Installing Ruby, Gem, Thin and Redmine on Linux in User Space with CloudLinux

Ruby is best known as the language behind the rails web application framework. However, it is a very flexible general purpose language that can be used for tasks of direct interest to R Developers (parsing files, interacting with databases, processing XML or JSON, math functions, statistics, machine learning, etc).

If you do not have root access on a Linux server, you may still be able to install the ruby language and rubgems. Start by checking the version currently installed (if any):

user@lve [~]# which ruby
/usr/bin/ruby
user@lve [~]# ruby --version
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
user@lve [~]# 

Create or navigate to a temporary directory.
Get a source archive of ruby and ruby gems from RubyForge.
Uncompress and extract the downloaded sources.
Change directory to the location of extracted sources.

user@lve [~]# cd ~/tmp
user@lve [~/tmp]# wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.0-stable.tar.gz
user@lve [~/tmp]# tar xvzf ruby-2.0-stable.tar.gz  
user@lve [~/tmp]# wget http://rubyforge.org/frs/download.php/76729/rubygems-1.8.25.tgz 
user@lve [~/tmp]# tar xvzf rubygems-1.8.25.tgz 

Run configure script with –prefix option set to $HOME/… (avoid permissions issues). This will result in an installation of ruby in your home directory.

user@lve [~/tmp]# cd ruby-2.0.0-p195
user@lve [~/tmp/ruby-2.0.0-p195]# ./configure --prefix=$HOME/ruby_2.0
user@lve [~/tmp/ruby-2.0.0-p195]#  make
user@lve [~/tmp/ruby-2.0.0-p195]#  make install

Add $HOME/ruby_2.0/bin to your path (in ~/.bash_profile or other startup script).

export PATH=$HOME/ruby_2.0/bin/:.:$PATH

Verify the correct version was installed:

user@lve [~]# ruby --version
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
user@lve [~]# 

Keep in mind that various subdirectories will be created by this process (bin, lib, share).

user@lve [~/tmp]# cd rubygems-1.8.25
user@lve [~/tmp/rubygems-1.8.25]# 

Set GEM_HOME to a gems directory that you have write access to.

export GEM_HOME=$HOME/gems
export RUBYOPT=rubygems

Run the ruby gems setup program.

user@lve [~/tmp]# cd rubygems-1.8.25
user@lve [~/tmp/rubygems-1.8.25]# ruby setup.rb 

As next steps, you can:
– do rails installation

user@lve [~/]# gem install rails

– download last version of redmine and do setting in any directory;
– next create database and execute all steps from http://www.redmine.org/projects/redmine/wiki/RedmineInstall;
– do changes in .htaccess:

  RewriteEngine On
  RewriteRule  ^(.*)$  http://127.0.0.1:30008/$1  [P]
 

– install and run thin server
( http://code.macournoyer.com/thin/usage, http://www.thomasmonaco.com/2013/03/redmine-thin-and-apache-over-ssl )

user@lve [~/]# cd redmine_root
user@lve [~/]# bundle install
user@lve [~/]# thin start -d -a 127.0.0.1 -p 30008 

Note:

If you your account does not have access to tools of compilation, then you can just upload own binary files.
But it other history:

user@lve [~/packages]# ls -1
binutils-2.17.50.0.6-20.el5_8.3.x86_64.rpm
cpp-4.1.2-54.el5.x86_64.rpm
gcc-4.1.2-54.el5.x86_64.rpm
gcc-c++-4.1.2-54.el5.x86_64.rpm
net-tools-1.60-82.el5.x86_64.rpm
rpm-4.4.2.3-31.el5.x86_64.rpm
user@lve [~/packages]# rpm2cpio *.rpm | cpio -idmv
... 

Important vaiables in .bashrc:

...

PATH=$HOME/ruby_2.0/bin:$HOME/gem/bin:$HOME/bin:$HOME/sbin:$HOME/usr/bin:$HOME/user/libexec/gcc/x86_64-redhat-linux/4.1.1:.:$PATH
export PATH

GEM_HOME=$HOME/gem
export GEM_HOME

RUBYOPT=rubygems 
export RUBYOPT

C_INCLUDE_PATH=$HOME/include
export C_INCLUDE_PATH

CPLUS_INCLUDE_PATH=$HOME/include
export CPLUS_INCLUDE_PATH

LD_LIBRARY_PATH=$HOME/lib:$HOME/lib64:$HOME/usr/lib64
export LD_LIBRARY_PATH

RAILS_ENV=production
export RAILS_ENV

...
Scroll to top