CentOS 7 系统初始化

一、需改网卡名称为 eth[x]

/etc/sysconfig/grub

GRUB_CMDLINE_LINUX ="... net.ifnames=0 biosdevname=0 ..."
  • BIOS
grub2-mkconfig  -o  /boot/grub2/grub.cfg
  • EFI
grub2-mkconfig  -o  /boot/efi/EFI/centos/grub2/grub.cfg

二、升级最新软件包

yum update -y

三、卸载相关软件

yum remove NetworkManager* -y
yum remove postfix -y
userdel -r postfix -y
yum remove aic94xx-firmware-30-6.el7.noarch -y
yum remove iwl2000-firmware-18.168.6.1-80.el7_9.noarch -y
yum remove iwl6050-firmware-41.28.5.1-80.el7_9.noarch -y
yum remove iwl3945-firmware-15.32.2.9-80.el7_9.noarch -y
yum remove iwl105-firmware-18.168.6.1-80.el7_9.noarch -y
yum remove iwl4965-firmware-228.61.2.24-80.el7_9.noarch -y
yum remove iwl6000g2b-firmware-18.168.6.1-80.el7_9.noarch -y
yum remove iwl100-firmware-39.31.5.1-80.el7_9.noarch -y
yum remove iwl3160-firmware-25.30.13.0-80.el7_9.noarch -y
yum remove alsa-tools-firmware-1.1.0-1.el7.x86_64 -y
yum remove ivtv-firmware-20080701-26.el7.noarch -y
yum remove linux-firmware-20200421-80.git78c0348.el7_9.noarch -y
yum remove iwl2030-firmware-18.168.6.1-80.el7_9.noarch -y
yum remove iwl135-firmware-18.168.6.1-80.el7_9.noarch -y
yum remove iwl7260-firmware-25.30.13.0-80.el7_9.noarch -y
yum remove iwl6000g2a-firmware-18.168.6.1-80.el7_9.noarch -y
yum remove iwl1000-firmware-39.31.5.1-80.el7_9.noarch -y
yum remove iwl5000-firmware-8.83.5.1_1-80.el7_9.noarch -y
yum remove iwl5150-firmware-8.24.2.2-80.el7_9.noarch -y
yum remove iwl6000-firmware-9.221.4.1-80.el7_9.noarch -y
yum remove alsa-firmware-1.0.28-2.el7.noarch -y
yum remove centos-logos-70.0.6-3.el7.centos.noarch -y
yum remove mariadb-libs-5.5.68-1.el7.x86_64 -y

查看当前kernel版本、卸载历史kernel

四、停止服务

systemctl stop firewalld
systemctl disable firewalld

五、停止SELINUX

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

六、提升SSH连接速度

sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config

七、配置VI编辑操作

cat >> /etc/virc << EOF
set tabstop=4
set shiftwidth=4
set expandtab
syntax on
set nu
EOF

八、配置服务器时间

yum install ntp -y
timedatectl set-timezone "Asia/Shanghai"
/usr/sbin/ntpdate cn.pool.ntp.org
echo "1 4 * * * /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root