How to create Solr 6 cores? - linux

I've installed Solr 6 on a Digital Ocean ubuntu instance:
install_solr_service.sh solr-6.1.0.tgz
and verified that Solr is running. However, I cannot create any cores, either through the UI or at the command line. I've tried various different permutations of:
sudo ./solr create -c netest
including
sudo ./solr create -c netest -d /opt/solr/server/solr/configsets/basic_configs/conf/
but it always gives me:
ERROR: Error CREATEing SolrCore 'netest': Unable to create core [netest] Caused by: /var/solr/data/netest/data
If I create the directory in advance:
sudo mkdir /var/solr/data/netest/
sudo mkdir /var/solr/data/netest/data
sudo chown -R solr:solr /var/solr/data
when I rerun the create command I get:
ERROR: Error CREATEing SolrCore 'netest': Unable to create core [netest] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/var/solr/data/netest'
If I copy solrconfig.xml into the directory and run the command again I get:
ERROR: Error CREATEing SolrCore 'netest': Unable to create core [netest] Caused by: Can't find resource 'schema.xml' in classpath or '/var/solr/data/netest'
and I'm stuck at this stage as google isn't helping me find where to get or create the schema.xml file.
Can anyone help?

Try this way
Navigate to Solr/solr-6.1.0/server/solr/
create new folder and name it netest.
copy conf folder from Solr/solr-6.1.0/server/solr/configsets/basic_configs/ and paste it inside netest folder.
now you enter this command on terminal sudo ./solr create -c netest
This will create newcore with name netest using config files inside conf folder
hope this helps

You shouldn't use root, but solr user privileges to create Solr cores since data folder (e.g. /var/solr/data) is usually owned by solr. Secondly please note that provided solr shell script is still using the Solr Admin UI as the main starting point for administering Solr.
So try the following commands:
cd /opt/solr
sudo -u solr ./bin/solr create -c netest
sudo ls -la /var/solr/data
For any other problems, please double check that:
Solr is accessible via Admin UI (e.g. curl -s http://localhost:8983/solr/ or links).
jar command is accessible (it is in your PATH).
For syntax, run: bin/solr --help in your Solr HOME folder.
For troubleshooting, check your Solr logs (e.g. /var/solr/logs/solr.log).
Related: SOLR-7826: Permission issues when creating cores with bin/solr as root user.

Its permission issue, so try to create a new core using below command, and it will work!
sudo -u solr bin/solr create -c demo

If you have created schema.xml and solrconfig.xml in your core directory, try Add Core from core admin page, it should work.

./solr create_core -c netest -d basic_configs

su - solr -c "/opt/solr/bin/solr create -c testcore -n
data_driven_schema_configs"
This command works for me in solr 6.60 with the sudo user.

Related

VS Code on linux, various permissions errors

Is there any way to get vs code to work properly in linux? I can't run sudo code . because that gives me an error saying it's not secure to do so, I can't do anything within the editor to force doing things, like staging a file in git, or reloading a newly installed extension. I've googled around, and it seems nobody else has posted about this, and it seems highly unlikely that I'm the first to raise issue about this. (Take it easy on me, I'm a relatively new linux user). I'm trying to figure this out on Ubuntu 18.04 if that's relevant at all. My version of vs code is 1.30.2
I guess my main question is what's the right way to get applications like vs code to be able to perform tasks that required doing things without fighting the OS about sudo and privileges?
Launch via sudo from terminal
To launch VSCode as root --which is highly discouraged-- you must specify an alternate user data directory as follows:
$ sudo code --user-data-dir /path/to/alternate/folder
VSCode will automatically generate the required folders in the selected directory and launch with root privileges.
Change permissions to fix "permission denied" error
The solution in this case is to manually change the permissions of the two directories /home/$USER/.config/Code/ and /home/$USER/.vscode/. Perform these steps:
$ sudo chmod 755 /home/$USER/.config/Code
$ sudo chmod 755 /home/$USER/.vscode
To answer your other question:
If you really need to run several commands as root and you are annoyed by having to enter your password several times (when sudo has expired), just do sudo -i and you'll become root.
If you want to run commands using pipes, use sudo sh -c "comand1 | command2".
You may also want to take a look at this Ask Ubuntu answer about running applications as root.
I solve this problem using:
sudo chown -R YOUR_USER YOUR_PROJECT/
You basically need to tell the OS that you are the owner of the files you create. Use sudo chown <user name> <projects directory>
However, if you already created some files before applying chown, don't forget to change their permission also sudo chown <user name> <projects directory>/<file name>.

Cassandra - ERROR: Doesn't have write permissions for ./../data/data directory

