Personal tools

Difference between revisions of "Ubuntu18 04"

From Rivendell Wiki

Jump to: navigation, search
(Jack Audio)
(Jack Audio)
Line 185: Line 185:
 
  sudo nano /lib/systemd/system/rivendell.service
 
  sudo nano /lib/systemd/system/rivendell.service
  
In the [Service] section, add a line User=%username% where %username% is the logged in user, the same one that you are having start Jack. So if the logged in user is rd, then the [Service] section of the file should look like this:
+
In the [Service] section, add a line '''User=%username%''' where %username% is the logged in user, the same one that you are having start Jack. So if the logged in user is rd, then the [Service] section of the file should look like this:
  
 
  [Service]
 
  [Service]

Revision as of 07:18, 24 November 2020

How to install Rivendell 3.4.1 on Ubuntu 18.04.

This guide assumes you have Ubuntu 18.04 (or a variation such as LUbuntu 18.04) installed and running. Note that these instructions are based on a variety of sources including the folks at Radiotools.uk, the Raspberry PI build, and notes on the email list.

Note that these instructions do not include support for ASI cards, I do not have an ASI card to test with.

Update your OS

Start by making sure that Ubuntu is fully updated. From a shell:

sudo apt-get -y update
sudo apt-get -y upgrade

Install Apache, MySQL, and GIT

sudo apt-get -y install apache2
sudo apt-get -y install mysql-server
sudo apt-get -y install git

Set up your users and groups

Create a Rivendell group

sudo addgroup rivendell
sudo adduser pypad

Add your logged in user to the rivendell group

sudo usermod -a -G rivendell %username% <-- Substitute your logged in user account

Add your logged in user to the Audio group

sudo usermod -a -G audio %username% <-- Substitute your logged in user account

