nps,npc其他版本見: https://github.com/ehang-io/nps/releases
一、服務端安裝(雲主機)
1.1 wget命令安裝 (centos系統需要安裝,ubuntu不需要該步)
yum -y install wget yum -y install setup yum -y install perl
1.2 下載NPS源碼(源碼下載地址根據自己的設備)
國內地址:https://gitee.com/easy-know/nps
海外地址:https://github.com/ehang-io/nps/releases
wget https://github.com/ehang-io/nps/releases/download/v0.26.9/linux_amd64_server.tar.gz
1.3 解壓NPS
tar -zxvf linux_amd64_server.tar.gz
1.4 安裝NPS
安裝后軟件會開機自動啟動,NPS內網穿透占用幾個端口號,所以需要關閉防火牆(不建議),或者放行以下端口:
服務端默認占用的端口:80 443 8080 8024
sudo ./nps install
1.5 啟動NPS
sudo nps start
或
./nps start
啟動完成之后可以先訪問下服務器端(如http://雲主機ip:8080/)
1.6 自定義項
安裝好服務端后需要及時的修改默認的賬號和密碼一般默認配置文件路徑在/etc/nps/conf/nps.conf,修改好重啟服務器生效
#web web_host=a.o.com web_username=admin #修改用戶名 web_password=123 #修改密碼 web_port = 8080 #web管理頁面的端口號 web_ip=0.0.0.0 web_base_url= web_open_ssl=false web_cert_file=conf/server.pem web_key_file=conf/server.key
二、客戶端(需要實現內網穿透的主機)
2.1 wget命令安裝 (centos系統需要安裝,ubuntu不需要該步)
yum -y install wget yum -y install setup yum -y install perl
2.2 下載NPC源碼
wget https://github.com/ehang-io/nps/releases/download/v0.26.9/linux_amd64_client.tar.gz
2.3 解壓NPC
tar -zxvf linux_amd64_client.tar.gz
2.4 啟動NPC
2.4.1 無需配置文件
客戶端除運行一條命令外無需任何其他設置,此模式的各種配置在服務端web管理中完成。
./npc -server=服務器ip:web中顯示的port -vkey=web界面中顯示的密鑰
2.4.2 注冊到系統,開機自啟動
對於linux、darwin
注冊:sudo ./npc install #其他參數(例如-server=xx -vkey=xx或者-config=xxx) 啟動:sudo npc start 停止:sudo npc stop #如果需要更換命令內容需要先卸載./npc uninstall,再重新注冊
三、客戶端更新
首先進入到對於的客戶端二進制文件目錄
請首先執行
sudo npc stop #停止運行
sudo npc-update update