I've tried following the installation instructions laid out here: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
But I run into a problem with, I'm guessing, Upstart/initctl and I can't get the mongod service to start other than by running it manually as sudo in a terminal, which is a Bad Idea IMO. (Even if this is merely for a classroom, single-user setup.)
sudo /etc/init.d/mongod start
Yields this error:
initctl: Unknown job: mongod
I've tried sudo initctl reload-configuration and running the above start command again, to no avail.
Any ideas or suggestions on what to do next?
Installing mongodb using what the official documentation doesn't seem to work in crouton. Below are the instructions I followed to get it working on my machine (crouton running elementaryOS)
Download the physical mongodb package for linux (can be obtained from mongodb.org)
Extract the mongodb package using tar -xvzf mongodb-linux-x86_64-2.6.7.tgz
Make the installation directory (sudo mkdir /usr/lib/mongodb)
Copy the extracted mongodb into to /usr/lib/mongodb (sudo mv mongodb-linux-x86_64-2.6.7 /usr/lib/mongodb)
Make the data directory (sudo mkdir -p /data/db)
Start mongodb (sudo /usr/lib/mongodb/mongodb-linux-x84_64-2.6.7/bin/mongod &)
Related
I'm starting my coding journey and I have set up the Ubuntu terminal(WSL2). I followed this guide my cousin gave me and it included some directions to install PostgreSQL. I thought it would be a good idea to get it ahead of time, but now it's turning into a nightmare. I installed it and followed the directions to make it automatically connect to the server on the Ubuntu terminal start-up. Long story short, it makes the terminal take awhile to start-up, puts my terminal in some weird directory, and I won't even be using it, so we decided to get rid of it. We tried everything and finally decided to just uninstall it. Now on start-up, it's still trying to connect to the server or whatever. I tried running the code to make it automatically start-up again in case it might just toggle it on and off, but now it's attempting to connect three times on open. Please see the directions I used below as well as what my terminal is showing on start-up. Also, when I try commands to end it or whatever, it can't do it because postgresql can't be found (because I uninstalled it). Any thoughts?
Directions:
In a few weeks, we'll talk about SQL and Databases and you'll need something called PostgreSQL, an open-source robust and production-ready database.
Let's install it now.
sudo apt install -y postgresql postgresql-contrib libpq-dev build-essential
sudo /etc/init.d/postgresql start
sudo -u postgres psql --command "CREATE ROLE `whoami` LOGIN createdb;"
You can configure PostgreSQL to autostart, so you don't have to execute sudo /etc/init.d/postgresql start each time you open a new terminal:
sudo echo "`whoami` ALL=NOPASSWD:/etc/init.d/postgresql start" | sudo tee /etc/sudoers.d/postgresql
sudo chmod 440 /etc/sudoers.d/postgresql
echo "sudo /etc/init.d/postgresql start" >> ~/.zshrc
Error Code:
sudo: /etc/init.d/postgresql: command not found
sudo: /etc/init.d/postgresql: command not found
sudo: /etc/init.d/postgresql: command not found
➜ /home
Just remove the offending line from .zshrc.
Let me add that the Linux emulation of Windows cannot be used for serious work with a database, as it does not implement the vital system call fsync to persist data. Any operating system crash will result in data corruption.
I recently started developing with NodeJS. In the course I attend, they gave me steps to install on Mac but it's giving me problems. After a some googling, I understood that macOS Catalina has blocked writing access to the root folder. After that, I spent a day searching on Google and Stack Overflow for solutions to this problem. There were many different solutions, but none of them worked. Some installed, but the mongod command wouldn't work. Even the installation process on MongoDB itself didn't work.
At the end, I decided to use MongoDB Atlas. So in my cluster0, I went to Connect > Connect with mongo shell > I do not have MongoDB installed. They gave some steps to install it with Homebrew. Now, when I type mongo "mongodb+srv://cluster0.hflrg.mongodb.net/<dbname>" --username <myUserName>, it connects to MongoDB Atlas. The mongod command still doesn't work.
Can you tell me a way to install MongoDB on Mac. I have macOS Catalina Version 10.15.5.
Note: I don't have much experience with the terminal, so if possible, please avoid using terms like "Add so and so the you $PATH variable", and try to explain in detail. A huge thanks in advance.
I usually and like to install by downloading .tgz package from MongoDB Community Server, and setting up via command lines.
Download .tgz package from MongoDB Community Server.
Extract the files from the downloaded archive:
tar -zxvf mongodb-macos-*.tgz
Copy binaries in your PATH environment variable:
sudo cp /path/to/the/mongodb-directory/bin/* /usr/local/bin/
Create the data directory:
sudo mkdir -p /usr/local/var/mongodb
IMPORTANT
Starting with macOS 10.15 Catalina, Apple restricts access to the MongoDB default data directory of /data/db. On macOS 10.15 Catalina, you must use a different data directory, such as /usr/local/var/mongodb.
Create the log directory:
sudo mkdir -p /usr/local/var/log/mongodb
Run MongoDB:
mongod --dbpath /usr/local/var/mongodb --logpath /usr/local/var/log/mongodb/mongo.log
To run mongod in the background, use --fork at the end of command line:
mongod --dbpath /usr/local/var/mongodb --logpath /usr/local/var/log/mongodb/mongo.log --fork
Helpful links and references:
Installing MongoDB on macOS tarball
MongoDB on macOS Catalina v10.15+
Hope these may help! Have a great one!
Use Homebrew, it uses /usr/local by default.
brew tap mongodb/brew
brew install mongodb/brew/mongodb-community
brew services start mongodb/brew/mongodb-community
mongo --quiet --eval 'db.version()'
4.2.8
This worked for me, but is based on the answer by #Erni_Souza
Download the .tgz package from here MongoDB Community Server.
Extract the files on your machine using tar -zxvf mongodb-macos-*.tgz or just use the default Archive Utility.app on your machine.
Copy the binaries into your /usr/local/bin folder with:
sudo cp /path/to/the/mongodb-directory/bin/* /usr/local/bin/ just as instructed or you can resort to using the ./mongod command via Terminal.app from the folder you extracted into.
Create the data directory mkdir -p ~/data/db
Run mongodb
mongod --dbpath ~/data/db
or with
./mongod --dbpath ~/data/db
if the binaries are still in the directory you extracted them to.
You can check out this link MongoDB on macOS Catalina v10.15+ as given in the answer by #Erni_Souza for more information.
I'm using a tutorial to install MongoDB on the raspberry pi: http://notejs.com/?p=252
I have followed the instructions with complete success up till the line:
Connect to an instance:
mongo
I then get an error like this:
-bash: mongo: command not found
I have followed this tutorial step by step, the only difference is that I downloaded, compiled and installed MongoDB in a folder that isn't the home folder, could this be the problem?
edit: MongoDB is apparently running already when I enter the command:
sudo /etc/init.d/mongod start
So it's not the case that it's too much for my PI
The instructions have this section for making the mongod binary part of your path, which is why that is working:
sudo ln -s /opt/mongo/bin/mongod /usr/bin/mongod
But they do not do the same for the mongo shell binary. Hence you just need to do the same thing for the that binary, that is:
sudo ln -s /opt/mongo/bin/mongo /usr/bin/mongo
Alternatively you could add /opt/mongo/bin to your $PATH variable, or just call /opt/mongo/bin/mongodirectly.
After upgrading my system from 14.10 to 15.04 I can't seem to use docker like I used to. I already have a docker group that my user is part of and I used to be able to use docker without sudo just fine. Now I can't use it unless I have sudo docker -d running in another terminal. Simply running docker ps gives me this error:
FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
I've tried reinstalling, rebooting, restarting services, and blowing out configurations to no avail. Any tips would be appreciated. As a side note, I installing 15.04 in a vm to see if I could get docker working there and I was able to set it up no problem. seems like an issue specific to those who have upgraded from 14.10.
Did u checked this http://docs.docker.com/articles/systemd/? This helped me to start docker under Ubunu 15.04.
What to do if this fails...
$ sudo usermod -aG docker $USER
..and you have added user to docker group and Ubuntu still requires sudo:
If you initially ran Docker CLI commands using sudo before adding your user to the docker group, you may see the following error, which indicates that your ~/.docker/ directory was created with incorrect permissions due to the sudo commands.
To fix this problem, either remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:
$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
$ sudo chmod g+rwx "$HOME/.docker" -R
What the link mafahand provided tells is how to use docker on a systemd based host. Ubuntu 15.04 uses systemd now while older version used upstart. That might explain why upgraded systems show erratic behavior. Check out the Ubuntu wiki for some help on that regard.
After installing docker via
sudo apt install docker.io
you might have to reboot your system or start the docker.socket unit manually. For some reason that did not happen on my machine after installing it.
Type
systemctl status docker
to check whether docker is up and running. If it is not enabled use
sudo systemctl enable docker
to enable it permanently and/or
sudo systemctl start docker
to run the service.
go to run jenkins after doing an upgrade, and get the following:
start jenkins
start: Job failed to start
That's it...nothing shows up in jenkin's log...so it is difficult to debug to say the least.
(and it isn't running already, or anything like that).
Is there another log somewhere that I should be looking at that would be helpful?
(I am assuming answer to this problem will be somewhat iterative, so hopefully someone can start me on a path to debug this)
So, knowing it was a pre-start error allowed me to investigate more deeply.
Further digging allowed me to figure out that the exact line in the /etc/init/jenkins.conf file was one pointing to the /usr/share/jenkins/bin/maintain-plugins.sh
Looking at this location, I found it was not present (ie. no bin directory). This means that jenkins-common was no longer installed for some reason...odd indeed...going into apt-get and doing an install of this component again led to the error:
dpkg error processing /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb ...
having seen this error before and refreshing my memory via google gave the following solution:
dpkg -i --force-overwrite /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb
This allowed the installation of common to proceed as normal. After this, all I had to do was replace the /usr/share/jenkins/jenkins.war with my backed up copy (because ubuntu is far behind the latest release version), and I was able to start the server again.
I am not exactly sure what caused the problem to begin with, but it was likely during an apt-get upgrade/clean process...and because of the weirdness with jenkins conflicting with jenkins-common, it did not repopulate the /usr/share/jenkins directory properly.
regardless, am glad it is working again. :)
Instead, you can run the following before the install to properly clean up any conffiles left by the distro version:
sudo apt-get purge jenkins
Then install the correct version.
Ubuntu 18.04 LTS use Java 9 as default java
Jenkins 2.107.2 still use Java 8
[Solution]
Install Java 8 before install Jenkins
sudo add-apt-repository ppa:webupd8team/java
sudo apt install oracle-java8-installer
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"
sudo apt install jenkins
See https://stackoverflow.com/a/49937744/900684
I went to see the jenkins logs
tail -f /var/log/jenkins/jenkins.log
In my case it didn't start because I used incompatible java version.
Update and make sure it sees correct java (In my case it should have been opened using JRE 1.7. To check, please use java -version command) and all should work
The following worked for me:
sudo rm /etc/init/jenkins.conf
sudo update-rc.d jenkins defaults
sudo service jenkins start
Then....
root#core:/# service jenkins start
* Starting Jenkins Continuous Integration Server jenkins [ OK ]
Borrowed from: https://groups.google.com/forum/#!msg/jenkinsci-users/eW_yEWLojFc/tFhb8DKoRHUJ
I got from this link: https://serverfault.com/questions/710680/jenkins-not-starting-in-ubuntu
It might be caused by a full disk.
To be really sure, try running it manually. Like this:
/usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1