太鼓达人 发表于 2018-6-22 16:40:34

Kali Linux安装及基础配置

0x00 安装Kali

Kali Linux基于Debian Linux,旨在渗透测试及安全审计。

下载官方镜像
制作USB启动盘
LVM安装系统
0x01 LVM分区空间划分

查看当前分区情况
root@kali:~# df -hl
文件系统 容量 已用 可用 已用% 挂载点
rootfs 9.1G 7.0G 1.7G 82% /
udev 10M 0 10M 0% /dev
tmpfs 783M 728K 782M 1% /run
/dev/mapper/kali-root 9.1G 7.0G 1.7G 82% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.6G 240K 1.6G 1% /run/shm
/dev/sda2 229M 29M 189M 13% /boot
/dev/sda1 487M 128K 486M 1% /boot/efi
/dev/mapper/kali-home 418G 71M 397G 1% /home

卸载/home所在文件系统
root@kali:~# umount /dev/mapper/kali-home
检测/home所在文件系统
root@kali:~# e2fsck -f /dev/mapper/kali-home
e2fsck 1.42.5 (29-Jul-2012)
第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
/dev/mapper/kali-home: 11/27803648 files (0.0% non-contiguous), 1795740/111192064 blocks

重新划分/home分区大小
root@kali:~# resize2fs /dev/mapper/kali-home 222G
resize2fs 1.42.5 (29-Jul-2012)
Resizing the filesystem on /dev/mapper/kali-home to 58195968 (4k) blocks.
The filesystem on /dev/mapper/kali-home is now 58195968 blocks long.

减少/home逻辑分区大小
root@kali:~# lvreduce -L 222G /dev/mapper/kali-home
WARNING: Reducing active and open logical volume to 222.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce home? : y
Reducing logical volume home to 222.00 GiB
Logical volume home successfully resized

增加/逻辑分区大小
root@kali:~# lvresize -L +200G /dev/mapper/kali-root
Extending logical volume root to 209.86 GiB
Logical volume root successfully resized

重新划分/分区大小
root@kali:~# resize2fs /dev/mapper/kali-root
resize2fs 1.42.5 (29-Jul-2012)
Filesystem at /dev/mapper/kali-root is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 14
The filesystem on /dev/mapper/kali-root is now 55012352 blocks long.

检测重新分区效果
root@kali:~# df -hl
文件系统 容量 已用 可用 已用% 挂载点
rootfs 207G 7.0G 191G 4% /
udev 10M 0 10M 0% /dev
tmpfs 783M 728K 782M 1% /run
/dev/mapper/kali-root 207G 7.0G 191G 4% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.6G 244K 1.6G 1% /run/shm
/dev/sda2 229M 29M 189M 13% /boot
/dev/sda1 487M 128K 486M 1% /boot/efi
/dev/mapper/kali-home 219G 60M 208G 1% /home

0x02 添加用户及权限

创建新用户
root@kali:~# adduser yogy
正在添加用户"yogy"...
正在添加新组"yogy" (1002)...
正在添加新用户"yogy" (1001) 到组"yogy"...
创建主目录"/home/yogy"...
正在从"/etc/skel"复制文件...
输入新的 UNIX 密码:
重新输入新的 UNIX 密码:
passwd:已成功更新密码
正在改变 yogy 的用户信息
请输入新值,或直接敲回车键以使用默认值
全名 []:
房间号码 []:
工作电话 []:
家庭电话 []:
其它 []:
这些信息是否正确? y

赋root权限
root@kali:~# sudo vim /etc/sudoers
# User privilege specification
root ALL=(ALL:ALL) ALL
yogy ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

0x03 修改软件源更新

添加Kali源
yogy@kali:~$ sudo vim /etc/apt/sources.list
#阿里源
deb http://mirrors.aliyun.com/kali kali main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali main non-free contrib
deb http://mirrors.aliyun.com/kali-security kali/updates main contrib non-free
deb http://mirror.nus.edu.sg/kali/kali/ kali main non-free contrib
#debain源
deb http://mirrors.163.com/debian/ wheezy main contrib
deb http://mirrors.163.com/debian/ wheezy-proposed-updates main contrib
deb-src http://mirrors.163.com/debian/ wheezy main contrib
deb-src http://mirrors.163.com/debian/ wheezy-proposed-updates main contrib

更新软件
yogy@kali:~$ sudo apt-get update && sudo apt-get upgrade
命中 http://mirrors.aliyun.com kali Release.gpg
命中 http://mirrors.163.com wheezy Release.gpg
...
下载 12.9 kB,耗时 1分 1秒 (210 B/s)
正在读取软件包列表... 完成
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。

0x04 修改时区UTC

查看当前时间
yogy@kali:~$ date -R
Sat, 10 Jul 2015 22:57:28 -0800
选择时区
yogy@kali:~$ tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
...
Asia
...
none - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
...
China 26) Laos 43) Taiwan
...
#? 9
Please select one of the following time zone regions.
Beijing Time
Xinjiang Time
#? 1
The following information has been given:
China
Beijing Time
Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Tue Jul 7 04:10:17 CST 2015.
Universal Time is now: Mon Jul 6 20:10:17 UTC 2015.
Is the above information OK?
Yes
No
#? 1
You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
修改profile并生效
yogy@kali:~$ echo "TZ='Asia/Shanghai'; export TZ" >> ~/.profile
yogy@kali:~$ source ~/.profile
验证效果
yogy@kali:~$ date -R
Sat, 11 Jul 2015 14:57:28 +0800
0x05 配置GNOME 3

