- 更新国内源
# Backup Base and epel
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@localhost ~]# mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
# 以下根据系统自选
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
- 安装基础包
[root@localhost ~]# yum install -y gcc gcc-c++ make cmake net-tools httpd-tools wget vim tree htop \
iotop iftop lrzsz unzip telnet nmap nc psmisc dos2unix bash-completion sysstat \
lsof tcpdump bzip2 zip unzip bind-utils bash-completion-extras
- 关闭firewalld && 关闭SELinux
[root@localhost ~]# setenforce 0 && sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
[root@localhost ~]# systemctl stop firewalld.service && systemctl disable firewalld.service
- 配置网络名称为eth0
[root@localhost ~]# vim /etc/sysconfig/grub
GRUB_CMDLINE_LINUX # 追加 "net.ifnames=0"
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg #刷新内核
[root@localhost ~]# mv /etc/sysconfig/network-scripts/{ifcfg-ens32,ifcfg-eth0} # 修改默认网卡名为eth0
[root@localhost ~]# cat >> /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF # 设置固定IP
IPADDR=10.0.0.10
GATEWAY=10.0.0.254
NETMASK=255.255.255.0
DNS1=223.5.5.5
EOF
- SSH 连接速度优化
[root@localhost ~]# cat /etc/ssh/sshd_config |egrep "GSSAPIAuthentication|UseDNS"
GSSAPIAuthentication yes # 修改前
UseDNS yes
[root@localhost ~]# sed -i 's/#UseDNS yes/UseDNS no/g;s/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
[root@localhost ~]# cat /etc/ssh/sshd_config |egrep "GSSAPIAuthentication|UseDNS"
GSSAPIAuthentication no # 修改后
UseDNS no
[root@localhost ~]# systemctl restart sshd
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。