Installation and configuration
Step 1: Enable SSH and log in to the Linux server.
Step 2: First install the node Version Manager (NVM)
Wget - qO - https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bashCopy the code
copy
Step 3: Install the node using node Version Manager (NVM)
nvm install node
Step 4: Install Verdaccio & PM2, which requires running the Verdaccio service in the background
yaml npm i -g verdaccio pm2
Step 5: Set the Verdaccio registry as the source. By default, the original NPM registry set.
npm set registry http://localhost:4873
npm set ca null
Step 6: Run Verdaccio and stop (CRTL + C) it. It will create a configuration file that we will use.
verdaccio
Step 7: Now perform the following configuration to listen for all addresses on the server instance.
Open and edit the config.yaml file:
vim .config/verdaccio/config.yaml
Add the following lines at the end.
Listen: 0.0.0.0:4873Copy the code
copy
Change the following lines so that only authenticated people can access our registry
Replace "access: $all" with "access: $authenticated"
There are more parameters you can use to configure it. Things like storage, proxy, default port changes. (Read more)
Step 8: Run Verdaccio in the background using PM2:
pm2 start verdaccio
Step 9: You can now access the Verdaccio Web UI.
The URL looks like this:
http://ec2-.. compute.amazonaws.com:4873
{或者}
http://your-ec2-public-ip-address:4873 (You can check your EC2 instance public ip from AWS console)
To confirm the running status of Verdaccio, run the following command:
pm2 list
Step 10: Register the user in the Verdaccio registry
npm set always-auth true
npm adduser
It will ask for a user name, password, and a valid E-mail ID. Take note of this detail and use it later to log into the Verdaccio registry to publish our library.
Step 11: Now we are ready to use our AWS server instance as a private registry.
Log in to the Verdaccio registry. Enter the same user name, password, and E-mail ID that you set in the previous step.
npm set registry http://your-ec2-public-ip-address:4873
npm login
Step 12: Go to your custom library package path. In my case, this is my Angular 7 package path ->/libraries/dist/your-library-name/your-library-name-0.0.1. TGZ
If you want to know how to create Angular 7 libraries/packages, (click here)
cd [custom library package path]
Step 13: Finally, your-library-name-0.0.1. TGZ publishes our library on the Verdaccio registry
[custom library package Path] >> NPM publish your-library-name-0.0.1. TGZ
{或者}
[custom library package path] >> npm publish
{或者}
[custom library package path] >> npm publish --registry http://your-ec2-public-ip-address:4873
Now go to http://your-ec2-public-ip-address:4873, where you will see the new library package.