How To Install RTL8821CU On Ubuntu Linux?
Simple things sometimes get tricky in Linux. Realtek Wi-Fi adapter driver is one of them. The rtl8821cu is a driver for the Realtek 8821CU Wi-Fi adapter. If you have a Realtek 8821CU Wi-Fi adapter, you might be facing an issue of not detecting the hardware on Ubuntu. It is because the driver is missing.
You need to install the correct driver for the Realtek Wi-Fi adapter. In this article, I am going to walk you through a step-by-step guide on how you can install the rtl8821cu drive on Ubuntu.
What Is RTL8821CU?
RTL8821CU is a driver for the Realtek 8821CU wireless LAN chipset. It is a highly integrated single-chip that supports 1-stream 802.11ac solutions with Multi-user MIMO (Multiple-Input, Multiple-Output) and Wireless LAN (WLAN) with integrated Bluetooth 2.1/3.0/4.2.
The RTL8821CU driver provides the necessary software to communicate between the chipset and the operating system, allowing the wireless device to function properly.
This driver is important for ensuring that the wireless device is recognized by the operating system and that it can connect to wireless networks. The driver provides support for a wide range of wireless technologies, including Wi-Fi standards such as 802.11b, 802.11g, 802.11n, and 802.11ac.
It also provides support for advanced features such as secure connections, automatic connection to known networks, and power management.
Pre-requisites
Before building this driver, you need to make sure the following packages are installed on your system.
- make
- gcc
- linux-header
- bc
- git
These packages are required to get the source code of the driver and compile it to get it installed.
Install The Required Packages Before Installing RTL8821CU Driver
We need to install all the required packages first. The linux-header and bc packages are installed by default out of the box. We need to install git, make, and gcc packages. Ubuntu has a package called build-essential that has many essential packages including make and gcc.
So, we need to install git and build-essential to get all the necessary packages installed on our system. Use the following command to install:
sudo apt update && sudo apt install git build-essential
This will update the system and install git and build-essential packages.
If your system has a missing Linux header, you can use the following command to install it.
sudo apt install linux-headers-$(uname -r)
Install RTL8821cu On Ubuntu Linux
As we have installed all the required packages into our system, we can proceed to download and compile the rtl8821cu driver.
First, We need to clone the driver from the git repository. This driver is provided by brektrou. Use the following commands:
mkdir -p ~/build cd ~/build git clone https://github.com/brektrou/rtl8821CU.git
Now, use the following commands to build the driver and install it.
cd ~/build/rtl8821CU make sudo make install
Recently the above driver had an issue with the Linux Kernel 5.19. You will get compile error at the end. If you are facing the same issue, try the following driver. If you have tried the first one and failed, delete the build folder and start again. This driver is provided by Nick and it works. Use the following commands to install this driver:
mkdir -p ~/build cd ~/build git clone https://github.com/morrownr/8821cu-20210916.git
Now, use the following commands to build the driver and install it.
cd ~/build/8821cu-20210916 make sudo make install
Use the following command to load the driver.
sudo modprobe 8821cu
Now, check if the driver is loaded by using the following command:
lsmod | grep 8821cu
Output:
8821cu 2506752 0 cfg80211 974848 1 8821cu
Finally, you need to add the following line to your “/etc/modules” file to start the driver at boot:
8821cu
You can use gedit, nano, xed, or any text editor to do this. I am using gedit, so the command is:
sudo gedit /etc/modules
Now, add 8821cu at the bottom of the document and Save it.
Restart your system and check if your wireless adapter is now functional. If you encounter any issues during installation, you may want to check the log files in the “/var/log” directory for further information.
Conclusion
Installing the Realtek rtl8821cu driver is easy. You need to follow the steps correctly to successfully install it into your system. I hope this small tutorial helps you to solve your problem and that your Realtek wireless adapter starts working.