Installing LAMP stack on Kali Linux

Installing LAMP stack on Kali Linux

 


Installing LAMP stack on Ubuntu 20.04 in 5 Minutes

This post will explain how to install the LAMP stack on Ubuntu 20.04. LAMP stack consists of the following components:

Check Kali Version

In this method, we will use the hostnamectl command to check the Kernel version and CPU architecture


Static hostname: <Name Of Your System>

Icon name: computer-laptop

Chassis: laptop 💻

Machine ID: <Hashdata Machine Id in your system>

Boot ID: <BootId in your system>

Operating System: Kali GNU/Linux Rolling          

Kernel: Linux 5.18.0-kali5-amd64  → Type Of Kali linux version in your computer

Architecture: x86-64  → In my computer support 64 bit / and other 32 bit

Hardware Vendor: <Laptop Brand Name>

Hardware Model: <Laptop Model Name>

Firmware Version: F.24




Linux - Any Linux based operating system

Apache server - Apache is an open-source webserver

MySQL - MySQL database

PHP - PHP as a server-side programming language


These components work together to host single or multiple dynamic websites that are stable in production.


Before you go ahead and start installing the LAMP stack on Ubuntu, make sure you have a non-root user configured along with a server firewall for security purposes. If you don't know what I mean, have a look at this article to configure a non-root sudo user and a firewall on your server before you proceed further.


Installing Apache and allowing it through the firewall

Apache is an amazing open-source web server. Let's install it using the following commands:


sudo apt update

This command updates the package lists for upgrades. Let's run it to ensure that we install the up-to-date versions of the software later.



sudo apt install apache2

Press Y when prompted and the installation will finish after a while.




Let's allow Apache through the firewall using the following command:


sudo ufw allow in "Apache Full"

You can always issue the "sudo ufw status" command to verify the changes 😡



sudo apt install ufw

You can face any issue if this command "sudo ufw allow in “Apache Full”" command to install ufw in your system and then again try before this “sudo ufw status”:


sudo ufw status

You can see check ufw active or not then first active do this next command 😡



Sudo ufw enable

You can enable ufw through this given command put in terminal and then see magic 👍


sudo ufw allow in "Apache Full" now It Work

You can always issue the "sudo ufw status" command to verify the changes 🙂


sudo apache2

You can check your apache2 Working or not: 🙂


systemctl status apache2

You can check your apache2 Working or not by default is disable for active follow next command 😡


systemctl start apache2

You can start your apache2 With this command: 🙂




“127.0.0.1” or “localhost”

You can now go to the server URL (IP address) mention above and the apache2 default page will be displayed on the screen. 


192.168.something.something 

You can now go to the server URL (IP address) mention above and the apache2 default page will be displayed on the screen. Its work when use router access internet router give your system this ip address


ifconfig


Through this command I





Congratulations! You have successfully installed the apache web server on your server


Installing MySQL on Ubuntu

MySQL is a very popular and open source database that can be used with almost any application to store huge amounts of data effectively.


Execute the following command to install MySQL on ubuntu:


sudo apt install mysql-server

confirm the installation by typing 'y' followed by the 'Enter'.



You should be able to login to MySQL console by typing the following command:



sudo mysql


systemctl start mysql


systemctl status mysql

mysql

You should be not able access to login to MySQL console by typing the following command

Dont warry try to root user is show error u try to normal user not with root other to change setting through next command:


su root

You should be able to access root user by typing the following command:


su passwd root

You should be able to change your root user password by typing the following command:


su root

You should be able to login root user by typing the following command:



mysql -p 

You should be able to access root user by typing the following command:

By default mysql password not there if yes password try root








To exit the MySQL console type exit in the MySQL console


sudo mysql -u root -p

You should be able to your mysql acces by typing the following command:

Password → root



exit

You should be able to exit through mysql terminal by typing the following command:








Installing PHP

We can install PHP by firing the following commands:


sudo apt install php libapache2-mod-php php-mysql



This will install the following 3 packages


php -  installs PHP

libapache2-mod-php - Used by apache to handle PHP files

php-mysql - PHP module that allows PHP to connect to MySQL 

Confirm the PHP installation by executing the below command:


php -v

You should be able to check your php install or not and check your php version 👍


Congratulations! You have successfully installed LAMP stack on your server. If you have any doubts, feel free to drop a comment below and I will get back to you!



No comments:

Post a Comment