Ruan Bekker's Blog

From a Curious mind to Posts on Github

Setup MongoDB Client on CentOS 6

I have a bastion host that is still running CentOS6 and epel repos provides mongodb-shell version 2.x and Mlab requires version 3.x

Setup the Repositories

Create the repository:

1
2
3
4
5
6
7
8
$ cat > /etc/yum.repos.d/mongodb.repo << EOF
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
EOF

Update the repository index:

1
$ sudo yum update -y

Install MongoDB-Shell

Install the MongoDB Shell Client:

1
$ sudo yum install mongodb-shell -y

Connect to your Remote MongoDB Instance:

1
$ mongo remotedb.mlab.com:27017/<dbname> -u <user> -p <pass>

Comments