If you’re a Raspberry Pi fan, you’re certainly not afraid to dive deep into your computer’s hardware and software. That is a good thing, especially since we’re going to teach you how to set up a VPN on a Raspberry Pi device in 2021.
Before we start, we have a few useful pointers that you need to keep in mind. First of all, VPNs have different installation methods when it comes to their Raspberry Pi support. That’s the reason why we’ve decided to focus on ExpressVPN in this article to provide you with an easy-to-follow tutorial.
Based on our extensive testing of more than sixty VPNs so far, we conclude that you won’t find a better option than ExpressVPN. This is especially applicable to Raspberry Pi owners, as this VPN supports your device in the best way possible.
Aside from setting up a VPN on any Raspberry Pi device, you can install VPNs on practically any computer, smartphone, and more. So, what follows are our in-depth VPN installation guides.
TechNadu’s Step-by-Step Guide: Here’s How to Set Up a VPN on Raspberry Pi in 2021
Let’s get started with this procedure, shall we? These are the steps to install and configure a VPN on Raspberry Pi in 2021.
- Step #1: Check the Required Equipment
- Step #2: Set Up a VPN on Raspberry Pi
- Step #3: Learn to Interact With VPN Servers
- Step #4: Learn to Control Your VPN Connection
Step #1: Check the Required Equipment (If You’re Assembling a Raspberry Pi Device)
Many of you have probably already assembled your Raspberry Pi computers. However, if you’re starting from scratch, you’ll want to know what kind of equipment you need.
So, let’s go over everything you need to assemble your Raspberry Pi computer and prepare it to act as a VPN client.
- Raspberry Pi Board: These days, you’ll find a huge selection of Raspberry Pi boards. However, if you want the latest one available, we recommend getting the Raspberry Pi 4 Model B board (you can choose from 1GB, 2GB, or 4GB of RAM). In addition, the Raspberry Pi 3 Model B will do the job of running a VPN service without a hitch. Even older models should work just fine. However, since the models we recommend are already quite affordable, they bring a better overall value at the moment.
- Raspberry Pi Case: Not just about any case will do the job of allowing your Raspberry Pi to run optimally, especially if you plan on putting your Raspberry Pi under a lot of pressure. If you decide to go with a Raspberry Pi 4 board, the Flirc and iUniker cases stand out. And if you plan on going with a Raspberry Pi 3 board, check out the official Raspberry Pi case on Amazon.
- USB Keyboard & Mouse: When it comes to input devices for Raspberry Pi computers, you have plenty of options in front of you. Newer boards come with Bluetooth integrated, and they also come with USB ports. If you want to cut the costs of building a new Raspberry Pi computer, this AmazonBasics Keyboard + Mouse combo should do the job just fine.
- MicroSD Memory Card: Your Raspberry Pi computer needs some memory, of course. This is where MicroSD cards come into play, allowing you to add gigabytes of storage. However, keep in mind that some memory cards are optimized for Raspberry Pi boards by coming with Raspbian already installed. This speeds up the process of assembling your computer while also allowing you to change your OS in the future. A good option is a memory card sold by STEADYGAMER.
- Ethernet Cable / Wi-Fi Dongle: You also need to think about Internet connectivity. If you plan on going the wired route, you’ll need an Ethernet cable to connect your computer to your router (such as this one by AmazonBasics). There are plenty of Wi-Fi USB adapters available if you’re willing to get rid of cords (note that the newest boards come with Wi-Fi already included). We recommend checking this one by LOOTEKOO, compatible with a range of Raspberry Pi boards.
- Power Adapter: Make sure to use a proper power adapter for your board. It means that you need to know which Raspberry Pi you plan on buying, and you need to know what kind of power adapter that specific board requires. For example, here’s a USB-C power supply for Raspberry Pi 4 boards, and here’s a Micro-USB power supply for Raspberry Pi 3 boards.
- ExpressVPN Subscription: And finally, you’ll need an active VPN subscription. Based on our experience, the best VPN for Raspberry Pi right now is ExpressVPN. It comes with the simplest installation method possible, you get to control it via easy-to-remember commands, and it’s capable of encrypting your data safely and securely.
In case you don’t want to pick each component manually, you can rely on a wide range of Raspberry Pi kits. These bring every possible part you’ll need, from the board itself up to a case, cables, memory card, and more. Among today’s Pi kits, the ones made by CanaKit are the most high-quality. Here’s a Raspberry Pi 4 (4GB) kit as well as a Raspberry Pi 3 B+ kit.
Step #2: Set up a VPN on Raspberry Pi
First, you need to prepare the VPN’s installation file. Then (even though this step is optional), you can verify your VPN’s signature to ensure that your download is unaltered. And finally, you can proceed to install the VPN on your computer. So, let’s go through each of these steps.
1. Prepare ExpressVPN’s Installation File
One of the reasons we recommend ExpressVPN is that it comes with a highly streamlined installation procedure. So, here’s what needs to be done.
Before getting started, you need to have active VPN credentials. Therefore, if you haven’t done so already, make sure to subscribe to ExpressVPN.
- Visit ExpressVPN’s website and log in to your account. Click on the “My Account” link at the top of ExpressVPN’s home page, then supply your email account and password, and you should see your account dashboard.
- Now, click on the button that says “Set Up Other Devices” at the top of the screen. Then, select “Linux” on the left-hand side. Finally, make sure to select “Raspbian” on the right side and then proceed to download it.
- Alternatively, you can also download the installation file by using the following command: “wget https://download.expressvpn.xyz/clients/linux/expressvpn_18.104.22.1685-1_armhf.deb” – and you’ll get the latest version of ExpressVPN. However, the VPN can be updated soon, so it always a good idea to download the installation file by visiting ExpressVPN’s website instead.
You now have ExpressVPN’s installation file on your computer. However, let’s make sure that your download is unaltered before we tell you how to run it. After all, you want to be very careful when installing and using a VPN.
2. Verify Your PGP (Pretty Good Privacy) Signature
Even though this step is optional, we highly recommend going through it. By verifying the PGP key, you can be sure that your data will be properly encrypted. Here’s how to download ExpressVPN’s PGP key and verify its integrity.
- First, download ExpressVPN’s PGP key by running the following command: “gpg –keyserver hkp://keyserver.ubuntu.com –recv-keys 0xAFF2A1415F6A3A38.”
- If the code above doesn’t work, there’s an alternative you can try. So, go ahead with this command: “wget https://www.expressvpn.com/expressvpn_release_public_key_0xAFF2A1415F6A3A38.asc.”
- Finally, you’ll also need to run one more commands, as follows: “gpg –import expressvpn_release_public_key_0xAFF2A1415F6A3A38.asc.“
- Next, you need to verify the fingerprint of the PGP key, done by using the “gpg –fingerprint firstname.lastname@example.org” command. Make sure to closely check if you see the following code on your screen: “1D0B 09AD 6C93 FEE9 3FDD BD9D AFF2 A141 5F6A 3A38.” If you do, proceed to download the signature file and verify the signature on the installer file.
- Log in to your account on ExpressVPN’s website. Click on “Set Up Other Devices,” then choose “Linux” and take a look at the right side of the page. You’ll see the link saying “Signature File,” so make sure to click on it.
- Alternatively, there’s a command you can use to download the file directly by using Terminal: “wget https://download.expressvpn.xyz/clients/linux/expressvpn_22.214.171.1245-1_armhf.deb.asc.” However, ensure the ExpressVPN version in the code matches the file you’ve downloaded earlier.
So far, we’ve installed and PGP key provided by ExpressVPN, which can be used to verify whether any future update files are indeed issued by ExpressVPN.
- Navigate to the folder where you’ve downloaded the installer and signature files. By default, they’re in your “Downloads” folder, so you can use the “cd ~/Downloads/” command to access that folder.
- Finally, you can proceed to run the verification. You can use the following command: “gpg –verify expressvpn_126.96.36.1995-1_armhf.deb.asc,” but keep in mind to use the correction ExpressVPN version (based on the version you’ve downloaded to your computer).
In case the two fingerprints are the same (the one from the file you’ve downloaded and the one supplied by ExpressVPN’s PGP key), you’ve downloaded the official and unaltered file.
In other words, you’re free to proceed with installing ExpressVPN, so continue reading the following segment.
3. Install ExpressVPN on Raspberry Pi
Don’t worry, as we’re nearly done. All there’s left is to run ExpressVPN’s installation file and proceed to activate the application. So, continue as per the following steps.
- Using Terminal, navigate to the folder where you’ve downloaded ExpressVPN’s installation file. By default, you can use the “cd ~/Downloads/” command if the file is in your “Downloads” folder.
- Now, run the “sudo dpkg -i expressvpn_188.8.131.525-1_armhf.deb” command. Once again, make sure to use the correct version number – if you’re reading this by the time ExpressVPN releases a new update, make sure to replace the corresponding numbers in the command we’re showing you.
- Once the application is installed, run the “expressvpn activate” command. You will be asked to insert your activation code, which is found on ExpressVPN’s website (once you log in to your account). Copy and paste the activation code and then confirm your entry by pressing the “Enter” key.
- You will be asked whether to send anonymous information, so you can press “N” or “Y” to decline or accept this offer. Keep in mind that this data is used for diagnostic purposes, and no personal data is being sent to ExpressVPN. In fact, ExpressVPN was audited in the past to prove its claims of not collecting any personally identifiable information about its users.
That’s it! You’ve now set up ExpressVPN on your Raspberry Pi. Considering that ExpressVPN brings a command-line interface on Linux, you’ll need to learn how to use it.
In other words, we will show you plenty of useful commands for connecting and disconnecting to various servers and interacting with the VPN application itself.
Step #3: Learn to Interact With VPN Servers
In this segment, we will show you how to interact with ExpressVPN. More precisely, we will show you how to connect to the closest server, list all available servers, and shut down your VPN session. So, let’s get started.
How to Connect to a Server
You can connect to a server simply by using the “expressvpn connect” command via Terminal. By using this command, ExpressVPN will check your physical location and connect you to the closest server available. This is a feature offered by ExpressVPN that is called “Smart Location.” However, once you start using the VPN, the “expressvpn connect” command will actually connect you to the most recently used server.
Speaking of picking a server, there are many benefits to using the closest one available. The most prominent advantage is the small impact of this set-up on your Internet connection speed.
Considering that your Web data doesn’t travel too far, you shouldn’t feel any negative effect of using a VPN. Connecting to a remote server will always slow down your network connection up to a certain point.
Also, keep in mind that you can use ExpressVPN on up to five devices simultaneously. You can install it on as many as you want, but you can have up to five active connections concurrently. If you go over this limit, ExpressVPN will display a message that your usage limit is exceeded (that’s right, you won’t find any confusing error messages here, even on Raspberry Pi).
How to Connect to a Specific Server
ExpressVPN offers more than 1,000 servers in more than 90 locations. As you can see, you’ll have plenty of options in front of you. So, to check out the available servers, you can go with the “expressvpn list all” command. This will bring up a huge list of servers, so let’s see what the information found here means.
First, on the left side, you’ll see an alias of each server (usala3, usde, ussj, hk1, and plenty more). Then, you’ll see the country and the location of each server. And on the right side, ExpressVPN provides a personalized recommendation about whether it’s suitable to connect to a specific server from your physical location.
To connect to a specific server, you can use the “expressvpn connect [LOCATION]” or “expressvpn connection [ALIAS]” commands. For example, let’s say that we want to connect to a Los Angeles server. It means you could use the “expressvpn connection usala1” command or the – expressvpn connect “USA – Los Angeles – 1.”
You can also connect to a specific country, allowing ExpressVPN to pick the most suitable server associated with that country. The code you need to use would be “expressvpn connect [COUNTRY]” – as in “expressvpn connect Germany.”
If you remember, we previously told you about ExpressVPN’s “Smart Location” feature that allows you to connect to the closest server available. To use this option, you can go with the “expressvpn connect smart” command.
How to Disconnect From a Server
When you no longer need your VPN session to be active, you can disconnect from the currently used server. For this purpose, the “expressvpn disconnect” command should be used. The VPN will display a message saying that you’re disconnected, and you’ll automatically return to your regular IP address.
Step #4: Learn to Control Your VPN Connection
By now, you’ve installed ExpressVPN on your Raspberry Pi, and you also know how to connect and disconnect from servers. Considering that ExpressVPN brings a command-line interface, you’ll want to know additional commands to control your VPN connection.
Use a Different VPN Protocol
VPN services bring all kinds of VPN protocols, in charge of encrypting your Web data and keeping it in a secure tunnel. When it comes to ExpressVPN, you can rely on the OpenVPN protocol for Raspberry Pi. However, you can switch between two variants here – TCP and UDP.
Generally, the TCP variant is incredibly tough, capable of bypassing different kinds of firewalls. It’s also very reliable and stable, without you having to worry about losing your VPN connection at any moment. Then, we have the UDP variant, which brings fast Internet browsing speeds, but this one is not as reliable as its counterpart.
To switch between these two protocols, you can use the “expressvpn protocol tcp” or “expressvpn protocol udp” commands. By entering any of these commands, ExpressVPN will automatically switch to the chosen protocol. And if you’d like to allow ExpressVPN to pick the optimal protocol based on your location, you can go with “expressvpn protocol auto.”
Initialize ExpressVPN on Start-Up
If you’d like to use ExpressVPN at all times (and therefore keep your Web connection protected without interruption), you need to set the VPN to start on boot-up automatically. This is even more important on Raspberry Pi computers, which often run as media streaming machines. If your Raspberry Pi restarts for any reason, you know that it’ll automatically connect once your computer’s system is up and running.
To allow ExpressVPN to run on startup, you need to use the “expressvpn autoconnect true” command. You should see a message via Terminal that ExpressVPN’s auto-connect is enabled. To disable this feature, use the “expressvpn autoconnect false” command.
Utilize the Autocomplete Feature
As you can see, ExpressVPN requires you to remember a whole series of commands. In your day-to-day use of this VPN, you’ll probably only use a couple of commands, so it’s not that hard to remember them. However, let’s not forget about power users who want to really dig into this application.
This is where the autocomplete feature comes into play. It allows you to get a list of functions by pressing the “Tab” key – while typing a specific command. For example, let’s say that you want to switch to a different VPN protocol. You can use the “expressvpn protocol” command and then press the “Tab” key twice to see which protocols are available.
Troubleshoot Your VPN Connection
In case you run into any problems connecting to ExpressVPN, you should first try connecting to a different server. Also, you can try switching to a different protocol. If that doesn’t work, you can restart your computer and then restart ExpressVPN by using the “sudo service expressvpn restart” command. This should be especially helpful if you see a message saying that you can’t connect to the ExpressVPN daemon.
If you decide to install a new version of ExpressVPN, it’s advisable to remove the old version first, meaning you should uninstall the VPN application before getting the new one. For this purpose, the “sudo dpkg -r expressvpn” will do the job of removing ExpressVPN from your system.
Open ExpressVPN’s Manual
There’s a reason why ExpressVPN is one of the world’s most popular VPN services. When it comes to Raspberry Pi computers, we’re certain you won’t find a better deal than ExpressVPN. Therefore, if you become a subscriber, it’s wise to take your time and learn about the VPN’s features.
If you’d like to check everything that ExpressVPN offers on your Raspberry Pi computer, go with the “man expressvpn” command. This will open the application’s manual, featuring a series of commands and descriptions, allowing you to get the most out of this VPN.
So, you’ve finally reached the end of our guide on how to set up a VPN on Raspberry Pi. We hope that you gained useful knowledge by reading this article. However, if you have any additional questions, please contact us by using the comments section below. And of course, enjoy using your Raspberry Pi!