Created
May 17, 2013 19:32
-
-
Save hudsonmaradona/5601419 to your computer and use it in GitHub Desktop.
Script Install Web Server - Ngnix + Unicorn + Ruby 2.0 + PostgreSQL 9.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# PATH | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
# Store the base dir | |
BASEDIR=$( cd $(dirname $0); pwd) | |
# Get all dependencies | |
echo "" | |
echo "Update & Upgrade Server Ubuntu" | |
echo "" | |
sudo apt-get -y update && sudo apt-get -y upgrade | |
echo "" | |
echo "Clean Instalation Ubuntu" | |
echo "" | |
sudo apt-get autoremove && sudo apt-get autoclean | |
echo "" | |
echo "Install Packages and Libs" | |
echo "" | |
sudo apt-get -y install build-essential vim openssl curl git git-core libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev zip unzip libpcre3 libpcre3-dev make g++ autoconf automake imagemagick python-software-properties | |
sudo apt-get -y install bison libc6-dev libffi-dev libreadline6 libreadline6-dev libsqlite3-dev libtool libxml2-dev libxslt-dev libxslt1-dev libyaml-dev ncurses-dev zlib1g zlib1g-dev libreadline-dev flex libpq-dev memcached | |
sudo apt-get -y install linux-headers-$(uname -r) libcurl4-openssl-dev libmagickwand-dev ufw htop atop | |
# Install Firewall | |
echo "" | |
echo "Firewall Ubuntu UFW" | |
echo "" | |
sudo ufw default deny | |
sudo ufw enable | |
sudo ufw logging on | |
sudo ufw allow ssh | |
sudo ufw allow www | |
# Install PostgreSQL 9.2 | |
echo "" | |
echo "Install PostgreSQL 9.2" | |
echo "" | |
sudo add-apt-repository ppa:pitti/postgresql && sudo apt-get update && sudo apt-get install postgresql-9.2 | |
# Install LibYAML | |
echo "" | |
echo "Install LibYAML" | |
echo "" | |
mkdir ~/install | |
cd ~/install | |
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz | |
tar -zxf yaml-0.1.4.tar.gz | |
cd yaml-0.1.4 | |
./configure && make && sudo make install | |
# Install NodeJs | |
echo "" | |
echo "Install NodeJs" | |
echo "" | |
sudo add-apt-repository ppa:chris-lea/node.js | |
sudo apt-get update && sudo apt-get install nodejs | |
# Install Ruby 2.0.0 | |
echo "" | |
echo "Install Ruby 2.0.0p0" | |
echo "" | |
cd ~/install | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz | |
tar xzvf ruby-2.0.0-p0.tar.gz | |
cd ruby-2.0.0-p0 | |
./configure && make && sudo make install | |
echo "" | |
echo "Gem Update System" | |
echo "" | |
# Gem Update | |
sudo gem update --system | |
sudo gem install bundle | |
sudo gem install unicorn | |
echo "" | |
echo "Install Ngnix" | |
echo "" | |
cd ~/install | |
wget -O - http://nginx.org/keys/nginx_signing.key | sudo apt-key add - | |
touch nginx.list | |
echo "deb http://nginx.org/packages/ubuntu/ precise nginx" >> nginx.list | |
echo "deb-src http://nginx.org/packages/ubuntu/ precise nginx" >> nginx.list | |
sudo cp ~/install/nginx.list /etc/apt/sources.list.d/ | |
sudo apt-get update -y | |
sudo apt-get install -y nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Path to new Ruby version
ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz