Table of Contents
I. Theory
1. Kali Linux
II. Experiment
1. Preparation for Installing Kali Linux on a Virtual Machine
2. Installing Kali Linux
3. Changing to Domestic Sources for Kali Linux
4. Setting a Static IP for Kali Linux
5. Enabling SSH Remote Access for Kali Linux
6. Remote Access to Kali Linux via MobaXterm
III. Issues
1. Error Configuring /etc/resolv.conf
2. Which apt commands replace apt-get commands
I. Theory
1. Kali Linux
(1) Concept
Kali Linux is a Debian-based Linux distribution designed for digital forensics and penetration testing.
(2) Official Website
Get Kali | Kali Linux
(3) Download
Index of /kali-images/
(4) Select Version
https://old.kali.org/kali-images/kali-2023.4/kali-linux-2023.4-installer-amd64.iso

II. Experiment
1. Preparation for Installing Kali Linux on a Virtual Machine
(1) Create a New Virtual Machine

(2) Select Custom (Advanced) and click the “Next” button.

(3) Choose to install the operating system later, and click the “Next” button.

(4) Select “Linux” and choose the version, then click the “Next” button.
Select Linux operating system, version Debian 64-bit

(5) Enter the virtual machine name and save location. Click the “Next” button.

(6) Set the processor according to your needs, and click the “Next” button.

(7) Allocate memory reasonably based on your computer’s memory; here, select 8GB.

(8) Use Network Address Translation (NAT).

(9) Select the I/O controller type.

(10) Select the disk type.

(11) Select the disk.

(12) Specify the disk capacity.

(13) Specify the disk file.

(14) Customize hardware.
Browse and select the appropriate ISO file.

Click Finish to return.

2. Installing Kali Linux
(1) Start this virtual machine.

(2) Select the first option, Graphical install.

(3) Select language.

(4) Select location.
(5) Configure keyboard.

(6) Wait for components to install.

(7) Configure network.
Hostname

Domain is empty.

(8) Set user and password.
Username


Password

(9) Disk partitioning (default).

Continue.
Use the first partition scheme.

Complete the partitioning operation.

Yes.

(10) Wait for the system to install.

You can see that the system kernel is based on Linux 6.5.0.

(11) Select the installation program (default).

Wait for installation (this may take a while).

(12) Yes.

(13) Select “/dev/sda”.

(14) Complete the installation and click continue.

(15) Log in.

Enter the system.

(16) Create a root account.
First enter the previously set Kali password, then enter the root account password twice.
sudo passwd root

(17) Switch to the root account.
su root

3. Changing to Domestic Sources for Kali Linux
(1) Domestic Sources
1) Official Source
# deb http://http.kali.org/kali kali-rolling main non-free contrib
# deb-src http://http.kali.org/kali kali-rolling main non-free contrib
2) Aliyun
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
3) Huawei Cloud
deb https://repo.huaweicloud.com/kali kali-rolling main non-free contrib
deb-src https://repo.huaweicloud.com/kali kali-rolling main non-free contrib
4) USTC
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
5) Tsinghua University
deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
6) NetEase
deb http://mirrors.163.com/debian wheezy main non-free contrib
deb-src http://mirrors.163.com/debian wheezy main non-free contrib
deb http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian wheezy-proposed-updates main non-free contrib
deb http://mirrors.163.com/debian-security wheezy/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security wheezy/updates main non-free contrib
7) Zhejiang University
deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
8) Neusoft University
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
9) Chongqing University
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
(2) View the official source.
vi /etc/apt/sources.list

(3) Comment out the official source and add domestic sources.

(4) Update the index.
apt update

(5) View the upgrade list.
apt list --upgrade

(6) Update software.
apt upgrade

The installation process will prompt, click OK to continue the installation.

(5) Install Chinese input method.
apt install fcitx fcitx-googlepinyin

4. Setting a Static IP for Kali Linux
(1) Check IP.
A dynamic IP is 192.168.204.146.
ip addr

ifconfig

(2) Confirm vim command.
apt install vim
(3) View network configuration.
vim /etc/network/interfaces


(4) Add DNS.
vim /etc/resolv.conf
# 8.8.8.8 is a common DNS for domestic mobile, telecom, and unicom. 8.8.8.8 is provided by GOOGLE, 119.29.29.29 is Tencent's public DNS, 223.5.5.5 is Alibaba's public DNS.
nameserver 8.8.8.8
nameserver 114.114.114.114
nameserver 119.29.29.29
nameserver 223.5.5.5

Before modification:

After modification:

(5) Change directory to modify network configuration.
Configure static IP.
vim /etc/network/interfaces.d/eth0
auto eth0
iface eth0 inet static # Set eth0 to use the default static address
address 192.168.204.100 # Set eth0's IP address
netmask 255.255.255.0 # Set eth0's subnet mask
gateway 192.168.204.2 # Configure the default gateway for the current host

Modification:

(6) Restart the network.
systemctl restart networking.service

(7) Set the system to automatically enable the network card after startup.
update-rc.d networking defaults

(8) Check IP.
A dynamic IP is 192.168.204.146.
A static IP is 192.168.204.100.
ip addr

ifconfig

5. Enabling SSH Remote Access for Kali Linux
(1) Edit the ssh_config file.
cd /etc/ssh
vim ssh_config

Before modification:


After modification:

(2) Edit the sshd_config file.
cd /etc/ssh
vim sshd_config

Before modification:


After modification:


(3) Restart the service.
service ssh restart

(4) Check the status of the ssh service.
service ssh status

(5) Set the system to automatically start the ssh service.
update-rc.d ssh enable

6. Remote Access to Kali Linux via MobaXterm
(1) Download.
MobaXterm free Xserver and tabbed SSH client for Windows (mobatek.net)
(2) Set up SSH.

Enter the password to log in.

(3) Check the system version.
cat /etc/os-release

III. Issues
1. Error Configuring /etc/resolv.conf
(1) Error message.
The network connection has been disconnected, temporary failure in name resolution.
the network connection has been disconnected Temporary failure in name resolution
(2) Cause analysis.
In the new version of Kali Linux, the default initial state of network-manager is not started. Simply modifying /etc/resolv.conf will not take effect; this file needs network-manager to be started to take effect.
(3) Solution.
Enable network-manager and change false to true.
vim /etc/NetworkManager/NetworkManager.conf
……
managed=true

Before modification:

After modification:
2. apt command replaces which apt-get commands
(1) Commands.
apt install | apt-get install | Install package
apt remove | apt-get remove | Remove package
apt purge | apt-get purge | Remove package and configuration files
apt update | apt-get update | Refresh repository index
apt upgrade | apt-get upgrade | Upgrade all upgradable packages
apt autoremove | apt-get autoremove | Automatically remove unnecessary packages
apt full-upgrade | apt-get dist-upgrade | Automatically handle dependencies when upgrading packages
apt search | apt-cache search | Search applications
apt show | apt-cache show | Display installation details
Resource Directory
1. Growth roadmap & learning plan
2. Supporting video tutorials
3. SRC & hacker literature
4. Internet protection action materials
5. Must-read books for hackers
6. Collection of interview questions
Scan the code below to access.

