linux配置yum仓库
‘壹’ 《linux就该这么学》,配置yum软件仓库这里,第三步要怎么操作,求详细方法,最好有代码
你有linux光盘?搜索下centos开机挂载光盘或iso一堆介绍。
‘贰’ 如何配置Centos 6.5 的yum源
你好,我最近也在学习配置YUM源,看得是《linux就该这么学》这本教材,里面关于yum配置是这么写的:
第1步:首先我们要切换到"/etc/yum.repos.d/"目录中(因为该目录存放着yum仓库的配置文件)
第2步:使用vim编辑器创建并打开一个名为rhel7.repo的新文件,名称可以自定义,但后缀必需为repo。
第3步:逐项写入配置参数,并保存退出。
第4步:按配置参数的路径将光盘挂载。
第5步:将光盘挂载信息写入到/etc/fstab文件中。
第6步:使用"yum install httpd -y"命令检查是否配置正确。
切换到/etc/yum.repos.d目录中:
[root@linuxprobe ~]# cd /etc/yum.repos.d/
打开Vim界面后敲击"a"进入到插入模式:
编辑完成后敲击[ESC]并在末行模式中:wq!保存并退出。
[root@linuxprobe yum.repos.d]# vim rhel7.repo
[rhel7]
name=rhel7
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
创建挂载光盘的目录:
[root@linuxprobe yum.repos.d]# mkdir -p /media/cdrom
仓库提供方式为本地,所以需要将光盘挂载到/media/cdrom中:
[root@linuxprobe yum.repos.d]# mount /dev/cdrom /media/cdrom
mount: /dev/sr0 is write-protected, mounting read-only
设置成开机自动挂载:
[root@linuxprobe yum.repos.d]# vim /etc/fstab
/dev/cdrom /media/cdrom iso9660 defaults 0 0
测试安装"httpd"服务,出现“Complete”则代表Yum仓库配置正确:
[root@linuxprobe yum.repos.d]# yum install httpd
Loaded plugins: langpacks, proct-id, subscription-manager
rhel7 | 4.1 kB 00:00
(1/2): rhel7/group_gz | 134 kB 00:00
(2/2): rhel7/primary_db | 3.4 MB 00:00
Resolving Dependencies
……………………………………………………
Complete!
我就是这么配置成功的,你可以按照上面的步骤试试,如果还有问题的话,可以自己去网络上下载《linux就该这么学》,完全免费的哦!
‘叁’ linux如何安装yum
第一步:创建一个新文件夹,并把光盘的内容全部复制到该文件夹内:
[root@localhost ~]# mkdir /yum
[root@localhost ~]# cp -rvf /misc/cd/* /yum
第二步:安装工具包:
[root@localhost ~]# rpm -ivh /yum/Server/createrepo-0.4.11-3.el5.noarch.rpm
第三步:生成仓库数据库:
[root@localhost ~]# cd /yum
[root@localhost yum]# createrepo . //注意后面的.
第四步:查看文件:
[root@localhost yum]# ls /yum/repodata/
filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml
第五步:客户端配置:
[root@localhost ~]# cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/chenbin.repo
[root@localhost ~]# vi /etc/yum.repos.d/chenbin.repo [rhel-chenbin]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///yum/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
第六步:清除yum安装时的缓存:
[root@localhost ~]# yum clean all
‘肆’ 虚拟机linux如何安装yum 源么
以red
hat
enterprise
linux
6为例,叙述如何为虚拟机中的linux配置本地yum源
首先在/mnt目录中创建dvd目录。
[root@localhost
~]#
mkdir
/mnt/dvd
接着把镜像挂载到创建的目录下(要在/dev里面找到cdrom这个文件,必须把镜像加载到虚拟机里面,通常安装之后,假如没有进行更改,通常都是加载好的)。
[root@localhost
mnt]#
mount
/dev/cdrom
/mnt/dvd
然后在/etc/yum.repos.d里面,把存在着的配置文件全部删除掉(当然,最好先备份),然后利用下面的命令,新建一个文件,后缀必须是.repo,文件名可随意
[root@localhost
my]#
vim
/etc/yum.repos.d/local.repo
在配置文件里面写下如下内容
[RHEL6]
//仓库名称,可随意
name=all
rhel6
packages
//名称,可随意
baseurl=file:///mnt/dvd
//源路径,很重要,根据你的实际情况进行填写
enable=1
//启用本yum源
最后,导入公钥。
[root@localhost
yum.repos.d]#
rpm
--import
/etc/pki/rpm-gpg/RPM*
‘伍’ linux使用yum安装时,系统中的仓库配置文件默认有哪些
你的问题不太明确,下面是相关yum的一些内容。
yum使用仓库保存管理rpm的软件包、仓库的配置文件保存在/etc/yum.repos.d/目录下格式如下:
[LinuxCast] #仓库的名字
name = 对名字的解释 #描述仓库的基本信息
baseurl = 仓库的地址 #本地的或者以http、ftp、file、ntfs
enable = 1 #是否启用
gpgcheck = 1 #是否校验
yum配置文件必须以.repo结尾,一个配置文件中可以保存多个yum仓库的配置信息,/etc/yum.repos.d/目录下可以存在多个配置文件.
使用yum操作软件的相关命令:
yum install software-name #安装指定的软件
yum remove software-name #卸载指定的软件
yum update software-name #更新指定的软件
使用yum进行查询操作:
yum search keyword #搜索
yum list (all|installed|recent|updates) #列出全部、安装的、最近的、软件更新
yum info packagename #显示指定软件信息
yum whatprovides packagename #查询哪个rpm包含软件包
自己创建yum仓库:
1、通过rpm安装createrepo文件
2、运行命令:createrepo -v /yum-dir #创建yum仓库的索引文件
3、创建一个yum仓库的配置文件
4、yum clean all #清除yum缓存信息
5、使用yum对软件包进行分组:createrepo -g /tmp/comps.xml /yum-dir
‘陆’ linux yum怎么安装 及过程
第一种方法:(推荐)
第一步:新建一个文件夹,并把光盘内的所有文件复制到这个文件夹里:
[root@localhost ~]# mkdir /yum
[root@localhost ~]# cp -rvf /misc/cd/* /yum
第二步:备份repodata文件。因为有四个文件夹里都有这个文件,所以都要备份。
[root@localhost ~]# mv /yum/Server/repodata /yum/Server/repodata.bak
[root@localhost ~]# mv /yum/VT/repodata /yum/VT/repodata.bak
[root@localhost ~]# mv /yum/Cluster/repodata
/yum/Cluster/repodata.bak
[root@localhost ~]# mv /yum/ClusterStorage/repodata
/yum/ClusterStorage/repodata.bak
第三步:安装工具包:
[root@localhost ~]# rpm -ivh
/yum/Server/createrepo-0.4.11-3.el5.noarch.rpm
第四步:生成仓库数据库:
[root@localhost ~]# createrepo -g
/yum/Server/repodata.bak/comps-rhel5-server-core.xml /yum/Server/
[root@localhost ~]# createrepo -g /yum/VT/repodata.bak/comps-rhel5-vt.xml
/yum/VT/
[root@localhost ~]# createrepo -g /yum/Cluster/repodata.bak/
/yum/Cluster
[root@localhost ~]# createrepo -g
/yum/ClusterStorage/repodata.bak/comps-rhel5-cluster-st.xml
/yum/ClusterStorage/
第五步:查看仓库数据文件:
[root@localhost ~]# ls /yum/Server/repodata/
comps-rhel5-server-core.xml //这个文件软件包组的分类。
filelists.xml.gz other.xml.gz primary.xml.gz //这三个文件为软件包列表文件。
repomd.xml //这个文件为MD5校验信息。
在/yum/VT /yum/Cluster
/yum/ClusterStorage下面都有这几个文件,作用和这一样。如果想更新软件包,只需把下载完的软件包放在Server或者其他三个目录里,再使用第四步重新生成数据库文件即可。
第六步:客户端配置:主要修改下面红色的部分:
[root@localhost ~]# cp /etc/yum.repos.d/rhel-debuginfo.repo
/etc/yum.repos.d/chenbin.repo
[root@localhost ~]# vi /etc/yum.repos.d/chenbin.repo
[rhel-Server]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///yum/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-VT]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///yum/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///yum/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///yum/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
参考文章:http://www.jb51.net/LINUXjishu/32188.html
‘柒’ linux yum仓库0怎么配置
YUM仓库的配置 先讲一下思路: 1.YUM仓库配置首先需要一个YUM源,也就是需要提供一个存放PRM包以及YUM对这些RPM分析文件的位置,这个存放位置可以是一个本地目录、FTP服务器、HTTP服务器或者是光盘。。
‘捌’ Linux怎么进行Yum软件仓库配置
大家都知道rpm –ivh xxx.rpm能安装软件,这是没有错的,但是如果哪天你要安装一个软件,发现一堆的依赖关系,关系多达几百个,错综复杂,你是不是会崩溃掉,这个情况在默认没有安装桌面的环境中经常遇到,在init 3模式下安装init 5的X window,用rpm非疯了不可YUM的使用我们就以安装GCC为例吧
Yum install gcc命令
上图就是我们的仓库文件的内容了,我来解释一下
[Steven]只是仓库名字,这个可以随意
Name=….这个你可以理解为仓库的描述,这个可以不写这一行
我们来规划一下,我们要在/packages下建立我们的软件源,首先,我们把这个文件夹建立一下
现在的目录是空的,然后我们来把软件拷贝到里面
现在只有一个文件夹,里面一堆软件包,我们来指定一下yum路径,看看能不能安装吧
我们来生成一下,现在先看一下目录结构
‘玖’ linux 中 配置自己的yum仓库 里面有一步是vi模式下编辑自己的XXXX.repo文件
baseurl路劲最后跟光盘的挂载路径,比如:
baseurl=file://光盘挂载地址,
首先你需要将光盘挂载到本地的一个路径(挂载点):
# mkdir /mnt/cdrom 创建挂载点
# mount /dev/cdrom /mnt/cdrom 挂载光盘文件到挂载点
baseurl=file://media/cdrom
如果你拷贝的话,光拷贝rpm包可能还不够,估计得将iso全部解压后文件和文件夹都拷贝到一处才可以。建议看下下面这个帖子:
http://jingyan..com/article/e4d08ffdd07e6a0fd2f60da7.html
希望能帮到你
‘拾’ debian linux的yum配置
centos配置yum源
网络yum源配置
1.把默认yum源备份(可选)
#mkdir /opt/centos-yum.bak
#mv /etc/yum.repos.d/* /opt/centos-yum.bak/
2.查看系统版本
cat /etc/redhat-release //查看系统的版本
CentOS Linux release 7.2.1511 (Core)
3.下载aliyun yum源repo文件(对应自己的系统版本下载即可)
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
wget http://mirrors.aliyun.com/repo/Centos-7.repo
4. 清除缓存
#yum clean all
#yum makecache //把yum源缓存到本地,加快软件的搜索好安装速度
#yum list //总共列出了9954个包
centos镜像源配置
上传镜像到服务器
cd /mnt
mkdir cdrom //新建挂在目录
mount 镜像名称 /mnt/cdrom //挂载镜像
cd /etc/yum.repos.d
cp -r yum.repos.d yum.repos.d.bak //备份repos.d文件
rm -rf /etc/yum.repos.d/* //清空repos.d目录下文件
touch local.repo //新建repo文件
vi local.repo //编辑repo文件
[yum]
name=centos7.6
baseurl = file:///mnt/cdrom //镜像挂载目录
gpgcheck =0
enabled =1
退出:wq
yum clean all
Yum makecache
局域网yum源配置
1.备份yum源
rm -f /etc/yum.repos.d/*
cat>/etc/yum.repos.d/local.repo
2.查看系统版本
cat /etc/redhat-release //查看系统的版本
CentOS Linux release 7.2.1511 (Core)
3.编辑yum配置文件
vi /etc/yum.repos.d/local.repo
【yum】
name= centos7.5
baseurl=http://ip地址/yum/centos7.2
gpgcheck =0
enabled =1
4.清楚缓存
yum clean all
yum makecache
deepin系统配置apt-get
1.备份source.list文件
cp /etc/apt/source.list /etc/apt/source.list.bak
2、编辑源列表文件(网络源把网址换成ali或163地址即可)
vim /etc/apt/source.list
deb http://ip地址:/yum/deepin kui main contrib non-free
3.更新apt缓存
4.apt-get update
main 由符合DFSG标准的软件包组成,不依赖于main外的软件来运行。这是debian发行时默认启用的仓库组成。
contrib 软件包包含符合DFSG标准的软件,但依赖项不在main中(可能是非自由的Debian打包)。
non-free 非自由,包含不符合DFSG的软件。
lion、panda 是发行版的仓库代号
通过apt命令已安装软件
apt list --installed
dpkg -l
ubuntu配置网络apt源
1.备份源文件备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.查看新版本信息
lsb_release -c
得到系统的系统代号:
我们可以看到新版本的Ubuntu系统代号为bionic
同样的我们也可以得到之前任意版本的系统代号:
Ubuntu 12.04 (LTS)代号为precise。
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 15.04 代号为vivid。
Ubuntu 15.10 代号为wily。
Ubuntu 16.04 (LTS)代号为xenial。
3.编辑源列表文件
sudo vi /etc/apt/sources.list
4.将原有的内容注释掉,添加以下内容 (src-源码)
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
5.更新软件列表
运行如下命令:
sudo apt-get update
6.更新软件包
运行如下命令:
sudo apt-get upgrade
银河麒麟系统配置apt网络源
1、查看系统版本
cat /proc/version
2、备份原list文件
cd /etc/apt
sudo cp sources.list sources.list.bak
3、编辑新list文件
vi sources.list
deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
4、更新apt源
sudo apt-get clean
apt-get update
5、安装软件包
apt-get install ant