Centos8 uses yum to install mongodb 4.2 method

1、 Make repo file

Refer to the mongodb official installation document, use the following script to make a Yum library to install mongodb4.2, but the installation process prompts "Failed to synchronize cache for repo'mongodb-org-4.2'"

[ mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

The reason is that the official installation package of centos8 has not yet been provided, because the $releasever variable is 8, so try to write the address to 7 to see if the centos7-based version can be installed.

Okay, use vim to create a repo file

sudo vim /etc/yum.repos.d/mongodb-org-4.2.repo

Enter the following configuration to the repo file, then save and exit vim

[ mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

2、 Use yum command to install

sudo yum install -y mongodb-org

The installation process used to be because the network was too slow and the download was unsuccessful. Just perform one more time. After a while, it prompts that the installation is successful and the process goes smoothly.

3、 Start mongodb

You can use it after installing and starting the service

The start, stop, and restart commands are as follows:

sudo service mongod start
sudo service mongod stop
sudo service mongod restart

4、 Open mongodb remote connection

The configuration file of mongodb is /etc/mongod.conf

If you want to open remote access, you need to modify the bindIp value of the file: 0.0.0.0, otherwise it will not be able to connect through other computers.

sudo vim /etc/mongod.conf

After the file is modified, restart to make the configuration effective

sudo service mongod restart

If you still cannot connect remotely, you can let the firewall open port 27017 (this port is the default port of mongodb, you can modify the port of mongodb through the configuration file)

firewall-cmd --permanent --zone=public--add-port=27017/tcp
firewall-cmd --reload

Refer to the official installation instructions:

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/#run-mongodb-community-edition

to sum up

The above is the method for centos8 to install mongodb 4.2 using yum introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message, and the editor will reply to you in time. Thank you very much for your support to the ZaLou.Cn website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!

Recommended Posts

Centos8 uses yum to install mongodb 4.2 method
Centos7 uses yum to install pip, ipython
Centos7.6 method to install Tomcat-8.5.39
Centos7 uses yum to install Apache, mariadb, PHP
How to install MongoDB on CentOS 7
CentOS 6.8 method steps to install vsftpd
How to install MongoDB on CentOS 8
Centos8 use yum to install rabbitmq tutorial
CentOS7 system yum way to install MySQL5.7
Centos7 YUM install MariaDB 10.0
CentOS 7.2 Yum install MySQL 5.6
Install MongoDB on CentOS 7
Centos7 install mongodb 4.x
Centos7 YUM install MariaDB 10.0
CentOS 5 to CentOS 5.8 YUM source
Centos7 uses LVM to achieve dynamic expansion method
Centos7 uses Ansible to install Chinese fonts in batches
centos install mysql through yum
Install MongoDB database under CentOS7
CentOS 6.8 under linux install mongodb
CentOS 7 yum install PHP7.3 tutorial
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
CentOS7 yum install and start mysql
CentOS Yum compile and install MySQL 5.6
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install PHP7.4 in CentOS
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install Yarn on CentOS 8
Install java in yum mode in Centos
How to install Nginx on CentOS 8
How to install MongoDB on Ubuntu 16.04
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
CentOS7 yum install and start mysql
Centos6 method steps to build gitlab
Centos yum install mysql5.6 or above
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install HDP2.6 in Centos7.2
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8