How to install Marzban on a VPS

Marzban (Persian for "border guard") is a modern proxy management system based on Xray-core with a user-friendly web interface. It's suitable for deploying V2Ray proxies with multiple users, flexible traffic and time limits.

Marzban's capabilities

  • Web interface using React
  • REST API backend
  • Scalability with multiple nodes
  • Protocol support: VLESS, VMess, Trojan, Shadowsocks
  • Traffic and expiration limits
  • Subscription links for V2RayNG, Clash, Nekoray, and others
  • Automatic generation of links and QR codes
  • Load and traffic monitoring
  • TLS and REALITY support
  • Built-in Telegram bot and CLI
  • Multilingual interface, support for multiple administrators (in progress)

Preparation

Before installation, make sure you are connected to the server via SSH.

If you don't know how to do this, use our instructions: How to connect to a server via SSH .

Installing Marzban

Run one of the commands depending on the database you need:

With SQLite (default):

sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install Code language:  JavaScript  ( javascript )

With MySQL:

sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysql Code language:  JavaScript  ( javascript )

With MariaDB:

sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mariadb Code language:  JavaScript  ( javascript )

What happens after installation?

  • The panel files will be located in /opt/marzban
  • Configuration is in /opt/marzban/.env
  • Data and certificate files are in /var/lib/marzban
  • Logs will appear in the terminal - you can stop them with Ctrl+C

How to access the panel

By default, Marzban does not work by IP - access is only possible through a domain with an SSL certificate.

  • Example address: https://yourdomain.com:8000/dashboard/
  • Replace yourdomain.com with your actual domain.
  • Make sure port 8000 is open in your firewall.

If you don't have a domain, you can temporarily use an SSH tunnel:

ssh  -L 8000 :localhost :8000  user @your-server-ip Code language:  CSS  ( css )

After that, open http://localhost:8000/dashboard/ . Access will work as long as the SSH session is open.

Creating an administrator

After installation, create a user with administrator rights:

sudo marzban cli admin create --sudo

After this, you can log in to the panel using your login and password.

Additionally

  • Command help: marzban --help
  • Restart the panel: sudo marzban restart
  • Configuration change: nano /opt/marzban/.env

You can also specify HTTPS settings and configure the panel to listen on the standard port 443 by changing the variables in .env :

UVICORN_SSL_CERTFILE= "/var/lib/marzban/certs/fullchain.pem" UVICORN_SSL_KEYFILE= "/var/lib/marzban/certs/key.pem" UVICORN_PORT= 443 Code language:  JavaScript  ( javascript )