ubuntu nodejs mongodb環境配置

2021-07-09 06:52:43 字數 1840 閱讀 9502

安裝nodejs

# apt-get update  

# apt-get install -y python-software-properties software-properties-common

# add-apt-repository ppa:chris-lea/node.js

# apt-get update

# apt-get install nodejs

安裝npm

# apt-get install npm
安裝pm2

# npm install -g pm2
設定pm2為自啟動

# pm2 startup upstart
安裝mongodb

# apt-get install mongodb
啟動/停止

/etc/init.d/mongodb start

/etc/init.d/mongodb stop

確認是否啟動成功

netstat -antup 

cat /var/log/mongodb/mongodb.

log

修改路徑

vi /etc/mongodb.conf 

dbpath=/www/mongodb

vi /etc/init.d/mongodb

data=/www/mongodb

mkdir /www/mongodb/

chown -r

mongodb:nogroup /www/mongodb/

後台自啟動

服務後台自動啟動

進入/usr/bin/下輸入以下命令

./mongod --dbpath /var/lib/mongodb/

--logpath /var/log/mongodb/mongodb.

log後台執行程式

設定資料庫連線密碼

重新啟動服務

$ mongod –auth

建立連線使用者

$ mongo

> use admin

switched to db admin

> db.adduser("root","1983")

關閉服務(直接在 mongod 啟動的命令視窗 「ctrl + c」)

重啟服務:

$: mongod –auth

檢視是否開始驗證:、

$ mongo

mongodb shell

version: 2.0

.4    connecting to: test

> use admin

switched to db admin

> show collections

fri mar 14

09:07:08 uncaught exception: error:

有提示 鏈結錯誤。

進行使用者驗證:

> db.auth("root","1983")

1重新檢視就可以檢視資料集

> show collections

system.indexes

system.users

安裝git

# apt-get install git

# apt-get install git-core

VirtualBox Vagrant環境配置

兩個軟體的安裝,除了安裝位址改一下,其他一路預設即可。還有就是vagrant安裝完了後要重啟一下電腦。然後cmd中 輸入 vagrant 驗證 有些慢,等待5s左右 出現命令提示,則安裝成功 這裡演示的是centos 7 開啟方才生成的vagrantfile配置檔案,找到如下一行配置 config....

up squared openvino環境配置

使用balenaetcher對u盤進行燒錄 balenaetcher 將u盤插入up squared按照提示安裝ubuntu sudo add apt repository ppa ubilinux up sudo apt update sudo apt get autoremove purge l...

Hyperledger Fabric 環境配置

簡單說一下 1.第一步,安裝curl brew install curl2.安裝docker 3.安裝golang,安裝go brew install go3.1.設定gopath export gopath home go export path path gopath bin 4.安裝制定版本n...