This tutorial applies to CentOS, which is an Ubuntu tutorial Http://clock.co.uk/blog/how-to-create-a-private-npmjs-repository
before installation Installing Erlang
Yum install gcc glibc-devel make ncurses-devel openssl-devel autoconf-y wget http://erlang.org/download/otp_src_
R15B01.tar.gz
tar zxvf otp_src_R15B01.tar.gz
cd otp_src_r15b01
./configure && Make && sudo make install
start installing the NPM Private library Step 1 Installing related packages
sudo yum install autoconf autoconf-archive automake curl-devel erlang-asn1 erlang-erts erlang-eunit Erlang-os_mon erlang- Xmerl Help2man js-devel libicu-devel libicu-devel perl-test-harness-y
Step 2. Install CouchDB
Step 2.1 Download Couchdb
sudo su-
$ wget http://mirrors.advancedhosters.com/apache/couchdb/source/1.6.0/apache-couchdb-1.6.0.tar.gz
$ tar xfv apache-couchdb-1.6.0.tar.gz
$ cd apache-couchdb-1.6.0
$./configure $ make
$ make Install
Test Couchdb
$ couchdb
Apache couchdb 1.2.0 (loglevel=info) is starting.
Apache CouchDB has started. Time to relax.
After success Ctrl + C stop
Step 2.2 Creating COUCHDB users
$ useradd couchdb
$ chown-r couchdb:couchdb/usr/local/var/{log,lib,run}/couchdb
$ chown-r couchdb:couchdb/ Usr/local/etc/couchdb
Step 2.3 Modify COUCHDB data File location
$ mv/usr/local/var/lib/couchdb/data/
Add the following content
[Couch_httpd_auth]
Public_fields = appdotnet, Avatar, Avatarmedium, avatarlarge, date, email, fields, freenode, FullName, GitHub, homepage, n Ame, roles, Twitter, type, _id, _rev
users_db_public = True
[httpd]
secure_rewrites = False
Bind_ address=0.0.0.0
[couchdb]
delayed_commits = False
Database_dir =/data/couchdb
View_index_dir =/ Data/couchdb
Step 2.4 Increase self starter
$ touch/usr/local/var/run/couchdb/couchdb.pid
$ chown couchdb.couchdb/usr/local/var/run/couchdb/couchdb.pid
$ sudo ln-s/usr/local/etc/rc.d/couchdb/etc/init.d
$ chkconfig couchdb on
$ chkconfig--list | grep couchdb
couchdb 0:off 1:off 2:on 3:on 4:on 5:on 6:off
$ service couchdb start
Step 2.5 Add username password (optional)
$ curl-x put http://localhost:5984/_config/admins/admin-d ' "<password>"
<password> Change the password you want
Like what:
$ curl-x put http://localhost:5984/_config/admins/admin-d ' "123456" ""
And then you look at the Local.ini file and you find one more line.
$ vim/usr/local/etc/couchdb/local.ini
[admins]
admin =-pbkdf2-297f2655663749cd6ff31d4f73dd973045501604, eaf253d41b0d8ddac87aa3d6683f7ee7,10
$ sudo/etc/init.d/couchdb Restart
And then you test that adding a library will tell you no permissions
$ curl-x put http://localhost:5984/database2
{"error": "Unauthorized", "Reason": "You are not a server admin."}
Add a URL with username and password and try again.
$ curl-x put http://admin:123456@localhost:5984/database2
{"OK": true}
Step 3 Set up NPM Private library
STE 3.1 Copy npmjs.orgThe first command will be very long, because the whole npmjs.org will be moved down, so please be patient, it will take about a few hours, maybe a day.
$ curl-x POST http://127.0.0.1:5984/_replicate-d ' {source ': ' http://isaacs.iriscouch.com/registry/', ' target ': ' Registry "," Create_target ": true} '-H" Content-type:application/json "
$ curl-x POST http://127.0.0.1:5984/_ Replicate-d ' {' source ': ' http://isaacs.iriscouch.com/registry/', ' Target ': ' Registry ', ' Continuous ': true, ' Create_ Target ": true} '-H ' Content-type:application/json"
Step 3.2 To make CouchDB's mirror library work
$ SU-
$ npm install-g couchapp
$ git clone git://github.com/npm/npm-registry-couchapp
$ cd Npm-registry-cou Chapp
$ npm Install
$ npm start \
--npm-registry-couchapp:couch=http://localhost:5984/registry
Check to see if the following application upload completed, these two steps for the first time to run will also be relatively long:
$ npm run load \
--npm-registry-couchapp:couch=http://localhost:5984/registry
$ npm--registry http:// Localhost:5984/registry/_design/scratch/_rewrite Search
Client Settings
$ vim ~/.NPMRC
Add the following paragraph
Registry = Http://localhost:5984/registry/_design/scratch/_rewrite
Upload your own NPM library to the private library.
specifically see http://blog.csdn.net/nsrainbow/article/details/37903097