Linux Network Proxy Configuration Guide
Configuring network proxy tools in Linux environment helps us access global internet resources. This guide will introduce how to configure Clash proxy on Linux systems.
1. Download Clash Core
First, we need to download the Clash core program. Here we use a pre-compiled version.
wget https://github.com/zhongfly/Clash-premium-backup/releases/download/2023-09-05-gdcc8d87/clash-linux-amd64-n2023-09-05-gdcc8d87.gz
After downloading, extract the file, rename it to clash, and grant executable permissions.
gunzip clash-linux-amd64-n2023-09-05-gdcc8d87.gz
mv clash-linux-amd64-n2023-09-05-gdcc8d87 clash
chmod +x clash
2. Download GeoIP Database
Clash needs a GeoIP database for routing rule decisions.
mkdir -p ~/.config/clash/
wget -O ~/.config/clash/Country.mmdb https://github.com/Dreamacro/maxmind-geoip/releases/latest/download/Country.mmdb
3. Prepare Configuration File
Clash requires a configuration file config.yml to run. This file defines proxy servers, rules, and other information.
Typically, you can obtain this file from your proxy service provider. You need to upload the config.yml file you use on Windows or other devices to your Linux device and place it in the same directory as the clash executable.
4. Start Clash
After placing the config.yml file in the same directory as the clash executable, use the following command to start Clash:
./clash -f config.yml
If everything is normal, Clash will run in the background.
5. Test Connection
After starting Clash, we can test the network connection by setting up a proxy. Clash’s default HTTP proxy port is 7890.
First, test if you can access Google:
curl -x http://127.0.0.1:7890 https://www.google.com -I --connect-timeout 5
If it returns HTTP/2 200 or HTTP/1.1 301 or other successful status codes, the proxy is working properly.
Next, you can check the location of the exit IP address:
curl -x http://127.0.0.1:7890 https://ipinfo.io
The output IP information should show the region where your proxy server is located.
At this point, you have successfully configured Clash proxy on Linux.