How to install an openHAB2 binding from a script

I am trying to create an installation package that will install and configure openhab2 with mqtt. Is there a way to install a binding from a shell script? Or another way?

If you edit the conf/services/addons.cfg file and add mqtt1 to the binding entry, then openhab will automatically install the binding. See my example addons.cfg file below. You’ll notice some of them have a 1 suffix. This means it’s an openhab 1.x binding.

package = standard

# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave")
binding = networkupstools1,zwave,mqtt1,mqttitude1,astro,weather1

# A comma-separated list of UIs to install (e.g. "basic,paper")
ui = paper,basic,habmin

# A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
persistence = mysql,rrd4j

# A comma-separated list of actions to install (e.g. "mail,pushover")
action = mail,xmpp

# A comma-separated list of transformation services to install (e.g. "map,jsonpath")
transformation = map,exec

# A comma-separated list of text-to-speech engines to install (e.g. "marytts,freetts")
tts =

# A comma-separated list of miscellaneous services to install (e.g. "myopenhab")
misc = hueemulation

Thanks! That works great.