Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is the first time I am working on Fedora. I will be writing some device drivers.

I understand that for proper compilation of the driver I must have the same source code as that of the running kernel.

In Ubuntu I used to do this using apt-get. But this is not working in Fedora, so how do I download this?

share|improve this question
Is there any reason you aren't downloading the kernel source directly, and compiling that? You can checkout the specific version, and use the Fedora specific config file from your /boot directory. – AsheeshR May 3 '14 at 12:06
fedoraproject.org/wiki/Building_a_custom_kernel ... Haven't tried that, found via Google for fedora kernel source, first result. – derobert May 3 '14 at 12:19

To download the source for the Linux kernel on a Red Hat based distro you'll need to use the tool yum. This is equivalent to apt-get. This tool needs to either be run using sudo or to become the root user on the box.

$ yum install kernel-devel kernel-tools kernel-headers

The source will be installed here:

$ ls -l /usr/src/kernels/$(uname -r)

Where uname -r is the version of the kernel + architecture that you're using:

$ uname -r

This is the source for kernel version 3.13.9. The point release (the Fedora project adds patches to their kernel) which is represented by the -100. The architecture is x86_64, i.e. 64-bit.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.