How to Install RealTek wifi Drivers in Ubuntu [Tutorial]

Hi fellow members,

In recent weeks there have been inquiries about wifi drivers, dongles and their alternatives.

In this tutorial I’ll explain how to install the Realtek rtl8812AU/8812AU USB wifi driver and the use of a suitable USB3 external wifi aerial, to boost your laptop or rig wifi signal.

Ideally this is used at home to gain a stronger wifi signal through the external aerial, and use the laptop’s builtin wifi system when out and about.

There are several companies offering these types of USB3 wifi aerials (in single or twin format), to complement your existing laptop wifi. The drivers only work with the external aerial and don’t interfer with the builtin system and vice-versa. Thus have two wifi signals to connect to. Should you feel it is useful to enable wifi ability on your rig, it also works.

The following instructions are terminal commands, Ctrl + Alt + T in most Linux OS’es, or click on the icon in Ubuntu’s panel, or menu and found under System or Utility entry.

Tools used in this tutorial are:

  • Dell Latitude 5430 non-v-Pro laptop
  • BrosTrend 1200Mbps Long Range USB WiFi Dongle Adapter
  • Realtek rtl8812AU/8812AU

Install the drivers

Enter the following commands in order:

sudo apt install dkms git

Now, clone this repository:

git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux

Go to the directory:

cd rtl8812AU_8821AU_linux

And now run these commands one after another:

sudo cp -R . /usr/src/rtl8812AU_8821AU_linux-1.0
sudo dkms add -m rtl8812AU_8821AU_linux -v 1.0
sudo dkms build -m rtl8812AU_8821AU_linux -v 1.0
sudo dkms install -m rtl8812AU_8821AU_linux -v 1.0

Check the WiFi driver installation

You should use the following commands:

  • dkms status
  • modinfo rtl8812au | egrep ‘filen|vers|0811’
  • sudo modprobe -rfv rtl8812au
  • sudo modprobe -v rtl8812au
  • iwconfig
  • iwlist chan
  • sudo iwlist scan | egrep -i ‘cell|chan|essid|wpa|cipher|qual’

Now reboot your system and plug in your USB3 aerial.

Upon rebooting the drivers are activated, see picture No2

Chose the 802.11 NIC entry, and enter your wifi password to activate. See picture No3

Picture No4 below shows the usual wifi strength of 65-75mbps of this Dell 5430 Latitude non-vPro laptop, and by switching to the Realtek driver entry, you can see the significant improvement in signal strength of 400mbps in picture No3 above.

4 Likes

Nice to see an elaborate but comprehensive guide.

2 Likes

Thanks for the tutorial @anon56357095

I have created a Tutorial category and moved your post there along with some formatting changes.

2 Likes

Thank you creating this new category. :grinning:

I do not understand why you decided to change the command line instructions.

I used the Ubuntu Gnome 18.04 desktop, for this tutorial, and Ubuntu allowed the use of the su command to gain root privillage (a first I must note). I hope the new instructions method work, as I can not guarantee, it will work.

The commands (below) are the instructions I used to install and activate the wifi drivers.

Install Realtek rtl8812AU/8812AU USB wifi driver

su
apt install dkms
apt install git
git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux
cd rtl8812AU_8821AU_linux
cp -R . /usr/src/rtl8812AU_8821AU_linux-1.0
dkms add -m rtl8812AU_8821AU_linux -v 1.0
dkms build -m rtl8812AU_8821AU_linux -v 1.0
dkms install -m rtl8812AU_8821AU_linux -v 1.0

Test

dkms status
modinfo rtl8812au | egrep 'filen|vers|0811'
su
modprobe -rfv rtl8812au
su
modprobe -v rtl8812au
iwconfig
iwlist chan
su
iwlist scan | egrep -i 'cell|chan|essid|wpa|cipher|qual'

Too many cooks and kitchens, lol

:sunglasses:

I prefer avoiding su. It’s a good practice to use sudo (for invidual commands) then su (a new shell running as root).

1 Like

Okay, nay probs my friend, its horses for courses.

A one of command I use sudo, prolonged use I prefer su. Much to the chagrin of some of the rpm forums I belong to in the past, who are opposed to even mentioning the word sudo.

:sunglasses:

1 Like

@abhishek Thanks for reminding me to chime in on this topic, since I wanted to do that some time ago, but didn’t find the time and ultimately I forgot about it.


Now here, what I originally wanted to say, more or less:

