1. 程式人生 > >Linux下更換預設yum源為網易yum源的操作記錄

Linux下更換預設yum源為網易yum源的操作記錄

廢話不多說,下面記錄了centos下更換系統預設yum源為網易yum源的操作過程:
1)備份原有的預設yum源

[[email protected] ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

2)修改CentOS-Base.repo檔案。將檔案中的baseurl地址修改為網易163的yum源地址即可!

[[email protected] ~]# vim /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
[[email protected] ~]# yum clean all
[[email protected] ~]# yum makecache          //將伺服器上的軟體包資訊快取到本地,以提高搜尋安裝軟體的速度
[[email protected] ~]# yum update              //更新系統

依照上面操作後,yum源就更換成網易的了,並能正常使用。

要特別注意的是:如果要想CentOS使用yum update更新時不升級核心,方法如下:

[[email protected] ~]# cp /etc/yum.conf /etc/yum.confbak
方法一)修改yum的配置檔案
[
[email protected]
~]# vim /etc/yum.conf 在[main]的最後新增 exclude=kernel*

方法二)直接在yum的命令後面加上如下的引數:

[[email protected] ~]# yum --exclude=kernel* update

如果要更換成阿里雲的yum源,只需要將/etc/yum.repos.d/CentOS-Base.repo內容替換成下面內容即可,然後yum clean all、yum makecache、yum update

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

相關推薦

Linux更換預設yumyum

今天在linux下安裝mysql,下載速度感人!最後直接超時了。覺得有必要替換下預設的yum源,替換後速度果真蹭蹭的分分鐘下好了! 地址: http://mirrors.163.com/.help/centos.html 2、替換預設源 wget (下載預設

Linux更換預設yumyum操作記錄

廢話不多說,下面記錄了centos下更換系統預設yum源為網易yum源的操作過程: 1)備份原有的預設yum源 [[email protected] ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum

linux redhat配置yum(163)的方法 (

工作中大多數使用centos系統,當我們安裝完centos系統的時候其實yum已經配置好了。我們直接執行yum install 軟體包名稱 就可以安裝好一個軟體包。他預設使用配置好的centos的源。但好多人習慣都使用下面的這二個源 1、這是中科大的源 cd /etc

centos修改YUM【轉】

文件 all centos 網易yum源 base 運行 緩存 使用說明 yum 使用說明 首先備份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d

centos更改yum與更新系統

在centos下更改yum源與更新系統。[1] 首先備份/etc/yum.repos.d/CentOS-Base.repo$cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backu

RHEL6配置yum映象

轉載:https://www.jianshu.com/p/446e3fe7d710由於 redhat的yum線上更新是收費的,如果沒有註冊的話不能使用,如果要使用,需將redhat的yum解除安裝後,重啟安裝,再配置其他源.本文包括配置本地源及第三方源。第三方源包括:網易,e

切換Centos的yum,切換國內的阿里雲163

將CentOS的系統的yum更換為網易和阿里雲的yum軟體安裝源 第一步:備份你的原映象檔案,以免出錯後可以恢復。 (使用mv命令,mv有兩個作用一個是移動,一個是重新命名,這裡用到的是重新命名

修改Ubuntu的apt-get

1、複製原檔案備份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 2、編輯源列表檔案 sudo vim /etc/apt/sources.list 3、將原來的列表刪除,新增如下內容 deb htt

Centos 6.5更換yum阿里和

源所在的目錄:     /etc/yum.repos.d/    在更換之前可以先備份自己的源,防止出錯,Centos 5.X 安裝阿里或者網易的源wget -O /etc/yum.repos.d/C

redhat7.4修改yum CentOSyum

yum centos# 創建目錄 mkdir /data/tools/centos_yumcd /data/tools/centos_yum# 下載軟件包,若地址不對,到此網站上找http://mirrors.163.com/centos/7/os/x86_64/Packages/wget http://mi

更改CentOS預設yum映象國內的yum映象

剛安裝完的CentOS系統,預設帶的yum映象源一般都是國外的,導致線上安裝的時候,速度很慢。這個時候需要你更換yum映象源為國內的,國內主要開源的開源映象點應該算是阿里和網易了。  網易:http://mirrors.163.com.centos/    阿里雲:htt

Linux更換jdk和配置環境變量

pat 出現 下載jdk cnblogs clas home log code 文件 不需要刪除舊的jdk,安裝新版本的jdk,再更新環境變量即可。 Linux下安裝jdk,步驟如下 1:下載jdk包:本章使用的為後綴為tar.gz的文件(不需要安裝),如jdk-

Redhat6.6更改yum

yum安裝軟件 ret ras 3.2 parser hat rpm yum man gem 當前系統版本 [root@redhat-128 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server relea

Linux切換python2和python3默認執行版本的方式(也能作用於sublime等編輯器的默認執行方式)

安裝路徑 linux code bsp 指令 config 選項 原來 pda 使用 alternate 機制可以自由切換python默認版本,只需要在終端輸入簡單的幾個指令: sudo update-alternatives --install /usr/bin/

NetHogs——Linux按進程實時統計絡帶寬利用率

nethogs網上有很多適用於Linux操作系統的開源網絡監視工具.比如說,你可以用命令iftop來檢查帶寬使用情況. netstat用來查看接口統計報告,還有top監控系統當前運行進程.但是如果你想要找一個能夠按進程實時統計網絡帶寬利用率,那麽NetHogs就是你所需要的唯一工具. 參考博文:https:/

linux 如何搭建本地倉庫 以及 httpdyum倉庫?

網絡 lag ram cto scope 倉庫 extra data 位置 如何配置本地光盤yum倉庫以及網絡yum倉庫 1.配置本地倉庫啟用光盤 掛載光盤到mnt [root@localhost ~]# mount /dev/cdrom /mnt [root@localh

Linuxpython預設版本切換成替代版本

當你安裝 Linux 時,安裝過程有可能同時為你提供多個可用的 Python 版本,因此係統中會存在多個 Python 的可執行二進位制檔案。你可以按照以下方法使用 ls 命令來檢視你的系統中都有那些 Python 的二進位制檔案可供使用。 $ ls /usr/bin/python* /

Linux更換jdk和配置環境變數

不需要刪除舊的jdk,安裝新版本的jdk,再更新環境變數即可。 Linux下安裝jdk,步驟如下    1:下載jdk包:本章使用的為字尾為tar.gz的檔案(不需要安裝),如jdk-8u111-linux-x64.tar.gz    2: 把jdk檔案儲存至Li

CentOS 6.8配置yum阿里雲軟體

一、備份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.CentOS-Base.repo.backup 提示 “ mv: cannot stat `/etc/yum.repos.d/CentOS-Base.repo': No such file

Linux安裝QQ,百度盤等win系軟體的通用方法

安裝deepin-wine環境 git clone https://github.com/wszqkzqk/deepin-wine-ubuntu 解壓到本地資料夾,開啟資料夾後開啟終端 sudo sh ./install.sh 安裝 安裝deepin-wine應用容器