OH2 - moving between Windows and Linux

I’m testing OH2 with a manual install on my Windows10 PC, by unzipping the downloaded zip file into a local folder. As it’s a Java app, is it possible to simply move this directory tree directly to Linux on a Pi and run it from there, assuming the permissions are set correctly? Are there any differences between the rules if I do?
I realise that an APT-GET is the preferred way to install on Linux, but this wouldn’t work without a lot of messing about as I’m running read only to minimise SD card writes, and due to the many power cuts we get around here. I have part of the file system that’s writable that my current OH 1.8 sits in with the logging redirected to a RAM Drive, which works well and I’d like to continue with

In Windows all of the files are contained in a single subdirectory tree. This is not so on Linux. Since I’m at work I can’t actually give you the specifics but the short answer is no. The actual content of the configuration files is compatible though.

1 Like

That actually is incorrect. On Linux you have multiple options for installation. One of them is to just have openhab run from within one folder.

http://docs.openhab.org/installation/linux.html#manual-installation

In my opinion the major difference between Windows and Linux is file naming. For example serial ports are defined as COM1 vs /dev/ttyUSB0

Yes, but you will have to change some of your configs if you are using any UDB devices. As @rtvb indicates, the names of serial and USB devices are different between Windows and Linux.

No, unless you are using the Exec binding or executeCommandLine in which case you will have to change your paths and potentially rewrite scripts accordingly.

Honestly, I see the manual installation being a lot more work than the apt-get method, even with this read only configuration. In both the apt-get and manual installation you will have to put userdata on a writable and persisted file system. If you choose to use a RAM disk you will have to write a cron job to periodically write userdata to a persistent file system as all of your config is stored there. And because there are internal processes that periodically creates backups of the JSON DB where the config is stored you are looking at a lot of work to figure out how and when to go rw on the file system to support these operations and then go back to ro.

Assuming that you already have /var/logs pointed to a tmpfs there is nothing additional needed to put the openHAB logs on your ramdisk. In the manual install you will have to either modify where the logging is done or set up soft links to put the userdata/logs on your tmpfs file system.

With the manual installation you will have to create and configure the openhab user unless you want to run openhab as root, a pretty significant security risk, particularly for a program that is potentially internet facing and made up of plug-ins written by lots of disparate developers.

With the manual installation you will have to set up and configure the scripts to make openHAB run as a service.

Thanks for the replies, i now have everything I need to work out how I’ll deploy…
I’ll update this thread when it’s all working for anyone else wanting to run read only. My current thoughts are maybe an apt-get installation with a few symbolic links to the writable parts of the file system. This machine runs a few other things so it’s non standard before I upgrade to OH 2

This posting might be useful to you:

Also, consider running your persistence database on some other host as the database writes will probably undermine what you are trying to achieve with the ro config in the first place.

Or consider running your Pis to boot and run off an external hard drive.

1 Like

Has anything changed that you know of in terms of writes to databases between the versions? I currently use MAPDB for restore on startup for items that can’t be recreated, I then persist those that infrequently change twice a day to MAPDB. Anything else I restore from one system to the other.
I also run a 32GB cards with 24GB Free space.

Nothing has changed. It is the writes that wear out the card so if you have OH configured to persist sparingly your SD card will last longer. But if you have lots of Items with everyUpdate persisted your card will wear out much much faster and power outages will have a greater chance of corrupting things.

Larger SD cards will certainly last longer (all other things being equal) but lots of writes will still wear it out. Logs and persistence are the two largest sources of writes in OH, hence the concern.

Like I said in the posting I linked to, YMMV. I’ve been running one Pi on the same SD card for years as an IP camera and not as read only. Others have had brand new SD cards wear out in weeks.

1 Like

Many tries over a couple of hours and still no joy moving from windows to linux. My main motivation is to be on standard setup so upgrading is easy. Windows upgrade scripts are not great and don’t want to be odd man out using windows.

Any ideas?

I copied conf and copied userdata. I suspect some folders of userdata should not be copied but no ideas from there.

See lots of suggestions on threads but no solutions. Any help is appreciated

Thanks in advance