Skip to content

Running Without Docker

Alexander Bersenev edited this page Nov 30, 2019 · 3 revisions

The proxy can be started without Docker (for advanced users)

Single Starting

  1. git clone -b stable https://github.com/alexbers/mtprotoproxy.git; cd mtprotoproxy
  2. (optional, recommended) edit config.py, set PORT, USERS and AD_TAG
  3. python3 mtprotoproxy.py

The proxy will run until the ssh-session or terminal-session is closed.

Autostarting on Boot

This instruction is valid on Linux with systemd (most modern OSes including Ubuntu, Debian, CentOS, RHEL, Gentoo, etc). You should have Python3 and git installed

  1. git clone -b stable https://github.com/alexbers/mtprotoproxy.git /opt/mtprotoproxy; cd /opt/mtprotoproxy
  2. (optional, recommended) edit config.py, set PORT, USERS and AD_TAG
  3. Create tgproxy user: useradd --no-create-home -s /usr/sbin/nologin tgproxy
  4. (optional, recommended) install cryptography Python module
  5. (optional) install uvloop Python module
  6. Create file /etc/systemd/system/mtprotoproxy.service with the following content:
[Unit]
    Description=Async MTProto proxy for Telegram
    After=network-online.target
    Wants=network-online.target

[Service]
    ExecStart=/opt/mtprotoproxy/mtprotoproxy.py
    AmbientCapabilities=CAP_NET_BIND_SERVICE
    LimitNOFILE=infinity
    User=tgproxy
    Group=tgproxy
    Restart=on-failure

[Install]
    WantedBy=multi-user.target
  1. Enable autostarting on boot: systemctl enable mtprotoproxy
  2. (optional, start the proxy) systemctl start mtprotoproxy
  3. (optional, get a link to share the proxy) journalctl -u mtprotoproxy | cat
Clone this wiki locally