How to install LAMP Server on Fedora 26

Fedora Tutorial – Hello Linux, today we will show you how to install LAMP Server on Fedora 26. LAMP Server is an essential parts if you want to build a powerful, rock solid web application server. LAMP Server and Fedora 26 is a great combination for your server. LAMP Server is combination between Linux, Apache, MySQL/MariaDB and PHP. And today we will guide you step by step install LAMP Server on Fedora 26. After we have LAMP Server installed on our system, we can then install various web application such as Owncloud, Nextcloud, Pydio and many more.

Steps to install LAMP Server on Fedora 26

Step 1. Enable EPEL and REMI Repository

First, we need to enable EPEL and REMI repository on Fedora 26. Please visit our previous tutorial to enable these repositories.

Step 2. Install Apache web server

First we need to install Apache web server. Log in to Fedora server and execute this command as root

dnf --enablerepo=remi,epel install httpd

Output sample

[root@fedora ~]# dnf --enablerepo=remi,epel install httpd
determining the fastest mirror (33 hosts).. done.
Remi's RPM repository - Fedora 26 - x86_64                                  1.3 MB/s | 1.3 MB     00:01    
Last metadata expiration check: 0:00:01 ago on Tue 22 Aug 2017 07:30:14 PM WIB.
Dependencies resolved.
============================================================================================================
 Package                         Arch                Version                     Repository            Size
============================================================================================================
Installing:
 httpd                           x86_64              2.4.27-2.fc26               updates              1.3 M
Installing dependencies:
 apr                             x86_64              1.6.2-1.fc26                updates              118 k
 apr-util                        x86_64              1.5.4-5.fc26                fedora                95 k
 fedora-logos-httpd              noarch              26.0.1-1.fc26               fedora                33 k
 httpd-filesystem                noarch              2.4.27-2.fc26               updates               27 k
 httpd-tools                     x86_64              2.4.27-2.fc26               updates               88 k
 mod_http2                       x86_64              1.10.10-1.fc26              updates              149 k

Transaction Summary
============================================================================================================
Install  7 Packages

Total download size: 1.8 M
Installed size: 4.8 M
Is this ok [y/N]:

Start and enable Apache

systemctl enable httpd
systemctl start httpd

Enable http through firewalld

firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --reload

Now open web browser and type the Fedora 26 IP address. You should see the following page.

install lamp server on fedora 26

At this point, our Apache web server is running and well configured.

Step 3. Install MariaDB

To install MariaDB, use the following command

dnf --enablerepo=remi,epel install mysql-server

The command will install MariaDB instead of MySQL Server. But that’s oke since MariaDB is a fork of MySQL Server. After install, start and enable MariaDB

systemctl start mariadb
systemctl enable mariadb

The next step is to secure the MariaDB. The default MariaDB password is none. Simply press Enter when asked.

mysql_secure_installation

Output:

[root@fedora ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

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.

You already have a root password set, so you can safely answer 'n'.

Change the 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] 
... 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] n
 ... skipping.

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!

Step 4. Install PHP

Now install PHP with the following command

dnf --enablerepo=remi,epel install php php-mysql

Output

root@fedora ~]# dnf --enablerepo=remi,epel install php php-mysql
Last metadata expiration check: 0:50:59 ago on Tue 22 Aug 2017 07:30:14 PM WIB.
Dependencies resolved.
============================================================================================================
 Package               Arch          Version                                              Repository   Size
============================================================================================================
Installing:
 php                   x86_64        7.1.8-1.fc26.remi                                    remi        2.8 M
 php-pecl-mysql        x86_64        1.0.0-0.15.20160812git230a828.fc26.remi.7.1          remi         40 k
Installing dependencies:
 php-cli               x86_64        7.1.8-1.fc26.remi                                    remi        4.2 M
 php-common            x86_64        7.1.8-1.fc26.remi                                    remi        1.0 M
 php-json              x86_64        7.1.8-1.fc26.remi                                    remi         60 k
 php-mysqlnd           x86_64        7.1.8-1.fc26.remi                                    remi        229 k
 php-pdo               x86_64        7.1.8-1.fc26.remi                                    remi        123 k

Transaction Summary
============================================================================================================
Install  7 Packages

Total download size: 8.4 M
Installed size: 31 M
Is this ok [y/N]:

Now we have Apache, MariaDB and PHP installed on Fedora 26. At this point, our LAMP Server is ready. Thank you for reading this how to install LAMP Server on Fedora 26. See you on the next tutorial.

2 Trackbacks / Pingbacks

  1. Fedora Tutorial - How to enable SSL on Apache Fedora 26
  2. Step by Step Install LAMP Server on Fedora 27 Server

Leave a Reply

Your email address will not be published.


*