How to install Matrix on Debian Buster » History » Version 1
Olivier Bitsch, 11/16/2019 12:30 PM
| 1 | 1 | Olivier Bitsch | # How to install Matrix on Debian Buster |
|---|---|---|---|
| 2 | |||
| 3 | You must a Debian Buster server with Public IP address. |
||
| 4 | |||
| 5 | Enable backports, add the following line in /etc/apt/sources.list |
||
| 6 | |||
| 7 | ~~~ |
||
| 8 | deb http://deb.debian.org/debian/ buster-backports main contrib non-free |
||
| 9 | ~~~ |
||
| 10 | |||
| 11 | Then install Matrix |
||
| 12 | |||
| 13 | apt update |
||
| 14 | apt -y install -t buster-backports matrix-synapse |
||
| 15 | |||
| 16 | During the setup, you will be asked to choose the domain, like `climathon.today`. |
||
| 17 | |||
| 18 | You have then to create the following entries into the DNS |
||
| 19 | |||
| 20 | ~~~ |
||
| 21 | matrix.<you-root-domain> A <public IP address of your server> |
||
| 22 | _matrix._tcp.<you-root-domain> SRV 5 443 matrix.<you-root-domain> |
||
| 23 | ~~~ |
||
| 24 | |||
| 25 | Install Nginx |
||
| 26 | |||
| 27 | apt -y install nginx certbot python3-certbot-nginx -t buster-backports |
||
| 28 | |||
| 29 | Do configuration into the file `/etc/matrix-synapse/homeserver.yaml` and update at least the following items. |
||
| 30 | |||
| 31 | ~~~ yaml |
||
| 32 | no_tls: True |
||
| 33 | enable_registration: True |
||
| 34 | trusted_third_party_id_servers: |
||
| 35 | - matrix.org |
||
| 36 | - vector.im |
||
| 37 | - riot.im |
||
| 38 | - uni-shenzhen.com |
||
| 39 | - climathon.today |
||
| 40 | ~~~ |
||
| 41 | |||
| 42 | Install certificates, when requested, just place the domain matrix.<you-root-domain> |
||
| 43 | |||
| 44 | certbot --nginx |
||
| 45 | |||
| 46 | Redirect everything to https when requested. |
||
| 47 | |||
| 48 | Edit the file `/etc/nginx/sites-enabled/default` and add the following into server{} where is your matrix.<you-root-domain> hostname. |
||
| 49 | |||
| 50 | ~~~ |
||
| 51 | location /_matrix { |
||
| 52 | proxy_pass http://localhost:8008; |
||
| 53 | proxy_set_header X-Forwarded-For $remote_addr; |
||
| 54 | } |
||
| 55 | ~~~ |
||
| 56 | |||
| 57 | Install Riot.IM Web interface |
||
| 58 | |||
| 59 | |||
| 60 | cd /var/www/html |
||
| 61 | rm index.nginx-debian.html |
||
| 62 | wget https://github.com/vector-im/riot-web/releases/download/v1.5.3/riot-v1.5.3.tar.gz |
||
| 63 | tar xzvf riot-v1.5.3.tar.gz |
||
| 64 | cp config.sample.json config.json |
||
| 65 | |||
| 66 | Then replace into `config.json` everywhere there is matrix.org |
||
| 67 | |||
| 68 | ~~~ json |
||
| 69 | { |
||
| 70 | "default_server_config": { |
||
| 71 | "m.homeserver": { |
||
| 72 | "base_url": "https://matrix.<you-root-domain>", |
||
| 73 | "server_name": "<you-root-domain>" |
||
| 74 | }, |
||
| 75 | ... |
||
| 76 | "roomDirectory": { |
||
| 77 | "servers": [ |
||
| 78 | "<you-root-domain>" |
||
| 79 | ] |
||
| 80 | }, |
||
| 81 | ~~~ |