Installation sur un serveur GNU/Linux CentOS

De wiki CoRM
Aller à : navigation, rechercher

Installation de CoRM - serveur GNU/Linux CentOS

Introduction

Il est recommandé d'utiliser un serveur dédié afin d'installer CoRM, cependant, si vous savez ce que vous faites, ce n'est nullement obligatoire.

Architecture 3 tiers

Prérequis

Vous devez connaitre les commandes de base d'un système GNU/Linux. Si vous n'êtes pas familiarisé avec CentOS, ce n'est pas gênant.
Les prérequis afin d'installation la solution CoRM sont les suivants.

Materiel

  • CPU : au moins 1 cœur ;
  • Architecture CPU : 64 bits ;
  • Mémoire vive : au moins 1Go ;
  • Espace disque : au moins 15Go ;

Logiciel

  • Système d'exploitation GNU/Linux CentOS 6.5 (de préférance fraichement installé) ;
  • Apache 2.2 ;
  • Ruby 1.9.3 ;
  • Rails 3.2.18 ;
  • Serveur PostgreSQL 8.4 ;

Installation

Avant d'installer quoi que se soit, assurez-vous que votre système soit à jour :
# yum update -y

Pour des questions de simplicité, nous allons désactiver le firewall IPTABLES pui SELINUX :
# vi /etc/selinux/config
SELINUX=disabled

# rm -rf /etc/rc3.d/S08ip*

Afin de prendre en compte les modifications, il faut redémarrer votre serveur.

Serveur Web Apache


# yum install httpd httpd-devel -y
# chkconfig httpd on
# /etc/init.d/httpd start

À partir de ce moment vous pouvez faire pointer votre navigateur préféré à l'adresse de votre serveur GNU/Linux. Install CoRM Apache Test Page.PNG

Serveur PostgreSQL


# yum install postgresql-server postgresql-devel -y
# chkconfig postgresql on
# service postgresql initdb
# /etc/init.d/postgresql start

Initialiser le mot de passe administrateur de PostgreSQL :
# su - postgres
-bash-4.1$ psql
postgres=# ALTER USER postgres WITH ENCRYPTED PASSWORD 'MyGreatPassword' ;
postgres=# \q
-bash-4.1$ logout

Le nouveau mot de passe administrateur est donc "MyGreatPassword".

Language Ruby

La version de ruby fournie avec le système est trop ancienne (1.8.7). Nous allons récupérer puis compiler une version plus récente.

Présrequis :
# yum groupinstall 'Development Tools' -y
# yum install curl-devel openssl-devel zlib-devel apr-devel apr-util-devel readline-devel wget -y

Libyaml :
# cd /usr/local/src
# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
# tar xzvf yaml-0.1.4.tar.gz
# cd yaml-0.1.4
# ./configure --prefix=/usr/local
# make && make install

Ruby :
# cd /usr/local/src
# wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p547.tar.gz
# tar xzvf ruby-1.9.3-p547.tar.gz
# cd ruby-1.9.3-p547
# ./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
# make && make install

Création d'un lien symbolique :
# ln -s /usr/local/src/ruby-1.9.3-p547/ruby /usr/bin

# ruby -v
ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-linux]

Framework Ruby-on-Rails

# gem update
# gem install --no-rdoc --no-ri rails -v 3.2.18


Pour vérifier si tout a fonctionné :
# rails -v
Rails 3.2.18

Récupération du code source

# cd /
# mkdir webapps
# cd webapps/
# git clone https://github.com/SIGIRE/CoRM.git
# cd CoRM/

Configuration

Base de données

# cd CoRM/
# cd config
# cp database.yml.example database.yml

# vi database.yml
development:
adapter: postgresql
encoding: unicode
database: db_corm_dev
pool: 5
username: root
password: MyGreatPassword

test:
adapter: postgresql
encoding: unicode
database: db_corm_test
pool: 5
username: root
password: MyGreatPassword

production:
adapter: postgresql
encoding: unicode
database: db_corm_prod
pool: 5
username: root
password: MyGreatPassword

Fichier de sécurité

# cp application.yml.default application.yml
# vi application.yml
CORM_SECRET_TOKEN:
64a4aa0d52e1611fe17027ad78e5b55a1495fc2770b2fdb2e570eea6fc2c2c031f7de0e07ea4d2a8fce30237c696d92072ec7c94b7020a19bc52ba1734c09743</code>
DEVISE_SECRET_KEY:
48af28f68a5a821b2e0c9f404130d8c566d47d43883c3460108137110013af4993ddc79f73f66e49c28ff866c329ffbe05aa7239f2b5d840c2b81471691ad9dc</code>