Linux basic optimization Guide

Source: Internet
Author: User


Linux basic optimization guide code: when someone sees this title, they must be wondering "Do linux need to be optimized ?". Before answering this question, www.2cto.com asked the question "What is 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 www.2cto.com § speed up startup if you often use a large number of peripherals, for example, infrared, Bluetooth, printers, scanners, etc. This part can be skipped, because it will remove the loading of these things when guiding the system to improve 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 www.2cto.com can directly control everything about the service through the command line, it is not intuitive and secure for new users. Therefore, it is implemented using the 3rd-party tool, but please rest assured that, that tool is free of charge. Install this tool and run $ sudo apt-get install sysv-rc-conf $ sudo sysv-rc-conf. Which of the following are required? What are not required? You can search by google one by one, here are some examples that most people can consider removing. If you do not know what evms, cron, anacron, apmd, atd, mdamd, and lvm are, you can safely remove the bluez-utiles Bluetooth. If you need to use it every time you start the system, it's okay to keep it. Bootlogd. If you have a hobby of viewing logs, keep it. cupsys. If you use a common printer, keep dns-clean. If it is a dial-up Internet access, if you do not know what fetchmail is, you can also remove hdparm. If all are SATA hard disks, remove hotkey-setup, which is only required by the notebook. You can try to remove it, if there are any side effects, the hotplug can be removed by most people. Some hardware may be needed, for example, if you have an HP printer with a rare sound card, you can keep the klogd to remove it. www.2cto.com networking can be safely removed from ntp-server time synchronization when surfing the internet at the Jiaotong University dormitory, generally, I have not seen the device in the legend of pcmcia, So I removed powernowd. If the CPU supports frequency conversion, it can save power consumption, if you do not need to dial the Internet, disable the ppp-dns and the readahead to disable rmnologin. Rsync remove screen-cleanup remove stop-bootlogd remove sysklogd remove it as well as remove it with your urandom or remove the yellow boot screen of usplash remove bittorrent remove other services, we recommend that you use sudo vi/etc/init. d/rc find CONCURRENCY = none and change it to CONCURRENCY = shell to save it. Then exit www.2cto.com. Use the appropriate kernel to download the source code from kernel.org and compile the kernel. Adjust the parameters to suit you. The kernel clock frequency is 100 250 333 1000. Choose the appropriate driver, compile the disk controller and file system into the kernel, and compile the remaining modules into the kernel, remove the non-compiled CPU type if you don't need it. Select the same memory size as your own model. If the memory size is greater than or equal to 1 GB, you can choose to enable the support for memory larger than 1 GB. I will not go into details here, my kernel is reduced to 1.2 M. You can refer to this size. § Reasonable use of memory Linux's memory management mechanism is different from windows's. Even if you have 64 GB of memory, after a period of use, the remaining physical memory will still be quite small, 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. Www.2cto.com sudo echo 'vm. swappiness = 0'>/etc/sysctl. conf takes effect if it is not restarted. Modify/proc/sys/vm/swappiness § Resource Restriction and edit/etc/security/limits. conf * hard core 0 enjoy hard nofile 128 enjoy hard fsize 1024000 enjoy hard rss 102400 enjoy hard stack 102400 enjoy hard cpu 10 enjoy hard nproc 20 enjoy hard maxlogins 10 enjoy hard data 102400 saga hard nproc 200 saga hard nofile 4096 enjoy and saga both use user names, the specific content of the restriction is as follows: File annotations. 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 to test whether the limit is required: () {:|:};:§ cut down the system size if the hard disk space is tight, removing unnecessary applications is also risky for new users, so proceed with caution. Www.2cto.com § other optimizations if you do not need ipv6 sudo vi/etc/modprobe. d/aliases find alias net-pf-10 ipv6 changed 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 sudo hdparm-k again. 1/dev/hda // Save the result. Replace/dev/hda with your own one. related 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 www.2cto.com browser. sessionhistory. set max_entries to 5 browser. sessionhistory. set max_total_viewers to 1 network. http. max-connections-per-server is set to 10 network. http. pipelining. set maxrequests to 10 network. dns. set disableIPv6 to true network. set dnsCacheEntries to 9999 network. set dnsCacheExpiration to 9999 browser. cache. disk. set capacity to 512000 browser. cache. memory. capacity is set to 102400 (smaller memory users can set). For more information, see mozilla's official site online documentation.
 

Related Article

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.