meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
digital:server:matrixsynapse [2019/06/02 20:37]
natrius Step 2 - spelling mistake
digital:server:matrixsynapse [2019/11/28 14:30] (current)
natrius Step 9 - added "working" link
Line 39: Line 39:
 sudo apt install -y lsb-release wget apt-transport-https sudo apt install -y lsb-release wget apt-transport-https
 sudo wget -O /​usr/​share/​keyrings/​matrix-org-archive-keyring.gpg https://​packages.matrix.org/​debian/​matrix-org-archive-keyring.gpg sudo wget -O /​usr/​share/​keyrings/​matrix-org-archive-keyring.gpg https://​packages.matrix.org/​debian/​matrix-org-archive-keyring.gpg
-echo "deb [signed-by=/​usr/​share/​keyrings/​matrix-org-archive-keyring.gpg] https://​packages.matrix.org/​debian/​ $(lsb_release -cs) main" | +echo "deb [signed-by=/​usr/​share/​keyrings/​matrix-org-archive-keyring.gpg] https://​packages.matrix.org/​debian/​ $(lsb_release -cs) main" | sudo tee /​etc/​apt/​sources.list.d/​matrix-org.list
-    ​sudo tee /​etc/​apt/​sources.list.d/​matrix-org.list+
 </​code>​ </​code>​
  
Line 104: Line 103:
 ''​%%enable_registration%%:​ False''​ ''​%%enable_registration%%:​ False''​
  
-''​%%registration_shared_secret%%: ​"%%[shared_secred_key]%%"''​+''​%%registration_shared_secret%%:​ %%[shared_secred_key]%%''​
  
-#### Check listener and federation port+#### Check ports
  
