mirror of
https://github.com/angristan/wireguard-install.git
synced 2024-11-23 21:46:02 +03:00
Fix support for CentOS, Rocky and AlmaLinux
Fix https://github.com/angristan/wireguard-install/pull/253 Fix https://github.com/angristan/wireguard-install/issues/374 Fix https://github.com/angristan/wireguard-install/issues/231
This commit is contained in:
parent
258eb9441b
commit
5b483ecb89
11
README.md
11
README.md
@ -17,13 +17,14 @@ WireGuard does not fit your environment? Check out [openvpn-install](https://git
|
|||||||
|
|
||||||
Supported distributions:
|
Supported distributions:
|
||||||
|
|
||||||
- Ubuntu >= 16.04
|
- AlmaLinux >= 8
|
||||||
- Debian >= 10
|
|
||||||
- Fedora
|
|
||||||
- CentOS
|
|
||||||
- AlmaLinux
|
|
||||||
- Arch Linux
|
- Arch Linux
|
||||||
|
- CentOS Stream >= 8
|
||||||
|
- Debian >= 10
|
||||||
|
- Fedora >= 32
|
||||||
- Oracle Linux
|
- Oracle Linux
|
||||||
|
- Rocky Linux >= 8
|
||||||
|
- Ubuntu >= 18.04
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -31,26 +31,24 @@ function checkVirt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkOS() {
|
function checkOS() {
|
||||||
# Check OS version
|
source /etc/os-release
|
||||||
if [[ -e /etc/debian_version ]]; then
|
OS="${ID}"
|
||||||
source /etc/os-release
|
if [[ ${OS} == "debian" || ${OS} == "raspbian" ]]; then
|
||||||
OS="${ID}" # debian or ubuntu
|
if [[ ${VERSION_ID} -lt 10 ]]; then
|
||||||
if [[ ${ID} == "debian" || ${ID} == "raspbian" ]]; then
|
echo "Your version of Debian (${VERSION_ID}) is not supported. Please use Debian 10 Buster or later"
|
||||||
if [[ ${VERSION_ID} -lt 10 ]]; then
|
exit 1
|
||||||
echo "Your version of Debian (${VERSION_ID}) is not supported. Please use Debian 10 Buster or later"
|
fi
|
||||||
exit 1
|
OS=debian # overwrite if raspbian
|
||||||
fi
|
elif [[ ${OS} == "fedora" ]]; then
|
||||||
OS=debian # overwrite if raspbian
|
if [[ ${VERSION_ID} -lt 32 ]]; then
|
||||||
|
echo "Your version of Fedora (${VERSION_ID}) is not supported. Please use Fedora 32 or later"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [[ ${OS} == 'centos' ]] || [[ ${OS} == 'almalinux' ]] || [[ ${OS} == 'rocky' ]]; then
|
||||||
|
if [[ ${VERSION_ID} == 7* ]]; then
|
||||||
|
echo "Your version of CentOS (${VERSION_ID}) is not supported. Please use CentOS 8 or later"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [[ -e /etc/almalinux-release ]]; then
|
|
||||||
source /etc/os-release
|
|
||||||
OS=almalinux
|
|
||||||
elif [[ -e /etc/fedora-release ]]; then
|
|
||||||
source /etc/os-release
|
|
||||||
OS="${ID}"
|
|
||||||
elif [[ -e /etc/centos-release ]]; then
|
|
||||||
source /etc/os-release
|
|
||||||
OS=centos
|
|
||||||
elif [[ -e /etc/oracle-release ]]; then
|
elif [[ -e /etc/oracle-release ]]; then
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
OS=oracle
|
OS=oracle
|
||||||
@ -176,18 +174,13 @@ function installWireGuard() {
|
|||||||
dnf install -y wireguard-dkms
|
dnf install -y wireguard-dkms
|
||||||
fi
|
fi
|
||||||
dnf install -y wireguard-tools iptables qrencode
|
dnf install -y wireguard-tools iptables qrencode
|
||||||
elif [[ ${OS} == 'almalinux' ]]; then
|
elif [[ ${OS} == 'centos' ]] || [[ ${OS} == 'almalinux' ]] || [[ ${OS} == 'rocky' ]]; then
|
||||||
dnf -y install epel-release elrepo-release
|
|
||||||
dnf -y install wireguard-tools iptables qrencode
|
|
||||||
if [[ ${VERSION_ID} == 8* ]]; then
|
if [[ ${VERSION_ID} == 8* ]]; then
|
||||||
dnf -y install kmod-wireguard
|
yum install -y epel-release elrepo-release
|
||||||
|
yum install -y kmod-wireguard
|
||||||
|
yum install -y qrencode # not available on release 9
|
||||||
fi
|
fi
|
||||||
elif [[ ${OS} == 'centos' ]]; then
|
yum install -y wireguard-tools iptables
|
||||||
yum -y install epel-release elrepo-release
|
|
||||||
if [[ ${VERSION_ID} -eq 7 ]]; then
|
|
||||||
yum -y install yum-plugin-elrepo
|
|
||||||
fi
|
|
||||||
yum -y install kmod-wireguard wireguard-tools iptables qrencode
|
|
||||||
elif [[ ${OS} == 'oracle' ]]; then
|
elif [[ ${OS} == 'oracle' ]]; then
|
||||||
dnf install -y oraclelinux-developer-release-el8
|
dnf install -y oraclelinux-developer-release-el8
|
||||||
dnf config-manager --disable -y ol8_developer
|
dnf config-manager --disable -y ol8_developer
|
||||||
@ -354,9 +347,11 @@ AllowedIPs = ${CLIENT_WG_IPV4}/32,${CLIENT_WG_IPV6}/128" >>"/etc/wireguard/${SER
|
|||||||
|
|
||||||
wg syncconf "${SERVER_WG_NIC}" <(wg-quick strip "${SERVER_WG_NIC}")
|
wg syncconf "${SERVER_WG_NIC}" <(wg-quick strip "${SERVER_WG_NIC}")
|
||||||
|
|
||||||
echo -e "\nHere is your client config file as a QR Code:"
|
# Generate QR code if qrencode is installed
|
||||||
|
if command -v qrencode &>/dev/null; then
|
||||||
qrencode -t ansiutf8 -l L <"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
|
echo -e "\nHere is your client config file as a QR Code:"
|
||||||
|
qrencode -t ansiutf8 -l L <"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "It is also available in ${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
|
echo "It is also available in ${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user