Home  >  Article  >  Backend Development  >  Setting Up LAMP (Linux, Apache, MariaDB and PHP) on Fedora 24 Server

Setting Up LAMP (Linux, Apache, MariaDB and PHP) on Fedora 24 Server

WBOY
WBOYOriginal
2024-08-28 11:00:32396browse

Setting Up LAMP (Linux, Apache, MariaDB and PHP) on Fedora 24 Server

Follow these instructions to install LAMP (Linux, Apache, MariaDB, and PHP) on a Fedora 24 server. First, perform a minimum installation of Fedora 24. Install the necessary components, including PHP, MariaDB, and Apache, after updating the system. Activate the automatic startup of the Apache server and permit incoming HTTP traffic over the firewall. Set a strong root password, activate the MariaDB service, and safeguard the installation. Set PHP settings appropriately for your needs. By creating a straightforward PHP file and using a web browser to view it, you may test the LAMP architecture. After completing these procedures, your Fedora 24 server will have a fully operational LAMP stack, prepared to host dynamic websites and applications.

Methods Used

  • LAMP Stacks

  • Control Panels

LAMP Stacks

A LAMP stack is a pre-packaged software package that consists of Linux as the operating system, Apache as the web server, MariaDB (or MySQL) as the database server, and PHP as the programming language in the context of putting up a LAMP (Linux, Apache, MariaDB, and PHP) stack on a Fedora 24 server. This stack is especially made to function harmoniously with one another, offering a dependable setting for hosting dynamic websites and applications. Utilising a LAMP stack simplifies the installation and configuration procedure, ensuring compatibility and lowering the possibility of problems. It uses PHP for server-side scripting and dynamic content production, MariaDB for database management, Apache to handle HTTP requests, and Linux for stability and security. In conclusion, a Fedora 24 server can host and operate web applications effectively using a LAMP stack.

Algorithm

  • Introduce Fedora 24 on the server.

  • Install the most recent packages by updating the system.

sudo dnf update
  • In Fedora 24, type "sudo dnf install httpd" to set up Apache and the package deal manager.

sudo dnf install httpd
  • To begin the Apache benefit, enter "sudo systemctl begin httpd," and to make sure of the right operation, enter "sudo systemctl have interaction httpd."

sudo systemctl start httpd
sudo systemctl enable httpd
  • To initiate the setup process for the MariaDB (or MySQL) database server, utilize the Fedora bundle executive like DNF. Simply execute the command "sudo dnf present mariadb-server" and you're good to go!

sudo dnf install mariadb-server
  • Start and enable the MariaDB service by typing "sudo systemctl start mariadb" and "sudo systemctl enable mariadb," respectively.

sudo systemctl start mariadb
sudo systemctl enable mariadb
  • Set an established base password and run the security script to uphold your MariaDB installation (sudo mysql_secure_installation).

sudo mysql_secure_installation
  • Employing a package manager, install PHP and the appropriate modules (for example, sudo dnf install php php-mysqlnd).

sudo dnf install php php-mysqlnd
  • Employing the command "sudo vi," make the necessary alters in the /etc/php.ini file, that includes PHP configuration information.

sudo vi /etc/php.ini
  • Below mentioned is the command that states “sudo systemctl restart httpd”, this command should be run in the command terminal.

sudo systemctl restart httpd
  • Write a sample PHP configuration file with an attached string. For reference, you can follow the below example.

sudo vi /var/www/html/info.php
  • Spare the record and after that open it in a web browser such as Google Chrome or Edge by writing "http://server_ip/info.php" into the address bar at the beat.

<?php phpinfo(); ?>
  • The LAMP stack configuration is finished if the PHP info page appears as intended.

Control Panels

Control panels are web-based interfaces that offer a graphical user interface (GUI) to manage and modify the components of the stack while configuring a LAMP stack on a Fedora 24 server. The management procedure is made simpler by control panels like cPanel or Webmin, especially for those who are unfamiliar with Linux. They provide user-friendly interfaces for controlling services like PHP configuration settings, MariaDB database server, and Apache web server. Users may quickly build virtual hosts, manage databases, set up security measures, configure PHP modules, and carry out other administration operations with the use of control panels. These panels simplify the procedure for both seasoned administrators and Linux beginners by offering an effective and user-friendly way to set up and manage a LAMP stack on a Fedora 24 server.

Algorithm

  • Begin the LAMP setup procedure.

  • Setup Fedora 24 with the basic installation option on the server.

  • Install the most recent packages by updating the system.

sudo dnf update
  • The article talks about Apache, linux etc so it is important for you to install them at priority.

sudo dnf install httpd mariadb mariadb-server php php-mysqlnd
  • Set up Apache as the web server:

  • Follow the command and run in the terminal so that it will boost automatically.

sudo systemctl enable httpd
  • Let the firewall pass through incoming HTTP traffic.

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
  • Start the MariaDB service and make it active.

sudo systemctl start mariadb
sudo systemctl enable mariadb
  • Make sure that the root password for MariaDB is secure.

sudo mysql_secure_installation
  • Modify PHP to your specifications.

  • Create a straightforward PHP file and use a web browser to view it to test the LAMP setup.

<?php
   phpinfo();
?>
  • The LAMP stack is configured properly if the test is successful.

  • You have the option to add extra safeguards, such as HTTPS, performance optimisation, and security best practises, to better secure and optimise the stack.

Conclusion

In conclusion, setting up a LAMP stack on a Fedora 24 server entails installing and configuring the necessary components to build a reliable environment for hosting dynamic websites and applications. LAMP stands for Linux, Apache, MariaDB, and PHP. You can successfully set up the LAMP stack by following the specified instructions, which also include carrying out a minimum installation of Fedora 24, installing Apache, MariaDB, and PHP, and configuring them suitably. Making a straightforward PHP file and viewing it via a web browser to test the stack makes sure the installation is working properly.

Additionally, management and configuration tasks can be made simpler by using control panels like cPanel or Webmin, especially for people with little experience with Linux. You can further improve the performance and security of the stack by putting extra security safeguards into place and by using optimisation methods. Overall, a Fedora 24 server running a well configured LAMP stack offers a solid environment for hosting dynamic web applications.

The above is the detailed content of Setting Up LAMP (Linux, Apache, MariaDB and PHP) on Fedora 24 Server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn