UbuntuUbuntu Based

How To Install 3X-UI VPN on Ubuntu 24.04 LTS

Install 3X-UI VPN on Ubuntu 24.04

In this tutorial, we will show you how to install 3X-UI VPN on Ubuntu 24.04 LTS. 3X-UI VPN offers a user-friendly and feature-rich web panel designed to simplify managing VPN protocols on Ubuntu 24.04. Organizations and individuals require secure connectivity, fast data transfer, and reliability when connecting to remote networks, and 3X-UI provides a versatile solution with support for VLESS, VMess, Shadowsocks, and Trojan protocols. With robust security features and an intuitive interface, this VPN panel unifies essential settings in one place, reducing complexity for both new and experienced administrators.

The following guide outlines a comprehensive step-by-step procedure to install, configure, and optimize 3X-UI VPN on Ubuntu 24.04. Learn to maintain best practices, address potential installation issues, and deploy a multi-protocol service that streamlines traffic management. This tutorial also explores optimizing firewall configurations, applying SSL certificates, and managing users securely and efficiently. The power of 3X-UI VPN lies in its flexibility, allowing administrators to tailor configurations for their specific requirements while maximizing performance and safeguarding data.

Prerequisites

System Requirements
Ensure you have a clean installation of Ubuntu 24.04 LTS with at least 1 GB of RAM and a modest CPU. A virtual private server or a dedicated physical server works fine. The system should be accessible using root or sudo privileges to install packages and modify configurations. A stable internet connection is essential.

While 3X-UI VPN can function without a domain name, using a registered domain and an SSL certificate improves both security and accessibility. Additionally, ensure you have adequate storage space (at least 10 GB) to handle logs and potential updates over time.

Basic Command Line Knowledge
Navigating directories, editing files, and running scripts using the Linux command line are critical skills for a successful installation process. Becoming familiar with common tools like nano or vi for text editing can streamline the configuration steps and troubleshooting.

Confirm that neither conflicting VPN software nor overlapping ports are in use. Having a fresh environment helps avoid unintended compatibility issues. If necessary, remove or disable existing services that might conflict with port assignments.

Pre-Installation Setup

System Updates
Keeping the operating system current ensures stability and security. Start by updating package lists and upgrading installed packages:

sudo apt-get update
sudo apt-get upgrade -y

This step applies the latest patches, improves overall performance, and sets a reliable foundation for the 3X-UI VPN installation. It also helps mitigate potential security risks.

Installing Essential Dependencies
Before downloading any scripts, check for crucial software libraries:

sudo apt-get install -y curl wget vim net-tools ufw

Curl and Wget enable downloading external scripts, whereas net-tools provides useful networking commands like netstat for monitoring system ports.

Security Preparations
Consider ensuring that ports 80 and 443 are open if you plan on using HTTPS. Adjust your firewall to allow essential inbound and outbound connections:

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

These rules accommodate SSH, web traffic, and future SSL-based VPN protocols. If you have a custom domain name, configure the DNS records (A or CNAME) to point to your server’s IP address. Acquiring an SSL certificate in advance, whether from Let’s Encrypt or another certificate authority, enhances encryption and user trust.

Installation Process

Downloading and Running the Installation Script
3X-UI VPN typically provides an official script that automates much of the installation. In most cases, the command looks like the following (the actual URL may differ as versions are updated):

bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)

Before running any external script, review it to confirm authenticity. This practice prevents malicious code from compromising your system. If you trust the source, running the command will trigger the automated installation sequence. During this phase, the script might prompt for user input, such as default ports or directories.

Script Verification
It is good practice to verify the script’s hash or signature. Typically, the developer provides a checksum file. Confirm the downloaded script’s integrity with:

sha256sum install.sh

Compare the output with the signature on the official repository. If both match, proceed. Otherwise, halt the installation and investigate possible issues.

Initial Configuration
During installation, the script may request several default configuration parameters to tailor the 3X-UI Panel:

  • Panel Port Selection: The default port is often 54321 or similar. Confirm it’s open in the server firewall.
  • Username Setup: Choose a unique admin username for accessing the 3X-UI dashboard.
  • Password Configuration: Secure the panel with a robust password. Use a combination of uppercase, lowercase, numbers, and symbols.
  • Web Path Configuration: Decide if you plan to run 3X-UI under a particular endpoint path (e.g., /admin) through a reverse proxy.

