搭建自己的私有npm库
1.安装Couchdb
[[email protected]_private ~]# yum install wget [[email protected]_private ~]# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm [[email protected]_private ~]# rpm -ivh --test epel-release-6-8.noarch.rpm [[email protected]_private ~]# rpm -ivh epel-release-6-8.noarch.rpm [[email protected]_private ~]# yum --enablerepo=epel info couchdb [[email protected]_private ~]# yum install couchdb [[email protected]_private ~]# vi /etc/couchdb/local.ini [httpd] port = 5984 bind_address = 127.0.0.1 (改为自己的IP地址) [[email protected]_private ~]# /etc/init.d/couchdb start [[email protected]_private ~]# /etc/init.d/couchdb status couchdb (pid 1329) 正在运行... [[email protected]_private ~]# service iptables stop
2.Couchdb追加用户
打开管理画面:http://your-ip-address:5984/_utils/
点击画面右下角的“Fix this”,创建用户。admin/admin
3.创建npm数据库
[[email protected]_private ~]# curl -X PUT http://admin:[email protected]:5984/registry
{“ok”:true}
4.配置npm用数据库
[[email protected]_private ~]# vi /etc/couchdb/local.ini [couch_httpd_auth] public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev users_db_public = true [httpd] secure_rewrites = false [couchdb] delayed_commits = false
5.安装git和node
[[email protected]_private ~]# yum install git [[email protected]_private ~]# yum installl npm [[email protected]_private ~]# rpm --import https://fedoraproject.org/static/0608B895.txt [[email protected]_private ~]# rpm -Uvh http://download-i2.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm [[email protected]_private ~]# yum install nodejs npm --enablerepo=epel
6.安装 npm-registry-couchapp
[[email protected]_private ~]# git clone git://github.com/npm/npm-registry-couchapp [[email protected]_private ~]# cd npm-registry-couchapp/ [[email protected]_private npm-registry-couchapp]# npm install [[email protected]_private npm-registry-couchapp]# npm start --npm-registry-couchapp:couch=http://admin:[email protected]:5984/registry [[email protected]_private npm-registry-couchapp]# npm run load --npm-registry-couchapp:couch=http://admin:[email protected]:5984/registry
7.同步官方npm库
[[email protected]_private npm-registry-couchapp]# curl -X POST http://admin:[email protected]:5984/_replicate -d ‘{"source":"http://isaacs.iriscouch.com/registry/", "target":"registry", "create_target":true}‘ -H "Content-Type: application/json"
8.在本地定义.npmrc
loglevel = "info" always-auth = true registry = http://admin:[email protected]:5984/registry/_design/scratch/_rewrite
9. 在本地发布私有npm包
http://oschina.net/shanhe/blog/280441
centos6.5 64位下安装私有npm
时间: 2024-11-08 18:16:56