這篇主要是創一個mirror of NPM Registry
首先是安裝CouchDB
1 2 3 4 5 6 7 8 9 10 11
| yum install epel-release -y tee /etc/yum.repos.d/npm_repo.repo << EOF [apache-couchdb-rpm] name=bintray--apache-couchdb-rpm baseurl=http://apache.bintray.com/couchdb-rpm/el7/$basearch/ gpgcheck=0 repo_gpgcheck=0 enabled=1 EOF yum repolist all yum install couchdb -y
|
接下來修改設定,然後啟動
1 2 3 4 5 6
| sed -i '/\[httpd\]/a allow_jsonp = true' /opt/couchdb/etc/local.ini sed -i '/\[httpd\]/a secure_rewrites = false' /opt/couchdb/etc/local.ini sed -i '/\[httpd\]/a port = 8092' /opt/couchdb/etc/local.ini sed -i '/\[httpd\]/a bind_address = 0.0.0.0' /opt/couchdb/etc/local.ini systemctl start couchdb systemctl enable couchdb
|
開防火牆
1 2 3 4 5 6 7 8 9 10 11
| firewall-cmd --add-port=8092/tcp firewall-cmd --add-port=8094/tcp firewall-cmd --reload
curl http://localhost:8092/
curl http://192.168.1.116:8092/
|
開始mirror:
1 2 3 4 5 6 7
| curl -X PUT http://localhost:8092/_config/admins/jamal -d '"jamal"'
curl -X PUT http://jamal:jamal@localhost:8092/registry
curl -X POST http://localhost:8092/_replicate -d '{"source":"https://skimdb.npmjs.com/registry", "target":{"headers":{"Authorization":"Basic amFtYWw6amFtYWw="},"url":"http://192.168.1.116:8092/registry"}, "continuous":true, "create_target": false, "user_ctx": {"name": "jamal","roles":["_admin","_reader","_writer"]}}' -H "Content-Type: application/json"
|