-
First install nodejs and npm.
sudo apt-get install nodejs npm -
Now clean the cache of npm first:
sudo npm cache clean -f -
Install n module of npm:
sudo npm install -g n -
Begin the installation by selecting the version of node to install: stable or latest or specific version number:
sudo n stableor
sudo n 12.18.2Current LTS version
sudo n 16.15.1 -
Check the version of node:
node -v -
Check the version of npm:
npm -v
Last active
June 11, 2026 07:51
-
-
Save farhad0085/13c13ff61236aab04672ec1f8fa366ed to your computer and use it in GitHub Desktop.
This is going to be beyond the scope of the tutorial. However here is how you could install a specific version if needed:
First, install the required libraries:
sudo apt-get install -y libssl-dev openssl make gcc libbz2-dev libffi-dev liblzma-dev libreadline-dev libncurses5-dev libncursesw5-dev uuid-dev libgdbm-dev libdb5.3-dev tk-dev
Then choose the specific Python from here:
https://www.python.org/ftp/python/
After that go to the /opt directory and download the archive of the specific version:
cd /opt
sudo wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
Extract the archive:
sudo tar -xf Python-3.12.0.tgz
Then cd into the directory:
cd Python-3.12.0
And finally, compile the new version:
sudo ./configure --enable-optimizations
sudo make
sudo make altinstall
Finally you can create a symlink for that specific Python version so that you could use the binary from anywhere:
sudo ln -fs /opt/Python-3.12.0/Python /usr/bin/python3.12
Then you could check if the python3.12 version is available:
python3.12 --version
sudo apt purge -y python2.7-minimal
sudo apt purge -y python2.*
sudo ln -s /usr/bin/python3 /usr/bin/python
sudo apt install -y python3-pip
sudo ln -s /usr/bin/pip3 /usr/bin/pip
python --version
Reference: https://stackoverflow.com/a/60590067
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment