Table of Contents
In this article, I will take you through the steps to install rtl8821cu Wifi USB Driver on Ubuntu Linux. rtl8821cu is a realtek Wifi adapter USB device, the driver of which is available in GitHub to support WLAN product like RTL8811CU and RTL8821CU. It is available to be installed in all almost all the famous Linux distributions. Here we will the steps to install rtl8821cu Wifi USB Driver on Ubuntu Linux systems. In case if your Ubuntu system does not have this driver module installed then you can follow below given simple steps to install.
How to Install rtl8821cu Wifi USB Driver on Ubuntu Linux
Also Read: Step by Step to Install Caine OS on VirtualBox [Complete Guide]
Step 1: Prerequisites
a) You should have a running Ubuntu
Linux Server.
b) You should have sudo
or root
access to run privileged commands.
c) You should have apt
, make
, gcc
, bc
and git
utility available in your System.
Step 2: Update Your Server
Before going through the steps to install rtl8821cu Wifi USB Driver, it is highly recommended to first update your system packages to the latest available version using sudo apt update && sudo apt upgrade
command as shown below.
cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Get:1 https://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 https://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,078 B]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [545 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,344 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,963 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [321 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [780 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [59.9 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [11.8 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1,467 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/restricted Translation-en [207 kB]
Get:16 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [790 kB]
...............................................
Step 3: Clone Git Repo
You need to first create a separate build directory called brektrou
using mkdir brektrou
command as shown below.
cyberithub@ubuntu:~$ mkdir brektrou
Then switch to that directory using cd brektrou
command as shown below.
cyberithub@ubuntu:~$ cd brektrou/
Now you need to clone the GitHub repo using git clone https://github.com/brektrou/rtl8821CU.git
command as shown below.
cyberithub@ubuntu:~/brektrou$ git clone https://github.com/brektrou/rtl8821CU.git
Cloning into 'rtl8821CU'...
remote: Enumerating objects: 1743, done.
remote: Total 1743 (delta 0), reused 0 (delta 0), pack-reused 1743
Receiving objects: 100% (1743/1743), 7.68 MiB | 4.00 MiB/s, done.
Resolving deltas: 100% (739/739), done.
Step 4: Compile Source Code
Next step is to compile the source code using Makefile
configuration. You just need to run make
command which will read the configuration and generate the object files based on that as you can see below.
cyberithub@ubuntu:~/brektrou/rtl8821CU$ make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/5.15.0-58-generic/build M=/home/cyberithub/brektrou/rtl8821CU modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-58-generic'
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_cmd.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_security.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_debug.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_io.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_ioctl_query.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_ioctl_set.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_ieee80211.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_mlme.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_mlme_ext.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_mi.o
CC [M] /home/cyberithub/brektrou/rtl8821CU/core/rtw_wlan_util.o
....................................
Step 5: Install rtl8821cu
After generating object files, now you need to install them by using sudo make install
command as shown below. This should install the driver module just like below.
cyberithub@ubuntu:~/brektrou/rtl8821CU$ sudo make install mkdir -p /lib/modules/5.15.0-58-generic/kernel/drivers/net/wireless/realtek/rtl8821cu/ install -p -m 644 8821cu.ko /lib/modules/5.15.0-58-generic/kernel/drivers/net/wireless/realtek/rtl8821cu/ /sbin/depmod -a 5.15.0-58-generic
Step 6: Verify Driver Installation
You can also verify the driver installation by running below ls
command. This command should show the installed driver module on the output just like below.
cyberithub@ubuntu:~/brektrou/rtl8821CU$ ls /lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtl8821cu 8821cu.ko
Step 7: Uninstall rtl8821cu
Once you are done using the Wifi driver then you can also choose to uninstall rtl8821cu from your system by running sudo make uninstall
command from cloned repo directory as shown below.
cyberithub@ubuntu:~/brektrou/rtl8821CU$ sudo make uninstall
rm -rfv /lib/modules/5.15.0-58-generic/kernel/drivers/net/wireless/realtek/rtl8821cu/
removed '/lib/modules/5.15.0-58-generic/kernel/drivers/net/wireless/realtek/rtl8821cu/8821cu.ko'
removed directory '/lib/modules/5.15.0-58-generic/kernel/drivers/net/wireless/realtek/rtl8821cu/'
/sbin/depmod -a 5.15.0-58-generic
great explaination... it works fine...thx