Linux Basic optimization (Mid-term architecture optimization)

Source: Internet
Author: User
Tags i18n aliyun

  • 1. Linux kernel optimization
    First step

    Cat >>/etc/sysctl.conf<<eof
    Net.ipv4.tcp_fin_timeout = 2
    Net.ipv4.tcp_tw_reu SE = 1
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_syncookies = 1
    net.ipv4.tcp_keepalive_time =
    Net.i Pv4.ip_local_port_range = 4000 65000
    Net.ipv4.tcp_max_syn_backlog = 16384
    Net.ipv4.tcp_max_tw_buckets = 36000 net.ipv4.route.gc_timeout = +
    Net.ipv4.tcp_syn_retries = 1
    net.ipv4.tcp_synack_retries = 1
    net.core.so Maxconn = 16384
    Net.core.netdev_max_backlog = 16384
    Net.ipv4.tcp_max_orphans = 16384
    iptables
    Net.nf_c Onntrack_max = 25000000
    Net.netfilter.nf_conntrack_max = 25000000
    Net.netfilter.nf_conntrack_tcp_timeout_ established =
    Net.netfilter.nf_conntrack_tcp_timeout_time_wait = +
    Net.netfilter.nf_conntrack_tcp_ timeout_close_wait =
    Net.netfilter.nf_conntrack_tcp_timeout_fin_wait =
    EOF

    Step two:

    S Ysctl-p



  • 2. Adding a dual NIC requires activation


    • 3. Turn off the firewall (2 steps)

      sed-i ' s#selinux=enforcing#selinux=disabled#g '/etc/selinux/config
      /etc/init.d/iptables Stop


    • 4. Time Synchronization Service (2 steps)

      \ntpdate-u cn.pool.ntp.org
      hwclock-w \ Write hardware time
      HWCLOCK-R \ View Current hardware time


      Configure Time Synchronization Tasks
      Yum-y install NTP \ Installation time Synchronization tool


      2. Two ways to synchronize time
      -1. Boot sync
      Vim/etc/rc.d/rc.local
      /usr/sbin/ntpdate-u cn.pool.ntp.org >/dev/null 2>&1; /sbin/hwclock-w


      -2. Timed Task synchronization
      Vi/etc/crontab
      XX * * * root/usr/sbin/ntpdate-u cn.pool.ntp.org >/dev/null 2>&1; /SBIN/HWCLOCK-W # (Update time write hardware simultaneously)


    • 5. Configure the Yum source to add a eper source

      Replace the Yum source
      -1. Clear Yum Source Cache
      Yum Clean All
      -2. Back up the Yum source
      Mv/etc/yum.repos.d/centos-base.repo/etc/yum.repos.d/centos-base.repo.backup
      -3. Replace CentOS 7 Source
      Download new Source: Wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-7.repo
      -4. Generate Cache
      Yum Makecahe
      5. Add Epel Source
      Wget-o/etc/yum.repos.d/epel.repo Http://mirrors.aliyun.com/repo/epel-7.repo


    • 6. Streamlined boot-up

      Chkconfig|egrep-v "Crond|sshd|network|rsyslog|sysstat" |awk ' {print "Chkconfig", $, "Off"} ' |bash


    • 7. Character Set changes

      Cp/etc/sysconfig/i18n/etc/sysconfig/i18n.ori
      Echo ' lang= ' en_US. UTF-8 "' >/etc/sysconfig/i18n
      source/etc/sysconfig/i18n
      Echo $LANG


    • 8. History command, Break time optimization

      echo ' Export tmout=300 ' >>/etc/profile
      echo ' Export histsize=5 ' >>/etc/profile
      echo ' Export histfilesize=5 ' >>/etc/profile
      Tail-3/etc/profile
      . /etc/profile


    • 9. Download and install the system basic software

      Yum Install Lrzsz nmap tree Dos2unix nc-y


    • 10. Configure the Hosts file (non-optimized project, experiment only)

      Cat >/etc/hosts<<eof
      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
      :: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
      172.16.1.5 LB01
      172.16.1.6 LB02
      172.16.1.7 WEB01
      172.16.1.8 WEB02
      172.16.1.9 WEB03
      172.16.1.51 DB01
      172.16.1.31 nfs01
      172.16.1.41 Backup
      172.16.1.61 M01
      172.16.1.62 Jumpserver
      Eof

Linux Basic optimization (Mid-term architecture optimization)

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.