Manually Deploy Hysteria2

Manually Deploy Hysteria2

After a Synology Docker app is closed, it cannot be restarted and reports the error failed to initialize logging driver database is locked.

The problem is in the log database. In fact, you only need to delete the log.db file. When the app starts again, this file will be recreated automatically. It will not affect the original data, and you do not need to reinstall the app.

Below is a simple guide:

1. Preparation

1.1 Open Ports

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F

1.2 Remove the Firewall

apt-get purge netfilter-persistent
apt-get remove ufw
reboot

1.3 Point the Domain Name to the Server IP

Add an A record at your domain provider.

2. Install the Server

Run the following command:

bash <(curl -fsSL https://get.hy2.sh/)

3. Configure the Server

Enter the following command:

vi /etc/hysteria/config.yaml

3.1 ACME Domain

listen: :443                // Default listen port is 443. You can change it to another port.
acme:
  domains:
    - www.yourdomain.com      // Your domain
  email: [email protected]       // Your email
auth:
  type: password
  password: yourpassword      // Your password
masquerade:
  type: proxy
  proxy:
    url: https://www.bing.com/    // SNI you want to masquerade as
    rewriteHost: true
quic:
  initStreamReceiveWindow: 26843545 
  maxStreamReceiveWindow: 26843545 
  initConnReceiveWindow: 67108864 
  maxConnReceiveWindow: 67108864

3.2 Self-Signed Domain

openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout /etc/hysteria/server.key -out /etc/hysteria/server.crt -subj "/CN=hku.hk" -days 36500 && sudo chown hysteria /etc/hysteria/server.key && sudo chown hysteria /etc/hysteria/server.crt

Modify /etc/hysteria/config.yaml as follows:

listen: :443 # Listen port
tls:
  cert: /etc/hysteria/server.crt
  key: /etc/hysteria/server.key
auth:
  type: password
  password: 123456 # Set authentication password
masquerade:
  type: proxy
  proxy:
    url: https://bing.com # Masquerade URL
    rewriteHost: true
quic:
  initStreamReceiveWindow: 26843545 
  maxStreamReceiveWindow: 26843545 
  initConnReceiveWindow: 67108864 
  maxConnReceiveWindow: 67108864 

After configuring the server, start it:

systemctl start hysteria-server.service

Check server status:

systemctl status hysteria-server.service

Enable auto-start on boot:

systemctl enable hysteria-server.service

At this point, the server setup is complete.


Client configuration is pending.

If configuring manually, add the domain name and fill in your own domain as the SNI masquerade domain.