Linux 鲲鹏云 参照 MongoDB 4.0.12 移植指南(CentOS 7.6) 踩坑记录

目录

安装GCC

升级gcc

 

安装cython

安装typing

  

依赖解决

执行编译

安装后没有mongorestore等组件



鲲鹏云移植文档https://support.huaweicloud.com/prtg-kunpengdbs/kunpengmongodb_02_0001.html

记录之间出现的问题

安装GCC

安装OS依赖包报错

Linux 鲲鹏云 参照 MongoDB 4.0.12 移植指南(CentOS 7.6) 踩坑记录_第1张图片

Linux 鲲鹏云 参照 MongoDB 4.0.12 移植指南(CentOS 7.6) 踩坑记录_第2张图片

补充概念「尝试在命令行中添加『--allowerasing』以替换有冲突的软件包,或者『skip-broken』以跳过可卸载的软件包,或者『 --nobest』不仅使用最佳候选软件包」

1解决 Problem 1: cannot install both libyaml-0.1.4-11.el7.aarch64 and libyaml-0.1.7-5.el8.aarch64

执行 yum install libyaml libyaml-devel --nobest(使用低版本的,为了和教程一致不导致后面出幺蛾子o(╥﹏╥)o)

Linux 鲲鹏云 参照 MongoDB 4.0.12 移植指南(CentOS 7.6) 踩坑记录_第3张图片

后面几个类似的gmp,mpfr,libmpc同样操作

这样我们的错误就剩下3个了

解决步骤:末尾加上 --skip-broken(没找到其他办法了o(╥﹏╥)o)

 

补充关于openssl的,上面剩余3个均可以按照以下方法,根据关键字在mnt目录查询对应rpm进行-ivh执行

恢复OpenSSL组件到系统自带的OpenSSL 1.0.2版本(前提配置好了本地yum源)

Linux 鲲鹏云 参照 MongoDB 4.0.12 移植指南(CentOS 7.6) 踩坑记录_第4张图片

升级gcc

make install 后

Linux 鲲鹏云 参照 MongoDB 4.0.12 移植指南(CentOS 7.6) 踩坑记录_第5张图片

未解决

../../.././libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:157:10: fatal error: sys/ustat.h: No such file or directory
 #include
          ^~~~~~~~~~~~~
compilation terminated.

 

安装cython

 

注意python command not found 执行失败需要安装python  或者检查usr/bin/下是否有python软连接

1、下载python

# wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz

2、解压、编译安装

# tar -zxvf Python-2.7.9.tgz

# cd Python-2.7.9

# ./configure --prefix=/usr/local/python-2.7.9

# make

# make install

3、我们需要为新安装的版本添加一个软链

# ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python2.7(名字与5一致)

4、#python2.7 --verison

 

安装typing

python2.7 setup.py install 即可 ,注意后面的python都用python2.7执行!!!

Traceback (most recent call last):
  File "setup.py", line 5, in 
    from setuptools import setup
ImportError: No module named setuptools

解决:https://pypi.org/project/setuptools/42.0.0/#files  下载setuptools-42.0.0.zip

进行解压和安装

在回到typing目录执行安装即可

  

依赖解决

    yum install pcre-devel python-devel
    # 解压安装
    tar -zxvf scons-3.0.1.tar.gz && cd scons-3.0.1
    python setup.py install

 

执行编译

#python2 buildscripts/scons.py MONGO_VERSION=4.0.12 all CFLAGS="-march=armv8-a+crc -mtune=generic" -j64 --disable-warnings-as-errors

1报错!ERROR:root:code for hash md5 was not found.

Linux 鲲鹏云 参照 MongoDB 4.0.12 移植指南(CentOS 7.6) 踩坑记录_第6张图片

 解决:

编译hashlib https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.zip
$ unzip hashlib-20081119.zip  
$ cd hashlib-20081119  
$ sudo python setup.py install

2继续报错

scons: *** No SConstruct file found.
File "/home/mongo-r4.0.12/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Script/Main.py", line 912, in _main

解决:这个要进入对应目录  /home/mongo-r4.0.12

 

3继续报错

Could not find and curl lib
See /home/mongo-r4.0.12/build/scons/config.log for details


解决: yum install libcurl-devel

 

4继续报错(但是能编译了^_^)


cc1plus: out of memory allocating 135143 bytes after a total of 1441792 bytes

cc1plus: out of memory allocating 223400 bytes after a total of 22872064 bytes
Compiling build/opt/mongo/s/client/rs_local_client.o
scons: *** [build/opt/mongo/db/s/migration_source_manager.o] Error 1
scons: *** [build/opt/mongo/db/repair_database_and_check_version.o] Error 1
scons: building terminated because of errors.
build/opt/mongo/db/s/migration_source_manager.o failed: Error 1
build/opt/mongo/db/repair_database_and_check_version.o failed: Error 1

解决分配swap内存

创建一个目录/opt/mongodb/

# mkdir /opt/mongodb/

# rm -rf /opt/mongodb/swap

创建一个xGB大小的文件(按自己机器需要配置)

# dd if=/dev/zero of=/opt/mongodb/swap bs=1024 count=2048000
2048000+0 records in
2048000+0 records out
2097152000 bytes (2.1 GB, 2.0 GiB) copied, 30.3635 s, 69.1 MB/s

把创建的文件变成SWAP分区

# mkswap /opt/mongodb/swap
Setting up swapspace version 1, size = 2 GiB (2097147904 bytes)
no label, UUID=dd2fa2db-f8bd-41db-9e1a-5d9257924c6f
  • 启用这个SWAP文件
# swapon /opt/images/swap
swapon: /opt/images/swap: insecure permissions 0644, 0600 suggested.

看看SWAP是否生效

# free -m

编译工作完成后关闭SWAP

# swapoff swap
# rm -f /opt/images/swap

5继续编译继续报错No space left on device

挂载大容量磁盘

https://www.cnblogs.com/zishengY/p/7137671.html

安装后没有mongorestore等组件

MongoDB-tools编译

参照的 https://bbs.huaweicloud.com/forum/thread-66998-1-1.html

配置Go环境
wget https://obs-mirror-ftp4.obs.cn-north-4.myhuaweicloud.com/middleware/go1.14.5.linux-arm64.tar.gz
tar -zxvf go1.14.5.linux-arm64.tar.gz -C /usr/local

解压后配置环境变量
vim /etc/profile
//在文件的最后加上
export GOROOT=/usr/local/go
export GOPATH=$PATH:$GOROOT/bin

n -s /usr/bin/go /usr/local/go/bin/go
go version

下载mongo-tools安装包
wget https://obs-mirror-ftp4.obs.cn-north-4.myhuaweicloud.com/middleware/mongo-tools.tar.gz

创建文件目录,将文件夹移动到对应位置
tar -xvf mongo-tools.tar.gz
mkdir -p /root/mongodb-tools-r4.2.0/src/github.com/mongodb
mv mongo-tools /root/mongodb-tools-r4.2.0/src/github.com/mongodb

建立GCC软链接
mkdir -p /opt/mongodbtoolchain/v3/bin
ln -s /usr/bin/gcc   /opt/mongodbtoolchain/v3/bin/aarch64-mongodb-linux-gcc

构建mongo-tools
cd /root/mongodb-tools-r4.2.0/src/github.com/mongodb/mongo-tools
. ./set_goenv.sh set_goenv ./build.sh ./build.sh ssl ./build.sh ssl sasl

查看bin目录,可见

你可能感兴趣的:(Linux,#,web开发部署配置相关)