Linux 使用帮助

Build Status

域名更新站点:https://github.com/spirits5052/SSRLINE

CentOS

sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh)"

or

sudo bash -c "$(wget -O- https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh)"

Debian

10

sudo apt install trojan

<= 9

TROJAN_DEBIAN_VERSION="1.10.0-3"

sudo apt update
sudo apt install build-essential devscripts debhelper cmake libboost-system-dev libboost-program-options-dev libssl-dev default-libmysqlclient-dev python3 curl openssl
dget http://ftp.us.debian.org/debian/pool/main/t/trojan/trojan_${TROJAN_DEBIAN_VERSION}.dsc
dpkg-source -x trojan_${TROJAN_DEBIAN_VERSION}.dsc trojan-${TROJAN_DEBIAN_VERSION}
cd trojan-${TROJAN_DEBIAN_VERSION}/
dpkg-buildpackage -us -uc -d
sudo dpkg -i ../trojan_${TROJAN_DEBIAN_VERSION}_$(dpkg-architecture -q DEB_BUILD_ARCH).deb
sudo apt purge devscripts debhelper cmake # you can remove it now

Ubuntu

Not for Debian

Pre-compiled binary
https://github.com/trojan-gfw/trojan/releases/latest

18.10 & 19.04


sudo add-apt-repository ppa:greaterfire/trojan
sudo apt-get update
sudo apt-get install trojan

.>=19.04

sudo apt-get install trojan

Arch Linux

sudo apt-get install trojan

安装完毕后,trojan配置文件 /usr/local/etc/trojan/config.json

dingyu

编辑配置文件

peizhi

登录网站个人中心>>我的服务,获取服务器配置信息.

fuwu

设置开机启动

systemctl enable trojan

启动Trojan

systemctl start trojan

检查trojan是否在运行

ss -lp | grep trojan

如果输出为空,可能的原因包括:
1、config.json文件有语法错误:请注意是否少了逗号,有特殊字符等
2、开启了selinux:

setenforce 0

关闭再启动 trojan

运行没问题的话,最后一步是防火墙放行端口。

firewall-cmd --permanent --add-service=https # 端口是443
firewall-cmd --permanent --add-port=端口号/tcp # 其他端口号
firewall-cmd --reload # 重新加载防火墙

注意事项

配置文件中的 remote_addr 和 remote_port 请认真填写。如果使用默认的 127.0.0.1 和 80,
请运行以下命令安装Nginx并放行80端口:

yum install -y epel-release && yum install -y nginx
systemctl enable nginx; systemctl start nginx
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
文档更新时间: 2020-09-04 17:53   作者:Sam