Prechádzať zdrojové kódy

0662: Running Matrix Synapse Home Server in Docker on Ubuntu Server

i12bretro 3 rokov pred
rodič
commit
7d4f29c83e
1 zmenil súbory, kde vykonal 116 pridanie a 0 odobranie
  1. 116 0
      0662.html

+ 116 - 0
0662.html

@@ -0,0 +1,116 @@
+    <!DOCTYPE html>
+    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+      <head>
+        <title>Running Matrix Synapse Home Server in Docker on Ubuntu Server</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+        <meta charset="UTF-8">
+        <meta name="keywords" content="Home Lab,Home Lab Ideas,Docker Made Easy,Install Guide,Self-Hosted,Chat,Container,Containerization,Docker,Docker How To,Docker Installation Tutorial,Docker Simplified,Docker Tutorial,Element,Encrypted Communication,Free Software,Getting Started With Docker,Encryption,End To End Encrpytion,Ubuntu,Synapse,Self-hosted,Secure Communication Server,Secure Communication,Secure Chat,Instant Messaging,How To,Tutorial,i12bretro">
+        <meta name="author" content="i12bretro">
+        <meta name="description" content="Running Matrix Synapse Home Server in Docker on Ubuntu Server">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <meta name="revised" content="05/15/2022 08:37:11 PM" />
+				          <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
+				  <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
+				        <script type="text/javascript" src="includes/js/steps.js"></script>
+        <link href="css/steps.css" rel="stylesheet" type="text/css" />
+      </head>
+      <body>
+        <div id="gridContainer">
+          <div class="topMargin"></div>
+          <div id="listName" class="topMargin">
+            <h1>Running Matrix Synapse Home Server in Docker on Ubuntu Server</h1>
+          </div>
+          <div></div>
+          <div id="content">
+          <h2>What is Matrix?</h2>
+
+<blockquote><em>Matrix is an open source project that publishes the Matrix open standard for secure, decentralised, real-time communication, and its Apache licensed reference implementations. -<a href="https://matrix.org" target="_blank">https://matrix.org</a></em></blockquote>
+
+<h2>Installing Docker</h2>
+
+<ol>
+	<li>Log into the Linux host</li>
+	<li>Run the following commands in a terminal window
+	<div class="codeBlock"># install prerequisites<br />
+	sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y<br />
+	# add docker gpg key<br />
+	curl -fsSL https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release)/gpg | sudo apt-key add -<br />
+	# add docker software repository<br />
+	sudo add-apt-repository &quot;deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release) $(lsb_release -cs) stable&quot;<br />
+	# install docker<br />
+	sudo apt install docker-ce docker-compose containerd.io -y<br />
+	# enable and start docker service<br />
+	sudo systemctl enable docker &amp;&amp; sudo systemctl start docker<br />
+	# add the current user to the docker group<br />
+	sudo usermod -aG docker $USER<br />
+	# reauthenticate for the new group membership to take effect<br />
+	su - $USER</div>
+	</li>
+</ol>
+
+<h2>Running Matrix Synapse</h2>
+
+<ol>
+	<li>Continue with the following commands in terminal to setup and run Matrix Synapse
+	<div class="codeBlock"># create working directories<br />
+	sudo mkdir ~/docker/matrix-synapse -p &amp;&amp; sudo mkdir ~/docker/postgresql -p<br />
+	# set owner of docker directory<br />
+	sudo chown &quot;$USER&quot;:&quot;$USER&quot; ~/docker -R<br />
+	# run the postgesql docker container<br />
+	docker run -d --name postgres -e POSTGRES_USER=matrix_synapse_rw -e POSTGRES_PASSWORD=m@trix! -e POSTGRES_DB=matrix_synapse -e LC_COLLATE=&#39;C&#39; -e LC_CTYPE=&#39;C&#39; -e POSTGRES_INITDB_ARGS=&quot;--encoding=UTF-8&quot; -v ~/docker/postgresql:/var/lib/postgresql/data --restart=unless-stopped postgres:latest<br />
+	# generate synapse homeserver.yaml<br />
+	docker run -it --rm -v ~/docker/matrix-synapse:/data -e SYNAPSE_SERVER_NAME=my.matrix.host -e SYNAPSE_REPORT_STATS=no matrixdotorg/synapse:latest generate<br />
+	# edit the homeserver.yaml file<br />
+	sudo nano ~/docker/matrix-synapse/homeserver.yaml</div>
+	</li>
+	<li>Press CTRL+W and search for name: server_name
+	<p>server_name: &quot;YOUR.MATRIX.DNS&quot;</p>
+	</li>
+	<li>Press CTRL+W and search for name: sqlite3</li>
+	<li>Comment out the sqlite database parameters by adding a # to the beginning of each of the lines</li>
+	<li>Arrow up slightly and uncomment the psycopg2 database connection and complete it as follows:
+	<p>datebase:<br />
+	&emsp;name: psycopg2<br />
+	&emsp;txn_limit: 10000<br />
+	&emsp;args:<br />
+	&emsp; user: matrix_synapse_rw<br />
+	&emsp; password: m@trix!<br />
+	&emsp; database: matrix_synapse<br />
+	&emsp; host: postgres<br />
+	&emsp; port: 5432<br />
+	&emsp; cp_min: 5<br />
+	&emsp; cp_max: 10</p>
+	</li>
+	<li>Add the following line at the bottom of the file
+	<p>suppress_key_server_warning: true</p>
+	</li>
+	<li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
+	<li>Continue with the following commands in terminal
+	<div class="codeBlock"># generate a random string<br />
+	RANDOMSTRING=$(openssl rand -base64 30)<br />
+	# write the random string as registration_shared_secret<br />
+	echo &quot;registration_shared_secret: $RANDOMSTRING&quot; | sudo tee -a ~/docker/matrix-synapse/homeserver.yaml &gt; /dev/null<br />
+	# run the matrix synapse container<br />
+	docker run -d --name matrix-synapse --link postgres -v ~/docker/matrix-synapse:/data -p 8008:8008 --restart=unless-stopped matrixdotorg/synapse:latest<br />
+	# create a new synapse user<br />
+	docker exec -it matrix-synapse register_new_matrix_user http://DNSorIP:8008 -c /data/homeserver.yaml</div>
+	</li>
+	<li>Enter a username, enter and confirm the password and choose if the user is an admin</li>
+	<li>At this point the Matrix Synapse server is running over http</li>
+	<li>Open a web browser and navigate to the http://DNSorIP:8008</li>
+	<li>A message stating It works! Synapse is running should be displayed</li>
+	<li>Navigate to https://element.io/get-started#download</li>
+	<li>Download and install Element</li>
+	<li>Run the Element application</li>
+	<li>Click Sign In</li>
+	<li>Click the Edit link next to matrix.org</li>
+	<li>Select Other homeserver &gt; type http://DNSorIP:8008 &gt; Click Continue</li>
+	<li>Login using the Synapse username and password created earlier</li>
+</ol>
+
+<p>Documentation: <a href="https://registry.hub.docker.com/r/matrixdotorg/synapse/" target="_blank">https://registry.hub.docker.com/r/matrixdotorg/synapse/</a></p>
+          </div>
+        </div>
+      </body>
+    </html>
+