Skip to content

Installation

Shishkevich D. edited this page May 30, 2025 · 9 revisions

Install in one-line (recommended)

  1. Install the necessary tools to run the script: curl (if needed)
  2. Open shell and enter this command
$ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
  1. Go through the panel setup
  2. Once configured, go to http://<your-ip>:<your-port> and log in with the credentials that were issued by the panel after installation

Docker (recommended)

  1. Before installing Docker, install the following tools using your package manager: curl, nano (if necessary)

  2. Install Docker using the official script

$ bash <(curl -sSL https://get.docker.com)

Using Docker Compose

  1. Create a panel folder and go to this folder
$ mkdir panel
$ cd panel
  1. Create and edit the compose.yml file using nano or another editor. Insert the following contents into the file:

compose.yml

services:
  panel:
    image: ghcr.io/mhsanaei/3x-ui:latest
    container_name: 3xui_app
    volumes:
      - ~/panel/db/:/etc/x-ui/
      - ~/panel/cert/:/root/cert/
    environment:
      XRAY_VMESS_AEAD_FORCED: "false"
      XUI_ENABLE_FAIL2BAN: "true"
    tty: true
    network_mode: host
    restart: unless-stopped
  1. Start the Docker container using the following command.
$ docker compose up -d
  1. Open url http://<your-ip>:2053 and log in to the panel. The credentials are as follows:
  • 👤 Username: admin
  • 🔑 Password: admin

Caution

After logging in, immediately change the administrator credentials in the panel settings (Panel Settings > Authentication)

Tip

It is also recommended to set up two-factor authentication and set up another panel web path for complete security

Update

If an update is needed, disable the container and push the new version of the image with the following commands

$ docker compose down
$ docker compose pull
$ docker compose up -d

Delete

If you want to delete a container, execute the following commands

$ docker compose down
$ docker system prune -a
$ rm panel -rf

Using CLI

  1. Execute the following command
$ docker run -itd \
   -e XRAY_VMESS_AEAD_FORCED=false \
   -e XUI_ENABLE_FAIL2BAN=true \
   -v $PWD/db/:/etc/x-ui/ \
   -v $PWD/cert/:/root/cert/ \
   --network=host \
   --restart=unless-stopped \
   --name 3x-ui \
   ghcr.io/mhsanaei/3x-ui:latest

Update

If an update is needed, disable the container and push the new version of the image with the following commands

$ docker ps -a

With this command, we find out the ID of the container on which the panel is running. Next, we stop our container and pull down the image:

$ docker container stop <container_id>
$ docker image pull ghcr.io/mhsanaei/3x-ui

After that, we execute the command from step 3.

Delete

If you want to delete a container, execute the following commands

$ docker container stop <container_id>
$ docker system prune -a
$ rm 3x-ui -rf

Install another version

Caution

This method is not recommended. Always use the latest version.

  1. Install the necessary tools to run the script: curl (if needed)

  2. Open shell and enter this command

$ VERSION=v2.5.5 && bash <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/$VERSION/install.sh") $VERSION

The required version is specified in the VERSION variable, e.g. v2.5.5.

  1. Go through the panel setup

Manual installation

To download the latest version of the compressed package directly to your server, run the following command:

ARCH=$(uname -m)
case "${ARCH}" in
  x86_64 | x64 | amd64) XUI_ARCH="amd64" ;;
  i*86 | x86) XUI_ARCH="386" ;;
  armv8* | armv8 | arm64 | aarch64) XUI_ARCH="arm64" ;;
  armv7* | armv7) XUI_ARCH="armv7" ;;
  armv6* | armv6) XUI_ARCH="armv6" ;;
  armv5* | armv5) XUI_ARCH="armv5" ;;
  s390x) echo 's390x' ;;
  *) XUI_ARCH="amd64" ;;
esac

wget https://github.com/MHSanaei/3x-ui/releases/latest/download/x-ui-linux-${XUI_ARCH}.tar.gz

Once the compressed package is downloaded, execute the following commands to install or upgrade x-ui

ARCH=$(uname -m)
case "${ARCH}" in
  x86_64 | x64 | amd64) XUI_ARCH="amd64" ;;
  i*86 | x86) XUI_ARCH="386" ;;
  armv8* | armv8 | arm64 | aarch64) XUI_ARCH="arm64" ;;
  armv7* | armv7) XUI_ARCH="armv7" ;;
  armv6* | armv6) XUI_ARCH="armv6" ;;
  armv5* | armv5) XUI_ARCH="armv5" ;;
  s390x) echo 's390x' ;;
  *) XUI_ARCH="amd64" ;;
esac

cd /root/
rm -rf x-ui/ /usr/local/x-ui/ /usr/bin/x-ui
tar zxvf x-ui-linux-${XUI_ARCH}.tar.gz
chmod +x x-ui/x-ui x-ui/bin/xray-linux-* x-ui/x-ui.sh
cp x-ui/x-ui.sh /usr/bin/x-ui
cp -f x-ui/x-ui.service /etc/systemd/system/
mv x-ui/ /usr/local/
systemctl daemon-reload
systemctl enable x-ui
systemctl restart x-ui