I'm learning now how to compile and boot linux kernels. Is there a way to boot kernels in a virtual machine, rather than messing my system? I use VMWare Workstation on Windows 8. Can I use that to boot my linux kernel?

  • Not really sure what you are asking other than "can I use VM".
    – psusi
    Sep 2, 2013 at 23:32

3 Answers 3


I'm learning now how to compile and boot linux kernels. Is there a way to boot kernels in a virtual machine, rather than messing my system? I use VMWare Workstation on Windows 8.

I am assuming, based on your wording, that you don't have a UNIX-like working environment. To build your own kernel, you have to have one, so in this case you have a choice between the two:

  1. Create one, by installing a GNU/Linux distribution in a Virtual Machine under your hypervisor (that is VMWare Workstation)
  2. or take it the hacker's way, and follow linux from scratch to create one for yourself (!!Not advised for a beginner).

After you have a working environment, then compiling and testing your own kernel is as simple as doing (for example):

wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.3.tar.xz
tar -xzf linux-3.9.3.tar.xz
cd linux-3.9.3
make menuconfig
make modules
make modules_install
make install

and then reboot (it may be slightly more involved, like making a ramdisk, therefore the above serves only as an example).

Here are two guides on how to compile a linux kernel for Ubuntu and for Arch Linux

  • Thanks for the reply. I already have an Ubuntu installation on my VMWare, but I'm afraid the new kernel is incompatible with it and would kill it. What should I do about that? Is using a fresh installation recommended? Sep 3, 2013 at 6:56
  • 1
    @SamerAfach I don't think it could kill it, far from it, but if it's your first time compiling a kernel, I suggest you do so on a testing vm, not a production one. Sep 3, 2013 at 7:13
  • So even a kernel from kernel.org should be compatible with an Ubuntu installation? Sep 3, 2013 at 7:19
  • 1
    @SamerAfach Yes it should. Anyway I have posted a link for you with directions on how to do it from the official Ubuntu website. Go ahead, take a look :) Sep 3, 2013 at 7:20
  • Actually I was on that site before, and then I faced some problems in compiling that; and someone recommended that I start learning the process with vanilla linux kernel, and that's why I'm not using that anymore; have a look: unix.stackexchange.com/questions/88968/… Sep 3, 2013 at 7:21

If you have a VM guest that's Linux then you could build t he Kernel inside of that VM and boot it inside that way. That's what I do all the time to save from mucking up my primary system.

  • Is any kernel from kernel.org compatible with any linux operating system I have? I have already ubuntu, but I'm worried it wouldn't work due to compatibility problems. Sep 3, 2013 at 7:00
  • 1
    @SamerAfach - You should be able to download a kernel.org kernel and run it on any distro. Remember that the distros often have patch sets that they apply to their kernel that may not be in kernel.org. Redhat and Canonical do this. So you might have issues.
    – slm
    Sep 3, 2013 at 11:31

I would recommend doing a Gentoo install in the VM. It will teach you how to configure, compile and boot the Linux kernel using a bootloader. A great learning experience (though not as good as real hardware install outside of a VM).

The Gentoo handbook has all the documentation you will need to get started. And of course their wiki is useful too.

P.S. Don't use genkernel, that won't teach you how to configure a kernel.


  • You mentioned Windows, so we assumed you didn't have a Linux install (in a VM or otherwise).
  • Genkernel is a known good kernel configuration maintained by the Gentoo devs. Your question was regarding learning about compiling kernels therefore I discouraged you from taking the easy way out and configure it manually (with trial and error).
  • ArchLinux and Gentoo both use kernels from kernel.org with very little patching. You can of course grab the vanilla sources from upstream if you want.
  • Mixing kernels from different distros is hit and miss. Sometimes it works and sometimes it doesn't and usually only partially anyway. Even mixing a newer kernel with an older initrd on ArchLinux doesn't work out; that ramdisk contains modules that weren't compiled into the kernel.
  • Ubuntu and custom kernels don't go well together. Their kernel has a ton of patches, so you'll want to grab their source rather than upstream.
  • If you just want the latest kernel compiled for Ubuntu you can try this PPA
  • Thanks for the reply. What do you mean with "genkernel"? the kernel of Gentoo from their source? I'm concerned about the compatibility of those kernels in kernel.org with any linux system I would have. I have right now an Ubuntu; would installing a any kernel from their work? and about Gentoo; is Gentoo also compatible with any kernel from kernel.org? Please explain the compatibility issue. Thanks. Sep 3, 2013 at 6:58
  • Ah, I got what genkernel means from their website, but the question about the compatibility is still up :) Sep 3, 2013 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .