How to Install OpenCast on Ubuntu Linux

This brief tutorial shows students and new users how to install and configure OpenCast on Ubuntu 18.04 | 16.04.

Opencast is a free open-source web-based application for automated video capture, processing, management, and distribution.

It is a Java-based app that uses a database to store its content. It also allows you to build and trim video recordings, schedule events to automatically record based on a pre-defined timetable, and capture both video(s) of the presenter.

OpenCast is a very popular software and many organizations and universities are using it to record and schedule events and seminars.

For more about Opencast, please visit its homepage.

When you’re ready to install OpenCast on Ubuntu, follow the steps below:

Update Ubuntu and Install Dependencies

Opencast required several dependencies including, Tesseract, sox, etc.

To get started, run the commands below to update Ubuntu and install the required dependencies.

sudo apt update
sudo apt dist-upgrade
sudo apt install git unzip build-essential software-properties-common hunspell tesseract-ocr sox

You’ll also want the FFmpeg app if you’re going to be editing video files. To install, run the commands below to add the FFmpeg repository to Ubuntu and install it.

sudo add-apt-repository --yes ppa:jonathonf/ffmpeg-4
sudo apt update
sudo apt install ffmpeg

To verify if FFmpeg is installed, run the commands below:

ffmpeg -version

It should output similar lines as shown below:

Output:
ffmpeg version 4.2.2-0york0~18.04 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/usr --extra-version='0york0~18.04' --toolchain=hardened

Continue below with the setup.

Install OpenJDK 8

OpenCast is a Java-based app so you’ll need Java installed. First, download the Java 8 Development Kit: either the official Oracle JDK or Open JDK

For this tutorial, we’re going to install OpenJDK.

To do that, run the commands below:

sudo apt update
sudo apt-get install openjdk-8-jdk openjdk-8-doc openjdk-8-jre-lib

After installing Java, you can verify it by running the commands below:

java -version

It should output something similar as shown below:

Output:
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

After, continue below to install Maven.

Download and Install Maven

After installing OpenJDK version 8 above, use the steps below to download Maven. You will also need the latest version of Maven (at least version 3.6.3, version 3.6.3 is recommended).

Next, go and download Apache Maven latest from its download page.

The recommended version of Apache Maven is 3.6.3. Make sure to check the Maven download page to see if a newer version is available for you to download. If there are, select those and download them instead.

Run the commands below to download version 3.6.3.

cd /tmp
wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

Next, run the commands below to extract the downloaded package to the /opt directory.

sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt

Create a symbolic link to the version folder if you want to have separate versions and update them as they become available.

sudo ln -s /opt/apache-maven-3.6.3 /opt/maven

When the next version is released. all you have to do is update the symbolic link to reference the new release folder by running the command above and updating the release number in the folder name.

Setup Maven Environment Variables

After downloading and extracting the Maven package, go and set up its environment variables. To do that, run the commands below:

sudo nano /etc/profile.d/maven.sh

Then copy and paste the lines below and save them into the file.

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export M2_HOME=/opt/apache-maven-3.6.3
export MAVEN_HOME=/opt/apache-maven-3.6.3
export PATH=${M2_HOME}/bin:${PATH}

Finally, run the commands below to update and load the changes.

sudo chmod +x /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh

Now run the commands below to check the version number.

mvn -version

You should see the content below.

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven-3.6.3
Java version: 1.8.0_242, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.3.0-40-generic", arch: "amd64", family: "unix"

Installing ActiveMQ

Apache ActiveMQ is an open-source message broker system. Opencast requires ActiveMQ as a message relay for the administrative user interface.

Run the commands below to download ActiveMQ from the Apache office package repository. At the time of this writing, the current version was 5.15.8.

cd /tmp
wget http://archive.apache.org/dist/activemq/5.15.8/apache-activemq-5.15.8-bin.tar.gz

After that, extract the downloaded folder and move its content to the /opt directory and create a folder called activemq

tar -xvzf apache-activemq-5.15.8-bin.tar.gz
sudo mv apache-activemq-5.15.8 /opt/activemq

You’ll want to create dedicated user and group accounts to run ActiveMQ effectively. Simply run the commands below to create a username activemq as well as a group name.

sudo addgroup --quiet --system activemq
sudo adduser --quiet --system --ingroup activemq --no-create-home --disabled-password activemq

Next, change the ownership of the /opt/activemq directory so the user can have full control of the content there.

sudo chown -R activemq:activemq /opt/activemq

After that, you will also want to create an ActiveMQ systemd service so you can control starting, stopping, and enabling its service. To do that, simply run the commands below to create a service file.

