第一个:Linux系统性能优化

2019-07-13 23:05发布

#安装常用工具,添加国内源
yum install wget net-tools  -y


mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo


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


setenforce 0


getenforce


#关闭防火墙,centos7已默认关闭
/etc/init.d/iptables stop


chkconfig iptables off


#关闭无用的自启进程
chkconfig|egrep -v "crond|sshd|network|rsyslog|sysstat"|awk '{print "chkconfig",$1,"off"}'|bash


chkconfig --list|grep 3:on


#时间同步
echo '*/5 * * * * /usr/sbin/ntpdate cn.ntp.org.cn >/dev/null 2>&1' >>/var/spool/cron/root

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


yum install lrzsz nmap tree dos2unix nc -y