If you want this user to be able to access the serial port from Rivendell (useful for GPIO's)

sudo usermod -a -G dialout %username% <-- Substitute your logged in user account

Log out and log back in so your logged in user picks up all the new groups it is a member of.

Install Dependencies

Note, some of these dependencies may not be needed, but as of writing Rivendell 3.4.1int6 successfully compiles with these installed.

Note, if it asks about enabling Realtime for Jack, I normally say "yes" but this does not work on all systems.

sudo apt-get -y install build-essential dpkg-dev fakeroot g++ g++-7 gcc gcc-7 \
libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 \
libaudio-dev libcilkrts5 libcups2-dev libcupsfilters-dev libcupsimage2-dev libdrm-dev libexpat1-dev \
libfakeroot libfontconfig1-dev libfreetype6-dev libgcc-7-dev libgl1-mesa-dev libgles1 libglu1-mesa-dev \
libglvnd-core-dev libglvnd-dev libice-dev libiodbc2 libitm1 libjbig-dev libjpeg-dev libjpeg-turbo8-dev \
libjpeg8-dev liblcms2-dev liblsan0 liblzma-dev libmng-dev libmng2 libmpx2 libmysqlclient20 libopengl0 \
libpq5 libpthread-stubs0-dev libquadmath0 libsm-dev libstdc++-7-dev libtiff-dev libtiff5-dev libtiffxx5 libtsan0 \
libubsan0 libx11-dev libx11-doc libx11-xcb-dev libxau-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev \
libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev \
libxcb1-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev \
libxinerama-dev libxmu-dev libxmu-headers libxrandr-dev libxrender-dev libxshmfence-dev libxt-dev libxxf86vm-dev \
make mesa-common-dev pkg-config x11proto-core-dev x11proto-damage-dev x11proto-dev x11proto-dri2-dev \
x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-randr-dev x11proto-xext-dev \
x11proto-xf86vidmode-dev x11proto-xinerama-dev xorg-sgml-doctools xtrans-dev libflac++6v5 libid3-3.8.3v5 \
lame jackd2 screen samba patchage vlc-plugin-jack jackd libcdparanoia-dev libflac++-dev libsamplerate0-dev \
libid3tag0-dev libid3-3.8.3-dev libcurl4-gnutls-dev libsndfile-dev libpam0g-dev libsoundtouch1-dev \
libasound2-dev libtwolame-dev libmp3lame-dev libmp4v2-dev libfaad-dev libmad0-dev libjack-jackd2-dev \
libice-dev libsm-dev libxt-dev libxi-dev libssl-dev build-essential libx11-dev libxext-dev xsltproc evince qt4* \
libtag1-dev libmysqlclient-dev libqt4-sql-mysql libqt5sql5-mysql qtcreator curl python3-mysqldb python3-pyqt4 \
python3-pip build-essential libssl-dev libffi-dev python3-dev python3-pyqt4* python3.7 docbook5* autotools-dev \
libtooli* automake libcoverart1 libcoverart-dev libcoverart-doc libdiscid-dev libdiscid-doc libdiscid0 libmusicbrainz5-2 \
libmusicbrainz5-dev fop docbook-xsl-ns

Clone the Rivendell source with GIT and compile source

git clone -b master https://github.com/ElvishArtisan/rivendell.git

Or alternatively visit the releases to download an archived version of the source. As of writing this the current release is 3.4.1int6.

If you want to compile the documentation, set up your Docbooks style sheet location:

export DOCBOOK_STYLESHEETS=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/

Change to your Rivendell source folder

cd rivendell
./autogen.sh

If compiling with documentation:

./configure MUSICBRAINZ_LIBS="-L/usr/local/lib -ldiscid -lmusicbrainz5cc -lcoverartcc" --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-available

If compiling without documentation:

./configure MUSICBRAINZ_LIBS="-L/usr/local/lib -ldiscid -lmusicbrainz5cc -lcoverartcc" --libexecdir=/var/www/rd-bin --sysconfdir=/etc/apache2/conf-available --disable-docbook

If configure is successful then compile the source:

make
sudo make install
sudo ldconfig -v

Disable PulseAudio

This is not always necessary, but sometimes it is required to get audio to work properly. As root edit the file:

/etc/pulse/client.conf

Uncomment the autospawn and make it no:

autospawn = no

Save the configuration file.

Getting MySQL to work and creating the Rivendell user and database

Ubuntu 18.04 by default will only allow a user with elevated root access to log into the root MySQL user account.

sudo mysql -uroot
CREATE USER 'rduser'@'%' IDENTIFIED BY 'letmein';
CREATE DATABASE Rivendell;
GRANT ALL PRIVILEGES ON Rivendell.* TO 'rduser'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit;

MySQL 5.7 needs Strict mode turned off to avoid errors with Rivendell. Create the following file:

sudo nano /etc/mysql/conf.d/disable_strict_mode.cnf

Copy / paste into the file that is created:

[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

CTRL-O to write the file, CTRL-X to exit.

If you want others Rivendell workstations to be able to connect to this machine's MySQL across the network then change the Bind in Mysql.

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Look for the bind-address= line and update it:

bind-address            = 0.0.0.0

Restart your MySQL service

sudo systemctl restart mysql

Configure Apache

Turn on the cgid module:

sudo a2enmod cgid

Copy the Apache configuration

sudo cp ~/rivendell/conf/rd-bin.conf /etc/apache2/conf-available/
sudo ln -s /etc/apache2/conf-available/rd-bin.conf /etc/apache2/conf-enabled/rd-bin.conf
sudo systemctl restart apache2

Make /var/snd

Create /var/snd where your audio files will get stored

sudo mkdir /var/snd
sudo chown username:rivendell /var/snd <-- Note substitute your logged in user name and group`
sudo chmod ug+rwx /var/snd

Configure Rivendell

Copy the sample configuration file to /etc/rd.conf

sudo cp ~/rivendell/conf/rd.conf-sample /etc/rd.conf

Edit the file and update with any relevant user names, groups, etc.

sudo nano /etc/rd.conf

Create your new database and generate audio

If you are setting up a new install, populate your Rivendell database:

sudo rddbmgr --create --generate-audio

If you are updating from a previous version of Rivendell, then restore and / or update your database with rddbconfig:

sudo rddbconfig

Configure audio cards for ALSA access

If you want to use your audio cards through ALSA, then configure them for access:

sudo rdalsaconfig

Select the card(s) you want to use and hit Save.

Start the Rivendell services

Use systemd to start the Rivendell services:

sudo systemctl start rivendell

Then start up rdadmin:

rdadmin

Check your hosts, audio resources and other settings. If all looks okay start up rdairplay and see if you can play the test file.

Jack Audio

Getting Jack to work takes a few extra steps. Jack and the Rivendell services all need to run under the same user ID in order for them to all see each other. In the official CentOS distribution this is accomplished by having the Rivendell services start up jackd, this can be set up in rdadmin --> Manage hosts. However for some reason this does not always work in Ubuntu. The way to make this work is to start Jack with the logged in user, and then have systemd start the Rivendell services under the same logged in user.

First, stop the Rivendell services:

sudo systemctl stop rivendell

Next remove all audio cards from being selected in rdalsaconfig. If a sound card is selected in rdalsaconfig then sometimes Rivendell will grab the card instead of Jack.

sudo rdalsaconfig

To have Systemd start up the Rivendell services under the logged in user, we have to edit the following file:

sudo nano /lib/systemd/system/rivendell.service

In the [Service] section, add a line User=%username% where %username% is the logged in user, the same one that you are having start Jack. So if the logged in user is rd, then the [Service] section of the file should look like this:

[Service]
Type=simple
ExecStart=/usr/local/sbin/rdservice
PrivateTmp=false
Restart=always
RestartSec=2
StartLimitInterval=120
StartLimitBurst=50
User=rd
    • Note, the "U" in User needs to be a capital U or it won't work!

Once that file is updated with the needed user name, save the file and then reload the daemons for systemd (this loads up your changes)

sudo systemctl daemon-reload

Now start Jack audio. You can do this with qjackctl or with a command line.

Once Jack is started, start up your Rivendell services. From a command prompt:

sudo systemctl start rivendell

you should find that Rivendell now sees Jack. Jack connections can now be made with Rivendell's Jack Connect [JC] macro or via Patchage or QJackCTL

If this works, then what you can do is disable the Rivendell service from starting up, have the operating system start up Jack with the desktop, and use Cron to start up the Rivendell service. Be sure that you have your user set up for auto-login (no password required) upon reboot.

Disable Rivendell service from systemd:

sudo systemctl disable rivendell

Find where your system allows you to add items to its autostart. In LUbuntu it is found in the

Preferences --> Default Applications for LX Session --> Autostart option

Under manually started applications, add in the command to start Jackd. I normally put this into a detached screen session.

Once that is done, modify your root crontab:

sudo crontab -e

And add in a line for a delay and a start of the Rivendell services:

@reboot sleep 60 && systemctl start rivendell

If done correctly this will allow Jack to start, then after a brief delay will start up the Rivendell services which will see Jack as it is already running.

Don't delete your source!

A final note about the source that you have just compiled from. If in the future you are updating to a new version of the source code, you will first need to uninstall the current version. If you don't do this then the code remains linked to various existing libraries and the newer updated source will give you errors when you try and compile it.

The easist way to uninstall from source is to go to your original source folder and do a make uninstall:

cd ~/rivendell/
sudo systemctl stop rivendell
sudo make uninstall

Once uninstalled, I recommend renaming the folder. I usually use reference to the version of the source that the folder contains. As an example:

cd
mv ~/rivendell/ ~/rivendell-341/

Once you've done this you can then safely pull down the new source code from github and compile it.