Skip to content

Latest commit

 

History

History
281 lines (211 loc) · 9.35 KB

install.md

File metadata and controls

281 lines (211 loc) · 9.35 KB

安装指南

NPS 提供多种安装方式,推荐使用 Docker 部署,也支持 二进制发布包安装 及 源码编译。


1. NPS 服务端

docker-compose.yaml

services:
  nps_duan2001:
    image: docker.1ms.run/duan2001/nps:latest
    restart: always
    network_mode: host # 服务端根据情况配置网络情况,默认端口8081,可以修改配置文件更改
    container_name: npsduan2001
    volumes:
      - /www/dk_project/dk_app/duan2001nps/nps_duan2001/conf:/conf

1. NPC 客户端

DockerHub(推荐)

docker pull duan2001/npc
docker run -d --restart=always --name npc --net=host duan2001/npc -server=xxx:123,yyy:456 -vkey=xxx,yyy -type=tls,tcp -log=off

docker-compose.yaml 无配置文件安装

version: '3.8'

services:
  npc:
    image: duan2001/npc
    container_name: npchk64901419
    # 保持与 docker run --net=host 一致,直接使用宿主机网络
    network_mode: host
    # 保持与 docker run --restart=always 一致
    restart: always
    # 将 run 命令后面的参数放入 command 字段
    volumes:
      - /opt/npchk64901419/conf:/conf
    command:
      - -server=XXX.XX.XXX.XXX:8024
      - -vkey=XXXXXX
      - -type=tcp

GHCR(可选)

docker pull ghcr.io/djylb/npc
docker run -d --restart=always --name npc --net=host ghcr.io/djylb/npc -server=xxx:123,yyy:456 -vkey=xxx,yyy -type=tls,tcp -log=off

2. 脚本安装

此方式不支持 Windows 安装。

2.1 NPS

# Install (default configuration path: /etc/nps/; binary file path: /usr/bin/)
wget -qO- https://fastly.jsdelivr.net/gh/djylb/nps@master/install.sh | sudo sh -s nps
nps install
nps start|stop|restart|uninstall

# Update
nps update && nps restart

2.2 NPC

# Install
wget -qO- https://fastly.jsdelivr.net/gh/djylb/nps@master/install.sh | sudo sh -s npc
/usr/bin/npc install -server=xxx:123,yyy:456 -vkey=xxx,yyy -type=tls -log=off
npc start|stop|restart|uninstall

# Update
npc update && npc restart

2.3 脚本说明

  • 不传任何参数时,脚本默认安装最新版本的 nps 和 npc,二进制文件会安装到系统路径(/usr/bin 或 /usr/local/bin),配置文件位于 /etc/nps。

  • 脚本支持通过参数指定:

    • 模式:nps | npc | all(默认 all)
    • 版本:例如 v0.29.0,默认 latest
    • 安装目录:指定路径时,压缩包将直接解压到该目录,而不会安装到系统路径。
  • 同样支持以下环境变量:

    • NPS_INSTALL_MODE:等同于第一个参数
    • NPS_INSTALL_VERSION:等同于第二个参数
    • NPS_INSTALL_DIR:等同于第三个参数

3. 发布包安装

NPS 提供官方二进制安装包,适用于 Windows、Linux、macOS、FreeBSD 等多种平台。

📌 下载地址:🔗 最新发布页面


3.1 Windows 安装

Windows 10/11 用户(推荐):

Windows 7 用户(使用 old 结尾版本):

📌 安装方式(解压后进入文件夹)

# NPC 客户端
.\npc.exe install -server="xxx:123,yyy:456" -vkey="xxx,yyy" -type="tcp,tls" -log="off"
.\npc.exe start|stop|restart|uninstall

# 更新
.\npc.exe stop
.\npc-update.exe update
.\npc.exe start

3.2 Linux 安装

📌 推荐使用 Docker 运行。

X86/64

ARM

📌 安装方式(解压后进入文件夹)

# NPS 服务器
./nps install
nps start|stop|restart|uninstall

# 支持指定配置文件路径
./nps -conf_path="/app/nps"
./nps install -conf_path="/app/nps"

# 更新
nps update && nps restart

# NPC 客户端
./npc install
/usr/bin/npc install -server=xxx:123,yyy:456 -vkey=xxx,yyy -type=tcp,tls -log=off
npc start|stop|restart|uninstall

# 更新
npc update && npc restart

3.3 macOS 安装

📌 安装方式(解压后进入文件夹)

# NPS 服务器
./nps install
nps start|stop|restart|uninstall

# 支持指定配置文件路径
./nps -conf_path="/app/nps"
./nps install -conf_path="/app/nps"

# 更新
nps update && nps restart

# NPC 客户端
./npc install
/usr/bin/npc install -server=xxx:123,yyy:123 -vkey=xxx,yyy -type=tcp,tls -log=off
npc start|stop|restart|uninstall

# 更新
npc update && npc restart

3.4 FreeBSD 安装


4. Android 使用

4.1 APK (仅限NPC)

4.2 Termux 运行


5. OpenWrt 使用


6. 源码安装(Go 编译)

6.1 安装依赖

go get -u github.com/djylb/nps

6.2 编译

NPS 服务器

go build -o nps cmd/nps/nps.go

NPC 客户端

go build -o npc cmd/npc/npc.go

编译完成后,即可使用 ./nps 或 ./npc 启动。


7. 相关链接