As we know how much web stack is important for hosting web content in linux environment and in this tutorial we will setup our web server for penetration testing on Ubuntu OS.

What is LAMP ?

LAMP stands for Linux, Apache, MySQL, and PHP. Its all are very common example of a web service stack each component. These are the first priority whenever the web application has been hosted into the web server.

What steps will we follow ?

  • Ubuntu
  • Apache
  • PHP
  • MySQL
  • phpMyAdmin
  • FTP
  • SSH
  • Nmap
  • Docker
  • Windows

Requirements

  • Ubuntu
  • Windows

Lets do it 🙂 !!

Install Apache Nmap PHP SSH FTP

  • Apache – Apache is the most commonly used web server in linux operating system. It is a free open source software which runs over 50% of the world’s wide web servers.
  • PHP – PHP is a popular general-purpose scripting language that is especially suited to web development.
  • Nmap – Nmap is a free and open-source network scanner. It also used for vulnerability scanning and network discovery and analyzing the responses.
  • SSH – Secure Shell (SSH) is a cryptographic network protocol. It is a secure way to access a computer over an unsecured network.
  • FTP – File Transfer Protocol is a standard network protocol used for the transfer of computer files between a client and server on a computer network.

Now we will install all these in a single command.

Install MySQL

MySQL is a relational database management system based on SQL – Structured Query Language that is works with SELECT , DELETE , INSERT , REPLACE , and UPDATE statements. MySQL is used to manage database systems, retrieving data from database tables etc.

Lets install the MySQL database server by using the “apt-get” command.

We will login to the database after installation. If we are logging in with root, it is not necessary to enter the password.

After login we have to provide all the privileges to the user of ubuntu, in our case we will select the user “shubham” whose password is “123“.

We need to execute the flush privileges command to update the database.

Results

Here you can see that we have configured Web Server Lab in a few minutes.

Docker

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

Now we will configure our Web Server Lab in docker. In order to create a Docker-based LAMP stack we need to download docker first in ubuntu using the following command.

After the installation we have to download the docker-compose which let us easily organize multi-container applications using yaml configuration files.

After install all these we need to create a “.yaml” file that will contains the following configuration.
Note : If you are trying this in the new ubuntu, you can enter the given configuration otherwise you will have to change the port and credentials accordingly.

After sets the configuration accordingly, now its time to build our project and setup the web server using the following command.

This may take some time, but you can see that all the service has started in the docker.

Check the service to see if the service is working properly. You can see that our Apache server is working successfully on port 82.

Now let’s check the phpmyadmin server, whose username is “user” and the password is “test

Windows – XAMPP

XAMPP is a free and open-source web server stack package, consisting mainly of the Apache HTTP Server, MariaDB database, and interpreters for scripts written in the PHP and Perl programming languages.

Configuring the web server lab on a window machine is quite easy. First we have to install the “XAMPP” application from the official website. Once installed we have to click on the “Start” button of the Apache and MySQL service.

Done ! Our web server is successfully deployed in the window machine.

About the Author
Shubham Goyal Certified Ethical Hacker, information security analyst, penetration tester and researcher. Can be Contact on Linkedin.

One thought on “Web Server Lab Setup on Docker, Ubuntu and Windows”

Leave a Reply

Your email address will not be published. Required fields are marked *