Menu

[draft] HOWTO install Jamulus as a "headless" server on Ubuntu 18.04

Gilgongo
2020-03-20
2020-11-29
1 2 3 .. 5 > >> (Page 1 of 5)
  • Gilgongo

    Gilgongo - 2020-03-20

    I wrote a step-by-step guide for creating a "pure" (headless, no GUI) Jamulus server for Ubuntu 18.4 (although earlier versions using systemd should also work).

    THIS HOWTO HAS NOW BEEN MOVED TO THE PROJECT WIKI HERE:

    https://jamulus.io/wiki/Server-Linux

    Let me know if you have comments/corrections etc.

    Thanks!

     
    ❤️
    1

    Last edit: Gilgongo 2020-11-29
    • Simon Tomlinson

      Simon Tomlinson - 2020-03-23

      hi thanks for this, I'm using AWS Ubuntu and I get the error:

      ubuntu@ip-172-31-43-57:~$ sudo apt-get install build-essential libqt4-dev
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      E: Unable to locate package libqt4-dev
      

      I've looked on the web and I see messages that this package is no longer available and you should use:

      sudo apt update
      sudo apt install libqtcore4 libqtgui4
      sudo apt-get install build-essential libqt4-dev
      

      Would you agree with this?

      [EDIT]

      I finally got it working, i had to do the following in this order on AWS Ubuntu:

      sudo apt update
      sudo apt install libqtcore4 libqtgui4
      sudo apt install libqt4-dev
      
       

      Last edit: Simon Tomlinson 2020-03-23
      • Gilgongo

        Gilgongo - 2020-03-23

        (sorry, SourceForge forums confused me - I'm not sure if you saw my earlier reply by email or not so I'm posting here too)

        Can you tell me what version of Ubuntu you are using? (cat /etc/issue)

         
      • Gilgongo

        Gilgongo - 2020-03-23

        Ah interesting - what version of Ubuntu are you using?

         

        Last edit: Gilgongo 2020-03-23
        • Simon Tomlinson

          Simon Tomlinson - 2020-03-23

          Version 18 i believe is what AWS ubuntu image is installed as default.

          Authenticating with public key "imported-openssh-key"
          Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-1057-aws x86_64)
          
           
          • Gilgongo

            Gilgongo - 2020-03-23

            The version I tested the HOWTO on was Ubuntu 18.04.4 LTS, so essentially the same.

            I have no idea why apt wasn't able to find libqt4-dev the first time you ran the install, nor why it would find it when you installed libqtcore4 and libqtgui4 first!

             
    • Simon Tomlinson

      Simon Tomlinson - 2020-03-23

      One thing I've noticed that I can't seem to get working, I tried creating a central server. This would be useful for a group of us who are trying to work collaboratively on a number of different rooms, so would be useful so not every musician keeps connecting to our rooms for our projects. (this is answering your use case question above for having another central server).

      However, I can get the central server running fine and I've configured it on the default 22124 port. However, when i tried to create a second server to be listed on this new central server, although it runs and I can connect to it using the IP and port (in this case 22126), it is not listed on the serverlist dialog of the client when I've configured the client to use my new central server. I can see the main central server I created, but not any other servers (despite having --showallservers configured).

      Here's the config of the child server:

      ubuntu@ip-172-31-21-64:~$ ./jamulus-fit2funk.sh
      - server mode chosen
      - no GUI mode chosen
      - logging file name: /var/log/jamulus/jam.log
      - server info: Fit to Funk PRIVATE Rehearsal;London;224
      - central server: localhost
      - selected port number: 22126
      - welcome message: This room reserver only for Fit2Funk Band Rehearsal!
       *** Jamulus, Version 3.4.4cvs
       *** Internet Jam Session Software
       *** Under the GNU General Public License (GPL)
      
       
      • Simon Tomlinson

        Simon Tomlinson - 2020-03-23

        Ah, actually I found i had the name of the server too long! Once I made it below 20 chars it was all good - maybe worth putting as you get no error about it not working.

        Still worth pointing out that ping information doesn't work between a server and a central server when they are on the same host.

         

        Last edit: Simon Tomlinson 2020-03-23
        • Gilgongo

          Gilgongo - 2020-03-23

          Nice catch on the 20 characters! Will add a note on that in the HOWTO.

          Is the other issue related to this? https://sourceforge.net/p/llcon/bugs/12/

           

          Last edit: Gilgongo 2020-03-23
    • David Harrold

      David Harrold - 2020-03-26

      This systemd unit file avoids the need for a shell script, and sends all log output to journald so you don't need to worry about log file rotation.

      [Unit]
      Description=Jamulus-Server
      After=network.target
      
      [Service]
      Type=simple
      User=jamulus
      NoNewPrivileges=true
      ProtectSystem=true
      ProtectHome=true
      Nice=-20
      IOSchedulingClass=realtime
      IOSchedulingPriority=0
      ExecStart=/usr/bin/jamulus --server --nogui \
                 --centralserver jamulus.fischvolk.de \
                 --serverinfo rebootrebels.co.uk;London;224 \
                 --welcomemessage "Welcome to the Reboot Rebels rehearsal room. All welcome while we are not here." \
                 --numchannels 12
      Restart=on-failure
      RestartSec=30
      StandardOutput=journal
      StandardError=inherit
      SyslogIdentifier=jamulus
      
      [Install]
      WantedBy=multi-user.target
      

      Hope this is helpful
      -David

       
      • Gilgongo

        Gilgongo - 2020-03-26

        Ah, Excellent! Somebody who actually knows something about systemd! :-) I'll update the HOWTO.

        Does the Nice parameter also allow ionice (setting the io scheduling class) to be called? I don't know how important ionice is for Jamulus though really. EDIT: Oops just seen it's got IOSchedulingClass, sorry!

        BTW the reason I had a separate shell script was that a) I can never remember where systemd puts things, and b) if you edit the unit file you also need to run a separate command to update systemd. I thnk it reminds you, but I'm not sure. Anway I'll point that out in the HOWTO so people can choose which they want to do.

         

        Last edit: Gilgongo 2020-03-26
        • David Harrold

          David Harrold - 2020-03-26

          The IOSchedulingClass and IOSchedulingPriority statements set the io scheduling class and io priority, i.e. the equivalent of 'ionice'.
          More information on using systemd unit files to set scheduling priorities here, scroll down to the Scheduling section : https://www.freedesktop.org/software/systemd/man/systemd.exec.html

          My Jamulus server instance is running on an Amazon AWS EC2 virtual server instance, so there is probably no point in trying to raise the IO priority. AWS may limit I/O anyway according to the 'size' of the EC2 instance I'm paying for. If my IO is not sufficient I will probably just have to pay a few more dollars and upgrade to a more powerful EC2 instance.

          Process and IO Scheduling is probably only going to be important for folks who are using their own physical server, and are sharing it with other applications.

          NB: If you edit the unit file, use sudo systemctl daemon-reload to pick up the changes and then sudo systemctl restart jamulus

           
          • Gilgongo

            Gilgongo - 2020-03-26

            Cool - I put your stuff into the HOWTO and removed the separate script stuff in the end to keep it simple (along with removing some other stuff that wasn't needed like a separate log file).

            Much more streamlined now. Thanks!

             
            • Gronaz

              Gronaz - 2020-03-26

              All in the end before Test you server you could add a complete example sudo service jamulus status
              Thank you for this great guide Gilgongo & David

               
              👍
              1

              Last edit: Gronaz 2020-03-26
      • Gronaz

        Gronaz - 2020-04-03

        Hi David, thank you for this great guide.
        I wanted to switch to serviced to drop the jamulus-startup.sh for ease of mind and I was not pleased to see 4 or 5 processes involved in jamulus (subshell etc...). Unfortunately, but I don't know if this is really important, the RT scheduling and priority set in the script by the sudo chrt 99 .... prefix were not applied when using the unit file. I followed the link you gave below and nearly fall in nervous breakdown reading mans of sched,ps and many others and in the end I dared to try this insersion in the file unit:

        ...
        ProtectHome=True
        CPUSchedulingPolicy=rr
        CPUSchedulingPriority=99
        Nice=-20
        ...
        

        sudo systemctl daemon-reload sudo service jamulus restart
        Before

        $ ps -o pid,ppid,sched,cls,ni,pri,rtprio,cp,cmd 15763
          PID  PPID SCH CLS  NI PRI RTPRIO  CP CMD
        15763     1   0  TS -20  39      -   3 /usr/local/bin/jamulus -s -n -u 5 -e jamulus.fischvolk.de -o Gronazulus;Coarraze;74
        

        After

        $ ps -o pid,ppid,sched,cls,ni,pri,rtprio,cp,cmd 15815
          PID  PPID SCH CLS  NI PRI RTPRIO  CP CMD
        15815     1   2  RR   - 139     99   5 /usr/local/bin/jamulus -s -n -u 5 -e jamulus.fischvolk.de -o Gronazulus;Coarraze;74
        

        Do you think this is not usefull for a server at home ?

         

        Last edit: Gronaz 2020-04-03
        • David Harrold

          David Harrold - 2020-04-04

          CPU scheduling is a complicated subject, and I am far from being an expert. But if you think about the problem at a high level, what you are trying to achieve is to make sure that your Jamulus server has sufficient cpu resources to keep up with demand from the audio traffic flows.

          For a private server at home, the first and simplest thing to do is to shutdown and remove all unnecessary tasks. Ideally you should tell your server not to run any kind of graphical desktop. On Ubuntu, you can achieve that using systemctl set-default multi-user, then rebooting.

          Then look through the list of tasks still running, and shutdown and disable anything you do not need. A default Ubuntu installation starts many services that are useful for a general purpose server, but are not necessary for a server that is only being used for Jamulus. For me, that meant shutting down smb, cups, modemmanager, wpa_supplicant, and nfs, because I do not need the server that is running Jamulus to also be a network file server. And I know that my server does not have a modem or a wifi card! But you will have to adapt this list to your circumstances.

          Now that the server is only running the tasks you want it to, you can think about scheduling. The good folks at UbuntuStudio have already compiled a 'low latency' kernel with optimisations aimed at audio applications:

          Eg. for Ubuntu 18.04: sudo apt-get install linux-lowlatency-hwe-18.04

          More information here: https://help.ubuntu.com/community/UbuntuStudio/RealTimeKernel

          Once you've worked through this, you will probably find there is no need to raise the 'nice' scheduling priorities for Jamulus server. On my server the latency reported by a Jamulus client on the same Ethernet segment as the server is around 2ms. That is tiny compared to the latency that the Internet will add for remote users, so no point in tuning the server any further.

           
    • Rachel Morganfield

      @gilgongojones

      I just found this page. Could you please link the new website?

       
  • Volker Fischer

    Volker Fischer - 2020-03-20

    Thank you for that nice HOWTO.
    Regarding the -o option: The format is: [name];[city];[country as QLocale ID].
    [name] is an arbitrary name (a string)
    [city] is the name of your city given as a string
    [country] is an integer number as given in the following list: https://doc.qt.io/qt-5/qlocale.html#Country-enum

     
    👍
    2
    • Gilgongo

      Gilgongo - 2020-03-21

      I've now put my server into what I call "public mode" - how long does it typically take to show up on the list?

       
      • Volker Fischer

        Volker Fischer - 2020-03-21

        It should show up instantly. But be aware of the known bug: https://sourceforge.net/p/llcon/bugs/12/

         
        • Gilgongo

          Gilgongo - 2020-03-21

          Hmm. The server is on a different network to the clients (and has a static Internet-routable IPv4 address, no NATing). I can't see my server listed though (I'm calling it jam.phreak.co.uk)

           

          Last edit: Gilgongo 2020-03-21
          • Volker Fischer

            Volker Fischer - 2020-03-21

            jamulus.dyndns.org does not exist anymore. You have to use jamulus.fischvolk.de

             
            • Gilgongo

              Gilgongo - 2020-03-21

              Ah OK. So I'm now starting the server with:

              Jamulus -s -n -g -l /var/log/jamulus/jam.log -e jamulus.fischvolk.de -o pHreak;London;224

              I see no errors on my side (in fact there's nothing in jam.log at all - should there be?) but still not showing in the server list.

               
              • Volker Fischer

                Volker Fischer - 2020-03-21

                I can see your server now in the Connection Setup list.

                 
                • Gilgongo

                  Gilgongo - 2020-03-21

                  OK - I saw a couple of client connection in the log now. Still can't see the server listed with my (Windows) client from my LAN though. Does the client only list servers with certain properties or something? I assume my ping time is OK.

                   
1 2 3 .. 5 > >> (Page 1 of 5)