How to Install latest LAMP stack on Fedora 25 – DebYum.

share on:
install LAMP on fedora 25

LAMP stands for (Linux,Apache,Mysql/Mariadb,PHP). If you are planning to host your website (WordPress or any other PHP based CMS) then you should install LAMP or LEMP on your server. In this tutorial, we will install LAMP on Fedora 25 server. We will install latest versions of all the software’s included in LAMP stack.

 If you are planning to host your own website then you can buy a VPS from DigitalOcean. DigitalOcean is a simple and robust cloud computing platform best suited for hosting your own websites with complete control over your server.

Use this link to sign up on Digital Ocean and you will get $10 credit to buy a VPS from DigitalOcean.

Install LAMP on Fedora 25

For this tutorial, I have set up a Fedora 25 server on DigitalOcean.

Hostname of Fedora 25 server.

[root@fedora ~]# hostnamectl status
Static hostname: fedora.engy.remote
Icon name: computer-vm
Chassis: vm
Machine ID: 4a03fd7c8956495b8fdf1f7b959748bd
Boot ID: fb679d1cc3b34b5ca36bdea6f2dcc0e1
Virtualization: kvm
Operating System: Fedora 25 (Cloud Edition)
CPE OS Name: cpe:/o:fedoraproject:fedora:25
Kernel: Linux 4.8.6-300.fc25.x86_64
Architecture: x86-64


If you logged in as root then you should create a normal user.

Make that user part of the Group “wheel” so that it can perform administrative tasks.

[root@fedora ~]# useradd -G wheel -c "Main User" -s /bin/bash engy


Verify the User.

[root@fedora ~]# id engy
uid=1000(engy) gid=1000(engy) groups=1000(engy),10(wheel)
[root@fedora ~]#
[root@fedora ~]# passwd engy
Changing password for user engy.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.


Switch to the recently created user to perform the rest of the tasks.

[root@fedora ~]# su engy
[engy@fedora root]$ cd
[engy@fedora ~]$


Secure your server.

Install and configure Firewall in Fedora 25.

[engy@fedora ~]$ sudo dnf install firewalld -y


Start the Firewalld service.

[engy@fedora ~]$ sudo systemctl start firewalld


Start Firewalld at the boot time.

[engy@fedora ~]$ sudo systemctl enable firewalld


Check the status of Firewalld service.

[engy@fedora ~]$ sudo systemctl status firewalld
 firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2017-01-15 11:42:17 UTC; 15s ago
Docs: man:firewalld(1)
Main PID: 25636 (firewalld)
CGroup: /system.slice/firewalld.service
└─25636 /usr/bin/python3 -Es /usr/sbin/firewalld --nofork --nopid


Install LAMP on Fedora 25.

Now we will install the latest available version of Apache HTTP server, MySQL/MariaDB, and PHP.

Install LAMP on Fedora 25: Apache 2.4.25.

Apache HTTP Server 2.4.25 was Released on December 20, 2016. This version of Apache is latest GA release of the new generation 2.4.x branch of Apache HTTPD and represents fifteen years of innovation by the project, and is recommended over all previous releases.

Update Fedora 25.

[engy@fedora ~]$ sudo dnf update


Install the latest version of Apache http server.

Fedora 25 already provides the latest version of Apache http server in its default repositories. So we don’t need to compile it from the source.

[engy@fedora ~]$ sudo dnf info httpd
Last metadata expiration check: 0:27:48 ago on Sun Jan 15 10:43:11 2017.
Available Packages
Name                                                     : httpd
Arch                                                       : x86_64
Epoch                                                    : 0
Version                                                  : 2.4.25
Release                                                 : 1.fc25
Size                                                       : 1.4 M
Repo                                                     : updates
Summary                                               : Apache HTTP Server
URL                                                        :
License                                                  : ASL 2.0
Description                                            : The Apache HTTP Server is a powerful, efficient, and extensible
                                                               : web server.


Install latest Apache server.

[engy@fedora ~]$ sudo dnf install httpd -y


Check the Version of Apache HTTP server.

[engy@fedora ~]$ httpd -v
Server version: Apache/2.4.25 (Fedora)
Server built: Dec 22 2016 15:21:24


Start the HTTP server.

[engy@fedora ~]$ sudo systemctl start httpd.service
[sudo] password for engy:
[engy@fedora ~]$


Make Apache server start at the boot time.

[engy@fedora ~]$ sudo systemctl enable httpd.service


Check the status of Apache Http server.

[engy@fedora ~]$ sudo systemctl status httpd.service
 httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2017-01-15 11:26:31 UTC; 5s ago
Main PID: 25064 (httpd)
Status: "Processing requests..."
Tasks: 32 (limit: 4915)
CGroup: /system.slice/httpd.service
├─25064 /usr/sbin/httpd -DFOREGROUND
├─25065 /usr/sbin/httpd -DFOREGROUND
├─25066 /usr/sbin/httpd -DFOREGROUND
├─25067 /usr/sbin/httpd -DFOREGROUND
├─25068 /usr/sbin/httpd -DFOREGROUND
└─25074 /usr/sbin/httpd -DFOREGROUND
[engy@fedora ~]$


Set the Directory index to serve Php files.

[engy@fedora ~]$ sudo vi /etc/httpd/conf/httpd.conf
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
<IfModule dir_module>
 DirectoryIndex index.html index.php


Configure the Firewalld to allow http/https traffic.

