Login to VPS
ssh root@vps_host_ip
Change vim Comment color
Open vimrc file
sudo vim /usr/share/vim/vimrc
Add line below
hi Comment ctermfg=lightblue
Check and Set locale
locale
locale -a
Uncomment locale that you need (for example en_US.UTF-8, uk_UA.UTF-8)
sudo vim /etc/locale.gen
sudo dpkg-reconfigure locales
And choose en_US.UTF-8 from above
Add to .bashrc
export LC_ALL="en_US.UTF-8"
export LANGUAGE="en_US:en"
source .bashrc
sudo reboot
Login to VPS again and check your locale
Create and setup a new user
adduser deploy
Root Privileges
gpasswd -a deploy sudo
Key Authentication (from your local system)
ssh-add -l ==> List of available keys
ssh-add -D ==> Clean out all keys if you have a couple
ssh-add ~/.ssh/id_rsa ==> Add necessary key
ssh-copy-id deploy@SERVER_IP_ADDRESS
The corresponding private key can now be used to log into the server
Now try logging into the vps without password, with: ssh deploy@SERVER_IP_ADDRESS
Disallow remote ssh access to the root account
ssh deploy@SERVER_IP_ADDRESS
sudo vim /etc/ssh/sshd_config
Modify this below line to "no"
PermitRootLogin yes
Uncomment line below and set to 'no'
PasswordAuthentication yes
Type this to restart SSH:
sudo service ssh restart
Now you can login to vps by ssh deploy key ONLY
Add locales for 'deploy' user
Add to .bashrc
export LC_ALL="en_US.UTF-8"
export LANGUAGE="en_US:en"
source .bashrc
unlogin - login to system
locale
Install Ruby using rbenv
Update and install dependencies
sudo apt-get update
Install the dependencies required for rbenv and Ruby
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
Install git
sudo apt-get update
sudo apt-get install git
Install rbenv
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
Install ruby-build
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
Install plugin that lets you set global and project-specific environment variables
git clone https://github.com/rbenv/rbenv-vars.git $(rbenv root)/plugins/rbenv-vars
Setup ruby
rbenv install 2.3.0
rbenv global 2.3.0
ruby -v
gem install bundler --no-rdoc --no-ri
rbenv rehash
Install Postgresql
sudo apt-get install postgresql postgresql-contrib libpq-dev
Add new user of postgresql
sudo su - postgres OR sudo su postgres
createuser user_name -s
psql
\du
\password user_name
Install NodeJs
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
nodejs --version
Deploy your project to vps with capistrano https://gist.github.com/stadniklksndr/13fa12e1c0fdb713d2ea60b26dac4e26