Operating system overview
OS: CentOS 7
OS Configuration: Minimal Install
Install required packages
Add Node.js and Yarn repository
wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
Install and configure Node.js and Yarn
npmare not recommended since it's old and not stable enough during installation. So here I chose Yarn as the Node.js package manager.
yum install nodejs yarn -y
npm -g bin // Output: /usr/bin yarn global bin // Output: /usr/local/bin yarn config set prefix /usr // Change yarn prefix to npm prefix
Prepare account & permission setup
Create user account
Since the Ghost 1.2 update, a new tool Ghost-cli is introduced as a Ghost blog installer and manager. If your are not running root as your only server managment user, please ignore the next step. Place [username] with your own desired user name.
Set up permission
Next up we will grant the created user sudo permission.
usermod -aG wheel [username]
Create Ghost installation folder
Ghost have to be deployed somewhere in your server with Ghost-cli. And we are going to create a folder for deployment with correct permission. Officially recommended path is /var/www/ghost.
su - [username] cd /var/www sudo mkdir ghost sudo chown [username]:[username] ghost/ sudo chmod 775 ghost/
Start Ghost installation
yarn global add [email protected]
Install Ghost blog
Since CentOS 7 are not officially supported in Ghost docs, we have to follow a special guide for installation.
cd /var/www/ghost ghost install --db=sqlite3 // If you want to use MySQL, remove --db=sqlite3 option
And Ghost-cli will download and install for you.
Remember not to start Ghost blog when Ghost-cli prompts to start the systemd service of your newly deployed blog. Just start it later mannually or it will show ERR!.