mongo Archives - The Linux GURUS https://thelinuxgurus.com/tag/mongo/ Learn Linux & DevOPS from THE LINUX GURUS Sun, 23 Feb 2020 05:22:57 +0000 en-US hourly 1 https://i0.wp.com/thelinuxgurus.com/wp-content/uploads/2020/01/cropped-thelinuxgurus_transparent_name.png?fit=32%2C32&ssl=1 mongo Archives - The Linux GURUS https://thelinuxgurus.com/tag/mongo/ 32 32 148921671 Install PyMongo to connect Python & MongoDb https://thelinuxgurus.com/install-pymongo-to-connect-python-mongodb/ https://thelinuxgurus.com/install-pymongo-to-connect-python-mongodb/#respond Sun, 23 Feb 2020 05:22:57 +0000 https://thelinuxgurus.com/?p=1132 PyMongo is a python package that contains tools for connection to MongoDB. So if you have MongoDB installed for your application & you would like...

The post Install PyMongo to connect Python & MongoDb appeared first on The Linux GURUS.

]]>
PyMongo is a python package that contains tools for connection to MongoDB. So if you have MongoDB installed for your application & you would like to connect to that from your python application, then you would be using PyMongo to make that connection. It’s the recommended way to work with MongoDB from python.

Recommended Read: Recommended guide to install POSTGRESQL from Source

Also Read: Install ROBO3T on Ubuntu (Install RoboMongo)

In simple words, PyMongo is a python driver for MongoDB & connects to MongoDB using python. In this tutorial, we will learn to install PyMongo on our Linux systems. But first, we will start with the pre-requisites.

Pre-requisites

Since we are going to make connections from python to MongoDB, obviously we would need to have both installed on our systems. Please refer to the following articles to install Python & MongoDB on your Linux systems.

Install python on Ubuntu

Install python on CentOS/RHEL

Install Python from source

Install MongoDB on Ubuntu & Ubuntu 16.04

Install MongoDB on CentOS/RHEL

Once we have these installed on our systems, we can process with the PyMongo installation.


Install PyMongo

We will be discussing three methods to install PyMongo on Linux systems,

1- Using PIP

2- Using easy_install

3- Using source package

Now let’s discuss all three methods in detail.


1- Using PIP

You should check if you have PIP installed on your systems. If it’s not installed, then you can tutorials to install it on CentOS/RHEL & on Ubuntu. Once that is installed, use the following commands to install PyMongo,

$ python -m pip install pymongo

To install a specific version, the command is,

$ python -m pip install pymongo==3.5.1

& if you need to upgrade the installed version, the command is,

$ python -m pip install –upgrade pymongo


2- Using easy_install

Easy_install is a python module that is part of the Python setuptools package, so if it is not installed on your system, install it using the following command on Ubuntu,

$ sudo apt-get install python-setuptools

Or you can also install it all systems that have pip installed with the following command,

$ pip install setuptools

Once the package has been installed, we can use easy_install for PyMongo installation,

$ python -m easy_install pymongo

To upgrade it, the command is,

$ $ python -m easy_install -U pymongo

Now let’s discuss the final method, i.e. install using Source packages.


3- Using source package

We need to first install some dependencies first, then we can install the PyMongo on our systems. For Ubuntu/Debian, execute the following command from the terminal,

$ sudo apt-get install build-essential python-dev

For Redhat/CentOS, use the following command,

# yum install gcc python-devel

Now we can download the PyMongo packages from the GitHub repository & install it on our systems,

$ git clone git://github.com/mongodb/mongo-python-driver.git pymongo

$ cd pymongo/

$ python setup.py install

That’s it, PyMongo is now installed on our systems. We can now use it to connect to MongoDB from Python. This also concludes our tutorial on the installation of PyMongo on Linux systems. Please do let us know about your questions, queries or suggestions, you can use the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Install PyMongo to connect Python & MongoDb appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/install-pymongo-to-connect-python-mongodb/feed/ 0 1132
Install ROBO3T on Ubuntu (Install RoboMongo) https://thelinuxgurus.com/install-robo3t-on-ubuntu/ https://thelinuxgurus.com/install-robo3t-on-ubuntu/#comments Sun, 23 Feb 2020 05:12:08 +0000 https://thelinuxgurus.com/?p=1125 Robo 3T or Robomongo as it was called formerly, is a free, lightweight GUI MongoDB management tool. It provides GUI tools for managing & querying...

The post Install ROBO3T on Ubuntu (Install RoboMongo) appeared first on The Linux GURUS.

]]>
Robo 3T or Robomongo as it was called formerly, is a free, lightweight GUI MongoDB management tool. It provides GUI tools for managing & querying the MongoDB database. It embeds the actual mongo shell that allows for CLI as well as GUI access to the database.

Recommended Read: Simple guide to install MongoDB on Ubuntu 18.04

 Also Read: Complete guide to Install Django on Ubuntu

In this tutorial, we will learn to install Robo3T on Ubuntu (or we can also say install RoboMongo), we will be installing the latest version of ROBO 3T i.e. 1.3 which has support for MongoDB 4, an upgraded mongo shell, support for importing from MongoDB SRV connection strings, etc. So let’s start with the process to install Robo3t on Ubuntu servers.

Install Robo3T on Ubuntu

We are assuming that you have MongoDB installed on your system. If you still have not installed MongoDB, please refer to our tutorials for installing MongoDB on Ubuntu & CentOS. Now back to Robo 3T installation, we will be discussing two methods for the installation of Robo 3T,

1- Install using SNAP

2- Install using Official Packages


1- Install Robo3T using SNAP

