ubuntu无法安装 git
解决办法一
add-apt-repository -y ppa:git-core/ppa
apt update
apt install git
解决办法二
sudo curl -L https://github.com/AndyYoungDev/ubuntu-aliyun-sources/releases/download/shell/change.sh | bash
apt update
apt install git
安装nodejs npm pm2
linux
wget https://cdn.npm.taobao.org/dist/node/v14.15.4/node-v14.15.4-linux-x64.tar.xz
tar -xvf node-v14.15.4-linux-x64.tar.xz
mv node-v14.15.4-linux-x64 nodejs
ubuntu
echo "export NODE_HOME=/opt/software/nodejs/bin/" >> /etc/profile
source /etc/profile
echo "export PATH=$NODE_HOME:$PATH" >> /etc/profile
source /etc/profile
Centos
ln -s /opt/software/nodejs/bin/npm /usr/local/bin/
ln -s /opt/software/nodejs/bin/node /usr/local/bin/
pm2
第一种:
npm config set registry https://registry.npm.taobao.org
npm install || npm install --registry=https://registry.npm.taobao.org
npm install -g pm2
ln -s /opt/software/nodejs/bin/pm2 /usr/local/bin/
第二种
cd /opt/software/nodejs/lib/node_modules/
wget http://lcy828.cn/pm2.tar
tar -xvf pm2.tar
ln -s /opt/software/nodejs/lib/node_modules/pm2/bin/pm2 /usr/local/bin/pm2
注意在shell脚本中
用ln软连接后可能会出现脚本内无法使用
而脚本运行完却可以执行
此时可以
echo $PATH
然后在shell
脚本加入这一行
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin"