How to Install LAMP Stack on Fedora 27

A "LAMP" stack is a group of free softwares that is typically installed together to enable a server to host dynamic websites and web application. This term is actually an acronym which represents the Linux operating system, with the Apache web server, MySQL, and PHP. Here, the site data is stored in a MySQL database, and dynamic content is processed by PHP.

Fedora 27 is our latest free, leading-edge operating system with greatest GNOME desktop environment. In this article, I'll explain on how to install a LAMP stack with WordPress on a Fedora 27.

Install Apache

All the latest version of Apache, Mysql and PHP is present in the server repository itself.  So we can use the simple dnf command to install all packages without any third party repository. You can just install the Apache by running this command below:

#dnf install httpd

Make sure to enable and start the service.

# systemctl enable httpd.service
 # systemctl start httpd.service
 # systemctl status httpd.service
 ● httpd.service - The Apache HTTP Server
 Active: active (running) since Wed 2017-11-29 04:20:06 UTC; 6s ago
 Docs: man:httpd.service(8)
 Main PID: 9498 (httpd)
 Status: "Processing requests..."
 Tasks: 213 (limit: 4915)
 CGroup: /system.slice/httpd.service
 ├─9498 /usr/sbin/httpd -DFOREGROUND
 ├─9499 /usr/sbin/httpd -DFOREGROUND
 ├─9500 /usr/sbin/httpd -DFOREGROUND
 ├─9501 /usr/sbin/httpd -DFOREGROUND
 └─9502 /usr/sbin/httpd -DFOREGROUND

Now we can confirm the Apache version installed and test it's working by accessing the server IP in the browser, just like this >>http://Server IP or hostname/

# httpd -V
 Server version: Apache/2.4.29 (Fedora)
 Server built: Oct 25 2017 12:34:45
 Server's Module Magic Number: 20120211:68
 Server loaded: APR 1.6.3, APR-UTIL 1.6.1
 Compiled using: APR 1.6.2, APR-UTIL 1.6.0
 Architecture: 64-bit
 Server MPM: event
 threaded: yes (fixed thread count)
 forked: yes (variable process count)

Install MariaDB

Secondly, we need to install our Database server. You can install the latest version of it by running the following command:

# dnf install mariadb-server
 # mysql -V
 mysql Ver 15.1 Distrib 10.2.9-MariaDB, for Linux (x86_64) using readline 5.1

Start/enable MariaDB service and check its status.

# systemctl start mariadb.service
# systemctl enable mariadb.service
# systemctl status mariadb.service
 ● mariadb.service - MariaDB 10.2 database server
 Active: active (running) since Wed 2017-11-29 04:26:32 UTC; 15s ago
 Main PID: 12371 (mysqld)
 Status: "Taking your SQL requests now..."
 Tasks: 43 (limit: 4915)
 CGroup: /system.slice/mariadb.service
 └─12371 /usr/libexec/mysqld --basedir=/usr

Next, you will need to secure your database server. You can run the following command to secure MariaDB database and set root password:

# mysql_secure_installation

Install PHP


# dnf install php php-common
# dnf install php php-common php-mysqlnd php-gd php-imap php-xml php-cli php-opcache php-mbstring
# systemctl restart httpd

You need to restart Apache to make these changes effective. Now you can create a php info page under the domain document root to confirm its version.

# cd /var/www/html

You can browse the URL >>http://ServerIP/info.php to confirm it's working.

PHP installation information

We've successfully completed with the installation of LAMP stack on Fedora 27. Now, it's time to set up our WordPress blog. Let's install WordPress with the steps below:

Install WordPress


# dnf install wget
# wget

Create MariaDB/MySQL Database for WordPress


mysql -u root -p
 Enter password:
 MariaDB [(none)]> CREATE USER wpuser@localhost IDENTIFIED BY "password";
 Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE DATABASE wp_database;
 Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> GRANT ALL ON wp_database.* TO wpuser@localhost;
 Query OK, 0 rows affected (0.00 sec)

 Query OK, 0 rows affected (0.00 sec)

We've connected to the MySQL shell and created a database named "wp_database" with a user "wpuser" for the WordPress installation.

Now, you need to create the wp-config.php from the template wp-config-sample.php file and modify the MySQL settings with the one we created to start with our installation.

#cd /var/www/html/wordpress/
#cp wp-config-sample.php wp-config.php

I've modified the file settings with my created database details.

 /** The name of the database for WordPress */
 define('DB_NAME', 'wp_database');

/** MySQL database username */
 define('DB_USER', 'wpuser');

/** MySQL database password */
 define('DB_PASSWORD', 'password');

/** MySQL hostname */
 define('DB_HOST', 'localhost');

Now you can browse the following URL >> http://Server IP or hostname/wordpress/ to complete our installation.

WordPress Configuration


WordPress Installation

Now you can access your admin area browsing the URL >>http://Server IP/wordpress/wp-login.php with the credentials created.

Wordpress Dashboard

That's all! you have installed WordPress Successfully on your Fedora 27 server. Now you can go ahead and customize your WordPress Blog as per your requirements.

Wrapping up

WordPress is an opensource software, which you can use to create your beautiful website, blog, or app.  And there are thousands of plugins and themes available for this to transform your website into the one in your imagination. I hope this article will help you to build your own WordPress Blog in your latest Fedora 27.

Saheetha Shameer 12:05 am



All comments are subject to moderation.