模板机优化

tech2026-08-19  4

1.网卡优化

优化网卡1

vi /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes NAME=eth0 DEVICE=eth0 ONBOOT=yes IPADDR=10.0.0.200 PREFIX=24 GATEWAY=10.0.0.2 DNS1=223.5.5.5

优化网卡2

vi /etc/sysconfig/network-scripts/ifcfg-eth1 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes NAME=eth1 DEVICE=eth1 ONBOOT=yes IPADDR=172.16.1.200 PREFIX=24

重启网卡

systemctl restart network

1.配置yum仓库

rm -f /etc/yum.repos.d/* curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2.安装基础软件包

yum install net-tools vim tree htop iftop gcc gcc-c++ glibc\ iotop lrzsz sl wget unzip telnet nmap nc psmisc \ dos2unix bash-completion bash-completion-extra sysstat \

3.关闭防火墙firewalld

systemctl disable firewalld systemctl stop firewalld

4.关闭selinux

sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config

5.调整单个进程最大能打开文件的数量

echo '* - nofile 65535' >> /etc/security/limits.conf

标题#6.关闭dns

sed -ri 's#(.*UseDNS.*)#\1\nUseDNS no#g' /etc/ssh/sshd_config

7.自动同步服务器

yum -y install ntpdate vim /etc/crontab PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin >/dev/null */5 * * * * root ntpdate ntp1.aliyun.com > /dev/null

修改主机名

hostnamectl set-hostname backup
最新回复(0)