How to Install and Use Lnav Log Viewer on Ubuntu 16.04 LTS

Matrix is a brand new ecosystem for decentralized communication in actual time for open federated prompt messaging and VoIP providers. It gives RESTful HTTP JSON APIs for constructing distributed and federated chat servers with no single level of management and failure and gives all references for the APIs.

Synapse is an implementation of the matrix homeserver that is created by matrix crew and written in Python/Twisted. With this software program, we will implement the matrix method for decentralized communication, we will create our own residence server and retailer all consumer private information, chat historical past, create the room for personal use, and so on.

On this tutorial, we are going to present you step-by-step the right way to set up and configure Matrix Synapse on Ubuntu 18.04. We are going to configure Matrix Synapse on the native IP deal with, and configure the Nginx internet server as a reverse proxy for it, and implement the HTTPS connection between purchasers and the front-end Nginx internet server.

Conditions

  • Ubuntu 18.04
  • Root privileges
  • Matrix Area title or sub-domain – matrix.hakase-labs.io

What we are going to do?

  1. Replace and Improve the Ubuntu 18.04 System
  2. Set up Matrix Synapse
  3. Configure Matrix Synapse
  4. Generate SSL Letsencrypt
  5. Set up and Configure Nginx as a Reverse proxy for Matrix Synapse
  6. Setup UFW Firewall
  7. Setup New Matrix Consumer
  8. Testing

Step 1 – Replace and Improve System

Login to your Ubuntu server, replace the repository and improve all packages utilizing the apt command under.

sudo apt replace
sudo apt improve

And all ubuntu packages have been upgraded.

Step 2 – Set up Matrix Synapse

On this step, we are going to set up the matrix synapse software program utilizing the Debian packages from the official matrix repository.

Add the matrix key and repository by operating all instructions under.

wget -qO – https://matrix.org/packages/debian/repo-key.asc | sudo apt-key add –
sudo add-apt-repository https://matrix.org/packages/debian/

The command will mechanically replace the repository.

Install Matrix Synapse

Now set up matrix synapse utilizing the apt command as under.

sudo apt set up matrix-synapse -y

Throughout the set up, it is going to ask you concerning the matrix server title – sort the matrix area title ‘matrix.hakase-labs.io’.

Matrix synapse apt installer - part 1

And for the nameless information report, select ‘No’.

Matrix synapse apt installer - part 1

When the matrix synapse set up is full, begin the service and allow it to launch everytime at system boot.

sudo systemctl begin matrix-synapse
sudo systemctl allow matrix-synapse

The matrix synapse is now up and operating utilizing the default configuration on port ‘8008’ and ‘8448’. Examine utilizing netstat command.

netstat -plntu

Check open ports

Step 3 – Configure Matrix Synapse

After the matrix synapse set up, we are going to configure it to run below the native IP deal with, disable matrix synapse registration, and allow the registration-shared-secret.

Earlier than modifying the house server configuration, we have to generate the shared secret key.

Run the command under.

cat /dev/urandom | tr -dc ‘a-zA-Z0-9’ | fold -w 32 | head -n 1

And you’ll get the generated key. Copy the outcome key.

Now we have to edit the house server configuration file ‘homeserver.yaml’ on the ‘/and so on/matrix-synapse/’ listing. Change the present listing to ‘/and so on/matrix-synapse’ and edit the configuration file utilizing vim.

cd /and so on/matrix-synapse/
vim homeserver.yaml

Change the HTTP and HTTPS Listener port ‘8008’ and ‘8448’ to the native IP deal with ‘127.0.0.1’.

    port: 8448
     bind_addresses:
       - '127.0.0.1'
 
     - port: 8008
     bind_addresses: ['127.0.0.1']

Matrix Synapse configuration

Matrix Synapse port config

Disable the matrix synapse registration, uncomment the ‘registration_shared_secret’ configuration and paste the key key generated.

enable_registration: False
 registration_shared_secret: "MtkF9JOkNHsRRISyR5L91KAQlrrPhyWX"

Save and exit.

Be aware:

registration_shared_secret: If set permits registration by anybody who additionally has the shared secret, even when registration is disabled.

Now restart the matrix synapse providers.

sudo systemctl restart matrix-synapse

restart matrix-synapse

Examine the homeserver service utilizing the command under.

netstat -plntu

You’ll get the matrix synapse service is now on the native IP deal with.

Check Matrix Synapse Ports

And we have now accomplished the matrix synapse set up and configuration.

Step 4 – Generate SSL Letsencrypt Certificates

On this tutorial, we are going to allow HTTPS for the Nginx reverse proxy, and we are going to generate the SSL certificates recordsdata from Letsencrypt.

