To run the OpenGrok code search engine using Unit:

  1. Install Unit with a Java 11+ language module.

  2. Follow the official OpenGrok installation guide. Here, we’ll place the files at /path/to/app/:

    $ mkdir -p /path/to/app/{src,data,dist,etc,log}
    $ tar -C /path/to/app/dist --strip-components=1 -xzf opengrok-X.Y.Z.tar.gz

    Our servlet container is Unit so we can repackage the source.war file to an arbitrary directory at Step 2:

    $ opengrok-deploy -c /path/to/app/etc/configuration.xml  \
          /path/to/app/dist/lib/source.war /path/to/app/

    The resulting pathname is /path/to/app/source.war.

  3. Run the following command so Unit can access the application directory:

    # chown -R unit:unit /path/to/app/


    The unit:unit user-group pair is available only with official packages, Docker images, and some third-party repos. Otherwise, account names may differ; run the ps aux | grep unitd command to be sure.

    For further details, including permissions, see the security checklist.

  4. Next, prepare the OpenGrok configuration for Unit:

        "listeners": {
            "*:80": {
                "pass": "applications/opengrok"
        "applications": {
            "opengrok": {
                "type": "java",
                "webapp": "/path/to/app/source.war",
                "options": [
  5. Upload the updated configuration. Assuming the JSON above was added to config.json:

    # curl -X PUT --data-binary @config.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config/


    The control socket path may vary; run unitd -h or see Startup and Shutdown for details.

    After a successful update, OpenGrok should be available on the listener’s IP address and port:

    OpenGrok on Unit - Search Screen