Install V2Ray 4.44.0 on Ubuntu 24.04 with VMess and TLS
V2Ray is a network proxy platform that supports several communication protocols, including VMess, VLESS, and Shadowsocks. Its configurable inbound and outbound connections make it possible to build different proxy architectures for personal and server-side deployments.
This guide walks through installing V2Ray Core 4.44.0 on a fresh Ubuntu 24.04.5 LTS server with a 64-bit x86 processor. The example deployment uses VMess with TCP transport and TLS encryption. A domain name and a Let’s Encrypt certificate provide the server identity, while systemd manages the V2Ray process.
The guide also includes a Bash installer that automates most of the deployment.
One version-related warning before starting: V2Ray 4.44.0 is an older release. This tutorial keeps that version because it is the target of the supplied procedure; it should not be treated as a recommendation to deploy an outdated release on a new production system. Check the project’s current releases and security guidance before choosing a version for an internet-facing server.
🧭 Deployment Overview #
The example environment uses the following configuration:
| Component | Configuration |
|---|---|
| Operating system | Ubuntu 24.04.5 LTS |
| Architecture | x86_64 |
| V2Ray version | 4.44.0 |
| Protocol | VMess |
| Transport | TCP |
| Encryption | TLS |
| Listening port | TCP 443 |
| TLS certificate | Let’s Encrypt |
| Service manager | systemd |
| Firewall | UFW |
The server accepts connections from clients that have the correct VMess UUID. TLS protects the connection between the client and server, and the V2Ray freedom outbound forwards accepted traffic to its destination.
Network Architecture #
The connection flow is straightforward:
+---------------------------+
| V2Ray Client |
| |
| Protocol: VMess |
| Transport: TCP |
| Security: TLS |
+-------------+-------------+
|
| TCP / 443
|
==============|================ Internet
|
+-------------+-------------+
| Ubuntu Server |
| |
| Ubuntu 24.04.5 LTS |
| |
| +---------------------+ |
| | V2Ray 4.44.0 | |
| | | |
| | VMess Inbound | |
| | TLS Certificate | |
| +---------------------+ |
| |
| Outbound: Freedom |
+-------------+-------------+
|
v
InternetThe client connects to the server over TCP port 443. V2Ray verifies the client’s VMess credentials, terminates the TLS connection, and forwards the traffic through the configured outbound.
🛠️ Prepare the Ubuntu Server #
Start by updating the package index and upgrading installed packages:
sudo apt update
sudo apt upgrade -yInstall the utilities required by the following steps:
sudo apt install -y \
curl \
unzip \
ca-certificates \
certbotCheck the operating system release:
lsb_release -aConfirm that the server uses the expected CPU architecture:
uname -mThe result should be:
x86_64This guide uses the Linux 64-bit V2Ray release archive.
🌐 Configure the Domain Name #
A domain name pointing to the server’s public IPv4 address is required for the Let’s Encrypt certificate.
For this example, use:
vpn.example.comCreate an A record with your DNS provider:
| DNS field | Value |
|---|---|
| Type | A |
| Name | vpn |
| Value | YOUR_SERVER_PUBLIC_IP |
Replace YOUR_SERVER_PUBLIC_IP with the actual public IPv4 address of the VPS.
Allow time for the DNS record to propagate, then check its resolution:
dig +short vpn.example.comThe returned address should match the server’s public IPv4 address.
Both TCP ports 80 and 443 must be reachable from the internet:
- Port 80 is used by the Let’s Encrypt HTTP-01 challenge during certificate issuance and renewal.
- Port 443 carries the V2Ray client connections.
Check both the Ubuntu firewall and the firewall provided by your VPS host. Opening a port in UFW does not automatically change the provider’s external firewall rules.
If another service already occupies port 80, Certbot’s standalone mode will not be able to bind to it. Stop or reconfigure that service temporarily, or use another supported certificate validation method.
🔑 Generate a VMess UUID #
VMess uses a UUID to identify authorized clients. Generate a new one on the server:
cat /proc/sys/kernel/random/uuidThe result will look similar to:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxSave the generated value securely. The same UUID must be configured on the server and every client that is allowed to connect.
This deployment uses:
"alterId": 0With VMess AEAD authentication, alterId should be set to 0. The older nonzero alterId mechanism is not needed for this configuration.
📥 Download V2Ray Core 4.44.0 #
Download the specified release archive from the official V2Fly GitHub release:
cd /tmp
curl -fL -o v2ray-linux-64.zip \
https://github.com/v2fly/v2ray-core/releases/download/v4.44.0/v2ray-linux-64.zipExtract the archive:
unzip v2ray-linux-64.zip -d v2ray-4.44.0Inspect the extracted files:
ls -lh v2ray-4.44.0The archive should contain the V2Ray executable and its supporting files, including:
v2ray
v2ctl
geoip.dat
geosite.datBefore using a downloaded binary on a production server, verify the archive against the checksum or signature published by the project, where available. Downloading a file from an official release URL does not, by itself, verify that the file has not been altered.
📦 Install the V2Ray Files #
Create the installation directories:
sudo mkdir -p /usr/local/bin
sudo mkdir -p /usr/local/etc/v2ray
sudo mkdir -p /usr/local/share/v2rayInstall the V2Ray executable:
sudo install -m 755 \
/tmp/v2ray-4.44.0/v2ray \
/usr/local/bin/v2rayInstall the GeoIP database:
sudo install -m 644 \
/tmp/v2ray-4.44.0/geoip.dat \
/usr/local/share/v2ray/geoip.datInstall the GeoSite database:
sudo install -m 644 \
/tmp/v2ray-4.44.0/geosite.dat \
/usr/local/share/v2ray/geosite.datCheck the installed version:
/usr/local/bin/v2ray -versionThe output should identify V2Ray 4.44.0.
V2Ray 4.44.0🔐 Obtain a Let’s Encrypt TLS Certificate #
The server will use a Let’s Encrypt certificate to authenticate its domain name and establish TLS connections.
Make sure the domain resolves to the server and that TCP port 80 is reachable. Then request a certificate using Certbot’s standalone mode:
sudo certbot certonly \
--standalone \
--preferred-challenges http \
-d vpn.example.com \
--agree-tos \
--email admin@example.com \
--non-interactiveReplace the example domain and email address with your own values.
After successful validation, Certbot stores the certificate files under:
/etc/letsencrypt/live/vpn.example.com/fullchain.pem
/etc/letsencrypt/live/vpn.example.com/privkey.pemThe first file contains the certificate chain. The second contains the private key and must be protected.
Create a Dedicated V2Ray Service Account #
Rather than running V2Ray as root, create a dedicated system account:
sudo useradd \
--system \
--no-create-home \
--shell /usr/sbin/nologin \
v2rayCreate a directory for the certificate files:
sudo mkdir -p /etc/v2ray/tlsCopy the certificate chain with restricted permissions:
sudo install -o root -g v2ray -m 640 \
/etc/letsencrypt/live/vpn.example.com/fullchain.pem \
/etc/v2ray/tls/fullchain.pemCopy the private key in the same way:
sudo install -o root -g v2ray -m 640 \
/etc/letsencrypt/live/vpn.example.com/privkey.pem \
/etc/v2ray/tls/privkey.pemThe files are owned by root and readable by members of the v2ray group. The V2Ray service can access the TLS material without receiving unrestricted root privileges.
The directory containing the files should also be restricted. For example:
sudo chown root:v2ray /etc/v2ray/tls
sudo chmod 750 /etc/v2ray/tls⚙️ Configure the VMess Server #
Create the V2Ray configuration file:
sudo nano /usr/local/etc/v2ray/config.jsonInsert the following JSON configuration:
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"tag": "vmess-in",
"listen": "0.0.0.0",
"port": 443,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "YOUR-UUID-HERE",
"alterId": 0,
"email": "user@example.com"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"certificates": [
{
"certificateFile": "/etc/v2ray/tls/fullchain.pem",
"keyFile": "/etc/v2ray/tls/privkey.pem"
}
]
}
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "blocked",
"protocol": "blackhole",
"settings": {}
}
]
}Replace the following values:
YOUR-UUID-HEREwith the UUID generated earlier.user@example.comwith an identifier for the client.
Save the file, then restrict its permissions:
sudo chown root:v2ray \
/usr/local/etc/v2ray/config.json
sudo chmod 640 \
/usr/local/etc/v2ray/config.jsonUnderstand the Inbound Settings #
The inbound section defines how remote clients connect to the server.
| Parameter | Description |
|---|---|
listen |
Listens on all IPv4 interfaces |
port |
TCP port 443 |
protocol |
VMess |
id |
UUID identifying an authorized client |
alterId |
Set to 0 for VMess AEAD |
network |
TCP transport |
security |
TLS encryption |
The listen value of 0.0.0.0 makes the inbound available on all IPv4 interfaces. The firewall determines whether remote systems can reach it.
Understand the Outbound Settings #
The outbound section controls how V2Ray handles traffic after accepting a client connection.
The freedom outbound allows traffic to connect directly to its destination. It is assigned the direct tag.
The blackhole outbound discards traffic when a routing rule directs a connection to it. It is assigned the blocked tag.
The example configuration defines both outbounds but does not include routing rules that send traffic to the blocked outbound.
🚀 Create the systemd Service #
A systemd unit allows V2Ray to start automatically during boot and restart after an unexpected failure.
Create the service file:
sudo nano /etc/systemd/system/v2ray.serviceAdd the following contents:
[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target
[Service]
Type=simple
User=v2ray
Group=v2ray
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/bin/v2ray -config=/usr/local/etc/v2ray/config.json
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.targetThe service runs under the unprivileged v2ray account.
The CAP_NET_BIND_SERVICE capability allows the process to bind to a privileged port such as TCP 443 without running the entire service as root.
NoNewPrivileges=true prevents the process and its child processes from gaining additional privileges through mechanisms such as set-user-ID executables.
Reload systemd so it recognizes the new unit:
sudo systemctl daemon-reloadEnable automatic startup:
sudo systemctl enable v2rayStart the service:
sudo systemctl start v2rayCheck its status:
sudo systemctl status v2rayA successful startup should show:
Active: active (running)If the service fails, inspect its journal before changing the configuration:
sudo journalctl -u v2ray -n 50 --no-pager🔄 Configure Automatic TLS Renewal #
Let’s Encrypt certificates have a limited validity period. Certbot can renew them automatically, but V2Ray must also receive the renewed certificate and private key.
The deployment hook below copies the renewed files into the directory used by V2Ray and restarts the service.
Create the hook:
sudo nano /etc/letsencrypt/renewal-hooks/deploy/v2ray-cert.shInsert:
#!/bin/bash
set -e
DOMAIN="vpn.example.com"
install -o root -g v2ray -m 640 \
"/etc/letsencrypt/live/${DOMAIN}/fullchain.pem" \
/etc/v2ray/tls/fullchain.pem
install -o root -g v2ray -m 640 \
"/etc/letsencrypt/live/${DOMAIN}/privkey.pem" \
/etc/v2ray/tls/privkey.pem
systemctl restart v2rayReplace vpn.example.com with the actual certificate domain.
Make the hook executable:
sudo chmod 755 \
/etc/letsencrypt/renewal-hooks/deploy/v2ray-cert.shCheck whether the Certbot timer is active:
sudo systemctl status certbot.timerIf necessary, enable it:
sudo systemctl enable --now certbot.timerTest the renewal process:
sudo certbot renew --dry-runA successful dry run confirms that Certbot can complete the renewal procedure in its test environment. The deployment hook runs when a certificate is actually renewed, so a dry run should not be treated as proof that V2Ray has already loaded a new certificate.
🧱 Configure the Ubuntu Firewall #
Check the current UFW status:
sudo ufw statusIf UFW is enabled, allow SSH before changing other firewall rules. This helps prevent accidentally locking yourself out of a remote server:
sudo ufw allow OpenSSHAllow HTTP for Let’s Encrypt validation and HTTPS for V2Ray:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcpIf UFW is currently inactive, configure the rules and review the default policy before enabling it:
sudo ufw enableDo not enable the firewall over a remote SSH session until you have confirmed that SSH is allowed and that the rules match your server’s access requirements.
Also configure the VPS provider’s external firewall to allow the required ports. UFW and the provider firewall operate independently.
🔎 Verify the V2Ray Server #
After starting the service and configuring the firewall, check each part of the deployment.
Confirm that systemd reports the service as running:
sudo systemctl status v2rayCheck whether V2Ray is listening on TCP port 443:
sudo ss -lntp | grep ':443'Inspect recent service logs:
sudo journalctl -u v2ray -n 50 --no-pagerNext, verify the TLS certificate and handshake:
openssl s_client \
-connect vpn.example.com:443 \
-servername vpn.example.comThe output should show the certificate chain presented by the server and the result of the TLS handshake.
A successful TLS handshake confirms that the server can negotiate TLS and present a certificate. It does not prove that VMess authentication is working. A real client connection is still required to test the complete configuration.
💻 Configure a V2Ray Client #
The client must use the same UUID, domain, port, protocol, transport, and TLS settings as the server.
The following example creates a local SOCKS5 inbound on port 10808 and forwards its traffic through the remote VMess server.
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 10808,
"protocol": "socks",
"settings": {
"udp": true
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "vpn.example.com",
"port": 443,
"users": [
{
"id": "YOUR-UUID-HERE",
"alterId": 0,
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "vpn.example.com",
"allowInsecure": false
}
}
}
]
}Replace YOUR-UUID-HERE with the server UUID. The address and serverName values should match the domain covered by the TLS certificate.
The local SOCKS5 proxy listens on:
127.0.0.1:10808Once the client is running, test it with curl:
curl --proxy socks5h://127.0.0.1:10808 \
https://www.google.comIf the request succeeds, the client has established a working connection through the V2Ray server.
Keep allowInsecure set to false in normal deployments. Setting it to true disables normal certificate verification and weakens the protection provided by TLS.
🤖 Automate the Deployment with Bash #
The manual procedure involves several repetitive operations. A Bash script can automate most of them, including package installation, UUID generation, certificate provisioning, configuration-file creation, systemd setup, and service startup.
The installer below performs these operations:
- Checks the operating system and CPU architecture.
- Installs the required packages.
- Downloads V2Ray Core 4.44.0.
- Installs the executable and GeoIP databases.
- Creates a dedicated service account.
- Generates a VMess UUID.
- Obtains a Let’s Encrypt certificate.
- Creates the V2Ray server configuration.
- Installs the systemd service.
- Configures the certificate renewal hook.
- Adds UFW rules if UFW is already active.
- Starts the service and checks its status.
- Saves the client connection details in a root-only file.
The script still requires a working domain, valid DNS, and reachable ports 80 and 443. It also downloads the release archive without performing a checksum or signature verification, so verify the release artifact independently before using it on a production system.
Create the Installer #
Create a new file:
nano install-v2ray-4.44.0.shPaste the complete script:
#!/usr/bin/env bash
set -Eeuo pipefail
# ==========================================
# V2Ray 4.44.0 Automatic Installation
# Ubuntu 24.04 LTS - x86_64
#
# Protocol: VMess
# Transport: TCP
# Security: TLS
# Port: 443
# ==========================================
VERSION="4.44.0"
ARCHIVE="v2ray-linux-64.zip"
DOWNLOAD_URL="https://github.com/v2fly/v2ray-core/releases/download/v${VERSION}/${ARCHIVE}"
INSTALL_DIR="/usr/local/bin"
CONFIG_DIR="/usr/local/etc/v2ray"
DATA_DIR="/usr/local/share/v2ray"
TLS_DIR="/etc/v2ray/tls"
SERVICE_USER="v2ray"
SERVICE_GROUP="v2ray"
SERVICE_FILE="/etc/systemd/system/v2ray.service"
log() {
echo
echo "[INFO] $1"
}
fail() {
echo
echo "[ERROR] $1"
exit 1
}
# ==========================================
# Check root privileges
# ==========================================
if [[ "${EUID}" -ne 0 ]]; then
fail "Please execute this script using sudo."
fi
# ==========================================
# Check operating system
# ==========================================
if [[ ! -f /etc/os-release ]]; then
fail "Cannot identify the operating system."
fi
source /etc/os-release
if [[ "${ID}" != "ubuntu" ]]; then
fail "This script is designed for Ubuntu."
fi
if [[ "$(uname -m)" != "x86_64" ]]; then
fail "This script supports x86_64 only."
fi
log "Ubuntu and architecture checks passed."
# ==========================================
# Collect user information
# ==========================================
read -r -p "Enter your domain name (e.g. vpn.example.com): " DOMAIN
read -r -p "Enter your email address for Let's Encrypt: " EMAIL
if [[ ! "${DOMAIN}" =~ ^[A-Za-z0-9.-]+$ ]]; then
fail "Invalid domain name."
fi
if [[ ! "${DOMAIN}" =~ \. ]]; then
fail "Please enter a fully qualified domain name."
fi
if [[ ! "${EMAIL}" =~ ^[^[:space:]@]+@[^[:space:]@]+\.[^[:space:]@]+$ ]]; then
fail "Invalid email address."
fi
# ==========================================
# Check DNS
# ==========================================
log "Checking domain DNS resolution."
if ! getent ahostsv4 "${DOMAIN}" >/dev/null 2>&1; then
fail "Domain does not resolve to an IPv4 address."
fi
echo
echo "Resolved IPv4 addresses:"
getent ahostsv4 "${DOMAIN}" | awk '{print $1}' | sort -u
echo
read -r -p "Have you confirmed DNS points to this server and ports 80/443 are reachable? [y/N]: " CONFIRM
if [[ ! "${CONFIRM}" =~ ^[Yy]$ ]]; then
fail "Please correct DNS and firewall settings first."
fi
# ==========================================
# Install dependencies
# ==========================================
log "Installing required packages."
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y \
curl \
unzip \
ca-certificates \
certbot \
ufw
# ==========================================
# Synchronize system time
# ==========================================
log "Enabling time synchronization."
timedatectl set-ntp true || true
# ==========================================
# Generate UUID
# ==========================================
UUID="$(cat /proc/sys/kernel/random/uuid)"
log "Generated VMess UUID."
# ==========================================
# Download V2Ray
# ==========================================
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "${TMP_DIR}"' EXIT
log "Downloading V2Ray ${VERSION}."
curl -fL \
--retry 3 \
--retry-delay 2 \
-o "${TMP_DIR}/${ARCHIVE}" \
"${DOWNLOAD_URL}"
# ==========================================
# Extract archive
# ==========================================
log "Extracting V2Ray archive."
unzip -q "${TMP_DIR}/${ARCHIVE}" -d "${TMP_DIR}/v2ray"
if [[ ! -x "${TMP_DIR}/v2ray/v2ray" ]]; then
fail "V2Ray executable was not found."
fi
# ==========================================
# Install binaries and databases
# ==========================================
log "Installing V2Ray binaries."
install -d "${INSTALL_DIR}"
install -d "${CONFIG_DIR}"
install -d "${DATA_DIR}"
install -m 755 \
"${TMP_DIR}/v2ray/v2ray" \
"${INSTALL_DIR}/v2ray"
install -m 644 \
"${TMP_DIR}/v2ray/geoip.dat" \
"${DATA_DIR}/geoip.dat"
install -m 644 \
"${TMP_DIR}/v2ray/geosite.dat" \
"${DATA_DIR}/geosite.dat"
"${INSTALL_DIR}/v2ray" -version
# ==========================================
# Create service account
# ==========================================
log "Creating V2Ray service account."
if ! getent group "${SERVICE_GROUP}" >/dev/null; then
groupadd --system "${SERVICE_GROUP}"
fi
if ! id "${SERVICE_USER}" >/dev/null 2>&1; then
useradd \
--system \
--gid "${SERVICE_GROUP}" \
--no-create-home \
--shell /usr/sbin/nologin \
"${SERVICE_USER}"
fi
# ==========================================
# Obtain TLS certificate
# ==========================================
log "Requesting Let's Encrypt certificate."
certbot certonly \
--standalone \
--preferred-challenges http \
--non-interactive \
--agree-tos \
--email "${EMAIL}" \
-d "${DOMAIN}"
# ==========================================
# Install TLS certificate
# ==========================================
log "Installing TLS certificate."
install -d -o root -g "${SERVICE_GROUP}" -m 750 "${TLS_DIR}"
install -o root -g "${SERVICE_GROUP}" -m 640 \
"/etc/letsencrypt/live/${DOMAIN}/fullchain.pem" \
"${TLS_DIR}/fullchain.pem"
install -o root -g "${SERVICE_GROUP}" -m 640 \
"/etc/letsencrypt/live/${DOMAIN}/privkey.pem" \
"${TLS_DIR}/privkey.pem"
# ==========================================
# Generate V2Ray configuration
# ==========================================
log "Generating V2Ray configuration."
cat > "${CONFIG_DIR}/config.json" <<EOF
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"tag": "vmess-in",
"listen": "0.0.0.0",
"port": 443,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "${UUID}",
"alterId": 0,
"email": "default-user"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"certificates": [
{
"certificateFile": "${TLS_DIR}/fullchain.pem",
"keyFile": "${TLS_DIR}/privkey.pem"
}
]
}
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "blocked",
"protocol": "blackhole",
"settings": {}
}
]
}
EOF
chown root:"${SERVICE_GROUP}" "${CONFIG_DIR}/config.json"
chmod 640 "${CONFIG_DIR}/config.json"
# ==========================================
# Create systemd service
# ==========================================
log "Creating systemd service."
cat > "${SERVICE_FILE}" <<EOF
[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target
[Service]
Type=simple
User=${SERVICE_USER}
Group=${SERVICE_GROUP}
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=${INSTALL_DIR}/v2ray -config=${CONFIG_DIR}/config.json
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
# ==========================================
# Configure certificate renewal hook
# ==========================================
log "Configuring automatic certificate renewal."
RENEW_HOOK="/etc/letsencrypt/renewal-hooks/deploy/v2ray-cert.sh"
install -d /etc/letsencrypt/renewal-hooks/deploy
cat > "${RENEW_HOOK}" <<EOF
#!/usr/bin/env bash
set -e
install -o root -g ${SERVICE_GROUP} -m 640 \
/etc/letsencrypt/live/${DOMAIN}/fullchain.pem \
${TLS_DIR}/fullchain.pem
install -o root -g ${SERVICE_GROUP} -m 640 \
/etc/letsencrypt/live/${DOMAIN}/privkey.pem \
${TLS_DIR}/privkey.pem
systemctl restart v2ray
EOF
chmod 755 "${RENEW_HOOK}"
# ==========================================
# Configure firewall
# ==========================================
log "Configuring firewall rules."
if ufw status | grep -q "Status: active"; then
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
log "UFW rules updated."
else
log "UFW is inactive. Rules were not activated automatically."
log "Enable UFW only after confirming your SSH access and firewall policy."
fi
# ==========================================
# Enable and start service
# ==========================================
log "Starting V2Ray service."
systemctl daemon-reload
systemctl enable v2ray
systemctl restart v2ray
# ==========================================
# Enable certificate renewal timer
# ==========================================
systemctl enable --now certbot.timer || true
# ==========================================
# Verify installation
# ==========================================
sleep 2
if ! systemctl is-active --quiet v2ray; then
journalctl -u v2ray -n 30 --no-pager
fail "V2Ray failed to start."
fi
# ==========================================
# Save client information
# ==========================================
CLIENT_INFO="/root/v2ray-client-info.txt"
cat > "${CLIENT_INFO}" <<EOF
V2Ray Server Information
=======================
Version: ${VERSION}
Domain: ${DOMAIN}
Port: 443
Protocol: VMess
Transport: TCP
TLS: Enabled
UUID: ${UUID}
AlterId: 0
Security: auto
ServerName: ${DOMAIN}
Client local SOCKS5 port: 10808
EOF
chmod 600 "${CLIENT_INFO}"
# ==========================================
# Installation complete
# ==========================================
echo
echo "=========================================="
echo " V2Ray Installation Completed Successfully"
echo "=========================================="
echo
echo "Version: ${VERSION}"
echo "Domain: ${DOMAIN}"
echo "Port: 443"
echo "Protocol: VMess"
echo "Transport: TCP"
echo "TLS: Enabled"
echo
echo "UUID: ${UUID}"
echo
echo "Client information saved to:"
echo "${CLIENT_INFO}"
echo
echo "Check service:"
echo "systemctl status v2ray"
echo
echo "Check logs:"
echo "journalctl -u v2ray -f"
echo
echo "Check listening port:"
echo "ss -lntp | grep ':443'"
echo
echo "=========================================="Run the Installer #
Make the script executable:
chmod +x install-v2ray-4.44.0.shRun it with root privileges:
sudo ./install-v2ray-4.44.0.shThe installer asks for the domain and email address used by Certbot:
Enter your domain name (e.g. vpn.example.com):
vpn.example.com
Enter your email address for Let's Encrypt:
admin@example.comIt also asks you to confirm that DNS points to the server and that ports 80 and 443 are reachable.
After successful installation, the script displays the generated UUID and saves the connection details to:
/root/v2ray-client-info.txtThis file contains the authentication credentials needed by the client. It is restricted to root, so retrieve it using an appropriately privileged account and do not publish or share it.
🧯 Troubleshooting Common Problems #
V2Ray Fails to Start #
Check the service status:
sudo systemctl status v2rayThen inspect the detailed journal:
sudo journalctl -u v2ray -xeCommon causes include invalid JSON, incorrect certificate paths, unreadable private keys, and another process already listening on port 443.
Check the configuration file carefully and confirm that the service account can read both TLS files.
Port 443 Is Already in Use #
Check which process owns the port:
sudo ss -lntp | grep ':443'A web server or another proxy may already be listening on TCP 443.
Stop or reconfigure the conflicting service before starting V2Ray. If the existing application must continue using port 443, the deployment needs a different port or a suitable front-end proxy architecture.
TLS Certificate Permission Denied #
Inspect the certificate directory:
ls -l /etc/v2ray/tls/The expected file permissions are similar to:
-rw-r----- root v2ray fullchain.pem
-rw-r----- root v2ray privkey.pemAlso check the directory permissions:
ls -ld /etc/v2ray/tlsThe V2Ray service must be able to traverse the directory and read the certificate files through its group membership.
VMess Authentication Fails #
Check the following settings on both the client and server:
- The UUID values must match.
- Both sides must use
alterIdset to0. - The system clocks should be synchronized.
- Both sides must use TCP transport.
- Both sides must use TLS.
- The client’s
serverNameshould match the certificate domain. - The client must connect to the correct server address and port.
Check the server’s time synchronization:
timedatectlIf the settings appear correct, inspect the server logs while attempting a client connection:
sudo journalctl -u v2ray -fTLS Certificate Renewal Fails #
Test the Certbot renewal process:
sudo certbot renew --dry-runCheck the renewal timer:
sudo systemctl status certbot.timerInspect the expiry dates of the certificate copy used by V2Ray:
sudo openssl x509 \
-in /etc/v2ray/tls/fullchain.pem \
-noout -datesIf Certbot successfully renews the certificate but V2Ray continues presenting the old one, check whether the deployment hook ran and whether the service restarted successfully.
✅ Final Deployment Checklist #
Before considering the deployment complete, verify each item:
- Ubuntu 24.04.5 is updated.
- The server uses the x86_64 architecture.
- V2Ray 4.44.0 is installed.
- The release archive has been verified.
- A VMess UUID has been generated.
- Domain DNS resolves to the server.
- The Let’s Encrypt certificate is valid.
- The TLS private key has restricted permissions.
- V2Ray runs under a dedicated service account.
- TCP port 443 is reachable.
- The systemd service is enabled.
- The Certbot renewal timer is enabled.
- The client configuration matches the server.
- A real client connection has been tested.
🔒 Security and Maintenance Considerations #
This example uses an older, specifically pinned V2Ray release. That makes the instructions reproducible, but it also means the deployment should be evaluated against current project maintenance and security information before being exposed to the internet.
A few operational practices are worth keeping:
- Keep Ubuntu security updates installed.
- Restrict access to the UUID and client configuration.
- Protect the TLS private key and its containing directory.
- Monitor the V2Ray systemd journal.
- Confirm that certificate renewal updates the files V2Ray actually reads.
- Review the release history and plan an upgrade to a maintained version when compatibility allows.
- Avoid disabling TLS certificate verification to work around connection problems.
The automated installer also does not verify the downloaded archive’s checksum or signature. For production use, add an explicit integrity-verification step based on the official release metadata before installing the binary.
📚 References #
- V2Fly GitHub repository
- V2Ray Core 4.44.0 release
- V2Fly documentation
- VMess configuration guide
- Let’s Encrypt documentation
- Certbot instructions
- Ubuntu Server documentation
This deployment provides a reproducible way to install V2Ray Core 4.44.0 on Ubuntu 24.04.5 with VMess, TCP, and TLS. It also demonstrates how to integrate the service with systemd, manage certificate permissions, automate Let’s Encrypt renewal, and verify a client connection.
The Bash installer reduces the amount of manual configuration, but it does not remove the need to check DNS, firewall rules, certificate handling, and release integrity. Those checks are especially important when deploying an older software version on an internet-facing server.