Last active
February 15, 2023 23:54
-
-
Save rafex/ba84a891c1e203a6af887239896d0ca4 to your computer and use it in GitHub Desktop.
Installation manually nodejs in Debian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run script with root | |
VERSION_NODEJS="19.6.0" | |
BASE_PATH="/opt/nodejs" | |
curl --create-dirs -O --output-dir ${BASE_PATH} https://nodejs.org/dist/v${VERSION_NODEJS}/node-v${VERSION_NODEJS}-linux-x64.tar.xz | |
mkdir -p ${BASE_PATH}/${VERSION_NODEJS} | |
chmod 755 ${BASE_PATH} | |
tar -xvf ${BASE_PATH}/node-v${VERSION_NODEJS}-linux-x64.tar.xz --directory ${BASE_PATH}/${VERSION_NODEJS} | |
mv ${BASE_PATH}/${VERSION_NODEJS}/node-v${VERSION_NODEJS}-linux-x64/* ${BASE_PATH}/${VERSION_NODEJS}/ | |
rm -rf ${BASE_PATH}/${VERSION_NODEJS}/node-v${VERSION_NODEJS}-linux-x64 | |
#ln -s ${BASE_PATH}/${VERSION_NODEJS}/bin/node /usr/bin/node | |
#ln -s ${BASE_PATH}/${VERSION_NODEJS}/bin/corepack /usr/bin/corepack | |
#ln -s ${BASE_PATH}/${VERSION_NODEJS}/bin/npm /usr/bin/npm | |
#ln -s ${BASE_PATH}/${VERSION_NODEJS}/bin/npx /usr/bin/npx | |
update-alternatives --install /usr/bin/node node ${BASE_PATH}/${VERSION_NODEJS}/bin/node 10 | |
update-alternatives --install /usr/bin/nodejs nodejs ${BASE_PATH}/${VERSION_NODEJS}/bin/node 10 | |
update-alternatives --install /usr/bin/corepack corepack ${BASE_PATH}/${VERSION_NODEJS}/bin/corepack 10 | |
update-alternatives --install /usr/bin/npm npm ${BASE_PATH}/${VERSION_NODEJS}/bin/npm 10 | |
update-alternatives --install /usr/bin/npx npx ${BASE_PATH}/${VERSION_NODEJS}/bin/npx 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment