Fedora 22 has been released just a few days ago and you can now install LAMP on it. LAMP is a suite of tools needed to build your web server with support for relational database such as MariaDb with the new package manager (DNF) in Fedora 22, there is a slight difference from the usual steps you have to perform the install.
The LAMP abbreviations is taken from the first letter of each package that it has – Linux, Apache, MariaDB and PHP . Since you already have Fedora installed, the Linux part is complete, else you can follow the following guides to install Fedora 22.
Once Fedora 22 has been installed, you will need to do a full system update by issuing the following command:
# dnf update
Now we are ready to continue. I will separate the installation process in 3 different steps to make the whole process easier for you.
Step 1: Setup Apache Web Server
1. Apache web server powers millions of websites across the web. It is very flexible in terms of customization and its security can be greatly improved with modules such as mod_security and mod_evasive.
To install Apache in Fedora 22 you can simply run the following command as root:
# dnf install httpd
2. Once the install is complete you can power on Apache by issuing the following command:
# systemctl start httpd
3. To verify that Apache is working properly open your server’s IP address in a web browser. You can find your IP address with command such as:
# ifconfig | grep inet
4. Once you know the IP address, you can enter your IP address in the browser you should see the default Apache page:
Note: In case you are not able to reach the page, it could be that the firewall is blocking connection on port 80. You can allow connections on the default Apache ports (80 and 443) by using:
# firewall-cmd --permanent –add-service=http # firewall-cmd --permanent –add-service=https
5. To ensure that Apache will start upon sytem boot run the following command.
# systemctl enable httpd
Note: The default Apache directory root for your website files is /var/www/html/
, make sure to place your files in there.
Step 2: Install MariaDB
6. MariaDB is an open source fork of the famous MySQL relational database. MariaDB has been forked by the MySQL creators due to concerns of Oracle acquisition. MariaDB is meant to remain free under the GNU GPL. It is slowly becoming the preferred option for a relational database engine.
To complete the install of MariaDB in Fedora 22 issue the following commands:
# dnf install mariadb-server
7. Once mariadb installation complete, you can start and enable MariaDB to auto start at system boot by issuing the following commands:
# systemctl start mariadb # systemctl enable mariadb
8. By default the root user will not have a root password set, you need to run mysql_secure_installation
command to set new root password and secure mysql installation as shown below.
# mysql_secure_installation
Once executed, you will be asked to enter the MySQL root password – simply press enter as there is no password for that user. The rest of the options depend on your choice, you can find a sample output and configuration suggestions in below screenshot:
Step 3: Install PHP with Modules
9. PHP is a powerful programming language can be used for generating dynamic content on websites. It is one of the most frequently used programming languages for web.
The installation of PHP and its modules in Fedora 22 is simple and can be completed with these commands:
# dnf install php php-mysql php-gd php-mcrypt php-mbstring
10. Once the install is complete you can test PHP by creating a simple PHP file info.php under Apache root directory i.e. /var/www/html/
and then restart Apache service to verify the PHP info by navigating your browser to the address http://server_IP/info.php.
# echo "<?php phpinfo(); ?>" > /var/www/html/info.php # systemctl restart httpd
Your LAMP stack setup is now complete and you have all the tools to start building your projects.
If you have any questions or ideas how to improve the setup of your LAMP stack please do not hesitate to submit a comment in the comment section below.
Exactly what I needed, thank you for the clear instructions. I’m new to Linux and had LAMP up and running the first time through.
Awesome dude, love you for your great work!
Thank you. I am glad you like my article.
Hi, and thanks for clear instructions! I’m quite new to Linux and don’t know if this is new to anyone else, but found out that in my Fedora 22 installation I had to type #firewall-cmd –reload after opening firewall ports to get www-server working from outside localhost.
@Teemu,
Thanks for sharing with us, it will help others too.
Thanks for an awesome, clear and precise manual.
If it is for beginners as well (so it seems), an instruction to go ‘su’ is missing.
Also, for convenience, I would recommend replacing ‘dnf’ with ‘dnf -y’ everywhere.
Excellent!!!
I thing you have another processes that is already “installing” something. You can find what the process is by opening a console and then running
ps auxf | grep 13533
This will show what is the process that is preventing the installation. You can wait for the process to finish or kill it if the process is not important.
Never mind. The other process that was running and needed to be killed was PHPStorm. I should have figured that… Sorry!
Thanks for these instructions! I followed the directions here and everything is working perfectly. However, I’ve had no luck figuring out how to install PHPMyAdmin in Fedora 22.
When I type at CLI:
‘dnf install phpmyadmin -y’
the system locates the various packages to be installed or upgraded, but then states
‘Downloading Packages:
Waiting for process with pid 13533 to finish.’
and basically times out from there.
Any ideas? I feel like I am overlooking something.
Thanks.
You simply has another dnf process running at the same time.
You just need to wait some time for it to clear and run the command again.