Installing Apache Solr: Permission Denied - solr

I am using iMac to run Apache Solr in command line. done the following:
wget https://apache.mirrors.nublue.co.uk/lucene/solr/8.5.1/solr-8.5.1-src.tgz
tar -xzf solr-8.5.1-src.tgz
cd to /solr
i then typed : bin/solr start and got permissions denied.
I tried sudo bin/solr start -force
and got :password: type password
after typing the password i get sudo: bin/solr command not found
I read that I need to change the solr home directory for better installation as it is denying root access probably?
Appreciate any suggestion to get Solr starting
Thanks
Paul

I think you need to download the binaries instead of the source files, then run:
cd solr/bin
solr create -c yourCore
solr start -p 8983

change the permission to to bin folder
something like:
sudo chmod -R 777 bin

You should download and install the version without scr at the end:
https://apache.mirrors.nublue.co.uk/lucene/solr/8.5.1/solr-8.5.1.tgz

Related

Configure Solr home directory instead using -s in bin/solr start command

How can I configure the solr home path?
It works for me if I using the -s option in the start command:
bin/solr start -s /opt/solr/server/xy
But I want that solr use the home folder "/opt/solr/server/xy" also when I start solr WITHOUT the -s option like this:
sudo service solr start
I had configure in bin/solr.in.sh -> SOLR_HOME=/opt/xy/apps/solr/server/xy but when I restart (stop and start) solr the admin panel shows me: solr.solr.home /var/solr/data - which is wrong.
I also try to change the SOLR_HOME entry in the /etc/default/solr.in.sh file but that didn't work either
In the default file there were 2 entries that were overwritten.
It is the case that the "SOLR_HOME entry" in the "/etc/default/solr.in.sh" file has to be overwritten.

Zsh: Command Not found : mongo After trying to install mongodb 4.2 using brew

