开发者社区> 问答> 正文

Linux 系统服务优化脚本

脚本内容:


#!/bin/bash
#welcome
cat << EOF
--------------------------------------------------------------
| ========= Welcome to Centos System init ========= |
----------------------Author:StoNe·J-------------------------
EOF
#disable ipv6
cat << EOF
--------------------------------------------------------------
| =========== Welcome to Disable IPV6 =========== |
--------------------------------------------------------------
EOF
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
cat << EOF
--------------------------------------------------------------
| ========== Welcome to Disable Selinux========== |
--------------------------------------------------------------
EOF
if [ -s /etc/selinux/config ]; then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
fi
echo "selinux is disabled,you must reboot!"
#set vim coloure
cat << EOF
--------------------------------------------------------------
| ========== Welcome to Set Vim Coloure========== |
--------------------------------------------------------------
EOF
sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
echo 'syntax on' > /root/.vimrc
echo "set vim coloure is ok!"
# configure file max to 52100
cat << EOF
--------------------------------------------------------------
| ====== Welcome to Configure file max to 65535====== |
--------------------------------------------------------------
EOF
cat >>/etc/security/limits.conf<<eof
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
eof
cat >>/etc/sysctl.conf<<eof
fs.file-max=65535
eof
echo "configure file max to 52100 is ok!"
#seting ssh
cat << EOF
--------------------------------------------------------------
| =========== Welcome to Seting SSH =========== |
--------------------------------------------------------------
EOF
#disable UseDNS
sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
/etc/init.d/sshd restart
echo "seting ssh is ok!"
#seting services
cat << EOF
--------------------------------------------------------------
| ========= Welcome to Seting SERVICES ========= |
--------------------------------------------------------------
EOF
SERVICES="acpid atd apmd avahi-daemon avahi-dnsconfd bluetooth capi cpuspeed cups dund firstboot hidd ip6tables isdn irda irattach mcstrans NetworkManager pcscd pand rawdevices sendmail sdpd yum-updatesd"
for service in $SERVICES
do
chkconfig $service off
service $service stop
done


@叨比叨  

展开
收起
chuanshuolian 2012-11-09 11:09:19 10510 0
4 条回答
写回答
取消 提交回答
  • ReLinux系统服务优化脚本
    selinux 以后能用的上吗
    不许要的话我想把她删了
    还有用php发email会用的上 sendmail 吗
    2012-11-13 16:49:26
    赞同 展开评论 打赏
  • 回楼主chuanshuolian的帖子
    估计没人敢用
    2012-11-13 13:00:07
    赞同 展开评论 打赏
  • ReLinux系统服务优化脚本
    呃……很强大的样子……但是楼主能多介绍一点么…… = = 或者说我太小白了
    2012-11-11 11:13:08
    赞同 展开评论 打赏
  • 顶下自己的文章

    -------------------------

    我在顶个

    -------------------------

    回 3楼(s122464884) 的帖子
    在多的帖子
    都没有人顶的~~~
    2012-11-09 11:09:30
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Alibaba Cloud Linux 3 发布 立即下载
ECS系统指南之Linux系统诊断 立即下载
ECS运维指南 之 Linux系统诊断 立即下载