How to Install Xibo on Ubuntu Server 20.04 LTS

Post Reply
User avatar
LHammonds
Site Admin
Site Admin
Posts: 1056
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

How to Install Xibo on Ubuntu Server 20.04 LTS

Post: # 1000Post LHammonds »

------------- WORK-IN-PROGRESS -------------

Greetings and salutations,

I hope this thread will be helpful to those who follow in my foot steps as well as getting any advice based on what I have done / documented.

To discuss this thread, please participate here: Ubuntu Forums

High-level overview

Xibo allows multiple displays to show media contained on multiple different screen layouts on a scheduled basis.

This tutorial will cover how to manually setup a Xibo server which will use a separate dedicated database server rather than using the Docker image system.

The server will be installed inside a virtual machine in vSphere running on ESXi servers. Notes will also be supplied for doing the same thing for VirtualBox on a Windows 10 PC. Although there are some VMware-specific and VirtualBox-specific steps, they are very few and the majority of this documentation will work for other Virtual Machines or even directly installed onto a physical machine (e.g. bare-metal install). If you have any advice on doing things better, please let me know by replying to the Ubuntu forums thread above.

Tools utilized in this process
Helpful links

The list below are sources of information that was helpful in the creation of this document.
These links may or may not be helpful: Assumptions

This documentation will need to make use of some very-specific information that will most-likely be different for each person / location. And as such, this information will be noted in this section. They will be highlighted in red throughout the document as a reminder that you should plug-in your own value rather than actually using these "place-holder" values.

Under no circumstance should you use the actual values listed below. They are place-holders for the real thing. This is just a checklist template you need to have answered before you start the install process.

Wherever you see RED in this document, you need to substitute it for you will use in your environment.
  • Ubuntu Server name: srv-xibo
  • Ubuntu Server IP address: 192.168.107.12
  • Database Server Name (remote): srv-mariadb
  • Database Server IP (remote): 192.168.107.20
  • Database Admin ID: root
  • Database Admin Password: rootpass
  • Database ID: xibouser
  • Database Password: xibouserpass
  • Xibo Library Location: /srv/xibo-library
  • Xibo Secret Key: YourSecretXiboKey
  • Email Server Name (remote): srv-mail
  • Email Server IP (remote): 192.168.107.25
  • Ubuntu Admin ID: administrator
  • Ubuntu Admin Password: myadminpass
Xibo Ubuntu Server - Setup an Ubuntu server for use as the Xibo server. This tutorial assumes the server was configured according to this tutorial: How to install and configure Ubuntu Server

MySQL/MariaDB server - Setup a separate and dedicated database server. This tutorial assumes the server was configured according to this tutorial: How to install and configure MariaDB

It is also assumed the reader knows how to use the VI editor. If not, you will need to beef up your skill set or use a different editor in place of it.
User avatar
LHammonds
Site Admin
Site Admin
Posts: 1056
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Prerequisites

Post: # 1001Post LHammonds »

Partition Changes

We will be using the /srv partition to store the large video files so we will need to increase this partition. We will assume we have an additional 30 GB of free space available in our volume group. Here are the commands to increase the volume to 21 GB and then expand the file system to 20 GB.

Code: Select all

sudo lvextend -L21G /dev/LVG/srv
sudo resize2fs /dev/LVG/srv 20G
Server Name Resolution

You might need to edit your local host file so you can use friendly names for servers if you don't add them to your internal DNS servers.

Edit the local host file:

Code: Select all

sudo vi /etc/hosts
Add your servers to the end of the file as needed. Example:
192.168.107.20 srv-database 192.168.107.25 srv-mail
Configure MariaDB / MySQL

In this scenario, a dedicated and general-purpose database server already exists and it will be used to hold the application's database.
  1. Connect to the MariaDB/MySQL server using PuTTY.
  2. At the login prompt, login with your administrator account (administrator / myadminpass)
  3. Type the following commands:
    sudo mysql -u root -p Enter password: rootpass
    CREATE DATABASE xibo CHARACTER SET utf8 COLLATE utf8_bin; CREATE USER 'xibouser'@'%' IDENTIFIED BY 'xibouserpass'; GRANT ALL ON xibo.* TO 'xibouser'@'%'; FLUSH PRIVILEGES; exit
    The above commands will allow the database account to connect from any machine from anywhere in the world. This might be OK if your database is not accessible outside your local network or if your machine name changes or you have multiple servers that connect to the same database that use the same ID. You can make this more secure by specifying your application server when granting access. Make sure the database server will recognize the server name (via hosts file or DNS) or just use the IP address:
    CREATE USER 'xibouser'@'srv-xibo' IDENTIFIED BY 'xibouserpass'; GRANT ALL ON xibo.* TO 'xibouser'@'srv-xibo';
    or
    CREATE USER 'xibouser'@'192.168.107.12' IDENTIFIED BY 'xibouserpass'; GRANT ALL ON xibo.* TO 'xibouser'@'192.168.107.12';
    This will prevent anyone knowing the credentials from logging into the database from any other remote machine not specified in the grant command.

    If your application is running on the database server (typical on a developer machine / non-production scenario), create the user like this:
    CREATE USER 'xibouser'@'localhost' IDENTIFIED BY 'xibouserpass'; GRANT ALL ON xibo.* TO 'xibouser'@'localhost';
    This will prevent anyone knowing the credentials from logging into the database from any other remote machine.

    If you mess anything up, you can remove the database and user by issuing these commands:
    DROP USER xibouser; FLUSH PRIVILEGES; DROP DATABASE xibo;
