Created
August 26, 2021 03:37
-
-
Save edwardsharp/324fdefc877a2d968650c601e22ed7b7 to your computer and use it in GitHub Desktop.
setup synapse, a matrix.org homeserver on debian 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup synapse, a matrix.org homeserver | |
# | |
# note: this is intended to be a list of commandz, | |
# not a executable script... | |
# | |
# mostly ripped from https://upcloud.com/community/tutorials/install-matrix-synapse/ | |
# and https://github.com/matrix-org/synapse/blob/develop/docs/setup/installation.md | |
su root | |
apt-get update | |
apt-get install build-essential python3-dev libffi-dev \ | |
python-pip python-setuptools sqlite3 \ | |
libssl-dev python-virtualenv libjpeg-dev libxslt1-dev | |
adduser synapse | |
su synapse | |
mkdir -p ~/synapse | |
virtualenv -p python3 ~/synapse/env | |
source ~/synapse/env/bin/activate | |
pip install --upgrade pip virtualenv six packaging appdirs | |
pip install --upgrade setuptools | |
pip install matrix-synapse | |
source ~/synapse/env/bin/activate | |
pip install -U matrix-synapse | |
cd ~/synapse | |
python -m synapse.app.homeserver \ | |
--server-name synapse.ifitis.org \ | |
--config-path homeserver.yaml \ | |
--generate-config \ | |
--report-stats=yes | |
su root | |
apt-get install snapd -y | |
snap install core; snap refresh core | |
snap install --classic certbot | |
ln -s /snap/bin/certbot /usr/bin/certbot | |
apt-get install nginx | |
certbot certonly --nginx -d synapse.ifitis.org | |
nano /etc/nginx/conf.d/matrix.conf | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name synapse.ifitis.org; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
listen [::]:443 ssl; | |
server_name synapse.ifitis.org; | |
ssl on; | |
ssl_certificate /etc/letsencrypt/live/synapse.ifitis.org/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/synapse.ifitis.org/privkey.pem; | |
location / { | |
proxy_pass http://localhost:8008; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
} | |
} | |
server { | |
listen 8448 ssl default_server; | |
listen [::]:8448 ssl default_server; | |
server_name synapse.ifitis.org; | |
ssl on; | |
ssl_certificate /etc/letsencrypt/live/synapse.ifitis.org/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/synapse.ifitis.org/privkey.pem; | |
location / { | |
proxy_pass http://localhost:8008; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
} | |
} | |
su synapse | |
nano ~/synapse/homeserver.yaml | |
- port: 8008 | |
tls: false | |
bind_addresses: ['127.0.0.1'] | |
type: http | |
x_forwarded: true | |
su root | |
systemctl restart nginx | |
systemctl enable nginx | |
su synapse | |
cd ~/synapse | |
source env/bin/activate | |
synctl start | |
register_new_matrix_user -c homeserver.yaml http://localhost:8008 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment