CentOS 7基础优化

新装的系统有不少东西需要优化和安装,通过终端敲命令过于浪费时间,干脆写成一个简单的小脚本供自己以后使用,其中有些配置需要根据环境环境修改。

systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
rm -rf /etc/yum.repos.d/*
mkdir .ssh && chmod 700 .ssh
curl http://10.0.0.102/authorized_keys > .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
curl http://10.0.0.102/centos7.repo > /etc/yum.repos.d/centos7.repo
curl http://10.0.0.102/epel.repo > /etc/yum.repos.d/epel.repo
curl http://10.0.0.102/resolv.conf > /etc/resolv.conf
curl http://mirrors.ustc.edu.cn/epel/RPM-GPG-KEY-EPEL-7 > /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
curl http://10.0.0.102/ntp.conf > /etc/ntp.conf
curl http://10.0.0.102/hosts > /etc/hosts
yum makecache
yum -y install vim wget lrzsz bmon python-pip net-tools ntp dstat 
yum -y update
systemctl enable ntpd
chmod 777 /etc/rc.d/rc.local
sed -i -e '129s/#/ /g' /etc/ssh/sshd_config
sed -i -e '129s/yes$/no/g' /etc/ssh/sshd_config
sed -i '/^GSS/s/yes/no/g' /etc/ssh/sshd_config
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
timedatectl set-local-rtc 1
clock -w
reboot

这个简陋的小脚本先这样用着,等以后有需求了再慢慢修改、优化。

点赞

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注