[engy@fedora ~]$ sudo firewall-cmd --add-service={http,https,ssh} --permanent
[engy@fedora ~]$ sudo firewall-cmd --add-port={80,443,22}/tcp --permanent
[engy@fedora ~]$ sudo firewall-cmd --reload
[engy@fedora ~]$ sudo firewall-cmd --list-ports
80/tcp 443/tcp


Verify the working of Apache server by visiting the ip address of your server in your browser.



Fedora 25 server - LAMP install on Fedora 25



Install latest MariaDB server on Fedora 25.

Install LAMP on Fedora 25: MariaDB 10.1.20

The latest version of MariaDB server available is 10.1.20. It is already provided by fedora 25 in its default repositories.

[engy@fedora ~]$ sudo dnf info mariadb-server
Last metadata expiration check: 0:38:32 ago on Sun Jan 15 10:35:31 2017.
Available Packages
Name                            : mariadb-server
Arch                            : x86_64
Epoch                          : 3
Version                        : 10.1.20
Release                       : 1.fc25
Size                              : 19 M
Repo                            : updates
Summary                      : The MariaDB server and related files
URL                               :
License                         : GPLv2 with exceptions and LGPLv2 and BSD
Description                    : MariaDB is a multi-user, multi-threaded SQL database server. It is a
                                    : client/server implementation consisting of a server daemon (mysqld)
                                    : and many different client programs and libraries. This package contains
                                    : the MariaDB server and some accompanying files and directories.
                                    : MariaDB is a community developed branch of MySQL.


Install the Latest version of MariaDB server.

[engy@fedora ~]$ sudo dnf install mariadb-server -y


Check the version of Mariadb server.

[engy@fedora ~]$ mysql -V
mysql Ver 15.1 Distrib 10.1.20-MariaDB, for Linux (x86_64) using readline 5.1


Start the MariaDB server now.

[engy@fedora ~]$ sudo systemctl start mariadb.service


Start the MariaDB server at the boot time now.

[engy@fedora ~]$ sudo systemctl enable mariadb.service


Check the status of MariaDB server.

[engy@fedora ~]$ sudo systemctl status mariadb.service
 mariadb.service - MariaDB 10.1 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2017-01-15 11:21:19 UTC; 9s ago
Process: 24986 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 24798 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Process: 24774 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 24956 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 26 (limit: 4915)
CGroup: /system.slice/mariadb.service
└─24956 /usr/libexec/mysqld --basedir=/usr


Secure the MariaDB installation.

[engy@fedora ~]$ mysql_secure_installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[engy@fedora ~]$


Install PHP in Fedora 25.

Install LAMP on Fedora 25: PHP 7 + OpCache

PHP version 7 is available in Fedora 25.

[engy@fedora ~]$ sudo dnf info php
Last metadata expiration check: 0:59:52 ago on Sun Jan 15 10:35:31 2017.
Available Packages
Name                                                    : php
Arch                                                     : x86_64
Epoch                                                   : 0
Version                                                 : 7.0.14
Release                                                 : 1.fc25
Size                                                      : 2.7 M
Repo                                                    : updates
Summary                                              : PHP scripting language for creating dynamic web sites
URL                                                      :
License :                                               : PHP and Zend and BSD
Description                                           : PHP is an HTML-embedded scripting language. PHP attempts to  make it
                                                            : easy for developers to write dynamically generated web pages. PHP also
                                                            : offers built-in database integration for several commercial and
                                                            : non-commercial database management systems, so writing a
                                                            : database-enabled webpage with PHP is fairly simple. The most common
                                                            : use of PHP coding is probably as a replacement for CGI scripts.
                                                            : The php package contains the module (often referred to as mod_php)
                                                            : which adds support for the PHP language to Apache HTTP Server.


Install PHP and it’s important modules in Fedora 25.

[engy@fedora ~]$ sudo dnf install php php-common php-mysqlnd php-gd php-imap php-xml php-cli php-opcache php-mbstring -y


Check PHP version.

[engy@fedora ~]$ php -v
PHP 7.0.14 (cli) (built: Dec 7 2016 10:01:29) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.14, Copyright (c) 1999-2016, by Zend Technologies


Now you have LAMP installed on your Fedora 25 server. Thanks for visiting this page. Please share this post with your friends on social media! Stay tuned for more Linux tutorials. Have a Great Day. 🙂


share on:


Hello there, My name is Rishi Guleria and I work as a Linux system administrator. I have created this blog to share what I have learned so far and to learn new things. Don't forget to leave the feedback. Have a great day. :)


  1. What a nice comment that makes a lot of sense. I am very interested in this topic and glad to find some information about it here.
    In this website there is also a lot of interesting and useful information:

    נערות ליווי

  2. Какие возможности предоставляет сайт «Dodji»
    Вариант первый: вы заказчик. Вам не нужно искать специфические биржи и сомнительные группы в соцсетях.
    Вы открываете каталог, где видна информация и о самих услугах, и о тех, кто их предлагает.
    Вариант второй: вы исполнитель. Вам не нужно тратить кучу времени и денег на портфолио и раскрутку своих страниц.
    Вы добавляете свои услуги в каталог — заказчики приходят к вам сами.

  3. Internet magazin SMART: trasport smart, electrocasnice, produse pentru casa si gradina, electrice, instrumente, smartphone. Procurati cu reduceri pe Livrare prin Moldova, specificatii si descrierii, alegere diversa

  4. I really cannot add more to what was said because you have disclosed all important information. I must say that this site is quite nice.
    In this website there is also a lot of interesting and useful information:

    נערות ליווי