Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The basic optimization mode of Linux

Shulou Source: shulou.com Published: 2022-06-02 05:08:02 09月29日 Update

This article mainly explains "the basic optimization method of Linux". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "the basic optimization method of Linux" together.

It boils down to:

One clear, one fine, one increase, two excellent, four set, seven others

A clear: regularly clean logs/var/spool/clientsqueue

One essence: streamline boot service

Increase: Increase file descriptor

Two excellent: linux kernel parameter optimization, yum source optimization

Four settings: set the character set of the system, set the ssh login limit, set the boot prompt information and kernel information, and set the block size.

Seven others: file system optimization, sync data synchronous writing to disk, do not update timestamp, lock system critical files, time synchronization, sudo centralized management, turn off firewall and selinux

1. sync data synchronous writing to disk

async sync

2. Do not update timestamp

noatime

3. File system optimization: disable ext3, ext4 log function

Disabled for less data-critical services

4. Set the block size, usually 4K

mkfs -t ext3 -b 4096 /dev/sda1

5. Lock down key files of the system

chattr +/-i /etc/passwd

6.Linux kernel tuning (parameter tuning)

…………

7. Set boot prompt information and system information

/etc/motd /etc/issue

8. Set up yum sources for the system and upgrade

/etc/yum.repos.d/

9. Time synchronization; between 50-100 servers can be set up time synchronization server ntpserver

/usr/sbin/ntpdate time.windows.com

10. Set the character set of the system

/etc/sysconfig/i18n

11. Use sudo tools to centralize user management

visudo

12. Limit ssh login settings, such as changing ports, prohibiting root logins, prohibiting password-less logins, and so on.

/etc/ssh/sshd.conf

13. Enlarge file descriptor

echo '* - nofile 65535 ' >>/etc/security/limits.conf

14. The requested URL/var/spool/clientsqueak/was not found on this server.

Write scripts, put them in timed tasks, and clean them up regularly.

15. Streamlined boot service

a) setup, check the startup service

b) Terminal input ntsysv

c) Scripting

cat /server/scripts/chkinfo.sh

#setup sys start server or process

for i in `chkconfig --list |grep 3:on|awk '{print $1}'`;do chkconfig --level 3 $i off;done

/bin/sh /server/scripts/chkinfo.sh

Thank you for reading, the above is the "basic optimization of Linux" content, after the study of this article, I believe that everyone has a deeper understanding of the basic optimization of Linux, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: System file time synchronization service method information login kernel data learning key content parameter size character character set log server disk Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Microsoft Linux Xiaomi