Project

General

Profile

Actions

Task #6170

closed

Setup a matrix server

Added by Jin-Guk Kwon over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Start date:
12/01/2018
Due date:
12/02/2018
% Done:

100%

Estimated time:
42.00 h
PM Check date:

Description

setup a matrix server on VM

jinguk


Files

matrix.pptx (337 KB) matrix.pptx Jin-Guk Kwon, 12/02/2018 12:07 PM
Actions #1

Updated by Jin-Guk Kwon over 5 years ago

  • Description updated (diff)
  • Assignee set to Jin-Guk Kwon
Actions #2

Updated by Jin-Guk Kwon over 5 years ago

matrix.lab.ungleich.ch 2a0a:e5c0:2:12:400:f0ff:fea9:c3f6

Actions #3

Updated by Jin-Guk Kwon over 5 years ago

apt-get update
apt-get install wget
wget qO - https://matrix.org/packages/debian/repo-key.asc | sudo apt-key add -
add-apt-repository https://matrix.org/packages/debian/
apt-get install matrix-synapse -y
-
>server name - type the matrix domain name
-->for the anonymous data report, choose 'No'
systemctl start matrix-synapse
systemctl enable matrix-synapse
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
vi /etc/matrix-synapse/homeserver.yaml

port: 8448
    bind_addresses:
      - '::'
      -'0.0.0.0'
port: 8008
    bind_addresses: ['::1', '127.0.0.1']
enable_registration: False
registration_shared_secret: "copy from generated code" 

systemctl restart matrix-synapse
apt-get install letsencrypt -y
certbot certonly --rsa-key-size 2048 --standalone --agree-tos --no-eff-email --email [e-mail] -d [server_domain_name]
apt-get nginx -y
systemctl start nginx
systemctl enable nginx
vi /etc/nginx/sites-available/matrix
server {
       listen 80;
       server_name matrix.hakase-labs.io;
       return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name [domain_name];

    ssl_certificate /etc/letsencrypt/live/[domain_name]/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/[domain_name]/privkey.pem;

    # If you don't wanna serve a site, comment this out
    root /var/www/html;
    index index.html index.htm;

    location /_matrix {
      proxy_pass http://localhost:8008;
      proxy_set_header X-Forwarded-For $remote_addr;
    }
}

root@ubuntu:/etc/nginx/sites-available# ln -s /etc/nginx/sites-available/matrix /etc/nginx/sites-enabled/
root@ubuntu:/etc/nginx/sites-enabled# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@ubuntu:/etc/nginx/sites-enabled# systemctl restart nginx
root@ubuntu:/etc/nginx/sites-enabled# ufw allow ssh
Rules updated
Rules updated (v6)
root@ubuntu:/etc/nginx/sites-enabled# ufw allow http
Rules updated
Rules updated (v6)
root@ubuntu:/etc/nginx/sites-enabled# ufw allow https
Rules updated
Rules updated (v6)
root@ubuntu:/etc/nginx/sites-enabled# ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
root@ubuntu:/etc/nginx/sites-enabled# ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)

root@ubuntu:/etc/nginx/sites-enabled# register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml https://localhost:8448
New user localpart [root]: ungleich
Password:
Confirm password:
Make admin [no]: yes
Sending registration request...
Success!
root@ubuntu:/etc/nginx/sites-enabled#
Actions #4

Updated by Jin-Guk Kwon over 5 years ago

Actions #5

Updated by Jin-Guk Kwon over 5 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Jin-Guk Kwon over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF