Set up Clash Client on Your Raspberry Pi 4

There are many tutorials out there on how to set up a Raspberry Pi 4 as a Clash server. However, in my case, I’m using the Pi as a desktop replacement. After some research, I noticed that most Clash clients like Clash for Windows and ClashX do not support Raspberry Pi. However, Clash does conveniently provide release binary for Linux systems on armv7, which matches our Pi 4. So let’s get cranking!

What You Need

I have tested Clash using the above setup and it worked reliably. Feel free to try it on earlier/later models of Pi or on different operating systems. Clash is versatile enough to support various system configurations. Just keep in mind that you need to look for the appropriate release binary for your system.

Download Clash

Clash is an open-source rule-based tunnel hosted on GitHub. You can download it here:

Under the latest release’s assets section, click on “clash-linux-armv7-va.b.c.gz” to download the binary, where va.b.c is is the latest version number.

Extract the downloaded binary to a convenient location. For me, it’s my home directory. Rename the binary to be “clash”, so we can refer to it more easily in the terminal.

Configure Clash

Download the Clash configuration file from your VPN service provider. It should be a YAML file with a .yml file extension. Put the YAML file at this location as the default Clash configuration:


Configure System Proxy

Please follow this official guide by the Pi Foundation on how to configure your system proxy. I’m going to highlight the important bits here:

$ sudo nano /etc/environment

Add the following three lines at the end of the file:

export http_proxy=""
export https_proxy=""
export no_proxy="localhost,"

2. Enable proxy for sudo operations

$ sudo visudo

Add the following line to the file:

Defaults    env_keep+="http_proxy https_proxy no_proxy"

3. Reboot your Pi to take effect

Run Clash!

In the terminal, navigate to the parent folder of your Clash binary.

sudo chmod +x clash

2. Run clash

sudo clash

You should see a bunch of information messages printed on the terminal. DO NOT close the terminal because otherwise, Clash will stop running.

Manage Clash

You can manage Clash proxies, rules, logs, and connections on one of the two web dashboards:

I personally prefer the aesthetics of yacd but both work fine.

Run Clash at Startup

Open Startup Applications or similar on your system settings, add the following command to autostart Clash on startup:

sudo ~/clash

The path depends on where you put Clash. Mine is located under the home directory.


Now, you have Clash successfully set up on your Raspberry Pi 4!

❤️ Open Source, Web Dev, programming languages, and Hanzi 漢字