setup/jami-on-a-server.md: create Jami on a server
https://forum.jami.net/t/jami-sur-serveur/4510 Change-Id: I81296a3803499022357de0a9ef65a72ad28d0c7e
This commit is contained in:
parent
2243762cab
commit
f7fe3ad683
|
@ -62,6 +62,10 @@ If a JAMI protocol account has no account backup and is removed from all linked
|
|||
|
||||
Back up all JAMI protocol accounts.
|
||||
|
||||
## Jami on a server
|
||||
|
||||
[Click here to set up Jami on a server that is always online.](jami-on-a-server.md)
|
||||
|
||||
## Jami extensions
|
||||
|
||||

|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
# Jami on a server
|
||||
|
||||
```{note}
|
||||
Add an existing Jami account with group conversations to a server that is always online to facilitate message exchange.
|
||||
```
|
||||
|
||||
## Create a user account on the server
|
||||
|
||||
It is recommended that a user account, without root permissions, be added to the server to run Jami.
|
||||
In this example, the `jamiserver` user account was added with the command:
|
||||
|
||||
```bash
|
||||
useradd -s /bin/bash -m jamiserver
|
||||
```
|
||||
|
||||
## Install the Jami daemon on the server
|
||||
|
||||
Install the Jami daemon on the server (the full Jami client is not required to be installed, especially if the server does not have a graphical user interface) by following the installation instructions for the server's GNU/Linux distribution: [Download Jami for GNU/Linux](https://jami.net/download-jami-linux/); however, for say Ubuntu/Debian, replace the command:
|
||||
|
||||
```bash
|
||||
apt-get install jami
|
||||
```
|
||||
|
||||
with the command:
|
||||
|
||||
```bash
|
||||
apt-get install jami-daemon dbus-x11
|
||||
```
|
||||
|
||||
## Copy the Jami configuration
|
||||
|
||||
A copy of the Jami configuration files is required on the server.
|
||||
If the Jami account is already configured on a computer (in this example, a computer is running GNU/Linux), copy the `.local/share/jami` and `.config/jami` directories to the server.
|
||||
|
||||
The commands below must be run from the home directory of the user.
|
||||
The server must be accessible via SSH from the computer where Jami is already installed, and the `jamiserver` user on the server must have a password (or the public SSH key of the user on the already configured computer).
|
||||
|
||||
```bash
|
||||
cd
|
||||
rsync -av .local/share/jami jamiserver@SERVER_NAME_OR_IP_ADDR:~/.local/share/
|
||||
rsync -av .config/jami jamiserver@SERVER_NAME_OR_IP_ADDR:~/.config/
|
||||
```
|
||||
|
||||
On the server, log in as the `jamiserver` user and ensure that the directories have been copied correctly.
|
||||
|
||||
```bash
|
||||
cd
|
||||
ls -a .local/share/jami
|
||||
ls -a .config/jami
|
||||
```
|
||||
|
||||
```{note}
|
||||
The owner of the server directories must be the `jamiserver` user, not the `root` user.
|
||||
```
|
||||
|
||||
## Create a script to launch Jami on the server
|
||||
|
||||
Create a script to launch Jami on the server with the Jami Daemon (jamid) and the D-Bus (dbus) by creating (as root) the `/usr/local/bin/launchjami` file and adding the following contents:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
dbus-launch --auto-syntax|grep DBUS_SESSION_BUS_ADDRESS >/tmp/env-jamiserver
|
||||
source /tmp/env-jamiserver
|
||||
/usr/libexec/jamid
|
||||
```
|
||||
|
||||
```{note}
|
||||
The `/usr/libexec/jamid` file was created from the `jami-daemon` package installed at the beginning.
|
||||
```
|
||||
|
||||
Ensure that the script is executable with:
|
||||
|
||||
```bash
|
||||
chmod +x /usr/local/bin/launchjami
|
||||
```
|
||||
|
||||
To start Jami on the server as a service, create the `jamiserver` systemd unit file that will run the script file by creating the `/etc/systemd/system/jamiserver.service` file as root and adding the following configuration:
|
||||
|
||||
```bash
|
||||
[Unit]
|
||||
Description=Daemon Jami for my project
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/launchjami
|
||||
ExecStop=/usr/bin/pkill -u jamiserver jamid
|
||||
User=jamiserver
|
||||
Group=jamiserver
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
|
||||
Retrieve the systemd configuration with:
|
||||
|
||||
```bash
|
||||
systemctl daemon-reload
|
||||
```
|
||||
|
||||
Then start the service with:
|
||||
|
||||
```bash
|
||||
systemctl start jamiserver.service
|
||||
```
|
||||
|
||||
To start Jami automatically when the server starts, the following command is required:
|
||||
|
||||
```bash
|
||||
systemctl enable jamiserver.service
|
||||
```
|
||||
|
||||
With the command:
|
||||
|
||||
```bash
|
||||
systemctl status jamiserver.service
|
||||
```
|
||||
|
||||
The service must be set to active:
|
||||
|
||||
```bash
|
||||
# systemctl status jamiserver.service
|
||||
● jamiserver.service - Daemon Jami for my project
|
||||
Loaded: loaded (/etc/systemd/system/jamiserver.service; disabled; preset: enabled)
|
||||
Active: active (running) since Fri 2025-03-14 05:29:18 UTC; 17min ago
|
||||
Main PID: 982 (launchjami)
|
||||
Tasks: 35 (limit: 2260)
|
||||
Memory: 65.9M (peak: 70.4M)
|
||||
CPU: 24.966s
|
||||
CGroup: /system.slice/jamiserver.service
|
||||
├─982 /bin/bash /usr/local/bin/launchjami
|
||||
├─988 /usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session
|
||||
└─989 /usr/libexec/jamid
|
||||
```
|
||||
|
||||
```{important}
|
||||
If further changes are made to the Jami configuration on the computer after installation on the server, it is required to copy the configuration files back to the server (rerun the `rsync` commands) and restart the service.
|
||||
```
|
Loading…
Reference in New Issue