Binlog Format

If you cannot login but you have the right ID and password, you might need to enable mixed mode binary logging on the database server. Here is how you can change the logging mode if necessary.

Code: Select all

vi /etc/mysql/my.cnf
The default value is as follows even if it does not exist in the config file:

Code: Select all

[mysqld]
binlog-format=STATEMENT
To change to mixed mode, set it as follows:

Code: Select all

[mysqld]
binlog-format=MIXED
And restart the service:

Code: Select all

systemctl restart mysql
Install Apache Web Server

Follow this tutorial on how to install and configure Apache web server.

Your site will need to upload files larger than 8 MB which requires increasing this limit in PHP. The below will modify the upload limit to allow files as large as 4 GB to be uploaded (adjust to your needs).

Code: Select all

sudo vi /etc/php/7.4/apache2/php.ini

Code: Select all

max_execution_time = 200
post_max_size = 4096M
upload_max_filesize = 4096M
Reload Apache for changes to the config to take affect:

Code: Select all

sudo systemctl reload apache2
Install Xibo Prerequisites
  1. At the server console, type the following:

    Code: Select all

    sudo apt -y install php7.4-mysql php7.4-gd php7.4-soap php7.4-xml php7.4-zip php7.4-curl php7.4-mbstring php-zmq
    a2enmod rewrite
    systemctl restart apache2
  2. If you plan on utilizing email functions (and who doesn't!!!), type the following commands:

    Code: Select all

    sudo apt -y install php-pear
    sudo pear install mail
    sudo pear install Net_SMTP
  3. Create a test file with the following commands:

    Code: Select all

    sudo printf '%s\n' '<?php' 'phpinfo();' '?>' > /var/www/html/testphp.php
    sudo chown www-data:root /var/www/html/testphp.php
    sudo chmod 644 /var/www/html/testphp.php
  4. Now visit http://192.168.107.12/testphp.php and see if you get the phpinfo page.
  5. When finished with the test page and validating all require modules are enabled, delete the info page.

    Code: Select all

    sudo rm /var/www/html/testphp.php
User avatar
LHammonds
Site Admin
Site Admin
Posts: 1056
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Install Xibo

Post: # 1002Post LHammonds »

  1. Copy the URL of the current release by visiting https://github.com/xibosignage/xibo-cms/releases

    Code: Select all

    wget https://github.com/xibosignage/xibo-cms/releases/download/3.1.2/xibo-cms-3.1.2.tar.gz -O /tmp/xibo.tar.gz
    sudo mkdir -p /var/www/xibo.mydomain.com
    sudo tar xvzf /tmp/xibo.tar.gz -C /var/www/xibo.mydomain.com/ --strip-components=1
    sudo chown www-data:root --recursive /var/www/xibo.mydomain.com
    sudo find /var/www/xibo.mydomain.com/web. -type d -exec chmod 755 '{}' \+
    sudo find /var/www/xibo.mydomain.com/web. -type f -exec chmod 644 '{}' \+
    rm /tmp/xibo.tar.gz
    mkdir /srv/xibo-library
    sudo chown www-data:root /srv/xibo-library
  2. Create the Apache web config file for Xibo

    Code: Select all

    sudo touch /etc/apache2/sites-available/xibo.mydomain.com.conf
    sudo chown root:root /etc/apache2/sites-available/xibo.mydomain.com.conf
    sudo chmod 644 /etc/apache2/sites-available/xibo.mydomain.com.conf
    sudo vi /etc/apache2/sites-available/xibo.mydomain.com.conf
    Copy/Paste the contents into the xibo configuration file:

    Code: Select all

    <VirtualHost *:80>
      ServerAdmin webmaster@localhost
      ServerName mydomain.com
      ServerAlias xibo.mydomain.com
      DocumentRoot /var/www/xibo.mydomain.com/web
      <Directory /var/www/xibo.mydomain.com/web>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
      </Directory>
      ErrorLog ${APACHE_LOG_DIR}/xibo.mydomain.com-error.log
      CustomLog ${APACHE_LOG_DIR}/xibo.mydomain.com-access.log combined
    </VirtualHost>
    
    Validate the configuration file syntax and ensure it shows "Syntax OK"

    Code: Select all

    sudo apache2ctl configtest
    Enable the host configuration:

    Code: Select all

    sudo a2ensite xibo.mydomain.com
  3. Visit http://xibo.mydomain.com/
  4. If you are missing any libraries such as "ZIP" you can run the following command to search the repository for available libraries to install:

    Code: Select all

    apt-cache search php zip
  5. If the installation wizard shows all requirements have been met, click Next
  6. Select the "Use an existing database" tab and set the following, then click Next:
    * Check: Use an existing database
    * Host: srv-database
    * Database Name: xibo
    * Database Username: xibouser
    * Database Password: xibouserpassword
  7. Xibo Administrator Account - Set the following and click Next:
    * Admin Username: xiboadmin
    * Admin Password: xiboadminpass
  8. Library Location - Set the following and click Next:
    * Library Location: /srv/xibo-library
    * Server Key: YourSecretXiboKey
    * Check: Statistics
  9. Xibo was successfully installed - If you see this screen, login with your xiboadmin user account you just specified.
Post Reply