yum配置,外网下载安装和本地安装

 

1.外网下载安装的配置;

cd  /etc/yum.repos.d
mkdir  bak
mv * bak
vi  net.repo


将下面的内容复制到 net.repo文件中:(或者在网上搜一下阿里的yum源配置文件)

 

 

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
gpgcheck=0

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
gpgcheck=0

 

 

 阿里:http://mirrors.aliyun.com/repo/Centos-6.repo

 163 : http://mirrors.aliyun.com/repo/Centos-6.repo

   这两个地址都是Centos6  的repo,根据相应的版本获取对应的repo

  可以直接用wget下载,下载完需要修改程序中的两个变量(根据系统版本修改):

  $releasever 修改成 6 

   $basearch  修改成 x86_64

 

2.本地yum源配置

首先要上传一份本虚拟机的安装镜像到虚拟机,如:CentOS-6.6-x86_64-bin-DVD1.iso

比如将镜像放入到了/home目录下面:

mkdir  -p  /yum/Local
mount  -o loop /home/CentOS-6.6-x86_64-bin-DVD1.iso  /yum/Local
cd  /etc/yum.repos.d
vi  local.repo

 

将下面的内容复制到 local.repo 文件中:

[base]  
name=local  
baseurl=file:///yum/Local/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


yum源每次开机都要重新挂载一次:

mount  -o loop /home/CentOS-6.6-x86_64-bin-DVD1.iso  /yum/Local

 

 

 

你可能感兴趣的:(linux)