新聞中心
這篇文章主要介紹“如何在linux中安裝node”,在日常操作中,相信很多人在如何在linux中安裝node問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對(duì)大家解答”如何在linux中安裝node”的疑惑有所幫助!接下來,請(qǐng)跟著小編一起來學(xué)習(xí)吧!

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長期合作伙伴,公司提供的服務(wù)項(xiàng)目有:主機(jī)域名、虛擬空間、營銷軟件、網(wǎng)站建設(shè)、江漢網(wǎng)站維護(hù)、網(wǎng)站推廣。
在linux中安裝node的方法:1、下載“node-v16.18.0-linux-x64.tar.xz”并將其放到linux服務(wù)器上;2、在linux上解壓“node-v16.18.0-linux-x64.tar.xz”;3、配置全局路徑PATH在“/etc/profile”文件中;4、刷新“source /etc/profile”;5、在bin文件中進(jìn)行權(quán)限分配即可。
linux 服務(wù)器的node 安裝
1.先下載 node 當(dāng)然下載的是符合linux 系統(tǒng)的 我當(dāng)時(shí)下載的是 node-v16.18.0-linux-x64.tar.xz
2. 把 node-v16.18.0-linux-x64.tar.xz 放到linux 服務(wù)器上 我當(dāng)時(shí)是用ftq 放到了 /usr/local文件夾下新建了一個(gè) node 文件
3.解壓 node-v16.18.0-linux-x64.tar.xz 必須在linux 服務(wù)器上解壓。在window 中解壓再放上去使用npm 會(huì)報(bào)錯(cuò) 解壓代碼 tar -xJvf node-v16.18.0-linux-x64.tar.xz
4.配置 全局路勁PATH 在 /etc/profile 文件進(jìn)行如下設(shè)置 注釋:(主要看pathmunge 函數(shù)的使用不會(huì)的可以百度查一下linux 函數(shù)使用)把node文件里面bin 路勁添加到全局路徑
pathmunge /usr/local/linuxNode/node-v16.18.0-linux-x64/bin after
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
#pathmunge 是Linux 函數(shù)
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`/usr/bin/id -u`
UID=`/usr/bin/id -ru`
fi
USER="`/usr/bin/id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
# Path manipulation
#$EUID 是全局變量 判斷用戶是否具有權(quán)限
if [ "$EUID" = "0" ]; then
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
fi
HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
#使用 pathmunge 函數(shù)
pathmunge /usr/local/linuxNode/node-v16.18.0-linux-x64/bin after
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done
unset i
unset -f pathmunge
5.進(jìn)行 刷新 source /etc/profile
6.進(jìn)入到我們按鈕的node 文件的bin 文件 進(jìn)行權(quán)限分配。chmod +x node 或者 chmod +x node
到此,關(guān)于“如何在linux中安裝node”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!
標(biāo)題名稱:如何在linux中安裝node
本文來源:http://www.dlmjj.cn/article/gcosce.html


咨詢
建站咨詢
