Skip to content

How to Install Bower on CentOS/RHEL 9/8

Bower manages the components for the website. This tutorial help you to install Bower on CentOS / RHEL 7/6/5 system. Steps to install bower on Linux.

Steps
5
Covers
CentOS, Node.js, npm
On this page 5 steps

Bower is a popular package manager for web projects, facilitating the management of dependencies such as frameworks, libraries, assets, and utilities. Although the front-end landscape has evolved with alternatives like Yarn and npm gaining popularity, Bower still supports legacy projects or specific use cases. This guide provides a comprehensive walkthrough for installing Bower on CentOS/RHEL 9/8.

Prerequisites

  • A system running CentOS/RHEL 9/8
  • Sudo or root privileges
  • Basic command-line proficiency

Step 1 of 5Install Node.js and NPM

Bower requires Node.js and npm (Node Package Manager) as a prerequisite. CentOS/RHEL repositories might not always offer the latest version of Node.js, so we’ll use NodeSource repositories to install a recent version.

  1. Add NodeSource Repository: First, you’ll need to add the NodeSource repository to your system. Depending on the version of Node.js you want to install, the command may vary. For the latest stable version, use:
    curl -sL https://rpm.nodesource.com/setup_20.x | sudo bash -
    
  2. Install Node.js and npm: Once the repository is added, you can install Node.js and npm with the following command:
    sudo yum install -y nodejs
    
  3. Verify Installation: Confirm that Node.js and npm are correctly installed by checking their versions:
    node -v
    npm -v
    

Step 2 of 5Install Git

Bower requires Git to fetch packages from remote repositories. Most CentOS/RHEL systems come with Git pre-installed, but if yours doesn’t, install it by running:

sudo dnf install git

Verify Git installation by checking its version:

git --version

Step 3 of 5Install Bower

With Node.js, npm, and Git installed, you can now proceed to install Bower. Bower is installed globally using npm:

sudo npm install -g bower

Step 4 of 5Verify Bower Installation

To ensure Bower is installed correctly, check its version:

bower -v

This command should return the installed version of Bower, indicating that Bower is successfully installed on your system.

Step 5 of 5Using Bower

With Bower installed, you can now use it to manage front-end dependencies for your web projects. Here’s a quick example to get started:

  1. Creating a New Project: Navigate to your project directory (or create a new one) and initialize a new Bower project:
    mkdir myproject
    cd myproject
    bower init
    
  2. Installing Packages: To install a package, like jQuery for example, run:
    bower install jquery --save
    

    The --save flag adds the package as a dependency in your project’s bower.json file.

Conclusion

You have successfully installed Bower on CentOS/RHEL 9/8. While Bower may not be the first choice for new projects in the ever-evolving front-end development landscape, it remains a useful tool for managing dependencies in projects where it is already in use or where its specific functionalities are needed. Remember to check the official Bower documentation for more advanced usage and tips on managing your web project dependencies efficiently.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top