Para este articulo vamos a instalar nodejs 10 en Ubuntu Server, aunque la fecha de termino de soporte de Node termina en mayo del 2021, lo voy a instalar debido a que la aplicación se desarrollo con esta versión y no se han hecho las pruebas para migrar a la versión mas reciente LTS. Recuerda siempre programar con versiones LTS si es que vas a implementarlo en produccion.
Procedimiento
- Actualiza el gestor de paquetes
$ sudo apt update
- Verifica que tengas instalado curl
$ sudo apt install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version (7.68.0-1ubuntu2.5).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
- Descarga el paquete desde nodesource, te va a marcar que esta desactualizado y que debes de actualizar tu aplicación.
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
================================================================================
================================================================================
DEPRECATION WARNING
Node.js 10.x is no longer actively supported!
You will not receive security or critical stability updates for this version.
You should migrate to a supported version of Node.js as soon as possible.
Use the installation script that corresponds to the version of Node.js you
wish to install. e.g.
* https://deb.nodesource.com/setup_12.x — Node.js 12 LTS "Erbium"
* https://deb.nodesource.com/setup_14.x — Node.js 14 LTS "Fermium" (recommended)
* https://deb.nodesource.com/setup_15.x — Node.js 15 "Fifteen"
* https://deb.nodesource.com/setup_16.x — Node.js 16 "Gallium"
Please see https://github.com/nodejs/Release for details about which
version may be appropriate for you.
The NodeSource Node.js distributions repository contains
information both about supported versions of Node.js and supported Linux
distributions. To learn more about usage, see the repository:
https://github.com/nodesource/distributions
================================================================================
================================================================================
- Una vez descargado el instalador, puedes instalarlo con el gestor de paquete apt.
$ sudo apt install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
- Verifica que se haya instalado correctamente
$ node --version
v10.24.1
Referencias
https://joshtronic.com/2018/05/08/how-to-install-nodejs-10-on-ubuntu-1804-lts/