Build your own private npm Library 1 install Couchdb1.6 [root @ npm_private ~] # Yuminstalllibicu-developenssl-develcurl-develmakegccerlangjs-devellibtoolwhichgcc-c ++ [root @ npm_private ~] # Wgethttp: // rpms. famil build your own private npm Library 1 install Couchdb1.6
[root@npm_private ~]#yum install libicu-devel openssl-devel curl-devel make gcc erlang js-devel libtool which gcc-c++[root@npm_private ~]#wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm[root@npm_private ~]#rpm -Uvh remi-release-6.rpm epel-release-6-8.noarch.rpm[root@npm_private ~]#yum install libicu-devel openssl-devel curl-devel make gcc erlang js-devel libtool which gcc-c++[root@npm_private ~]#wget http://www.eng.lsu.edu/mirrors/apache/couchdb/source/1.6.0/apache-couchdb-1.6.0.tar.gz[root@npm_private ~]#gunzip -c apache-couchdb-1.6.0.tar.gz | tar -xvf -[root@npm_private ~]#cd apache-couchdb-1.6.0[root@npm_private ~]#./configure --with-erlang=/usr/local/lib/erlang/usr/include/[root@npm_private ~]#make[root@npm_private ~]#make install[root@npm_private ~]#adduser -r --home /usr/local/var/lib/couchdb -M --shell /bin/bash --comment "CouchDB Administrator" couchdb[root@npm_private ~]#chown -R couchdb:couchdb /usr/local/etc/couchdb[root@npm_private ~]#chown -R couchdb /usr/local/var/lib/couchdb[root@npm_private ~]#chown -R couchdb /usr/local/var/run/couchdb[root@npm_private ~]#chown -R couchdb:couchdb /usr/local/var/log/couchdb[root@npm_private ~]#chmod -R 0770 /usr/local/etc/couchdb[root@npm_private ~]#chmod -R 0770 /usr/local/var/lib/couchdb[root@npm_private ~]#chmod -R 0770 /usr/local/var/log/couchdb[root@npm_private ~]#chmod -R 0770 /usr/local/var/run/couchdb[root@npm_private ~]#ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb[root@npm_private ~]#chkconfig --add couchdb[root@npm_private ~]#chkconfig --level 1234 couchdb on[root@npm_private ~]#vi /usr/local/etc/couchdb/local.ini[httpd];port = 5984;bind_address = 127.0.0.1bind_address = x.x.x.x[root@npm_private ~]# service iptables stop
2. Couchdb append user
Open management screen: http://x.x.x.x: 5984/_ utils/
Click "Fix this" in the lower-right corner of the screen to create a user. Admin/admin
3. create an npm database
[Root @ npm_private ~] # Curl-x put http: // admin: admin @ ipaddress: 5984/registry
{"OK": true}
4. configure npm database
[root@npm_private ~]# vi /usr/local/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, _revusers_db_public = true[httpd]secure_rewrites = false[couchdb]delayed_commits = false
5. install git and node
[root@npm_private ~]# yum install git[root@npm_private ~]# yum install npm[root@npm_private ~]# rpm --import https://fedoraproject.org/static/0608B895.txt[root@npm_private ~]# rpm -Uvh http://download-i2.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm[root@npm_private ~]# yum install nodejs npm --enablerepo=epel
6. install npm-registry-couchapp
[root@npm_private ~]# git clone git://github.com/npm/npm-registry-couchapp[root@npm_private ~]# cd npm-registry-couchapp/[root@npm_private npm-registry-couchapp]# npm install[root@npm_private npm-registry-couchapp]# npm start --npm-registry-couchapp:couch=http://admin:admin@ipaddress:5984/registry[root@npm_private npm-registry-couchapp]# npm run load --npm-registry-couchapp:couch=http://admin:admin@ipaddress:5984/registry
7. synchronize the official npm Library
[root@npm_private npm-registry-couchapp]# curl -X POST http://admin:admin@ipaddress:5984/_replicate -d '{"source":"http://isaacs.iriscouch.com/registry/", "target":"registry", "create_target":true}' -H "Content-Type: application/json"
8. find the local. npmrc file
$ npm config ls -l...userconfig = "/xxxxxxx/.npmrc"...
9. DEFINE. npmrc locally
registry = http://ipaddress:5984/registry/_design/scratch/_rewrite
10. release the npm package
The private package does not need to register the npm account on the official website. you can simply start npm adduser. Http://my.oschina.net/shanhe/blog/280441