Closed sxy15 closed 11 months ago
拉取cnpmjs 仓库
1. git clone https://github.com/cnpm/cnpmjs.org.git
2. cd cnpmjs.org
3. sudo npm install
安装mysql-server
sudo apt install mysql-server
安装成功,mysql服务自动启动,可以通过下边命令验证
sudo systemctl status mysql
在 cnpmjs.org 目录下执行:
mysql -uroot -p<password> -e 'DROP DATABASE IF EXISTS cnpmjs_test;' &&\
mysql -uroot -p<password> -e 'CREATE DATABASE cnpmjs_test;' &&\
mysql -uroot -p<password> 'cnpmjs_test' < docs/db.sql &&\
mysql -uroot -p<password>'cnpmjs_test' -e 'show tables;'
+-----------------------+ | Tables_in_cnpmjs_test | +-----------------------+ | dist_dir | | dist_file | | download_total | | module | | module_deps | | module_keyword | | module_log | | module_maintainer | | module_star | | module_unpublished | | tag | | total | | user | +-----------------------+
vi ./config/index.js
修改 database config配置:
db: 'cnpmjs_test',
username: 'root',
password: 'xxxxxx',
dialect: 'mysql',
启动服务
sudo node dispatch.js
注释bindingHost一行,对外网开放
设置源
nrm add sxy15 http://x.x.x.x:7001
nrm use sxy15
建了一个@cnpm/nnn 的包,然后添加用户进行发布
npm adduser
npm publish
然后就可以看到对应的包了!
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxxxxx';
node.js 安装