Snap package manager is available by default on Ubuntu 16.04 & above, if it’s not installed on your system then you can install it using the tutorial HERE. Once the snap is installed, we can install Robo 3T on Ubuntu with the following command,

$ sudo snap install robo3t-snap

Once installed you can run it either from the menu or using the following command from the terminal,

$ robo3t


2- Install Robo3T using Official packages

Firstly, we need to download the Robo 3T, use the following command to download the latest packages,

$ wget https://download-test.robomongo.org/linux/robo3t-1.3.1-linux-x86_64-7419c406.tar.gz

You can create a folder for robo 3t,

$ mkdir -p /data/robo3t

Next, extract the files from tar to that folder,

$ tar -xvzf robo3t-1.3.1-linux-x86_64-7419c406.tar.gz -C /data/robo3t

Now go to the extracted folder,

$ cd /data/robot3t

Once in the folder, we can start the robot 3t with the following command,

$ ./robot3t

Robo 3T will now start & will keep running until the script is stopped or the session is closed. You can also start the script in background in the following command,

$ nohup ./robot3t &

That concludes our tutorial on how to install Robo3T on Ubuntu (install RoboMongo). Please do let us know if you have any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Install ROBO3T on Ubuntu (Install RoboMongo) appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/install-robo3t-on-ubuntu/feed/ 4 1125
Simple guide to install MongoDB on Ubuntu 18.04 https://thelinuxgurus.com/simple-guide-to-install-mongodb-on-ubuntu-18-04/ https://thelinuxgurus.com/simple-guide-to-install-mongodb-on-ubuntu-18-04/#respond Fri, 24 Jan 2020 07:04:22 +0000 https://thelinuxgurus.com/?p=1037 MongoDB is a free & open-source No-SQL database, it uses JSON like document format to store data in the database which is unlike the SQL...

The post Simple guide to install MongoDB on Ubuntu 18.04 appeared first on The Linux GURUS.

]]>
MongoDB is a free & open-source No-SQL database, it uses JSON like document format to store data in the database which is unlike the SQL database, where data is stored in a row & column-based format.

MongoDB is very fast & has great performance when compared to the SQL database. MongoDB databases are very easy to scale & they also address various shortcomings that other SQL databased present. MongoDB is completely ideal for the types of DB required to handle the data that we have today i.e. big data, IoT, online gaming, etc.

Recommended Read: Scheduling CRON Jobs with Crontab for Beginners

Also Read: Ultimate guide to install PYTHON from source

In this tutorial, we will learn to install MongoDB on Ubuntu 18.04. There are two methods with which we can install MongoDB on Ubuntu 18.04,

1- Install using apt manager,

2- Install using tar packages.


1- Install MongoDB on Ubuntu 18.04 using apt

We need to first make sure that “gnupg” package is installed on the system or not, cause we will receive an error while importing the public keys for mongodb if it’s not installed. Install it with the following command,

$ sudo apt-get install gnupg

Next, we will import the public keys for MongoDB,

$ wget -qO – https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add –

Next, we will create the list file for MongoDB with the following command,

$ echo “deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

Now reload the repositories for packages,

$ sudo apt-get update

Now to install MongoDB on Ubuntu 18.04, execute

$ sudo apt-get install -y mongodb-org

Or to install a specific version, use

$ sudo apt-get install -y mongodb-org=4.2.2 mongodb-org-server=4.2.2 mongodb-org-shell=4.2.2 mongodb-org-mongos=4.2.2 mongodb-org-tools=4.2.2


2- Install MongoDB on Ubuntu 18.04 using tar packages

Before we can download & install mongodb using tar packages. We must have some packages installed on our servers,

$ sudo apt-get install libcurl4 openssl

We will create a directory for keeping the mongodb packages,

$ mkdir -p /data/mongodb

Next, we have to download the package using the following command,

$ wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.2.tgz

Next, we need to extract the file to the created directory,

$ tar -xvzf mongodb-linux-x86_64-ubuntu1804-4.2.2.tgz -C /data/mongodb

Next, we will create symbolic links to the binaries directory,

$ sudo ln -s /data/mongodb/bin/* /usr/local/bin/

Now, we need to create a data directory & log directory as well,

$ sudo mkdir -p /var/lib/mongo

$ sudo mkdir -p /var/log/mongo

Next, we have change ownership of these folders to mongod,

$ sudo chown -R mongod:mongod /var/lib/mongo

$ sudo chown -R mongod:mongod /var/log/mongo

Note: When installing using apt package manager, all these folders are created by the system only with required permissions.


Starting & connecting MongoDB

Once we have installed mongodb, we can start the database with the following command,

$ sudo systemctl start mongod

Also, we can use the following command to start db,

$ mongod –dbpath /var/lib/mongo –logpath /var/log/mongodb/mongod.log –fork

Now to connect to the database,

$ mongo


Connecting database from remote systems

By default, we can only connect the database from the localhost & to be able to connect the database from other systems, we need to make configuration in mongodb configuration file,

$ sudo vi /etc/mongod.conf

& look for “net.bindIp”, then change it the following

net.bindIp 0.0.0.0

You can also change & mention a single remote IP address if you only need to connect from a single remote system. After making the changes, you need to restart the database to implement the changes made,

$ sudo systemctl stop mongod

$ sudo systemctl start mongod

Note:- If running database through CLI, we can mention the parameter “–bind_ip” followed by ‘0.0.0.0’ for connecting from all remote IPs or we can also mention a single IP address.

That’s it guys, we now end this tutorial on how to install MongoDB on 18.04. Please do send us your questions, queries & suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Simple guide to install MongoDB on Ubuntu 18.04 appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/simple-guide-to-install-mongodb-on-ubuntu-18-04/feed/ 0 1037