4 Setting Up a CentOS Server

4.1 Install CentOS 7

Download CentOS from https://www.centos.org/download/. The DVD ISO should have the essentials.

Alternatively, you can use the NetInstall verion. Instructions are here: https://www.if-not-true-then-false.com/2014/centos-7-netinstall-guide/

4.2 Install additional system software

We assume you are logged in as a user with sudo privileges.

The following commands will get you most of what’s needed:

sudo -s

yum install postgres
yum install httpd
yum install epel-release
yum install http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
yum install postgresql94-server postgresql-contrib postgis2_94 postgresql94-devel
yum install emacs # (or your favorite editor)
yum install git
yum install graphviz
yum install R
yum install java

4.3 Install required Ruby and Rails software8

4.3.1 RVM (Ruby Version Manager)

  • Run the following three commands to get and install RVM and add yourself to the rvm group:

    sudo grgpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    curl -sSL https://get.rvm.io | sudo bash -s stable
    sudo usermod -a -G rvm `whoami`
  • Ensure rvmsudo works:

    if sudo grep -q secure_path /etc/sudoers; then sudo sh -c "echo export rvmsudo_secure_path=1 >> /etc/profile.d/rvm_secure_path.sh" && echo Environment variable installed; fi
  • Log out of the server and then log back in to make RVM take effect.

  • Install the correct version of Ruby

    First, visit https://github.com/PecanProject/bety/blob/master/.ruby-version and note the version of Ruby that BETYdb currently expects.

    To install that version of Ruby, run

    rvm install ruby-X.X.X

    where X.X.X is the version number found in the .ruby-version file. Ensure this version is set as the default by running

    rvm --default use ruby-2.3.0

4.4 Bundler:

gem install bundler --no-rdoc --no-ri

4.5 node.js (needed to be able to compile Rails assets):

sudo yum install -y epel-release
sudo yum install -y --enablerepo=epel nodejs npm

4.6 Phusion Passenger9

Passenger requires EPEL. Enable it with the following commands:

sudo yum install -y epel-release yum-utils
sudo yum-config-manager --enable epel
sudo yum clean all && sudo yum update -y

Ensure the date is working properly and install ntp if not:


If this gives the wrong output, install ntp:

sudo yum install -y ntp
sudo chkconfig ntpd on
sudo ntpdate pool.ntp.org
sudo service ntpd start

Now add the Passenger YUM repository:

sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo

Install Passenger + Apache module:

sudo yum install -y mod_passenger || sudo yum-config-manager --enable cr && sudo yum install -y mod_passenger

Restart Apache:

sudo systemctl restart httpd

Check installation:

sudo /usr/bin/passenger-config validate-install

  1. See the Phusion Passenger site’s instructions for installing RVM, Ruby, Bundler, and nodejs here: https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/install_language_runtime.html

  2. See the Phusion Passenger site’s instructions for installing Passenger here: https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/el7/install_passenger.html