- Install prerequisites:
sudo apt update
sudo apt install wget unzip -y- Download and extract Trojan-Go:
wget https://github.com/p4gefau1t/trojan-go/releases/latest/download/trojan-go-linux-amd64.zip
unzip trojan-go-linux-amd64.zip -d trojan-go-setup
cd trojan-go-setup
chmod +x trojan-goInside trojan-go-setup:
nano config.jsonPaste:
{
"run_type": "client",
"local_addr": "127.0.0.1",
"local_port": 1080,
"remote_addr": "addYourDomain",
"remote_port": addYourPort,
"password": [
"addYourPassword"
],
"ssl": {
"sni": "addYourSNI",
"verify": false,
"verify_hostname": false
}
}Save with Ctrl+O, press Enter, then exit with Ctrl+X.
./trojan-go -config ./config.jsonIf error "bind: address already in use":
sudo fuser -k 1080/tcp- Install Privoxy:
sudo apt install privoxy -y- Edit config:
sudo nano /etc/privoxy/configAt the end of the file, add:
forward-socks5t / 127.0.0.1:1080 .
- Restart Privoxy:
sudo systemctl restart privoxy
sudo systemctl enable privoxy- Check Privoxy:
sudo systemctl status privoxyYou should see active (running).
sudo nano /etc/environmentAdd at the bottom:
http_proxy="http://127.0.0.1:8118"
https_proxy="http://127.0.0.1:8118"
ftp_proxy="http://127.0.0.1:8118"
no_proxy="localhost,127.0.0.1,::1"
HTTP_PROXY="http://127.0.0.1:8118"
HTTPS_PROXY="http://127.0.0.1:8118"
FTP_PROXY="http://127.0.0.1:8118"
NO_PROXY="localhost,127.0.0.1,::1"Log out & back in, or reboot.
sudo nano /etc/apt/apt.conf.d/99proxyPaste:
Acquire::http::Proxy "http://127.0.0.1:8118/";
Acquire::https::Proxy "http://127.0.0.1:8118/";
- Check proxy variables:
env | grep -i proxy- Test with curl/wget:
curl -I http://example.com
wget -O - http://example.com- Test apt:
sudo apt updatePrivoxy + system proxy configs persist automatically. To reconnect, just restart Trojan-Go:
cd ~/trojan-go-setup
./trojan-go -config ./config.jsonsudo apt update
sudo apt install wget unzip -y
wget https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-64.zip
unzip Xray-linux-64.zip -d xray
cd xray
chmod +x xraynano config.jsonPaste this configuration (based on your link):
{
"inbounds": [
{
"port": 10808,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true
}
}
],
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "your-domain",
"port": 443,
"users": [
{
"id": "vless-id",
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "your-host",
"allowInsecure": true,
"alpn": []
}
}
}
]
}Run:
./xray run -c config.jsonLeave this terminal running. Your SOCKS5 proxy is now at 127.0.0.1:10808.
export http_proxy="socks5h://127.0.0.1:10808"
export https_proxy="socks5h://127.0.0.1:10808"Edit /etc/environment and add:
http_proxy="socks5h://127.0.0.1:10808"
https_proxy="socks5h://127.0.0.1:10808"
ftp_proxy="socks5h://127.0.0.1:10808"
no_proxy="localhost,127.0.0.1,::1"Reboot or log out/in.
sudo nano /etc/apt/apt.conf.d/99proxypaste:
Acquire::http::Proxy "socks5h://127.0.0.1:10808/";
Acquire::https::Proxy "socks5h://127.0.0.1:10808/";- Firefox: Preferences → Network Settings → Manual → SOCKS Host 127.0.0.1, Port 10808, SOCKS v5, and enable “Proxy DNS when using SOCKS v5”.
- Chrome/Brave: start from the terminal with:
google-chrome --proxy-server="socks5://127.0.0.1:10808" brave-browser --proxy-server="socks5://127.0.0.1:10808"
Step 1 — Create the Systemd Service File
Step 1 — Create the Systemd Service File
sudo nano /etc/systemd/system/xray.serviceNow paste this exactly, but replace yourusername with your real Linux username (ex: hasindu):
[Unit]
Description=Xray-core VLESS Proxy
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=yourusername
WorkingDirectory=/home/yourusername/xray
ExecStart=/home/yourusername/xray/xray run -c /home/yourusername/xray/config.json
Restart=on-failure
[Install]
WantedBy=multi-user.targetSave & Exit:
- Press CTRL + O → Enter
- Press CTRL + X
Step 2 — Apply the Service & Enable Auto-Start
sudo systemctl daemon-reload
sudo systemctl enable xray.service
sudo systemctl start xray.serviceStep 3 — Check Status
sudo systemctl status xray.serviceYou should see active (running) in green. Also confirm SOCKS proxy port:
ss -tlnp | grep 10808If you see it listening → success ✅
Step 1 — Move Xray to /opt/xray
sudo mkdir -p /opt/xray
sudo cp -a ~/xray/. /opt/xray/
sudo chown -R root:root /opt/xrayStep 2 — Create/Modify Service File
sudo nano /etc/systemd/system/xray.service[Unit]
Description=Xray-core VLESS Proxy
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/xray
ExecStart=/opt/xray/xray run -c /opt/xray/config.json
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.targetSave and exit
Step 3 — Enable Auto-Start
sudo systemctl daemon-reload
sudo systemctl enable xray.service
sudo systemctl start xray.serviceStep 4 — View Live Logs
journalctl -u xray.service -fThis helps you see connection errors in real-time.