Linux Server adventure optimization Linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. 1. disable unnecessary services.
2. Disable the unused tty
1. disable unnecessary services.
This should be easy to understand. All services that I don't need are closed,
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
A powerful firewall in linux, as long as the machine needs to connect to the Internet, Where can it be opened?
Network
If the network of a linux machine is not connected to the Internet, it can be disabled.
Sshd
This is an openssh server. If your machine is hosted in an IDC instead of local operations,
The sshd service is used to access the machine.
Syslog
This is the log system of linux, which must be,
Otherwise, the cause cannot be found when the machine encounters a problem.
In addition to the four necessary services, what other services need to be retained?
In this case, it can be determined based on the purpose of the system. For example, the database server needs to enable mysqld (or oracle)
For web servers, you need to enable apache
This command enables init to open six consoles for you, which can be accessed by alt + f1 to alt + f6 respectively.
By default, all the six consoles reside in the memory. In fact, there is no need to use so many
You can use the ps auxf command to see that there are six processes.
Root 3004 0.0 0.0 1892 412 tty1 Ss + Jun29/sbin/mingetty tty1
Root 3037 0.0 0.0 2492 412 tty2 Ss + Jun29/sbin/mingetty tty2
Root 3038 0.0 0.0 2308 412 tty3 Ss + Jun29/sbin/mingetty tty3
Root 3051 0.0 0.0 1812 412 tty4 Ss + Jun29/sbin/mingetty tty4
Root 3056 0.0 0.0 2116 412 tty5 Ss + Jun29/sbin/mingetty tty5
Root 3117 0.0 0.0 2396 412 tty6 Ss + Jun29/sbin/mingetty tty6
How do I close these processes?
Usually we can keep the first two consoles,
Use # To comment out the last four.
Then, you do not need to restart the machine. You only need to execute the init q command.
Init q
Q as the parameter meaning: Re-execute the command in/etc/inittab
3. How do I disable ipv6?
Ipv6 is not required yet, but it will be used as the resident core of the module after the system is installed,
You can use this step to close it:
First, edit the network configuration file:
Vi/etc/sysconfig/network
Modify
NETWORKING_IPV6 = yes
Is
NETWORKING_IPV6 = no
Disable the Module vi/etc/modprobe. conf.
Add the following two lines to the file:
Alias net-pf-10 off
Alias ipv6 off
Restart the machine to make the modification take effect.
4. How do I disable atime?
A linux file has three default times:
Atime: Access time to this file
Ctime: the time when inode of this file changes.
Mtime: the time when the file was modified.
If there are multiple small files, there is usually no need to record the file access time,
This reduces disk I/O. For example, the web server page contains multiple small images.
How to Set it?
Modify the file system configuration file: vi/etc/fstab
Use noatime and nodiratime in partitions that contain a large number of small files
For example:
/Dev/md5/data/pics1 ext3 noatime, nodiratime 0 0
In this way, no disk I/O is generated when files are accessed.
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