centos7.7环境安装nodejs8
nodejs的yum安装部署
[root@iZbp16v1zpi82lbf50mlnxZ ~]# curl -sL https://rpm.nodesource.com/setup_8.x | bash -
## Installing the NodeSource Node.js 8.x LTS Carbon repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m
## Confirming "el7-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.TWX2USs2BV' 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm' (根据实际情况)
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.TWX2USs2BV' (根据实际情况)
## Cleaning up...
+ rm -f '/tmp/tmp.TWX2USs2BV' (根据实际情况)
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
# 默认安装最新版本
## Run `sudo yum install -y nodejs` to install Node.js 8.x LTS Carbon and npm.
## You may also need development tools to build native addons:
sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
[root@iZbp16v1zpi82lbf50mlnxZ ~]# node --version
v8.17.0
[root@iZbp16v1zpi82lbf50mlnxZ ~]# npm --version
6.13.4
# 安装cnpm
[root@iZbp16v1zpi82lbf50mlnxZ ~]# npm install -g cnpm --registry=https://registry.npm.taobao.org
# 安装pm2
[root@iZbp16v1zpi82lbf50mlnxZ ~]# npm install pm2 -g
mongodb-centos7.7 yum安装mongodb
1.配置yum源
# vim /etc/yum.repos.d/mongodb-org-3.4.repo 添加如下内容
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
2.yum安装
# yum -y install mongodb-org
3.修改mongo配置文件
# vim /etc/mongod.conf
修改dbpath
4.启动mongo
配置文件启动
# /usr/bin/mongod --config=/etc/mongod.conf
5.登陆数据库,设置数据库用户和密码
# /usr/bin/mongo
> use admin
switched to db admin
> db.createUser({user:"admin",pwd:"TWX2USs2BV1wasx",roles:["root"]})
Successfully added user: { "user" : "admin", "roles" : [ "root" ] }
> db.auth("admin", "TWX2USs2BV1wasx")
1
来源:oschina
链接:https://my.oschina.net/u/4275654/blog/4547315