Trojan搭建教程
我在搭建时候遇到最大的问题就是镜像源,我这个是在centos7上面安装的,rocky7应该通用,别的需要换对应的源。
第一次update用下面的镜像源
sudo vi /etc/yum.repos.d/CentOS-Base.repo,写入如下内容
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
更新源
centos操作系统:
yum update -y && yum install curl -y
ubuntu操作系统:
apt-get update -y && apt-get install curl -y
输入一键安装脚本
source <(curl -sL https://git.io/trojan-install)
跟着安装脚本做完。
trojan安装完成,提示重启trojan成功后,选择证书方式:Let’s Encrypt证书,输入注册的域名(需要dns解析到该主机ip)。
以上都做完以后如果不能访问https,那就是证书还有问题,需要更换镜像源。
下载源
1、安装wget
yum install -y wget
2、下载CentOS 7的repo文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、更新镜像源
清除缓存:yum clean all
生成缓存:yum makecache
这个时候再输入trojan命令,选择第三个安装管理,再选择第二个证书申请,再次选择Let’s Encrypt 证书,这时候输入你的域名,更新完毕后就可以使用https了。