Skip to content

Install

Installing takes a few minutes: you paste one line into a terminal on your server and answer two questions. First check Requirements.

Use the IP address and user name your provider gave you:

Terminal window
ssh root@YOUR_SERVER_IP

Replace root with your own user name if the provider gave you another. The commands below start with sudo, which means “run this as the administrator”. If you are logged in as root, you can leave sudo out.

Copy the whole line, paste it and press Enter:

Terminal window
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/aftabIR/aftabWG/main/install.sh)"

The installer asks two things:

  1. The licence. Read it and type yes. If you do not, nothing is installed.
  2. HTTPS, a padlock for the panel. Choose a domain that points to this server, this server’s IP address, or not now. With no domain, choose the IP address. HTTPS explains each choice.

If you will choose a domain or the IP address, open TCP port 80 in your provider’s firewall before you paste the line: Let’s Encrypt checks the server at the end of the install. With that port closed HTTPS is not set up, and the panel runs over plain HTTP until you add it (see HTTPS).

It then downloads the right version for your server, checks its signature, and keeps away from ports and subnets that are already in use, such as an existing WireGuard, OpenVPN or Docker. Nothing is compiled on your server.

At the end the installer shows the panel address, with a random port and a secret path, and a random username and password. Save the password now: it is not shown again. If you lose it, sudo aftab reset-admin makes a new one, and sudo aftab info shows the address and username again.

The installer also made a default inbound and a client named default. First sign-in uses them.

For automation, put variables before bash:

  • AFTAB_ACCEPT_EULA=1 accepts the licence when nobody is typing.
  • AFTAB_USERNAME and AFTAB_PASSWORD set the sign-in.
  • AFTAB_PORT and AFTAB_PATH set the panel’s port and secret path.
  • AFTAB_WG_PORT sets the UDP port of the VPN.
  • AFTAB_PUBLIC_HOST sets the address put in client configs.
  • AFTAB_BRAND sets the brand name.
  • AFTAB_VERSION installs a particular version.
  • AFTAB_RESULT writes the result to a file that only root can read.
  • AFTAB_SSL=ip, AFTAB_SSL=domain or AFTAB_SSL=none answers the HTTPS question. AFTAB_DOMAIN is the domain for AFTAB_SSL=domain, and the address put in client configs when AFTAB_PUBLIC_HOST is not set.
  • By default the installer also installs Tor, AmneziaWG, and the pinned components the panel may need (wstunnel, hev-socks5-tunnel, amneziawg-go, psiphon-tunnel-core when this CPU has a build). Set AFTAB_SMALL=1 to skip them; add them later with sudo aftab extras install. Offline installs that cannot reach GitHub should use AFTAB_SMALL=1, then aftab component add or aftab extras install when a mirror is available. AFTAB_AWG=1 is obsolete (full install already runs AmneziaWG).

Nobody can answer the HTTPS question in a script, so without a terminal the installer skips HTTPS and prints No terminal: HTTPS skipped, unless you give AFTAB_SSL or AFTAB_DOMAIN, or an AFTAB_PUBLIC_HOST that is a domain name. Add HTTPS later with sudo aftab ssl: see HTTPS.

A password given this way stays in your shell history and shows in the process list while the installer runs. Leave AFTAB_PASSWORD out and the installer makes a random one.

Terminal window
sudo AFTAB_ACCEPT_EULA=1 AFTAB_PORT=2053 AFTAB_PATH=/secret/ \
bash -c "$(curl -fsSL https://raw.githubusercontent.com/aftabIR/aftabWG/main/install.sh)"

On another computer, download these files from the project’s Releases page:

  • install.sh
  • aftab-X.Y.Z-linux-amd64.tar.gz, or the -arm64 or -armv7 file that matches the server
  • SHA256SUMS and SHA256SUMS.minisig

Put them in one folder on the server and run:

Terminal window
sudo AFTAB_SOURCE=/root/aftab-X.Y.Z-linux-amd64.tar.gz bash install.sh

Or set AFTAB_MIRROR to an https:// mirror of the download address.

  • “this kernel cannot create WireGuard interfaces”. The server is an OpenVZ or LXC container. Rent a KVM or Xen server with Linux 5.6 or newer.
  • “unsupported distribution”. Use one of the systems in the table on the Requirements page.
  • A line that ends “Fix: …, then run this installer again”. The panel runs as its own user, never as root, and this server cannot run it that way yet: it uses iptables-legacy, the panel’s users or setpriv are missing, or aftab-panel cannot read a certificate the settings name. The installer stopped before it changed anything. Do what the line says after Fix:, then run the installer again. For a certificate it gives two ways: let the panel’s user read it, if it is this panel’s own certificate, or clear the setting.
  • The server is in Iran. The installer notices, recommends a server abroad with a bridge here, and stops if you answer n.
  • “the panel failed to start”. Read the log with sudo aftab log, or its last lines with journalctl -u aftab -n 50.