English | Русский
Shell script that installs Passwall2 on an OpenWrt router from the upstream GitHub releases. Works with both opkg and apk (OpenWrt 25.x).
Run on the router:
sh -c "$(wget -qO- https://raw.githubusercontent.com/enxy0/passwall2_install/main/passwall2.sh)"That is the whole install. See Options to change what it installs.
Note: the upstream archive does not always ship the proxy cores (
26.8.27had none,26.11.11has them again). The script installsxray-coreandsing-boxfrom the passwall build feed, where they are much newer than in the official OpenWrt feeds. The feed stays configured (/etc/apk/repositories.d/passwall.listforapk,/etc/opkg/customfeeds.confforopkg), so the cores can be updated later. Use--no-xrayor--no-sing-boxto skip one (sing-boxtakes about 44 MB of flash), or--no-feedto keep the existing feeds.
To read the script before running it:
cd /tmp && wget -O passwall2.sh https://raw.githubusercontent.com/enxy0/passwall2_install/main/passwall2.sh
less passwall2.sh
sh passwall2.shOptions go after --. Each line below replaces the command above — run one of them, not both.
sh -c "$(wget -qO- https://raw.githubusercontent.com/enxy0/passwall2_install/main/passwall2.sh)" -- -c
sh -c "$(wget -qO- https://raw.githubusercontent.com/enxy0/passwall2_install/main/passwall2.sh)" -- 26.9.2-1
sh -c "$(wget -qO- https://raw.githubusercontent.com/enxy0/passwall2_install/main/passwall2.sh)" -- -c 26.6.3-1Full list:
Usage: passwall2.sh [OPTIONS] [VER]
Options:
[VER] Optional release version (e.g., 26.6.3-1)
-c, --clean Clean install (remove old packages first)
-l, --only-luci Install only LuCI interface (skip binaries)
--no-xray Do not install xray-core
--no-sing-box Do not install sing-box (~44 MB on flash)
--no-feed Do not add the passwall build feed
--no-restart Do not restart the Passwall2 services after the install
-h, --help Show help message
Examples:
passwall2.sh Install latest release
passwall2.sh 26.6.3-1 Install a specific release
passwall2.sh -c Clean install of latest release
passwall2.sh -c 26.6.3-1 Clean install of a specific release
passwall2.sh -l LuCI-only install
passwall2.sh --no-sing-box Install with xray-core only
passwall2.sh --no-xray Install with sing-box only
passwall2.sh --no-feed Install the cores from the existing feeds
- Installs
curl,unzip,jsonfilter,kmod-nft-tproxy,kmod-nft-socket, and replacesdnsmasqwithdnsmasq-fullif needed. - Backs up
/etc/config/passwall2and/etc/config/passwall2_serverif they exist. - Downloads the LuCI package and the runtime archive for the detected architecture.
- Installs the runtime packages from the archive (chinadns-ng, shadowsocks-rust, simple-obfs, v2ray-plugin, geodata). When the archive includes the cores,
--no-xrayand--no-sing-boxskip them too. - Adds the passwall build feed and installs or upgrades
xray-coreandsing-boxfrom it. If the feed cannot be added or read, the feed line is removed again and the cores come from the official OpenWrt feeds. - Installs the LuCI package and cleans up.
- Restarts the Passwall2 services that were running before the install. The package installs itself with
start, notrestart, which would leave a second proxy process. A service that was stopped stays stopped.--no-restartskips this step.
Then open LuCI and go to Services -> Passwall2.
The feed stays configured, so the cores can be updated later without this script:
apk update && apk add --upgrade xray-core sing-box # OpenWrt 25.x
opkg update && opkg upgrade xray-core sing-box # older releasesUpgrade only these packages. A bare apk upgrade or opkg upgrade is not recommended on OpenWrt.
Not enough space. Run with -c to remove the old packages first, or skip sing-box with --no-sing-box.
No compatible binary package. Run with -l to install only the LuCI interface.
Passwall2 starts but no traffic is proxied. A proxy core is missing: /usr/bin/xray or /usr/bin/sing-box must exist. The log shows process /tmp/etc/passwall2/acl/default.json error. Install a core manually:
apk add xray-core sing-box # OpenWrt 25.x
opkg install xray-core sing-box # older releases- Passwall2: original project by the OpenWrt Passwall team