How to install LAMP on Fedora 25 Server

April 10, 2017 | By | 1 Reply More

Hi everyone, today I am going to share a simple article to build a powerful web server with LAMP (Linux Apache MariaDb and PHP) on Fedora 25 Server. The upcoming Fedora 26 is still in development and I think it still worth it to use Fedora 25 Server as our web server. Install LAMP on Fedora 25 is very easy. With few steps we can have a powerful web server on top of Fedora 25.

Steps to install LAMP on Fedora 25 Server

Step 1. Update your system

Open Terminal or connect to Fedora 25 Server via SSH and type the following command to update your system.

dnf update

Step 2. Install Apache web server

dnf install httpd

Output

install apache on fedora 25.png

Once installed, we need to start the httpd service and enable it during boot.

systemctl enable httpd.service

Output

[root@localhost ~]# systemctl enable httpd.service
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

Now start the httpd service

systemctl start httpd.service

Check the Apache service status. Make sure its activated

systemctl status httpd.service

apache web service status.png

Now we need to enable access to http or https through the system firewall

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

Now reload firewalld

systemctl reload firewalld

Now test the Apache web server if its working. Open web browser (from other computer) and type the Fedora server ip address. For example: http://10.34.0.192. Change the IP address to your server IP address. It should shows something like this:

fedora test page apache

At this point, Apache web server is working properly. Now continue to the next step.

Step 3. Install MariaDb Database Server

Now use this command to install MySQL database server

dnf install mariadb-server

Output:

Last metadata expiration check: 2:32:57 ago on Mon Apr 10 19:48:30 2017.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mariadb x86_64 3:10.1.21-3.fc25 updates 6.4 M
mariadb-common x86_64 3:10.1.21-3.fc25 updates 68 k
mariadb-config x86_64 3:10.1.21-3.fc25 updates 31 k
mariadb-errmsg x86_64 3:10.1.21-3.fc25 updates 204 k
mariadb-libs x86_64 3:10.1.21-3.fc25 updates 656 k
mariadb-server x86_64 3:10.1.21-3.fc25 updates 18 M
mariadb-server-utils x86_64 3:10.1.21-3.fc25 updates 2.2 M
perl x86_64 4:5.24.1-385.fc25 updates 6.0 M
perl-Carp noarch 1.40-365.fc25 fedora 29 k
perl-DBD-MySQL x86_64 4.042-1.fc25 updates 152 k
perl-DBI x86_64 1.636-3.fc25 fedora 732 k
perl-Data-Dumper x86_64 2.161-1.fc25 fedora 55 k
perl-Encode x86_64 4:2.88-5.fc25 updates 1.5 M
perl-Errno x86_64 1.25-385.fc25 updates 67 k
perl-Exporter noarch 5.72-366.fc25 fedora 33 k
perl-File-Path noarch 2.12-365.fc25 fedora 34 k
perl-File-Temp noarch 0.23.04-365.fc25 fedora 61 k
perl-Getopt-Long noarch 2.49.1-1.fc25 fedora 62 k
perl-HTTP-Tiny noarch 0.070-1.fc25 fedora 56 k
perl-IO x86_64 1.36-385.fc25 updates 132 k
perl-IO-Socket-IP noarch 0.39-1.fc25 updates 45 k
perl-IO-Socket-SSL noarch 2.038-1.fc25 fedora 261 k
perl-MIME-Base64 x86_64 3.15-365.fc25 fedora 29 k
perl-Math-BigInt noarch 1.9997.27-2.fc25 updates 178 k
perl-Math-Complex noarch 1.59-385.fc25 updates 99 k
perl-Mozilla-CA noarch 20160104-3.fc25 fedora 14 k
perl-Net-SSLeay x86_64 1.78-1.fc25 fedora 329 k
perl-PathTools x86_64 3.63-366.fc25 fedora 88 k
perl-Pod-Escapes noarch 1:1.07-365.fc25 fedora 20 k
perl-Pod-Perldoc noarch 3.28-1.fc25 updates 86 k
perl-Pod-Simple noarch 1:3.35-1.fc25 updates 211 k
perl-Pod-Usage noarch 4:1.69-1.fc25 fedora 33 k
perl-Scalar-List-Utils x86_64 3:1.47-1.fc25 updates 64 k
perl-Socket x86_64 4:2.024-1.fc25 fedora 56 k
perl-Storable x86_64 1:2.56-368.fc25 updates 83 k
perl-Term-ANSIColor noarch 4.05-2.fc25 fedora 45 k
perl-Term-Cap noarch 1.17-365.fc25 fedora 22 k
perl-Text-ParseWords noarch 3.30-365.fc25 fedora 17 k
perl-Text-Tabs+Wrap noarch 2013.0523-365.fc25 fedora 23 k
perl-Time-Local noarch 1:1.250-1.fc25 updates 30 k
perl-URI noarch 1.71-5.fc25 fedora 115 k
perl-Unicode-Normalize x86_64 1.25-365.fc25 fedora 81 k
perl-constant noarch 1.33-367.fc25 fedora 24 k
perl-libnet noarch 3.10-1.fc25 fedora 126 k
perl-libs x86_64 4:5.24.1-385.fc25 updates 1.5 M
perl-macros x86_64 4:5.24.1-385.fc25 updates 63 k
perl-parent noarch 1:0.236-1.fc25 fedora 18 k
perl-podlators noarch 4.09-1.fc25 updates 114 k
perl-threads x86_64 1:2.15-1.fc25 updates 58 k
perl-threads-shared x86_64 1.55-1.fc25 updates 44 k

Transaction Summary
================================================================================
Install 50 Packages

Total download size: 40 M
Installed size: 177 M
Is this ok [y/N]:

Now enable the service during boot time

systemctl enable mariadb

Start Mariadb Service

systemctl start mariadb

Now check the status of Mariadb service

systemctl status mariadb

It should showing active status on the output as per follow

mariadb service on fedora

Next step is to secure Mariadb installation

mysql_secure_installation

Follow on screen steps until finished. At this point, MariaDb was successfully installed and ready to use. Optionally, we can install MariaDb server database where it will store all server information.

configure mariadb on fedora.gif

OK now at this point, MariaDB is ready for use. Next we will install PHP.

Step 4. Install PHP and Modules

To install PHP on Fedora 25 use the following command:

dnf install php php-common

install php on fedora 25

To enable PHP to work with MariaDB databases, we need to install several modules.

dnf install php-mysqlnd php-gd php-mbstring

install php modules on fedora 25.gif

Now restart Apache

systemctl restart httpd

Now we need to test our PHP. Create a file called info.php under /var/www/html/ directory. You may use your favorite editor such as nano or vim.

nano /var/www/html/info.php

Add the following lines to the info.php

<?php
phpinfo()
?>

Close and save it. To test PHP, open web browser and type the following address on the web browser.

httpd://server-ip-address/info.php

You should see the following information on the web browser.

test php on fedora 25.png

OK, now we are successfully install Apache, MariaDB and PHP on our Fedora 25. And basically I have covered all you need to know to install LAMP on Fedora 25 Server. Thanks for coming and share this article if you found useful. Cheers.

Tags: , ,

Category: Fedora

Comments (1)

Trackback URL | Comments RSS Feed

  1. Wesley says:

    Parabéns pelo passo a passo na instalação do LAMP. Valeu !!!
    Obrigado !

Leave a Reply

%d bloggers like this: