Simple Linux Server initialization Shell script

Source: Internet
Author: User

The Shell script is mainly used to initialize the new Linux server system, including:

It can be modified according to your actual situation and used in the production environment. The original author is NetSeek and I have made some modifications.

#! /Bin/sh # desc: lsm03624 modified by www.webnginx.com # ----------------- cut begin response # welcomecat <EOF + response + |== Welcome to Centos System init ==|+ -------------- http://www.linuxtone.org response ++ upload hoautr: netSeek -------------------------- + EOF # disable ipv6cat <EOF + Welcome + | === 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/configecho" 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 = "zh_CN.UTF-8"/'/etc/sysconfig/i18n # configure file max to 52100 echo "* soft nofile 52100 * hard nofile 52100">/etc/security/limits. conf # tunoff services # -------------------------------------------------------------------------------- cat <EOF + ------------------------------------------ -------------------- + | === Welcome to Tunoff services ==|+ response + EOF # response for I in 'ls/etc/rc3.d/S * 'docursrv = 'echo $ I | cut-c 15-'echo $ CURSRVcase $ CURSRV incpuspeed | crond | irqbalance | microcode_ctl | mysqld | network | nginx | php-fpm | sendmail | sshd | syslog) # This system service is set based on the specific application. network, sshd, and syslog are three system services that must be started! Echo "Base services, Skip! ";; *) Echo" change $ CURSRV to off "chkconfig -- level 235 $ CURSRV offservice $ CURSRV stop; esacdonerm-rf/etc/sysctl. confecho "net. 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 = 134217728net. ipv4.ip _ Local_port_range = 1024 65536net. core. rmem_max = 16777216net. core. wmem_max = 16777216net. ipv4.tcp _ rmem = 4096 87380 16777216net. ipv4.tcp _ wmem = 4096 65536 16777216net. ipv4.tcp _ fin_timeout = 3net. ipv4.tcp _ tw_recycle = 1net. core. netdev_max_backlog = 30000net. ipv4.tcp _ no_metrics_save = 1net. core. somaxconn = 262144net. ipv4.tcp _ syncookies = 0net. ipv4.tcp _ max_orphans = 262144net. ipv4.tcp _ max_syn_backlog = 262144net. ipv4.tcp _ synack_retries = 2net. ipv4.tcp _ syn_retries = 2vm. swappiness = 6 ">/etc/sysctl. confecho" optimizited kernel configure was done!"

Editor's note: This script can be used with other security scripts and optimization scripts.

Original article: http://www.linuxde.net/2011/12/3273.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.