diff --git a/.vitepress/config/cn.ts b/.vitepress/config/cn.ts index dd5a571..c86bd36 100644 --- a/.vitepress/config/cn.ts +++ b/.vitepress/config/cn.ts @@ -23,6 +23,7 @@ export const cn = defineConfig({ { text: '无公网IP', link: '/guide/network/networking-without-public-ip' }, { text: '使用 WireGuard 客户端接入', link: '/guide/network/use-easytier-with-wirefuard-client' }, { text: '注册为windows服务(开机自启)', link: '/guide/network/install-as-a-windows-service' }, + { text: '将服务安装为 Linux Systemd 服务', link: '/guide/network/install-as-a-systemd-service' }, { text: '其他配置', link: '/guide/network/configurations' }, ], }, diff --git a/.vitepress/config/en.ts b/.vitepress/config/en.ts index f1afda5..2b76101 100644 --- a/.vitepress/config/en.ts +++ b/.vitepress/config/en.ts @@ -23,6 +23,7 @@ export const en = defineConfig({ { text: 'Without Public IP', link: '/en/guide/network/networking-without-public-ip' }, { text: 'Use WireGuard Client', link: '/en/guide/network/use-easytier-with-wirefuard-client' }, { text: 'Installing as a Windows Service (Auto-Start on Boot)', link: '/en/guide/network/install-as-a-windows-service' }, + { text: 'Installing as a Linux Systemd Service', link: '/en/guide/network/install-as-a-systemd-service' }, { text: 'Other Configurations', link: '/en/guide/network/configurations' }, ], }, diff --git a/en/guide/network/install-as-a-systemd-service.md b/en/guide/network/install-as-a-systemd-service.md new file mode 100644 index 0000000..476d864 --- /dev/null +++ b/en/guide/network/install-as-a-systemd-service.md @@ -0,0 +1,34 @@ +# Installing as a Linux Systemd Service + +On Linux distributions that support systemd, you can configure the service to start automatically with the system by following these steps: + +1. Create a new service file at `/etc/systemd/system/easytier.service` and modify the command line parameters after `ExecStart` as needed. + +```shell +[Unit] +Description=EasyTier Service +After=network.target syslog.target +Wants=network.target + +[Service] +Type=simple +ExecStart=/root/easytier-core --ipv4 x.x.x.x --network-name xxx --network-secret yyy --peers tcp://peer_host:11010 + +[Install] +WantedBy=multi-user.target +``` + +2. After saving the file, run the following command in the terminal to enable the service: + +```sh +systemctl enable easytier.service +``` + +3. You can start and stop the service using the following commands: + +```sh +systemctl start easytier.service +systemctl stop easytier.service +``` + +Please note that using the `systemctl` command instead of the `service` command is the more modern approach, and it is recommended to use it on systems that support systemd. \ No newline at end of file diff --git a/guide/network/install-as-a-systemd-service.md b/guide/network/install-as-a-systemd-service.md new file mode 100644 index 0000000..35f0992 --- /dev/null +++ b/guide/network/install-as-a-systemd-service.md @@ -0,0 +1,34 @@ +# 将服务安装为 Linux Systemd 服务 + +在支持 systemd 的 Linux 发行版中,可以通过以下步骤将服务配置为随系统启动: + +1. 创建新的服务文件 `/etc/systemd/system/easytier.service`,并根据需要修改 `ExecStart` 后面的命令行参数。 + +```shell +[Unit] +Description=EasyTier Service +After=network.target syslog.target +Wants=network.target + +[Service] +Type=simple +ExecStart=/root/easytier-core --ipv4 x.x.x.x --network-name xxx --network-secret yyy --peers tcp://peer_host:11010 + +[Install] +WantedBy=multi-user.target +``` + +2. 保存文件后,在命令行中执行以下命令以启用服务: + +```sh +systemctl enable easytier.service +``` + +3. 启动和停止服务可以使用以下命令: + +```sh +systemctl start easytier.service +systemctl stop easytier.service +``` + +请注意,使用 `systemctl` 命令替代 `service` 命令是更现代的做法,建议在支持 systemd 的系统中使用。 \ No newline at end of file