7 Temmuz 2012 Cumartesi

Ruby on Rails on CentOS 5.7

To contact us Click HERE


I am trying to deploy a rails application on the CentOS 5.7.

Here is the steps I used to deploy a Rails application on a clean CentOS 5.7. Please comment if you have any suggestions.

  1. Install Prereq Package
  2. yum update -y yum install -y curl curl-devel mysql mysql-server mysql-devel httpd httpd-devel autoconf automake binutils gcc gcc-c++ zlib-devel openssl-devel readline-devel apr-devel apr-util-devel /sbin/chkconfig --levels 235 mysqld on /sbin/chkconfig --levels 234 httpd on
  3. Install Ruby
    • Step 1: Download
    • # Source code: version 1.8.7-2011.12 curl -O http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.12.tar.gz
    • Step 2: Install
    • # Extract it: tar xzvf ruby-enterprise-1.8.7-2011.12.tar.gz # Run the installer (completely safe, none of your system files will be touched!): ./ruby-enterprise-1.8.7-2011.12/installer # Simply press Enter if asking for your input
    • Step 3 Install Passenger
    • /opt/ruby-enterprise-1.8.7-2011.12/bin/passenger-install-apache2-module # Simply press Enter if asking for your input
    • Step 4: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
    • # Follow the instructions that the Ruby Enterprise Edition installer gave you.
    • Step 5: Add Ruby enterprise to path
    • export PATH=/opt/ruby-enterprise-1.8.7-2011.12/bin:$PATH
  4. Reboot
  5. reboot
  6. Deploy the rails app
  7. 1. gem install rubygems-update2. update_rubygems3. gem install sqlite3 -v '1.3.5' # create /etc/httpd/conf.d/passenger.conf# LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so # PassengerRoot /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/gems/1.8/gems/passenger-3.0.11 # PassengerRuby /opt/ruby-enterprise-1.8.7-2011.12/bin/ruby # #  virtualhost *:80="" /virtualhost #    ServerName server_name/server_name #    DocumentRoot app_dir/public/app_dir #    SetEnv rails_env production #     directory="" app_dir="" p="" public=""=""/app_dir=""/directory #        Allow from all #        Options -MultiViews # # # Place the rails app under # Configuration of the database setting. Open the /config/database.yml with editor # Change the username and password under the production tag according the database settings # For example2: # production: #  adapter: mysql2 #  encoding: utf8 #  database: production #  username: #  password: #  socket: /var/lib/mysql/mysql.sock
  1. Init the rails app
  2. /opt/ruby-enterprise-1.8.7-2011.12/bin/bundle install --no-deployment --without development --without test # Run only if the db is not created and the user has privilege to create database. # RAILS_ENV=production /opt/ruby-enterprise-1.8.7-2011.12/bin/rake db:create RAILS_ENV=production /opt/ruby-enterprise-1.8.7-2011.12/bin/rake db:migrate RAILS_ENV=production /opt/ruby-enterprise-1.8.7-2011.12/bin/rake assets:precompile # change the permissions of the application's directory chown -R apache:apache chmod -R u=rw,g=r,o-rwx chmod -R ug+X chcon -R -u system_u -t httpd_sys_content_t
  3. restart http server
  4. /etc/init.d/httpd restart

Hiç yorum yok:

Yorum Gönder