How to install Kali Linux on DigitalOcean

Unfortunately, DigitalOcean does not support ISO images to install custom Linux distribution. Therefore, if ones need to run any distribution not included in the list, it is necessary to find out another way.

We can install any Linux distribution in VirtualBox in our home computer and then upload virtual dis to DigitalOcean

Requirements to the custom Linux distribution for DigitalOcean

Images you upload to DigitalOcean must meet the following requirements:

  • Operating system. Images must have a Unix-like OS.
  • File format. Images must be in one of the following file formats:
  • Raw (.img) with an MBR or GPT partition table
  • qcow2
  • VHDX
  • VDI
  • VMDK
  • Size. Images must be 100 GB or less when uncompressed, including the filesystem.
  • Filesystem. Images must support the ext3 or ext4 filesystems.
  • cloud-init. Images must have cloud-init 0.7.7 or higher, cloudbase-init, coreos-cloudinit, iginition, or bsd-cloudinit installed and configured correctly. If your image’s default cloud-init configuration lists the NoCloud datasource before the ConfigDrive datasource, Droplets created from your image will not function properly.
  • SSH configuration. Images must have sshd installed and configured to run on boot. If your image does not have sshd set up, you will not have SSH access to Droplets created from that image unless you recover access using the Droplet console.
  • Boot-loader. It should be booted by BIOS (not EFI)

You can also upload a custom image that meets the above criteria as a compressed gzip or bzip2 file.

I followed all this requirements, but I wasted the whole day trying it and failed.

So if you want to run Kali Linux on DigitalOcean, I will show you another method to achieve the result.

How to turn Debian into Kali Linux

I did this trick with Debian 10 in the minimal version, without a graphical desktop. The system has successfully survived the kernel update.

By the way, in the kernel info:

uname -a

the following is said:

Linux w-e-b 5.2.0-kali3-cloud-amd64 #1 SMP Debian 5.2.17-1kali1 (2019-09-27) x86_64 GNU/Linux

This is some kind of cloud kernel, the description says that it is the Linux kernel and modules for use on the Amazon EC2, Google Compute Engine and Microsoft Azure cloud platforms. I did NOT install it on purpose – such a kernel was installed during the update. But the system works – apparently, it’s OK for it.

This instruction is different from ‘How to add Kali Linux repositories to another Linux distribution’. We will not save the repositories of the source distribution, but leave only the Kali Linux repository.

You need to start by creating a new droplet:

Choosing the latest Debian version:

Choose a plan according to your needs. If this is a system without a graphical interface for your personal needs (for using Kali Linux tools) or for a web server with a small load, then 1-2 gigabytes of RAM will be enough. The system itself consumes less than 100 megabytes of RAM, that is, approximately 900 megabytes remain for your needs, which is quite a lot for command line utilities. If you decide to raise your own web server, then one gigabyte or RAM is enough to serve several hundred (or even several thousand, depending on the site) visitors per day.

If you wish, you can add a swap partition: ‘How to create or enlarge a Swap file in Kali Linux’.

The choice of the region of the data center is exclusively out of your preferences (if it is a website, then closer to its audience):

Additional options:

IPv6 is support for the corresponding IP addresses of the sixth version. IPv6 address will be provided free of charge.

Private networking – the network interface of your droplet will be additionally assigned a local address of the form 10.*.*.*. Its meaning is that if you have several droplets, they can exchange data with each other inside this local network.

Now you need to specify the SSH public key. If you do not have one, then you need to generate a public-private key pair. On Linux, this is done with the command:

ssh-keygen

On Windows, install Cygwin and run the command there:

ssh-keygen

Your public key is located in the .ssh/id_rsa.pub file to view it:

cat .ssh/id_rsa.pub

Copy this key and paste into this window, also select a name for it:

When creating other droplets, you can use the same public key:

If desired, specify a more readable host name and enable backups:

Pretty quickly a new system will be created. An IP address will be assigned to it automatically, you will find it in the information about the droplet. SSH is the most convenient way to connect and manage, so please read:

If you click Access console, the web console opens:

You can fix the system through it if you break the SSH service or if you have other serious problems (you can also reset the root password here if you forget it - ‘How to reset a forgotten login password in Linux’).

Debian has the default DigitalOcean configuration, all repositories are stored in the /etc/apt/sources.list file, so open it

vim /etc/apt/sources.list

and comment out all uncommented lines.

Also add the line:

deb https://http.kali.org/kali kali-rolling main non-free contrib

It turns out:

Now we execute:

apt update && apt full-upgrade
reboot

After that, the system information is as follows:

cat /etc/issue
Kali GNU/Linux Rolling \n \l

That is, now the system itself considers Kali Linux'om.

The top lines in /etc/apt/sources.list say that this file is automatically generated and that it will not survive the next re-bundle. I do not know under what conditions a re-bundle will happen, so it’s better to take action just in case.

The simplest of the suggested options is to edit the /etc/cloud/templates/sources.list.debian.tmpl template:

vim /etc/cloud/templates/sources.list.debian.tmpl

We also comment on unnecessary lines in it and add a line with Kali Linux repositories. As a result, I got this:

Conclusion

Do you want Virtual Private Server (VPS) hosting with ISO images support? I recommend you this one (I have been using its services for 4 years already, I host SuIP.biz web-site there).

Recommended for you:

Leave a Reply

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