How to Install Kali Linux on AWS EC2 (Free Tier)

How to Install Kali Linux on AWS EC2 (Free Tier) – If you look at the previous creation of AWS EC2 instances using Ubuntu Server 20.04, this time we will learn how to install an AMI (Amazon Machine Image) from the Amazon Marketplace. One of the AMIs that we will install is Kali Linux from the Amazon Marketplace.

What is Kali Linux?

Kali Linux is a Linux distribution derived from Debian and also the successor to BackTrack which is used to penetrate the network.

How to Install Kali Linux on AWS EC2?

Slightly different from the article I made before, namely AWS EC2 Tutorial, Easy Instance Setup Step by step, this time we will create an EC2 instance using the KALI Linux operating system through the AWS Marketplace.

Step 1: Login AWS Console

If you already have an AWS account, log in to AWS Management Console, if you don’t have an AWS account, please read the tutorial on creating an AWS account that I have created.

Step 2: AWS Marketplace

aws marketplace
AWS Marketplace

After logging in to the AWS Console, go to AWS Marketplace or do a search with the keyword “TIMES” in the search box in the AWS Console.

PicsArt 10 30 04.45.37
Search Kali Linux on AWS Marketplace

Click on the Kali Linux AWS Marketplace search result with the label Free Tier.

kali aws marketplace
Kali Linux AWS Marketplace

Then click Continue to Subscribe, after that wait a while because the initial status is still pending for a while until the status Effective date and button Continue to Configuration open.

PicsArt 10 30 04.54.35
Subscribe Kali Linux

As long as our AWS Free Tier service is still running we are still allowed to use t2.micro instance resources independently Free as long as the usage limit is still below 750 hours of running instance.

After status pending on Effective date has changed to the effective date, then the next step is to configure the instance.

PicsArt 10 30 04.59.45

Step 3: Creating Instances

times config
Launch Kali Instance

Determine which region will be used for the instance we created, then click Continue to launch through EC2. As in the previous tutorial to make EC2 instance, here we also do the same to create a Kali Linux instance.

Selecting an Instance Type

choose t2.micro Free tier eligible in section Choose and Instance Type.

PicsArt 10 30 05.15.03
Instance Type

Configuring Instances

Next, after selecting the instance type, proceed to the section Configure Instance Details, how many instances we will create, for Free Tier it is recommended to create 1 instance that can be used to run for 1 full month.

setup instance times
Number of instances

Setting Storage Volume

The next step is to configure how much storage to use, by default storage for Kali Linux is required at least 12GB.

storage times
Instance Storage

Add Tags

Continue to the next step, namely Add Tags, The key tag is used to copy the settings of a configuration. For example, with the KALI key tag, we use 16GB of storage and the t2micro instance type, so if we use the key tag on the new instance, it will directly follow the KALI setting with 16GB of storage and the t2micro instance type. Fill in the Tag = NAME, and Key = TIMES.

tag times
Add Tags

Configuring Firewall

Then next step Configure Security Group.

times secgroups
Security Group

Instance Reviews

After the firewall configuration, the final step Instance Review whether the instance is in accordance with the configuration we want or will it be changed as needed.

times review instance
Instance Review

Click Launch and download and save KEY PAIR in a safe place so that only you can access the instance.

PicsArt 10 30 05.48.28
Download Key Pair

Key Pair to access SSH can use Key Pair that has been created previously (eg WEBSERVER.pem) or create a new Key Pair specifically for Kali Linux instances only. Then Launch Instance, and wait a few moments for the instance notification to be generated successfully.

Step 4: Test Connection to Kali Linux Instance

To do connection to Instance can be done in 3 ways and there are already articles that I have made before. Here I use Termux as a tool for SSH connection to Kali Linux Instances.

PicsArt 10 30 06.13.19
Connect via SSH client
ssh -i "KALI-LINUX.pem" [email protected]
PicsArt 10 30 06.20.17
SSH

