Install RVM with latest Ruby version:
\curl -L https://get.rvm.io | bash -s stable --ruby
Test if RVM is correctly installed:
rvm -v
Install Node.js (https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions):
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
yum install nodejs
Test if Node.js is correctly installed:
node -v
To install bundler, the Ruby application's gem dependencies manager (http://bundler.io/, sources: https://github.com/bundler/bundler):
gem install bundle
Test if bundler is correctly installed:
bundle -v
To install another version of Ruby on RVM:
rvm install "ruby-1.9.3"
To create a gemset:
rvm gemset create mygemset
To use a gemset:
rvm use mygemset
To delete a gemset:
rvm gemset delete mygemset
Show installed rvm ruby versions:
rvm list
Show rvm gemsets:
rvm gemset list
Show current gemset and ruby version:
rvm current
Set current gemset and ruby version:
rvm use 1.9.3@my_app_gemset
To make RVM switch automatically to the correct gemset and ruby version on entering the application folder:
in the application folder create a file named .ruby-gemset
containing only the gemsetname:
my_app_gemset
and a file named .ruby-version
containing only the ruby version:
1.9.3
or you can make it all in the same time with:
rvm use 1.9.3@my_app_gemset --ruby-version --create
CentOS 7: https://www.phusionpassenger.com/library/install/apache/install/oss/el7/ CentOS 6: https://www.phusionpassenger.com/library/install/apache/install/oss/el6/
Create a new folder:
mkdir myapp
and enter it:
cd myapp
Set the current gemset and ruby version:
rvm use 1.9.3@my_app_gemset --ruby-version --create
This will create also .ruby-gemset
and .ruby-version
files.
Verify current gemset and ruby version:
rvm current
To install Rails in the current gemset:
gem install rails
To create a new Ruby on Rails application:
rails new .
This will also run bundle install
.
First determine which Ruby command Passenger should use for the app:
passenger-config about ruby-command
Take note of the path after "Command" (path-to-ruby).
<VirtualHost *:80>
PassengerRuby /path-to_ruby
ServerName myapp.mydomain.ext
DocumentRoot /var/www/html/myapp/public
#RailsEnv development
<Directory /var/www/html/myapp/public>
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Restart apache:
service httpd restart
Open a browser and go to myapp.mydomain.ext
.