Ubuntu Server automatically installs and deploys the Rails Environment

Source: Internet
Author: User

Do you need to install and deploy Rails to a new Web Server frequently?

Are you still experiencing the annoying installation process from installing Ruby Rubygems MySQL... to installing Web Server components?

Now you can use this script to deploy Ruby1.8 + Rails + Passenger + Nginx on the Ubuntu Server:

#! /Bin/sh


Echo "= YTRIPTHIRD Ubuntu INSTALL ="
Cd/tmp # Ruby
Echo "= Install Ruby library ..."
Sudo apt-get install g ++ ruby1.8 rubygems rake irb ruby1.8-dev build-essential libopenssl-ruby imagemagick rmagick
Echo "= Ruby library install done ."
Echo ""


# MySQL Server
Echo-n "Do you want install MySQL automation [y/n]:"
Read KEYcase $ KEY iny | Y)
Echo "= Install MySQL server ..."
Sudo apt-get install mysql-server mysql
;;
Esac
Sudo apt-get install libmysqlclient-dev
Echo "= MySQL install done ."
Echo ""


# Rubygems
Echo-n "Do you want install Rubygems? [Y/n]:"
Read KEYcase $ KEY iny | Y)
Echo "= Install Rubygems from source file ..."
Wget http://rubyforge.org/frs/download.php/60719/rubygems-1.3.5.zip
Unzip rubygems-1.3.5.zip
Cd rubygems-1.3.5 sudo ruby setup. rb sudo gem sources-a http://gems.github.com cd .. sudo rm-R/tmp/rubygems-1.3.5 echo "= Rubygems install done ."
;;
Esac
Echo ""


# Install Rails
Echo-n "Do you want install Rails? [Y/n]"
Read KEYcase $ KEY iny | Y)
Echo "= Install Rails and some Gems ..."
Sudo gem install rails passenger -- no-rdoc
Echo "= Rails install done ."
;;
Esac
Echo ""

# Install Web server
Echo "= Install Web Server"
Wget http://sysoev.ru/nginx/nginx-0.7.64.tar.gz
Tar zxf nginx-0.7.64.tar.gz
Echo ""
Echo "= *** Nginx install Warring! * ** ="
Echo "*** nginx source path:/tmp/nginx-0.7.64"
Echo "*** must be install nginx in:/etc/nginx"
Echo ""
Sudo passenger-install-nginx-module
Echo "= Web Server install done ."
Echo ""


This script is successfully tested on Ubuntu Server 9.04. However, you may need to make some minor adjustments to this script to adapt to your environment, such as Ruby and Rails...

Or you don't want to use Passenger + Nginx to deploy your Rails App, you can also modify the Install Web Server section.

Or you can add more class libraries in the first batch to install them ....

In short, this script is a reference example for you. Do not manually install the Rails App in the future, and organize your installation process into the Shell script. Then:

$ Sh install-Ubuntu.sh

It is easy to deal with all the processes, and you do not need to repeatedly Query Information on Google during each deployment!
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.