How to install LLMP Stack on CentOS
In this tutorial, we will explain How to install LLMP Stack on CentOS
LLMP Stack is a popular open source web platform commonly used to run dynamic web sites and servers. It includes Linux, Lighttpd, MySQL, and PHP/Python/Perl and is considered by many the platform of choice for development and deployment of high-performance web applications which require a solid and reliable foundation.
You will need:
- A VPS running CentOS
Step 1 – Install Lighttpd
Lighttpd is an open-source web server more optimized for speed-critical environments than common products while remaining standards-compliant, secure and flexible. It is designed and optimized for high-performance environments.
Install Epel before Lighttpd:
yum install epel-release -y
Now you can install Lighttpd by following this command:
yum install lighttpd -y
After, you need to start and enable the apache:
systemctl start lighttpd
systemctl enable lighttpd
Now you need to enable HTTP and HTTPS traffic on the firewall:
firewall-cmd –permanent –zone=public –add-service=http
firewall-cmd –permanent –zone=public –add-service=https
If the firewall is not installed in your system use these command to install and start it:
yum install firewalld
systemctl start firewalld
Step 2 – Install MariaDB
Now you need to install MariaDB. We will need MariaDB to store information of the website.
To install it, run this command:
yum install mariadb-server mariadb
After, you need to start and enable it:
systemctl start mariadb
systemctl enable mariadb.service
Now its time to secure the installation.
You will be asked for a password, so just hit Enter.
After, you will be asked a series of questions.
- Set root password? [Y/n]
Type y if you want to set.
- Remove anonymous users? [Y/n]
Type y if you want to remove.
- Disallow root login remotely? [Y/n]
Type y if you want to disallow.
- Remove test database and access to it? [Y/n]
Type y to remove.
- Reload privilege tables now? [Y/n]
Type y to reload privileges.
Step 3 – Install PHP
PHP is a popular general-purpose scripting language that is especially suited. To install PHP and MySQL extension you need to run the following command:
yum install php php-mysql php-fpm lighttpd-fastcgi
Now open www.conf :
And add lines below:
user = lighttpd
group = lighttpd
Start PHP-FPM and enable it:
systemctl start php-fpm.service
systemctl enable php-fpm.service
Now open php.ini
And add this line:
Save it. And open modules.conf
Add this line:
Now open the last file :
Add these lines:
fastcgi.server += ( “.php” =>
“host” => “127.0.0.1”,
“port” => “9000”,
“broken-scriptfilename” => “enable”
Save it and restart lighttpd to take effects:
systemctl restart lighttpd
Step 4 – Test PHP
You need to test PHP if is working. You can do it by running the following command:
echo “<?php phpinfo();” > /var/www/lighttpd/phpinfo.php
Now go to your browser and open this url http://youripaddress/phpinfo.php to see PHP configuration information.
You have successfully installed LLMP Stack in CentOS.