初始化配置:
//修改主机名字,无需重启,永久修改。
hostnamectl set-hostname ServerName
//修改网卡IP
[root@ServerName ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet #网络类型,以太网。必须
BOOTPROTO=static #IP设置方式,静态,必须。自动的话将static设置为dhcp
NAME=eth0 #网卡名,必须
DEVICE=eth0 #设备名,必须
ONBOOT=yes #网卡开启自启动,必须
IPADDR=192.168.235.82
NETWORK=255.255.255.0
GATEWAY=192.168.235.2
DNS1=223.5.5.5
//关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
//关闭图形化的网络管理器,CLI界面的用不到。图形界面的可以留着
systemctl stop NetworkManager
systemctl disable NetworkManager
//关闭postfix一个电子邮件服务器
systemctl stop postfix
systemctl disable postfix
//关闭SELinux
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
cat !$
//优化远程shell登录
sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
s