Step 1: Remove any previous repository
sudo rm -rf /etc/yum.repos.d/mongod* sudo yum clean all
Step 2: create new repo file
sudo vi /etc/yum.repos.d/mongodb-org-3.4.repo
Copy and paste below lines in mongodb-org-
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb. org/yum/amazon/2013.03/ mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb. org/static/pgp/server-3.4.asc
Save repo file and exit
Step 3: sudo yum install -y mongodb-org
Step 4 : service mongod start
Step 5 : Check mongod running status
service mongod status
Step 6: To ensure mongo will restart automatically on reboot
sudo chkconfig mongod on