Article directory
- Preface
- 1. apt download
- 2. wget download
-
- 1. Create a new directory to store files
- 2. Use wget to download the installation package according to the download address.
- 3. Unzip the package
- 4. Specify the directory with the command to make it take effect (create a soft link, and you can use the node and npm commands directly in any directory)
- `If you are inspired, please like and save it~`
Preface
General installation can use the command directlyapt
, but the installed version is not the latest version, and the version number cannot be specified
You need to specify the version number specifically You can use the wget
command to download the installation package for installation
1. apt download
1. Install using apt
Update
sudo apt update
download
sudo apt install nodejs
View version number
node -v
Although it is convenient to install nodejs through apt, the installed version is not the latest, so we can use the second download method
2. wget download
wget
Command download, you need to obtain the download address in advance
For example, install nodejs
- Visit https://nodejs.org/dist/ to get the required version
- https://nodejs.org/dist/v20.10.0/node-v20.10.0-linux-arm64.tar.xz
- Generally, there are two compression formats:
.xz
and.gz
. Generally,.xz
has a higher compression rate
1. Create a new directory to store files
mkdir /usr/local/nodejs && cd /usr/local/nodejs
2. Use wget to download the installation package according to the download address.
wget https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz
3. Unzip the package
tar -xvf node-v18.16.0-linux-x64.tar.xz
4. Specify the directory with the command to make it take effect (create a soft link, and you can use the node and npm commands directly in any directory)
cd node-v18.16.0-linux-x64
ln -s /usr/local/nodejs/node-v18.16.0-linux-x64/bin/node /usr/local/bin/node
ln -s /usr/local/nodejs/node-v18.16.0-linux-x64/bin/npm /usr/local/bin/npm