Install MariaDB on Red Hat Enterprise Linux
Make sure your system is up-to-date and
wget is installed. The
wget to download scripts from our GitHub repository.
Alternatively, if you are familiar with
curl you can replace wget with
sudo yum -y update sudo yum -y install wget.
If you see a message that your machine is not registered with an entitlement server, please make sure you have attached a valid subscription to this machine before you continue. See Red Hat’s online documentation for more details.
|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 yum -y install vim sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 100
pwgen (password generator) is not available on
RHEL. To use it, you have to enable the
epel (Extra Packages
Enterprise Linux) repository 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.
subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum -y update sudo yum -y install pwgen
Please use the latest stable version of MariaDB from https://downloads.mariadb.org/mariadb/repositories.
Choose your distribution from the available list (
choose your release (
Red Hat EL 7 (x86_64)), then select the latest
stable version of MariaDB. At the time of writing this is version
You should now see instructions how to install MariaDB on your distribution.
relution.cnf template from our GitHub repository and safe
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.
sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
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%';
Ctrl+D to disconnect from MariaDB and return to the command
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
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
Ctrl+D to sign out again.
If you’re going to install Relution on another machine, you need to open
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
Replace ADDRESS with the IP address and netmask of the
machine or network you want to grant access to this MariaDB instance.
sudo firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="###ADDRESS###" port protocol="tcp" port="3306" accept' sudo firewall-cmd --reload