阿里雲ECS上CentOS系統配置從入門到進門

服務器端建立新用戶

爲服務器安全起見,建立用戶(用戶名:yishi):mongodb

useradd yishi

設置密碼:shell

passwd yishi

添加sudo權限:數據庫

usermod -aG wheel yishi

關閉Root的遠程訪問

修改/etc/ssh/sshd_configubuntu

PermitRootLogin no

而後:centos

service sshd restart

開啓SSH的公鑰訪問

$ cat id_rsa.pub >> ~/.ssh/authorized_keys
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/id_rsa 
# Disable password authentication forcing use of keys
PasswordAuthentication no

https://wiki.centos.org/HowTo...安全

MongoDB

Create/etc/yum.repos.d/mongodb-org-3.2.repo,Content:服務器

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

Client only:ssh

sudo yum install -y mongodb-org-shell

https://docs.mongodb.com/manu...阿里雲

語言報錯的處理

export LC_ALL=C
mongo

http://askubuntu.com/question...url

NodeJS鏈接阿里雲MongoDB數據庫

dbURI = sprintf("mongodb://%s:%s@%s:%d,%s:%d/%s?replicaSet=%s", conf.username, conf.password, conf.host1, conf.port1, conf.host2, conf.port2, conf.dbname, conf.replSetName);

隨機密碼-MAC上

openssl rand -hex 16
相關文章
相關標籤/搜索