code: public synchronized boolean installPlugin(String id, String version) throws PluginException {
          // Download to temporary location
          Path downloaded = downloadPlugin(id, version);
  
          Path pluginsRoot = pluginManager.getPluginsRoot();
          Path file = pluginsRoot.resolve(downloaded.getFileName());
          try {
              Files.move(downloaded, file);
          } catch (IOException e) {
              throw new PluginException(e, "Failed to write file '{}' to plugins folder", file);
          }
  
          String pluginId = pluginManager.loadPlugin(file);
          PluginState state = pluginManager.startPlugin(pluginId);
  
          return PluginState.STARTED.equals(state);
      }
docs: Installs a plugin by id and version.
  
  @param id the id of plugin to install
  @param version the version of plugin to install, on SemVer format, or null for latest
  @return true if installation successful and plugin started
  @exception PluginException if plugin does not exist in repos or problems during