sudo nano /etc/systemd/system/activemq.service

Then copy the content below into the file and save it.

[Unit]
Description=Apache ActiveMQ
After=network.target
[Service]
Type=forking
User=activemq
Group=activemq

ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop

[Install]
WantedBy=multi-user.target

After saving it, run the commands below to enable the service.

sudo systemctl daemon-reload
sudo systemctl start activemq
sudo systemctl enable activemq

To verify if the service is functioning, run the commands below to check it.

/opt/activemq/bin/activemq status

You should see similar output as below:

Output:
INFO: Loading '/opt/activemq//bin/env'
INFO: Using java '/usr/bin/java'
ActiveMQ is running (pid '5453')

After installing ActiveMQ, its default configuration file is located at /opt/activemq/conf/activemq.xml. You can open it and modify it to fit your environment.

After making changes to the file, restart the ActiveMQ service by running the commands below:

sudo systemctl restart activemq

Install MariaDB Database

OpenCast needs a database server to store its content. and MariaDB database server is a great place to start when looking at open-source database servers to use with OpenCast.

To install MariaDB run the commands below.

sudo apt install mariadb-server mariadb-client

After installing MariaDB, the commands below can stop, start and enable the MariaDB service to start up when the server boots.

Run these on Ubuntu

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

After that, run the commands below to secure the MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Restart MariaDB server

To test if MariaDB is installed, type the commands below to logon into the MariaDB server

sudo systemctl status mariadb.service

You should see similar messages below:

mariadb.service - MariaDB 10.1.44 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-03-05 12:14:17 CST; 1min 15s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 16048 (mysqld)
   Status: "Taking your SQL requests now."
    Tasks: 27 (limit: 4666)
   CGroup: /system.slice/mariadb.service
           └─16048 /usr/sbin/mysqld

Mar 05 12:14:17 ubuntu1804 /etc/mysql/debian-start[16081]: information_schema
Mar 05 12:14:17 ubuntu1804 /etc/mysql/debian-start[16081]: mysql
Mar 05 12:14:17 ubuntu1804 /etc/mysql/debian-start[16081]: performance_schema

Now that you’ve installed all the packages that are required, continue below to start configuring the servers. First, create a blank OpenCast database.

Run the commands below to log on to MariaDB. When prompted for a password, type the root password you created above.

sudo mysql -u root -p

Then create a database called opencast

CREATE DATABASE opencast;

Create a database user called opencastuser with a new password

CREATE USER 'opencastuser'@'localhost' IDENTIFIED BY 'new_password_here';

Then grant the user full access to the opencast database.

GRANT ALL ON opencast.* TO 'opencastuser'@'localhost' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

Install OpenCast

For this tutorial, we will create a new user account for OpenCast. This user will be used to run the Opencast process.

It is recommended to run OpenCast services as non-root.

To create a user account named opencast with /opt/opencast home directory, run the commands below:

sudo useradd -r -d /opt/opencast opencast

Download the Opencast Source code using Git, then change it into its source directory.

cd /tmp
git clone https://github.com/opencast/opencast.git opencast_source
cd opencast_source

You’ll want to get the latest version checked out. To see a list of available releases, use the commands below:

git tag

You should see a list of all releases with the most recent release at the end.

.
7.5
7.6
8.0
8.1

Check out the latest release using the following command.

git checkout 8.1

Next, build the code using Apache Maven by running the commands below:

mvn clean install -DskipTests

It may take some time to build the code, depending on the speed of your machine. This process will create all binaries for OpenCast and installer modules.

After a successful build, you should see a similar message as below:

INFO] Assemblies // Distribution Admin .. SUCCESS [ 39.871 s]
[INFO] Assemblies // Distribution Admin/Presentation . SUCCESS [ 14.156 s]
[INFO] Assemblies // Distribution All-In-One .. SUCCESS [ 15.232 s]
[INFO] Assemblies // Distribution Ingest .. SUCCESS [ 12.632 s]
[INFO] Assemblies // Distribution Presentation . SUCCESS [ 12.215 s]
[INFO] Assemblies // Distribution Worker .. SUCCESS [ 12.512 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10:24 min
[INFO] Finished at: 2020-03-14T10:36:31-05:00
[INFO] ------------------------------------------------------------------------

Change into the build folder, extract the allinone tar archive and move it to the OpenCast home directory. They give OpenCast’s user ownership of its home folder.

cd build
tar -xf opencast-dist-allinone*.tar.gz
sudo mv opencast-dist-allinone*/ /opt/opencast/
sudo chown -R opencast:opencast /opt/opencast

Import the database schema and initial data for Opencast installation by running the commands below:

