How to Install Centos Ruby on Rails for 1.9.2 Apache
Download, install and update the Ruby, Ruby Gems, Sqlite and Passenger software packages to enable Ruby on Rails 1.9.2 programs in Apache. The Ruby scripting language simple syntax enables Web developers to create and deploy rich, interactive, maintainable applications quickly within the Ruby on Rails framework. Use the Centos Linux command line to install and configure all software packages required to run Ruby on Rails for Apache.
Things You'll Need
- Computer with Centos Linux version 5.4 or greater that has the Apache Web server installed
- Centos Linux root password
Instructions
-
Install Ruby 1.9.2
-
1
Open a command line terminal on a Centos Linux computer. Enter “su – root” at the command prompt and press “Enter.” Type the root password when prompted and tap “Enter.”
-
2
Type “yum install httpd-devel openssl-devel zlib-devel gcc gcc-c++ curl-devel expat-devel gettext-devel mysql-server mysql-devel –y” at the command prompt and press “Enter.”
-
-
3
Type “cd /usr/local/src” at the command prompt and tap “Enter.” Enter “curl –O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz” on the command line and touch the “Enter” key.
-
4
Enter “cd ruby-1.9.2-p180.tar.gz” at the command prompt and press “Enter.” Type “./configure --enable-shared --enable-pthread” on the command line and press “Enter.”
-
5
Type “make” at the command prompt to compile the Ruby software and press “Enter.” Write “make install” on the command line and tap “Enter.”
-
6
Enter “cd ext/zlib/” on the command line and press “Enter.” Write “ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib” at the command prompt and tap “Enter.”
-
7
Type “cd ../../” on the command line to move the command prompt up two directories.
-
8
Enter “make” and press “Enter” at the command prompt. Type “make install” on the command line and touch the “Enter” key.
Install Ruby Gems
-
9
Type “wget https://rubyforge.org/frs/download.php/74922/rubygems-1.8.4.tgz --no-check-certificate” on the command line and press “Enter” to download RubyGems source code.
-
10
Enter “tar xzvf rubygems-*.tgz” at the command prompt and tap “Enter.” Type “cd rubygems-*” on the command line and press “Enter.”
-
11
Type “ruby setup.rb” at the command prompt and tap “Enter.” Write “cd ..” at the command prompt and press “Enter.”
-
12
Enter “gem update –system” at the command prompt and tap the “Enter” key. Type “gem update” on the command line and press “Enter.”
-
13
Type “gem install rails” at the command prompt and press “Enter.”
Install Sqlite and Passenger
-
14
Type “yum install sqlite-devel” on the command line and press “Enter.”
-
15
Write “gem install sqlite3-ruby” at the command prompt and tap “Enter.”
-
16
Enter “gem install passenger” on the command line and tap “Enter.”
-
17
Write “passenger-install-apache2-module” at the command prompt and press “Enter.”
Modify Apache Configuration
-
18
Type “vi /etc/httpd/conf/httpd.conf" at the command prompt and press "Enter.” Use the “Arrow” keys to move the cursor to an empty line at the bottom of the text document.
-
19
Press “I” and type the following into the text document:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7
PassengerRuby /usr/local/bin/ruby -
20
Press the spacebar and type the following into the text document:
<virtualhost *:80>
RailsEnv development
ServerName app.com
ServerAlias www.app.com
DocumentRoot /var/www/html/blog/public
<directory /var/www/html/blog/public>
AllowOverride all
Options -MultiViews
</directory>
</virtualhost> -
21
Press the “Esc” key. Type “:wq” and press “Enter.” Write “service httpd restart” on the command line and press “Enter.”
-
1
References
- Photo Credit Stockbyte/Stockbyte/Getty Images