您的位置:首页 > 其它

如何安装epel yum源 apt-get

2015-07-24 09:14 369 查看
【CentOS】
epel链接 http://dl.fedoraproject.org/pub/epel/6Server/x86_64/

Install 【EPEL】 if you haven't already.
yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum install epel-release


使用Redhat/CentOS系统光盘作为yum仓库
1,挂载系统iso光盘到本地
前提是系统iso文件已经复制到本地文件系统
root~魂斗罗~# ll -h CentOS-6.8-x86_64-bin-DVD1.iso
-rw-r--r--. 1 root root 3.7G Sep 27 20:33 CentOS-6.8-x86_64-bin-DVD1.iso

#mkdir /mnt/iso
#mount -o loop -t iso9660 ./CentOS-6.8-x86_64-bin-DVD1.iso /mnt/iso

2,备份repo文件
root~魂斗罗~# mkdir repo
root~魂斗罗~# mv /etc/yum.repos.d/* ./repo/
root~魂斗罗~# cp repo/CentOS-Media.repo /etc/yum.repos.d/
root~魂斗罗~# ll /etc/yum.repos.d/
total 4
-rw-r--r--. 1 root root 630 Sep 27 20:12 CentOS-Media.repo

3,修改Media.repo
root~魂斗罗~# vim /etc/yum.repos.d/CentOS-Media.repo
只修改3处
baseurl=file:///mnt/iso/
gpgcheck=0
enabled=1
root~魂斗罗~#

4,测试安装
root~魂斗罗~# yum clean all
root~魂斗罗~# yum list
root~魂斗罗~# yum install -y gcc


【163】 源的使用
yum -y install wget(确保系统存在wget)
cd /etc/yum.repos.d
rm -rf ./*
wget http://mirrors.163.com/.help/CentOS5-Base-163.repo(适用于CentOS5) wget http://mirrors.163.com/.help/CentOS6-Base-163.repo(适用于CentOS6) wget http://mirrors.163.com/.help/CentOS7-Base-163.repo(适用于CentOS7) yum clean all
yum makecache

测试:
yum install gcc -y


yum 命令使用一直报错

Loaded plugins: fastestmirror, security
Determining fastest mirrors
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

解决方法

yum clean all
yum info kernel
or any other yum command as a test. If that doesn't work you can try Code:

yum clean all
rm -f /var/lib/rpm/__db*
rpm --rebuilddb
then try any yum command again.

yum list

OK !

保存 yum包
[root@admin-node ~]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1


查看系统版本:
/etc/debian_version
lsb_release -a
uname -rm

Ubuntu镜像使用帮助

http://mirrors.163.com/.help/ubuntu.html
下载与系统匹配的源
apt-get update

Debian镜像使用帮助

http://mirrors.163.com/.help/debian.html
下载与系统匹配的源
apt-get update

apt-get update 和 upgrade 的区别

update 是同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。

upgrade 是升级已安装的所有软件包,升级之后的版本就是本地索引里的,因此,在执行 upgrade 之前一定要执行 update, 这样才能是最新的。

Debian 全球镜像站

debian 的镜像下载(所有系列)

http://cdimage.debian.org/mirror/cdimage/archive/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  epel yum源