This project is a bash script that aims to setup a AmneziaWG VPN on a Linux server, as easily as possible!
Supported distributions:
- AlmaLinux >= 9
- Debian >= 11
- Rocky Linux >= 9
- Ubuntu >= 22.04
others can work but not tested
2Gb of free space is required for temporary files.
Before installation it is strictly recommended to upgrade your system to the latest available version and perform the reboot afterwards.
Use curl or wget to download the script:
curl -O https://raw.githubusercontent.com/Varckin/amneziawg-install/main/amneziawg-install.sh
wget https://raw.githubusercontent.com/Varckin/amneziawg-install/main/amneziawg-install.sh
Set permissions:
chmod +x amneziawg-install.sh
And execute:
./amneziawg-install.sh
Answer the questions asked by the script and it will take care of the rest.
It will install AmneziaWG (kernel module and tools) on the server, configure it, create a systemd service and a client configuration file.
Run the script again to add or remove clients!
If you encounter an error during the installation of AWG from the repository, you need to build it manually.
Follow these steps:
- Perform a clean installation:
./amneziawg-install.sh
Select option 4
: "Uninstall AmneziaWG"
- Review Required Repositories Check the following repositories:
- Download Your Kernel Source Code a) Check your kernel version:
uname -r
b) Search for the correct version of the kernel source:
sudo apt-cache search linux-source
c) Install the source code:
sudo apt install linux-source-<version>
d) Verify where the source code is saved:
dpkg -L linux-source-<version>
Usually, it will be located at:
/usr/src/linux-source-<version>.tar.xz
- Build and Install the AmneziaWG Kernel Module and Tools Execute the following steps:
- Replace
<version>
with the actual kernel version or package name. - Ensure all prerequisites (e.g.,
build-essential
,gcc
) are installed before building the module.
# Create a working directory
mkdir amnezia-build
cd amnezia-build
# Clone required repositories
git clone https://github.com/amnezia-vpn/amneziawg-linux-kernel-module.git
git clone https://github.com/amnezia-vpn/amneziawg-tools.git
# Prepare and extract kernel source
mkdir linux-source
tar xf /usr/src/linux-source-<version>.tar.xz -C linux-source
# Link kernel source to the AmneziaWG module
ln -s linux-source amneziawg-linux-kernel-module/src/kernel
# Build and install the kernel module
cd amneziawg-linux-kernel-module/src
make
sudo make install
# Build and install the AmneziaWG tools
cd ../../amneziawg-tools/src
make
sudo make install
# Return to the main directory
cd ../../
- Retry Installation After completing the above steps, you can attempt to run the installation script again:
./amneziawg-install.sh