基础设置
设置阿里源
镜像下载地址: https://mirrors.aliyun.com/kali-images/
修改 /etc/apt/sources.list , 将相关 url 改成阿里云的源。
#deb https://mirrors.aliyun.com/kali kali-rolling main non-free contrib
#deb-src https://mirrors.aliyun.com/kali kali-rolling main non-free contrib
启用sshd服务
┌──(root💀kali)-[~]
└─# systemctl enable ssh 3 ⨯
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
┌──(root💀kali)-[~]
└─# systemctl start ssh
┌──(root💀kali)-[~]
└─# systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2023-02-01 21:02:50 CST; 16s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 4689 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 4690 (sshd)
Tasks: 1 (limit: 9359)
Memory: 2.0M
CPU: 24ms
CGroup: /system.slice/ssh.service
└─4690 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
Feb 01 21:02:50 kali systemd[1]: Starting OpenBSD Secure Shell server...
Feb 01 21:02:50 kali sshd[4690]: Server listening on 0.0.0.0 port 22.
Feb 01 21:02:50 kali sshd[4690]: Server listening on :: port 22.
Feb 01 21:02:50 kali systemd[1]: Started OpenBSD Secure Shell server.
┌──(root💀kali)-[~]
└─#
设置中文输入法
设置时区
$ sudo dpkg-reconfigure tzdata
当前Kali版本
# lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2022.2
Codename: kali-rolling
启动apache2和php
kali本身已经安装了apache2和php8.1.5,需要安装php8.1-fpm (The PHP 8.1 FastCGI Process Manager)
#apt install php8.1-fpm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libapache2-mod-php8.1 php8.1-cli php8.1-common php8.1-mysql php8.1-opcache php8.1-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
php8.1-fpm
The following packages will be upgraded:
libapache2-mod-php8.1 php8.1-cli php8.1-common php8.1-mysql php8.1-opcache php8.1-readline
6 upgraded, 1 newly installed, 0 to remove and 1051 not upgraded.
Need to get 6,589 kB of archives.
After this operation, 5,200 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirrors.aliyun.com/kali kali-rolling/main i386 php8.1-readline i386 8.1.5-1+b1 [13.2 kB]
Get:2 http://mirrors.aliyun.com/kali kali-rolling/main i386 php8.1-opcache i386 8.1.5-1+b1 [322 kB]
Get:3 http://mirrors.aliyun.com/kali kali-rolling/main i386 php8.1-mysql i386 8.1.5-1+b1 [121 kB]
Get:4 http://mirrors.aliyun.com/kali kali-rolling/main i386 libapache2-mod-php8.1 i386 8.1.5-1+b1 [1,636 kB]
Get:5 http://mirrors.aliyun.com/kali kali-rolling/main i386 php8.1-cli i386 8.1.5-1+b1 [1,688 kB]
Get:6 http://mirrors.aliyun.com/kali kali-rolling/main i386 php8.1-common i386 8.1.5-1+b1 [1,105 kB]
Get:7 http://mirrors.aliyun.com/kali kali-rolling/main i386 php8.1-fpm i386 8.1.5-1+b1 [1,704 kB]
Fetched 6,589 kB in 3s (2,342 kB/s)
(Reading database ... 295981 files and directories currently installed.)
Preparing to unpack .../0-php8.1-readline_8.1.5-1+b1_i386.deb ...
Unpacking php8.1-readline (8.1.5-1+b1) over (8.1.2-1+b2) ...
Preparing to unpack .../1-php8.1-opcache_8.1.5-1+b1_i386.deb ...
Unpacking php8.1-opcache (8.1.5-1+b1) over (8.1.2-1+b2) ...
Preparing to unpack .../2-php8.1-mysql_8.1.5-1+b1_i386.deb ...
Unpacking php8.1-mysql (8.1.5-1+b1) over (8.1.2-1+b2) ...
Preparing to unpack .../3-libapache2-mod-php8.1_8.1.5-1+b1_i386.deb ...
Unpacking libapache2-mod-php8.1 (8.1.5-1+b1) over (8.1.2-1+b2) ...
Preparing to unpack .../4-php8.1-cli_8.1.5-1+b1_i386.deb ...
Unpacking php8.1-cli (8.1.5-1+b1) over (8.1.2-1+b2) ...
Preparing to unpack .../5-php8.1-common_8.1.5-1+b1_i386.deb ...
Unpacking php8.1-common (8.1.5-1+b1) over (8.1.2-1+b2) ...
Selecting previously unselected package php8.1-fpm.
Preparing to unpack .../6-php8.1-fpm_8.1.5-1+b1_i386.deb ...
Unpacking php8.1-fpm (8.1.5-1+b1) ...
Setting up php8.1-common (8.1.5-1+b1) ...
Setting up php8.1-mysql (8.1.5-1+b1) ...
Setting up php8.1-readline (8.1.5-1+b1) ...
Setting up php8.1-opcache (8.1.5-1+b1) ...
Setting up php8.1-cli (8.1.5-1+b1) ...
Setting up libapache2-mod-php8.1 (8.1.5-1+b1) ...
libapache2-mod-php8.1: not switching MPM - already enabled
Setting up php8.1-fpm (8.1.5-1+b1) ...
Creating config file /etc/php/8.1/fpm/php.ini with new version
NOTICE: Not enabling PHP 8.1 FPM by default.
NOTICE: To enable PHP 8.1 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.1-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
update-rc.d: We have no instructions for the php8.1-fpm init script.
update-rc.d: It looks like a network service, we disable it.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for kali-menu (2022.2.0) ...
Processing triggers for php8.1-cli (8.1.5-1+b1) ...
Processing triggers for libapache2-mod-php8.1 (8.1.5-1+b1) ...
Processing triggers for php8.1-fpm (8.1.5-1+b1) ...
NOTICE: Not enabling PHP 8.1 FPM by default.
NOTICE: To enable PHP 8.1 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.1-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
#a2enmod proxy_fcgi setenvif
Considering dependency proxy for proxy_fcgi:
Enabling module proxy.
Enabling module proxy_fcgi.
Module setenvif already enabled
To activate the new configuration, you need to run:
systemctl restart apache2
#a2enconf php8.1-fpm
Enabling conf php8.1-fpm.
To activate the new configuration, you need to run:
systemctl reload apache2
启用php8.1-fpm,并重启apache2
# systemctl enable php8.1-fpm
┌──(root㉿kali)-[/etc/apache2]
└─# systemctl enable php8.1-fpm
Synchronizing state of php8.1-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php8.1-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/php8.1-fpm.service → /lib/systemd/system/php8.1-fpm.service.
┌──(root㉿kali)-[/etc/apache2]
└─# systemctl start php8.1-fpm
┌──(root㉿kali)-[/etc/apache2]
└─# systemctl reload apache2
在/var/www/html下编辑一个php文件,通过浏览器即可打开
<?php
phpinfo();
?>