如何使用root账户执行安装命令?

如何

sudo

password:

centos:yum install xxxxx -y

ubantu:apt-get install xxxxx -y 

centos/redhat: sudo - root -c "yum install xxx -y"

ubuntu: sudo - root -c "apt install xxx -y"

centos/redhat: su - root -c "yum install xxx -y"

ubuntu: su - root -c "apt install xxx -y"

切换成root用户,直接输入上面的命令执行就可以 ;你这个命令就是执行这个shell脚本的命令