I just now installed Datastax Enterprise. I trying to run the commands. I am using OS X (Sierra).
cd dse/bin
./cassandra
After some process I am getting errors like this:
ERROR 02:29:11 Doesn't have write permissions for ./../data/data directory
ERROR 02:29:11 Insufficient permissions on directory ./../data/data
I saw one of the similar issue and found thier suggestion that run below commands:
sudo chown -R cassandra:cassandra /var/lib/cassandra/data
sudo chown -R cassandra:cassandra /var/lib/cassandra/commitlog
Even now I am getting other issue:
chown: cassandra: illegal group name
How did you install DSE? /var/lib/cassandra/data is typical path from an installation from packages under linux while ./../data/data/ seems to be a tarball installation (for defaults locations etc see https://docs.datastax.com/en/dse/5.1/dse-dev/datastax_enterprise/install/dseTarLoc.html).
Your data directory is configured inside dse - you need to check the permissions there or configure your data directory in cassandra.yaml.
At least in some cases CASSANDRA_HOME is set in
bin/cassandra.in.sh
I am not sure how Cassandra gets there without CASSANDRA_HOME being set but there is no question that it can get there because the first thing cassandra.in.sh does is check if CASSANDRA_HOME is not initialized here:
if [ "x$CASSANDRA_HOME" = "x" ]; then
# CASSANDRA_HOME="`dirname "$0"`/.."
CASSANDRA_HOME=/usr/local/c4/cassandra
fi
Because cassandra.in.sh lives in bin/cassandra.in.sh this thing
"dirname "$0"/.."
forces data/data (which is important, as you will learn) to be considered in
/usr/local/c4/cassandra/bin/../data/data
To find where you put bin/cassandra.in.sh do a
sudo updatedb
locate data/data
In my case this is where I put it:
server#think:$ locate data/data
/usr/local/c4/cassandra/data/data
You can see above in the code box my solution for now is to hard code the location. I am sure I will figure out how it all works in good time. Now for the second part of your question you need to learn how Ubuntu uses group names to get that part to work. You were on the right track with:
sudo chown -R cassandra:cassandra /var/lib/cassandra/data
sudo chown -R cassandra:cassandra /var/lib/cassandra/commitlog
But you have not created the group yet, I used these instructions successfully:
https://www.admintome.com/blog/install-cassandra-on-ubuntu-18-04/
Finally, I can see from my notes I did spend a fair amount of time getting this to work correctly even if I don't understand every part of Cassandra yet. If you would like to dig in the to mysteries of CASSANDRA_HOME yourself, start with this:
sudo grep -R "CASSANDRA_HOME" /usr/

RStudio cannot reach .Rhistory on Ubuntu

I was working with markdown file on RStudio. I have Ubuntu 14.04 on my laptop. I produce html files using knitr. I decided to clean my enviroment and added rm and gc commands at the end.
Now here is a message in my console window:
Error attempting to read history from ~/.Rhistory: permission denied (is the .Rhistory file owned by root?)
What it means? Is it bad for my code?
You are right - the first time you ran it, you were in sudo mode, and the .Rhistory file was created with root as the owner. Running RStudio as root would remove the symptom, but is not ideal. To be able to run it as a regular user, simply change the owner of the .Rhistory file:
sudo chown -c <user_name> .Rhistory
In the best traditions of stackoverflow I reply to my own question! The problem occurred because when I first started R, I did it as su:
sudo R
so I can load a lot of useful libraries in /usr/lib/R/site-library and not in my account. As result .Rhistory became su file. It is possible for RStudio to see it if it is started as
sudo rstudio
and then all is fine.

Run executable file from a different user

While creating an rpm spec file I have created a new user and group in the %pre section. This new user does not however have permission to login from from shell for security purposes. Now when I install the rpm this new user is successfully created. However, I wish to start the installed rpm service with the newly created user. Currently I simply write; 'filePath/file.exe file.cfg' to execute the file.exe with its configuration file i.e. file.cfg in my 'init.d' file to start the service. How can I modify this command to start the same service but with the user that I created while installing the rpm? Basically I want to execute the program in my init.d file but through a different user, like I would have done with sudo if my required user was the super user. Any feedback will be highly appreciated.
Your initial starting point both for installing the rpm and for running the service is privileged. For instance, on my CentOS 6 machine, I see in /etc/passwd
games:x:12:100:games:/usr/games:/sbin/nologin
but running as root, I can do this:
$ sudo -u games /bin/sh
sh-4.1$ echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin
sh-4.1$ id
uid=12(games) gid=100(users) groups=100(users) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
sh-4.1$ cd
sh-4.1$ pwd
/usr/games
In your service script, you can use sudo to run a given process as another user (though a quick check of the same machine does not show this being done).
#msuchy points out that runuser may be preferable. I see that this is relatively recent (according to Ubuntu runuser command?, appeared in util-linux 2.23 -- lacking a date makes release notes less than useful...). The oblique comments in its documentation about PAM make it sound as if this circumvents some of the security checks. Perhaps someone has a better comment about that.

Open GTS build failed

Every thing is okay (Opengts dir & tomcat dir have permission 777) but i am getting this error again & again, why--
executing # sudo ant all then i get this error
BUILD FAILED
/usr/local/OpenGTS_2.4.5/build.xml:111: CATALINA_HOME environment variable has not been defined.
(make sure CATALINA_HOME is defined and exported to the list of environment variables)
I got the this msg when starting the tomcat
sudo ./startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-6.0.36
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.36
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.36/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/apache-tomcat-6.0.36/bin/bootstrap.jar
Any one have the solution please tell me how to fix this error.
Try to configure OpenGTS in your home directory (rather than /usr/local/).
And use ant all command (not sudo ant all).
Good Lock.. :)
First run this command:
echo $CATALINA_HOME
It should give you the path to your tomcat directory, which I'm assuming is /usr/local/apache-tomcat-6.0.36, but if you see a different path, or if the response is blank, try running this command:
export CATALINA_HOME=/usr/local/apache-tomcat-6.0.36
If you read the OpenGTS Configuration Manual, it talks about the CATALINA_HOME environment variable for Linux in section 2.4a. There are other environment variables too that you must set to install OpenGTS successfully (All mentioned in the manual).
To solve this problem, ensure the OpenGTS2.6.x has all files and directories to user:group same as logged in user. then run / ant all command
Please note that "sudo ant all" doesn't work.
Use this command to change ownership of OpenGTS files/dir
/usr/local/OpenGTS2.6.2> cd ..
sudo chown -R ranjan:ranjan OpenGTS2.6.2
change ranjan to your username: group name
/usr/local/OpenGTS2.6.2> ant all
It will work.
Try to install tomcat7 rather than tomcat6 via command line
apt-get update
apt-get install tomcat7
Configure CATALINA_HOME by
export CATALINA_HOME=/usr/share/tomcat7

Resources