First, the installation of Node.js
Because Ghost is developed based on Node.js, it is necessary to install the Node.js environment, depending on how the system is installed in a slightly different way. Here's how to install the three most common branches of Linux:
1. Ubuntu and its derivative classes
The code is as follows |
Copy Code |
sudo apt-get update sudo apt-get install-y python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install Nodejs |
2, Redhat/centos, etc.
The code is as follows |
Copy Code |
See if there are any epel sources Yum Repolist If you do not install the following method and install Node.js RPM-UVH http://download-i2.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm Yum Install Nodejs NPM--enablerepo=epel |
3. Debian and its branches
code is as follows |
copy code |
sudo apt-get Install Python g++ make Checkinstall src=$ (mktemp-d) && cd $src wge T-n http://nodejs.org/dist/node-latest.tar.gz tar xzvf node-latest.tar.gz && CD node-v* ./configure fakeroot checkinstall-y--install=no--pkgversion $ (echo $ ( PWD) | Sed-n-re ' s/.+node-v (. +) $/1/p ') make-j$ (($ (Nproc) +1)) Install sudo dpkg-i node_* |
The CrunchBang Linux on my own notebook belongs to this class, which is performed dpkg-i Node-xxx.deb Checkinstall after the Node.js source package is generated by the Deb file first.
If it is a version of the system, refer to the method on the GitHub.
Second, the installation of Ghost
Ghost's Official download page is:
The code is as follows |
Copy Code |
# wget Https://en.ghost.org/archives/ghost-0.4.1.zip # Unzip Ghost-0.4.1.zip-d Ghost # CD Ghost # NPM Install--production |
Copy a copy of config.example.js for Config.js, change the 127.0.0.1 to 0.0.0.0 (if you use Nginx or Apache reverse proxy, the modification step can be omitted) use NPM to start the Ghost program
The code is as follows |
Copy Code |
[root@test174 ghost]# NPM start > ghost@0.4.1 start/tmp/ghost > Node Index Ghost is running in development ... www.111cn.net Listening on 0.0.0.0:2368 Url configured as:http://my-ghost-blog.com CTRL + C to shut down |
When completed, the front and rear interfaces are as follows:
Ghostfront
Ghostadmin
Third, Nginx reverse proxy
The Nginx reverse proxy is mentioned above, although node.js, like Tomcat, can be independent of the front-end Web, but often we do not. The configuration of the Nginx reverse proxy is as follows:
The code is as follows |
Copy Code |
server { Listen 0.0.0.0:80; server_name ghost.com; Access_log/var/log/nginx/ghost.com.log; Location/{ Proxy_set_header X-real-ip $remote _addr; Proxy_set_header HOST $http _host; Proxy_set_header X-nginx-proxy true; Proxy_pass http://127.0.0.1:2368; Proxy_redirect off; } } |
Error problems that may be encountered:
The code is as follows |
Copy Code |
> sqlite3@2.1.19 install/var/www/ghost/node_modules/sqlite3 > Node Build.js www.111cn.net [Sqlite3]: Checking for http://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.1.a-node-v11-linux-x64.tar.gz [Sqlite3]: error:eacces, open '/root/tmp/node-sqlite3-release/node_sqlite3-v2.1.a-node-v11-linux-x64.tar.gz ' NPM err! sqlite3@2.1.19 Install: ' Node Build.js ' NPM err! Exit Status 1 NPM err! NPM err! Failed at the sqlite3@2.1.19 install script. NPM err! This is most likely a problem with the Sqlite3 package, NPM err! Not with NPM itself. NPM err! Tell the author, this is fails on your system: NPM err! Node Build.js NPM err! You can get their info via: NPM err! NPM owner LS Sqlite3 NPM err! There is likely additional logging output above. NPM err! System Linux 3.2.0-4-amd64 NPM err! Command "/usr/local/bin/node" "/USR/LOCAL/BIN/NPM" "Install" "--production" NPM err! Cwd/var/www/ghost NPM err! Node-v v0.10.26 NPM err! Npm-v 1.4.3 NPM err! Code elifecycle NPM err! NPM err! Additional logging details can be found in: NPM err! /var/www/ghost/npm-debug.log NPM err! Not OK Code 0 |
The error message above is the one I encountered while CrunchBang Linux (the branch of Debian) and I did not experience this problem in the CentOS test environment. The workaround is as follows:
Verify that the Sqlite-devel package is installed before you install it, and then perform the following steps:
code is as follows |
copy code |
npm install-g node-gyp npm install sqlite3--build-from-source & nbsp NPM Install--production |