Symptom An attempt to install the software fails in Linux. The possible cause is insufficient permission. Higher permissions are required to perform this operation.
A common approach is to run the installation command as superuser root using the sudo command. If using apt (Debian/Ubuntu system) or yum (CentOS/RHEL system) to install the software:
sudo apt install package_name
Or:
sudo yum install package_name
If the installation fails because of the file permission, you can change the file permission, such as using the chmod command to give the file execution permission:
sudo chmod +x filename
Or you need to change directory permissions:
sudo chmod -R 755 directory_name
Run a series of root permission commands to switch to the root user with the su command:
Su
Then enter the password of user root. You can then execute commands that require root privileges, each time without having to type sudo.
It is also possible to add user accounts directly to sudo's execution group, on Debian/Ubuntu systems:
sudo usermod -aG sudo username
On CentOS/RHEL systems:
sudo usermod -aG wheel username
In some cases, the installation may fail because of insufficient disk space. You can run the df-h command to check the disk space. Clear some space if you need to.
Ensure that the configuration of the software warehouse is correct and the network is normal. Use the right package manager, such as apt on Debian/Ubuntu, dnf on Fedora, yum or dnf on CentOS/RHEL.
Check the use status of SELinux. SELinux may prevent some operations. You can test the effect of SELinux by disabling SELinux:
sudo setenforce 0
Once disabled to resolve the problem, you need to adjust the SELinux policy.
If you are using a live CD or USB that requires root permissions, make sure you are logging in as root. The sudo or su command may damage system operations and should be used with caution.
In Linux, the root user has the permission to perform system-wide management and configuration tasks. Software installation involves writing system files and updating databases. Therefore, root permission is required to ensure that system files can be written, the package manager database can be updated, dependencies can be resolved, system configurations can be changed, and system security and stability can be guaranteed. Root privileges are at the heart of Linux system administration and ensure that only authorized users can perform these actions, as these actions can affect the entire system operation. The Sudo command is a common usage that allows authorized users to execute commands as root while retaining the ability to audit and control permissions.