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

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

 2012-09-08 17:59:50 来源:WEB开发网   
核心提示: #!/bin/bash# Program:# system_init_shell# History:# 2012/06/01 [email protected]# Release:# 1.1cat << EOF+--+| === Welcome to Ce

 #!/bin/bash
# Program:
# system_init_shell
# History:
# 2012/06/01 [email protected]
# 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

1 2  下一页

Tags:CentOS 初始化 生产

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