Linux
etp服务端一般安装在具有公网IP的Linux服务器上,本文介绍基于Linux环境的安装教程。
提示
安装过程中若出现问题,可先查阅 常见问题 文档寻找解决方案。
方法一:采用nohup
服务端配置:
etps.toml
host="0.0.0.0"
bindPort = 9527
客户端配置:
etpc.toml
serverAddr = "x.x.x.x"
serverPort = 9527
secretKey = "your-secret-key"
将可执行程序和toml配置文件放在同一个文件夹,然后执行命令:
sudo nohup ./etps > /dev/null 2>&1 && #启动服务端
sudo nohup ./etpc > /dev/null 2>&1 & #启动客户端
或者
sudo nohup ./etps -c etps.toml > /dev/null 2>&1 & #启动服务端
sudo nohup ./etpc -c etpc.toml > /dev/null 2>&1 & #启动客户端
方法二:采用systemd
下文介绍如何使用systemd安装etp服务端。
- 安装
systemd如果没有安装systemd,执行如下命令安装:
# CentOS/RHEL
yum install systemd
# Debian/Ubuntu
apt install systemd
- 创建
etps.service服务文件 在/etc/systemd/system目录下创建一个etps.service服务文件
sudo vim /etc/systemd/system/etps.service
添加如下内容:
[Unit]
# 服务名称,可自定义
Description = etp server
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
# 启动etps的命令,修改为自己的etps的文件路径
ExecStart = /path/to/etps -c /path/to/etps.toml
[Install]
WantedBy = multi-user.target
- 使用
systemd命令管理etps服务
# 启动
sudo systemctl start etps
# 停止
sudo systemctl stop etps
# 重启
sudo systemctl restart etps
# 查看状态
sudo systemctl status etps