how to install Ruby on Rails on fresh CentOS 5.0
Posted by Olek Poplavsky on December 13, 2007 at 12:43 AM
Well, here it is: I have to install Ruby on Rails app on fresh slice from slicehost.com, and this time I will use CentOS. And I know nothing about CentOS, and last time I used RedHat was around 8 years ago...
First - a reference - I found almost all information that I needed here: http://bryan.squall.us/posts/65
Here is my slightly modified script:
ssh -l root SERVER.IP.OR.NAME
yum update
yum install man wget
yum groupinstall "Development Tools"
yum install postgresql-devel
yum install ruby ruby-devel rdoc
yum install ruby-devel
wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz
tar xfvz rubygems-0.9.4.tgz
cd rubygems-0.9.4
ruby setup.rb
gem update --system
gem install rails --version 1.2.6
gem install mongrel
gem install ruby-postgres
adduser www
passwd www
first post on public weblog; setting up fresh gentoo on slicehost with rails
Posted by Olek Poplavsky on July 08, 2007 at 02:12 PM
So, here is is, my first post on this sparkling new blog of my own.
As I was setting blog up on fresh slice of slicehost, I found that there were number of instructions around how to do it, but none of them started from the very beginning, and they are mostly not based on Gentoo. So, I decided to write my own short guide on how to install initial rails environment on Gentoo.
I understand that people that dare to use Gentoo have good knowledge of basic building blocks, and personal preferences on them. This guide is just that, guide,not too detailed, without too many words to distract, and by no means foolproof. If you do not know what is Gentoo, you might be better off using some easier distribution, like Ubuntu. If you know and like Gentoo, I have to tell you that it is nice to use it on slicehost, with all the burstable raw CPU power.
Lets get started.
First, of course, buy a slice from slicehost ;) I got 256M one, and so far I liked it.
ssh to slice by IP and change root password:
ssh -lroot xx.xx.xx.xx
passwd
Login to slicehost manager and create your DNS entries (unless somebody else manages them). Create only one entry per domain ( for example, one entry for "woodenbits.com", and another one for "suretask.com"), than create aliases within those domains ("www", "blog", "svn" for woodenbits.com etc).
Now, back to ssh.
Add USE flags to your system:
USE="apache2 ruby ssl mysql postgres sqlite3 imagemagick gif jpeg jpeg2k png tiff svg wmf xpm pdf truetype unicode"
Optional, but recommended step - instal screen utility and start it
emerge screen
screen -h 9999
Upgrade your gentoo with fresh code out there:
emerge portage
emerge --update --deep --newuse world
Last step takes looong time, better run t overnight. Detach from screen session by pressing "ctrl-a d", than log out of ssh.
Come back next morning, ssh back to yuor slice, reattach your screen session with
screen -x
Merge all config files (about 29 of them):
etc-update
Keep your hostname config, it seems to be OK to replace rhe rest of them with updated version automatically.
Just in case, close shells in your screen session, that will exit it, than perform soft reboot from slicehost manager. That takes just seconds.
Ssh in there again, start screen again, and lets continue:
emerge ruby rubygems sqlite --ask
If you are planning on using pound for load balancing, get it:
emerge openssl pound --ask
If pound is still masked, unmask it so that emerge dares to install it: nano /etc/portage/package.unmask Add line
~www-servers/pound-2.3.2
Lets unmask newer versions of apache 2.2 and postgres 8.2 and install it
site ~ # more /etc/portage/package.keywords
~www-servers/pound-2.3.2
~net-www/apache-2.2.4
~app-admin/apache-tools-2.2.4
~dev-libs/apr-1.2.8
~dev-libs/apr-util-1.2.8
~dev-db/postgresql-8.2.4
~dev-db/libpq-8.2.4
site ~ # more /etc/portage/package.unmask
net-www/apache
app-admin/apache-tools
dev-libs/apr
dev-libs/apr-util
emerge subversion postgresql --ask
emerge --config =postgresql-8.2.4-r1
emerge --config =dev-util/subversion-1.3.2-r4
Now, lets start with rubygems installations
gem update --system
gem install rails mongrel mongrel_cluster postgres sqlite3-ruby -y
Lets get capistrano, it is going to make our life easier down the road.
gem install termios capistrano
Again, this is optional task, but those utilities are sooooo useful.
emerge vim sudo slocate --ask
locate -s
Create your subversion users list and first user, than create svn repository.
htpasswd2 -c /var/svn/conf/svnusers USER_NAME
svnadmin create --fs-type fsfs /var/svn/repos/YOUR_SVN_ROOT
chown -R apache.apache repos
Now, configure your apache, there are some excellent guides out there, I will not cover it here - call me lazy if you wish ;)
Tell gentoo to load apache on startup:
rc-update add apache2 default
rc
At this point you should have functioning system, and you can start deploying you rails applications there. Have fun doing it!