Install LAMP (Apache, MySQL & PHP) on Fedora 28/27/26

Fedora Linux

LAMP Stack is known as Linux, Apache, MySQL, and PHP. This is the popular web server environment for hosting PHP web applications on Fedora systems. This tutorial helps you to install Apache, MySQL, and PHP on Fedora system.

Prerequsiteis

Login to your Fedora system and open a terminal. Now upgrade the current packages to the latest version by running the following command.

Apache Installation

Apache is the most popular web server widely used by Linux systems. Run below command to install httpd server using DNF tool.

Now enable httpd service and start it

Then verify httpd service is running properly:

MariaDB Installation

MariaDB is an alternative of MySQL is the default database for Fedora system. You can install it from official yum repositories by running the following command.

Now enable MariaDB service and start it

After installation process, Run the secure installation script to secure MariaDB instance.

Follow the onscreen instructions. The default password is none. Change your root account password and Press Y for all other operations to apply improved security.

  • Change the password for root? – Press y and change root password
  • Remove anonymous users? Press y
  • Disallow root login remotely? Press y
  • Remove test database and access to it? (Press y
  • Reload privilege tables now? Press y

Now check the MariaDB service status.

PHP Installation

PHP is the most popular programming language. It’s widely used for websites development. You can simply run below command to install the latest available PHP version using DNF.

You may also require some modules as per your requirements. Install required PHP modules on your system.

Verify the current active PHP version on your system

Test Setup

To test the installation, create a phpinfo() function file under default document root directory. The Apache default document root on Fedora is /var/www/html.

Add following content:

Now access phpinfo.php script via system IP address.

Open in browser

Source: https://tecadmin.net/install-lamp-on-fedora/

Share: