#!/bin/bash
#优化服务器启动的脚本、禁用无关账号、无关服务
#Lock User Account
passwd -l xfs
passwd -l news
passwd -l nscd
passwd -l dbus
passwd -l vcsa
passwd -l games
passwd -l nobody
passwd -l avahi
passwd -l haldaemon
passwd -l gopher
passwd -l ftp
passwd -l mailnull
passwd -l pcap
passwd -l mail
passwd -l shutdown
passwd -l halt
passwd -l uucp
passwd -l operator
passwd -l sync
passwd -l adm
passwd -l lp
#Language Set 中文设置
sed -i -e 's/^LANG=.*/LANG="zh_CN.UTF-8"/' /etc/sysconfig/i18n
source /etc/sysconfig/i18n
#Init Mode 无桌面模式启动
sed -i -e 's/^id.*initdefault.*$/id:3:initdefault:/' /etc/inittab
#sshd 提高速度
sed -i "s/#MaxAuthTries 6/MaxAuthTries 6/" /etc/ssh/sshd_config
sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
#Service Set...Stop all except ssh and network 把除了ssh 和网络服务全禁用了
server=`chkconfig --list | awk '{print $1}' | grep -E -v 'sshd|network'`
for i in $server
do
service $i stop
chkconfig --level $i off
done
#Start and Set autostart
server2=`chkconfig --list | awk '{print $1}' |grep -E 'network|sshd|cpuspeed|syslog|crond|iptables|lvm2-monitor'`
for i in $server2
do
service $i start
chkconfig --level $i on
done
init
#Vim Settings
sed -i -e 's/^.*fileencodings=.*/set fileencodings=cp936,utf-8,latin1/' /etc/vimrc
\cp /etc/vimrc ~/.vimrc
echo 'set nowrap' >> /root/.vimrc
echo 'set autochdir' >> /root/.vimrc
echo 'set paste' >> /root/.vimrc
echo 'colo desert' >> /root/.vimrc
echo 'set nu' >> /root/.vimrc

Linux的服务器初始优化脚本。的更多相关文章

  1. 24个节点测试Linux VPS/服务器速度一键脚本使用 附服务器配置

    对于大部分网友而言,我们是希望购买的VPS.服务器既便宜也稳定,甚至还能提供更好的优质服务.这样的商家有没有呢?回答是基本没有.但是,只要我们购买的VPS在稳定性 和速度上对比同类的商家差不多,或者自 ...

  2. linux apache服务器优化建议整理(很实用)

    转载:http://www.cnblogs.com/zhongbin/archive/2013/06/11/3131865.html 1.apache服务器的time_wait过多 fin_wait1 ...

  3. Linux生产服务器Shell脚本分享

    Linux生产服务器Shell脚本分享 2012-6-6 86市场网 linux 作为一名Linux/unix系统管理员,我经常遇到人问这个问题:shell能做什么?PHP这么强大,为什么不用PHP来 ...

  4. 优化Linux生产服务器的经验之谈

    [51CTO独家特稿]如何优化自己的Linux生产服务器?本文结合实际的工作经验,总结了优化Linux生产服务器的九大要点.如果有些方法您尚未采用,不妨一试. 一.时间同步 生产环境下的服务器对时间的 ...

  5. Linux 服务器系统监控脚本 Shell【转】

    转自: Linux 服务器系统监控脚本 Shell - 今日头条(www.toutiao.com)http://www.toutiao.com/i6373134402163048961/ 本程序在Ce ...

  6. Odoo Linux服务器一键安装脚本使用指南

    Odoo安装脚本介绍 为了帮助更多Linux服务器维护人员快速部署Odoo,为此开源智造(OSCG)基于André Schenkels曾经开放的openerp-install-scripts所构建的基 ...

  7. 大数据项目之_15_帮助文档_NTP 配置时间服务器+Linux 集群服务群起脚本+CentOS6.8 升级到 python 到 2.7

    一.NTP 配置时间服务器1.1.检查当前系统时区1.2.同步时间1.3.检查软件包1.4.修改 ntp 配置文件1.5.重启 ntp 服务1.6.设置定时同步任务二.Linux 集群服务群起脚本2. ...

  8. MySQL安装后的初始优化

    mysql数据库在安装之后,有一些内置的库(test库).用户(如root@localhost.localdomain)是不需要的,而且在Linux系统上,yum安装的mysql是默认无root密码的 ...

  9. linux web服务器静态资源的处理 unison+inotify双向同步

    linux web服务器静态资源的处理 unison+inotify双向同步 http://monkeyzhu.blog.51cto.com/5764358/1324391 简介 unison可以使两 ...

随机推荐

  1. oracle查询语句大全

    1.查处oracle数据库的字符编码格式 select * from v$nls_parameters t where t.PARAMETER='NLS_CHARACTERSET'; 如果查出的是ZH ...

  2. bzoj 2132: 圈地计划

    #include<cstdio> #include<iostream> #include<cstring> #define M 100009 #define inf ...

  3. visual studio 2013连接Oracle 11g并获取数据:(二:实现)

    1.VS中新建一个winform窗体 (1)一个按钮 (2)一个数据表格视图(在里面显示得到的数据表) 2.双击按钮进入代码 (1)添加 using System.Data.OracleClient; ...

  4. 倍增 LCA

    以NOIP2013提高组day1 最后一道题为例来学的倍增和lca.其实这套题早就做过了,倍增和lca也学过,只不过当时没有理解清楚,所以今天再次学了一遍,虽然没有时间编程序了,但是先把思路和做法在这 ...

  5. 2、IValueConverter应用

    1.C#代码如下: public class logotoimgConverter:IValueConverter { //将logo转换为URI public object Convert(obje ...

  6. Cisco IOS Software Activation Command Reference

    clear license agent : to clear license agent statistics counters or connection statistics (in privil ...

  7. cvWaitKey

    OpenCV中的一个函数 函数原型为: C++: int waitKey(int delay=0) Python: cv2.waitKey([delay]) → retval C: int cvWai ...

  8. SharePoint 跨域还原网站一则

    博客地址:http://blog.csdn.net/foxdave 源端:执行PowerShell命令备份网站集 Backup-SPSite http://server_name/sites/site ...

  9. BZOJ 2331 地板

    妈妈我会写插头dp了!!!!!!.... 感动啊... #include<iostream> #include<cstdio> #include<cstring> ...

  10. webservice basics

    =====================Quote starts================== JAX-WS (JavaTM API for XML-Based Web Services)规范 ...