# How to fetch rocky linux kernel source code

**URL:** <https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630>\
**Category:** Rocky Linux Help & Support\
**Created:** [November 19, 2021, 2:15am UTC](https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630 "2021-11-19T02:15:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tingyin.duan](https://avatars.discourse-cdn.com/v4/letter/t/e480ec/32.png) [@tingyin.duan](https://forums.rockylinux.org/u/tingyin.duan)\
**Post date:** [November 19, 2021, 2:15am UTC](https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630/1 "2021-11-19T02:15:42Z")

</div>

I am a green hand of rocky linux.  
I need to rebuild the kernel of rocky linux 8.5 to make it work better on my workstation，the source code is not found in the iso.  
So where can I download the kernel source code？

---

<div class="post-metadata">

**Author:** ![toracat](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/toracat/32/68_2.png) [@toracat](https://forums.rockylinux.org/u/toracat)\
**Post date:** [November 20, 2021, 12:52am UTC](https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630/2 "2021-11-20T00:52:01Z")

</div>

The following command will download the latest kernel src.rpm:

$ dnf download --source kernel

---

<div class="post-metadata">

**Author:** ![tingyin.duan](https://avatars.discourse-cdn.com/v4/letter/t/e480ec/32.png) [@tingyin.duan](https://forums.rockylinux.org/u/tingyin.duan)\
**Post date:** [November 20, 2021, 9:20am UTC](https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630/3 "2021-11-20T09:20:12Z")

</div>

> [@toracat](#):
>
> dnf download --source kernel

Thanks a lot for your reply.  
Inspired by your advice, I have fetched the source code package I need.

---

<div class="post-metadata">

**Author:** ![KASmol](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@KASmol](https://forums.rockylinux.org/u/KASmol)\
**Post date:** [August 14, 2023, 7:35pm UTC](https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630/4 "2023-08-14T19:35:39Z")

</div>

I am trying to install the Nvidia drivers for my K4000, but the driver says it cannot find my source files. I installed the devel files ok, the downloaded the rpm for the kernel.

dnf download --source kernel

and got the kernel-5.14…src.rpm  
for my kernel (thus the …)  
but when I try to yum or dnf the rpm file it says it cannot install the source files. How can I fix this?  
thanks

---

<div class="post-metadata">

**Author:** ![quartsize](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/quartsize/32/3787_2.png) [@quartsize](https://forums.rockylinux.org/u/quartsize)\
**Post date:** [August 16, 2023, 6:13pm UTC](https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630/5 "2023-08-16T18:13:39Z")

</div>

“Source” in the `dnf download --source` context is the source for building the kernel RPMs, not for building kernel modules. If `kernel-devel` and `kernel-headers` aren’t satisfying your driver installer, you should check that they are the same version as your running kernel (`uname -r`).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [October 15, 2023, 6:14pm UTC](https://forums.rockylinux.org/t/how-to-fetch-rocky-linux-kernel-source-code/4630/6 "2023-10-15T18:14:15Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
