代码拉取完成,页面将自动刷新
同步操作将从 冰羽.../shell 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
#2022-01-05 cnetos7+
Core=`cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l`
Geturl="https://mirror.cnop.net"
echo "Cpu core number $Core"
echo -e "\033[32m Enter a nginx path( Default /usr/local/node ): \033[0m"
read Dir
if [ -z "$Dir" ]; then
echo -e "\033[32m Using the default path /usr/local/node :\033[0m"
Dir=/usr/local/node
echo $Dir
else
echo -e "\033[32m Your input $Path :\033[0m"
echo $Dir
fi
if [ -e $Dir ]; then
#Folder name exists in system
echo -e "\033[32m Ready to Install. \033[0m"
else
#Folder name no exists in system
echo -e "\033[32m Create $Dir \033[0m"
mkdir $Dir
fi
#nodejs_version
echo " " && echo -e "\033[32m Please enter a nodejs version using Numbers instead: \033[0m"
echo -e "\033[32m 1.node-v14.9.0 (Default) \033[0m"
echo -e "\033[32m 2.node-v16.13.1 \033[0m"
#echo -e "\033[32m 3.openresty-1.19.3.1 \033[0m"
read Vname
case $Vname in
1|'')
echo node-v14.9.0
Vname=node-v14.9.0
;;
2)
echo node-v16.13.1
Vname=node-v16.13.1
;;
# 3)
# echo openresty-1.19.3.1
# Vname=openresty-1.19.3.1
# ;;
esac
echo -e "\033[32m Installing libraries... \033[0m"
yum -y install epel* python3 && yum install -y centos-release-scl && yum install -y devtoolset-8-gcc*
echo "source /opt/rh/devtoolset-8/enable" >> /etc/profile && source /etc/profile && gcc --version
echo -e "\033[32m Download $Vname.tar.gz: \033[0m"
cd /home && wget $Geturl/nodejs/$Vname.tar.gz
tar zxvf $Vname.tar.gz && cd $Vname && echo "$Vname"
#nake && make install
./configure --prefix=$Dir
make -j$Core && sudo make install -j$Core
ln -s $Dir/bin/node /usr/bin/node
echo '
#set for nodejs
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
'>>/etc/profile
source /etc/profile
node -v && npm -v
sleep 3
if [ -e $Dir/bin/node ]; then
#succeed
echo -e "\033[32m Installation success. \033[0m"
else
#Folder name no exists in system
echo -e "\033[32m Installation failed. \033[0m"
mkdir $Dir
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。