How to Install RealTek wifi Drivers in Ubuntu [Tutorial]


#1

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.


#2

Nice to see an elaborate but comprehensive guide.


#3

Thanks for the tutorial @mack

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


#4

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:


#5

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


#6

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:


#7

@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:

@mack 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.