0% found this document useful (0 votes)
1 views

installer_wordpress

The document provides a step-by-step guide for setting up a web server using Apache, MariaDB, and PHP, including the installation of WordPress. It details commands for checking services, configuring Apache, managing user permissions, and troubleshooting common issues. Additionally, it includes instructions for uninstalling phpMyAdmin and cleaning up related files and configurations.

Uploaded by

Hajri Azza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

installer_wordpress

The document provides a step-by-step guide for setting up a web server using Apache, MariaDB, and PHP, including the installation of WordPress. It details commands for checking services, configuring Apache, managing user permissions, and troubleshooting common issues. Additionally, it includes instructions for uninstalling phpMyAdmin and cleaning up related files and configurations.

Uploaded by

Hajri Azza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 8

sudo apt update

sudo apt upgrade

Step 1: Check for Processes Using Port 80


Run the following command to see which service is using port 80:
bash
Copy code
sudo lsof -i :80

❯ sudo apt install apache2


❯ systemctl is-enabled apache2
❯ ip addr |grep inet

❯ sudo apt install mariadb-server mariadb-client


❯ sudo systemctl status mariadb.service
❯sudo systemctl is-enabled mariadb.service
❯sudo mysql_secure_installation
❯sudo mysql -u root
❯ sudo apt install php libapache2-mod-php php-mysql
❯ sudo systemctl restart apache2
❯ sudo vim /var/www/html/info.php
❯ sudo apt install phpmyadmin
❯ sudo systemctl reload apache2.service
❯sudo ufw status (enable)
 sudo ufw allow OpenSSH
❯sudo ufw allow 'Apache Full'
install Wordpress
❯wget -c http://wordpress.org/latest.tar.gz
❯ tar -xzvf latest.tar.gz
❯ ls
❯ cd wordpress
❯ ls
cd ..
❯sudo cp -R wordpress /var/www/html/zacstech.com
❯ ls -l /var/www/html

❯ sudo chown -R www-data:www-data /var/www/html/zacstech.com


❯ sudo chown -R 755 /var/www/html/zacstech.com

❯ sudo mysql -u root -p (password azza)

CREATE DATABASE wordpress;

CREATE USER 'azza'@'%' IDENTIFIED BY 'azza';

GRANT ALL PRIVILEGES ON *.* TO 'azza'@'%' WITH GRANT OPTION;


❯ sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

❯ sudo nano /var/www/html/wp-config.php

❯ ls -a ~/wordpress

. ..

❯ ls -l /var/www/html

❯ sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

<VirtualHost *:8081>
ServerName zacstech.com
ServerAdmin azza@localhost
DocumentRoot /var/www/html/zacstech.com

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<VirtualHost *:8081>
ServerName zacstech.com
ServerAdmin azza@localhost
DocumentRoot /var/www/html/zacstech.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

❯ sudo nano /var/www/html/wp-config.php


❯ sudo vim /etc/apach2/sites-available/zacstech.com.conf

❯ sudo vim /etc/apach2/sites-available/zacstech.com.conf

❯ apachectl -t

Syntax OK

❯ sudo vim /etc/apache2.conf

❯ sudo vim /etc/apache2/apache2.conf

ServerName localhost

❯ sudo a2ensite zacstech.com.conf

Enabling site zacstech.com.

To activate the new configuration, you need to run:

systemctl reload apache2

❯ systemctl reload apache2

Step 2: Stop Nginx or the Conflicting Service


If Nginx is listed in the output, ensure it is fully stopped and disabled:
bash
Copy code
sudo systemctl stop nginx
sudo systemctl disable nginx

Verify that Nginx is no longer running:


bash
Copy code
sudo systemctl status nginx
Step 2: Restart Nginx
1. Start and Enable Nginx:
bash
Copy code
sudo systemctl start nginx
sudo systemctl enable nginx

2. Verify Nginx is Running:


bash
Copy code
sudo systemctl status nginx

Step 1: Change Apache Port


1. Edit the Apache ports configuration file:
bash
Copy code
sudo nano /etc/apache2/ports.conf

Look for the line:


mathematica
Copy code
Listen 80

Change it to a different port, e.g.:


mathematica
Copy code
Listen 8081

