Вы находитесь на странице: 1из 3

## Setup Ruby on Rails on existing Apache server Centos 6.

4##

1. #Make sure to install dependencies


yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel
httpd-devel apr-devel apr-util-devel

2. # Install Ruby
cd /opt/
wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar zxvf ruby-2.1.2.tar.gz
cd ruby-2.1.2
./configure
make
make install

3. #Check version
/usr/local/bin/ruby -v

4. #Install Ruby Gems


cd /opt/
wget http://production.cf.rubygems.org/rubygems/rubygems-2.3.0.tgz
tar xvzf rubygems-2.3.0.tgz
cd rubygems-2.3.0
/usr/local/bin/ruby setup.rb

5. #Ensure that we have the latest gem


/usr/local/bin/gem update --system

6. #Install Rails with specific version. Remove [-v 3.2.18] if you need to install
latest version.
/usr/local/bin/gem install rails -v 3.2.18

7. #Install Passenger
/usr/local/bin/gem install passenger

8. # Install bundle as sudoer


/usr/local/bin/bundle install

#Optional if you'll use mysql as db


/usr/local/bin/gem install mysql2

9. #View installed gems


/usr/local/bin/gem list

10. #Install Passenger Module for Apache by following installation package below
/usr/local/bin/passenger-install-apache2-module

11. #After finishing above command it will provide you five line of code to add in
your Apache configuration file /etc/httpd/conf/httpd.conf. Sample below
LoadModule passenger_module /usr/local/lib/ruby/gems/2.1.0/gems/passenger-
4.0.45/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.45
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
12. # Restart Apache
service httpd restart

13. # Sample VirtualHost config for site


<VirtualHost *:80>
ServerName www.powerup.com
DocumentRoot /var/www/nameless-ocean-7563/public
<Directory /var/www/nameless-ocean-7563/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>

## Sample Alias config for site


Alias /ngipin "/var/www/nameless-ocean-7563/public"
RackEnv development
<Location /ngipin>
PassengerBaseURI /ngipin
PassengerAppRoot /var/www/nameless-ocean-7563
</Location>
<Directory "/var/www/nameless-ocean-7563/public">
Allow from all
Options -MultiViews
</Directory>

#Reload Apache
service httpd reload

##Install Node.Js via EPEL Repo


yum install nodejs

## Add /usr/local/bin to path


export PATH=$PATH:/usr/local/bin

####Note: Encountered the ff error:


Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem
pristine executable-hooks-1.3.2
Ignoring gem-wrappers-1.2.4 because its extensions are not built. Try: gem
pristine gem-wrappers-1.2.4
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem
pristine executable-hooks-1.3.2
Ignoring gem-wrappers-1.2.4 because its extensions are not built. Try: gem
pristine gem-wrappers-1.2.4
Error loading RubyGems plugin "/usr/local/rvm/gems/ruby-
2.1.2@global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": cannot load such
file -- executable-hooks/wrapper (LoadError)
Error loading RubyGems plugin "/usr/local/rvm/gems/ruby-2.1.2@global/gems/gem-
wrappers-1.2.4/lib/rubygems_plugin.rb": cannot load such file -- gem-wrappers
(LoadError)

#Fixed by installing the ff:


/usr/local/bin/gem install executable-hooks -v ">=1.3.2"
/usr/local/bin/gem install gem-wrappers -v ">=1.2.4"

Вам также может понравиться