cd /opt/opencast
mysql -u opencastuser -p opencast < docs/scripts/ddl/mysql5.sql

Next, edit the Opencast configuration file to make a few changes in the configuration.

sudo nano /opt/opencast/etc/custom.properties

Make the highlighted changes and save the file.

...
############# config ################
org.opencastproject.admin.email=admin@example.com
org.opencastproject.security.admin.user=admin
org.opencastproject.security.admin.pass=opencast

######### DATABASE #########

# Relational Database configuration.  By default, Opencast uses an embedded H2 database.  A standalone database se$
# is recommended for production systems.  If you run the ddl script for your db vendor (see docs/scripts/ddl/) man$
# (this is recommended) set 'ddl-generation' to 'false'.
org.opencastproject.db.ddl.generation=true

# db.vendor can be any of the values listed at under the "eclipselink.target-database" section of
# http://www.eclipse.org/eclipselink/documentation/2.4/jpa/extensions/p_target_database.htm#target-database
# Common values include MySQL, PostgreSQL.
org.opencastproject.db.vendor=MySQL

# Opencast comes with the jdbc drivers for MySQL (com.mysql.jdbc.Driver) and PostgreSQL (org.postgresql.Driver). T$
# other jdbcDrivers to the Opencast runtime, rebuild the db module with your desired drivers.
org.opencastproject.db.jdbc.driver=com.mysql.jdbc.Driver

# The jdbc connection url, username, and password
org.opencastproject.db.jdbc.url=jdbc:mysql://localhost/opencast
org.opencastproject.db.jdbc.user=opencastuser
org.opencastproject.db.jdbc.pass=database_user_password_here

Save the file and exit.

Next, open the OpenCast web server configuration file.

sudo nano /opt/opencast/etc/org.ops4j.pax.web.cfg

Set the listening address to 0.0.0.0 so that the application can be accessed outside the network.

# This property specifies the comma separated list of addresses used
# localhost,10.0.0.1). Host names or IP addresses can be used. Pax Web default value is "0.0.0.0".
org.ops4j.pax.web.listening.addresses=0.0.0.0

Run the commands below to use Opencast configurations for Apache ActiveMQ. First, create a backup of the current ActiveMQ configuration file.

sudo mv /opt/activemq/conf/activemq.xml /opt/activemq/conf/activemq.xml.backup

Next, copy the OpenCast configuration file to its location specified below:

sudo cp /opt/opencast/docs/scripts/activemq/activemq.xml /opt/activemq/conf/activemq.xml

The default Opencast ActiveMQ configuration disables the web administration console. You’ll have to enable it.

Run the commands below to open the file.

sudo nano /opt/activemq/conf/activemq.xml

Scroll down and un-comment the highlighted line below

<!--
Enable web consoles, REST and Ajax APIs and demos
The web consoles requires by default login, you can disable this in the jetty.xml file

Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>

Save the file and exit, then restart ActiveMQ.

sudo systemctl restart activemq

Next, copy the Opencast startup script to start and manage the Opencast server processes easily.

cd /opt/opencast
sudo cp docs/scripts/service/opencast.service /etc/systemd/system/

Reload the Systemd units, start and enable its service.

sudo systemctl daemon-reload
sudo systemctl start opencast.service
sudo systemctl enable opencast.service

To check the OpenCast service status, run the commands below:

sudo systemctl status opencast.service

It should output similar messages as below:

● opencast.service - Opencast
   Loaded: loaded (/etc/systemd/system/opencast.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-03-14 10:53:57 CDT; 15s ago
     Docs: https://docs.opencast.org
           https://docs.opencast.org
 Main PID: 29273 (start-opencast)
    Tasks: 89 (limit: 4666)
   CGroup: /system.slice/opencast.service
           ├─29273 /bin/sh /opt/opencast/bin/start-opencast server
           └─29368 /usr/bin/java -Xms128M -Xmx1G -XX:+UnlockDiagnosticVMOptions -Dcom.sun.management.jmxremote -Dor

Mar 14 10:53:57 ubuntu1804 systemd[1]: Started Opencast.
Mar 14 10:53:57 ubuntu1804 start-opencast[29273]: start-opencast: JAVA_HOME not set; results may vary

Finally, browse the server’s hostname or IP address followed by port 8080.

http://example.com:8080

You should see the OpenCast login page.

OpenCast Ubuntu

Login with username and password:

Username: admin
Password: opencast

opencast Ubuntu install

That’s it!

Conclusion:

This post showed you how to install and configure OpenCast on Ubuntu 18.04 | 16.04. If you find any error above, please use the form below to report it.

Thanks,