How to install LAMP Server on Fedora 26

Fedora Tutorial – This tutorial is going to show you how to install LAMP Server on Fedora 26. LAMP (Linux Apache MySQL PHP) is a great software solution to build a powerful web server. Installing LAMP on Fedora 26 on take few minutes and it doesn’t have to be a Linux master to be able to install LAMP Server. Fedora 26 Server edition is a great operating system for server. You can download and install Fedora 26 Server edition from this link.

Steps to install LAMP Server on Fedora 26

Step 1. Update your system

It is recommended to update your server prior to LAMP Server installation. This task is to ensure that you have the latest packages installed on the server.

dnf update

Step 2. Install Apache Web Server

The next step on install LAMP Server on Fedora 26 is to install Apache. Apache is the most popular web server for Linux.

dnf install httpd

Output sample

[root@fedora ~]# dnf install httpd
Last metadata expiration check: 0:54:31 ago on Sun 13 Aug 2017 09:08:47 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]:

After installation complete, we need to enable server and start it.

systemctl enable httpd
systemctl start httpd

Now check the Apache status

[root@fedora ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-08-13 22:04:57 WIB; 4s ago
     Docs: man:httpd.service(8)
 Main PID: 15415 (httpd)
   Status: "Processing requests..."
    Tasks: 47 (limit: 4915)
   CGroup: /system.slice/httpd.service
           ├─15415 /usr/sbin/httpd -DFOREGROUND
           ├─15416 /usr/sbin/httpd -DFOREGROUND
           ├─15417 /usr/sbin/httpd -DFOREGROUND
           ├─15418 /usr/sbin/httpd -DFOREGROUND
           ├─15419 /usr/sbin/httpd -DFOREGROUND
           └─15420 /usr/sbin/httpd -DFOREGROUND

Aug 13 22:04:56 fedora.vitruvian.lan systemd[1]: Starting The Apache HTTP Server...
Aug 13 22:04:57 fedora.vitruvian.lan systemd[1]: Started The Apache HTTP Server.

Configure the firewall

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

At this point, our Apache web server is ready. You may check by opening a web browser and type your server IP address.

http://your-server-ipaddress

 

install LAMP Server on Fedora 26

Step 2. Install MariaDB Server

MariaDB is a free, open source database server. After installing Apache, now we need to install MariaDB server.

dnf install mariadb-server

Start/Enable MariaDB Service

systemctl start mariadb
systemctl enable mariadb

Secure MariaDB

mysql_secure_installation

Output Sample

[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] n

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

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

The last thing to do on How to install LAMP Server on Fedora 26 is to install PHP and modules.

dnf install php php-common

Sample output

[root@fedora ~]# dnf install php php-common
Last metadata expiration check: 1:09:42 ago on Sun 13 Aug 2017 09:08:47 PM WIB.
Dependencies resolved.
======================================================================================================================
 Package                      Arch                     Version                        Repository                 Size
======================================================================================================================
Installing:
 php                          x86_64                   7.1.8-1.fc26                   updates                   2.8 M
Installing dependencies:
 php-cli                      x86_64                   7.1.8-1.fc26                   updates                   4.2 M
 php-common                   x86_64                   7.1.8-1.fc26                   updates                   1.0 M
 php-json                     x86_64                   7.1.8-1.fc26                   updates                    69 k

Transaction Summary
======================================================================================================================
Install  4 Packages

Total download size: 8.1 M
Installed size: 30 M
Is this ok [y/N]:

After the installation completed, restart Apache

systemctl restart httpd

Ok, now we have a working LAMP Server on Fedora 26 Server. We can then install other web applications on top of it. Please leave us comment if you have any questions.

 

Admin

Leave a Reply

Your email address will not be published. Required fields are marked *