Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save djrobby/c96bed2726902c20475440d314b1bb6e to your computer and use it in GitHub Desktop.
Save djrobby/c96bed2726902c20475440d314b1bb6e to your computer and use it in GitHub Desktop.
Setting up a general web dev Ubuntu VPS
# Startup script for Ubuntu 17.04 VPS on Vultr (Dev machine and cloud server)
# add a new user @todo: make this a one-liner
# adduser stvhwrd
# usermod -aG sudo stvhwrd
# OPTIONAL: to add ssh key, assuming that you have ssh-copy-id installed on local machine and your keypair is in ~/.ssh and named id_rsa:
# Locally, i.e. on your laptop. eg. ssh-copy-id stvhwrd@
ssh-copy-id stvhwrd@<IP_ADDRESS_OF_SERVER>
# log in with ssh key
# eg. ssh stvhwrd@
ssh stvhwrd@<IP_ADDRESS_OF_SERVER>
# install some useful bits
sudo apt update && sudo apt full-upgrade -y;
sudo apt install -y git zsh wget curl rbenv curl mosh tree vim tmux git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev;
cd $HOME
git clone ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
# check for latest version of ruby at
rbenv install 2.4.1
rbenv global 2.4.1
ruby -v
# enable firewall
sudo ufw app list;
sudo ufw allow OpenSSH;
sudo ufw allow mosh;
sudo ufw enable;
# configure git -- don't forget to add the RSA key to GitHub, GitLab, etc.
git config --global color.ui true;
git config --global "Stevie Howard";
git config --global "";
ssh-keygen -t rsa -b 4096 -C "";
echo "after adding the SSH key to your GitHub account, run `ssh -T` to test the connection.";
# install NodeJS
curl -sL | sudo -E bash -;
sudo apt install -y nodejs;
# install Yarn package manager
curl -sS | sudo apt-key add -;
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list;
sudo apt update && sudo apt install -y yarn;
# install MySQL
sudo apt -y install mysql-server mysql-client libmysqlclient-dev;
# install PostgreSQL
sudo sh -c "echo 'deb xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - | sudo apt-key add -;
sudo apt update && sudo apt install -y postgresql-common;
sudo apt install -y postgresql-9.5 libpq-dev;
sudo -u postgres createuser stvhwrd -s;
# install Rails (make sure that rbenv is finished installing Ruby, first)
gem install -V rails;
rbenv rehash;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment