[SOLVED] How to change the LSP port (5007) to another

You can change the LSP port within openHAB, using Paper UI (Configuration->Services->Misc->LSP), REST API

curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" -d "{port=5007}" "http://openhab-ip:8080/rest/services/org.eclipse.smarthome.lsp/config"

or even via services/runtime.cfg by adding this line

org.eclipse.smarthome.lsp:port=5007

Please be aware that you will get an error if trying to get the setting through REST API, as long as you did not set it yet, because port=5007 is default, so by default there is no config at all.