Posts and how to...

Many useful articles and instructions!

    Installing and running v2raya and Xray on Ubuntu 24.04 or in an LXC container (socks5 proxy)

    Installation and Configuration Guide for v2raya + Xray in LXC Container = SOCKS5 proxy

    Installing and running v2raya and Xray on Ubuntu 24.04 or in an LXC container

    p.s. This proxy client helps you run cryptocurrency wallets to ensure blockchain synchronization despite internet restrictions in various regions around the world

    Complete guide to deploying VLESS proxy through v2raya with Xray core in an isolated LXC container on Ubuntu/Debian


    Table of Contents

    1. Requirements and Preparation
    2. Installing Xray Core
    3. Installing v2raya
    4. Configuring v2raya
    5. Importing VLESS Configuration
    6. Testing Functionality
    7. Configuring Proxy on Host
    8. Service Management
    9. Troubleshooting
    10. Security

    1. Requirements and Preparation

    What You'll Need

    Component Requirement
    Host Proxmox VE / any LXC host
    Container LXC with Ubuntu 20.04+ or Debian 10+
    Access SSH or console access to container
    VLESS Working VLESS link from provider

    Creating LXC Container (Proxmox)

    # Recommended container parameters:
    # - CPU: 1-2 cores
    # - RAM: 512MB - 1GB
    # - Disk: 4-8GB
    # - Network: bridge (vmbr0)
    # - Unprivileged container: No (for iptables to work)

    ⚠️ Important: For transparent proxy to work, container must be privileged or have access to network functions.


    2. Installing Xray Core

    Xray is a modern core with support for VLESS, Vision, Reality, and other protocols.

    # Download and run official installation script
    bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

    Verify Installation

    # Check version
    xray version
    
    # Check file locations
    ls -la /usr/local/bin/xray
    ls -la /usr/local/etc/xray/
    File/Folder Path
    Binary /usr/local/bin/xray
    Config /usr/local/etc/xray/config.json
    Geo data /usr/local/share/xray/geoip.dat, geosite.dat

    3. Installing v2raya

    ⚠️ Why Not via apt Repository

    The official v2raya repository has certificate issues, so we use manual .deb package installation.

    Download Binary

    # Create download directory
    mkdir -p /root/vpn
    cd /root/vpn
    
    # Download latest version (check current on GitHub)
    wget https://github.com/v2rayA/v2rayA/releases/download/v2.3.3/installer_debian_x64_2.3.3.deb

    Install Package

    # Install .deb package
    apt install /root/vpn/installer_debian_x64_2.3.3.deb
    
    # Or via dpkg
    dpkg -i /root/vpn/installer_debian_x64_2.3.3.deb
    apt install -f -y  # Fix dependencies if needed

    Verify Installation

    # Check version
    v2raya --version
    
    # Check file locations
    ls -la /etc/v2raya/
    ls -la /var/lib/v2raya/

    4. Configuring v2raya

    Start Service

    # Start service
    sudo systemctl start v2raya.service
    
    # Enable auto-start on boot
    sudo systemctl enable v2raya.service
    
    # Check status
    sudo systemctl status v2raya.service

    Configuration File

    Main config file location:

    /etc/default/v2raya

    Default Parameters:

    Parameter Value Description
    Web Port 2017 Control panel port
    SOCKS5 20170 SOCKS5 proxy port
    HTTP 20171 HTTP proxy port
    Address 127.0.0.1 Local access only

    Enable Network Access (Optional)

    # Edit config
    nano /etc/default/v2raya
    
    # Change listen address
    V2RAYA_ADDRESS="0.0.0.0:2017"
    
    # Restart service
    sudo systemctl restart v2raya

    ⚠️ Warning: Opening network access requires strong password and HTTPS!


    5. Importing VLESS Configuration

    Get VLESS Link

    Your provider should provide a VLESS link like:

    vless://uuid@server.com:443?type=tcp&security=tls&sni=server.com&flow=xtls-rprx-vision#name

    Converters (if needed)

    Converter URL Purpose
    VLESS Converter https://eikeidev.github.io/vless-xtls-converter/ JSON ↔ VLESS
    Amnezia Converter https://sovenov.github.io/amnezia_xkeen_converter/ JSON ↔ VLESS
    VlessLinker https://github.com/AS97GitHub/VlessLinker Link generation

    Import via Web Interface

    1. Open control panel:

      http://<container_IP>:2017
    2. Create account on first login (username + password)

    3. Import configuration:

      • Click "Import" or "+" button
      • Paste VLESS link
      • Click "Save"
    4. Activate profile:

      • Toggle switch to ON
      • Indicator should turn green

    Import via JSON File

    # Save JSON config to v2raya directory
    cp config.json /etc/v2raya/
    
    # Or import via web interface (Upload button)

    6. Testing Functionality

    Basic Checks

    # 1. Check service status
    sudo systemctl status v2raya
    
    # 2. Check listening ports
    sudo ss -tlnp | grep -E '2017|20170|20171'
    
    # 3. Check API status
    curl http://127.0.0.1:2017/api/status

    Test Proxy

    # Test SOCKS5 proxy (recommended)
    curl -x socks5h://127.0.0.1:20170 https://api.ip.sb/ip
    
    # Test HTTP proxy
    curl -x http://127.0.0.1:20171 https://api.ip.sb/ip
    
    # Test with verbose output
    curl -v -x socks5h://127.0.0.1:20170 https://api.ip.sb/ip

    Expected Result

    {
      "ip": "XXX.XXX.XXX.XXX",
      "country": "XX",
      ...
    }

    If you see your VPN server's IP — it works!


    7. Configuring Proxy on Host

    ️ Temporary Setup (Current Session)

    # On host (not in container!)
    export ALL_PROXY=socks5h://<container_IP>:20170
    export http_proxy=http://<container_IP>:20171
    export https_proxy=http://<container_IP>:20171
    
    # Test
    curl https://api.ip.sb/ip

    Permanent Setup

    # Add to ~/.bashrc or ~/.profile
    echo 'export ALL_PROXY=socks5h://<container_IP>:20170' >> ~/.bashrc
    echo 'export http_proxy=http://<container_IP>:20171' >> ~/.bashrc
    echo 'export https_proxy=http://<container_IP>:20171' >> ~/.bashrc
    
    # Apply changes
    source ~/.bashrc

    Using with proxychains

    # Install proxychains
    apt install proxychains -y
    
    # Configure /etc/proxychains.conf
    nano /etc/proxychains.conf
    
    # Add to end of file:
    socks5 <container_IP> 20170
    
    # Usage
    proxychains curl https://api.ip.sb/ip
    proxychains firefox
    proxychains apt update

    8. Service Management

    systemctl Commands

    Command Description
    systemctl start v2raya Start service
    systemctl stop v2raya Stop service
    systemctl restart v2raya Restart service
    systemctl enable v2raya Enable auto-start
    systemctl disable v2raya Disable auto-start
    systemctl status v2raya Show status

    View Logs

    # Real-time logs
    journalctl -u v2raya -f
    
    # Last 50 lines
    journalctl -u v2raya -n 50 --no-pager
    
    # Today's logs
    journalctl -u v2raya --since today

    Update v2raya

    # Download new version
    wget https://github.com/v2rayA/v2rayA/releases/latest/download/installer_debian_x64_<version>.deb
    
    # Install
    apt install /path/to/installer_debian_x64_<version>.deb
    
    # Restart
    systemctl restart v2raya

    9. Troubleshooting

    Error: iptables not found

    # Problem: transparent proxy mode requires iptables
    # Solution 1: Install iptables
    apt update && apt install iptables -y
    
    # Solution 2: Disable transparent proxy in v2raya settings
    # Web Interface → Settings → Transparent Proxy → Disable

    Error: SSL_ERROR_SYSCALL

    # Problem: proxy not responding or profile not activated
    # Solution:
    # 1. Check service status
    systemctl status v2raya
    
    # 2. Check profile activation in web interface
    # 3. Use SOCKS5 instead of HTTP
    curl -x socks5h://127.0.0.1:20170 https://api.ip.sb/ip
    
    # 4. Check logs
    journalctl -u v2raya -f

    Error: Port in use

    # Find process on port
    sudo ss -tlnp | grep 2017
    
    # Stop conflicting process or change port
    nano /etc/default/v2raya

    Web interface not accessible

    # Check firewall
    sudo ufw status
    sudo ufw allow 2017/tcp
    
    # Check service
    systemctl status v2raya
    
    # Check logs
    journalctl -u v2raya -f

    Diagnostic Checklist

    # 1. Service active?
    systemctl is-active v2raya
    
    # 2. Ports listening?
    ss -tlnp | grep -E '2017|20170|20171'
    
    # 3. API responding?
    curl http://127.0.0.1:2017/api/status
    
    # 4. Profile activated?
    # Check in web interface
    
    # 5. Logs without errors?
    journalctl -u v2raya -n 50 --no-pager

    10. Security

    Recommendations

    Measure Description
    Password Use strong password in v2raya
    Access Restrict web interface to localhost
    HTTPS Enable HTTPS for web panel
    Updates Regularly update v2raya and Xray
    Snapshot Take LXC snapshots before changes

    LXC Snapshot (Proxmox)

    # Create snapshot before update
    pct snapshot <CTID> pre-update
    
    # Rollback if problems occur
    pct rollback <CTID> pre-update
    
    # List snapshots
    pct snapshot list <CTID>

    Auto-start Container

    # Enable container auto-start on host boot
    pct set <CTID> -onboot 1

    ️ Firewall Inside Container

    # Install UFW
    apt install ufw -y
    
    # Allow only necessary ports
    ufw allow 2017/tcp    # Web interface (if external access needed)
    ufw allow 20170/tcp   # SOCKS5
    ufw allow 20171/tcp   # HTTP
    
    # Enable firewall
    ufw enable

    Ports Summary Table

    Service Port Protocol Purpose
    v2raya Web UI 2017 HTTP/HTTPS Control panel
    SOCKS5 Proxy 20170 SOCKS5 Main proxy
    HTTP Proxy 20171 HTTP Alternative proxy

    Useful Links

    Resource URL
    v2raya GitHub https://github.com/v2rayA/v2rayA/releases
    v2raya Docs https://v2raya.org/en/docs/prologue/installation/debian/
    Xray Install https://github.com/XTLS/Xray-install
    VLESS Converter https://eikeidev.github.io/vless-xtls-converter/
    Amnezia Converter https://sovenov.github.io/amnezia_xkeen_converter/
    VlessLinker https://github.com/AS97GitHub/VlessLinker

    Final Verification

    # 1. Service running
    systemctl status v2raya
    
    # 2. Ports open
    ss -tlnp | grep v2raya
    
    # 3. Proxy responding
    curl -x socks5h://127.0.0.1:20170 https://api.ip.sb/ip
    
    # 4. Web interface accessible
    curl http://127.0.0.1:2017/api/status

    Congratulations! Your VPN infrastructure is ready to use!

    If issues occur — check logs with journalctl -u v2raya -f