What are "sufficient access rights to run the Nexus service" (as nexus user on Linux)
Nexus3 Documentation https://books.sonatype.com/nexus-book/reference3/install.html#configure-service say
Then create a nexus user with sufficient access rights to run the service.
I understand that logs should be writable, and scripts executable, but as while installing, possibly for the first time, how can user know?
But documentation does not guide about this.
Having recommended nexus
and sonatype-work
folders.
lrwxrwxrwx. 1 root root 25 Jun 5 16:46 nexus -> /opt/nexus/nexus-3.3.0-01
drwxr-xr-x. 9 root root 4096 May 11 08:26 nexus-3.3.0-01
-rw-r--r--. 1 root root 107331345 Apr 20 08:52 nexus-3.3.0-01-unix.tar.gz
drwxr-xr-x. 3 root root 4096 Apr 20 08:53 sonatype-work
Maybe that should be one command to add all permission for folder in nexus
and sonatype-work
folders?
IMPORTANT Be sure to assign the appropriate permissions to the user running the nexus service.
Nexus Service Account Setup for nexus-3.9.0-01 Linux
1. Create a service user
It is good practice to run the Nexus service or daemon as a specific user that has only the required access rights. The user should be named 'nexus' and it must be able to create a valid shell.
To add the user, run the following command:
sudo useradd nexus
Also, I've configured the user's home directory to be the install directory
sudo usermod -d /opt/nexus nexus
2. Configure the directory user and group owner
We need to grant the nexus user premission to the Nexus directories. We will be changing ownership from "root" to "nexus" for both the owner and group.
sudo chown nexus:nexus /opt/nexus -R
Run the "ls -l" to confirm the ownership change. The directories should like:
/opt/nexus$ ls -l
drwxr-xr-x 10 nexus nexus 4096 Mar 8 15:32 nexus-3.9.0-01
drwxr-xr-x 3 nexus nexus 4096 Mar 8 15:08 sonatype-work
3. Configure Nexus to run as your new service account
Now that we have created a new service account, we need to configure Nexus to run as our new "nexus" user. In the "/opt/nexus/nexus-3.9.0-01/bin" directory, please edit the "nexus.rc" file with nano or VI. The file should mirror the following:
run_as_user="nexus"
4. Validate the Install is working with the service account
To vaidate the that the install is working, start the Nexus service. To start the repository manager from application directory in the bin folder on a Unix-like platform like Linux use:
./nexus run
After starting the service for any Linux-based operating systems, verify that the service started successfully.
Startup is complete when the log shows the message "Started Sonatype Nexus".
tail -f /opt/sonatype-work/nexus3/log/nexus.log
Run the "top" command to cofirm that the service is running under the "nexus" user ( will require another terminal session)
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29688 nexus 20 0 7401296 1.155g 25424 S 0.3 4.2 4:23.95 java
To stop the service in the "top" terminal window, type:
./nexus stop
Next, you will need to configure the daemon to start up as a service using init.d or systemd. Please see the following link for the official Nexus documentation :
https://help.sonatype.com/display/NXRM3/Run+as+a+Service
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With