This article details how to setup a rails application on a Linux VPS. Although Apache is typically used to proxy requests to Mongrel, Apache is very bloated, and is a memory hog. Many Rails applications nowadays use a previously unheard of web server called "nginx".
First, we need to install Yum:
rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/python-elementtree-1.2.6-4.i386.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/python-sqlite-1.1.6-1.i386.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/python-urlgrabber-2.9.6-1.noarch.rpm
rpm-Uvh
http://download.fedora.redhat.com/pub/fedora/linux/core/updates/4/i386/yum-2.4.1-1.fc4.noarch.rpm
|
This will make the installation of several other things we need to install faster. Now let's create a user to run our app off of. Root is not safe.
. To allow this user to sudo, we need to do the following:
type in "visudo". uncomment the line "%wheel ALL=(ALL) ALL". Type in ":write, and then :quit". This user can now sudo. now type in: passwd rails. You will be prompted to enter a new password for this user. Next, you need to log out. Log back in as that user. Use the password you just provided. Next we need to install ruby:
| sudo yum install ruby irb rdoc ruby-devel openssl |
Next Rubygems: (if no dir /usr/local/src, create it)
cd /usr/local/src
sudo wget http://rubyforge.org/frs/download.php/17190/rubygems-0.9.4.tgz
sudo tar -zxvf rubygems-0.9.4.tgz
cd rubygems-*
sudo ruby setup.rb
|
Now Rails: IF THIS FAILS THE FIRST TIME, TRY AGAIN. IT *WILL* WORK
sudo gem install rails --include-dependencies
|
Finally, before we install mongrel, we need to install gcc
Now we can install mongrel
sudo gem install mongrel mongrel_cluster gem_plugin --include-dependencies
|
We should now install mysql for ruby:
sudo gem install mysql
sudo yum install ruby-mysql
sudo yum install ruby-mysql.i386
(C Bindings)
|
Next we will create our rails app, setup the servers, configuration, and init.d scripts.