Set up the letsencrypt software utilizing the apt command under.

sudo apt set up letsencrypt -y

The Letsencrypt software is put in on the system, now generate the SSL certificates recordsdata for the matrix area title ‘matrix.hakase-labs.io’ utilizing the certbot command as proven under.

certbot certonly –rsa-key-size 2048 –standalone –agree-tos –no-eff-email –email [email protected] -d matrix.hakase-labs.io

The Letsencrypt software will generate SSL certificates recordsdata by operating the ‘standalone’ short-term internet server for verification.

And when it is full, you’ll get the outcome as proven under.

Generate SSL Letsencrypt Certificates

SSL certificates recordsdata for the matrix synapse area title ‘matrix.hakase-labs.io’ is generated contained in the ‘/and so on/letsencrypt/reside/’ listing.

Step 5 – Set up and Configure Nginx as a Reverse Proxy

On this step, we are going to set up the Nginx internet server and configure it as a reverse proxy for dwelling server that’s operating on the port ‘8008’.

Set up the Nginx internet server utilizing the apt command under.

sudo apt set up nginx -y

After the set up is full, begin the service and allow it to launch everytime at system boot

sudo systemctl begin nginx
sudo systemctl allow nginx

Subsequent, we are going to create a brand new digital host configuration for the matrix area title ‘matrix.hakase-labs.io’.

Go to the ‘/and so on/nginx’ configuration listing and create a brand new digital host file ‘matrix’.

cd /and so on/nginx/
vim sites-available/matrix

Paste the next configuration there.

server {
        hear 80;
        server_name matrix.hakase-labs.io;
        return 301 https://$server_name$request_uri;
 }
 
 server {
     hear 443 ssl;
     hear [::]:443 ssl;
     server_name matrix.hakase-labs.io;
 
     ssl_certificate /and so on/letsencrypt/reside/matrix.hakase-labs.io/fullchain.pem;
     ssl_certificate_key /and so on/letsencrypt/reside/matrix.hakase-labs.io/privkey.pem;
 
     # If you happen to do not wanna serve a web site, remark this out
     root /var/www/html;
     index index.html index.htm;
 
     location /_matrix {
       proxy_pass http://127.0.0.1:8008;
       proxy_set_header X-Forwarded-For $remote_addr;
     }
 }
 

Save and exit.

Activate the digital host file and check the configuration.

ln -s /and so on/nginx/sites-available/matrix /and so on/nginx/sites-enabled/
nginx -t

Be sure there is no such thing as a error, then restart the Nginx providers.

sudo systemctl restart nginx

Nginx set up and configuration as a reverse proxy for the Matrix Synapse homeserver has been accomplished.

Configure Nginx

Step 6 – Setup UFW Firewall

On this tutorial, we are going to solely open three ports for our providers. We are going to solely permit SSH, HTTP, and HTTPS connection on the UFW firewall configuration.

Add the SSH, HTTP, and HTTPS providers to the UFW firewall configuration by operating the command under.

ufw permit ssh
ufw permit http
ufw permit https

setup UFW firewall

Now allow the UFW firewall service after which verify the standing.

ufw allow
ufw standing

And you’ll get the outcome as proven under.

Check Firewall status

And we have accomplished the UFW firewall configuration.

Step 7 – Create a New Matrix Consumer

At this stage, the matrix synapse homeserver set up and configuration is full. And on this step, we are going to present you the right way to add a brand new matrix consumer from the command line server.

To create a brand new matrix consumer, run the command under.

register_new_matrix_user -c /and so on/matrix-synapse/homeserver.yaml https://127.0.0.1:8448

Now you want to enter the consumer title, password, and resolve whether or not the consumer may have the admin privileges or not.

Under is the outcome on my system.

Create a New Matrix User

And we have now created a brand new matrix consumer named ‘hakase’ with admin privilege.

Step 8 – Testing

Obtain the Riot desktop software in your working system and set up it.

Open the Riot software program and you’ll get the Matrix login web page as under.

Test Matrix Synapse

Sort the matrix username and password, then select the ‘Customized server’ possibility and sort the customized area title ‘matrix.hakase-labs.io’.

Click on the ‘Signal In’ button.

And now you’ll get the Riot Dashboard.

Riot Dashboard

The Matrix Synapse dwelling server is up and operating below the Nginx reverse proxy HTTPS connection, and the ‘hakase’ consumer is now logged in to the matrix homeserver utilizing the Riot software desktop.

Matrix consumer configuration.

User settings

Matrix chat consumer as a Group.

Matrix Chat

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here