Skip to main content

Installing MarkLogic Server

Configuring MarkLogic Server to Run as a Non-Daemon User

On UNIX-based systems (Linux), MarkLogic runs as the UNIX user named daemon. This section describes how to change a configuration to run as a different UNIX user. This procedure must be run by the root user. Additionally, the root user is still required for installing and uninstalling MarkLogic and for starting and stopping MarkLogic from the startup scripts.

To modify an installation to run as a user other than daemon, perform the following steps:

  1. In a command window on the machine in which you installed MarkLogic, log in as the root user.

  2. Make sure MarkLogic is stopped. If it is still running, stop it as follows:

    Platfrom

    Steps

    Red Hat Linux

    As the root user, enter the following command:

    /sbin/service MarkLogic stop
  3. Edit the configuration file for your platform using a text editor such as vi.

    Platform

    Configuration file

    Red Hat Linux

    /etc/marklogic.conf

    Note

    You must create the /etc/marklogic.conf file if it does not exist. The file is only read by the MarkLogic startup: it is never written to. Therefore, it will survive uninstalling MarkLogic.

  4. In the file /etc/marklogic.conf, add or edit the MARKLOGIC_USER environment variable to point to the user in which you want MarkLogic Server to run. For example, if you want it to run as a user named raymond, change the following line:

    export MARKLOGIC_USER=daemon

    to the following:

    export MARKLOGIC_USER=raymond
  5. Save the changes to the /etc/marklogic.conf file.

  6. If you have not yet started MarkLogic after performing a clean installation (that is, after installing into a directory where MarkLogic has never been installed), then you are done and you can skip the rest of the steps in this procedure. If you have an existing installation (for example, if you are upgrading to a maintenance release), then continue with the following steps.

  7. For all of the MarkLogic files owned by daemon, you need to change the owner to the new user. This includes all forest data and all of the configuration files. By default, the forest data is in the following directories:

    Platform

    Configuration file

    Red Hat Linux

    /var/opt/marklogic
  8. For example, on a Linux system, perform a command similar to the following, which changes the owner to the user specified earlier in the /etc//MarkLogic.conf file:

    chown -R raymond /var/opt/MarkLogic
  9. Make sure to change the owner for all forests in the system; otherwise, forests will fail to mount upon startup. Note that the above command only changes the owner for forests installed in the default directory. You need to run a similar command on the data directory for each forest in which a data directory is specified.

  10. When you have completed all the file and directory ownership changes, start MarkLogic as described in Starting MarkLogic Server.

Once you have performed this procedure, all new files created by MarkLogic are created with the new user ownership; there will be no need to change any ownership again.

Warning

On Linux systems, use the /etc/marklogic.conf script to set environment variables. Any configuration changes you make to the MarkLogic-supplied startup script (for example, /etc/sysconfig/MarkLogic) will not survive an upgrade and need to be merged in during any upgrade of MarkLogic (because the installation installs a new version of the startup scripts). Under Linux, the uninstallation process saves an old version of the scripts (for example, /etc/sysconfig/MarkLogic.rpmsave), so you can use that version to merge in your changes. If you perform a clean installation (not an upgrade installation), however, you will need to run this entire procedure again. If you use /etc/marklogic.conf for your environment variable changes, they will survive an upgrade and you will not need to merge your changes.

The following are default values of environment variables you can override in /etc/marklogic.conf on Linux-based systems (you will have to create the file if it does not exist):

export MARKLOGIC_INSTALL_DIR=/opt/MarkLogic 
export MARKLOGIC_DATA_DIR=/var/opt/MarkLogic
export MARKLOGIC_FSTYPE=ext4
export MARKLOGIC_USER=daemon
export MARKLOGIC_PID_FILE=/var/run/MarkLogic.pid
export MARKLOGIC_UMASK=022
export MARKLOGIC_DISABLE_JVM=0
export MARKLOGIC_EC2_HOST
export TZ=:/etc/localtime