Sunday, July 25, 2010

Rails Server Deployment - Ruby, Rails, ImageMagick, MySQL, Nginx Installation and configuration

Ruby Rails Server Deployment Instructions

This isn't totally new, Its there everywhere. Just thought of keeping it a compiled note.
(this is scraped from my notes)
I've used a Ubuntu 9.10 Server to install...




Install Ruby 1.9.1, Rails 2.3.5, ImageMagick, MySql 5.1
----------------------------------------------------
Install Gcc :
apt-get install gcc

Install Zlib (optional) :
wget http://zlib.net/zlib-1.2.5.tar.gz
tar zxvf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure
make
sudo make install


Install Openssl(optional)
wget http://mirrors.isc.org/pub/openssl/source/openssl-0.9.8g.tar.gz
tar zxvf openssl-0.9.8g.tar.gz
cd openssl-0.9.8g
./config
make
make install


Ruby 1.9.1
apt-get install libopenssl-ruby1.9.1 libssl-dev

wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz
tar zxvf ruby-1.9.1-p376.tar.gz
cd ruby-1.9.1-p376

For Including Openssl and Zlib
------------------------------
vi ruby-1.9.1-p376/ext/Setup
#openssl (uncomment it)
#zlib (uncomment it)

Installation
------------
./configure
make
sudo make install


Verify Ruby Installation
----------------------
whereis ruby

ruby -v
gem -v



Install ImageMagick
apt-get install imagemagick

NOTE: If any problem occurs with the above step... then run this one also.
apt-get install graphicsmagick-imagemagick-compat


Verify ImageMagick Installation
-------------------------------
whereis identify
whereis convert
convert logo: logo.gif

Install RMagick

apt-get install libmagick9-dev
sudo gem install rmagick


Install Rails and other required gems

gem update --system
gem install rails -v=2.3.5

sudo gem install mysql --source http://gems.rubyinstaller.org



Install MySQL Server 5.1
sudo apt-get install mysql-server-5.1
sudo apt-get install libmysqlclient16-dev

Verify MySQL Installation
mysql --version
mysql Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (x86_64) using EditLine wrapper
whereis mysql
ps -ef | grep mysql
mysql -uroot -p

Create User in MySQL and set Privileges
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON . TO 'monty'@'localhost' WITH GRANT OPTION;

Memcached, Nginx and Mongrel Cluster

http://articles.slicehost.com/2009/3/11/ubuntu-intrepid-nginx-rails-and-mongrels

Install nginx
sudo apt-get install apache2-utils
sudo aptitude install nginx
sudo /etc/init.d/nginx start

Verify nginx Installation

Install Mongrel and Mongrel Cluster
sudo gem install mongrel -v 1.2.0.pre2 --pre --source http://rubygems.org
sudo gem install gem_plugin
sudo gem install fastthread cgi_multipart_eof_fix daemons

sudo gem install mongrel_cluster

mongrel_rails cluster::configure -e production -p 8000 -N 2 -c /home/demo/public_html/testapp -a 127.0.0.1
mongrel_rails cluster::start
mongrel_rails cluster::restart
mongrel_rails cluster::stop

0 comments:

Post a Comment