GNOME 3是新一代Linux桌面管理器,简洁优雅。

开启GNOME 3模式
gsettings set org.gnome.desktop.session session-name gnome
更换主题
从gnome-look下载GTK 3.x主题,如Gnome-Cupertino
解压至目录/usr/share/themes/
yogy@kali:~/Downloads$ tar -zxvf 147061-Gnome-Cupertino-2.1.5.tar.gz -C /usr/share/themes/
Advanced Settings -- 主题 -- GTK主题&&窗口主题
添加插件
从gnome下载插件
移至目录~/.local/share/gnome-shell/extensions/
Advanced Settings -- Shell 扩展
在线插件管理
0x06 浏览器安装Flash插件

Kali自带的Iceweasel浏览器,是Mozilla Firefox的Debian再发布版。

在adobe下载flash
解压并移至指定文件夹
yogy@kali:~/Downloads$ tar -zxvf install_flash_player_11_linux.x86_64.tar.gz
yogy@kali:~/Downloads$ sudo cp libflashplayer.so /usr/lib/mozilla/plugins/
yogy@kali:~/Downloads$ cp -r ./usr/* /usr/
管理插件
重启浏览器,在插件管理中启动Shockwave Flash
0x07 安装SCIM输入法

安装SCIM,实现汉语、日语、英语的三语输入。

安装主程序
yogy@kali:~$ sudo apt-get install scim scim-gtk-immodule scim-modules-socket scim-modules-talbe
添加汉语输入
下载scim-googlepinyin
解压并安装
yogy@kali:~/Downloads$ tar xzfv scim-googlepinyin.tar.gz
yogy@kali:~/Downloads$ cd scim-googlepinyin.tar.gz
yogy@kali:~/Downloads$ PKG_CONFIG_PATH=/usr/lib/pkgconfig
yogy@kali:~/Downloads$ ./autogen.sh
yogy@kali:~/Downloads$ make
yogy@kali:~/Downloads$ sudo make install
添加日语输入
yogy@kali:~$ sudo apt-get install scim-tables-ja
0x08 清理USB启动盘

清理fstab
yogy@kali:~$ sudo gedit /etc/fstab
# 使用USB安装系统时生成,需将其注释以正常挂载
# /dev/sdc1 /media/usb0 auto rw,user,noauto 0 0
# /dev/sdc2 /media/usb1 auto rw,user,noauto 0 0

格式化U盘
卸载挂载点
yogy@kali:~$ sudo umount /dev/sdd1
yogy@kali:~$ sudo umount /dev/sdd2
完全格式化
yogy@kali:~$ sudo mkfs.vfat /dev/sdd1
yogy@kali:~$ sudo mkfs.vfat -I /dev/sdd
0x09 调节开机亮度

安装laptop-mode-tools
yogy@kali:~$ apt-get install laptop-mode-tools
查看亮度极值
yogy@kali:~$ sudo gedit /sys/class/backlight/intel_backlight/max_brightness
4437

配置LCD亮度控制
yogy@kali:~$ sudo gedit /etc/laptop-mode/conf.d/lcd-brightness.conf
CONTROL_BRIGHTNESS=1
BATT_BRIGHTNESS_COMMAND="echo 2555"
LM_AC_BRIGHTNESS_COMMAND="echo 2555"
NOLM_AC_BRIGHTNESS_COMMAND="echo 2555"
#BRIGHTNESS_OUTPUT="/proc/acpi/video/VID/LCD/brightness"
BRIGHTNESS_OUTPUT="/sys/class/backlight/intel_backlight/brightness"

0x0a 手动配置静态网络

配置IP和DNS
yogy@kali:~$ sudo vim /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.21.5.67
netmask 255.255.0.0
gateway 10.21.0.254
dns-nameservers 159.226.8.6 159.226.39.1 4.4.4.4
托管设备
yogy@kali:~$ sudo sed -i "s/managed=false/managed=true/" /etc/NetworkManager/NetworkManager
.conf
重启网络
yogy@kali:~$ sudo /etc/init.d/networking restart
0x0b 系统备份与还原

备份
直接备份
yogy@kali:~$ sudo tar cvpfz backup-kali.tgz --exclude=/backup-kali.tgz --exclude=/proc --exclude=/l
ost+found --exclude=/mnt --exclude=/tmp --exclude=/sys /
bzip2压缩备份
yogy@kali:~$ sudo tar cvpfj backup-kali.tar.bz2 --exclude=/backup-kali.tar.bz2 --exclude=/proc --excl
ude=/lost+found --exclude=/mnt --exclude=/tmp --exclude=/sys /
还原
直接还原
yogy@kali:~$ sudo tar xvpfz backup-kali.tgz -C /
bzip2压缩还原
yogy@kali:~$ sudo tar xvpfj backup-kali.tar.bz2 -C /
补齐目录
yogy@kali:~$ sudo mkdir /proc /lost+found /mnt /tmp /sys



页: [1]
查看完整版本: Kali Linux安装及基础配置