How to optimize the Linux server after it is installed

Source: Internet
Author: User
Tags openssh server
How to optimize the Linux server after it is installed is not directly hosted in the data center after it is installed, instead, we need to perform a series of optimization configurations and security configurations. 1. it should be easy to understand to disable services that are not needed by our system. 1... information &
How to optimize the Linux server after it is installed is not directly hosted in the data center after it is installed, instead, we need to perform a series of optimization configurations and security configurations. 1. it should be easy to understand to close services that are not needed by our system, one advantage is to reduce memory and CPU usage, and the other advantage is to improve security. which services must be retained? On linux machines, there are usually four services that must be retained. iptables is a powerful firewall in linux. as long as the machine needs to be connected to the Internet, the network of the linux machine must be enabled, if you do not want to access the Internet, you can disable it. if you want to access the Internet, you must enable it. sshd is an openssh server. if your machine is not operated locally, it is hosted in the IDC, therefore, syslog must be performed through the sshd service when accessing the machine. this is the log system of the linux system and must be available. Otherwise, the cause will not be found in the case of machine problems except for the four necessary services, what other services need to be retained? In this case, you can determine the purpose of the system. for example, to use a database server, you need to enable the mysqld (or oracle) web server, to enable apache 2 and disable unnecessary tty, edit your/etc/inittab and find the following section: 1: 2345: respawn:/sbin/mingetty tty12: 2345: respawn: /sbin/mingetty tty23: 2345: respawn:/sbin/mingetty tty34: 2345: respawn:/sbin/mingetty tty45: 2345: Weight:/sbin/mingetty tty56: 2345: weight: the/sbin/mingetty tty6 command enables init to open six consoles for you. you can use alt + f1 to alt + f6 to access these six consoles by default, in fact, there is no need to use so many. you can see that the ps auxf command is six. Processes: root 3004 0.0 0.0 1892 tty1 Ss + Jun29/sbin/mingetty tty1root 412 3037 0.0 0.0 2492 tty2 Ss + Jun29/sbin/mingetty tty2root 412 3038 0.0 0.0 tty3 Ss + Jun29/sbin/mingetty tty3root 3051 0.0 0.0 1812 tty4 Ss + Jun29/sbin/mingetty tty4root 412 3056 0.0 0.0 2116 tty5 Ss + Jun29/sbin/mingetty tty5root 412 3117 0.0 2396 412 tty6 Ss + Jun29/sbin/mingetty tty6 How do I close these processes? Usually we can keep the first two consoles, and annotate the last four with #, and then we don't need to restart the machine, you only need to execute the init q command to define init q as a parameter: re-execute the command in/etc/inittab and restart the machine to make the modification take effect. 3. how do I disable atime? A linux file has three default times: atime: access time of this file ctime: time when inode of this file changes mtime: the modification time of this file. if there are multiple small files, there is usually no need to record the file access time, which can reduce disk io, for example, how do I set multiple small images on a web server page? Modify the file system configuration file: vi/etc/fstab uses noatime in the partition containing a large number of small files. nodiratime includes:/dev/md5/data/pics1 ext3 noatime, nodiratime 0 0 will no longer generate disk write io when files are accessed. 4. make sure your server runs on level 3. practice: vi/etc/inittab id: 3: initdefault: it is unnecessary to run X on the server. 5. Optimization of sshd X11Forwarding no // forwarding of x images without UseDNS no // reverse resolution of IP addresses 6. Optimization of shell modification command history record # vi/etc/profile find HISTSIZE = 1000 to HISTSIZE = 100 and then source/etc/profile
Related Article

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.