###############################################################
#
README —
https://github.com/tinode/chat/blob/master/INSTALL.md #
###############################################################
1) Download archive GO - https://go.dev/doc/install:
# wget -P /usr/local/
https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
2) Be sure to remove previous versions 'rm -rf /usr/local/go' and
unzip the GO archive:
# cd /usr/local
# tar -xvzf go1.21.0.linux-amd64.tar.gz
3) Adding lines 'nano ~/.profile' to end of file:
[...]
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
[...]
Save and close the file. Update your settings:
# source ~/.profile
4) Checking the version GO:
# go version
(go version go1.21.0 linux/amd64)
5) Installing the database MariaDB:
# apt install mariadb-server
Checking the functionality:
# systemctl status mariadb
(If you need to change 'root' password for MySQL)
# mysql -u root
Run the following commands:
==========================
[...]
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
mysql> quit
[...]
==========================
6) Create a Tinode server and database initialize Tinode-db:
# go install -tags mysql
github.com/tinode/chat/server@latest
# go install -tags mysql
github.com/tinode/chat/tinode-db@latest
7) Open configuration file Tinode:
# nano
$GOPATH/pkg/mod/
github.com/tinode/ch...@vX.XX.XX/server/tinode.conf
(where X.XX.X is the version you installed)
If you are using MySQL, be sure to include the adapter name in the
config file 'tinode.conf':
==========================
[...]
"store_config": {
"use_adapter": "
mysql",
},
[...]
(If necessary, specify the ROOT password for the database)
[...]
"User": "root",
"Passwd": "password-mariadb",
[...]
==========================
8) Run database initializer:
# cd $GOPATH/pkg/mod/
github.com/tinode/ch...@v0.22.10
# $GOPATH/bin/init-db -config=./tinode-db/tinode.conf
-data=./tinode-db/data.json
Create folder '$HOME/tinode/webapp' upload and unpack archives:
# wget
https://github.com/tinode/webapp/archive/master.zip
# wget
https://github.com/tinode/tinode-js/archive/master.zip
Unzip archive:
# unzip master.zip
10) Create symlink template:
# ln -s
$GOPATH/pkg/mod/
github.com/tinode/ch...@v0.22.10/server/templ
$GOPATH/pkg/mod/
github.com/tinode/ch...@v0.22.10
11) Start server Tinode:
# cd $GOPATH/pkg/mod/
github.com/tinode/ch...@v0.22.10
# $GOPATH/bin/tinode -config=./server/tinode.conf
-static_data=$HOME/tinode/webapp/
12) Create ROOT user:
# $GOPATH/bin/tinode-db -auth=ROOT -uid=usrFMx8Tg123
-scheme=basic
# mysql -u root
[...]
mysql> USE 'tinode';
mysql> UPDATE auth SET authlvl=30 WHERE
uname='basic:login-of-the-user-to-make-root';
mysql> quit
[...]
Test the installation by pointing in the browser
http://localhost:6060/.
Static files along the path '-static_data' are stored in the 'root'
directory.
You can change this by editing the 'static_mount' line in the config
file 'tinode.conf'
==========================
If you configured Certbot make sure to change the port
'tinode.conf':
[...]
"listen": ":6060", => "listen": ":443",
[...]
==========================
#######################################
#
Obtaining SSL-certificates with Certbot #
#######################################
1) Installing Certbot is recommended using a 'snap' package:
# sudo apt install snapd
# sudo snap install core
(core 16-2.60.2 from Canonical installed)
# sudo snap refresh core
(snap "core" has no updates available)
Then you can install the certbot package:
# sudo apt install --classic certbot
(certbot 2.6.0 from Certbot Project (certbot-eff) installed)
Next, you need to create a symlink to the certbot command
# sudo ln -s /snap/bin/certbot /usr/bin/certbot
2) We get a certificate with the '–standalone' option, use the -d
flag to specify the domain:
# sudo certbot certonly --standalone -d your_domain
==========================
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel):
us...@domain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf.
You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
(Y)es/(N)o: y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
Would you be willing, once your first certificate is successfully
issued, to
share your email address with the Electronic Frontier Foundation, a
founding
partner of the Let's Encrypt project and the non-profit organization
that
develops Certbot? We'd like to send you email about our work
encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
(Y)es/(N)o: n
==========================
When you run the command, you will be prompted to enter an email and
agree to the terms of service.
########################################
#
Screen — hide programs in background #
########################################
# sudo apt install screen
Run by the command:
# screen
To minimize the running screen along with all the contents, press
Ctrl + A, then press D.
The list of running screens can be viewed using:
# screen -ls
In order to return to the minimized screen, just click:
# screen -r
Shutdown "Screen" with command:
# exit
p.s.
It works checked !!