Install a Lamp Stack on a VPS

Lamp is an acronym that stands for Linux (L), Apache (a), MySQL (M), and PHP (P). A lamp stack contributes to many different web applications, providing the basic foundations required for proper hosting. The build Lamp stack supports established applications like WordPress, Drupal and more.

To use a lamp stack, all that is needed is the base Linux package. You can install a lamp stack on the VPS after you have logged in as root via SSH.

Preparation of the lamp stack

Before starting the additional installation, you must ensure that your operating system is up to date by running the following command:

yum update

Install Apache

Step 1: Install Apache as the web server. Enter "Y" for YES when prompted.

yum install httpd

Step 2: Enable Apache.

systemctl enable httpd

Step 3: Set Apache to start booting.

systemctl start httpd

Step 4: Check the status of Apache (httpd).

systemctl status httpd

Step 5 – Once Apache is installed and verified, make sure it is working properly by navigating to your server IP in the URL. You should now see an HTTP Server Test page.

Instalar MySQL
Step 1: Now, you will need to install MySQL. Follow the quick steps below:
yum -y install @mysql
Step 2: Enable MySQL.
systemctl enable --now mysqld
Step 3: Set MySQL to start the server startup.
systemctl start mysqld
Step 4: Check that MySQL is active.
systemctl status mysqld
Step 5: Secure your MySQL.
mysql_secure_installation
MySQL will ask you if you want to validate the password component to test the password and improve security. Go ahead and enter "Y" or "Y" for yes.
Choose your password strength between 0 and 2. Next, you'll need to enter a password that you'll need in the future. Once you've done that and set your password, continue by answering yes to the following options:
  • Do you want to continue with the password provided?
  • Delete anonymous users?
  • Disallow root login remotely?
  • Check out the test database and access it?
  • Reload privilege tables now?
Step 6: From here, you will need to login to your installed MySQL.
mysql -u root -p
Step 7: You will now need to create a database along with a privileged user. Note that we used "Lampuser" and "Password" as the database username and password for this tutorial. You can later swap these with your requirements.
CREATE DATABASE lamp_db;
CREATE USER lampuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'lampuser'@'localhost';
FLUSH PRIVILEGES;
(Note: Run the above MySQL commands, "Lamp_DB" will be the database, "Lampuser" will be the database username, and "password" will be the password for the database

Instalar PHP
Step 1: You will need to install Yum Install PHP using the line below and answer "Y" for YES when prompted to do so.
yum install php
Step 2: Install more PHP extensions and applications. Answer "Y" for yes when prompted.
yum install php-pear php-mysqlnd php-curl php-mbstring php-gd php-xml php-pear php-fpm php-pdo php-opcache php-json php-zip php-cli
Step 3: Enable PHP.
systemctl enable php-fpm
Step 4: Make sure PHP starts on startup.
systemctl start php-fpm

Make sure everything is running
Step 1: Make sure Apache is running by running the command below. Note that this process should also show a green active (running) status if it is working properly.
systemctl status httpd
Step 2: Make sure MySQL is running by running the command below. Note that this process should also show a green active (running) status if it is working properly.
systemctl status mysqld
Step 3: Make sure PHP is running by running the command below. Note that this process should also show a green active (running) status if it is working properly.
systemctl status php-fpm
Step 4: Now you're done! Your lamp's battery has been installed and is ready to be used for any of your future housing needs.

No comments

Powered by Blogger.