Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Installation Instructions (CentOS 7.1.1503)

Andre Quina edited this page Dec 16, 2015 · 9 revisions

Installation instructions for CentOS 7.1.1503

Apply any updates

sudo yum update

Install Dependencies

sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel

Install nano, skip if you use another editor... you'll need to change the editing commands below

sudo yum install -y nano

Install Apache

sudo yum install -y httpd
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --reload
sudo systemctl start httpd
sudo systemctl enable httpd

Install Git:

sudo yum install -y git

install mongo

sudo nano /etc/yum.repos.d/MongoDB.repo

enter the contents:

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

start mongo

sudo yum install -y mongodb-org
sudo chkconfig mongod on
sudo service mongod start

Install NPM and bower

sudo curl -sL https://rpm.nodesource.com/setup | sudo bash -
sudo yum install -y nodejs
sudo -E npm install -g bower

install passenger

sudo yum install -y epel-release pygpgme curl
sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
sudo yum install -y mod_passenger
sudo yum install -y ruby-devel

Add crucible user:

sudo useradd -m crucible
sudo passwd crucible

Crucible code

sudo su crucible
cd
gem install bundler
echo 'export PATH=${PATH}:${HOME}/bin' >> .bashrc
source .bashrc
git clone https://github.com/fhir-crucible/crucible.git
cd crucible
bundle install --deployment
bower install
bundle exec rake assets:precompile RAILS_ENV=production

enter a production secret

bundle exec rake secret RAILS_ENV=production
# enter secret from previous command
nano config/secrets.yml
# exit from crucible user
exit

Configure apache

sudo nano /etc/httpd/conf.d/crucible.conf

Enter the following contents

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot /var/www/crucible/public
  <Directory /var/www/crucible/public>
      Order allow,deny
      Allow from all
      Options -MultiViews
      # Compress css and js
      AddOutputFilterByType DEFLATE text/css application/x-javascript application/javascript text/javascript application/json
  </Directory>
</VirtualHost>

Configure passenger

sudo nano /etc/httpd/conf.d/passenger.conf

add the following lines under PassengerRuby line

PassengerDefaultUser crucible
PassengerDefaultGroup crucible

Move crucible to make SELinux happy

sudo mv /home/crucible/crucible /var/www

Setup delayed job to start on startup

sudo nano /etc/init.d/delayed_job

Enter the following contents

#!/bin/bash
#
# delayed job
#
# chkconfig: - 99 15
# description: start, stop, restart God (bet you feel powerful)
#

RETVAL=0

case "$1" in
    start)
      cd /var/www/crucible
      su crucible -c 'RAILS_ENV=production bin/delayed_job -n3 start'
      RETVAL=$?
      ;;
    stop)
      cd /var/www/crucible
      su crucible -c 'RAILS_ENV=production bin/delayed_job stop'
      RETVAL=$?
      ;;
    restart)
      cd /var/www/crucible
      su crucible -c 'RAILS_ENV=production bin/delayed_job restart'
      RETVAL=$?
      ;;
    status)
      cd /var/www/crucible
      su crucible -c 'RAILS_ENV=production bin/delayed_job status'
      RETVAL=$?
      ;;
    *)
      echo "Usage: delayed-job {start|stop|restart|status}"
      exit 1
  ;;
esac

exit $RETVAL

Start delayed job

sudo chmod a+x /etc/init.d/delayed-job
sudo chkconfig --level 345 delayed-job on
sudo /etc/init.d/delayed-job start

Add SELinux permissions

note the time from the following

date

Create a policy file with the following

sudo yum install -y policycoreutils-python
sudo setenforce 0
sudo systemctl restart httpd

# open the site on port 80 in a browser
# enter a url to a FHIR server in the input box at the top
# i.e, https://sqlonfhir-dstu2.azurewebsites.net/fhir
# click begin
# when the tests load (may take a minute), select read test and click execute
# when execution completes:

sudo su
cd
ausearch -ts <NOTED DATE ABOVE: i.e., 10:30:00> | audit2allow -M crucible
semodule -i crucible.pp
sudo setenforce 1
sudo systemctl restart httpd

The end.

Clone this wiki locally