On this page we present some system tips that are useful when installing CMS Ametys under Linux. These tips are obvious for a system engineer, but can be very useful for many users. Some commands may vary depending on the Linux version.

Comments
If you need help, don't hesitate to ask for help on theForums Ametys. You can also contribute to improving this documentation by adding your comments.

  1. System
    1. Checking prerequisites
  2. Create cms user
  3. User list (advanced)
  4. Group list (advanced)
  5. Encrypt a password (advanced)
  6. Installing a package
    1. Install wget
    2. install unzip
    3. Apache 2
      1. Installation
      2. Modules
    4. MySQL
    5. JVM
    6. Tomcat
  7. Virtual Host Apache
  8. SeLinux
  9. Number of open files
  10. vi - default editor
  11. vi - copy/paste (debian)
  12. vi - string replacement
  13. Alias

 

System

Checking prerequisites

  • Checking the processor :

    less /proc/cpuinfo
  • Checking the ram : 

    less /proc/meminfo
  • Checking available disk space :

    df -h
  • OS check :

    uname -a
  • JVM version :
 java -version
  • Version of apache httpd and tomcat : if you have installed them via your distribution's package system, you can find the version via the interface for consulting installed packages. If it's the version downloaded from the site, refer to the release notes in the tomcat (or httpd) directory, with the version number at the beginning of the file.

  • Server version mysql :
    1. connect to the server (depending on configuration, you may need to specify a login, password and database name)
    2. run the "status" command

Create cms user

#connexion en tant que root 
#Ajout de l'utilisateur cms 
useradd -m -s /bin/bash cms 
#Définition du mot de passe de l'utilisateur cms : générer un mot de passe http://www.pctools.com/guides/password/?length=8&phonetic=on&alpha=on&mixedcase=on&numeric=on&nosimilar=on&quantity=3&generate=true#password_generator
passwd cms

#login en tant que cms 
su - cms
#Gestion des droits du répertoire /home/cms 
cd /home 
chmod 711 cms

User list (advanced)

#Récupération des anciens login utilisateurs
cat /etc/passwd

Group list (advanced)

#Récupération des groupes (lié aux utilisateurs) de l'ancien serveur:
cat /etc/group

Encrypt a password (advanced)

#Cryptage du mot de passe:
perl -e 'print crypt("password", "NSc!ne1d@nyw&"),"\n"'

The useradd command can contain a -p parameter to set the (encrypted) password.

Installing a package

Installing a package depends on the OS used.

 Deposit updateSearch for a packageInstalling a package
Ubuntu
The documentation is online: http://doc.ubuntu-fr.org/apt-get
apt update apt-cache search <word1 word2 ...> apt install <paquet(s)> 
Redhat, Fedora
http://doc.fedora-fr.org/wiki/YUM_:_Configuration_du_gestionnaire_de_paquets
yum updateyum list <nom du paquet>
yum search <mot clef> 
yum install <nom du paquet> 

Install wget

wget is a command-line program for downloading files. We use wget to retrieve the zip file from CMS Ametys or to retrieve a version of the JVM, tomcat...

Example for Ubuntu

apt install wget

install unzip

unzip is used to unzip the CMS zipAmetys.

Example for Ubuntu

apt install unzip

Apache 2

Installation

Apache is installed in either /etc/httpd or /etc/apache2.

We recommend using a packaged version from the Linux distribution to take advantage of updates. Apache is used on the front end and will therefore be subject to attacks, so for security reasons it is advisable to keep it up to date. 

Example for Ubuntu/Debian

#En tant que root, installer Apache2
apt update
apt install apache2
#apache2 est installé dans /etc/apache2/

Modules

There are several ways to activate modules.

The first is to add a link from the mods-enabled directory to the mods-available directory.

#Configuration de Apache: ajout des modules
cd /etc/apache2/mods-enabled
ln -sf ../mods-available/deflate.load
ln -sf ../mods-available/expires.load
ln -sf ../mods-available/headers.load
ln -sf ../mods-available/proxy.conf
ln -sf ../mods-available/proxy_http.load
ln -sf ../mods-available/proxy.load
ln -sf ../mods-available/rewrite.load

The second is to use the a2enmod command. The a2enmod command activates a module in apache2, for example :

a2enmod deflate expires headers proxy proxy_http rewrite

