sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo reboot
sudo dpkg-reconfigure tzdata
sudo apt-get install ntp
sudo ntpdate ntp.ubuntu.com
date
sudo adduser ubuntu
sudo adduser ubuntu sudo
Edit /etc/sudoers
%sudo ALL=(ALL:ALL) ALL
ubuntu ALL=NOPASSWD: ALL
Edit /etc/profile
export PATH=/opt/ruby/bin:/opt/nginx/sbin:/opt/ruby/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export RAILS_ENV=production
export GEM_HOME=/opt/ruby/gems
export LC_ALL=en_US.UTF-8
Edit /etc/environment
PATH=/opt/ruby/bin:/opt/nginx/sbin:/opt/ruby/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RAILS_ENV=production
GEM_HOME=/opt/ruby/gems
LC_ALL=en_US.UTF-8
Edit /etc/sudoers
Defaults secure_path="/opt/ruby/bin:/opt/nginx/sbin:/opt/ruby/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
sudo apt-get install libmagickwand-dev libmysqlclient15-dev nodejs npm imagemagick libpq-dev
sudo apt-get install libyaml-dev libssl-dev libreadline-dev libxml2-dev libxslt1-dev libffi-dev build-essential
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.4.tar.gz
tar xvfz ruby-2.1.4.tar.gz
cd ruby-2.1.4/
./configure --prefix=/opt/ruby --disable-install-rdoc
make
sudo make install
sudo gem install bundler
sudo apt-get build-dep git-core
wget https://git-core.googlecode.com/files/git-1.8.5.4.tar.gz
tar xvfz git-1.8.5.4.tar.gz
cd git-1.8.5.4/
./configure
make
sudo make install
cd /opt
wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz
tar xvfz openssl-1.0.1j.tar.gz
sudo mv openssl-1.0.1j openssl
cd openssl/
./config
make
sudo make install
sudo mkdir /etc/vim/syntax
sudo curl http://www.vim.org/scripts/download_script.php?src_id=14376 -o /etc/vim/syntax/nginx.vim
cd /etc/vim
Download de the file https://gist.github.com/jtadeulopes/8978872
For more detail, see http://zduck.com/2012/syntax-highlighting-for-nginx-in-vim
Edit /etc/vim/vimrc
and add the lines below
set number
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
wget http://nginx.org/download/nginx-1.7.6.tar.gz
tar xvfz nginx-1.7.6.tar.gz
cd nginx-1.7.6/
./configure --prefix=/opt/nginx --with-http_ssl_module --with-openssl=/opt/openssl
sudo make
sudo make install
cd /opt/nginx/conf
sudo rm nginx.conf
Download the file https://gist.github.com/jtadeulopes/7237669
sudo mkdir /var/log/nginx
sudo mkdir sites-enabled
cd sites-enabled
Download the file https://gist.github.com/jtadeulopes/7237731
Or with SSL support https://gist.github.com/jtadeulopes/9189120
cd /etc/init
Download the file https://gist.github.com/jtadeulopes/7237115
Now, you can run:
sudo (start|restart|stop) nginx
sudo adduser deploy
su deploy
ssh-keygen -t rsa
See https://help.github.com/articles/generating-ssh-keys#platform-linux
sudo mkdir /var/www
sudo chown deploy:deploy -c -R /var/www
Capfile
https://gist.github.com/jtadeulopes/7249948
deploy.rb
https://gist.github.com/jtadeulopes/7249921
For each project, you must create the puma upstart file
cd /etc/init
Download the file https://gist.github.com/jtadeulopes/7254953
With the upstart for each project, you can run:
sudo (start|restart|stop) project
cd my/project/path/config
Download the file https://gist.github.com/jtadeulopes/7265503
sudo apt-get install monit
For each project, you must create the monit confg file
cd /etc/monit/conf.d
Download the file https://gist.github.com/jtadeulopes/7270279
Edit /etc/monit/monitrc
set daemon 60
Restart monit
sudo /etc/init.d/monit restart
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g bower