MISE EN PLACE D’UN SERVEUR WEB
Faire la mise à jour de l’OS avec yum update et redémarrer le PC après reboot
Configurer une IP statique
Une adresse statique est une adresse attribuée en permanence à un hôte. C'est une
adresse configurée manuellement par l'administrateur.
1. Ouvrez le fichier de configuration pour votre interface réseau.
vi / etc / sysconfig / network-scripts / ifcfg-eth0
2. Ajoutez les paramètres suivants au fichier:
3. DEVICE = enp3s0
4. ONBOOT = oui
5. IPADDR = [Link]
6. NETMASK = [Link]
PASSERELLE = [Link]
7. Enregistrez vos modifications et quittez
8. Vos nouveaux paramètres ne s'appliqueront pas avant le redémarrage ou la mise
en ligne de l'interface réseau. Si vous êtes connecté à distance au serveur et que
vous modifiez les paramètres réseau de l'interface à laquelle vous êtes connecté,
redémarrez le système.
9. Redémarrage de l'interface réseau.
ifdown enp0s3
ifup enp0s3
AUTORISER LA CONNEXION PAR SSH A UN SERVEUR LUNIX (CENTOS)
Le SHH ou encore SECURE SHELL permet de se connecter à distance à un ordinateur
afin d'obtenir un shell ou ligne de commande .En d’autres termes, il fait référence
pour l'accès distant sur les stations Linux et Unix.
Apres une installation de LINUX, le service n’est pas marche. Ce qui ne permet pas a
une autre machine de se connecter a notre serveur. (Sous d’autres distributions
LUNIX, il faut complètement l’installer. Mais avec CENTOS, il est déjà installé et il
suffit de le mettre en marche)
Vérifier le statut service ssh : systemctl status [Link]
Si le service est en marche vous aurez un message du genre:
openssh-daemon (pid 2015) is running...
Si le service n’est pas en marche alors : systemctl start [Link]
Le message suivant apparait : Starting sshd : [ OK ]
Mettre le service à ON au démarrage systemctl enable [Link]
INSTALLATION APACHE SUR UN SERVEUR LUNIX (CENTOS)
yum install –y httpd
Vérifier le statut service httpd : systemctl status [Link]
Si le service est en marche vous aurez un message du genre:
openssh-daemon (pid 2015) is running...
Si le service n’est pas en marche alors : systemctl start [Link]
Le message suivant apparait : Starting sshd : [ OK ]
Mettre le service à ON au démarrage systemctl enable [Link]
Tester le bon fonctionnement du serveur dans un navigateur.
[Link]
Il peut arriver qu’après toutes ces configurations le PC ne soit pas accessible à
distance soit par ssh ou http, il faudrait desactiver toutes les règles du firewall :
sudo systemctl stop firewalld
sudo systemctl disable firewalld
INSTALLATION APACHE SUR UN SERVEUR LUNIX (CENTOS)
1. The first step is to Enable the MariaDB repository. Create a repository
file named [Link] and add the following content:
/etc/[Link].d/[Link]
# MariaDB 10.3 CentOS repository list - created 2018-05-25 19:02 UTC
# [Link]
[mariadb]
name = MariaDB
baseurl = [Link]
gpgkey=[Link]
gpgcheck=1
Copy
2. Install the MariaDB server and client packages using yum, same as
other CentOS package:
sudo yum install MariaDB-server MariaDB-client -y
Yum may prompt you to import the MariaDB GPG key:
Retrieving key from [Link]
Importing GPG key 0x1BB943DB:
Userid : "MariaDB Package Signing Key <package-signing-key@[Link]>"
Fingerprint: 1993 69e5 404b d5fc 7d2f e43b cbcb 082a 1bb9 43db
From : [Link]
Type y and hit Enter.
3. Once the installation is complete, enable MariaDB to start on boot
and start the service:
systemctl enable mariadb
systemctl start mariadb
4. To verify the installation check the MariaDB service status by typing:
sudo systemctl status mariadbCopy
● [Link] - MariaDB 10.3.7 database server
Loaded: loaded (/usr/lib/systemd/system/[Link]; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/[Link].d
└─[Link]
Active: inactive (dead)
Docs: man:mysqld(8)
[Link]
5. The last step is to run the mysql_secure_installation script which will
perform several security related tasks:
sudo mysql_secure_installation
The script will prompt you to set up the root user password, remove
the anonymous user, restrict root user access to the local machine,
and remove the test database.
All steps are explained in detail and it is recommended to
answer Y (yes) to all questions.
Connect to MariaDB from the command line
To connect to the MariaDB server through the terminal as the root account
type:
sudo mysql_secure_installation
mysql -u root -p
You will be prompted to enter the root password you have previously set
when the mysql_secure_installation script was run.
Once you enter the password you will be presented with the MariaDB shell
as shown below:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.7-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Copy
PHP7 INSTALL
yum install epel-release yum-utils –y
yum install [Link]
yum-config-manager --enable remi-php74
yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y
pour forcer les droits setenforce 0
vi /etc/php/ini le fichier de configuration php
Fichiers de configurations
PHP : vi /etc/[Link]
MARIADB : /etc/[Link]
http : /etc/httpd/conf/[Link]
Itop : vi /var/www/html/conf/production/[Link]