Close Menu

    Subscribe to Updates

    Get the latest tech news from Unixzone about tech, Unix and infrastructure.

    What's Hot

    How to Install a Secure Mail Server with Docker

    September 15, 2025

    Install Windows Over Network via iPXE + Samba + HTTP Boot

    August 4, 2025

    Mikrotik SSTP VPN, Installing, Scripts, Advantages, and Disadvantages

    October 6, 2024
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Unix ZoneUnix Zone
    • Homepage
    • Categories
      • Article
      • Linux
      • Unix
      • Security
      • Tips
    • Get In Touch
    Subscribe
    Unix ZoneUnix Zone
    Home»Article»How to Install Node.js 12 on CentOS (Two Easy Methods)
    Article

    How to Install Node.js 12 on CentOS (Two Easy Methods)

    LinuxZoneBy LinuxZoneMarch 31, 2021Updated:September 15, 2025No Comments2 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Introduction:

    Node.js is one of the most popular JavaScript runtimes in the world, loved by developers for its speed, scalability, and rich ecosystem. Many modern applications — from APIs to real-time services — are built using Node.js.

    However, on CentOS systems, Node.js is often not installed by default, or the version available in the official repositories is outdated and may not meet your project requirements.

    In this guide, I’ll walk you through two simple ways to install Node.js 12 (LTS) on CentOS. Whether you want to install it globally from the repository or locally from binaries (perfect for offline systems), we’ve got you covered.


    Method 1: Install Node.js from Repository (Recommended)

    The easiest and most common way to install Node.js on CentOS is via the official NodeSource repository.

    1.1 Add the NodeSource Repository

    Run the following command to download and enable the Node.js 12.x repository:

    				
    					curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
    				
    			

    1.2 Install Node.js Package

    Once the repository is added, install Node.js with:

    				
    					sudo yum install -y nodejs
    				
    			

    1.3 Verify the Installation

    After installation, verify that Node.js and npm (Node.js package manager) are installed correctly:

    				
    					node --version
    # v12.22.0
    
    npm --version
    # 6.14.11
    				
    			

    ✅ Done! Node.js is now installed globally on your CentOS system, ready to use for any project.

    Method 2: Install Node.js from Source or Binary (Offline-Friendly)

    This method is useful if you don’t have internet access on your CentOS server, or if you want a local user-specific installation instead of a global one.

    2.1 Download and Extract Node.js Binary

    				
    					cd ~
    wget -c https://nodejs.org/dist/latest-v12.x/node-v12.22.0-linux-x64.tar.gz
    tar -zxf node-v12.22.0-linux-x64.tar.gz
    				
    			

    2.2 Configure Node.js for Local User

    Move the extracted folder and add it to your user profile path:

    				
    					mv node-v12.22.0-linux-x64 node
    echo "PATH=$PATH:$HOME/node/bin" >> ~/.bash_profile
    echo "export PATH" >> ~/.bash_profile
    source ~/.bash_profile
    				
    			

    2.3 Verify the Installation

    				
    					node -v
    # v12.22.0
    
    npm -v
    # 6.14.11
    				
    			

    ✅ Great! Node.js is now installed for your user account, independent of the system-wide configuration.

    Final Thoughts

    By following either of these methods, you can easily set up Node.js 12 LTS on CentOS, whether you prefer a global installation for all users or a local setup for isolated environments.

    If you are working on production projects, I recommend using Method 1 for a cleaner and more maintainable installation. For air-gapped environments or local setups, Method 2 is a perfect solution.

    Happy coding! 🚀

    Advertising Backend Development centos CentOS Server DevOps JavaScript Runtime linux Linux Server Node.js Node.js 12 Node.js Installation Node.js Tutorial NPM Software Installation Sysadmin
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleNew Start
    Next Article Is your VPN safe ? – Part1
    LinuxZone
    • Website

    Related Posts

    Article

    How to Install a Secure Mail Server with Docker

    September 15, 2025
    Article

    Install Windows Over Network via iPXE + Samba + HTTP Boot

    August 4, 2025
    Article

    Mikrotik SSTP VPN, Installing, Scripts, Advantages, and Disadvantages

    October 6, 2024
    Add A Comment
    Leave A Reply Cancel Reply

    Request Service
    Italian Trulli
    Top Posts

    Mikrotik SSTP VPN, Installing, Scripts, Advantages, and Disadvantages

    October 6, 2024237 Views

    How to Install Node.js 12 on CentOS (Two Easy Methods)

    March 31, 2021108 Views

    Install Windows Over Network via iPXE + Samba + HTTP Boot

    August 4, 202586 Views
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews

    Subscribe to Updates

    Get the latest tech news from Unixzone about tech, Unix and infrastructure.

    Demo
    Most Popular

    Mikrotik SSTP VPN, Installing, Scripts, Advantages, and Disadvantages

    October 6, 2024237 Views

    How to Install Node.js 12 on CentOS (Two Easy Methods)

    March 31, 2021108 Views

    Install Windows Over Network via iPXE + Samba + HTTP Boot

    August 4, 202586 Views
    Our Picks

    How to Install a Secure Mail Server with Docker

    September 15, 2025

    Install Windows Over Network via iPXE + Samba + HTTP Boot

    August 4, 2025

    Mikrotik SSTP VPN, Installing, Scripts, Advantages, and Disadvantages

    October 6, 2024

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook X (Twitter) Instagram YouTube LinkedIn WhatsApp Telegram
    • Home
    • Technology
    • Gaming
    • Phones
    • Buy Now
    © 2025 All Right Reserved By Gulf Digital Portal - UnixZone.

    Type above and press Enter to search. Press Esc to cancel.

    Manage Consent
    To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
    View preferences
    {title} {title} {title}