CentOS系统初始化

关闭防火墙,Selinux

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

配置yum源

mkdir /etc/yum.repos.d/OldRepo
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/OldRepo/
curl -so /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -so /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i '/aliyuncs.com/d' /etc/yum.repos.d/Centos-7.repo /etc/yum.repos.d/epel-7.repo

时间同步

yum install -y ntpdate
ntpdate ntp1.aliyun.com
hwclock -w
echo "*/20 * * * * $(which ntpdate) ntp1.aliyun.com > /dev/null 2>&1 && $(which hwclock) -w" > /var/spool/cron/root
chmod 600 /var/spool/cron/root

快速启动

sed -i 's/timeout=.*/timeout=1/g' /boot/grub2/grub.cfg

快速关机

cat <<EOF   >>/etc/systemd/system.conf
DefaultTimeoutStartSec=15s
DefaultTimeoutStopSec=15s
EOF

systemctl daemon-reload

资源限制

cat <<EOF  >>/etc/security/limits.conf

# add limits
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
* soft  memlock  unlimited
* hard memlock  unlimited
EOF

使用脚本

curl https://gitee.com/yx571304/my_oschina/raw/master/init.sh | sh

转载于:https://my.oschina.net/yx571304/blog/2231426

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值