1- CentOS7配置静态IP地址:
iface="网络接口名" cd /etc/sysconfig/network-scripts/; sed -i 's/^/#/' ifcfg-${iface} cat <>/etc/sysconfig/network-scripts/ifcfg-${iface}TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=noneDEFROUTE=yesNAME=${iface}DEVICE=${iface}ONBOOT=yesIPADDR=192.168.122.11PREFIX=24GATEWAY=192.168.122.1DNS1=223.5.5.5DNS2=192.168.122.1DNS3=8.8.8.8EOF systemctl restart network #可以先不重启网络,先配置完下面的ssh再重启
2- 解决ssh速度很慢的问题:
sed -ri 's/^(GSSAPIAuthentication).*/\1 no/; $aUseDNS no' /etc/ssh/sshd_config; systemctl restart sshd #GSSAPI认证关闭,DNS关闭
3- CentOS7使用阿里源:
sed -ri 's/^enabled=1/enabled=0/; s/^plugins=1/plugins=0/' /etc/yum/pluginconf.d/fastestmirror.conf /etc/yum.conf #去掉寻找最快源的功能Determining fastest mirrorscd /etc/yum.repos.d/; mv CentOS-Base.repo CentOS-Base.repo.bak; curl -Lo CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && { yum clean all; yum makecache; } #替换成阿里源
4- CentOS7关闭防火墙/SELINUX
systemctl stop firewalld; systemctl disable firewalld ; setenforce 0;sed -ri 's/^(SELINUX).*/\1=disabled/' /etc/selinux/config