相关网站
Ubuntu搭建Node服务器,主要可以通过两种方式进行安装:
- 二进制文件
- 包管理器
二进制文件
获取下载源地址 点此获取
1
https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.6.3.tgz
下载安装包并解压
1
2wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-3.6.3.tgz
tar -xzvf mongodb-linux-x86_64-ubuntu1604-3.4.5.tgz如果服务器下载特别慢,那就在本地电脑下载好后,使用SCP命令上传到服务器上。
scp -r mongodb.tgz [email protected]:/root/softwares/
解压过程中容易出错,解决方案见下方
配置环境变量
1
2
3vi .bashrc // 把MongoDB的bin目录添加到环境变量中
export PATH=$PATH:<mongodb-install-directory>/bin
source .bashrc验证是否安装成功
1
mongod --version
1
2
3
4
5
6
7
8
9
10
11db version v3.2.17
-----------------------------------------------------
git version: 186656d79574f7dfe0831a7e7821292ab380f667
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64
-----------------------------------------------------
包管理器
遇到的问题
-
因为在软件源中要用到HTTPS进行传输,所以,首先安装apt-transport-https,否则会出现:
E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?使用下面命令安装apt的ssl支持
apt-get install apt-transport-https顺便分享几个SSL的源站
https://mirrors.ustc.edu.cn/
https://mirrors.aliyun.com/https://mirrors.tuna.tsinghua.edu.cn/ 似乎限速…. 不推荐用
解决方案:重新下载,再次进行解压。