centos6.6系统初始化脚本
#!/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 元心科技--------------------------+
EOF
for i in `ls /etc/yum.repos.d/*`
do
mv ${i} ${i}_bak
done cp ./configs/local.repo /etc/yum.repos.d/
yum clean all
for i in gcc gcc-c++ glibc 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 ncurses-devel sudo bzip2 mlocate flex lrzsz sysstat lsof setuptool system-config-network-tui system-config-firewall-tui ntp libaio-devel wget ntp createrepo yum-downloadonly iftop
do
yum -y install ${i} > /dev/null 2>&1
if [ $? -eq 0 ];
then
echo "${i} is installed"
else
echo "${i} is installed to error"
fi
done #set profile
\cp ./configs/profile /etc
source /etc/profile #set ntp
echo "*/5 * * * * /usr/sbin/ntpdate time.windows.com > /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
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 "###############################################################"
centos6.6系统初始化脚本的更多相关文章
- centos7 系统初始化脚本
现在自己的本地虚拟机系统,直接安装的是centos7.2 mini版,安装完成发现好多东西都没有安装,所以写了一个简单的系统初始化脚本,让自己可以省一些力气,哈哈 人懒主要是. 下面贴出写的脚本,脚本 ...
- Centos7系统初始化脚本
前言: 因公司业务增加,陆续新增服务器,时不时的来几台,手动地一台台对服务器初始化操作感觉太麻烦. 于是乎,根据初始化需求整合了一个初始化脚本,实现批量脚本初始化操作. 说明: 本脚本根据自身需求编写 ...
- centos6、7系统初始化脚本
#!/bin/bash # #******************************************************************** #encoding -*-utf ...
- centos系统初始化脚本
#!/bin/bash #检测是否为root用户 ];then echo "Must be root can do this." exit fi #检测网络 echo " ...
- 简单的 centos7&rhel7 系统初始化脚本
#!/bin/bash #描述: 基于RHEL7¢os7的初始化配置 #读取用户输入的ip read -p "输入你当前Linux的IP地址:" LAST #截取网 ...
- LINUX 系统初始化脚本
#!/bin/bash ######the system first start configuretion #####for install ####copy right by donglei## ...
- Linux系统初始化脚本
#查看centos的版本号 CentOS_version=`cut -d /etc/centos-release | cut -d` #改变PS3格式 PS3="Please enter t ...
- 给公司个别安装好的系统环境处理-相当half系统初始化脚本shell
#!/bin/bash# Used for other system-environment update! echo -e '\n\033[35m~~请使用root权限运行此脚本~~\033[0m\ ...
- 分享我自己的一个最小化安装CentOS6的初始化脚本
在自己的虚拟机上使用的基于CentOS6的系统初始化脚本 #!/bin/bash # #Filename:system_init.sh #Description:系统安装完成后,对系统进行一些配置,以 ...
随机推荐
- java Web程序使用wro4j合并、压缩js、css等静态资源
在Web项目中,js.css合并压缩,不仅有利于减少Http请求数量.减少宽带资源占用,还能有效的管理各种js.css的引入,使整个项目更加有序.而对于访问用户来说,其更大的好处是增加了页面的打开速度 ...
- Python小练习(持续更新....)
最近一直在学习python,这些小练习有些是书上的,有些是别人博客上的! # 1.题目1# 给一个字符串,统计其中的数字.字母和其他类型字符的个数:# 比如输入“124mid-=”,输出:数字=3,字 ...
- Convex combination
en.wikipedia.org/wiki/Convex_combination 凸组合 In convex geometry, a convex combination is a linear co ...
- 【译】用 Chart.js 做漂亮的响应式表单
数据包围着我们.虽然搜索引擎和其他应用都对基于文本方式表示的数据偏爱有加,但人们发现可视化是更容易理解的一种方式.今年初,SitePoint 发表了 Aurelio 的文章< Chart.js简 ...
- Unicode Category
Lu(letter,uppercase):大写字母. Ll(letter.lowercase):小写字母. Lt(letter,titlecase):词首字母大写的字母. Lm(letter,modi ...
- SAP号码段
[转http://blog.csdn.net/wengyupeng/article/details/8513527] 1.通用Tcode:SNRO 常用维护特定Number range Tcode: ...
- 2014阿里实习生面试题——MySQL如何实现索引的
这是2014阿里实习生北京站二面的一道试题: 在MySQL中,索引属于存储引擎级别的概念,不同存储引擎对索引的实现方式是不同的,比如MyISAM和InnoDB存储引擎. MyISAM索引实现: MyI ...
- linux删除文件夹的命令
使用rm -rf 目录名字 命令即可 -r 就是向下递归,不管有多少级目录,一并删除-f 就是直接强行删除,不作任何提示的意思 eg 删除文件夹实例:rm -rf /var/log/httpd/acc ...
- LeetCode:存在重复元素【217】
LeetCode:存在重复元素[217] 题目描述 给定一个整数数组,判断是否存在重复元素. 如果任何值在数组中出现至少两次,函数返回 true.如果数组中每个元素都不相同,则返回 false. 示例 ...
- Linux服务器上的tomcat中部署web项目
首先了解一下下面几个概念,讲得不太准确:1.JVMJVM是class以及jar(实际上就是很多个class压缩在一起)的运行环境,特征就是java和javaw命令,通过这两个命令,你可以执行class ...