40 CentOS / RHEL

These are specific notes for installing PEcAn on RedHat/CentOS and will be referenced from the main installing PEcAn page. You will at least need to install the build environment and Postgres sections. If you want to access the database/PEcAn using a web browser you will need to install Apache. To access the database using the BETY interface, you will need to have Ruby installed.

This document also contains information on how to install the Rstudio server edition as well as any other packages that can be helpful.

40.1 Install build environment

40.1.0.1 Install and configure PostgreSQL, udunits2, NetCDF

Reference: centoshelp.org

yum install -y epel-release 
yum -y install http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm
yum -y install git R postgresql94-server postgresql94-contrib postgis2_94 udunits2 netcdf
/usr/pgsql-9.4/bin/postgresql94-setup initdb
systemctl enable postgresql-9.4
systemctl start postgresql-9.4

40.1.0.2 Install and start Apache

yum -y install httpd
systemctl enable httpd
systemctl start httpd

40.1.0.3 Install PHP

sudo yum -y install php php-pgsql

40.1.0.4 Install ruby-netcdf gem

cd $RUBY_APPLICATION_HOME
export $NETCDF_URL=http://www.gfd-dennou.org/arch/ruby/products/ruby-netcdf/release/ruby-netcdf-0.6.6.tar.gz
export $NETCDF_DIR=/usr/local/netcdf
gem install narray
export NARRAY_DIR="$(ls $GEM_HOME/gems | grep 'narray-')"
export NARRAY_PATH="$GEM_HOME/gems/$NARRAY_DIR"
cd $MY_RUBY_HOME/bin
wget $NETCDF_URL -O ruby-netcdf.tgz
tar zxf ruby-netcdf.tgz && cd ruby-netcdf-0.6.6/
ruby -rubygems extconf.rb --with-narray-include=$NARRAY_PATH --with-netcdf-dir=/usr/local/netcdf-4.3.0
sed -i 's|rb/$|rb|' Makefile
make
make install
cd ../ && sudo rm -rf ruby-netcdf*

cd $RUBY_APPLICATION
bundle install --without development

40.2 Apache Configuration

40.3 Install and configure Rstudio-server

based on Rstudio Server documentation

  • add PATH=$PATH:/usr/sbin:/sbin to /etc/profile

       cat "PATH=$PATH:/usr/sbin:/sbin; export PATH" >> /etc/profile
  • add rstudio.conf to /etc/httpd/conf.d/

       wget https://gist.github.com/dlebauer/6921889/raw/d1e0f945228e5519afa6223d6f49d6e0617262bd/rstudio.conf
       sudo mv rstudio.conf /httpd/conf.d/
  • download and install server:

       wget http://download2.rstudio.org/rstudio-server-0.97.551-i686.rpm
       sudo yum install --nogpgcheck rstudio-server-0.97.551-i686.rpm
  • restart server sudo httpd restart
  • now you should be able to access http://<server>/rstudio

40.4 Install Postgres

See documentation under the BETYdb Wiki