Hello everybody, welcome to my post on how to build a LAMP Stack on CentOS 7.6. This is one of my most favorite things to do and is fairly easy. I promise once you follow this you’ll have a web server running in no time. I have also recorded a video that you can view.
Alright let’s get started! First thing you’ll need is a VPS of some kind or a Dedicated Server. Now I personally use Digital Ocean for my VPS Machines when I make these. Once you have a VPS created then you’ll need to do the following.
In order to SSH into your server you’ll need a client of some sort. You can use PuTTY or if you have another SSH client feel free to use that. Once you have it ready you need to type in the following command.
Once you do that a prompt will ask for your password and you’ll enter it. Then hit save/accept and then you’ll be asked to enter your password again and then change your password to something else and then you’ll confirm your new password.
Once you’ve entered your server you’ll now need to do an update/upgrade. To do this you’ll need to use the following commands:
yum update -y
yum upgrade -y
Once you’ve done this your server will update/upgrade (if any are needed).
In order for you to have a working LAMP Stack you need the base, APACHE! This is very easy to install and get running. First install Apache:
yum install httpd -y
systemctl start httpd.service
If that worked then when you go to your Domain/IP then you’ll see a testing 123.. page. This means everything is working the way it should be so now we need to make sure that APACHE restarts when the server restarts:
systemctl enable httpd.service
After APACHE is install and running now we’ll need to install MariaDB.
yum install mariadb-server mariadb -y
systemctl start mariadb
Now we need to do the secure installation
Then there will be some options you’ll need to go through
Enter current password for root (enter for none): Hit Enter
Set root password? [Y/n]: y
New password: Enter a password
Re-enter new password: Re-enter your password
Remove anonymous users? [Y/n]: y
Disallow root login remotely? [Y/n]: y
Remove test database and access to it? [Y/n]: y
Reload privilege tables now? [Y/n]: y
Next we’ll need to install PHP.
yum install php php-mysql -y
systemctl restart httpd.service
Then we’ll need to create a test file to make sure PHP is running
in the editor type in <?php phpinfo(); ?>
ctrl + x
y and hit enter
When done you can go to your domain or ip address /info.php