Not a must per-se but damn handy nontheless and the point is we might want to have other applications which require a whole different Ruby version to run so I’ll thank myself later.
-
Ensure your user shell runcommand file (~/.bashrc, ~/.zshrc) doesn’t contain any
$PATH
path which doesn’t include the$PATH
variable itself (e.g.export PATH=/foo/bar:/baz/bara
) and append the$PATH
environment variable postfix (e.g.export PATH=/foo/bar:/baz/bara:$PATH
). -
Pull the latest stable Ruby from rvm.io using
\curl -sSL https://get.rvm.io | bash -s stable --ruby
-
Source the rvm file to obtain access to the function using
source /the/rvm/path/.rvm/scripts/rvm
-
Set the default Ruby binary and create a default gemset:
rvm ruby-x.y.z.-build@redmine --default --create
-
Make sure your autoload rc (~/.zshrc, ~/.bashrc) has the ruby path way way upfront the
$PATH
chain or it will bitch and moan and complain till you can’t take it anymore.
Having a default, flexible, Ruby install, we also have a gem
for each version we can use to pull in any needed packages.
-
Use
gem i bundler rdoc rake rails pry pry-rails passenger thin --no-ri --no-rdoc
for a quick install of the most dire programs. -
Move into the current Ruby gemset gems folder e.g.
cd ~/.rvm/gems/ruby-2.1.1-latest@redmine/gems/passenger-4.0.41
-
Compile the module for your webserver either nginx or apache:
passenger-install-apache2-module
orpassenger-install-ngix-module
.
-
While trying to execute the last command of the previous chapter, we find that the script tries to install nginx from source (download instead of package manager) and that its default location probably isn’t writable (/opt/nginx).
-
So switch user for a small bit and
sudo mkdir /opt/nginx && sudo chown redmine:redmine /opt/nginx
so we may install without problems using our limited redmine user. -
When done with compiling, write the thin configuration file either by hand or using the commands:
-
for permissions:
sudo mkdir /etc/thin && sudo chown redmine:redmine /etc/thin
-
then write the config:
-
thin config -C /etc/thin/redmine.yml \
-c /srv/redmine/sites/somesite.com \
--servers 2 -e production \
-a 127.0.0.1 -p 3000
This so we do not bump into either the gem not being found, or permissions not being correct. We can secure them lateron again.
Now make sure that these settings are reflected in the Nginx configuration file: vim /opt/nginx/conf/nginx.conf
See below file for the configs of thin and nginx.
Once all files are written (configured) we can safely replace the permissions with root or your superuser.
-
Thin (as Redmine):
thin -C /etc/thin/redmine.yml start
-
Nginx (as super):
sudo nginx
source 'https://rubygems.org'
gem 'pry'
gem 'pry-rails'
gem 'colorist'
gem 'yard'