Skip to content

Instantly share code, notes, and snippets.

@acburdine
Created November 16, 2017 13:22
Show Gist options
  • Save acburdine/3e0ad63dfb708cc744133d2daa658122 to your computer and use it in GitHub Desktop.
Save acburdine/3e0ad63dfb708cc744133d2daa658122 to your computer and use it in GitHub Desktop.
ghost-cli-droplet-init
#!/bin/bash
# Upgrade things initially
apt update && apt upgrade -y
# Add Yarn repo
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# Install NodeJS 8 package repo (runs apt update in the script which is why we add yarn first)
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
# Add some stuff so mysql doesn't prompt (see https://stackoverflow.com/questions/7739645/install-mysql-on-ubuntu-without-password-prompt)
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password password'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password password'
# Install ALL THE THINGS
apt install -y nginx mysql-client mysql-server yarn nodejs
# Add the user account (see https://askubuntu.com/questions/319714/proper-way-to-add-a-user-account-via-bash-script)
useradd mynewuser -s /bin/bash -m -g acburdine -G sudo
sudo chpasswd << 'END'
acburdine:password
END
# Clone repo
cd /home/acburdine
sudo -u acburdine git clone https://github.com/acburdine/Ghost-CLI-1 cli
cd /home/acburdine/cli
sudo -u acburdine yarn install
# Create ghost install dir
mkdir -p /var/www/ghost
chown -R acburdine:acburdine /var/www/ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment