Linux ⏱️ 3 min read

How To Install LAMP (Linux, Apache, MySQL, PHP) on Fedora

📅 2024-06-18 👁️ 734 WhatsApp Telegram X Facebook
How To Install LAMP (Linux, Apache, MySQL, PHP) on Fedora

How To Install LAMP (Linux, Apache, MySQL, PHP) on Fedora

First, open terminal and run the following command to update your system:

sudo dnf update

Run the following command to install Apache:

sudo dnf install httpd

Start Apache and use the following commands to make it start automatically at system startup:

sudo systemctl start httpd

sudo systemctl enable httpd

To verify that Apache is running, open your browser and go to http://localhost. "It works!" You should see a test page that says:

Run the following command to install MariaDB:

sudo dnf install mariadb-server

Start MariaDB and use the following commands to make it start automatically at system startup:

sudo systemctl start mariadb

sudo systemctl enable mariadb

Run the configuration command to secure MariaDB:

sudo mysql_secure_installation

Run the following command to install PHP and the module required for PHP to work with Apache:

sudo dnf install php php-mysqlnd

You can install additional PHP modules as per your need. For example:

sudo dnf install php-xml php-gd php-mbstring php-curl php-json php-zip

Run the following command to restart Apache:

sudo systemctl restart httpd

To test that PHP is working properly, create a PHP file in Apache's root directory (/var/www/html by default). To do this, run the following command:

echo "" | sudo tee /var/www/html/info.php

Open your browser and go to http://localhost/info.php. You should see a PHP information page. This page shows that PHP has been successfully installed and running.

If you are using firewalld, Fedora's default firewall, run the following commands to allow HTTP and HTTPS traffic:

sudo firewall-cmd --zone=public --add-service=http --permanent

sudo firewall-cmd --zone=public --add-service=https --permanent

sudo firewall-cmd –reload

If you want to install phpMyAdmin, you can use the following command:

sudo dnf install phpmyadmin

Use the following command to edit the phpMyAdmin configuration file:

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

In this file, edit the Require ip directives according to your needs. For example, to allow all IP addresses you can edit it as follows:

 

Require all granted

 

Then use the following command to restart Apache:

sudo systemctl restart httpd

Now you can access the phpMyAdmin interface by opening your browser and going to http://localhost/phpmyadmin.

By following these steps you can successfully install LAMP stack on Fedora.


Related Posts

See all →

Comments

0 comments
No comments yet. Be the first to comment. 🙂

Leave a comment

Comments are published after approval.
captcha