Reason
The default user of CentOS does not have sudo permission, so the sudo command cannot be used
Solution
Add the user to the sudoers file
Switch to the root user, entervi /etc/sudoers
Add at the end of the file <username> ALL=(ALL) ALL
, if you want to use the command without entering a password sudo
, add <username> ALL=(ALL) NOPASSWD: ALL
, <username> is your own username
Use wq!强制
the command to save the file and exit the editor