Is there any way to automate the SharePoint provider hosted apps installation and trusting process from appcatalog using CSOM/Rest API?
There is no way available right now to automate apps installation and trust in SPO. But in the upcoming weeks, it will be available via ALM APIs. The timeline is not clear but I think by December end or early January 2018, we will be able to use it.
You will be able to add, install, upgrade and remove the apps. The trust process will also be handled via the ALM APIs.
The ALM APIs will have native REST API support. But if you want to use CSOM or PowerShell, it will be available via PnP Core component or PnP PowerShell.
Below is the image of the operations that you will be able to do in the near future.
Currently PnP team has added the support for these operations in CSOM Core and PowerShell but you will be able to use it only when these features are available in your tenant.
YouTube link (starts at 16th min, you can stop at around 40th min)
PnP Powershell documentation links (self explanatory) -
Download PnP powershell - PnP-Powershell.
You need to wait for the upcoming PnP Core update to checkout these additions. Will be available in early Nov.