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.
Copy to clipboard failed. Open the code and copy it manually.
less /proc/cpuinfo
less /proc/cpuinfo
less /proc/cpuinfo
Checking the ram :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
less /proc/meminfo
less /proc/meminfo
less /proc/meminfo
Checking available disk space :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
df -h
df -h
df -h
OS check :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
uname -a
uname -a
uname -a
JVM version :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
java -version
java -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 :
connect to the server (depending on configuration, you may need to specify a login, password and database name)
run the "status" command
Create cms user
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#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
#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
#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)
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#Récupération des anciens login utilisateurs
cat /etc/passwd
#Récupération des anciens login utilisateurs
cat /etc/passwd
#Récupération des anciens login utilisateurs
cat /etc/passwd
Group list (advanced)
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#Récupération des groupes (lié aux utilisateurs) de l'ancien serveur:
cat /etc/group
#Récupération des groupes (lié aux utilisateurs) de l'ancien serveur:
cat /etc/group
#Récupération des groupes (lié aux utilisateurs) de l'ancien serveur:
cat /etc/group
Encrypt a password (advanced)
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#Cryptage du mot de passe:
perl -e 'print crypt("password", "NSc!ne1d@nyw&"),"\n"'
#Cryptage du mot de passe:
perl -e 'print crypt("password", "NSc!ne1d@nyw&"),"\n"'
#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.
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
Oops!
Copy to clipboard failed. Open the code and copy it manually.
apt install wget
apt install wget
apt install wget
install unzip
unzip is used to unzip the CMS zipAmetys.
Example for Ubuntu
Oops!
Copy to clipboard failed. Open the code and copy it manually.
apt install unzip
apt install unzip
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
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#En tant que root, installer Apache2
apt update
apt install apache2
#apache2 est installé dans /etc/apache2/
#En tant que root, installer Apache2
apt update
apt install apache2
#apache2 est installé dans /etc/apache2/
#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.
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#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
#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
#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 :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
If you wish to have logs of the mod-rewrite module:
Example for Ubuntu & Apache 2.4
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#ajouter cette ligne dans le fichier vhost après la directive "RewriteEngine On"
LogLevel alert rewrite:trace3
#ajouter cette ligne dans le fichier vhost après la directive "RewriteEngine On"
LogLevel alert rewrite:trace3
#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.
Copy to clipboard failed. Open the code and copy it manually.
sudo apt install mysql-server
#Configuration de MySQL
sudo mysql_secure_installation
sudo apt install mysql-server
#Configuration de MySQL
sudo mysql_secure_installation
sudo apt install mysql-server
#Configuration de MySQL
sudo mysql_secure_installation
Example for Redhat / Fedora
Oops!
Copy to clipboard failed. Open the code and copy it manually.
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'
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'
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.
Copy to clipboard failed. Open the code and copy it manually.
#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
#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
#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 :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Include sites-enabled/*.conf
Include sites-enabled/*.conf
Include sites-enabled/*.conf
Otherwise, add this line to the end of the file.
SeLinux
It is recommended to deactivate SeLinux:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
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
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
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.
Oops!
Copy to clipboard failed. Open the code and copy it manually.
#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
#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
#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
Oops!
Copy to clipboard failed. Open the code and copy it manually.
# Spécifier vi en tant qu'éditeur par défaut
vim /etc/profile
# ajouter les lignes suivantes
EDITOR=/usr/bin/vi
export EDITOR
# Spécifier vi en tant qu'éditeur par défaut
vim /etc/profile
# ajouter les lignes suivantes
EDITOR=/usr/bin/vi
export 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)
Oops!
Copy to clipboard failed. Open the code and copy it manually.
vi ~/.vimrc
#Aciver le copier/coller
set mouse-=a
#Activer la coloration syntaxique
syntax on
vi ~/.vimrc
#Aciver le copier/coller
set mouse-=a
#Activer la coloration syntaxique
syntax on
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 :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
:%s#<motif A>#<motif B>#g
:%s#<motif A>#<motif B>#g
:%s#<motif A>#<motif B>#g
For example, to replace cmsdev.xxxxxx.fr with cms.xxxxxx.fr do :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
:%s#cmsdevxxxxxx.fr#cms.xxxxxx.fr#g
:%s#cmsdevxxxxxx.fr#cms.xxxxxx.fr#g
:%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
Oops!
Copy to clipboard failed. Open the code and copy it manually.
cd
vi .bashrc
cd
vi .bashrc
cd
vi .bashrc
In general, it is sufficient to delete the comment before the line
Oops!
Copy to clipboard failed. Open the code and copy it manually.
alias ll='ls -l'
alias ll='ls -l'
alias ll='ls -l'
Note that sometimes the aliases are in another file (this file is called by the.bashrc):
Oops!
Copy to clipboard failed. Open the code and copy it manually.