OH4 fresh install and restore OH3.4 data

I decided to install OH4 as fresh install so I wasn’t upgrading a system that was originally 2.5 and then 3.4.
Also, I didn’t want to start again or slowly move the rules and items etc to another system in parallel.
Another thing was I wanted to keep my graph data for the past year.

I am using Debian bookworm and I used the tar command to get the files I wanted (json, persistence, icons, etc)

After running the tar command and also doing a full openhab backup for just in case, I purged opehab 3.4 from my server.
I installed zulu java 17 and then I installed the latest OH4 stable version and started it and waited until the webpage came up. Then I stopped OH4.

I restored the tar and also in the script I had logic to create the addons that I needed including the Nashorn addon and also in the script I had logic to add application/javascript;version=ECMAScript-5.1 so Nashorn would work.

I ran sudo dpkg-reconfigure openhab and this ran the upgrader tool.

Then I started OH4 and watched the log file and everything worked!
I had my persistence data and graphs as well.

After running for a day I went and converted all the Nashorn rules to ECMAScript 262 Edition 11. and then removed the Nashorn addon.

Everything is working and I am happy with the results and have no memory issues and all is good.

A big thank you to all involved in the new version.

1 Like

It’s good to know that this worked. I don’t think it’s always guaranteed to work which is one reason we recommend against this approach. But it’s definitely a path that can work in some cases. I’m glad it worked going from OH 3 to OH 4.

Thanks for posting!

I’m of two minds. This post definitely is OK here but I wonder it Tutorials and Solutions would be a better category. What do you think?

Probably leave it in this topic as it is not really a tutorial but just another option to migrate to OH4.
If it was a really detailed how to and I included the scripts etc then it would be a tutorial/solution.

System is running well.

1 Like