2. Update Virtual Host Configuration: Edit the default site configuration file:
bash
Copy code
sudo nano /etc/apache2/sites-available/000-default.conf

Find the line:


php
Copy code
<VirtualHost *:80>

Change it to:
php
Copy code
<VirtualHost *:8081>

3. Restart Apache to Apply Changes:


bash
Copy code
sudo systemctl restart apache2

4. Verify Apache is Running on the New Port: Check if Apache is listening on the new port:
bash
Copy code
sudo lsof -i :8081

sudo vim /var/www/html/info.php


<?php
phpinfo();
?>

echap and:wq
sudo systemctl restart apache2
i votre navigateur télécharge le fichier info.php au lieu de l'exécuter et d'afficher la page PHP,
cela signifie que le serveur Apache ne traite pas les fichiers PHP correctement. Voici les étapes pour
résoudre ce problème :

1. Vérifiez si PHP est installé et actif


Assurez-vous que PHP et le module PHP pour Apache sont installés :

sudo apt update


sudo apt install php libapache2-mod-php -y

2. Activer le module PHP dans Apache


Activez le module PHP pour Apache :
sudo a2enmod php

Vérifiez que le module libapache2-mod-php est bien installé :

bash
Copy code
dpkg -l | grep libapache2-mod-php

Étapes à suivre pour résoudre le problème :


1. Désactivez et réactivez le module PHP : Parfois, les modules Apache peuvent être
corrompus ou mal activés. Essayez de désactiver et de réactiver le module PHP pour voir si
cela résout le problème :
bash
Copy code
sudo a2dismod php7.4
sudo a2enmod php7.4

2. Redémarrez Apache : Après avoir réactivé le module, redémarrez Apache pour appliquer
les changements :
bash
Copy code
sudo systemctl restart apache2

1. Correction du problème de "ServerName"


Pour résoudre le problème de "server's fully qualified domain name", vous pouvez ajouter une
directive ServerName dans la configuration d'Apache. Cela permettra de supprimer ce message
d'erreur.

Étapes :

1. Ouvrez le fichier de configuration principale d'Apache :


bash
Copy code
sudo vim /etc/apache2/apache2.conf

2. Ajoutez la ligne suivante à la fin du fichier (ou modifiez la si elle existe déjà) :
apache
Copy code
ServerName localhost

3. Sauvegardez le fichier et quittez l'éditeur.


4. Redémarrez Apache pour appliquer les modifications :
bash
Copy code
sudo systemctl restart apache2

1. Uninstall phpMyAdmin package


You can remove the phpMyAdmin package using the following command:
bash
Copy code
sudo apt remove --purge phpmyadmin

This will remove phpMyAdmin and its configuration files.

2. Remove unused dependencies


After uninstalling phpMyAdmin, it’s a good idea to remove any unused dependencies that may
have been installed with it:
bash
Copy code
sudo apt autoremove

This will clean up packages that were installed as dependencies but are no longer required.

3. Remove configuration files


If you want to completely remove all phpMyAdmin files, including its configuration, you can
delete its associated files manually:

• The main configuration file for phpMyAdmin is usually located in /etc/phpmyadmin/ .


Remove the folder if it still exists:
bash
Copy code
sudo rm -rf /etc/phpmyadmin

• If you installed phpMyAdmin in your web server’s root directory ( /var/www/html/ ),


you may also want to delete the phpmyadmin directory:

bash
Copy code
sudo rm -rf /var/www/html/phpmyadmin

4. Remove the Apache configuration (if modified)


If you modified Apache’s configuration to include phpMyAdmin, you should remove the relevant
configuration files:

• Check for any phpMyAdmin-related Apache configuration:


bash
Copy code
sudo find /etc/apache2/sites-available/ -name "*phpmyadmin*"

If you find any configuration files related to phpMyAdmin, remove them:


bash
Copy code
sudo rm /etc/apache2/sites-available/your_phpmyadmin_config.conf
5. Restart Apache
After uninstalling phpMyAdmin, restart Apache to apply the changes:
bash
Copy code
sudo systemctl restart apache2

sudo apt install phpmyadmin


sudo systemctl reload apache2.service

You might also like