From e0b1fba69a5974a4262923a98467448ec577d987 Mon Sep 17 00:00:00 2001 From: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com> Date: Sun, 16 Aug 2020 19:26:47 +0800 Subject: [PATCH] Add `zh-CN` support --- ...all-or-update-geoip.dat-and-geosite.dat.md | 2 +- ...ent-permissions-when-using-certificates.md | 2 +- Migrate-from-the-old-script-to-this.md | 2 +- ...s-from-lib-directory-to-share-directory.md | 2 +- To-use-the-VLESS-protocol.md | 2 +- ...-update-geoip.dat-and-geosite.dat-zh-CN.md | 7 ++ locale/zh-CN/Home-zh-CN.md | 1 + ...rmissions-when-using-certificates-zh-CN.md | 103 ++++++++++++++++++ ...grate-from-the-old-script-to-this-zh-CN.md | 98 +++++++++++++++++ ...-lib-directory-to-share-directory-zh-CN.md | 30 +++++ .../zh-CN/To-use-the-VLESS-protocol-zh-CN.md | 75 +++++++++++++ 11 files changed, 319 insertions(+), 5 deletions(-) create mode 100644 locale/zh-CN/Do-not-install-or-update-geoip.dat-and-geosite.dat-zh-CN.md create mode 100644 locale/zh-CN/Home-zh-CN.md create mode 100644 locale/zh-CN/Insufficient-permissions-when-using-certificates-zh-CN.md create mode 100644 locale/zh-CN/Migrate-from-the-old-script-to-this-zh-CN.md create mode 100644 locale/zh-CN/Move-.dat-files-from-lib-directory-to-share-directory-zh-CN.md create mode 100644 locale/zh-CN/To-use-the-VLESS-protocol-zh-CN.md diff --git a/Do-not-install-or-update-geoip.dat-and-geosite.dat.md b/Do-not-install-or-update-geoip.dat-and-geosite.dat.md index 0334a8c..63e7e90 100644 --- a/Do-not-install-or-update-geoip.dat-and-geosite.dat.md +++ b/Do-not-install-or-update-geoip.dat-and-geosite.dat.md @@ -4,4 +4,4 @@ ``` # touch /usr/local/share/v2ray/.undat -``` \ No newline at end of file +``` diff --git a/Insufficient-permissions-when-using-certificates.md b/Insufficient-permissions-when-using-certificates.md index fa4e766..54a6641 100644 --- a/Insufficient-permissions-when-using-certificates.md +++ b/Insufficient-permissions-when-using-certificates.md @@ -100,4 +100,4 @@ fi # chmod +x /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh ``` -`renew` 重新部署證書後,會自動執行 `deploy/` 下具有可執行權限的腳本。 \ No newline at end of file +`renew` 重新部署證書後,會自動執行 `deploy/` 下具有可執行權限的腳本。 diff --git a/Migrate-from-the-old-script-to-this.md b/Migrate-from-the-old-script-to-this.md index 272de3a..88ff92f 100644 --- a/Migrate-from-the-old-script-to-this.md +++ b/Migrate-from-the-old-script-to-this.md @@ -95,4 +95,4 @@ $ curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/insta ### 注意事項 1. 你可能會對多文檔配置結構感到困惑,如果你仍希望使用原有的 `config.json`,請移除這些對你而言多餘的文檔。 -2. 如果你不打算通過 systemd 來管理 V2Ray,請自行處理 `V2RAY_LOCATION_ASSET`。 \ No newline at end of file +2. 如果你不打算通過 systemd 來管理 V2Ray,請自行處理 `V2RAY_LOCATION_ASSET`。 diff --git a/Move-.dat-files-from-lib-directory-to-share-directory.md b/Move-.dat-files-from-lib-directory-to-share-directory.md index 7a74244..a1ee6d5 100644 --- a/Move-.dat-files-from-lib-directory-to-share-directory.md +++ b/Move-.dat-files-from-lib-directory-to-share-directory.md @@ -27,4 +27,4 @@ DAT_PATH='/usr/local/share/v2ray/' [Service] Environment=V2RAY_LOCATION_ASSET=/usr/local/share/v2ray/ -``` \ No newline at end of file +``` diff --git a/To-use-the-VLESS-protocol.md b/To-use-the-VLESS-protocol.md index 67f37a0..1e4504b 100644 --- a/To-use-the-VLESS-protocol.md +++ b/To-use-the-VLESS-protocol.md @@ -72,4 +72,4 @@ fi "keyFile": "/etc/ssl/v2ray/privkey.pem" } ] -``` \ No newline at end of file +``` diff --git a/locale/zh-CN/Do-not-install-or-update-geoip.dat-and-geosite.dat-zh-CN.md b/locale/zh-CN/Do-not-install-or-update-geoip.dat-and-geosite.dat-zh-CN.md new file mode 100644 index 0000000..cba3ece --- /dev/null +++ b/locale/zh-CN/Do-not-install-or-update-geoip.dat-and-geosite.dat-zh-CN.md @@ -0,0 +1,7 @@ +如果你有在运行脚本时,不安装或更新 `geoip.dat` 和 `geosite.dat` 的需求。 + +请运行: + +``` +# touch /usr/local/share/v2ray/.undat +``` diff --git a/locale/zh-CN/Home-zh-CN.md b/locale/zh-CN/Home-zh-CN.md new file mode 100644 index 0000000..28b8007 --- /dev/null +++ b/locale/zh-CN/Home-zh-CN.md @@ -0,0 +1 @@ +Welcome to the fhs-install-v2ray wiki! diff --git a/locale/zh-CN/Insufficient-permissions-when-using-certificates-zh-CN.md b/locale/zh-CN/Insufficient-permissions-when-using-certificates-zh-CN.md new file mode 100644 index 0000000..0b4617e --- /dev/null +++ b/locale/zh-CN/Insufficient-permissions-when-using-certificates-zh-CN.md @@ -0,0 +1,103 @@ +## 使用证书时权限不足 + +### 方案一(不推荐) + +假定证书文档分别为: + +1. `/srv/http/example.com.pem`。 +2. `/srv/http/example.com.key`。 + +据此: + +1. `/srv/http/` 的默认权限一般为 755; +2. `/srv/http/example.com.pem` 的默认权限一般为 644。 +3. `/srv/http/example.com.key` 的默认权限一般为 600; + +将 `/srv/http/example.com.key` 修改为 644 即可: + +``` +# chmod 644 /srv/http/example.com.key +``` + +### 方案二 + +假定证书文档分别为: + +1. `/srv/http/example.com.pem`。 +2. `/srv/http/example.com.key`。 + +``` +# id nobody +``` + +* 输出的结果可能是: + +``` +uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup) +``` + +相应的,只需要执行: + +``` +# chown -R nobody:nogroup /srv/http/ +``` + +* 输出的结果也可能是: + +``` +uid=65534(nobody) gid=65534(nobody) groups=65534(nobody) +``` + +相应的,只需要执行: + +``` +# chown -R nobody:nobody /srv/http/ +``` + +### 方案三(Certbot) + +这里假定你已经通过 Certbot 获取了证书文档。 + +1. `/etc/letsencrypt/live/example.com/fullchain.pem`。 +2. `/etc/letsencrypt/live/example.com/privkey.pem`。 + +如果你使用 Debian 发行版,在安装 Cerbot 后,`renew` 是会定期运行的。 + +创建 V2Ray 专用的证书文档目录: + +``` +# install -d -o nobody -g nogroup /etc/ssl/v2ray/ +``` + +将证书文档以指定权限部署到指定路径: + +``` +# install -m 644 -o nobody -g nogroup /etc/letsencrypt/live/example.com/fullchain.pem -t /etc/ssl/v2ray/ +# install -m 600 -o nobody -g nogroup /etc/letsencrypt/live/example.com/privkey.pem -t /etc/ssl/v2ray/ +``` + +为在后续 `renew` 中自动重新部署,需要一个脚本,以下是参照内容: + +```bash +# vim /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh + +#!/bin/bash + +V2RAY_DOMAIN='example.com' + +if [[ "$RENEWED_LINEAGE" == "/etc/letsencrypt/live/$V2RAY_DOMAIN" ]]; then + install -m 644 -o nobody -g nogroup "/etc/letsencrypt/live/$V2RAY_DOMAIN/fullchain.pem" -t /etc/ssl/v2ray/ + install -m 600 -o nobody -g nogroup "/etc/letsencrypt/live/$V2RAY_DOMAIN/privkey.pem" -t /etc/ssl/v2ray/ + + sleep "$((RANDOM % 2048))" + systemctl restart v2ray.service +fi +``` + +#### 给予脚本可运行权限 + +``` +# chmod +x /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh +``` + +`renew` 重新部署证书后,会自动运行 `deploy/` 下具有可运行权限的脚本。 diff --git a/locale/zh-CN/Migrate-from-the-old-script-to-this-zh-CN.md b/locale/zh-CN/Migrate-from-the-old-script-to-this-zh-CN.md new file mode 100644 index 0000000..df54222 --- /dev/null +++ b/locale/zh-CN/Migrate-from-the-old-script-to-this-zh-CN.md @@ -0,0 +1,98 @@ +## 从旧脚本迁移至此 + +* 请确保你正在使用主流且不过时的发行版。 + +### 停止 V2Ray 服务 + +``` +# systemctl disable v2ray.service --now +``` + +### 移除原有文档 + +``` +# rm -r /usr/bin/v2ray/ +# rm /etc/systemd/system/v2ray.service +# rm /lib/systemd/system/v2ray.service +# rm /etc/init.d/v2ray +``` + +### 迁移配置文档 + +``` +# mv /etc/v2ray/ /usr/local/etc/ +``` + +如果你不想迁移配置文档,请在下载脚本后自行修改: + +``` +# vim install-release.sh + +JSON_PATH='/etc/v2ray/' +``` + +### 修改 Log 权限 + +#### nobody:nogroup + +``` +$ id nobody + +uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup) +``` + +``` +# chown -R nobody:nogroup /var/log/v2ray/ +``` + +#### nobody:nobody + +``` +$ id nobody + +uid=65534(nobody) gid=65534(nobody) groups=65534(nobody) +``` + +``` +# chown -R nobody:nobody /var/log/v2ray/ +``` + +### 安装 cURL + +#### Debian + +``` +# apt update +# apt install curl +``` + +#### CentOS / Fedora + +``` +# dnf makecache +# dnf install curl +``` + +#### openSUSE + +``` +# zypper refresh +# zypper install curl +``` + +### 下载此脚本 + +``` +$ curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh +``` + +### 运行此脚本 + +``` +# bash install-release.sh +``` + +### 注意事项 + +1. 你可能会对多文档配置结构感到困惑,如果你仍希望使用原有的 `config.json`,请移除这些对你而言多余的文档。 +2. 如果你不打算通过 systemd 来管理 V2Ray,请自行处理 `V2RAY_LOCATION_ASSET`。 diff --git a/locale/zh-CN/Move-.dat-files-from-lib-directory-to-share-directory-zh-CN.md b/locale/zh-CN/Move-.dat-files-from-lib-directory-to-share-directory-zh-CN.md new file mode 100644 index 0000000..ac4a165 --- /dev/null +++ b/locale/zh-CN/Move-.dat-files-from-lib-directory-to-share-directory-zh-CN.md @@ -0,0 +1,30 @@ +## 将 .dat 文档由 lib 目录移动到 share 目录 + +目前已无需移动。 + +--- + +如果你需要将 `/usr/local/lib/v2ray/` 移动到 `/usr/local/share/` 下。 + +### 修改脚本 + +``` +# vim install-release.sh + +DAT_PATH='/usr/local/share/v2ray/' +``` + +### 移动目录 + +``` +# mv /usr/local/lib/v2ray/ /usr/local/share/ +``` + +### 修改单元文件 + +``` +# systemctl edit v2ray.service + +[Service] +Environment=V2RAY_LOCATION_ASSET=/usr/local/share/v2ray/ +``` diff --git a/locale/zh-CN/To-use-the-VLESS-protocol-zh-CN.md b/locale/zh-CN/To-use-the-VLESS-protocol-zh-CN.md new file mode 100644 index 0000000..d87d277 --- /dev/null +++ b/locale/zh-CN/To-use-the-VLESS-protocol-zh-CN.md @@ -0,0 +1,75 @@ +## 使用 VLESS 协议 + +### 更细致的权限管理 + +``` +# useradd -s /usr/sbin/nologin v2ray +``` + +#### 修改单元文件 + +``` +# systemctl edit v2ray.service + +[Service] +User=v2ray +``` + +### 通过 Certbot 管理证书 + +这里假定你已经通过 Certbot 获取了证书文档。 + +1. `/etc/letsencrypt/live/example.com/fullchain.pem`。 +2. `/etc/letsencrypt/live/example.com/privkey.pem`。 + +如果你使用 Debian 发行版,在安装 Certbot 后,`renew` 是会定期运行的。 + +创建 V2Ray 专用的证书文档目录: + +``` +# install -d -o v2ray -g v2ray /etc/ssl/v2ray/ +``` + +将证书以指定权限部署到指定路径: + +``` +# install -m 644 -o v2ray -g v2ray /etc/letsencrypt/live/example.com/fullchain.pem -t /etc/ssl/v2ray/ +# install -m 600 -o v2ray -g v2ray /etc/letsencrypt/live/example.com/privkey.pem -t /etc/ssl/v2ray/ +``` + +为在后续 `renew` 重新部署证书后,自动重新部署证书到指定路径,并重启 V2Ray 服务,需要一个脚本,以下是参照内容: + +```bash +# vim /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh + +#!/bin/bash + +V2RAY_DOMAIN='example.com' + +if [[ "$RENEWED_LINEAGE" == "/etc/letsencrypt/live/$V2RAY_DOMAIN" ]]; then + install -m 644 -o v2ray -g v2ray "/etc/letsencrypt/live/$V2RAY_DOMAIN/fullchain.pem" -t /etc/ssl/v2ray/ + install -m 600 -o v2ray -g v2ray "/etc/letsencrypt/live/$V2RAY_DOMAIN/privkey.pem" -t /etc/ssl/v2ray/ + + sleep "$((RANDOM % 2048))" + systemctl restart v2ray.service +fi +``` + +#### 给予脚本可运行权限 + +``` +# chmod +x /etc/letsencrypt/renewal-hooks/deploy/v2ray.sh +``` + +`renew` 重新部署证书后,会自动运行 `deploy/` 下具有可运行权限的脚本。 + +### 修改 V2Ray 配置文档 + +```json +"certificates": [ + { + "certificateFile": "/etc/ssl/v2ray/fullchain.pem", + "keyFile": "/etc/ssl/v2ray/privkey.pem" + } +] +```