CentOS6 x86_64最小化安装优化脚本
#!/bin/bash
#centos6. x86_64系统最小化安装优化脚本
#系统基础优化,建议以root运行 if [ $USER != "root" ];then
echo "需要使用sudo运行此脚本"
exit
fi
yum -y intall wget
cd /usr/local/src
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
cp /usr/local/src/CentOS6-Base-.repo ./CentOS-Base.repo
yum clean all #清除yum缓存
yum makecache #重建缓存
yum -y update
cd /usr/local/src
#添加epel外部扩展源
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release--.noarch.rpm #安装gcc ,sysstat等工具
yum -y install gcc gcc-c++ vim-enhanced unzip unrar sysstat #配置ntp自动对时
yum -y install ntp
echo "01 01 * * * /usr/sbin/ntpdate ntp.api.bz >> /dev/null 2>&1 " >> /etc/crontab
/usr/sbin/ntpdate ntp.api.bz
service crond restart #配置文件的ulimit值
ulimit -SHn
echo "ulimit -SHn 65534" >> /etc/rc.local cat >> /etc/security/limits.conf << EOF
* soft nofile
* hard nofile
EOF #基础系统内核优化
cat >> /etc/sysctl.conf << EOF
net.ipv4.tcp_syncookies =
net.ipv4.tcp_syn_retries =
net.ipv4.tcp_tw_recycle =
net.ipv4.tcp_tw_reuse =
net.ipv4.tcp_fin_timeout =
net.ipv4.tcp_keepalive_time =
net.ipv4.tcp_local_port_range =
net.ipv4.tcp_max_syn_backlog =
net.ipv4.tcp_max_tw_buckets =
net.ipv4.route.gc_timeout =
net.core.somaxconn =
net.core.netdev_max_backlog =
net.ipv4.tcp_max_orphans = EOF
/sbin/sysctl -p #关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce
#关闭itables
service iptables stop
chkconfig iptables off #ssh配置优化
sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords no/g' /etc/ssh/sshd_config
sed -i "s/#UseDNS yes/UseDNS no/g" /etc/ssh/sshd_config
service sshd restart #禁用基于ipv6 网络
chkconfig ip6tables off #vim 基础语法优化
cat >> /root/.vimrc << EOF
set nu
set ruler
set shiftwidth=
set tabstop=
set expandtab
set cindent
set autoindent
set mouse=v
syntax on
EOF #精简开机启动服务,安装最小化服务的机器初始只留 cron|network|rsyslog|sshd 四个服务
for i in `chkconfig --list | grep :on | awk '{print $1}'`;do chkconfig --level $i off;done for CURSRV in crond rsyslog sshd network;do chkconfig --level $CURSRV on;done #重启服务器
reboot
CentOS6 x86_64最小化安装优化脚本的更多相关文章
- Centos 6.4 x86_64 最小化安装后的优化——还需要整理
Centos 6.4 x86_64 最小化安装后的优化 购买了服务器以后要做的第一件事就是安装操作系统了,这里推荐安装 Centos 6.4 x86_64,安装系统时要选择最小化安装(不需要图 ...
- Centos6.4最小化安装后使用xfce桌面环境
由于我个人使用的Centos是在虚拟机中最小化安装的,gnome实在是不喜欢,所以自己装了个xfce,安装后启动不起来,才发现x window等依赖环境没装,为了少走弯路,在此写下安装过程. 1.yu ...
- centos6.5 最小化安装无法上网
在VMware里装了个centos 6.5. 最小化安装后无法上网.在 google里找到答案 第一步:执行命令启动网卡 (最小化安装不是自动启动的) [root@localhost]# ifcon ...
- centos6.5最小化安装之后装图形化界面
查看自己系统环境 # cat /etc/issue 先要安装KDE桌面环境,执行命令: # yum groupinstall "X Window System" "KDE ...
- CentOS-6.5-x86_64 最小化安装,已安装包的总数,这些包?
一.我们怎么知道有多少的包被安装? [root@localhost ~]# rpm -qa | wc -l 217 二.怎样得知安装了那些软件包? [root@localhost ~]# rpm -q ...
- Centos6.5最小化安装:配置网络和自启动服务
参考http://www.111cn.net/sys/CentOS/56456.htm 1.开启网络连接,禁止IPV6启用 1.开启网络连接 vi /etc/sysconfig/network-sc ...
- 生产服务器环境最小化安装后 Centos 6.5优化配置[转]
内容目录 centos6.5最小化安装后配置网络: IP地址, 网关, 主机名, DNS 更新系统源并且升级系统 系统时间更新和设定定时任 创建普通用户并进行sudo授权管理 修改SSH端口号和屏蔽r ...
- 生产服务器环境最小化安装后 Centos 6.5优化配置备忘
生产服务器环境最小化安装后 Centos 6.5优化配置备忘 作者:Memory 发布于:2014-8-13 15:00 Wednesday 服务器 本文 centos 6.5 优化 的项有18处: ...
- 生产服务器环境最小化安装后Centos 6.5优化配置备忘
生产服务器环境最小化安装后 Centos 6.5优化配置备忘 本文 centos 6.5 优化 的项有18处,列表如下: 1.centos6.5最小化安装后启动网卡 2.ifconfig查询IP进行S ...
随机推荐
- FTP服务器windows配置
1.配置IIS Web的FTP站点 1.1 打开iis管理器(方法很多,这里我们用命令) Win+r中输入:inetmgr 1.2 新建FTP站点 1.2.1 新建FTP服务器根目录文件夹 1.2.2 ...
- GUI的最终选择 Tkinter(五):Text用法
Text组件 绘制单行文本使用Label组件,多行选使用Listbox,输入框使用Entry,按钮使用Button组件,还有Radiobutton和Checkbutton组件用于提供单选或多选的情况, ...
- Problem Statement
题目链接:https://vjudge.net/contest/239445#problem/E E - Problem Statement You are given nn strings ...
- C A Simple Job
题目3 : A Simple Job时间限制:1000ms单点时限:1000ms内存限制:256MB描述Institute of Computational Linguistics (ICL), Pe ...
- java编程如何实现多条2017-08-08 22:10:00.0这样的时间数据,相差多少天?(隔24小时为相差1天,否则为0天)
不多说,直接上干货! 这是yyyy-MM-dd HH:mm:ss.S GetIntervalDays.java package zhouls.bigdata.DataFeatureSelect ...
- [PHP]使用日志进行调试
两种方法: 1.利用自定义函数: //写日志,打印字符串function writelog($str){ $open=fopen("log.txt","a+") ...
- Python3基础(1)Python介绍、Python2 与Python3、变量、用户输入、if...else和for循环、while循环、break与continue
---------------个人学习笔记--------------- ----------------本文作者吴疆-------------- ------点击此处链接至博客园原文------ P ...
- case 范围取值
你可以在单个case标签中指定一系列连续的值,就像这样: case low ... high: 这和单独的case标签的合适数字有同样的效果,每个对应包含在从low到high中的一个整数值. 这个 ...
- SpringBoot | 第十八章:web应用开发之WebJars使用
前言 前面一章节我们主要讲解了关于文件上传的两种方式.本章节继续web开发的相关知识点.通常对于web开发而言,像js.css.images等静态资源版本管理是比较混乱的,比如Jquery.Boots ...
- (转)IE6 死后即将大快人心的10件事
(转)未来五年程序员应当具备的十项技能 W3C CSS 2.1 Specification(Quick Table of Contents) (转)IE6 死后即将大快人心的10件事 2009-04- ...