How to optimize Linux

Source: Internet
Author: User


Use the Setup--system service to remove any unused services in front of you.
Chkconfig inside to see what service ports open, can also off, and finally with Nmap to see which ports are open, do not need to/etc/services inside the corresponding port comment out.

Introduce the concepts of two Systems management first

1 System Performance management
1) response times (Response time)
From the user's point of view, the system is in a good state of performance refers to the system can quickly respond to user requests, that is, the system response time is short.
Specifically, the response time is the time interval at which the request is made to the corresponding result of the user's request back to the user.
2) throughput (throughput)
From the system administrator's point of view, the system's throughput becomes the indicator that the system is in good performance state.
Specifically, throughput is the number of transactions completed by the system over a given period of time. That is, the larger the throughput of the system, the more user or system requests that the system completes in a unit time, and the resources of the system are fully utilized.

2 Resources and bottlenecks
1) system resources (Resource)
Cpu
Memory
Disk
Input and output, especially network and serial communication
viewing system Information
CAT/PROC/CPUINFO-CPU (i.e vendor, Mhz, flags like MMX)
Cat/proc/interrupts-Interrupts
Cat/proc/ioports-Device IO port
Cat/proc/meminfo-memory information (i.e. Mem used, free, swap size)
Cat/proc/partitions-All partitions for all devices
Information on CAT/PROC/PCI-PCI devices
Cat/proc/swaps-Information for all swap partitions
Cat/proc/version-linux version number is equivalent to Uname-r
UNAME-A-See system kernel and other information
2) bottleneck (bottleneck)
In many resources of the computer, because of the system configuration, some resources become the bottleneck of system performance is very natural thing.
We call this resource a bottleneck when all users or systems request that a resource needs to exceed its available number range.
When bottlenecks occur in a system, there are usually two ways to eliminate bottlenecks:
Increase the number of resources that become bottlenecks;
Reduce the number of requests;

Some of the optimization measures

1 turn on HDD DMA support.
After the system is installed, the DMA of the hard disk is not opened, my method is in
/etc/rc.d/rc.local the last side with a line/sbin/hdparm-d1-c3-m16/dev/hda so that after each boot, the hard disk DMA will turn on, do not have to manually set each time.
You can use Hdparm-tt/dev/hda to test before and after adding.

2 run Ntsysv to turn off some unnecessary services, here are some specific explanations for some common services:
AMD manages the mixer devices
Amidxtape
Anacron (Command Dispatch)
APMD (Advanced Power Management)
Arpwatch (see ARP)
ATD (function cron similar)
AutoFS (automatic file system loading)
DAYTIME-UDP (udp-User Datagram Protocol, with TCP at the same level)
DHCPD (Dynamic Host service)
Echo (server echo Customer data Service)
ECHO-UDP (UDP version of Echo)
Finger (finger service)
Gated (Gateway Service)
GPM (mouse under the console)
IPChains (firewall)
Linuxconf-web (Open the linuxconf Web configuration port)
NETFS (Network File system)
*network (network support available)
Pcmica (provides support for PC cards, general notebooks)
SendMail (the famous mail server)
Keytable (keyboard innuendo, as if no use)
Kzuzu detecting PC Hardware----booting the system
#我只留下了apmd gpm Syslog Network iptable 5

3 Reduce the number of virtual terminals.
System default is 6, that is Ctrl+alt F1~f6 six, I turned off four, only left Ctrl+alt F1~f2, about 4 Mbytes of memory, but in this way, X-window from the original Ctrl+alt F7 into Ctrl+alt F3.
Modify/etc/inittab, will mingetty 3 to all plus # font size

Several settings that are good for system security

1 Delete all special accounts
You should delete all unused default user and group accounts (such as LP, Sync, Shutdown, halt, news, UUCP, operator, games, Gopher, etc.).

2 Shadow support features for open passwords:
Open the shadow function of the password, encrypt the password. Use the/usr/sbin/authconfig tool to turn on the shadow feature. If you want to convert your passwords and groups to shadow format, you can use the "pwcov,grpconv" command separately.

3. Root Account
The root account in a Unix system has the highest privileges. If the system administrator forgets to log off the root account before leaving the system, the system will log off automatically. This function can be achieved by modifying the "tmout" parameter in the account. Tmout is calculated by seconds. Edit your profile file (vi/etc/profile) and add the following line after "histfilesize=":
tmout=3600
3600, which means 60*60=3600 seconds, that is, 1 hours. This way, if the user logged on in the system has no action within one hours, the system will automatically log off the account. You can add this value to an individual user's ". BASHRC" file to allow the system to have a special automatic logoff time for that user.
After you change this setting, you must log off the user and then log in to activate the feature.

4 suppression of System Information exposure
Suppresses display of system welcome messages when someone remotely logs in. You can do this by modifying the "/etc/inetd.conf" file.
Put the following line in the/etc/inetd.conf file:
Telnet stream TCP nowait ROOT/USR/SBIN/TCPD in.telnetd
Modified to:
Telnet stream TCP nowait ROOT/USR/SBIN/TCPD in.telnetd-h
Add "-H" at the end to allow only one login to be displayed when someone logs in: prompt, without displaying system welcome information

How to optimize Linux

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.