In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to use the official Kali image to build a system on the DigitalOcean server. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
DigitalOcean is a cloud provider similar to AWS,Microsoft Azure,Google Cloud Platform. They provide examples of different Linux distributions, which are called "droplets". Like AWS, DigitalOcean has data centers all over the world, even multiple data centers in some countries.
Not long ago, however, DigitalOcean added a very distinctive feature, namely, support for custom images allows users to import virtual machine disks and use them as "droplets". This means that we can build our own systems in their cloud with official Kali images.
Although you can load the official kali-linux virtual image, it is not very efficient. Therefore, we will build a lightweight Kali installation and minimize it to make it work.
Generate ISO
By default, Kali Linux ISO has provided us with a GUI installation interface, although it is very easy to use, but we must minimize the amount of data uploaded to DigitalOcean, as we will discuss later. Running GUI on a headless system (headless system) is also a waste of resources, so we need to uninstall or disable it, we will only generate a custom Kali ISO without installing GUI or any other tools. Building ISO will require about 5 GB of hard disk space, so make sure you have enough space.
First, we want to make sure that the current system is the latest version:
Apt updateapt-y full-upgrade
If you have a new kernel installed, restart the system before performing the next step, and then start building.
Apt-y install git live-build cdebootstrap devscriptsgit clone https://gitlab.com/kalilinux/build-scripts/live-build-config.gitcd live-build-config./build.sh-variant minimal-verbose
Building ISO may take a while because it requires a large number of packages to be downloaded and assemble. In the meantime, you can enjoy a delicious cup of coffee or tea.
The verbose option displays the build log on the screen. But you can delete it, and you can do the following in the build.log file:
Tail-f build.log
Once our prompt is returned to the terminal that started build.sh, ISO is ready, and you can find it in the images/ directory.
Create a virtual machine
Now we can start building our virtual machine. Create a new virtual machine, set the operating system to the latest Debian 64-bit and allocate its 20 GB hard disk space (detailed setup information can be found on the Kali Trainingde site). It is important to store the virtual disk as a single file that is dynamically allocated. You can ignore the rest like the number of CPU and RAM, because only disk files will be uploaded to DigitalOcean.
Disk size is also important because the cost is based on the disk size of the custom mirror. It will also affect the choice of instances that we can create. Assuming that the hard drive created is 40 GB, you will not be able to create an instance at the level of $5 per month because its maximum hard disk size is 25 GB. In this case, for an instance with a 50GB disk, we will be forced to use the $10 monthly option. But don't worry, even if the disk is 20 GB, it will expand according to the droplet plan of your choice.
During the installation process, select the manual partition and set it as shown below. All files are in one partition and there are no swap files.
Update the system
After the installation is complete and rebooted, we log in to the console and update the system:
Apt updateapt-y full-upgrade
Sometimes you may forget to add a network image during installation. If this happens, you just need to follow the instructions on the Kali Docs site to fix it, and then run the two commands again.
Install the required software packages
In order for DigitalOcean to configure the system for us, we need to install the cloud-init package:
Apt-y install cloud-initecho 'datasource_list: [ConfigDrive, DigitalOcean, NoCloud, None]' > / etc/cloud/cloud.cfg.d/99_digitalocean.cfgsystemctl enable cloud-init update GRUB
At boot time, the disk is connected and mapped to sda1. Here, however, droplets is shown as vda1. To solve this problem, we need to change all instances of sda1 to vda1 in / boot/grub/grub.cfg:
Sed-I's boot/grub/grub.cfg SDA1Universe vda1Unique g'/
After updating the configuration file, we can run update-grub to update the system:
Update-grub, prepare SSH.
Since we need to connect to the system on DigitalOcean using SSH, we also need to install (and enable) the openssh-server package:
Apt-y install openssh-serversystemctl enable ssh.service
When creating a standard Droplet, you can choose whether or not to use the SSH key. However, when using a custom mirror, the use of the SSH key is enforced. For this reason, DigitalOcean asks us to delete the root password:
Passwd-d root
We also need to create a / root/.ssh folder:
Mkdir / root/.sshCleanup
Before completing the installation of the virtual machine, we run some commands to clean up some extra stuff:
Apt autoremoveapt autocleanrm-rf / var/log/*history-c
At this point, our virtual machine is ready, and we run poweroff to shut down the system.
Poweroff upload
In the virtual machine folder, locate the .vmdk file and compress it using bzip2,gzip or zip to prepare for upload to DigitalOcean.
Bzip2 kali.vmdk
Log in to your DigitalOcean account. In the Manage section on the left, click Images, and then select the Custom Images option.
We upload the compressed disk image here. We named it Kali, marked it Debian, and selected the region and datacenter to upload it to. Note that once uploaded to a location, droplets can only be launched at that location, which is currently a limitation of custom images. Another reminder is that uploaded images will consume your disk space, and DigitalOcean will be billed based on disk usage.
Start Droplet
When finished, the "Uploaded" column shows the time of the upload. Now we will click the "More" option of image and select "Start a droplet".
You will enter the Droplet settings, where you can select the droplet plan,SSH key and project to start it. Because this is a custom image, you need to use a SSH key. You can select an existing key or upload a new key by clicking "New SSH key", which opens the following interface where you can paste the public key and name it:
When you are finished, click Create, as shown below. It then returns to the dashboard (Manage > Droplets), which lists all the current droplet. Because we are using a SSH key, DigitalOcean does not send an email containing Droplet credentials.
It only takes a few seconds after the IP is displayed, and our droplet will be ready. To connect to it, we need to use the private SSH key we created (in this case, MY_KEY):
User@computer:~$ ssh-I MY_KEY root@192.168.1.1The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.ECDSA key fingerprint is SHA256:d83fcd43d25e2a7edd291666160b47360cc85870ded.Are you sure you want to continue connecting (yes/no)? YesWarning: Permanently added 'IP' (ECDSA) to the list of known hosts.Linux kali-s-1vcpu-1gb-nyc3-01 4.19.0-kali5-amd64 # 1 SMP Debian 4.19.37-2kali1 (2019-05-15) x86_64The programs included with the Kali GNU/Linux system are free software;the exact distribution terms for each program are described in theindividual files in / usr/share/doc/*/copyright.Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.
Now that we have a lightweight minimized Kali Linux installation, we can deploy and customize it as needed.
Root@kali-s-1vcpu-1gb-nyc3-01 SMP Debian # lsb_release-aNo LSB modules are available.Distributor ID: KaliDescription: Kali GNU/Linux RollingRelease: 2019.2Codename: n/aroot@kali-s-1vcpu-1gb-nyc3-01 2kali1 # uname-aLinux kali-s-1vcpu-1gb-nyc3-01 4.19.0-kali5-amd64 # 1 SMP Debian 4.19.37-2kali1 (2019-05-15) x86 * 64 GNU/Linuxroot@kali-s-1vcpu-1gb-lon1-01 ~ # free-htotal used free shared buff/cache availableMem: 987Mi 51Mi 527Mi 1.0Mi 407Mi 790MiSwap: 0B 0B 0B on how to build a system with an official Kali image on DigitalOcean's server, that's all. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.