Skip to content

A comprehensive bash script that automatically installs and configures WireGuard-UI on various Linux distributions with just one command.

License

Notifications You must be signed in to change notification settings

itsredbull/wireguard-ui-installer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WireGuard-UI Auto Installation Script

License: MIT Shell Script WireGuard

A comprehensive bash script that automatically installs and configures WireGuard-UI on various Linux distributions with just one command.

πŸš€ Features

  • Multi-Distribution Support: Works on Ubuntu, Debian, CentOS, RHEL, Fedora, Arch Linux, openSUSE, and Alpine Linux
  • Two Installation Methods:
    • Docker installation (recommended)
    • Build from source
  • Automatic Service Management: Sets up systemd/OpenRC services with auto-restart functionality
  • Firewall Configuration: Automatically configures UFW or Firewalld
  • IP Forwarding: Enables kernel IP forwarding for VPN routing
  • Web Interface: Easy-to-use web UI for managing WireGuard configurations
  • Auto-Restart: Automatically restarts WireGuard when configuration changes
  • Comprehensive Logging: All installation steps logged to /WireGuardInstall.log

πŸ“‹ Requirements

  • Linux server with root access
  • Internet connection
  • Supported Linux distributions:
    • Ubuntu/Debian (apt)
    • CentOS/RHEL/Fedora (yum/dnf)
    • Arch Linux (pacman)
    • openSUSE (zypper)
    • Alpine Linux (apk)

πŸ›‘οΈ Recommended VPS Provider

For reliable VPS hosting, we recommend myhbd.net - offering servers in multiple locations worldwide with one-click deployment options. Perfect for setting up your WireGuard VPN server!

Why myhbd.net?

  • βœ… Multiple server locations globally
  • βœ… One-click server deployment
  • βœ… Competitive pricing
  • βœ… High-performance SSD storage
  • βœ… 24/7 technical support

⚑ Quick Installation

Run this single command as root to install WireGuard-UI:

curl -fsSL https://raw.githubusercontent.com/itsredbull/wireguard-ui-installer/main/install.sh | bash

Or download and run manually:

wget https://raw.githubusercontent.com/itsredbull/wireguard-ui-installer/main/install.sh
chmod +x install.sh
sudo ./install.sh

πŸ”§ Installation Process

The script will:

  1. Detect your OS and package manager
  2. Install dependencies (WireGuard, curl, wget, git, etc.)
  3. Enable IP forwarding for VPN routing
  4. Prompt for installation method:
    • Option 1: Docker installation (recommended)
    • Option 2: Build from source
  5. Configure services for auto-start and auto-restart
  6. Set up firewall rules (ports 51820/udp and 5000/tcp)
  7. Create initial WireGuard configuration
  8. Start all services

🌐 Accessing the Web Interface

After successful installation:

Access URL: http://YOUR-SERVER-IP:5000

Default Credentials:

  • Username: admin
  • Password: admin

⚠️ IMPORTANT: Change the default password immediately after first login!

πŸ“ File Locations

  • Configuration: /etc/wireguard/wg0.conf
  • Web UI Files: /opt/wireguard-ui/ (source install) or Docker container
  • Docker Compose: /etc/wireguard-ui/docker-compose.yml (Docker install)
  • Installation Log: /WireGuardInstall.log
  • Service Files: /etc/systemd/system/wireguard-ui.service

πŸ”„ Service Management

Docker Installation

# Start
docker compose -f /etc/wireguard-ui/docker-compose.yml up -d

# Stop
docker compose -f /etc/wireguard-ui/docker-compose.yml down

# View logs
docker logs wireguard-ui

Source Installation (systemd)

# Start/Stop/Status
sudo systemctl start wireguard-ui
sudo systemctl stop wireguard-ui
sudo systemctl status wireguard-ui

# Enable/Disable auto-start
sudo systemctl enable wireguard-ui
sudo systemctl disable wireguard-ui

Source Installation (OpenRC - Alpine Linux)

# Start/Stop/Status
sudo rc-service wireguard-ui start
sudo rc-service wireguard-ui stop
sudo rc-service wireguard-ui status

πŸ”₯ Firewall Ports

The script automatically opens these ports:

  • 51820/udp: WireGuard VPN traffic
  • 5000/tcp: Web UI access

πŸ› οΈ Manual Configuration

Environment Variables (Source Install)

Edit /etc/systemd/system/wireguard-ui.service:

Environment=WGUI_SERVER_INTERFACE_ADDRESSES=10.252.1.0/24
Environment=WGUI_SERVER_LISTEN_PORT=51820
Environment=WGUI_CONFIG_FILE_PATH=/etc/wireguard/wg0.conf

Docker Environment Variables

Edit /etc/wireguard-ui/docker-compose.yml:

environment:
  - BIND_ADDRESS=0.0.0.0:5000
  - WGUI_USERNAME=admin
  - WGUI_PASSWORD=admin
  - WGUI_CONFIG_FILE_PATH=/etc/wireguard/wg0.conf

πŸ“Š Monitoring and Logs

  • Installation Log: tail -f /WireGuardInstall.log
  • Service Logs (systemd): journalctl -u wireguard-ui -f
  • Docker Logs: docker logs -f wireguard-ui
  • WireGuard Status: sudo wg show

πŸ”§ Troubleshooting

Common Issues

  1. Port 5000 already in use

    sudo netstat -tlnp | grep :5000
    sudo kill -9 <PID>
  2. WireGuard interface not starting

    sudo wg-quick up wg0
    sudo systemctl status wg-quick@wg0
  3. Web UI not accessible

    • Check if service is running: sudo systemctl status wireguard-ui
    • Verify firewall: sudo ufw status or sudo firewall-cmd --list-ports
    • Check logs: journalctl -u wireguard-ui
  4. Permission issues

    sudo chown -R root:root /etc/wireguard/
    sudo chmod 600 /etc/wireguard/wg0.conf

πŸ”„ Uninstallation

Docker Installation

docker compose -f /etc/wireguard-ui/docker-compose.yml down
docker rmi ngoduykhanh/wireguard-ui:latest
sudo rm -rf /etc/wireguard-ui

Source Installation

sudo systemctl stop wireguard-ui
sudo systemctl disable wireguard-ui
sudo rm /etc/systemd/system/wireguard-ui.service
sudo rm -rf /opt/wireguard-ui
sudo systemctl daemon-reload

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

If you encounter any issues:

  1. Check the installation log: /WireGuardInstall.log
  2. Review the troubleshooting section above
  3. Open an issue on GitHub with detailed error information

⭐ If this script helped you, please consider giving it a star!

About

A comprehensive bash script that automatically installs and configures WireGuard-UI on various Linux distributions with just one command.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages