Ubuntu 18.04 LTS is the current stable release of Canonical’s Linux operating system. It sports a lot of modern software thanks to backporting efforts. Despite this, users tend to get stuck on an aging version of the Linux kernel.

It’s not all that bad to be on Ubuntu LTS and stay stuck with an older release of the Linux kernel, as the developers do their best to port fixes and improvements down the line. Still, if you’re using 18.04 because of stability purposes, but would prefer to be using the latest and greatest Linux kernel (such as kernel 5,) you’ll be slightly annoyed. Luckily, because of the Linux community, it’s increasingly easy to use Linux kernel 5 on Ubuntu 18.04 LTS

Method 1 – With UKUU

The Ubuntu Kernel Upgrade Utility is the most straight-forward path to getting Linux use Linux kernel 5 on Ubuntu 18.04 LTS. To access the app, you’ll need to head over to our guide on how to install the UKUU application.

Once you’ve got the UKUU application working on Ubuntu, launch it by browsing for it in your application menu. Then, use the UKUU application to locate version 5 of the Linux kernel (the newest release available, preferably).

Select the version 5 kernel that you’d like to install on Ubuntu 18.04 LTS with the mouse to highlight it. After that, start the installation of the new kernel by clicking on the “Install” button to load it up on your system.

RECOMMENDED FOR YOU

Let the UKUU app fully download and install version 5 of the Linux kernel on your Ubuntu Linux PC. When the installation process is complete, close the UKUU application and reboot Ubuntu 18.04 LTS. When it boots back up, you should be using version 5 of the Linux kernel.

Want to be sure that you’re running the absolute latest version of the kernel and that UKUU worked as intended? Launch a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T and type:

uname -r

Method 2 – From source

The Ubuntu Kernel Update Utility is a good tool, but given that it typically works with versions of the Linux kernel in development by Canonical, things can be a bit unstable. For a more stable solution, you can compile Linux yourself.

To start out the compilation process, you need to create a new configuration file. The quickest and most straight-forward way of going about this is by downloading an existing configuration file we have set up.

Note: don’t want to use our preset config file? Copy an existing file out of /boot and save it as “.config.”

wget https://pastebin.com/raw/Pwz0Uyqn -O .config

After downloading the configuration file, it is time to download the latest release of the Linux kernel. As of writing this article, the version is 5.0.8.

Note: kernel versions are regularly posted on Kernel.org. If you want to update from 5.0.8 in the future, head there, download the new source and follow the instructions in this guide.

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.8.tar.xz

Extract the archive of the 5.0.8 kernel with the Tar command.

tar xvf linux-5.0.8.tar.xz

Move the new config file into the Linux code folder with the mv command.

mv .config ~/linux-5.0.8/

Install the kernel build dependencies on Ubuntu, so that it is possible to compile and build it.

sudo apt install build-essential libncurses5-dev gcc libssl-dev bc flex bison

Run the GUI menu tool for the kernel with make menu-config

cd ~/linux-5.0.8/
make menu-config

In the menu app, leave everything at the defaults and use the arrow keys to select “Save.” Be sure to write the file to “.config.”

Exit the menu tool by highlighting “Exit.”

Once you’re out of the GUI menu editor, it’s time to use the lscpu command to figure out how many cores your PC has, to determine how many CPUs can be used to compile the kernel.

To figure out how many cores you have, run:

lscpu | grep -E '^CPU('

Keep that number in mind. Then, use make with the deb-pkg command to start the compilation for Ubuntu. Be sure to change “CORE-NUMBER” with the number that appears when you run the lscpu command.

make -jCORE-NUMBER deb-pkg

Depending on how many CPU cores you have, your build will take a very long time. For best results, try to build on at least a dual-core CPU (2). When the building process is done, the compiler will output four ready to go DEB packages for your new kernel so that you may install them.

To install the newly compiled 5.0.8 Linux kernel, run the dpkg command.

sudo dpkg -i linux-*.deb

Assuming dpkg installed successfully, reboot your Linux PC. When it comes back online, you should be running Ubuntu 18.04 LTS on Linux kernel version 5.

To confirm you are indeed running kernel 5 on Ubuntu 18.04 LTS, use the uname command.

uname -r