# Upgrade

Before every update, check the version of installed packages. The database version is particularly important.

```
yum info vprotect-server vprotect-node mariadb-server
# Or
rpm -qa | egrep -e "vprotect|Maria"
```

If the host computer has an Internet connection, use the yum command - you'll also see the new package versions provided by the repositories.

For a Debian-based OS use the following:

```
dpkg -l | grep vprotect
dpkg -l | grep Maria
```

## RPM-based OS Upgrade

### Server

* Make sure you have the Storware Backup & Recovery database backup.
  * You can use this command manually to back it up on-demand on the Storware Backup & Recovery Server:`/opt/vprotect/server/scripts/backup_db.sh /path/to/backup/file.sql.gz`
* If Storware Backup & Recovery was installed on a virtual machine (not a physical one), it would be a good move to take a snapshot.
* After backing up the database, we should carefully stop the Storware Backup & Recovery service to make sure that we don't have any tasks running (a running task may cause problems updating the database).
  * View all tasks, if you see even one on the list, clear it (wait for the ongoing tasks to finish)
  * You can do this from the WebUI (it's faster)
* Now, if you don't have any tasks on the list, you can stop the service.

```
[root@vprotect ~]# systemctl disable vprotect-server --now
```

* To make sure that no scheduler has started a task before stopping the service, let's query the database.
  * If the table is not empty, start the Storware Backup & Recovery-Server service and clear the tasks again.

```
mysql -u root -p -e "Select * FROM vprotect.task;"
```

* Make sure you have MariaDB up-to-date - currently Storware Backup & Recovery by default uses version **10.11**, while **10.6** is the minimum version supported.

  * Otherwise, minor MariaDB versions should be updated with `yum update`
  * `rpm -e --nodeps "MariaDB-server-YOUR_VERSION_OF_PACKAGE"`
  * Update the MariaDB repository to the correct version `vi /etc/yum.repos.d/MariaDB.repo`
  * Install the new MariaDB-Server `yum install -y mariadb-server`
  * Update all other components of MariaDB `yum update -y mariadb`
  * Start the MariaDB engine `systemctl enable mariadb --now`
  * Run mysql\_upgrade to update the Storware Backup & Recovery Database `mysql_upgrade --user=root --password`
* If the database update is successful, now we can start with the Storware Backup & Recovery Update. Make sure you configure our new repository for Storware Backup & Recovery - new base URL:

{% hint style="info" %}
**Note:** use one of this URL's

* <https://repo.storware.eu/storware/current/el8/>
* [https://repo.storware.eu/storware/current/el9/](https://repo.storware.eu/storware/current/el7/)
  {% endhint %}

`vim /etc/yum.repos.d/vProtect.repo`

* Update the Server (it may take a while, the service is being restarted):

  ```
  yum -y update vprotect-server
  ```
* If the server service was not running before update, you may also need to execute:

  ```
  systemctl enable vprotect-server --now
  ```

### Node

1. Update each Node:

   ```
   systemctl stop vprotect-node
   yum -y update vprotect-node
   ```
2. Run the script to configure the OS for Node:

   ```
   vprotect-node-configure
   ```
3. If the node service was not running before the update, you may also need to execute:

   ```
   systemctl enable vprotect-node --now
   ```
4. Log in to the web UI and check if the nodes are running.

{% hint style="info" %}
**Note:** You may need to refresh your browser cache after update:

Chrome use `CTRL+SHIFT+R` (Windows/Linux) / `CMD+SHIFT+R` (MacOS)
{% endhint %}

## Debian-based OS Upgrade

Cleaning the tasks list and backuping the internal database procedure does not change for that version, therefore, once you did that, proceed with the following:

### Server

Firstly, disable the server service:

```
systemctl stop vprotect-server
```

Open the file with the **vprotect** name found under this path:

```
/etc/apt/sources.list.d/
```

and edit the link to the repository with the version you are interested in.

Once finished, use the following two commands (remember to have the root priveleges):

```
apt-get update
apt-get install --only-upgrade vprotect-server
```

When both commands have been executed, start the server again:

```
systemctl start vprotect-server
```

### Node

Firstly, stop the node:

```
```

**If you have not done that earlier**, repeat the file editing steps from this path:

```
/etc/apt/sources.list.d/
```

with the link to the version you are interested in and run the following two commands with the root priveleges:

```
apt-get update
apt-get install --only-upgrade vprotect-node
```

After executing the above, you can start and reconfigure the node:

```
systemctl start vprotect-node
vprotect-node-configure
```
