1.ノード環境をインストールする
a、官网下载 tar 包
b、解压设置环境变量
# vim /etc/profile
PATH=/usr/local/node/bin:$PATH
2. sinopiaをインストールする
# npm install -g sinopia
3.サービスを初めて手動で開始して、構成ファイルを生成します
# sinopia
Sinopia doesn't need superuser privileges. Don't run it under root.
warn --- config file - /root/.config/sinopia/config.yaml
warn --- http address - http://0.0.0.0:4873/
4.構成ファイルを変更します
# vim /root/.config/sinopia/config.yaml
# grep -v "^$" config.yaml | grep -v "^\s*#"
storage: /home/sinopia/storage
auth:
htpasswd:
file: /home/sinopia/htpasswd
max_users: -1
uplinks:
npmjs:
url: http://registry.npm.taobao.org
packages:
'@*/*':
access: $all
publish: $authenticated
'*':
access: $all
publish: $authenticated
proxy: npmjs
logs:
- {type: stdout, format: pretty, level: http}
- {type: file, path: /home/sinopia/logs/sinopia.log, level: info}
listen: 0.0.0.0:4873 # 默认没有,只能本机localhost访问,添加后可以通过外网访问
5.バックグラウンドスタートアップ用にpm2をインストールする
# npm install -g pm2
6. pm2を使用して、シノピアを開始します
# pm2 start `which sinopia`
# pm2 ls
7. nrmをインストールしてミラーサイトを管理する
# npm install -g nrm
# nrm ls
# nrm add cloudpath http://172.20.47.76:4873
# nrm use cloudpath
8.ユーザーを追加する
# npm adduser --registry http://172.20.47.76:4873
9.パッケージを公開してみます
# mkdir test
# cd test
# npm init -y
# npm publish
10.ページを開いてhttp://172.20.47.76:4873/を表示し
ます
効果は次のとおりです。
参照:
https : //github.com/rlidwka/sinopia
https://www.cnblogs.com/czf-zone/p/6860457.html