CentOS 8 installation starts verdaccio service

Posted Jun 16, 20202 min read

  1. Download node

     mkdir -p /data/app
     cd !$
     wget https://nodejs.org/dist/v12.18.0/node-v12.18.0-linux-x64.tar.xz
     tar xvf node-v12.18.0-linux-x64.tar.xz
  2. Install node

     mv node-v12.18.0-linux-x64 node
     cd node
     ln -s /data/app/node/bin/node /usr/bin/node -f
     node -v

    If node -v displays the version normally, you can proceed to the next step

  3. Install verdaccio

     npm install -g verdaccio
     ln -s /data/app/node/lib/node_modules/verdaccio/bin/verdaccio /usr/bin/verdaccio

    Slightly longer, wait patiently for the installation to complete
    verdaccio -i shows normal, indicating no problems with installation

  4. Configure verdaccio

     mkdir /verdaccio
     cp /root/.config/verdaccio/config.yaml /verdaccio/
     sed -ri's#(.*url:).*#\1https://registry.npm.taobao.org#' /verdaccio/config.yaml
     echo'# There is no following line by default, it can only be accessed locally, after adding it can be accessed through the external network, and the port can be changed by itself' >> /verdaccio/config.yaml
     echo'listen:' >> /verdaccio/config.yaml
  5. Configure verdaccio service

     cp /data/app/node/lib/node_modules/verdaccio/systemd/verdaccio.service /etc/systemd/system/verdaccio.service
     sed -ri's@^(ExecStart=).*@\1/usr/bin/verdaccio@' !$
  6. Start the verdaccio service

     systemctl enable verdaccio.service
     systemctl start verdaccio.service
     systemctl status verdaccio.service
  7. Verification
    Access the IP address of the verdaccio service through other intranet PCs, if the page can come out normally. Pay attention to whether the firewall of the server is turned on. If it is turned on, the corresponding port needs to be released. In addition, if you do not understand SELinux, you can turn it off

     sed -ri's#^(SELINUX=).*#\1disabled#' /etc/selinux/config

    Then restart the server to make config take effect.

Related Posts