Serving Private Bower on CentOS 7.2.x

While diving into the Polymer.js ecosystem I have discovered that custom web components with Polymer rely heavily on Bower for dependency and package management. Each custom web component is created as a bower package to make them easily reusable.

Since I am working for a private company on a private Polymer project we cannot use Bower in a public format because our code is proprietary to our project. Because of this we had to come up with a solution for creating bower packages but keeping them private.

Private Bower

Quickly, we discovered Private Bower which is a fork of the original Bower server but with extra goodies for user authentication and giving priority to private packages before public packages when installing.

I began the process of installing it on my CentOS 7.2.1511 server and ran into some snags because I am more familiar with the Ubuntu environment. CentOS is a fork of RedHat Linux and thus has a few differences.

I wanted an easy way to start, stop, and restart my Private Bower server as well as have it start automatically when the server boots up. I stumbled across a great script found here and with a little tweeking adapted it to my needs. Here is what I did:

  1. Make sure you have Node installed.
    1. curl --silent --location | bash -
    2. sudo yum -y install nodejs
  2. Install Private-Bower npm install -g private-bower.
  3. Navigate to the init.d folder. $ cd /etc/rc.d/init.d
  4. Clone the node-startup repo. git clone
  5. Copy the startup script inside of /node-startup/init.d/ to your current directory. sudo cp /node-startup/init.d/node-app private-bower
  6. Create a file sudo nano bower-config.json with the following json data:

         "port": 5678,
         "registryFile": "./bowerRepository.json",
         "timeout": 144000,
         "public": {
             "disabled": false,
             "registry": "",
             "registryFile": "./bowerRepositoryPublic.json",
             "whitelist": [],
             "blacklist": []
         "authentication": {
             "enabled": true,
             "key": "[your-password]"
         "repositoryCache": {
             "cachePrivate": false,
             "git": {
                 "enabled": false,
                 "cacheDirectory": "./gitRepoCache",
                 "host": "localhost",
                 "port": 6789,
                 "publicAccessURL" : null,
                 "refreshTimeout": 10
             "svn": {
                 "enabled": false,
                 "cacheDirectory": "./svnRepoCache",
                 "host": "localhost",
                 "port": 7891,
                 "publicAccessURL" : null,
                 "refreshTimeout": 10
         "proxySettings" : {
             "enabled": false,
             "host": "proxy",
             "username": "name",
             "password" : "pass",
             "port": 8080,
             "tunnel": false
         "log4js" : {
             "enabled": false,
             "configPath" : "log4js.conf.json"
  7. Be sure to replace [your-password] with a password key of your choice for authenticating users.

  8. Next we will edit the private-bower startup script and only change the following matching lines:

     APP_NAME="Private Bower"
  9. You should now be able to run sudo service private-bower start|stop|restart where the last argument is one in the example list.

  10. Test it out by navigating to your server IP with the port 5678. Example: http://123.456.789.101:5678.