-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
install-mongodb-on-red-hat.txt
156 lines (96 loc) · 4.08 KB
/
install-mongodb-on-red-hat.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
=======================================================================
Install MongoDB Community Edition on Red Hat Enterprise or CentOS Linux
=======================================================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: twocols
Overview
--------
Use this tutorial to install MongoDB Community Edition on Red Hat Enterprise Linux or
CentOS Linux versions 6 and 7 using ``.rpm`` packages. While some of these
distributions include their own MongoDB packages, the official MongoDB
Community Edition packages are generally more up to date.
.. admonition:: Platform Support
.. include:: /includes/fact-installation-64bit.rst
.. include:: /includes/fact-installation-rhel5.rst
Packages
--------
.. include:: /includes/list-mongodb-org-packages.rst
.. include:: /includes/fact-installation-bind-ip-default-in-config.rst
Init Scripts
------------
.. |init-script-path| replace:: ``/etc/rc.d/init.d/mongod``
.. include:: /includes/fact-mongodb-org-package-init-scripts.rst
.. include:: /includes/fact-installation-bind-ip-default-in-config.rst
Install MongoDB Community Edition
---------------------------------
.. include:: /includes/extracts/install-past-mongodb-org-red-hat.rst
.. include:: /includes/fact-installation-64bit.rst
.. include:: /includes/steps/install-mongodb-on-red-hat.rst
Run MongoDB Community Edition
-----------------------------
Prerequisites
~~~~~~~~~~~~~
Directory Paths
```````````````
To Use Default Directories
++++++++++++++++++++++++++
.. container::
By default, MongoDB runs using the |mongod-user| user account and
uses the following default directories:
- |mongod-datadir| (the data directory)
- ``/var/log/mongodb`` (the log directory)
|arrow| If you installed via the package manager,
The default directories are created, and the owner and group for
these directories are set to |mongod-user|.
|arrow| If you installed by downloading the tarballs,
The default MongoDB directories are not created. To create the
MongoDB data and log directories:
.. tip::
Depending on your user permission, you may need to use ``sudo``
to perform these operations.
.. code-block:: sh
mkdir -p /var/lib/mongo
mkdir -p /var/log/mongodb
By default, MongoDB runs using the |mongod-user| user account. Once
created, set the owner and group of these directories to |mongod-user|:
.. code-block:: sh
chown -R mongod:mongod <directory>
To Use Non-Default Directories
++++++++++++++++++++++++++++++
.. container::
To use a data directory and/or log directory other than the default
directories:
.. tip::
Depending on your user permission, you may need to use ``sudo``
to perform these operations.
#. Create the new directory or directories.
#. Edit the the configuration file ``/etc/mongod.conf`` and modify the
following fields accordingly:
- :setting:`storage.dbPath` to specify a new data directory path (e.g. ``/some/data/directory``)
- :setting:`systemLog.path` to specify a new log file path (e.g. ``/some/log/directory/mongod.log``)
#. Ensure that the user running MongoDB has access to the directory or
directories:
.. code-block:: sh
chown -R mongod:mongod <directory>
If you change the user that runs the MongoDB process, you **must**
give the new user access to these directories.
#. Configure SELinux if enforced. See :ref:`install-rhel-configure-selinux`.
.. |arrow| unicode:: U+27A4
.. _install-selinux-data-directory:
.. _install-rhel-configure-selinux:
Configure SELinux
`````````````````
.. include:: /includes/fact-selinux-redhat-options.rst
.. |mongod-user| replace:: ``mongod``
.. |mongod-datadir| replace:: ``/var/lib/mongo``
Procedure
~~~~~~~~~
.. include:: /includes/steps/run-mongodb-on-a-linux-distribution.rst
Uninstall MongoDB Community Edition
-----------------------------------
.. include:: /includes/fact-uninstall.rst
.. include:: /includes/steps/uninstall-mongodb-on-redhat.rst