I’ve been telling you a lot about Ruby on Rails but have I told you about how to set it up on your machine? Not at all. This is my chance to share my experience to you, but this time I’ll tell you about how to set it up on Ubuntu 10.04 (Lucid Lynx) or Ubuntu 11.04 (Natty Narwhal). The setup on these two OS is similar, so you don’t have to be confused about the version difference of Ubuntu. Now, let’s get into the point, these were the steps that I did :
- Update the packaging tool repository (apt) just to make every download fast. You can do it by changing the file in
- Please install some initial package that are needed for some action, by running this command :
sudo apt-get install build-essential openssl libreadline5 libreadline-dev git-core curl zlib1g zlib1g-dev
- Now let’s install RVM, by running this command :
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
- Go to your home directory (
cd ~) and open up file .bashrc by running :
- Please add this code inside the file :
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
- Now please close the terimnal and open it again to make the changes happened
- Next is ruby installation. I used REE, so I will show you how to install it. You can do it by running this command :
$> rvm install ree $> rvm --default ree
- Okay, your ruby has been installed and next is phusion passenger and application server installation. I used Nginx as my application server, so I did this to install those two things :
$> gem install passenger $> rvmsudo passenger-install-nginx-module
I used the default settings, so I just enter everything that prompted me. When you do this, you may find that you have to install somethings first. But it’s okay, because you will be shown what you have to do to install it. By running this command, you will also install the nginx. So you don’t have to worry about the nginx installation itself.
- I like using PostgreSQL as my RDBMS, so next is postgresql installation. Do it by running these command :
$> sudo apt-get install postgresql $> sudo -u postgres psql postgres #this command will bring you to postgre console \password postgres #this command is used to change password for user postgres. You will be prompted to enter new password. After that, quit the console. $> sudo apt-get install libpq-dev
- This is the main action, Ruby on Rails installation! Run this command to install it :
sudo gem install rails
- Later in the development, I like to use Paperclip which is need ImageMagick and RMagick Gem installation. But first, let’s install the imagemagick.
$> sudo apt-get install libjpeg62-dev $> sudo apt-get install libpng12-dev $> sudo apt-get install imagemagick $> sudo apt-get install libmagick9-dev
- You imagemagick has been installed and next, install rmagick. Do it by running these command :
$> sudo gem install rmagick $> irb -rubygems -r RMagick #this will lead you to ruby console puts Magick::Long_version #if you can see the version of RMagick after you run this command, that means the installation is successful
- To simplify your job to install gems in your Gemfile, you can use bundler. Install it by running :
sudo gem install bundler
That’s it, you have successfully installed Ruby on Rails on your Ubuntu. I hope this could help you doing it.