CentOS 6.X 系统初始化生产脚本
2012-09-08 17:59:50 来源:WEB开发网 #!/bin/bash
# Program:
# system_init_shell
# History:
# 2012/06/01 25061008@qq.com
# Release:
# 1.1
cat << EOF
+--------------------------------------------------------------+
| === Welcome to Centos 6.x System init === |
+--------------------------------------------------------------+
+---------------------------by opsren--------------------------+
EOF
#update 163 yum
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
wget http://mirrors.163.com/.help/CentOS-Base-163.repo
mv CentOS-Base-163.repo CentOS-Base.repo
yum clean metadata
yum makecache
#add epel
rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
#add rpmforge
rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
#update system pack
yum -y install gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel bison patch unzip libmcrypt-devel libmhash-devel ncurses-devel sudo bzip2 mlocate flex lrzsz sysstat lsof setuptool system-config-network-tui system-config-firewall-tui ntp libaio-devel wget ntp
#set ntp
echo "*/5 * * * * /usr/sbin/ntpdate ntp.api.bz > /dev/null 2>&1" >> /var/spool/cron/root
service crond restart
#set clock
hwclock --set --date="`date +%D\ %T`"
hwclock --hctosys
#set ulimit
echo "ulimit -SHn 102400" >> /etc/rc.local
cat >> /etc/security/limits.conf << EOF
* soft nofile 102400
* hard nofile 102400
* soft nproc 102400
* hard nproc 102400
EOF
#set max user processes
sed -i 's/1024/102400/' /etc/security/limits.d/90-nproc.conf
# turnoff the control-alt-delete
sed -i 's#exec /sbin/shutdown -r now#\#exec /sbin/shutdown -r now#' /etc/init/control-alt-delete.conf
#close useless service
for i in `ls /etc/rc3.d/S*`
do
CURSRV=`echo $i|cut -c 15-`
echo $CURSRV
case $CURSRV in
crond | irqbalance | network | sshd | rsyslog | sysstat )
echo "Base services, Skip!"
;;
*)
echo "change $CURSRV to off"
chkconfig --level 2345 $CURSRV off
service $CURSRV stop
;;
esac
done
echo "service is init is ok.............."
#set LANG
:> /etc/sysconfig/i18n
cat >> /etc/sysconfig/i18n << EOF
LANG="en_US.UTF-8"
EOF
#set ssh
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
sed -i 's/#Port 22/Port 6343/' /etc/ssh/sshd_config
- ››CentOS系统只需6步添加新硬盘并分区格式化的方法
- ››Centos6.0 64位下 MySQL 5.6.11 CMake 安装部署
- ››CentOS下配置超级终端minicom
- ››Centos6.2_x86_64环境下puppet-dashboard安装配置...
- ››CentOS下建立本地YUM源并自动更新
- ››CentOS 安装 PostgreSQL 9.2
- ››CentOS 6.3 安装 Oracle 11gR2 依赖库检查失败处理...
- ››CentOS 6.X 系统初始化生产脚本
- ››CentOS 6下安装nodejs 0.9.0教程
- ››CentOS使用Screen管理会话选项
- ››CentOS+JDK+Tomcat+MySql&JDBCDriver 开发环境搭建...
- ››CentOS 5.6创建NFS文件共享服务器
更多精彩
赞助商链接