TranslateProject/sources/tech/20150728 How to Update Linux Kernel for Improved System Performance.md
2015-07-28 15:48:00 +08:00

8.9 KiB
Raw Blame History

How to Update Linux Kernel for Improved System Performance

The rate of development for the Linux kernel is unprecedented, with a new major release approximately every two to three months. Each release offers several new features and improvements that a lot of people could take advantage of to make their computing experience faster, more efficient, or better in other ways.

The problem, however, is that you usually cant take advantage of these new kernel releases as soon as they come out — you have to wait until your distribution comes out with a new release that packs a newer kernel with it. Weve previously laid out the benefits for regularly updating your kernel, and you dont have to wait to get your hands on them. Well show you how.

Disclaimer: As some of our literature may have mentioned before, updating your kernel does carry a (small) risk of breaking your system. If this is the case, its usually easy to pick an older kernel at boot time that works, but something may always go wrong. Therefore, were not responsible for any damage to your system — use at your own risk!

Prep Work

To update your kernel, youll first need to determine whether youre using a 32-bit or 64-bit system. Open up a terminal window and run

uname -a

Then check to see if the output says x86_64 or i686. If its x86_64, then youre running the 64-bit version; otherwise, youre running the 32-bit version. Remember this, because it will be important.

Next, visit the official Linux kernel website. This will tell you what the current stable version of the kernel is. You can try out release candidates if youd like, but they are a lot less tested than the stable releases. Stick with the stable kernel unless you are certain you need a release candidate version.

Ubuntu Instructions

Its quite easy for Ubuntu and Ubuntu-derivative users to update their kernel, thanks to the Ubuntu Mainline Kernel PPA. Although its officially called a PPA, you cannot use it like other PPAs by adding them to your software sources list and expecting it to automatically update the kernel for you. Instead, its simply a webpage you navigate through to download the kernel you want.

Now, visit the kernel PPA webpage and scroll all the way to the bottom. The absolute bottom of the list will probably contain some release candidate versions (which you can see by the “rc” in the name), but just above them should be the latest stable kernel (to make this easier to explain, at the time of writing the stable version was 4.1.2). Click on that, and youll be presented with several options. Youll need to grab three files and save them in their own folder (within the Downloads folder if youd like) so that theyre isolated from all other files:

  • The “generic” header file for your architecture (in my case, 64-bit or “amd64″)
  • The header file in the middle that has “all” towards the end of the filename
  • The “generic” kernel file for your architecture (again, I would pick “amd64″ but if you use 32-bit youll need “i686″)

Youll notice that there are also “lowlatency” files available to download, but its fine to ignore this. These files are relatively unstable and are only made available for people who need their low-latency benefits if the general files dont suffice for tasks such as audio recording. Again, the recommendation is to always use generic first and only try lowlatency if your performance isnt good enough for certain tasks. No, gaming or Internet browsing arent excuses to try lowlatency.

You put these files into their own folder, right? Now open up the Terminal, use the

cd

command to go to your newly-created folder, such as

cd /home/user/Downloads/Kernel

and then run:

sudo dpkg -i *.deb

This command marks all .deb files within the folder as “to be installed” and then performs the installation. This is the recommended way to install these files because otherwise its easy to pick one file to install and itll complain about dependency issues. This approach avoids that problem. If youre not sure what cd or sudo are, get a quick crash course on essential Linux commands.

Once the installation is complete, Restart your system and you should be running the just-installed kernel! You can check this by running uname -a in the Terminal and checking the output.

Fedora Instructions

If you use Fedora or one of its derivatives, the process is very similar to Ubuntu. Theres just a different location to grab different files, and a different command to install them.

VIew the list of the most recent kernel builds for Fedora. Pick the latest stable version out of the list, and then scroll down to either the i686 or x86_64 section, depending on your systems architecture. In this section, youll need to grab the following files and save them in their own folder (such as “Kernel” within your Downloads folder, as an example):

  • kernel
  • kernel-core
  • kernel-headers
  • kernel-modules
  • kernel-modules-extra
  • kernel-tools
  • perf and python-perf (optional)

If your system is i686 (32-bit) and you have 4GB of RAM or more, youll need to grab the PAE version of all of these files where available. PAE is an address extension technique used for 32-bit system to allow them to use more than 3GB of RAM.

Now, use the

cd

command to go to that folder, such as

cd /home/user/Downloads/Kernel

and then run the following command to install all the files:

yum --nogpgcheck localinstall *.rpm

Finally Restart your computer and you should be running a new kernel!

Using Rawhide

Alternatively, Fedora users can also simply switch to Rawhide and itll automatically update every package to the latest version, including the kernel. However, Rawhide is known to break quite often (especially early on in the development cycle) and should not be used on a system that you need to rely on.

Arch Instructions

Arch users should always have the latest and greatest stable kernel available (or one pretty close to it). If you want to get even closer to the latest-released stable kernel, you can enable the testing repo which will give you access to major new releases roughly two to four weeks early.

To do this, open the file located at

/etc/pacman.conf

with sudo permissions in your favorite terminal text editor, and then uncomment (delete the pound symbols from the front of each line) the three lines associated with testing. If you have the multilib repository enabled, then do the same for the multilib-testing repository. See this Arch Linux wiki page if you need more information.

Upgrading your kernel isnt easy (done so intentionally), but it can give you a lot of benefits. So long as your new kernel didnt break anything, you can now enjoy improved performance, better efficiency, support for more hardware, and potential new features. Especially if youre running relatively new hardware, upgrading the kernel can really help out.

How has upgraded the kernel helped you? Do you think your favorite distributions policy on kernel releases is what it should be? Let us know in the comments!


via: http://www.makeuseof.com/tag/update-linux-kernel-improved-system-performance/

作者:Danny Stieben 译者:译者ID 校对:校对者ID

本文由 LCTT 原创翻译,Linux中国 荣誉推出