Once these details are entered, the script proceeds to complete installation, pull necessary dependencies, and prepare the environment. The final output typically includes a message indicating successful setup, along with instructions for accessing the 3X-UI Panel via a specific URL or IP/port combination.

The entire process can take anywhere from a few minutes to 20 minutes, depending on server speed, network conditions, and additional package installations. Avoid interrupting the installation or closing the SSH/terminal session prematurely.

Post-Installation Configuration

Security Hardening
Immediately securing your new setup is crucial. If using a domain, consider implementing an SSL certificate. Let’s Encrypt offers free certificates:

sudo apt-get install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com

Adjust your nginx configurations or your reverse proxy to route secure traffic to the 3X-UI panel. This extra layer of encryption protects user credentials and data from eavesdropping.

Change the default credentials provided by the installation script. A strong password reduces the likelihood of brute-force attacks. Also, confirm that the correct ports are open:

sudo ufw allow 54321/tcp
sudo ufw status

Adjusting Firewall Rules
Double-check existing firewall configurations to ensure no conflict with other services. If you plan to allow multiple VPN protocols through the same server, be mindful of overlapping port ranges or NAT rules. Where possible, segment traffic to specific ports.

Panel Settings
Access the 3X-UI web interface by navigating to http://your-server-ip:54321 (or a chosen port/domain). Log in with your admin credentials. From the dashboard, verify the basic settings:

  • General preferences
  • Service startup options
  • Backup or restore configuration files
  • Protocol-specific parameters

Install 3X-UI VPN on Ubuntu 24.04 LTS

Enabling features like traffic monitoring, bandwidth throttling, and simultaneous user connections fosters better insight into usage trends. These core functionalities are accessible in the main settings page of the 3X-UI panel.

Finally, consider auto-starting the 3X-UI service at system boot. Typically, the installation script handles this for you via a systemd service, but verify that systemctl status 3x-ui reports the service as active and running.

Setting Up VPN Protocols

VLESS with XTLS-Reality
VLESS is a lightweight and flexible protocol often paired with XTLS and Reality for improved encryption efficiency. After installing 3X-UI, select VLESS in the protocol list on the panel. Provide necessary configuration, including:

  • Server listening port
  • User ID (UUID)
  • Encryption methods
  • XTLS/Reality keys and certificate paths

This approach streamlines secure data transfers, often used by those who value high-speed, stealth connections.

VMess
VMess is another popular protocol offering security, speed, and adaptability. Configure it by selecting VMess in the 3X-UI panel. Common settings include:

  • Inbounds and outbounds definitions
  • UUID for each user
  • TLS or XTLS certificates
  • Advanced options (e.g., stream security, transport type)

This protocol suits various network environments due to its configurable transport modes.

Shadowsocks
Shadowsocks uses a robust encryption method to tunnel data, making it difficult to detect. Configure encryption cipher options such as AES-256-GCM or Chacha20-Poly1305. The 3X-UI panel allows customizing the password or passphrase and auto-binding to the correct port.

Trojan
Trojan masquerades VPN traffic as regular HTTPS traffic on port 443. Specify the domain name in the 3X-UI panel, the path to your SSL certificate, and a broad user password list if desired. Trojan is favored for bypassing particularly restrictive firewalls and deep packet inspections.

Each protocol offers distinct advantages. Test them to optimize performance under specific network conditions. The 3X-UI’s comprehensive support removes the hassle of heading to multiple configuration files, unifying them through a single management portal.

User Management

Adding and monitoring users within 3X-UI VPN is straightforward. Navigate to the user management page, create new accounts, and assign each user a unique identifier (such as a UUID) or a password for protocols like Shadowsocks and Trojan. Set expiration dates or data caps to manage bandwidth efficiently.

Whether deploying for a small team or a large user base, having individual accounts assists in monitoring usage. The 3X-UI panel displays real-time and historical traffic statistics, enabling quick response to suspicious activities or traffic spikes.

Troubleshooting

If installation hangs, check server logs to identify permission or port conflicts. Make sure the chosen port is not occupied by another service. When initial connections fail, verify firewall rules and domain name DNS settings. Use logs from the 3X-UI dashboard to detect misconfigurations or authentication issues.

Congratulations! You have successfully installed 3X-UI VPN. Thanks for using this tutorial for installing the 3X-UI VPN on your Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official 3X-UI website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button