Here’s a quick guide to set up a full LAMP stack (Linux, Apache, MySQL, PHP) on Fedora:
Install MySQL Server
sudo dnf install mysql-server -y
Installs the MySQL server package using Fedora’s package manager (dnf). The -y flag automatically confirms the installation.
sudo systemctl start mysqld
Starts the MySQL service so it can begin running in the background.
sudo systemctl enable mysqld
Enables MySQL to start automatically on system boot.
sudo mysql_secure_installation
Launches a security setup script to configure root password, remove test databases, and secure your MySQL installation.
Access MySQL
sudo mysql -u root -p
Opens the MySQL command-line client as the root user. You’ll be prompted to enter the root password set during the secure installation step.
Install Apache and PHP
sudo dnf install httpd php php-mysqlnd php-json php-mbstring php-zip php-gd php-fpm -y
Installs Apache (httpd) and PHP along with common PHP extensions used by web apps, such as:
-
php-mysqlnd: for connecting PHP to MySQL -
php-json: for working with JSON data -
php-mbstring: for multibyte string processing -
php-zip,php-gd: for file compression and image handling -
php-fpm: for managing PHP processes efficiently
sudo systemctl start httpd
Starts the Apache web server service.
sudo systemctl enable httpd
Ensures Apache automatically starts on boot.
Access Apache
http://127.0.0.1
If you see a Fedora test page, Apache is running successfully!
Install phpMyAdmin
sudo dnf install https://rpms.remirepo.net/fedora/remi-release-$(rpm -E %fedora).rpm -y
Adds the Remi repository, which provides the latest PHP and phpMyAdmin packages for Fedora.
sudo dnf config-manager setopt remi.enabled=1
Enables the Remi repository you just installed.
sudo dnf install phpMyAdmin -y
Installs phpMyAdmin, a web-based interface for managing MySQL databases.
sudo systemctl restart httpd
Restarts Apache to apply configuration changes and load phpMyAdmin.
Access phpMyAdmin
http://127.0.0.1/phpmyadmin
Login using your MySQL username and password.
That’s it! You now have MySQL, Apache, PHP, and phpMyAdmin running on Fedora. Perfect for local development or testing web apps.
Top comments (0)