二进制包安装
- centos7: rpm包
- rpm -ivh
- kali: deban包
- dpkg -i deb包
网络镜像源配置
- centos7:
- 配置文件路径 /etc/yum.repos.d
- 配置镜像源,会生成 .repo为后缀的文件,
- 文件内容格式:
[后缀.repo四部-----------------[标签]name=描述baseurl=file:/run/media/root/CentOS 7 x86_64/(光盘地址 ,可用df -Th查看)gpgcheck=0------------------]
- yum命令
- yum install vim -y
yum clean all 清除缓存
yum makecache(刷新缓存)
yum repolist 查看当前yum配置情况
- kali:
- 配置文件路径: /etc/apt/sources.list
- sudo apt-get install xxx
- sudo apt autoremove xxx
网络配置
- 一次性配置
- 配置ip地址 ip address add 地址/子网掩码数 dev 网卡名(ens33)
- 配置网关 ip route add default via 地址
- 配置dns 配置文件 /etc/resolv.conf 写入 “nameserver dns 地址”
- 永久配置
- 开机自启脚本(废弃)
- ip address add x.x.x.x/24 dev ens33
- ip route add default via x.x.x.x
- echo "nameserver 114.114.114.114" >> /etc/resolv.conf
- 网卡配置文件配置
- centos7:
- /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33 TYPE=Ethernet ONBOOT=yes BOOTPROTO=static|dhcp|none IPADDR=x.x.x.x NETMASK=255.255.x.x GATEWAY=x.x.x.x DNS1=x.x.x.x DNS2=x.x.x.x
- 重启网卡:
- systemctl restart NetworkManager
- systemctl status NetworkManager 查看网卡状态
- kali:
- /etc/network/interfaces
auto eth0 iface eth0 inet static address x.x.x.x netmask x.x.x.x gateway x.x.x.x
- 重启网卡:
- systemctl restart networking.service
- 开启路由转发功能:
- /proc/sys/net/ipv4/ip_forward
- echo 1 > ip_forward
- 永久修改内核配置:
- /etc/sysctl.conf net.ipv4.ip_forward=1
- sysctl -p 立即生效
总结:
四个配置文件
/etc/yum.repos.d
/etc/apt/sources.list
/etc/sysconfig/network-scripts/ifcfg-ens33
/etc/network/interfaces