Warning: connection as root a warning will occur and the connection is disconnected, to access the login using the user time.

Please login as the user "kali" rather than the user "root".
ssh -i "KALI-LINUX.pem" [email protected]

Note: By using the user “time” we can SSH access to the Kali Linux instance.

Check linux version

┌──(kali㉿kali)-[~]
└─$ uname -a
Linux kali 5.10.0-kali9-cloud-amd64 #1 SMP Debian 5.10.46-4kali1 (2021-08-09) x86_64 GNU/Linux
┌──(kali㉿kali)-[~]
└─$ sudo su
┌──(root💀kali)-[/home/kali]
└─# exit

Update Pakcage

As usual, before using a package, we update the package first so that all installed packages are updated to the new version.

┌──(kali㉿kali)-[~]
└─$ sudo apt update
update times
Update packages available

Then do a package upgrade:

┌──(kali㉿kali)-[~]
└─$ sudo apt upgrade

Web server test

Because the Apache2 webserver package is already included in Kali Linux, we immediately tried Apache2 webserver on Kali Linux.

Check Apache2 webserver version

┌──(kali㉿kali)-[~]
└─$ sudo apachectl -v
Server version: Apache/2.4.51 (Debian)
Server built:   2021-10-25T16:37:03

Check Apache service

┌──(kali㉿kali)-[~]
└─$ sudo service apache2 status
○ apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; dis>
     Active: inactive (dead)
       Docs: https://httpd.apache.org/docs/2.4/

Oct 29 18:22:02 kali systemd[1]: Starting The Apache HTTP Ser>
Oct 29 18:22:02 kali systemd[1]: Started The Apache HTTP Serv>
Oct 29 18:22:32 kali systemd[1]: Stopping The Apache HTTP Ser>
Oct 29 18:22:32 kali systemd[1]: apache2.service: Deactivated>
Oct 29 18:22:32 kali systemd[1]: Stopped The Apache HTTP Serv>
lines 1-10/10 (END)

Apache2 webserver service is not active Active: inactive (dead), then we need to activate it first with this command:

┌──(kali㉿kali)-[~]
└─$ sudo service apache2 restart

Check Apache2 Service after restarting:

┌──(kali㉿kali)-[~]
└─$ sudo service apache2 status
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; dis>
     Active: active (running) since Fri 2021-10-29 18:27:47 U>
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 28399 ExecStart=/usr/sbin/apachectl start (code=>
   Main PID: 28403 (apache2)
      Tasks: 6 (limit: 1140)
     Memory: 11.6M
        CPU: 45ms
     CGroup: /system.slice/apache2.service
             ├─28403 /usr/sbin/apache2 -k start
             ├─28405 /usr/sbin/apache2 -k start
             ├─28406 /usr/sbin/apache2 -k start
             ├─28407 /usr/sbin/apache2 -k start
             ├─28408 /usr/sbin/apache2 -k start
             └─28409 /usr/sbin/apache2 -k start

Oct 29 18:27:47 kali systemd[1]: Starting The Apache HTTP Ser>
Oct 29 18:27:47 kali systemd[1]: Started The Apache HTTP Serv>
lines 1-19/19 (END)

Test via curl:

curl -I -X POST http://54.179.179.71
HTTP/1.1 200 OK                                                                                
Date: Sat, 30 Oct 2021 06:43:23 GMT
Server: Apache/2.4.51 (Debian)
Last-Modified: Mon, 06 Sep 2021 11:21:56 GMT
ETag: "29cd-5cb51db5d838d" 
Accept-Ranges: bytes
Content-Length: 10701
Vary: Accept-Encoding
Content-Type: text/html                                          

Or test via web browser:

Apache2 webserver is active, test it by opening the IPv4 public address into a web browser.

Screenshot of 20211030 182859201 1
Apache2 webserver works

Conclusion

From the tutorial above we have learned how to install Kali Linux on AWS EC2.

Hope it is useful.




Leave a comment

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