LAMP on Fedora
This article shows you how to install and configure the Apache web server, PHP and MySQL on Fedora.
[pratajo@amd64 ~]$ su -
(enter the root password)
[root@amd64 ~]$ dnf install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
[root@amd64 ~]$ systemctl enable httpd.service
[root@amd64 ~]$ systemctl start httpd.service
To verify the correct functioning of the HTTP server, execute the command
[root@amd64 ~]$ systemctl status httpd.service
or open the link http://localhost/
We tested PHP by creating a document in /var/www/html
[root@amd64 ~]$ nano /var/www/html/info.php
and using the phpinfo() function
<?php
phpinfo();
?>
Open the link http://localhost/info.php
Next, we will install and configure the MySQL database.
The MariaDB and MySQL installation packages generate conflicts between them. To use MySQL we have to remove the other database.
[root@amd64 ~]$ dnf remove mariadb
[root@amd64 ~]$ dnf install https://repo.mysql.com//mysql80-community-release-fc31-1.noarch.rpm
[root@amd64 ~]$ dnf install mysql-community-server
[root@amd64 ~]$ systemctl start mysqld
[root@amd64 ~]$ systemctl enable mysqld
For security reasons, MySQL generates a temporary root password. Take note of it
[root@amd64 ~]$ grep 'temporary password' /var/log/mysqld.log
and run the security script before first use.
[root@amd64 ~]$ mysql_secure_installation
Answer the following questions:
We test the status of the database service with
[root@amd64 ~]$ systemctl status mysqld
If you want to remove MySQL, use the following command:
[root@amd64 ~]$ rpm -e --nodeps mysql-community-libs mysql-community-common mysql-community-server
To install MySQL WorkBench run the following command:
[root@amd64 ~]$ dnf install mysql-workbench-community