Ghost is a relatively new blog publishing platform. It started a 25,000-pound crowdfunding project on the crowdfunding platform kickstarter. Although WordPress is still the mainstream blogging tool on the Internet, it is now a general content management platform with many third-party development features. It has become so cumbersome and complex that it is difficult to maintain. But at the same time, just a few months after its birth, Ghost insisted on taking the user as the center to create a well-crafted user interface and promised to build a pure blog platform.
Install Ghost on Linux
Ghost is written using the Node. js framework. Therefore, you must first install the Node. js framework on your Linux system. Make sure that the Node. js version is 0.10 or later. Next, log on to the http://ghost.org (registration required) and then download the source code for the Ghost. Follow the steps below to install:
$ sudo mkdir -p /var/www/ghost$ sudo unzip ghost-0.3.3.zip -d /var/www/ghost$ cd /var/www/ghost$ sudo npm install --production
Configure Ghost before starting
Before starting Ghost, follow the steps below to create its configuration file at the/var/www/ghost/config. js location. Replace "YOUR_IP" with your host IP address ".
$ cd /var/www/ghost$ sudo cp config.example.js config.js$ sudo sed -i 's/127.0.0.1/YOUR_IP/g' config.js
Try to run Ghost in developer Mode
With this step, you can prepare to start Ghost.
Note that Ghost can run in two different modes: "Developer mode" and "user mode ". For the sake of security, Ghost stores the configuration files (/var/www/ghost/config. js) in two modes separately. For example, two different modes use different database files (for example, ghostdev. db and ghost. db in/var/www/content/data ).
Run the following command to start Ghost. Ghost runs in developer mode by default.
$ cd /var/www/ghost$ sudo npm start
After the Ghost runs successfully, the terminal will display the following output information, telling you that the Ghost is running at: 2368 (Translator's note: 2368 is the port number ).
In your local browser, type http: //: 2368. After identity verification, you will see the initial Ghost page.
Start Ghost as a user
After you confirm that the Ghost is running properly, press Ctrl + C to disable the Ghost in developer mode. Now you can start Ghost in user mode. When you run Ghost in user mode, you can use Node. js calls the forever module. The forever module allows you to run the Ghost with the daemon process, and allows you to run the Ghost with subsequent processes.
Install the forever module:
$ sudo npm install forever -g
Finally, you can run Ghost in user mode as follows:
$ cd /var/www/ghost$ sudo NODE_ENV=production forever start index.js
Check whether the database file of Ghost is successfully created in user mode (/var/www/ghost/content/ghost. db ).
You can also check the list of forever active processes:
$ Sudo forever list
Info: Forever processes running
Data: uid command script forever pid logfile uptime
Data: [0] cH0O/usr/bin/nodejs index. js 15355 15357/home/dev/. forever/cH0O. log 0: 0: 0: 37.741
If you see the above information, it means that the Ghost has been successfully executed and then the processes are running.
To stop the Ghost daemon, run the following command:
$ Cd/var/www/ghost
$ Sudo forever stop index. js