If you wish to have logs of the mod-rewrite module:

Example for Ubuntu & Apache 2.4

#ajouter cette ligne dans le fichier vhost après la directive "RewriteEngine On"
LogLevel alert rewrite:trace3

MySQL

Only MySQL is documented, but installation with another DBMS takes place in the same way. Please refer to the manuals of the chosen DBMS to reproduce the necessary steps.

Example for Ubuntu(other documentation)(Debian10)

sudo apt install mysql-server
#Configuration de MySQL
sudo mysql_secure_installation

Example for Redhat / Fedora

yum install mysql.x86_64
yum install mysql-server
/etc/init.d/mysqld start
#Définir un mot de passe root, exemple 'MonMotDePasse'
/usr/bin/mysqladmin -u root password 'MonMotDePasse'

JVM

You can install a JVM with Ansible, for example, using the glovesign role .java or follow the manual instructions for adoptjdk.

Tomcat

Tomcat is usually installed in /etc/tomcat7/ on Ubuntu and /opt/ on RedHat.

There are two ways to install tomcat: download and deploy a zip version of tomcat from Apache or install the packaged version from the Linux distribution.

CMS Ametys is compatible with Tomcat 9 and higher. Tomcat can be downloaded from Apache: Tomcat 9

To install tomcat you can use the Ansible pulse-mind role .tomcat.

#Exemple de lignes de commandes: 
cd /opt
mkdir tomcat
groupadd tomcat
useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat

tar xzf /tmp/tomcat.tgz
mkdir current
ln-f apache-tomcat.1.0.0 current

cd /opt/tomcat/current

chgrp -R tomcat /opt/tomcat
chmod -R g+r conf
chmod g+x conf
chown -R tomcat webapps/ work/ temp/ logs/

chmod -R g+w logs temp webapps work

Virtual Host Apache

On some OSes,Apache is configured in the conf/httpd.conf file. On Ubuntu, this file exists but is empty.
If there is a conf/httpd.conf file, a directory may be provided to receive vhost configurations, in which case there should be a line like :

Include sites-enabled/*.conf

Otherwise, add this line to the end of the file.

SeLinux

It is recommended to deactivate SeLinux:

vi /etc/selinux/config
SELINUX=disabled
/usr/sbin/setenforce 0

 
#ou si /etc/selinux/config n'existe pas: 
echo 0 > /selinux/enforce
apt-get install selinux-utils
setenforce 0
cd /etc
mkdir selinux
vi /etc/selinux/config
SELINUX=disabled

You don't have to disable SeLinux, but you do have to be prepared to spend a lot of time configuring your Linux OS, while encountering a large number of errors.
Alternatively, you can try disabling it for the duration of the installation, then re-enabling it to see if the likely problems are indeed caused by SeLinux and not by a configuration problem.

Number of open files

Linux allows you to modify the maximum number of open files. CMS requires you to increase this value; we recommend 100,000.

#Nombre de fichiers ouverts
vi /etc/security/limits.conf
* - nofile 100000
root - nofile 100000

#Puis rebootez.
reboot
 
#Dans le script de tomcat, par exemple /etc/default/tomcat7, ajoutez à la fin: 
#Pour être sur que tomcat l'utilise au démarrage, même après un reboot du serveur
ulimit -n 100000

vi - default editor

 # Spécifier vi en tant qu'éditeur par défaut
vim /etc/profile
# ajouter les lignes suivantes
EDITOR=/usr/bin/vi
export EDITOR

vi - copy/paste (debian)

vi ~/.vimrc

#Aciver le copier/coller
set mouse-=a
#Activer la coloration syntaxique
syntax on

vi - string replacement

Pour remplacer une chaine de caractère <motif A> par une autre <motif B> dans un fichier :

:%s#<motif A>#<motif B>#g

For example, to replace cmsdev.xxxxxx.fr with cms.xxxxxx.fr do :

:%s#cmsdevxxxxxx.fr#cms.xxxxxx.fr#g

Be careful not to replace too quickly, and check the result by comparing it with the old file.

Alias

For greater convenience, add the alias ll

cd
vi .bashrc

In general, it is sufficient to delete the comment before the line

alias ll='ls -l'

Note that sometimes the aliases are in another file (this file is called by the.bashrc):

 vi .bash_aliases
Back to top

Installation and operation manual