Install & configure ghost

Installing ghost on linux (official)
Compiling nodejs

cd /ffp/opt/
rm -r ghost
#rm ghost.zip
#curl -L -k https://ghost.org/zip/ghost-latest.zip -o ghost.zip
unzip -uo ghost.zip -d ghost
cd /ffp/opt/ghost
find . -type f -exec sed -i s/"\/usr\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \;
find . -type f -exec sed -i s/"\/usr\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \;
find . -type f -exec sed -i s/"\/usr\/bin\/env"/"\/ffp\/bin\/env"/ {} \;
find . -type f -exec sed -i s/"\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \;
find . -type f -exec sed -i s/"\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \;
find . -type f -exec sed -i s/"\/bin\/env"/"\/ffp\/bin\/env"/ {} \;
find . -type f -exec sed -i s/"\/ffp\/ffp\/"/"\/ffp\/"/ {} \;
#cp -r /ffp/opt/ghost ~/temp/ghost
/ffp/opt/nodejs/bin/npm install --production

#ERROR1:
	sh: /usr/local/zy-pkgs/ffproot/ffp/opt/ghost/node_modules/sqlite3/node_modules/.bin/node-pre-gyp: /usr/bin/env: bad interpreter: No such file or directory
#SOLUTION1:
	#See something like https://registry.npmjs.org/sqlite3/2.2.7 in error message.
	cd ~/temp
	wget http://registry.npmjs.org/sqlite3/-/sqlite3-2.2.7.tgz
	mkdir sqlite3-2.2.7
	cd sqlite3-2.2.7
	cp ../sqlite3-2.2.7.tgz .
	tar xvzf ./sqlite3-2.2.7.tgz
	rm sqlite3-2.2.7.tgz
	find . -type f -exec sed -i s/"\/usr\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \;
	find . -type f -exec sed -i s/"\/usr\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \;
	find . -type f -exec sed -i s/"\/usr\/bin\/env"/"\/ffp\/bin\/env"/ {} \;
	find . -type f -exec sed -i s/"\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \;
	find . -type f -exec sed -i s/"\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \;
	find . -type f -exec sed -i s/"\/bin\/env"/"\/ffp\/bin\/env"/ {} \;
	find . -type f -exec sed -i s/"\/ffp\/ffp\/"/"\/ffp\/"/ {} \;
	tar czf sqlite3-2.2.7.tgz package
	npm install sqlite3-2.2.7.tgz

cd /ffp/opt/ghost
/ffp/opt/nodejs/bin/npm install --production
npm install forever -g
npm install mysql -g
cd /ffp/opt/nodejs/lib/node_modules
find . -type f -exec sed -i s/"\/usr\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \;
find . -type f -exec sed -i s/"\/usr\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \;
find . -type f -exec sed -i s/"\/usr\/bin\/env"/"\/ffp\/bin\/env"/ {} \;
find . -type f -exec sed -i s/"\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \;
find . -type f -exec sed -i s/"\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \;
find . -type f -exec sed -i s/"\/bin\/env"/"\/ffp\/bin\/env"/ {} \;
find . -type f -exec sed -i s/"\/ffp\/ffp\/"/"\/ffp\/"/ {} \;

#Create mysql DB for ghost
mysql -p
CREATE DATABASE ghost CHARACTER SET utf8;
GRANT ALL ON ghost.* TO 'ghost'@'%' IDENTIFIED BY 'ghost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

sed -i s#\"\/shared\/img#\"\/blog\/shared\/img# /ffp/opt/ghost/core/built/scripts/ghost-dev.js	 	 
sed -i s#\"\/shared\/img#\"\/blog\/shared\/img# /ffp/opt/ghost/core/built/scripts/templates-dev.js	 	 
sed -i s#\"\/shared\/img#\"\/blog\/shared\/img# /ffp/opt/ghost/core/built/scripts/ghost.min.js

#/ffp/opt/ghost/config.js
	url: 'http://adrhc.go.ro/blog',
	database: {
		client: 'mysql',
		connection: {
			host: 'localhost',
			user: 'ghost',
			password: 'ghost',
			database: 'ghost',
			charset: 'utf8'
		}
	},

#Apache config:
#	ProxyPass			/blog/			http://127.0.0.1:2368/blog/
#	ProxyPassReverse	/blog/			http://127.0.0.1:2368/blog/

#Running ghost in production mode:
cd /ffp/opt/ghost
NODE_ENV=production npm start
#Running ghost in development mode:
cd /ffp/opt/ghost
npm start
#Running ghost in production mode (first put export NODE_ENV=production in ~/.profile):
cd /ffp/opt/ghost
/bin/nice --8 npm start
#Running ghost in production mode (first put export NODE_ENV=production in ~/.profile):
cd /ffp/opt/ghost && /bin/nice --8 forever -o /ffp/var/log/ghost.log start index.js
#cd /ffp/opt/ghost && forever stop index.js

posts page
login page

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.