LAMP is an acronym for a set of software for building a Web server. It is based on Linux, Apache is used as a web server, the database is MySQL, the code interpreter is PHP.
All actions are done from the root user.
At the very beginning, we update the system components and applications:
sudo yum update
Answer “y” to the question “Is this ok”, wait until the end of the process and restart the server with the command:
reboot
Let’s get to the installation.
Install the Apache web server, though in the repository it is called httpd:
yum install httpd
Next, install the database server. Since CentOS7, MariaDB has been actively used instead of MySQL:
yum install mariadb-server mariadb
If you are interested in the latest stable version of the distribution, then you should install from the developer’s repository. How to do this is discussed in this article .
Install PHP immediately with the module for working with the database:
sudo yum install php php-mysql
Installation completed.
Let’s configure the services so that they start automatically after a system reboot by executing the commands one by one:
systemctl enable httpd.service
systemctl start httpd.service
systemctl enable mariadb.service
systemctl start mariadb.service
To allow connection to the web server, add an allow rule and save it:
iptables -A IN_public_allow -p tcp -m tcp –dport 80 -m conntrack –ctstate NEW -j ACCEPT
iptables-save
Now let’s do a basic MariaDB security setup:
mysql_secure_installation
At the very beginning of use, the program will ask for the password of the root user, since it was not set during installation, then we simply answer by pressing the Enter key. Next, the program will prompt you to change the password of the root user. If a password has not been set, then this procedure cannot be avoided. Enter the password and confirm it. Further questions can be answered with the “Y” key.
Set root password? [Y/n] | Change root user password? |
Remove anonymous users? [Y/n] | Remove anonymous users? |
Disallow root login remotely? [Y/n] | Deny remote connection as root? |
Remove test database and access to it? [Y/n] | Delete test database and access to it? |
Reload privilege tables now? [Y/n] | Reload privilege table now? |
To test the installation, let’s create a php-file info.php in the root of the site:
touch /var/www/html/info.php
Open the file with any text editor, nano in our case:
nano /var/www/html/info.php
If you get an error message, then install this editor:
yum install nano
We add php-code in a file:
We save the changes. In any browser, follow the link in the format http://
In the example case, it will be like this, you have your own IP address:
http://10.10.7.7/info.php
The result will be like this:
PHP modules.
The installed DBMS support module will not be enough if you plan to use any CMS or self-written site. To satisfy the need for functionality, you should install the php language extensions. First, let’s see what the repository offers with the command:
yum search php-
Installing extensions is exactly the same as installing any other package, for example:
yum install php-gd
After installing the extensions, it is recommended to restart the web server service:
systemctl restart httpd.service
Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!