CentOS7 設置yum源


1、關閉防火牆

  • 臨時關閉防火牆
    systemctl stop firewalld
  • 永久防火牆開機自關閉
    systemctl disable firewalld
  • 臨時打開防火牆
    systemctl start firewalld
  • 防火牆開機啟動
    systemctl enable firewalld
  • 查看防火牆狀態
    systemctl status firewalld

2、關閉selinux 關閉原因 自行google  vi /etc/selinux/config

修改sellinux=disabled :wq保存退出

可能存在的問題:若修改了selinuxtype=disabled的值會導致linux啟動失敗。

解決方案:

1. 重啟時在啟動頁面,選擇你要啟動的內核 按 E, 進入 grub 編輯頁面。

2. 找到 linux16 那一行,在language 后面 也就是LANG=zh_CN.UTF-8,空格 加上 selinux=0 或者 enforcing=0 (備注:我是加入selinux=0 生效的。)

3. 然后 ctrl + x 啟動,就看到熟悉的登錄界面。

4 .修改selinux配置文件,正確關閉selinux

解決方案原文:http://www.mamicode.com/info-detail-1847013.html

3、設置域名解析

配置下centos的DNS一個國內,一個國外

vi  /etc/resolv.conf

nameserver 114.114.114.114

nameserver 8.8.8.8

4、安裝wget命令,已安裝請忽略

命令:yum -y install wget

5、更新yum源配置

5.1、備份下原來的yum源

cd /etc/yum.repos.d/   ls

mv CentOS-Base.repo CentOS-Base.repo_bak

5.2 、設置源網易或阿里雲

網易yum源:http://mirrors.163.com/.help/centos.html

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

yum clean all

yum makecache

 

阿里雲yum源:http://mirrors.aliyun.com/repo/Centos-7.repo

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum clean all

yum makecache

查看已安裝yum源:yum repolist all

圖形方案:https://jingyan.baidu.com/article/215817f7aef2e01eda1423f4.html

yum命令常見問題:

yum install的時候提示:Loaded plugins: fastestmirror(加速插件)

解決方案:

1.修改插件的配置文件

# vi  /etc/yum/pluginconf.d/fastestmirror.conf  

enabled = 1//由1改為0,禁用該插件

2.修改yum的配置文件

# vi /etc/yum.conf

plugins=1//改為0,不使用插件

解決方案原文:https://www.cnblogs.com/starof/p/4773209.html

6、安裝VIM命令,默認未安裝
檢測是否安裝VIM rpm -aq|grep vim
若出現以下命令則未安裝 vim-minimal.x86_64 2:7.4.160-4.el7
執行命令,yum -y install vim* 提示安裝完畢!

7、檢測IP地址 ipaddr show 或ifconfig

提示ifconfig command not found的解決方案:

1、確認sbin目錄是否存在 cd  /sbin ls

2、不存在執行命令:yum install net-tools

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM