Move to new Hardware

OpenHab runs currently on my NAS. I want to move it do a Dedicated Server just for OpenHAB.
The Current System is OpenHab 2.3 stable on Debian 9, installed via apt-get. For the new System I plan to use the PC Engines APU.2C4 wich has 4x1Ghz and 4 GB ECC RAM. I want to use Debian again.

My things are created with the PaperUI automatic Detection, and my items and rules are written by hand. For Persitence I use mariaDB.

What files do I need to Backup?
Should I first upgrade to 2.4?
Other thing I should pay attention?

Sounds like you system is Linux. Here is the documentation for backing up a Linux system, just one piee of your puzzle to get started on

that link will take you right to the back up section of the docs