伺服器端建立新使用者
為伺服器安全起見,建立使用者(使用者名稱:yishi):
useradd yishi
設定密碼:
passwd yishi
新增sudo許可權:
usermod -aG wheel yishi
關閉Root的遠端訪問
修改/etc/ssh/sshd_config
PermitRootLogin no
然後:
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
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:
sudo yum install -y mongodb-org-shell
語言報錯的處理
export LC_ALL=C
mongo
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