In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to optimize the installed Linux server". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Turn off unwanted services
It should be easy to understand that all services that our system does not need will be turned off. One advantage is to reduce the use of memory and CPU time, and another benefit can relatively improve security.
So which services are sure to be retained?
There are usually four services that must be retained on the linux machine
Iptables
Linux under the powerful firewall, as long as the machine needs to connect to the Internet, where can be separated from it
Network
The network of linux machines can be turned off if you don't have access to the Internet, as long as you go online, of course you have to turn it on.
Sshd
This is opensshserver, if your machine is not operated locally, but is hosted in the IDC computer room
Then you need to access the machine through this sshd service.
Syslog
This is the log system of the linux system, it must have
Otherwise, when there is something wrong with the machine, the cause will not be found.
Apart from these four essential services, what other services need to be retained?
At this point, it depends on the purpose of the system, for example: database server, you need to enable mysqld (or oracle).
Web server, you need to enable apache
2. Close unwanted tty
Please edit your / etc/inittab
Find the following paragraph:
1:2345:respawn:/sbin/mingettytty1
2:2345:respawn:/sbin/mingettytty2
3:2345:respawn:/sbin/mingettytty3
4:2345:respawn:/sbin/mingettytty4
5:2345:respawn:/sbin/mingettytty5
6:2345:respawn:/sbin/mingettytty6
This command enables init to open six consoles for you, which can be accessed from alt+f1 to alt+f6
These six consoles reside in memory by default, in fact, there is no need to use so many
As you can see with the command psauxf, there are six processes.
Root30040.00.01892412tty1Ss+Jun290:00/sbin/mingettytty1 root30370.00.02492412tty2Ss+Jun290:00/sbin/mingettytty2 root30380.00.02308412tty3Ss+Jun290:00/sbin/mingettytty3 root30510.00.01812412tty4Ss+Jun290:00/sbin/mingettytty4 root30560.00.02116412tty5Ss+Jun290:00/sbin/mingettytty5 root31170.00.02396412tty6Ss+Jun290:00/sbin/mingettytty6
How do I shut down these processes?
Usually we can just keep the first two consoles.
Just comment out the last four with #
Then you don't need to restart the machine, you just need to execute the command initq.
Initq
What Q means as a parameter: re-execute the command in / etc/inittab
After the modification is completed, you need to restart the machine to make it effective.
4. How to close atime?
A linux file has 3 times by default:
Atime: access time to this file
Ctime: when the inode of this file changed
Mtime: the modification time of this file
If there are multiple small files, it is usually not necessary to record the access time of the file.
This reduces the io of the disk, for example, there are multiple small pictures on the page of the web server
How to set it up?
Modify the configuration file of the file system: vi/etc/fstab
Use noatime,nodiratime in partitions that contain a large number of small files
For example:
/ dev/md5/data/pics1ext3noatime,nodiratime00
In this way, the io for writing to disk is no longer generated when the file is accessed.
5. Make sure your server runs on level3
Practice:
Vi/etc/inittab
Id:3:initdefault:
It is not necessary for the server to run X
6. Optimize sshd
X11Forwardingno// does not forward x graphics.
UseDNSno// does not reverse parse IP addresses.
7. Optimize shell
Modify command history record
# vi/etc/profile
Find HISTSIZE=1000 and change it to HISTSIZE=100
And then source/etc/profile
"how to optimize the installed Linux server" content is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.