Skip to content

Instantly share code, notes, and snippets.

@delputnam
Last active December 26, 2015 18:36
Show Gist options
  • Save delputnam/64ba97380ed299aa8327 to your computer and use it in GitHub Desktop.
Save delputnam/64ba97380ed299aa8327 to your computer and use it in GitHub Desktop.
# Tailored for default debian host on Google Cloud Compute,
# but should work for most Ubuntu/Debian systems.
# Be sure to replace 'example.com' with your URL.
# install zip, vim and wget
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y zip vim wget
# install nodejs 0.10.xx
curl -sL https://deb.nodesource.com/setup_0.10 | sudo -E bash -
sudo apt-get -y install nodejs
# install ghost
curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
sudo mkdir /var/www
sudo apt-get -y install unzip
sudo unzip -uo ghost.zip -d /var/www/ghost
cd /var/www/ghost && sudo npm install --production
sudo cp config.example.js config.js
sudo sed -i -- 's/my-ghost-blog\.com/example\.com/g' config.js
# -or- use vim /var/www/ghost/config.js
# to change the blog URL to match yours
#install nginx
sudo apt-get -y install nginx
sudo bash -c "cat > /etc/nginx/sites-available/ghost.conf" << 'EOF'
server {
listen 80;
server_name example.com;
client_max_body_size 1024M;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
}
EOF
sudo rm /etc/nginx/sites-available/default
sudo rm /etc/nginx/sites-enabled/default
sudo rm /etc/nginx/conf.d/default
sudo ln -s /etc/nginx/sites-available/ghost.conf /etc/nginx/sites-enabled/ghost.conf
sudo service nginx restart
sudo update-rc.d nginx defaults
# setup ghost service
sudo curl https://raw.githubusercontent.com/TryGhost/Ghost-Config/master/init.d/ghost \
-o /etc/init.d/ghost
sudo useradd -r ghost -U
sudo chown -R ghost:ghost /var/www/ghost
sudo chmod 755 /etc/init.d/ghost
sudo update-rc.d ghost defaults
sudo update-rc.d ghost enable
sudo adduser USERNAME ghost
# You can now use:
sudo service ghost start
# sudo service ghost stop
# sudo service ghost restart
# sudo service ghost status
# set up git
sudo apt-get -y install git-core
mkdir repo-name.git
cd repo-name.git
git init --bare
# on local machine
git remote rm origin
git remote add origin ssh://[email protected]/~/repo-name.git
git push origin --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment