Skip to content

Instantly share code, notes, and snippets.

@KarlGl KarlGl/VPS
Last active Aug 29, 2015

What would you like to do?
Steps to setup a VPS for general web stuff
In these examples my username is k
* Gain ssh access via "serial console" in the control pannel for one hour.
* Change root password with control pannel.
* useradd -s /bin/bash -m -d /home/k -g ssh k
on local machine:
* ssh-keygen -t rsa
* cat ~/.ssh/
on remote (as root):
* mkdir -p /home/k/.ssh && vim /home/k/.ssh/authorized_keys
* (paste key and save)
* vim /etc/ssh/sshd_config
* Add or uncomment this to the file and save it.
* PasswordAuthentication no
* restart ssh
* apt-get update
* apt-get install -y sudo
* usermod -a -G sudo k
* visudo
* add this to the top of the file
* Defaults rootpw
* Defaults:k timestamp_timeout=-1
* now to fix the locale shit:
* sh -c "echo 'LC_ALL=en_AU.UTF-8\nLANG=en_AU.UTF-8' >> /etc/default/environment"
Now you can exit, logout, and login without no password as non root user only from your computer.
* shh k@ip
* sudo apt-get install -y git man npm nodejs-legacy curl
* sudo chown k .ssh/
* ssh-keygen -t rsa
* cat .ssh/
* copy and paste key into
* git config --global "Karlgl"
* git config --global ""
Install Rails
* sudo apt-get install -y bundler postgresql libpq-dev
* sudo su postgres
* createuser k -d -S -R
Repo specific stuff
* git clone
* sudo npm install gulp -g
* npm install
* nohup gulp server &
Static file server
* apt-get install -y git nginx
* mkdir ~/www
* sudo vim /etc/nginx/sites-enabled/default
* scroll down within 'server' after 'location / {' add these lines:
* root /home/k/www;
can add backend services in here too, so that the frontend can request them over 80 with ajax... rewrite command will not pass the "sms_hour_backend" to the app as part of its path.
location /sms_hour_backend {
proxy_pass http://localhost:3000;
rewrite /sms_hour_backend/(.*) /$1 break;
* save and exit vim
* sudo nginx -s reload
* now can see any files in the www folder from a web browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.