In deze handleiding zullen we bekijken hoe je de nieuwste versie van Nodejs en NPM kunt installeren op RHEL-gebaseerde distributies zoals CentOS, Fedora, Rocky & AlmaLinux en Debian-gebaseerde distributies zoals Ubuntu & Linux Mint.
Nodejs is een lichtgewicht en efficiënt JavaScript-platform dat is gebouwd op basis van de Chrome’s V8 JavaScript-engine en NPM is een standaard NodeJS-pakketbeheerder. Je kunt het gebruiken om schaalbare netwerkapplicaties te bouwen.
Op deze pagina:
Hoe Node.js te installeren in RHEL-distributies
De nieuwste versie van Node.js en NPM is beschikbaar in het officiële NodeSource Enterprise Linux repository, dat wordt onderhouden door de Nodejs-website en dat je aan je systeem moet toevoegen om de nieuwste Nodejs– en NPM-pakketten te kunnen installeren.
Belangrijk: Als je een oudere versie van RHEL 6 of CentOS 6 gebruikt, wil je misschien lezen over het uitvoeren van Node.js op oudere distro’s.
NodeJS installeren in RHEL, CentOS, Fedora, Rocky & Alma
Om het repository voor de nieuwste versie van Node.js toe te voegen, gebruik je de volgende opdracht als root of als niet-root.
------------- For Node.js v19.x ------------- $ curl -fsSL https://rpm.nodesource.com/setup_19.x | sudo bash - $ sudo yum install -y nodejs ------------- For Node.js v18.x ------------- $ curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash - $ sudo yum install -y nodejs ------------- For Node.js v16.x ------------- $ curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash - $ sudo yum install -y nodejs ------------- For Node.js v14.x ------------- $ curl -fsSL https://rpm.nodesource.com/setup_14.x | sudo bash - $ sudo yum install -y nodejs
Optioneel: Er zijn ontwikkeltools zoals gcc-c++ en make nodig op je systeem om native add-ons van npm te kunnen bouwen.
# yum install gcc-c++ make OR # yum groupinstall 'Development Tools'
Hoe Node.js te installeren in Debian, Ubuntu en Linux Mint
De nieuwste versie van Node.js en NPM is ook beschikbaar in het officiële NodeSource Enterprise Linux-repository, dat wordt onderhouden door de Nodejs-website en dat je aan je systeem moet toevoegen om de nieuwste Nodejs- en NPM-pakketten te kunnen installeren.
Node.js installeren op Ubuntu en Mint
------------- For Node.js v19.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - &&\ $ sudo apt-get install -y nodejs ------------- For Node.js v18.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\ $ sudo apt-get install -y nodejs ------------- For Node.js v16.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&\ $ sudo apt-get install -y nodejs ------------- For Node.js v14.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&\ $ sudo apt-get install -y nodejs
Node.js installeren op Debian
------------- For Node.js v19.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_19.x | bash - &&\ $ sudo apt-get install -y nodejs ------------- For Node.js v18.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &&\ $ sudo apt-get install -y nodejs ------------- For Node.js v16.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\ $ sudo apt-get install -y nodejs ------------- For Node.js v14.x ------------- $ curl -fsSL https://deb.nodesource.com/setup_14.x | bash - &&\ $ sudo apt-get install -y nodejs
Optioneel: Er zijn ontwikkelingstools zoals gcc-c++ en make die je op je systeem moet hebben om native add-ons van npm te kunnen bouwen.
$ sudo apt-get install -y build-essential
Het testen van de nieuwste Nodejs en NPM in Linux
Om een eenvoudige test uit te voeren van Nodejs en NPM, kun je gewoon de geïnstalleerde versies op je systeem controleren met behulp van de volgende commando’s:
Op op RHEL-gebaseerde systemen
# node --version # npm --version
Op Debian, Ubuntu en Linux Mint
$ nodejs --version $ npm --version

Dat is het, Nodejs en NPM zijn nu geïnstalleerd en klaar voor gebruik op je systeem.
I believe these were easy and simple steps to follow but in case of problems you faced, you can let us know and we find ways of helping you. I hope this guide was helpful to you and always remember to stay connected to Tecmint.
Source:
https://www.tecmint.com/install-nodejs-npm-in-centos-ubuntu/