-Now check the HTTP and HTTPS listener port '​8008'​ and the federation port '​8448'​. ​**The best is to leave it default as it comes delivered** (watch here https://​github.com/​matrix-org/​synapse/​blob/​master/​docs/​sample_config.yaml ), so check if it matches the follwing:+**The best is to leave it default as it comes delivered** (watch here https://​github.com/​matrix-org/​synapse/​blob/​master/​docs/​sample_config.yaml ), so check if it matches the follwing:
  
 <​code>​sudoedit /​etc/​matrix-synapse/​homeserver.yaml</​code>​ <​code>​sudoedit /​etc/​matrix-synapse/​homeserver.yaml</​code>​
Line 128: Line 127:
 Now restart the Synapse services. Now restart the Synapse services.
  
-    sudo systemctl ​reload ​matrix-synapse.service+    sudo systemctl ​restart ​matrix-synapse.service
  
 Check the homeserver service with the following command Check the homeserver service with the following command
Line 265: Line 264:
 Nginx installation and configuration as a reverse proxy for the Synapse homeserver has been completed. Nginx installation and configuration as a reverse proxy for the Synapse homeserver has been completed.
  
-### (Optional) Step 6 - Postgre ​instead of sqlite+### (Optional) Step 6 - PostgreSQL ​instead of sqlite
  
 While the step is marked as optional, it is **strongly encouraged** for any server that isn't purely for testing. While the step is marked as optional, it is **strongly encouraged** for any server that isn't purely for testing.
  
-#### Initial ​Postgresql ​setup+#### Initial ​PostgreSQL ​setup
  
 <​code>​sudo apt install postgresql</​code>​ <​code>​sudo apt install postgresql</​code>​
Line 277: Line 276:
 <​code>​postgres=#​ CREATE DATABASE synapse ENCODING '​UTF8'​ LC_COLLATE='​C'​ LC_CTYPE='​C'​ template=template0 OWNER "​username";</​code>​ <​code>​postgres=#​ CREATE DATABASE synapse ENCODING '​UTF8'​ LC_COLLATE='​C'​ LC_CTYPE='​C'​ template=template0 OWNER "​username";</​code>​
  
-Where username can be "​matrix_synapse"​, and password is a new strong password you set for postgresql.+Where username can be ''​synapse_user''​, and password is a new strong password you set for postgresql.
  
 To end the postgre line just type in ''​\q''​ and close the postegre-usershell with ''​exit''​ To end the postgre line just type in ''​\q''​ and close the postegre-usershell with ''​exit''​
  
-#### Set up Postgre ​for Synapse+#### Set up PostgreSQL ​for Synapse
  
 <​code>​sudo apt install python3-psycopg2</​code>​ <​code>​sudo apt install python3-psycopg2</​code>​
Line 302: Line 301:
  
   * ''​user''​ is in this case ''​synapse_user''​   * ''​user''​ is in this case ''​synapse_user''​
-  * ''​Database''​ should be the full path to the db, example ''"​/​var/​lib/​matrix-synapse/​homeserver.db"''​+  * ''​Database''​ should be the above created ​db, example ''"​databse: synpase"''​
   * ''​Host''​ is the postgre hostname, usally ''/​var/​run/​postgresql/''​ or ''​127.0.0.1''​   * ''​Host''​ is the postgre hostname, usally ''/​var/​run/​postgresql/''​ or ''​127.0.0.1''​
  
Line 308: Line 307:
  
 <​code>​ <​code>​
-sudo systemctl ​reload ​matrix-synapse.service+sudo systemctl ​restart ​matrix-synapse.service
 </​code>​ </​code>​
  
Line 333: Line 332:
 At this stage, the Synapse homeserver installation and configuration is complete. And in this step, we need to add a new matrix user from the command line on the server. To create a new matrix user, run the command below. At this stage, the Synapse homeserver installation and configuration is complete. And in this step, we need to add a new matrix user from the command line on the server. To create a new matrix user, run the command below.
  
-    register_new_matrix_user -c homeserver.yaml http://​localhost:​8008+    register_new_matrix_user -c /​etc/​matrix-synapse/​homeserver.yaml http://​localhost:​8008
  
 Now you need to input the user name, password, and decide whether the user will have the admin privileges or not. And we have created a new matrix user with admin privilege. Now you need to input the user name, password, and decide whether the user will have the admin privileges or not. And we have created a new matrix user with admin privilege.
  
-### Step 9 - Federation +### Step 9 - Testing
- +
-You can test if federation is working using https://​federationtester.matrix.org. If any of the checks show an error then federation won't work. Other federation-testers include: +
- +
-  * https://​fed.mau.dev/​ +
- +
-### Step 10 - Testing+
  
 If you have used Riot with the desktop application before you may not want to log out, so it is better to go to [[https://​riot.im/​app/​]] and press "​Launch now". If you have used the web client before, download the Riot desktop application,​ install it and open the Riot software. With both you will get the Matrix login page now. Type the matrix username and password, then choose the '​Custom server'​ option and type the domain name from your server ''​example.com''​ in. Click the ''​Sign In''​ button and you will get to the Riot Dashboard. If you have used Riot with the desktop application before you may not want to log out, so it is better to go to [[https://​riot.im/​app/​]] and press "​Launch now". If you have used the web client before, download the Riot desktop application,​ install it and open the Riot software. With both you will get the Matrix login page now. Type the matrix username and password, then choose the '​Custom server'​ option and type the domain name from your server ''​example.com''​ in. Click the ''​Sign In''​ button and you will get to the Riot Dashboard.
Line 351: Line 344:
 If you need two instances of riot instead, you can start it with argument, refer to [[digital:​software:​riotim|Riot.im]]. If you need two instances of riot instead, you can start it with argument, refer to [[digital:​software:​riotim|Riot.im]].
  
-For another way to test it, go to ''​https://​example.com/​_matrix/​client/​versions''​ and the output should look like the following:+For another way to test it, go to ''​https://​example.com/​_matrix/​static/''​ and you will be presented with a ''​**It works! Synapse is running**''​ screen or go to ''​https://​example.com/​_matrix/​client/​versions''​ and the output should look like the following:
  
 <code xml> <code xml>
Line 362: Line 355:
 3 "​r0.3.0"​ 3 "​r0.3.0"​
 </​code>​ </​code>​
 +
 +### Step 10 - Federation
 +
 +You can test if federation is working using https://​federationtester.matrix.org. If any of the checks show an error then federation won't work. Other federation-testers include:
 +
 +  * https://​fed.mau.dev/​
  
 ## Explanations ## Explanations
Line 427: Line 426:
  
 ### Location of logs ### Location of logs
 +
 +Check matrix with ''​%%journalctl -xe%%''​ and ''​%%systemctl status matrix-synapse%%''​
 +
 +A good way to check the logs is ''​%%tail -20 [PATH]%%''​. ''​tail''​ will show the last lines of a file, with ''​-20''​ it is possible to see the last 20 lines.
 +
 +#### Matrix
  
 <​code>​ <​code>​
-/​etc/​matrix-synapse/​homeserver.log ​ 
 /​var/​log/​matrix-synapse/​homeserver.log /​var/​log/​matrix-synapse/​homeserver.log
 +</​code>​
 +
 +#### Nginx
 +
 +<​code>​
 +/​var/​log/​nginx/​error.log
 +/​var/​log/​nginx/​application.log
 </​code>​ </​code>​
  
Line 465: Line 476:
 For feedback about this guide or tips on how to improve it visit https://​matrix.to/#/#​synapseguide:​matrix.org For feedback about this guide or tips on how to improve it visit https://​matrix.to/#/#​synapseguide:​matrix.org
  
-### ToDo 
- 
-  * More explanations (explain more, because open source documentation is famously sparse) 
-    * what nginx 
-    * reverse proxy 
-    * what is postgre and why is it preferred over sqlite