@anon56357095 It is good practice to only use root for commands that actually need it. Especially in a tutorial or guide it should be always clear which commands need root and don’t need root. So, imagine someone is reading your post and they see that every command precedes with a sudo then the user can still decide to change to root for all the command. Your post still makes it clear, which commands need root permissions, though, even if the user decides to. If you use su in the beginning, on the other hand, then maybe (probably) some of the commands don’t need sudo and that would be a bad practice, if used unnecessarily.
Another thing, that I encountered often myself, what if a user did part of the work himself and only needs to execute some of the commands you are presenting? Then he should know what commands explicitly need elevated privileges and which don’t.

An alternative way (that I personally don’t prefer, usually) is to do it like this:

# mv /etc/file /etc/file.bak
$ cat /etc/file.bak

So you don’t explicitly change to root, neither do you use sudo but it’s all clear, when you need what level of permissions.

P.S.:
I personally change only to root, when I have to write tons of commands in a short period of time. With the amount of commands presented in your post, I would use sudo for all of them, since I am a fast typer anyway, and prefer to spend 1ms more of my time for not losing control over permissions given.

P.P.S.:
Forgot to mention, that sudo su is a better practice to get to an elevated prompt within Debian. Technically, it makes little difference, but nonetheless, we are talking about good practices, right now.

2 Likes

Thank you for your clear explanation, but … after restart no WIFI. My system is Ubuntu 19:10.
This is some information I get.

xxx:~$ lsusb
Bus 002 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 006: ID 03f0:2f24 HP, Inc LP2475w Monitor Hub
Bus 002 Device 005: ID 04b8:011d Seiko Epson Corp. GT-7300U [Perfection 1260/1260 PHOTO]
Bus 002 Device 004: ID 074d:3556 Micronas GmbH Composite USB-Device
Bus 002 Device 003: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 13b1:003f Linksys WUSB6300 802.11a/b/g/n/ac Wireless Adapter [Realtek RTL8812AU]
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 058f:6362 Alcor Micro Corp. Flash Card Reader/Writer
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

xxx:~$ dkms status
rtl8812AU_8821AU_linux, 1.0, 5.3.0-19-generic, x86_64: installed
xxx:~$ modinfo rtl8812au | egrep 'filen|vers|0811'
filename:       /lib/modules/5.3.0-19-generic/updates/dkms/rtl8812au.ko
version:        v4.3.14_13455.20150212_BTCOEX20150128-51
srcversion:     62D307B56D9BE4887112742
alias:          usb:v0BDAp0811d*dc*dsc*dp*ic*isc*ip*in*
parm:           rtw_chip_version:int
xxx:~$ sudo modprobe -rfv rtl8812au
rmmod rtl8812au
rmmod cfg80211
xxx:~$ sudo modprobe -v rtl9912au
modprobe: FATAL: Module rtl9912au not found in directory /lib/modules/5.3.0-19-generic
xxx:~$ sudo modprobe -v rtl8812au
insmod /lib/modules/5.3.0-19-generic/kernel/net/wireless/cfg80211.ko 
insmod /lib/modules/5.3.0-19-generic/updates/dkms/rtl8812au.ko 
xxx:~$ iwconfig
lo        no wireless extensions.

enp4s0    no wireless extensions.

xxx:~$ iwlist chan
lo        no frequency information.

enp4s0    no frequency information.

xxx:~$ sudo iwlist scan | egrep -i 'cell|chan|essid|wpa|cipher|qual'
lo        Interface doesn't support scanning.

enp4s0    Interface doesn't support scanning.

You have to install kernel headers and build the module against your kernel. Find the correct driver package and install it, after reboot.

1 Like

@koperwiek
Any updates?

Hello everybody, I haven’t been here in a while. But I am trying to get WiFi for my Dell Optiplex 9020 I’m running Ubuntu 20.04.3 with the 5.11.0-38 generic kernel. I have gone through all the steps listed above and this is my read out after booting:

jack@jack-OptiPlex-9020:~$ lsusb
Bus 002 Device 003: ID 045e:0053 Microsoft Corp. Optical Mouse
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0bda:c811 Realtek Semiconductor Corp.
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jack@jack-OptiPlex-9020:~$ dkms status
bcmwl, 6.20.155.1+bdcom: added
ndiswrapper, 1.60: added
rtl8812AU_8821AU_linux, 1.0: added
rtl88x2bu, 5.6.1: added
snx, 2.0.2.0somerville3, 3.2.0-37-generic, x86_64: built
jack@jack-OptiPlex-9020:~$ sudo modprobe -rfv rtl8812au

modprobe: FATAL: Module rtl8812au not found.

Skito you said, You have to install kernel headers and build the module against your kernel. Find the correct driver package and install it, after reboot. Could you be more specific? I am at my wits end, as Forrest said I’m not a smart man. Can you help me?