初始化linux系统脚本推荐

+————————————————————–+| === Welcome to Centos System init === |+————————————————————–++————————–by kerry—————————-+EOF#update yumcd /etc/yum.repos.dmv CentOS-Base.repo CentOS-Base.repo.bakwget http://centos.ustc.edu.cn/CentOS-Base.repo.5mv CentOS-Base.repo.5 CentOS-Base.repo

#update systemyum clean allyum -y update glibc\*yum -y update yum\* rpm\* python\*yum clean allyum -y update

#set ntpyum -y install ntpecho * 3 * * * /usr/sbin/ntpdate 210.72.145.44 /dev/null 2 1 /etc/crontabservice crond restart

#set ulimitecho ulimit -SHn 102400 /etc/rc.local

cat /etc/security/limits.conf EOF* soft nofile 65535* hard nofile 65535EOF

#set locale#true /etc/sysconfig/i18n#cat /etc/sysconfig/i18n EOF#LANG= zh_CN.GB18030 #SUPPORTED= zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en #SYSFONT= latarcyrheb-sun16 #EOF

#set sysctltrue /etc/sysctl.confcat /etc/sysctl.conf EOFnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 68719476736kernel.shmall = 4294967296net.ipv4.tcp_max_tw_buckets = 6000net.ipv4.tcp_sack = 1net.ipv4.tcp_window_scaling = 1net.ipv4.tcp_rmem = 4096 87380 4194304net.ipv4.tcp_wmem = 4096 16384 4194304net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.core.netdev_max_backlog = 262144net.core.somaxconn = 262144net.ipv4.tcp_max_orphans = 3276800net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 1net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 1200net.ipv4.ip_local_port_range = 1024 65535EOF

/sbin/sysctl -pecho sysctl set OK!!

#close ctrl+alt+delsed -i s/ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/#ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/ /etc/inittab

#set purview chmod 600 /etc/passwdchmod 600 /etc/shadowchmod 600 /etc/groupchmod 600 /etc/gshadow

#disable ipv6cat EOF+————————————————————–+| === Welcome to Disable IPV6 === |+————————————————————–+EOFecho alias net-pf-10 off /etc/modprobe.confecho alias ipv6 off /etc/modprobe.conf/sbin/chkconfig –level 35 ip6tables offecho ipv6 is disabled! #disable selinuxsed -i ‘/SELINUX/s/enforcing/disabled/’ /etc/selinux/config echo selinux is disabled,you must reboot! #vimsed -i 8 s/^/alias vi=’vim’/ /root/.bashrcecho ‘syntax on’ /root/.vimrc#zh_cnsed -i -e ‘s/^LANG=.*/LANG= en /’ /etc/sysconfig/i18n#init_sshssh_cf= /etc/ssh/sshd_config sed -i -e ’74 s/^/#/’ -i -e ’76 s/^/#/’ $ssh_cfsed -i s/#Port 22/Port 65535/ $ssh_cfsed -i s/#UseDNS yes/UseDNS no/ $ssh_cf#clientsed -i -e ’44 s/^/#/’ -i -e ’48 s/^/#/’ $ssh_cfservice sshd restartecho ssh is init is ok………….. #chkser#tunoff services#——————————————————————————–cat EOF+————————————————————–+| === Welcome to Tunoff services === |+————————————————————–+EOF#———————————————————————————for i in `ls /etc/rc3.d/S*`do CURSRV=`echo $i|cut -c 15-`echo $CURSRVcase $CURSRV in crond | irqbalance | microcode_ctl | lvm2-monitor |network | random | sshd | syslog ) echo Base services, Skip! ;; *) echo change $CURSRV to off chkconfig –level 235 $CURSRV off service $CURSRV stop ;;esacdone

echo service is init is ok…………..

长江后浪催前浪,一辈新人换旧人。

初始化linux系统脚本推荐

相关文章:

你感兴趣的文章:

标签云: