CentOS: Install TP-Link TL-WN821N Wireless USB Driver

I have a small server in my office which having network card problem because being stroked by lightning. So I decided to use TP-Link wireless USB adapter because this is the only available wireless adapter that we have in office.

This server has GNOME user interface. So I will let ‘Network Manager‘ to manage the wireless network. Variable as below:

OS: CentOS 6.2 64bit
Kernel version: 2.6.32-220.el6.x86_64
Wireless adapter:  TP-Link TL-WN821N v3

1. List all connected USB device:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 046d:c05b Logitech, Inc.
Bus 001 Device 004: ID 413c:2107 Dell Computer Corp.
Bus 001 Device 005: ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]
Bus 002 Device 003: ID 18e3:9106 Fitipower Integrated Technology Inc

2. Based on the output, we can determine the type of driver and chipset that we need to install as refer to this page: http://linuxwireless.org/en/users/Devices/USB.

3. Install applications that required in order to compile the driver:

$ yum install gcc automake autoconf kernel-headers kernel-devel -y

4. Download compat-wireless (the driver) from this page: http://linuxwireless.org/en/users/Download/stable/. I will download the latest stable version which is: compat-wireless-3.3-1.tar.bz2

Since the current server does not have internet connection, I will need to download the driver into my local PC and transfer to the server using USB hard drive. I then copy the package into /root directory in the destination server.

5. Extract and compile the source:

$ cd /root
$ tar -xjzf compat-wireless-3.3-1.tar.bz2
$ cd compat-wireless-*
$ ./scripts/driver-select ath9k_htc
$ make
$ make install

6. As you can see in step 1, the firmware version is Atheros AR7010+AR9287. So we need to download the respective firmware at this page: http://linuxwireless.org/download/htc_fw/ and move it into /lib/firmware directory:

$ cd /lib/firmware
$ wget http://linuxwireless.org/download/htc_fw/1.3/htc_7010.fw

7.  Once done, restart the server so it will load the driver accordingly:

$ init 6

Done! I can now able to detect and connect to the wireless network in the office.

Notes

There are some reference in Scientific Linux forum that when you have ELrepo installed, you could skip steps 3, 4 and 5 by running following command:

$ yum install kmod-compat-wireless

Reference: http://linuxwireless.org/en/users/Drivers/ath9k_htc