rails

Install Rails 3, Ruby 1.9, NginX and MongoDB on Debian Lenny

Let's start with setting up a developer account. Please note: ":developername" should be replaced with whatever your unix user name you want to be when developing ("irakli" in my case).

$ sudo groupadd webmaster
$ sudo /usr/sbin/useradd -g webmaster -m -s /bin/bash :developername

Once you have the username, install sudo if you don't already have it, add your username to sudoers using visudo and "sudo su - :developername". The rest of the tutorial will be run with that developer user, occasionally sudo-ing into root.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install vim
$ sudo apt-get install build-essential
$ sudo apt-get install python-software-properties
$ sudo apt-get install libssl-dev libreadline-dev
$ gcc -v
$ make -v

Install latest Git, using the instructions from a previous blog post

$ cd /usr/local/src
$ sudo wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
$ sudo tar xzvf ruby-1.9.2-p290.tar.gz
$ cd ruby-1.9.2-p290
$ sudo ./configure --enable-shared
$ sudo make && sudo make install
$ ruby -v
> ruby 1.9.2p290 (2011-07-09 revision 32553) 

Let's install RubyGems:

$ cd /usr/local/src
$ sudo wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.7.tgz
$ sudo tar xzvf rubygems-1.8.7.tgz 
$ cd rubygems-1.8.7
$ sudo ruby setup.rb 
$ gem --version
> 1.8.7
$ sudo gem install rubygems-update
$ sudo update_rubygems

After which installing Rails is as simple as:

$ sudo gem install rake
$ sudo gem install rails
$ sudo gem install bundler

Fixing Possible Errors

Installing Ruby On Rails 3 on CentOS with Nginx

This tutorial assumes that you are working with the local account on CentOS 5.x and sudo into root as necessary.

Configuring Yum

Yum is a popular package manager for CentOS and RedHat Linux distributions. Unfortunately, standard Yum repositories carry significantly outdated packages. Fortunately, there are third-party Yum repositories with more updated LAMP packages which we can use. One such repository is provided and hosted by RackSpace itself.

Python, Django and LAMPP

Disclaimer: the problem and the solution are not unique to LAMPP. If you have a MYSQL installation with uncommon paths, you will get a similar problem and you can solve it in a similar way. Just make sure you insert correct paths in the newly created .conf file for the LD (see below).

If, for whatever reason, you are running MySQL from your LAMPP installation and try to use Python's MySQLdb API to connect to MySQL server you will get the following nasty error into your face:

ImportError: libmysqlclient_r.so.15: cannot open shared object file

The problem is that lampp, in its attemt to not disturb the rest of the OS space, does not expose some crucial shared libraries (like: mysql client, ssl etc.) to Linux at large and Python is unable to find them even though they are installed under LAMPP.

The solution is quite easy

Syndicate content