Home > Article > Operation and Maintenance > How to solve the problem that centos system cannot use yum command
There are three solutions, as follows:
1. Set the network card to start automatically after booting
This problem first To confirm whether the network card has been started, the network card may be turned off when Centos is first installed, and you need to turn it on yourself.
Confirm that you are using the root account. If not, please change it yourself.
1. Enter the /etc/sysconfig/network-scripts directory. That is, enter the command "cd /etc/sysconfig/network-scripts" and use the command "ls -a" to view all files in the directory.
2. Modify the network card configuration file of ifcfg-ens33 (CentOS7 has modified the network card naming rules, it is no longer eth0, but ifcfg-eno number).
Enter the command "vi ifcfg-ens33" to enter the vi editor, and press the "i" or "insert" key to enter the editing mode.
3. Change the value of "ONBOOT" to "yes", then press esc to exit the edit mode, enter ":wq" to save and exit
4. Restart the system or restart the network card, enter the command "reboot" or "service network restart".
(Recommended tutorial: centos usage tutorial)
2. Set up the domestic dns server
If the network card has been turned on, it will still If this problem exists, you can try to configure domestic DNS.
1. Enter the command "vi /etc/resolv.conf"
2. Add "nameserver 114.114.114.114"
3. After saving, restart the system or restart the network card , enter the command "reboot" or "service network restart".
3. Modify the address in CentOS-Base.repo
If the above method still does not work, you can try modifying the address in CentOS-Base.repo.
1. Enter "/etc/yum.repos.d".
2. Edit "vi CentOS-Base.repo".
3. Comment out all "mirrorlist" and uncomment all "baseurl".
4. After saving, restart the system and enter the command "reboot".
Recommended related video tutorials: linux video tutorial
The above is the detailed content of How to solve the problem that centos system cannot use yum command. For more information, please follow other related articles on the PHP Chinese website!