-1

I have been tasked with installing Apache Solr on Cloud, for which I have selected a VM running Ubuntu 16.04.

I have completed the instalation of Solr 7.3.0. However, when I enter the following command:

command bin/solr start

I get the following message:

WARNING: Starting Solr as the root user is a security risk and is not best practice. Exiting.

I then attempted the Solr tutorial, Exercise 1 as set out here: https://lucene.apache.org/solr/guide/7_4/solr-tutorial.html

The result is the same regardless of the number of nodes I enter. On Stacks Exchange there is a prior question where answers were given: solr installation, cannot start examples

I chose the best answer to this question in which I was to have given solr user access to my directory, by entering the following command:

chown -R solr /opt/solr

as there is no solr group in the directory where solr is installed. Nonetheless, the result was the same error:

WARNING: Starting Solr as the root user is a security risk and is not best practice. Exiting.

without regard to whether I was plainly starting up Solr or starting up Exercise 1.

I then used the answer as presented in stacks from the link above

chown -R solr.solr /opt/solr

Again, the result was the same error

WARNING: Starting Solr as the root user is a security risk and is not best practice. Exiting.

without regard to whether I was plainly starting up Solr or starting up Exercise 1.

I am at loss as to how I should approach this matter. Please advise.

Thank you.

Tipo33
  • 181
  • 13

1 Answers1

0

Your changes does not change the user you're logged in as. Instead of using the root user (which has full access to your system), you should create an alternative user by using the adduser solr command, log out, and then log in as the user you just created.

If you read the error message, you can also see that Solr is telling you how you can override that message (but be aware, this is not recommended, and if your VM is available over any kind of network, can expose the complete contents of the VM to anyone that has access to it.

WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting.
         Please consult the Reference Guide. To override this check, start with argument '-force'

So you can use bin/solr start -force to really make Solr start as root, but you should try to understand how users work under Linux instead, and run Solr as a separate user.

The chown .. command you're issuing is only changing ownership of the files, not the user the application will run as (to do that, you'll have to log in as the user, use su to change to the user account or use sudo to run a single command as the other user. It's probably best to use either of the two first approaches first).

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • 1
    Thank you for the solution and apologies for the delayed reply. I have since implemented your solution and have experienced no further issues. – Tipo33 Feb 17 '20 at 02:28