I have tried the following steps to install and setup mongodb in my mac from here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ but I got the following error when running the final "mongo" command in my terminal:
Error Message - Zsh: Command Not found : mongo
This error msg occurred after trying to install mongodb 4.2 using brew
sudo chown -R $(whoami) $(brew --prefix)/*
then
brew tap mongodb/brew
then
brew install mongodb-community#4.2
and
brew services start mongodb-community#4.2
or
mongod --config /usr/local/etc/mongod.conf
then
ps aux | grep -v grep | grep mongod
and
mongo
running brew services start mongodb-community#4.2 returns:
Successfully started `mongodb-community#4.2` (label: homebrew.mxcl.mongodb-community#4.2)
running ps aux | grep -v grep | grep mongod returns:
9081 0.2 0.5 5528024 41856 ?? S 3:01pm 0:01.48 /usr/local/opt/mongodb-community#4.2/bin/mongod --config /usr/local/etc/mongod.conf
7613 0.0 0.1 4298832 5600 s000 T 2:47pm 0:00.08 vim /usr/local/etc/mongod.conf
running mongod --config /usr/local/etc/mongod.conf returns:
zsh: command not found: mongod
There are also no mongo files in my /usr/local/bin directory after using these commands
I created a data/db folder in my /usr/local/bin directory using the following commands:
sudo mkdir -p /usr/local/bin/data/db
sudo chown -R `id -un` /usr/local/bin/data/db
Running "brew update" returns:
brew update
Updated 1 tap (homebrew/cask).
==> Updated Casks
brave-browser
brew install mongodb-community-shell
Fixed the problem for me.
Solved it by manually installing the mongodb community files and db tools using the website instead. Then copying them into /usr/local/bin. Then ignoring the app permissions whenever calling mongo or related commands in the terminal through System Preferences > Security & Privacy > General.
After googling I found out that mongoimport and the other features have to be installed separately: https://www.mongodb.com/try/download/database-tools
Followed by copying those bin files after extracting them into the same /usr/local/bin directory
Not sure why its' not working through homebrew though
This worked for me, I was having same issue on mongodb-community#4.4
brew reinstall mongodb-community#4.4
On terminal something like this will appear during reinstallation.
copy highlighted path with echo
echo 'export PATH="/opt/homebrew/opt/mongodb-community#4.4/bin:$PATH"' >> ~/.zshrc
Now open another terminal and start mongodb services
brew services restart mongodb/brew/mongodb-community#4.4
write mongo on terminal and here we fly
If you installed the mongodb via Homebrew. Need to add the mongo path in your bash_profile.
Edit the bash_profile vi ~/.bash_profile
Add the below line in EOF export PATH=$PATH:/usr/local/opt/mongodb-community#4.2/bin
After the edit bash_profile. Close all terminals and open them again. mongo command start works.
In addition to #ramesh-babu-t-b 's answer, https://stackoverflow.com/a/68407530/1279516, the issue could also be that your MongoDB installation did add mongod to your path, but the installation happened within the current shell session, and so your shell doesn't have the updates to the PATH variable yet.
In this case, only his last step is still necessary - Open a new console window and retry the mongod command.

How can I install Apache Solr into a specified directory in Ubuntu 18.04 LTS

I have installed Apache Solr into Ubuntu 18.04 LTS. I have used the following commands:
cd /vm
sudo wget http://apache-mirror.8birdsvideo.com/lucene/solr/8.2.0/solr-8.2.0.tgz
tar xzf solr-8.2.0.tgz solr-8.2.0/bin/install_solr_service.sh --strip-components=2
sudo bash ./install_solr_service.sh solr-8.2.0.tgz -d /vm
I am trying to install everything into a folder /vm.
But it throws an error and installs everything under /opt.
Everything works fine and I am able to add core, add a document, etc.
I want to be able to install it into my specified folder and I am not able to find an option for that. Is there any way to do this?
The parameter to give the install directory is -i /vm. -d configures the data directory.
The example from the manual that replicates the default settings:
sudo bash ./install_solr_service.sh solr-6.6.0.tgz -i /opt -d /var/solr -u solr -s solr -p 8983

mongo db (mongodb.service) failed, status 14

I am experiencing the following problem using mongodb.
This is the error, when I check the status:
Screenshot of the error (mongodb.service, status 14)
Screenshot of code in the mongod.config file
Screenshot of the log file
I have tried uninstalling mongodb following every step from the website and install everything again and when I check the status I still get the same error. I have posted the screenshot of the error.
I am using MacBook pro if this matters.
Would really appreciate, if someone can help me fix this.
By changing the owner to monogdb user of
/var/lib/mongodb and /tmp/mongodb-27017.lock has worked for me.
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
It seems from the log you have a unclean shutdown before. Or, it could also indicates that mongod is already running.
First, make sure mongod is not running already
ps aux | grep mongod
If it's not, remove the file:
rm /tmp/mongodb-27017.sock
Then try systemctl start mongod to start MongoDB again.
After rebooting in the command line,it fixed to problem,don’t know why after stopping mongo and uninstalling and installing it didn’t fix the problem, but after reboot everything is working fine.
This worked for me on Ubuntu 18.04
Go to the TMP directory: cd /tmp
Check if you have the mongodb sock file: ls *.sock
Change the user:group permission: chown mongodb:mongodb <YOUR_SOCK>
Start MongoDB: sudo service mongod start
Check the MongoDB status: sudo service mongod status
If this does not work you can try
sudo reboot
Please see here : https://medium.com/#gabrielpires/mongodb-ubuntu-16-04-code-exited-status-14-aws-lightsail-problem-417ffc78cb11
I had a similar issue and even though the permissions were all okay, the service failed to start. I had a look at the mongodb log
sudo tail -40 /var/log/mongodb/mongod.log
It said that the database was shutdown unexpectedly and needed to be repaired. I ran
sudo mongod --repair --config /etc/mongod.conf
This fixed the database, but now changed the permissions. You will need to do the chown steps again.
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
Start the mongod service. It would be up & running now.
Same happended with CentOS Stream 8
the user for mongodb service is mongo and group is also mongo
sudo chown mongod:mongod /tmp/mongodb-27017.sock
Resolved, after checking the logfile, showing mongodb-27017.sock failed to start.
I have a similar issue. Was a SELinux blocking the normal execution.
So, I did:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp
and then:
$ sudo systemctl start mongod
and check:
sudo systemctl status mongod
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock

Jetty 6.1 with Solr 4.4

Is it possible to run Solr 4.4 with jetty 6.1 from Ubuntus package repository? I followed this example:
http://www.kingstonlabs.com/blog/how-to-install-solr-36-on-ubuntu-1204/
And tried some other examples, but it seemed to be impossible to run run Solr 4.4 from Jetty's webapps directory.
In the example you can read in the comments, that people ended up with 404 when try to reach
http://localhost:8080/solr
I tried also the configuration steps from the Apache Solr 4 Cookbook by Rafal Kuc, page 6 "Running Solr on Jetty"
Here a summary of the steps:
tar xvfz solr-4.4.0.tgz
sudo cp ~/solr-4.4.0/example/webapps/solr.war /usr/share/jetty/webapps
sudo mkdir /usr/share/jetty/temp
sudo cp ~/solr-4.4.0/example/contexts/solr-jetty-context.xml /usr/share/jetty/contexts
#Change temp dir
sudo vi /usr/share/jetty/contexts/solr-jetty-context.xml
sudo cp ~/solr-4.4.0/example/etc/jetty.xml /usr/share/jetty/etc/
sudo cp ~/solr-4.4.0/example/etc/webdefault.xml /usr/share/jetty/etc/
sudo cp ~/solr-4.4.0/example/etc/logging.properties /usr/share/jetty/etc/
sudo mkdir /usr/share/solr
sudo cp ~/solr-4.4.0/example/solr/solr.xml /usr/share/solr/
sudo mkdir -p /usr/share/solr/collection1/conf
sudo cp ~/solr-4.4.0/example/solr/collection1/conf/schema.xml /usr/share/solr/collection1/conf/
sudo cp ~/solr-4.4.0/example/solr/collection1/conf/solrconfig.xml /usr/share/solr/collection1/conf/
# JETTY_HOME = 0.0.0.0; NO_START=0;
# JAVA_OPTIONS="-Xmx256m -Djava.awt.headless=true -Dsolr.solr.home=/usr/share/solr/"
sudo vi /etc/default/jetty
But
http://localhost:8983/solr
is not reachable afterwards. If found some error messages in the logs and i think that the jetty.xml from the Solr 4.4.0 files which substituting the Jetty 6.1 jetty.xml does not work with the rest of jetty 6.1
I remember so issues in the logs about Java/Jetty Server classes. i think tey differ.
Anybody with experiences in this case an can surely confirm my guess?
The clue is to integrate the libs from the solr example directory example/lib/ext into the solr.war.
Extract the files from the solr.war. Then put the libs into the WEB-INF/lib folder.
Create a new solr.war with the libs included.

Resources