Install MariaDB on SUSE Linux Enterprise Server

Preparation

Make sure your system is up-to-date and wget is installed. The instructions use wget to download scripts from our GitHub repository. Alternatively, if you are familiar with curl you can replace wget with curl.

sudo zypper -n update
sudo zypper -n install wget
During this installation some files will need to be edited manually. If you are familiar with vim set it as default editor with the commands below. If you are not familiar with vim please skip this and keep using the default editor.
sudo zypper -n install vim
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 100

(Optional) Install a password generator

By default pwgen (password generator) is not available on SLES. To use it, you have to add an extra repository from openSUSE first. Since this is an unsupported 3rd party repository, you have to install it manually. If you do not want to install these packages on your server, you can skip this step and generate secure passwords on another machine.

sudo zypper -n addrepo https://download.opensuse.org/repositories/home:michalstrnad/SLE_12/home:michalstrnad.repo
sudo zypper refresh
sudo zypper -n install pwgen

Install MariaDB

Please use the latest stable version of MariaDB from https://downloads.mariadb.org/mariadb/repositories.

Choose your distribution from the available list (openSUSE). Next, choose your release (openSUSE 42 (x86_64)), then select the latest stable version of MariaDB. At the time of writing this is version 10.3 [stable].

You should now see instructions how to install MariaDB on your distribution.

Configure MariaDB for Relution

Download the relution.cnf template from our GitHub repository and safe it to /etc/my.cnf.d/relution.cnf.

wget https://raw.githubusercontent.com/relution-io/relution-setup/master/native/Linux/etc/my.cnf.d/relution.cnf.template
sudo mv relution.cnf.template /etc/my.cnf.d/relution.cnf
sudo chmod og-w /etc/my.cnf.d/relution.cnf

If SELinux is in enforcing mode (default) the file’s security context is wrong after the move. Run the command below to fix it. Otherwise SELinux will prevent the service from accessing the file for security reasons.

sudo restorecon -v /etc/my.cnf.d/relution.cnf

Start MariaDB and make sure the service is started automatically after a system reboot. Note that the service is still called mysql.

sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Check installation

You should now be able to connect to this MariaDB instance. Note that for backwards compatibility reasons the command line tools still use mysql, this is not an error.

mysql -u root

You should see output similar to the one below:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Enter this command to verify that server and database collation are set to utf8mb4 as desired:

SHOW VARIABLES LIKE '%collation%';

Make sure collation_database and collation_server show utf8mb4_general_ci.

Press Ctrl+D to disconnect from MariaDB and return to the command prompt.

Create Relution database

Next, we are going to create the relution database and an associated database user. This user is going to be used by the Relution service to connect to the database. Download the script from GitHub.

wget https://raw.githubusercontent.com/relution-io/relution-setup/master/native/Linux/scripts/create_database.sh --directory-prefix=/opt

Ensure the file is executable by root:

chmod 700 /opt/create_database.sh

(Optional) Use pwgen to generate a secure random password

pwgen -snc 48 1

Execute the script to create the database:

/opt/create_database.sh "relution" "<password>"

This creates a new database called relution and a new database user with the name relution that has full privileges on this database. This user is used by the Relution service to access the database. If administrative access to the database is needed for maintenance purposes we recommended to create a separate database user for this.

Make sure you save the password (excluding the quotation marks) in a secure location. You will need to configure this password later to grant Relution access to the database.

Verify that you can connect to the database as this user:

mysql -u relution -p relution

Enter the password when prompted. You should see the MariaDB prompt as above. Use Ctrl+D to sign out again.

Firewall configuration

If you’re going to install Relution on another machine, you need to open port 3306 on this machine, so Relution can talk to MariaDB. If Relution is going to be installed on the same machine you can skip these steps.

  • Open the YaST tool by issuing the following command: yast firewall

  • Use the cursor keys to select Allowed Services, followed by the return key

  • Select “MySQL server” below Service to Allow then use Add

  • Select Next and review the summary of your changes.

  • Select Finish to apply your changes.