- Joined
- 31.10.19
- Messages
- 140
- Reaction score
- 63
- Points
- 28
Connect to the server via SSH, update the packages, and install the necessary packages with the following command:
sudo apt install curl wget gnupg2 apt-transport-https -y
Add the GPG key for Matrix Synapse with the following command:
undefined
Add the Matrix Synapse repository with the following command:
echo "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/matrix-org.list
Install Matrix Synapse with the following commands:
sudo apt-get update
sudo apt-get install matrix-synapse-py3
In the opened window, enter the address of our site in the format matrix.sitename.domainname.
In the next window select "<No>, Matrix Synapse is installed". Start the service with the following commands:
sudo systemctl start matrix-synapse
sudo systemctl enable matrix-synapse
Now it's necessary to configure Matrix Synapse. Generate a secret key with the following command:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
Copy the output value. Open the server configuration file with the command:
sudo nano /etc/matrix-synapse/homeserver.yaml
Change the following lines:
bind_addresses: ['127.0.0.1']
enable_registration: true
registration_shared_secret: "paste the value from the previous command"
Save the changes and restart the service with the following command:
sudo systemctl restart matrix-synapse
Next, let's set up a reverse proxy on Nginx. Install Nginx:
sudo apt-get install nginx
Create an Nginx configuration file:
sudo nano /etc/nginx/conf.d/matrix.conf
Add the following lines to this file:
server {
listen 80;
server_name sitename.domainname; #your website address
location / {
proxy_pass http://localhost:8008;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
Save the changes and check the configuration with the following command:
nginx -t
If everything is correct, restart the service with the following command:
sudo systemctl restart nginx
Create a root user on our server with the following command:
register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008
Enter a username, then enter the password twice. When prompted to make admin type yes and press Enter.
Enable Let's Encrypt. Install Certbot with the following command:
sudo apt install certbot python3-certbot-nginx
Enter the following command to configure the SSL certificate:
certbot --nginx -d your_domain
Enter your e-mail and agree to the service's rules. Next step: enter Y if you want to receive email newsletters from EEF. Then you can check the functionality of your server by visiting your site, where an image with the text [matrix] will be displayed. This completes the installation: you can register an account and start communicating.