# Installation & Upgrade & De-installation

## Installation

### Ansible

Several playbooks are available and recommended for MariaDB prerequisites, source and DMK installation.

Please follow the instruction in Readme.md in dmk/ansible.

### Prerequisites

This paragraph describes all necessary steps which must be completed before you start the DMK installation.

* The system must come with a perl installation

Execute the below command to check if perl is installed:

```bash
which perl
```

Otherwise install the following packages if needed.

{% tabs %}
{% tab title="Debian/Ubuntu" %}
{% code overflow="wrap" fullWidth="true" %}

```bash
$ apt install zip libswitch-perl libaio1 libaio-dev ksh libncurses5 sudo tuned psmisc -ybas
```

{% endcode %}
{% endtab %}

{% tab title="CentOS/RedHat 7" %}
{% code overflow="wrap" %}

```bash
$ sudo yum install ksh perl-Switch wget -y
```

{% endcode %}
{% endtab %}

{% tab title="RedHat 8" %}
{% code overflow="wrap" %}

```bash
$ sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms

$ dnf install ksh perl-Switch tar libncurses.so.5 ncurses-compat-libs wget
```

{% endcode %}
{% endtab %}

{% tab title="Alma Linux/Rocky Linux 8" %}
{% code overflow="wrap" fullWidth="true" %}

```bash
$ dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y

$ dnf config-manager --enable epel

$ dnf config-manager --set-enabled powertools

$ dnf install ksh perl-Switch tar libncurses.so.5 ncurses-compat-libs wget
```

{% endcode %}
{% endtab %}

{% tab title="For Rocky Linux 9" %}
{% code overflow="wrap" %}

```bash
$ dnf install epel-release -y

$ dnf config-manager --enable epel

$ dnf config-manager --set-enabled crb

$ dnf install ksh perl-Switch tar wget perl

$ cd /usr/lib64

$ sudo ln -s libtinfo.so.6 libtinfo.so.5

$ sudo ln -s libncurses.so.6 libncurses.so.5
```

{% endcode %}
{% endtab %}
{% endtabs %}

* Ensure the mysql.cnf configuration file exists

### Software extraction

Based on the dbi services and OFA (Oracle Flexible Architecture) best practices extract the archive under ${MYQL\_BASE}/local, as explained below: <img src="https://79020188-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4z0oQPWoayw7nSV0CTV8%2Fuploads%2Fgit-blob-0e9a9ece1dbc36383b18da83d66dd5eb632a4363%2Fimage.png?alt=media" alt="" data-size="line">

```bash
gzip --decompress dmk-xx-xx-xxxx.tar.gz

tar -xvf dmk-xx-xx-xxxx.tar
```

Typically, ${MYSQL\_BASE} match:

* “/u01/app/mysql” on Linux/Unix

### Adapt the DMK configuration file

This is one of the most important installation steps, once extracted the “default” configuration file is available under ${DMK\_HOME}/etc.

* ${DMK\_HOME}/etc/dmk.conf.unix for Linux

Adapt the following variables

* MYSQL\_BASE, set it as explained in the OFA document
* MYSQL\_CNF, location of the mysql.cnf

:warning: **During the installation**, **the** “default\*\*” configuration file ${DMK\_HOME}/etc/dmk.conf.unix is renamed to dmk.conf\*\*. This mechanism avoids any configuration loss in case of upgrades.

### Install

Install DMK, from the ${DMK\_HOME}/bin directory or with absolute path as follows:

For Linux/Unix use the appropriate SHELL script : <img src="https://79020188-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4z0oQPWoayw7nSV0CTV8%2Fuploads%2Fgit-blob-e73ef37ed7e1f831b1dd8adaf7f6e665a6c59537%2Fimage.png?alt=media" alt="" data-size="line">

```bash
mysql@vmoraoel:/u01/app/mysql/local/dmk/bin/#> echo $SHELL

/bin/bash

mysql@vmoraoel:/u01/app/mysql/local/dmk/bin/#> . ./dmk.sh
```

Don’t be afraid, the installation is automated without questioning.

*Congratulations you have successfully installed DMK!*

### DMK as ROOT or another user

DMK doesn’t only belong to a unique/specific user, if the necessary privileges are correctly distributed you can start DMK from another user as presented below.

Install and source DMK under the target user

```bash
[root@vmoraoel ~]# . /u01/app/mysql/local/dmk/bin/dmk.sh
```

Once installed it can be sourced using the DBA’s login profile

```bash
[root@vmoraoel ~]# . /home/mysql/.profile
```

## Upgrade

dbi services recommend to perform a backup of your DMK package before upgrading.

The upgrade process is similar to the installation except that the prerequisites are already fulfilled:

* Extract the software as explained in chapter 3.1.3 Software extraction
* Install DMK as explained in chapter 3.1.5 Install

That’s it!

:warning: Upgrades don’t affect the configuration file “${DMK\_HOME}/etc/dmk.conf” file, please review this for newly introduced aliases or variables.

## De-installation

This paragraph describes the de-installation of the DMK toolkit.

For Linux: <img src="https://79020188-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4z0oQPWoayw7nSV0CTV8%2Fuploads%2Fgit-blob-e73ef37ed7e1f831b1dd8adaf7f6e665a6c59537%2Fimage.png?alt=media" alt="" data-size="line">

```bash
rm ~/.DMK_*

rm -rf $DMK_HOME
```

Do not forget to remove the profile from your environment.
