美文网首页
linux-系统初始化

linux-系统初始化

作者: 李哈哈_2c85 | 来源:发表于2020-12-21 15:59 被阅读0次

#!/bin/bash
# centos7 系统初始化
yum install -y rsync lrzsz* vim telnet ntpdate wget net-tools  nfs-utils.x86_64  
chmod +x /etc/rc.d/rc.local
#修改时区
mv /etc/localtime /etc/localtime.bak && cp -a /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#添加同步时间计划任务
(echo "*/10 * * * * /usr/sbin/ntpdate time.windows.com";crontab -l)|crontab
#关闭25号端口
systemctl stop postfix && systemctl disable postfix
#关闭防火墙-swap分区
swapoff -a;sed -i 's/.*swap.*/#&/' /etc/fstab
setenforce 0
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
systemctl disable firewalld.service
systemctl stop firewalld.service
#修改系统参数、文件描述符
sed -i 's/4096/65535/' /etc/security/limits.d/20-nproc.conf
echo '* soft nofile 65535' >> /etc/security/limits.conf
echo '* hard nofile 65535' >> /etc/security/limits.conf
echo "ulimit revamped: `ulimit -n`"

---
文件描述符放开,写在rc.local中,防止某些服务启动前采用系统默认大小,读取rc.local比ulimit要早,所以默认还是还是按照按1024来走的

ulimit -Hn 65535
ulimit -Sn 65535

相关文章

网友评论

      本文标题:linux-系统初始化

      本文链接:https://www.haomeiwen.com/subject/reudvktx.html