Ubuntu上安装yum

1.安装yum

sudo apt-get install yum

2.配置yum源

由于是Ubuntu没有yum源,所以要想使用yum安装软件必须要配置yum安装源。在/etc/yum/repos.d/目录下创建两个文件,fedora-163.repo和fedora-updates-163.repo。分别复制以下配置信息保存即可。

推荐使用vim编辑器。在终端使用:

vi fedora-163.repo

进入第一个文件,然后:

在命令模式下按下键盘上的a进入插入模式;粘贴下面两个文件内容;按下ESC键;再输入 :wq! 强制保存 (可能创建的文件是只读的,这样可以不用修改权限即可更改文件内容)(需要在root用户下)

fedora-163.repo文件内容:

  1.  
    [fedora]
  2.  
    name=Fedora 17 – $basearch – 163.com
  3.  
    failovermethod=priority
  4.  
    baseurl=http://mirrors.163.com/fedora/releases/17/Everything/$basearch/os/
  5.  
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-17&arch=$basearch
  6.  
    enabled=1
  7.  
    metadata_expire=7d
  8.  
    gpgcheck=1
  9.  
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
  10.  
     
  11.  
     
  12.  
    [fedora-debuginfo]
  13.  
    name=Fedora 17 – $basearch – Debug – 163.com
  14.  
    failovermethod=priority
  15.  
    baseurl=http://mirrors.163.com/fedora/releases/17/Everything/$basearch/debug/
  16.  
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-17&arch=$basearch
  17.  
    enabled=0
  18.  
    metadata_expire=7d
  19.  
    gpgcheck=1
  20.  
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
  21.  
     
  22.  
     
  23.  
    [fedora-source]
  24.  
    name=Fedora 17 – Source – 163.com
  25.  
    failovermethod=priority
  26.  
    baseurl=http://mirrors.163.com/fedora/releases/17/Everything/source/SRPMS/
  27.  
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-17&arch=$basearch
  28.  
    enabled=0
  29.  
    metadata_expire=7d
  30.  
    gpgcheck=1
  31.  
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

fedora-updates-163.repo文件内容:

  1.  
    [updates]
  2.  
    name=Fedora 17 – $basearch – Updates – 163.com
  3.  
    failovermethod=priority
  4.  
    baseurl=http://mirrors.163.com/fedora/updates/17/$basearch/
  5.  
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f17&arch=$basearch
  6.  
    enabled=1
  7.  
    gpgcheck=1
  8.  
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
  9.  
     
  10.  
    [updates-debuginfo]
  11.  
    name=Fedora 17 – $basearch – Updates – Debug – 163.com
  12.  
    failovermethod=priority
  13.  
    baseurl=http://mirrors.163.com/fedora/updates/17/$basearch/debug/
  14.  
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f17&arch=$basearch
  15.  
    enabled=0
  16.  
    gpgcheck=1
  17.  
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
  18.  
     
  19.  
    [updates-source]
  20.  
    name=Fedora 17 – Updates Source – 163.com
  21.  
    failovermethod=priority
  22.  
    baseurl=http://mirrors.163.com/fedora/updates/17/SRPMS/
  23.  
    mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f17&arch=$basearch
  24.  
    enabled=0
  25.  
    gpgcheck=1
  26.  
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

3.执行配置

在终端输入

yum makecache

即可完成在Ubuntu中安装yum