How to install an openHAB2 binding by terminal

How can one install binding or every addon by terminal or even karaf?

I know you are able to make an installation config in openhab2/services/addons.cfg but I would like to add packages whith the terminal after an initial installation

Thanks in advance

  1. Like you said, edit addons.cfg though you will need to list all the addons you want in this file. Note that you can change this file at any time, even after the initial installation and the changes will immediately take effect (i.e. removed add-ons are immediately removed and added add-ons are immediately installed).

  2. The REST API using curl:

curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" "https://<openhab address>/rest/extensions/<add-on id>/install"

where <openhab address> is the IP or hostname of your OH server and <add-on id> is the name of the add-on. Note, this would be the same ID you would put into addons.cfg

  1. I suspect there is a command one can issue from the karaf console (bundle:install ?) but it is not documented in the docs.

Thanks a lot. This looks promising. I will try all three solutions!