# trojan-gfw on freebsd



## mybsd (Aug 3, 2021)

Everyone who have installed trojan-gfw on webpage
trojan-gfw

knows that you should install trojan-gfw server side in vps server and trojan-gfw client side in local os.
Install trojna-gfw server in vps server this way:

Prepare domain name :

bind a domain name with vps_ip

Install tools:


> sudo apt install trojan  apache2
> sudo apt install gnutls-bin gnutls-doc



Create model file.


> vim ca.tmpl
> cn = "domain.com"
> organization = "ff"
> serial = 1
> ...



Create and put the certification file and key.



> certtool --generate-privkey --outfile ca-key.pem
> certtool --generate-privkey --outfile server-key.pem
> certtool --generate-certificate --load-privkey server-key.pem --load-ca-certificate ca-cert.pem \
> --load-ca-privkey ca-key.pem --template server.tmpl \
> ...



Set configuration :


> sudo vim  /etc/trojan/config.json
> {
> "run_type": "server",
> "local_addr": "0.0.0.0",
> ...


Create trojan service on server:


> sudo vim /etc/systemd/system/trojan.service
> [Unit]
> Description=trojan
> Documentation=https://trojan-gfw.github.io/trojan/config https://trojan-gfw.github.io/trojan/
> ...


Open ports:


> sudo ufw allow 443
> sudo ufw allow 80
> sudo ufw reload
> sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/trojan



Install trojna-gfw client in local os:



> sudo apt install trojan
> #get ca-cert file from vps.
> sudo scp root@vps_ip:/root/ca-cert.pem  /etc/trojan
> 
> ...



Both trojan server and client installed on debian.
Can someone here write a tutorial to introduce how to install trojan-gfw server side in vps server (runs freebsd) and trojan-gfw client side in local os(runs freebds)?


----------

