The LAMP stack is a collection of open-source software consisting of Linux, the Apache web server, the MariaDB database, and the PHP scripting language. It is widely used for hosting dynamic websites and web applications, especially in Linux server environments. This article will walk you through setting up a complete LAMP environment on Fedora 24.
Ensure your Fedora 24 system is installed and fully updated. Use the following command to update all packages:
<span class="fun">sudo dnf update</span>
Install Apache using DNF:
<span class="fun">sudo dnf install httpd</span>
Start the Apache service and enable it on boot:
sudo systemctl start httpd
sudo systemctl enable httpd
Allow HTTP service through the firewall:
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
Install the MariaDB database server:
<span class="fun">sudo dnf install mariadb-server</span>
Start the service and enable it at boot:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Run the secure installation script to set the root password and improve security:
<span class="fun">sudo mysql_secure_installation</span>
Install PHP and its database integration module using DNF:
<span class="fun">sudo dnf install php php-mysqlnd</span>
Modify PHP configuration file as needed:
<span class="fun">sudo vi /etc/php.ini</span>
Restart Apache to apply changes:
<span class="fun">sudo systemctl restart httpd</span>
Create a PHP test file:
<span class="fun">sudo vi /var/www/html/info.php</span>
Add the following content:
<span class="fun"><?php phpinfo(); ?></span>
Then access it in a browser:
<span class="fun">http://your_server_ip/info.php</span>
If the PHP info page loads correctly, your PHP installation is working.
For those unfamiliar with Linux command-line tools, using a web-based control panel like Webmin can simplify server management. These panels offer graphical interfaces to manage databases, configure virtual hosts, adjust PHP settings, and more.
Once you've completed the LAMP setup on Fedora 24, you'll have a stable and flexible platform ready to host PHP-based dynamic websites and applications. With proper firewall configuration, secure database settings, and PHP optimization, your server will be secure and efficient.
Additionally, incorporating web control panels can make administration easier for beginners and experienced users alike. A properly configured LAMP stack on Fedora 24 offers a solid foundation for web development and hosting.