IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码

Linux下安装MongoDB 4.2数据库–使用tar包方式

IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码

(一)基础环境设置
操作系统版本 :centos-7.4
MongoDB版本:MongoDB 4.2 社区版

(1)关闭防火墙

# 关闭防火墙
[root@mongodbenterprise lib]# systemctl stop firewalld.service


# 禁止firewall开机启动
[root@mongodbenterprise lib]# systemctl disable firewalld.service 


# 确认防火墙为not running状态
[root@mongodbenterprise lib]# firewall-cmd --state
 not running

(2)关闭selinux

[root@mongodbenterprise lib]# vim /etc/selinux/config
SELINUX=disabled

(3)安装依赖包

yum install -y libcurl openssl

(二)安装MongoDB
安装路径规划:
安装路径:/opt/mongo-4.2/
数据文件路径:/mongo/data/
错误日志路径:/mongo/log/mongodb.log
配置文件:/mongo/mongodb.conf

(1)下载安装包

110_1.png
需要注意的是,redhat/centos是类似的Linux系统,可以简单地理解为:centos是redhat的社区版。因此直接下载os为redhat7的tar包即可。

(2)解压安装包

[root@mongoserver ~]# ls
anaconda-ks.cfg  mongodb-linux-x86_64-rhel70-4.2.7.tgz
 [root@mongoserver ~]# tar -xzvf mongodb-linux-x86_64-rhel70-4.2.7.tgz 
 [root@mongoserver ~]# ls
 anaconda-ks.cfg  mongodb-linux-x86_64-rhel70-4.2.7  mongodb-linux-x86_64-rhel70-4.2.7.tgz

(3)安装MongoDB
tar包是不需要安装的,解压到安装位置即可,我的安装位置是/opt/mongo-4.2

[root@mongoserver ~]# ls
anaconda-ks.cfg  mongodb-linux-x86_64-rhel70-4.2.7  mongodb-linux-x86_64-rhel70-4.2.7.tgz
[root@mongoserver ~]# mv mongodb-linux-x86_64-rhel70-4.2.7 /opt/
[root@mongoserver ~]# cd /opt
[root@mongoserver opt]# ls
mongodb-linux-x86_64-rhel70-4.2.7
[root@mongoserver opt]# mv mongodb-linux-x86_64-rhel70-4.2.7/ mongodb-4.2
 [root@mongoserver opt]# ls
mongodb-4.2

(4)添加配置文件/mongo/mongodb.conf

[root@mongoserver ~]# vim /mongo/mongodb.conf
 # mongod.conf

# for documentation of all options, see:
 #   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
 systemLog:
   destination: file
   logAppend: true
   path: /mongo/log/mongodb.log

# Where and how to store data.
 storage:
   dbPath: /mongo/data
   journal:
     enabled: true
 #  engine:
 #  wiredTiger:

# how the process runs
 processManagement:
   fork: true  # fork and run in background
   pidFilePath: /mongo/mongod.pid  # location of pidfile
   timeZoneInfo: /usr/share/zoneinfo

# network interfaces
 net:
   port: 27017
   bindIp: 0.0.0.0  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

创建相关路径:

mkdir -p /mongo/log/
mkdir -p /mongo/data/

(5)将mongo的目录添加到PATH中,以便于操作系统能识别到mongo命令

[root@mongoserver ~]# vim /etc/profile
 # 在文件末尾添加
PATH=$PATH:$HOME/bin:/opt/mongodb-4.2/bin

# 使profile中的参数生效
[root@mongoserver ~]# source /etc/profile

(6)创建运行用户mongod

[root@mongoserver ~]# groupadd mongod
[root@mongoserver ~]# useradd -g mongod mongod

授权:
[root@mongoserver ~]# chown -R mongod:mongod /mongo

(7)运行MongoDB

[root@mongoserver log]# mongod -config /mongo/mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 2137
child process started successfully, parent exiting

# 或下面的方式
mongod -f /mongo/mongodb.conf

(8)查看运行状态

[root@mongoserver log]# ps -ef|grep mongo
 root       2036      1  8 01:03 ?        00:00:00 mongod -config /mongo/mongodb.conf
 root       2072   1309  0 01:03 pts/0    00:00:00 grep --color=auto mongo

(9)关闭MongoDB

[root@mongoserver log]# mongod --shutdown --config /mongo/mongodb.conf
 killing process with pid: 2082

【完】

文章永久链接:https://tech.souyunku.com/?p=35446


Warning: A non-numeric value encountered in /data/wangzhan/tech.souyunku.com.wp/wp-content/themes/dux/functions-theme.php on line 1154
赞(74) 打赏



未经允许不得转载:搜云库技术团队 » Linux下安装MongoDB 4.2数据库–使用tar包方式

IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码
IDEA2023.1.3破解,IDEA破解,IDEA 2023.1破解,最新IDEA激活码

评论 抢沙发

大前端WP主题 更专业 更方便

联系我们联系我们

觉得文章有用就打赏一下文章作者

微信扫一扫打赏

微信扫一扫打赏


Fatal error: Uncaught Exception: Cache directory not writable. Comet Cache needs this directory please: `/data/wangzhan/tech.souyunku.com.wp/wp-content/cache/comet-cache/cache/https/tech-souyunku-com/index.q`. Set permissions to `755` or higher; `777` might be needed in some cases. in /data/wangzhan/tech.souyunku.com.wp/wp-content/plugins/comet-cache/src/includes/traits/Ac/ObUtils.php:367 Stack trace: #0 [internal function]: WebSharks\CometCache\Classes\AdvancedCache->outputBufferCallbackHandler() #1 /data/wangzhan/tech.souyunku.com.wp/wp-includes/functions.php(5109): ob_end_flush() #2 /data/wangzhan/tech.souyunku.com.wp/wp-includes/class-wp-hook.php(303): wp_ob_end_flush_all() #3 /data/wangzhan/tech.souyunku.com.wp/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters() #4 /data/wangzhan/tech.souyunku.com.wp/wp-includes/plugin.php(470): WP_Hook->do_action() #5 /data/wangzhan/tech.souyunku.com.wp/wp-includes/load.php(1097): do_action() #6 [internal function]: shutdown_action_hook() #7 {main} thrown in /data/wangzhan/tech.souyunku.com.wp/wp-content/plugins/comet-cache/src/includes/traits/Ac/ObUtils.php on line 367