WEB开发网
开发学院操作系统CentOS CentOS 6.X 系统初始化生产脚本 阅读

CentOS 6.X 系统初始化生产脚本

 2012-09-08 17:59:50 来源:WEB开发网   
核心提示:service sshd restart#set sysctltrue > /etc/sysctl.confcat >> /etc/sysctl.conf << EOFnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 1net
service sshd restart
#set sysctl
true > /etc/sysctl.conf
cat >> /etc/sysctl.conf << EOF
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 1024 65535
EOF
/sbin/sysctl -p
echo "sysctl set OK!!"
#disable ipv6
echo "alias net-pf-10 off" >> /etc/modprobe.conf
echo "alias ipv6 off" >> /etc/modprobe.conf
/sbin/chkconfig ip6tables off
echo "ipv6 is disabled!"
#disable selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
#vim setting
sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
echo 'syntax on' > /root/.vimrc
cat << EOF
+--------------------------------------------------------------+
| ===System init over=== |
+--------------------------------------------------------------+
+---------------------------by 邱治军--------------------------+
EOF
echo "###############################################################"

关于脚本的解释说明:
1.将系统默认yum源改成163源
2.增加第三方epel源
3.增加第三方rpmforge软件库
4.更新系统的基础软件
5.设置系统时钟同步
6.其中第一条语句是设定硬件时钟,第二条语句是设定系统时钟和硬件时钟同步
7.增加打开最大文件描述符
8.增加系统进程数(线程)的限制-->max user processes
centos 5与centos 6不同的是,只要在/etc/security/limits.conf 设置了root soft nofile 102400 和root hard nofile102400,对应的uilmit -u 后的结果就会是102400,这里需要注意区别!
9.关闭control-alt-delete
10.关闭不用的系统服务
11.设置系统语系
12.设置SSH
13.设置系统内核参数
14.关闭IPV6
15.关闭selinux
16.vi相关设置

上一页  1 2 

Tags:CentOS 初始化 生产

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接