My VPS providers of choice

I like http://digitaloceancom and They've been good to me and reliable. :-D.

Digital Ocean

64-bit 12.04 LTS or 14.04 image.

I like to start off by giving my VPS a domain name such as <>.

Then I ssh

After I enter the generated password I immediately create a new user with sudo privileges.

adduser ${USER}
adduser ${user} sudo # or wheel if sudo doesn't exist

Locally I edit my ~/.ssh/config

User ${USER}
# Port 2222

Then I log in with the new user and test the sudo access by installing good stuff and editing the sshd_config

ssh-copy-id ${SERVER}
rsync -avhHPz ~/.gitconfig ${SERVER}:~/
rsync -avhHPz ~/.vimrc ${SERVER}:~/
rsync -avhHPz ~/.vim/ ${SERVER}:~/.vim/
rsync -avhHPz ~/.jshintrc ${SERVER}:~/
ssh ${SERVER}

cat ~/.ssh/authorized_keys

sudo apt-get update
sudo apt-get install --yes \
  vim \
  fail2ban \

sudo update-alternatives --config editor

And next I edit sshd_config

sudo vim /etc/ssh/sshd_config

These get changed

#Port 2222
PermitRootLogin no
PasswordAuthentication no

restart ssh

sudo service ssh restart

sudo apt-get install --yes \
  rsync \
  wget \
  curl \
  git \
  htop \


sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish

sudo chsh -s $(which fish) $(whoami)

And log back in (by hitting up to reveal the previous command and then enter)

ssh ${SERVER}


tar xvf node-${NODEVER}-linux-x64.tar.gz
rm node-${NODEVER}-linux-x64/{LICENSE,ChangeLog,}
sudo rsync -avhHP node-${NODEVER}-linux-x64/ /usr/local/

# for vim, etc
npm install -g \
  jshint \

# for quick development
npm install -g \
  yo \

# for manual tinkering
npm install -g \
  jade \
  less \
  pakmanager \
  uglify-js \
  grunt-cli \


echo "--no-rdoc --no-ri" >> ~/.gemrc
\curl -L | bash -s stable --ruby
source /home/aj/.rvm/scripts/rvm

# compass for yo
gem install sass



I find that if I don't manually set the locale for my VPSes, it won't be set and then I get a bunch of perl errors.

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8

dpkg-reconfigure locales

Absolute Essentials

I've had at least one case where the repositories had been left empty, so it's always good to check:

cat universe /etc/apt/sources.list
# you should see these two sources listed in the file
#deb lucid main universe multiverse
#deb lucid-security main universe multiverse
# you may or may not want to add regular updates in addition to security updates
#deb lucid-updates main restricted universe multiverse

sudo apt-get update

sudo apt-get install -y \
  ssh \
  rsync \
  fail2ban \

user accounts & security

Replace myuser with the name of the user you wish to create.

You will be prompted to enter user profile details. You can just leave everything blank, but I like to put my name.

adduser ${USER}

After you put in your name you can just leave the rest blank.

adduser ${USER} sudo
exit # leave the VPS and get back to your own system

Now back on your own computer test the account and copy over your favorite user preferences.

Change myuser and to your user name and your domain / website name (or your IP address if you haven't managed your DNS yet).


rsync -avh ~/.vimrc ${USER}@${VPS}:~/.vimrc
rsync -avh ~/.gitconfig ${USER}@${VPS}:~/.gitconfig

You should never login as root. Now that your user is set up and tested working, root should be disabled right away.

ssh ${USER}@${VPS}

sudo vim /etc/ssh/sshd_config

Look for the line with PermitRootLogin yes and change it to PermitRootLogin no. WARNING: never do this from the root account. Always do it from your user account.

sudo service ssh restart

Change to your hostname / domain / website (even if you haven't configured it yet in DNS)
sudo hostname ${VPS}
sudo bash -c "echo ${VPS} > /etc/hostname"

Now change your default editor to your editor of choice (which should be vim).

update-alternatives --config editor

Bare Bones

sudo apt-get install -y \
  bash-completion \
  command-not-found \
  man-db \
  psmisc \

#  dialog \

sudo tasksel
# Basic Server - 1
# SSH Server - 12

# remove other stuff - apache5, mysql, samba, postfix, sendmail, etc


if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion

basic utils

sudo apt-get install -y \
  htop \
  iftop \
  dnsutils \
  ntpdate \
  curl \
  wget \
  ssh \
  fail2ban \

sudo ntpdate
# note, some VPSes don't allow setting the time

development tools

sudo dd if=/dev/zero of=/128mb.swap bs=1M count=128
sudo mkswap /128mb.swap
sudo swapon /128mb.swap
# node, some VPSes don't allow swap

sudo apt-get install -y \
  git-core \
  build-essential \
  cmake \
  libssl-dev \
  gitosis \

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local


# Aliases
alias ll='ls -lah'
alias grep='grep --color=auto'

# For user@host.domain.tld:/path/to/curdir shows user@host:curdir, colorized
export CLICOLOR=1
export PS1="\[\e[1;34m\]\u\[\e[0;37m\]@\[\e[0;32m\]\h\[\e[0;37m\]:\[\e[0;35m\]\W\[\e[0m\] \$ "


mkdir ~/Code
cd ~/Code
git clone git://
cd node
git checkout v0.4.12
rm -rf ~/Code/node/*
git checkout v0.4.12 ./
#./configure --prefix=/usr/local
# make -j 4
# make install
make -f Makefile.cmake
cd ~/Code/node/build
sudo make install

cd ~/
curl | sudo sh

sudo npm install -g \
  validate-json \
  uglify-js \
  ender \

# TODO package mkjs

git clone git:// ~/webapps
sudo mv ~/webapps /var/webapps
ln -s /var/webapps ~/webapps
cd ~/webapps
cp config.default.js config.js
mkdir -p vhosts
npm install
# /etc/init/webapps.conf must not be a symlink
sudo cp ~/webapps/webapps.conf /etc/init/webapps.conf

Load webapps into ~/webapps/vhosts/, test that they work, and start the webapps service.

TODO: github hooks

By AJ ONeal

If you loved this and want more like it, sign up!

Did I make your day?
Buy me a coffeeBuy me a coffee  

(you can learn about the bigger picture I'm working towards on my patreon page )