diff --git a/docs/uninstall-zh.md b/docs/uninstall-zh.md index 1666ee1..65b2510 100644 --- a/docs/uninstall-zh.md +++ b/docs/uninstall-zh.md @@ -2,9 +2,22 @@ *其他语言版本: [English](uninstall.md), [简体中文](uninstall-zh.md).* -按照以下步骤移除 VPN。这些命令需要用 `root` 账户运行,或者使用 `sudo`。 +## 使用辅助脚本卸载 VPN -## 步骤 +**重要:** 此脚本将从你的服务器中删除 IPsec VPN。所有的 VPN 配置将被 **永久删除**,并且 Libreswan 和 xl2tpd 将被移除。此操作 **不可撤销**! + +```bash +wget https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras/vpnuninstall.sh -O vpnunst.sh +sudo bash vpnunst.sh +``` + +在完成后重启你的服务器。 + +## 手动卸载 VPN + +另外,你也可以手动卸载 VPN。按照以下步骤操作。这些命令需要用 `root` 账户运行,或者使用 `sudo`。 + +### 步骤 * [第一步](#第一步) * [第二步](#第二步) @@ -13,7 +26,7 @@ * [可选步骤](#可选步骤) * [完成后](#完成后) -## 第一步 +### 第一步 ```bash service ipsec stop @@ -23,34 +36,34 @@ rm -f /etc/init/ipsec.conf /lib/systemd/system/ipsec.service \ /etc/init.d/ipsec /usr/lib/systemd/system/ipsec.service ``` -## 第二步 +### 第二步 -### Ubuntu & Debian +#### Ubuntu & Debian `apt-get purge xl2tpd` -### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 +#### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 `yum remove xl2tpd` -## 第三步 +### 第三步 -### Ubuntu & Debian +#### Ubuntu & Debian 编辑 `/etc/iptables.rules` 并删除不需要的规则。你之前的防火墙规则(如果有)备份在 `/etc/iptables.rules.old-日期-时间`。另外如果文件 `/etc/iptables/rules.v4` 存在,请编辑它。 -### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 +#### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 编辑 `/etc/sysconfig/iptables` 并删除不需要的规则。你之前的防火墙规则(如果有)备份在 `/etc/sysconfig/iptables.old-日期-时间`。 **注:** 如果使用 Rocky Linux, AlmaLinux 或者 CentOS/RHEL 8 并且在安装 VPN 时 firewalld 正在运行,则可能已配置 nftables。编辑 `/etc/sysconfig/nftables.conf` 并删除不需要的规则。你之前的防火墙规则备份在 `/etc/sysconfig/nftables.conf.old-日期-时间`。 -## 第四步 +### 第四步 编辑 `/etc/sysctl.conf` 并删除该标记后面的行: `# Added by hwdsl2 VPN script`。 编辑 `/etc/rc.local` 并删除该标记后面的行: `# Added by hwdsl2 VPN script`。\*不要\* 删除 `exit 0` (如果有)。 -## 可选步骤 +### 可选步骤 **注:** 这一步是可选的。 @@ -74,7 +87,7 @@ rm -f /etc/ipsec.conf* /etc/ipsec.secrets* /etc/ppp/chap-secrets* /etc/ppp/optio rm -rf /etc/ipsec.d /etc/xl2tpd ``` -## 完成后 +### 完成后 重启你的服务器。 diff --git a/docs/uninstall.md b/docs/uninstall.md index b6e83f4..fc56eda 100644 --- a/docs/uninstall.md +++ b/docs/uninstall.md @@ -2,9 +2,22 @@ *Read this in other languages: [English](uninstall.md), [简体中文](uninstall-zh.md).* -Follow these steps to remove the VPN. Commands must be run as `root`, or with `sudo`. +## Uninstall using helper script -## Steps +**Important:** This script will remove IPsec VPN from your server. All VPN configuration will be **permanently deleted**, and Libreswan and xl2tpd will be removed. This **cannot** be undone! + +```bash +wget https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras/vpnuninstall.sh -O vpnunst.sh +sudo bash vpnunst.sh +``` + +When finished, reboot your server. + +## Manually uninstall the VPN + +Alternatively, you may manually uninstall the VPN by following these steps. Commands must be run as `root`, or with `sudo`. + +### Steps * [First step](#first-step) * [Second step](#second-step) @@ -13,7 +26,7 @@ Follow these steps to remove the VPN. Commands must be run as `root`, or with `s * [Optional](#optional) * [When finished](#when-finished) -## First step +### First step ```bash service ipsec stop @@ -23,34 +36,34 @@ rm -f /etc/init/ipsec.conf /lib/systemd/system/ipsec.service \ /etc/init.d/ipsec /usr/lib/systemd/system/ipsec.service ``` -## Second step +### Second step -### Ubuntu & Debian +#### Ubuntu & Debian `apt-get purge xl2tpd` -### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 +#### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 `yum remove xl2tpd` -## Third step +### Third step -### Ubuntu & Debian +#### Ubuntu & Debian Edit `/etc/iptables.rules` and remove unneeded rules. Your original rules (if any) are backed up as `/etc/iptables.rules.old-date-time`. In addition, edit `/etc/iptables/rules.v4` if the file exists. -### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 +#### CentOS/RHEL, Rocky Linux, AlmaLinux & Amazon Linux 2 Edit `/etc/sysconfig/iptables` and remove unneeded rules. Your original rules (if any) are backed up as `/etc/sysconfig/iptables.old-date-time`. **Note:** If using Rocky Linux, AlmaLinux or CentOS/RHEL 8 and firewalld was active during VPN setup, nftables may be configured. Edit `/etc/sysconfig/nftables.conf` and remove unneeded rules. Your original rules are backed up as `/etc/sysconfig/nftables.conf.old-date-time`. -## Fourth step +### Fourth step Edit `/etc/sysctl.conf` and remove the lines after `# Added by hwdsl2 VPN script`. Edit `/etc/rc.local` and remove the lines after `# Added by hwdsl2 VPN script`. DO NOT remove `exit 0` (if any). -## Optional +### Optional **Note:** This step is optional. @@ -74,7 +87,7 @@ rm -f /etc/ipsec.conf* /etc/ipsec.secrets* /etc/ppp/chap-secrets* /etc/ppp/optio rm -rf /etc/ipsec.d /etc/xl2tpd ``` -## When finished +### When finished Reboot your server.