本教程适用于centos, 这是ubuntu 教程 http://clock.co.uk/blog/how-to-create-a-private-npmjs-repository
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
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
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
$ couchdb Apache CouchDB 1.2.0 (LogLevel=info) is starting. Apache CouchDB has started. Time to relax. [info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:5984/
$ useradd couchdb $ chown -R couchdb:couchdb /usr/local/var/{log,lib,run}/couchdb $ chown -R couchdb:couchdb /usr/local/etc/couchdb
$ mv /usr/local/var/lib/couchdb /data/ $ vim /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, _rev users_db_public = true [httpd] secure_rewrites = false [couchdb] delayed_commits = false database_dir = /data/couchdb view_index_dir = /data/couchdb
$ 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
$ vim /usr/local/etc/couchdb/local.ini [admins] admin=password $ sudo /etc/init.d/couchdb restart
$ ps aux| grep couchdb couchdb 5511 0.0 0.0 9328 1448 ? S 09:38 0:00 /bin/sh -e /usr/local/bin/couchdb -a /usr/local/etc/couchdb/default.ini -a /usr/local/etc/couchdb/local.ini -b -r 5 -p /usr/local/var/run/couchdb/couchdb.pid -o /dev/null -e /dev/null -R couchdb 5521 0.0 0.0 9328 756 ? S 09:38 0:00 /bin/sh -e /usr/local/bin/couchdb -a /usr/local/etc/couchdb/default.ini -a /usr/local/etc/couchdb/local.ini -b -r 5 -p /usr/local/var/run/couchdb/couchdb.pid -o /dev/null -e /dev/null -R couchdb 5522 20.4 0.6 585268 51860 ? Sl 09:38 0:37 /usr/local/lib/erlang/erts-5.9.1/bin/beam.smp -Bd -K true -A 4 -- -root /usr/local/lib/erlang -progname erl -- -home /home/couchdb -- -noshell -noinput -os_mon start_memsup false start_cpu_sup false disk_space_check_interval 1 disk_almost_full_threshold 1 -sasl errlog_type error -couch_ini /usr/local/etc/couchdb/default.ini /usr/local/etc/couchdb/local.ini /usr/local/etc/couchdb/default.ini /usr/local/etc/couchdb/local.ini -s couch -pidfile /usr/local/var/run/couchdb/couchdb.pid -heart
$ 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":"registry2", "continuous":true, "create_target":true}' -H "Content-Type: application/json"
$ su - $ npm install -g couchapp $ git clone git://github.com/npm/npm-registry-couchapp $ cd npm-registry-couchapp $ npm install $ npm start --npm-registry-couchapp:couch=http://localhost:5984/registry
$ npm run load --npm-registry-couchapp:couch=http://localhost:5984/registry $ npm --registry http://localhost:5984/registry/_design/scratch/_rewrite search
$ vim ~/.npmrc增加以下这段
原文地址:http://blog.csdn.net/nsrainbow/article/details/35989657