Basic Linux optimization Guide

Source: Internet
Author: User

When someone saw the title of the Linux optimization Guide, they were sure to say, "Do you need to optimize linux ?". Before answering this question, I first asked the question "What is Linux optimization ?", My idea is that there is no optimal solution. what suits me is better. Isn't it optimal to adjust the desktop background to your favorite color?

I don't think you need to answer either of the above questions. If you are interested, you can continue. The optimization mentioned here mainly refers to performance. Optimization is based on your own hardware and your own needs. Therefore, there is no optimization method suitable for everyone. Take my machine as an example and talk about it with Ubuntu.

CPU: AMD AM2 Athlon64 X2 3600 +
RAM: DDRII 800 512 M * 2
DISK: SATA2, 250G, 8 M

§ Speed up startup

If you often use a large number of peripherals, such as infrared devices, Bluetooth devices, printers, and scanners, this part can be skipped, because it will remove these things when loading the boot system, to increase the startup speed.

Like most other releases, Ubuntu loads a large number of things you don't need by default during boot, such as HP printers, lvms, RAID, and even blind users. These things can be removed. Even if you occasionally need to use them, you can start them manually without affecting your use. This is similar to windows self-starting program, ubuntu has an astonishing number of self-starting programs.

Although you can use command lines to directly control everything about the service, it is not intuitive and secure for new users. Therefore, you can use the 3rd-party tool to implement it, that tool is free of charge.

Install and run this tool
$ Sudo apt-get install sysv-rc-conf
$ Sudo sysv-rc-conf

What is needed and what is not needed can be searched by google one by one. Here are some examples that most people can consider removing.
Evms, cron, anacron, apmd, atd, mdamd, and lvm can be removed without knowing what it is.
Bluez-utiles Bluetooth. If you use it every time you start the system, you can keep it.
Bootlogd. Keep it if you are interested in viewing logs.
Cupsys: if you use a printer, keep it.
If dns-clean is used for dial-up Internet access, keep it
Fetchmail can be removed if you do not know what it is.
Remove hdparm from all SATA hard disks.
Hotkey-setup is only required by the notebook. You can try to remove it and change it back if it has any side effects.
Hotplug can be removed by most people, and some hardware may be needed, such as rare sound cards.
If you have an HP printer, you can keep it.
It's okay to remove klogd.
Networking can be safely removed from the dormitory at Jiaotong University.
Ntp-server time synchronization, which can be removed
I have never seen the device in pcmcia, So I removed it.
Powernowd if the CPU supports frequency conversion, you can save power and remove it.
If you use ppp to dial up the Internet, disable it if you do not use dialing.
Ppp-dns same as above
Turn readahead off
Rmnologin Removal
If you don't know what to do with rsync
Remove screen-cleanup
Stop-bootlogd removed
You can remove sysklogd.
Remove urandom.
Remove the yellow boot screen of usplash.
Remove bittorrent
Consider the rest of the services.

Concurrent loading of some single-core machines slows down. We recommend that you use dual-core
Sudo vi/etc/init. d/rc
Find CONCURRENCY = none
Change to CONCURRENCY = shell
Save and exit

§ Use your own Kernel

Download the source code from kernel.org and compile the kernel by yourself. Adjust the parameters to suit your needs.

Kernel clock frequency is 100 250 333 1000 and other options choose your preferred

Driver, compile the disk controller and file system into the kernel, and compile the remaining modules.
Remove non-Compilation

CPU type, select the same as your own Model

Memory size, greater than or equal to 1 GB memory, open more than 1 GB memory supported

I will not repeat it here. My kernel is reduced to 1.2 MB. You can
For more information, see.

§ Reasonable use of memory

The memory management mechanism in Linux is different from that in windows. Even if you have 64 GB memory,
The remaining physical memory is still quite small. The memory is used instead of reading it, so don't be surprised.

One parameter to be adjusted here is vm. swappiness, and Ubuntu is 60 by default. This parameter determines whether the kernel will send the program swap to swap or release part of the cache. 0 indicates to release part of the cache as much as possible, and 100 indicates to use swap as much as possible, which can be adjusted between 0 and 100. I personally changed it to 0.

Sudo echo 'vm. swappiness = 0'>/etc/sysctl. conf

If it takes effect after restart, you can modify/proc/sys/vm/swappiness.
§ Resource restrictions

Edit/etc/security/limits. conf
Hardcore0
Enjoy hardnofile 128
Enjoy hardfsize 1024000
Enjoy hardrss 102400
Enjoy hardstack 102400
Enjoy hardcpu 10
Enjoy hardnproc 20
Enjoy hardmaxlogins 10
Enjoy harddata102400

Sagahardnproc 200
Sagahardnofile 4096

Both enjoy and saga are user names. For specific restricted content, see the comments in this file.

Without this restriction, a line of code may make you miserable, and you even need to restart it.
You can copy and paste the following line of code to the terminal and run the test to check whether the limit is required.
:() {:| :;};:

§ Cut system volume

If the hard disk space is tight and you want to delete unnecessary applications, this poses a risk for new users,
Exercise caution.

§ Other Optimizations

If you do not need ipv6
Sudo vi/etc/modprobe. d/aliases
Locate the alias net-pf-10 ipv6
Change to alias net-pf-10 off # ipv6

Disable pango
Sudo echo 'moz _ DISABLE_PANGO = "1" '>/etc/environment

Hard Disk Optimization (SATA can not be done)
Sudo hdparm-t-T/dev/hda // test hard disk Performance
Sudo hdparm-c 1/dev/hda // use 32bit Transmission Mode
Sudo hdparm-d 1/dev/hda // use DMA
Sudo hdparm-t-T/dev/hda // test again
Sudo hdparm-k 1/dev/hda // Save the result
Replace/dev/hda with your own device.


§ Settings of Common Software

OpenOffice has a Java option, which can be disabled in general.

Enter "about: config" in the address bar of Firefox and press Enter.

Browser. sessionhistory. max_entries is set to 5
Browser. sessionhistory. max_total_viewers is set to 1.
Set network. http. max-connections-per-server to 10.
Network. http. pipelining. maxrequests is set to 10.
Network. dns. disableIPv6 is set to true
Network. dnsCacheEntries is set to 9999
Network. dnsCacheExpiration is set to 9999
Browser. cache. disk. capacity: 512000
Browser. cache. memory. capacity is set to 102400 (smaller memory users can set)

For more information, see mozilla's official site online documentation and set it as appropriate. Linux optimization is complete.

  1. For details about commonly used software in Ubuntu 8.10, set and configure 1)
  2. About commonly used software in Ubuntu 8.10, configuration 2)
  3. Ubuntu Compiz is commonly used as the shortcut key 3)
  4. Brief Introduction to "Ubuntu ~" in the Ubuntu Operating System ~"
  5. How to install the nvidia official driver perfectly on Fedora 12

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.