Deploy Kali Linux with GUI on the cloud
Tags: cloud, kali, xfce, xrdp
Published: 2021-06-24 16:37:52

## Background

I recently helped organise a cyber security workshop for youngsters between 13 and 16. Some participants could not run virtual machines for various reasons.

Since the workshop required participants to have access to Kali Linux, I deployed Kali Linux with a Graphical User Interface (GUI) on Google Cloud Platform (GCP) for the participants. In this post, I'm going to show you how I did it.

*P.S. Although I used GCP, these steps are applicable to other platforms e.g. DigitalOcean.*

## Hardware specs

Since Kali Linux will be running with a GUI, I recommend allocating slightly more hardware resources.

<table>
  <tr>
    <th>Hardware</th>
    <th>Specifications</th>
  </tr>
  <tr>
    <td>Processor</td>
    <td>2 cores</td>
  </tr>
  <tr>
    <td>Memory</td>
    <td>4 GB</td>
  </tr>
  <tr>
    <td>Storage</td>
    <td>40 GB</td>
  </tr>
</table>

I recommend selecting Debian 10 as the operating system, since Kali Linux is built on top of Debian. Once it's running, connect via SSH.

## Add the Kali Linux repository

First, update and upgrade.

```console
$ sudo apt update && apt upgrade
```

Add the "kali-rolling" repository to your sources.

```console
$ echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee /etc/apt/sources.list
```

Download the repository's key for the system to verify Kali Linux packages and add it with `apt-key`.

```console
$ curl https://archive.kali.org/archive-key.asc | sudo apt-key add
```

Update again. The new "kali-rolling" repository should be recognised.

```console
$ sudo apt update
```

## Install all the things

The "kali-linux-default" package contains all the tools in a standard Kali Linux distribution.

```console
$ sudo apt install kali-linux-default
```

Once done, you need to install a desktop environment. The preferred desktop environment for Kali Linux is Xfce.

```console
$ sudo apt install kali-desktop-xfce
```

Finally, you need to install Xrdp. This will allow you to access and interact with the GUI via Remote Desktop Protocol (RDP).

```console
$ sudo apt install xrdp
```

> ⚠️ **Note**
> Make sure you have set a password for your user account.
>
> ```console?comments=true
$ sudo passwd myuser # replace myuser with your account name
```

## Enjoy!

If you're on Windows, use Remote Desktop Connection. If you're on Mac, download Microsoft Remote Desktop (available on the App Store).

![cloud kali](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wotson7h74sjgeblek0g.jpeg)

## Troubleshooting

It is normal to see a black screen initially. Wait for a few moments and the desktop should appear. If it is taking particularly long, consider changing the hosting region nearer to you.

If you encounter a "login failed for display 0", make sure you have set a password for your user account.

## References
- https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
- https://miloserdov.org/?p=3609
- https://www.kali.org/blog/major-metapackage-makeover/
- https://www.kali.org/docs/general-use/xfce-faq/
- https://linuxize.com/post/how-to-install-xrdp-on-debian-10/