Configure Clash Nyanpasu on Linux
Last Update:
Word Count:
Read Time:
Page View: loading...
Choosing and Setting up Clash.Nyanpasu Client on Linux
This guide will walk you through setting up Clash.Nyanpasu on a Linux server without a graphical user interface. We’ll use the Mihomo core, and you’ll learn how to manage your proxy settings via the command line.
We recommend using Clash.Nyanpasu for its robust features and active development.
1. Determine Your System Architecture
First, identify your Linux server’s architecture to download the correct AppImage. For example, if you have an x86_64 Ubuntu server, you’ll download the amd64.AppImage.
To find your architecture, use the command:
1 | |
This will output something like x86_64, aarch64, etc.
2. Download Clash.Nyanpasu
Navigate to the Clash.Nyanpasu releases page. Find the latest pre-release or stable release and locate the .AppImage file corresponding to your architecture.
For example, for x86_64 (also known as amd64), you might download:
1 | |
Remember to replace the URL with the specific version you are downloading.
3. Extract the AppImage
AppImages are self-contained executables. While they can often be run directly on systems with FUSE set up, on servers without a graphical environment, you might encounter issues like:
1 | |
And sudo modprobe fuse might not work if modprobe is not in your PATH or if you don’t have the necessary kernel modules.
To proceed without FUSE, extract the AppImage’s contents:
1 | |
This will create a squashfs-root directory in your current location.
4. Prepare Configuration Files
4.1 Locate the Mihomo Executable
After extraction, the Mihomo core executable (which Clash.Nyanpasu uses) will be located within the squashfs-root directory. Based on the example, it’s typically found at:
/workspace/squashfs-root/usr/bin/mihomo
(Note: The path in your system might vary if you extracted it elsewhere. Adjust /workspace/ accordingly.)
4.2 Create Configuration Directory
Create a directory for your Clash configuration files. We’ll use /etc/clash/ as the default in this guide:
1 | |
4.3 Copy Configuration Files
Copy your config.yaml file (which you should have prepared beforehand, containing your proxy settings) into the /etc/clash/ directory.
1 | |
Replace /path/to/your/config.yaml with the actual path to your configuration file.
4.4 GeoIP Database (MMDB)
Clash uses a GeoIP database (Country.mmdb) for IP-based routing. If you don’t have one, you’ll need to download it. Mihomo typically expects it in the same directory as your config.yaml.
You can download Country.mmdb from sources like:
- Official MaxMind GeoLite2: You need to register for a free account to download
GeoLite2-Country.mmdb, then rename it toCountry.mmdb. - Third-party Mirrors (use with caution and verify integrity): Some Clash-related projects provide direct downloads. Search for “Country.mmdb download clash” to find reputable sources.
Once downloaded, copy it to your configuration directory:
1 | |
5. Configure Shell Environment
To easily manage Clash and proxy settings, add the following functions to your ~/.bashrc file. This allows you to start Clash, and enable/disable proxy settings with simple commands.
Open ~/.bashrc with your preferred editor (e.g., nano or vim):
1 | |
Add the following lines to the end of the file:
1 | |
Save the file and exit the editor.
Apply the changes to your current session:
1 | |
6. Running Clash with TMUX
Since you’re on a server without a GUI, you’ll want to run Clash in a detached session so it continues running even after you close your terminal. tmux is an excellent tool for this.
Start a new tmux session:
1
tmux new -s clashYou are now inside a new
tmuxsession namedclash.Start Clash:
Inside the
tmuxsession, run theclashfunction you defined:1
clashYou should see output indicating Mihomo is starting.
Detach from the tmux session:
Press
Ctrl+bthend. You will be returned to your main shell, and Clash will continue running in the background within thetmuxsession.
7. Controlling the Proxy
From any other terminal window on your server (or your main shell after detaching from tmux):
To enable the proxy:
1
proxy_onYou can optionally specify a port if your Clash instance is listening on something other than 7890:
proxy_on 8888.To disable the proxy:
1
proxy_off
8. Managing the Clash Session
To reattach to the Clash tmux session:
1
tmux attach -t clashTo stop Clash:
If you are attached to the
clash, you can stop Clash by pressingCtrl+cin the terminal where Clash is running. This will terminate the Mihomo process and close the tmux pane.To kill the tmux session (and Clash running within it):
1
tmux kill-session -t clash
This comprehensive setup allows you to efficiently manage Clash.Nyanpasu and your proxy settings on a headless Linux server.