CentOS-7基础配置
0、虚拟机安装
禁用虚拟机中不使用的模块
echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist.conf
echo "blacklist intel_rapl" >> /etc/modprobe.d/blacklist.conf
echo "blacklist pcspkr" >> /etc/modprobe.d/blacklist.conf
1、配置静态IP
使用 ip a
命令获取物理网卡的初始配置信息:
1:lo:
2:ens32:
修改网卡配置文件: vi /etc/sysconfig/network-scripts/ifcfg-ens32
:
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.8
NETMASK=255.255.255.0
GATEWAY=192.168.0.254
DNS1=114.114.114.114
DNS2=8.8.8.8
修改/etc/hosts,配置主机名和静态IP
2、关闭防火墙和SELinux
systemctl stop firewalld
systemctl disable firewalld
sed -i '/SELINUX=enforcing/s/^/#/' /etc/selinux/config
sed -i '/#SELINUX=enforcing/a SELinux=disabled' /etc/selinux/config
3、关闭SSH的DNS查找选项
sed -i '/#UseDNS yes/a UseDNS no' /etc/ssh/sshd_config
4、更新系统并安装基础软件包
yum -y update
yum -y groupinstall 'X Window System'
yum -y groupinstall fonts
yum -y groupinstall "Development Tools"
yum -y install vim sudo wget net-tools
yum -y install kernel-devel
yum clean all