Skip to content

Server Linux

Jonathan edited this page Jul 25, 2020 · 107 revisions

Home > Running a Server > Installing on Linux

Please ensure you have read the server overview

Running a server with the GUI

If you plan to run a server on your desktop machine (and you have installed the Jamulus client already), you can run it in your chosen server mode by running Jamulus with the -s option as follows:

  1. Open a terminal window (CTRL+ALT+t on Ubuntu and related distros).

  2. Assuming Jamulus is in /usr/local/bin, type Jamulus -s

Hit return and you should see the server control window. You can stop the server by closing the server window, or by typing CTRL+C in the terminal.

To configure the server, please refer to the Windows & Macintosh instructions.

See also Command Line Options for other parameters you can set.


Running a "headless" server

The following guide is for running Jamulus as a "pure" server on hardware without audio (eg on a 3rd party/cloud host) and assumes Ubuntu/Debian distributions using systemd. We also have instructions for Raspberry Pi, which rock too.

Compile sources, create a user

Docker users: Jamulus user Grigory maintains a Docker image for Jamulus which you can use

  1. Get the sources, install the dependent packages according to the Linux client install guide. Note that you don't need to install the Jack package(s) for a headless build. If you plan to run headless on Gentoo, or are compiling under Ubuntu for use on another Ubuntu machine, see the footnotes.

  2. Compile the sources to ignore the Jack sound library:

qmake "CONFIG+=nosound headless" Jamulus.pro
make clean
make
  1. Move the resulting Jamulus binary file to a permanent location, or use sudo make install. You can now remove the sources directory if you wish.

The rest of this guide assumes you are using /usr/local/bin/Jamulus

  1. Create a non-privileged system user for the server to run as (will run as user jamulus, group nogroup):

sudo adduser --system --no-create-home jamulus

Create a start script

Once you have decided which mode you want your server to run in, use systemd to start it up (the rest of this guide assumes you are in "public" mode - Please also see this important note on Central Servers).

Create a systemd unit file that will start the server at boot time (thanks to David Harrold for this).

The unit file applies high priority CPU and I/O scheduling to the server process. This is optional (and may be ignored on some hosts).

Note also that the server log entries will go to journalctl (use journald to see it ).

[Unit]
Description=Jamulus-Server
After=network.target

[Service]
Type=simple
User=jamulus
Group=nogroup
NoNewPrivileges=true
ProtectSystem=true
ProtectHome=true
Nice=-20
IOSchedulingClass=realtime
IOSchedulingPriority=0

#### Change this to set genre, location and other parameters.
#### See https://github.com/corrados/jamulus/wiki/Command-Line-Options ####
ExecStart=/usr/local/bin/Jamulus -s -n -e jamulus.fischvolk.de -o "yourServerName;yourCity;[country ID]"
     
Restart=on-failure
RestartSec=30
StandardOutput=journal
StandardError=inherit
SyslogIdentifier=jamulus

[Install]
WantedBy=multi-user.target

Copy the unit file to /etc/systemd/system and give it permissions:

sudo cp jamulus.service /etc/systemd/system/jamulus.service

sudo chmod 644 /etc/systemd/system/jamulus.service

Test that it starts OK:

sudo systemctl start jamulus

sudo systemctl status jamulus

You should see something like this:

● jamulus.service
   Loaded: loaded (/lib/systemd/system/jamulus.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-03-26 11:52:34 GMT; 4s ago
 Main PID: 1308 (Jamulus)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/jamulus.service
           └─1308 /usr/local/bin/Jamulus -s -n -e jamulus.fischvolk.de -o yourServerName;yourCity;[country ID]

Mar 26 11:52:34 oddjob systemd[1]: Started jamulus.service.
Mar 26 11:52:35 oddjob jamulus[1308]: - server mode chosen
Mar 26 11:52:35 oddjob jamulus[1308]: - no GUI mode chosen
Mar 26 11:52:35 oddjob jamulus[1308]: - central server: jamulus.fischvolk.de
Mar 26 11:52:35 oddjob jamulus[1308]: - server info: yourServerName;yourCity;[country ID]
Mar 26 11:52:35 oddjob jamulus[1308]: - welcome message: Thanks for connecting!
Mar 26 11:52:35 oddjob jamulus[1308]:  *** Jamulus, Version [version]
Mar 26 11:52:35 oddjob jamulus[1308]:  *** Internet Jam Session Software
Mar 26 11:52:35 oddjob jamulus[1308]:  *** Under the GNU General Public License (GPL)

If all is well, enable the service to start at boot with:

sudo systemctl enable jamulus

You can now also control Jamulus with the service command. For example:

sudo service jamulus status

shows whether Jamulus is running OK, and the last few lines of the log (where you will see connections recorded). Note: Press q to exit the service status


See also Command Line Options for other parameters you can set.

Footnotes

Controlling recordings

If you plan on recording jam sessions you can toggle the recording function on/off, or make a new recording directory while the server is running using the following unit files (your system will need to be using systemd).

Simply create the following two .service files in /etc/systemd/system, calling them something appropriate (eg newRecording-Jamulus-server.service). Run sudo systemctl daemon-reload to register them for first use.

For turning recording on or off (depending on the current state):

[Unit]
Description=Toggle recording state for Jamulus server
Requisite=Jamulus-Server

[Service]
Type=oneshot
ExecStart=/bin/systemctl kill -s SIGUSR2 jamulus

For starting a new recording:

[Unit]
Description=Start a new recording on Jamulus server
Requisite=Jamulus-Server

[Service]
Type=oneshot
ExecStart=/bin/systemctl kill -s SIGUSR1 jamulus

(Note that the Jamulus process name in the ExecStart line needs to be the same as that of the server)

Now you can run these with the service start command, for example:

sudo service jamulusTogglerec start (assuming you named your unit file jamulusTogglerec.service)

Viewing The Logs

Jamulus will log to the system file if you left the StandardOutput=journal setting in the unit file. Logging to the system log is recommended, as the system will manage the log file for you, no need to come back and purge it later, or worry about filling up your disk space.

To view the log, use journalctl (to exit press Ctrl-C). For example, to read the system log file, filtered for the Jamulus service:

journalctl -u jamulus

For today’s entries:

journalctl -u jamulus --since today

For the last hour:

journalctl -u jamulus --since "1 hour ago"

Filter the log to see connection messages for your Jamulus server:

journalctl -u jamulus | grep connected

Follow (show on screen) Jamulus log messages as they occur:

journalctl -f -u jamulus

The "headless" flag

Compiling with the headless flag means you can avoid installing some of the dependent packages under the following circumstances:

  1. If you plan to run the server on Gentoo Linux, the only packages you should need for a headless build are qtcore, qtnetwork, and qtxml (both for building and running the server).

  2. If your server is running Ubuntu/Debian, you will need all dependent packages to compile the binary, but to run the resulting headless Jamulus server you should only need libqt5core5a, libqt5network5 and libqt5xml5. This may be useful for compiling/upgrading on one machine to run the binary on another (a Raspberry Pi, for example).