[wanghao@xb2-node ~]$ sudo curl -sL https://rpm.nodesource.com/setup_12.x | bash -
## Installing the NodeSource Node.js 12.x repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m
## Confirming "el8-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_12.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.Q9wKa7vhpH' 'https://rpm.nodesource.com/pub_12.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.Q9wKa7vhpH'
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
Error executing command, exiting
原因是我当前的身份是普通用户,可以先执行一下 sudo su
切换到 root 身份。