Installing v2rayN on Ubuntu and Debian, end to end

From download to autostart, including the desktop proxy settings most guides skip and what to do on a headless server.

LinuxFeb 18, 20262 min read

The Debian family covers most Linux desktop users. This walks through it in the order you actually do things, including the step most guides omit: making the rest of the system use the proxy.

Install

Install a local deb with apt
cd ~/Downloads

# the leading ./ is required, or apt looks for a repo package of that name
sudo apt install ./v2rayN-linux-64.deb

# if dependencies are missing
sudo apt update
sudo apt install -f

Launching

Start from a terminal to see errors
v2rayN

# if the command is not found, locate it
which v2rayN || dpkg -L v2rayn | grep bin

Making the system actually use it

This is where people get stuck. Unlike Windows there is no single "system proxy" — different layers need configuring separately.

Desktop environmentGNOME/KDE settings — affects apps that honour themEnvironment variableshttp_proxy and friends — affects your shellAPT specificallyThe package manager ignores env vars
Proxy configuration is layered on Linux

Desktop: in GNOME, Settings → Network → Network Proxy → Manual, with 127.0.0.1 and port 10809 for both HTTP and HTTPS. In KDE it lives under System Settings → Network → Settings → Proxy.

Environment variables — add to ~/.bashrc or ~/.zshrc
export http_proxy="http://127.0.0.1:10809"
export https_proxy="http://127.0.0.1:10809"
export all_proxy="socks5://127.0.0.1:10808"
export no_proxy="localhost,127.0.0.1,::1,*.local"

export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy
APT, configured separately
sudo tee /etc/apt/apt.conf.d/95proxy > /dev/null <<'EOF'
Acquire::http::Proxy "http://127.0.0.1:10809";
Acquire::https::Proxy "http://127.0.0.1:10809";
EOF

# remove the file when you no longer want it

Autostart

Desktop autostart entry
mkdir -p ~/.config/autostart
cat > ~/.config/autostart/v2rayn.desktop <<'EOF'
[Desktop Entry]
Type=Application
Name=v2rayN
Exec=v2rayN
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=15
EOF

The 15-second delay lets the network come up first, avoiding the situation where every server test fails at boot because there was no connectivity yet.

Headless servers

v2rayN is a GUI client and will not run on a server without a desktop. The right approach there is to run the core directly:

Core + config file + systemd
# 1. configure on a desktop machine, export the generated config.json
# 2. copy the core binary and config.json to the server
# 3. keep it running with systemd

sudo tee /etc/systemd/system/xray.service > /dev/null <<'EOF'
[Unit]
Description=Xray Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/xray run -c /usr/local/etc/xray/config.json
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl enable --now xray
sudo systemctl status xray

The server then has a permanent local proxy port, and everything else uses it through the same environment variables.