YUM配置及自定义

本文详细介绍了如何配置YUM,包括查看RPM文件内容、使用YUM命令、理解YUM仓库配置文件。YUM通过配置文件指向互联网上的仓库来获取系统所需的软件包。同时,讲解了RPM的包标签、查询限制以及YUM缓存的位置。了解这些内容有助于更好地管理和更新Linux系统。
摘要由CSDN通过智能技术生成


配置YUM


Yum needs to know what software should be installed on your system. For instance, if you are using Fedora Core 2, then it needs to know what packages make up a standard install of Fedora Core 2. The packages needed for a particular Linux distribution are stored in repositories on the Internet. To properly configure yum, you need to open a file called /etc/yum.conf, and make sure it contains the proper information. In other words, you use yum.conf to point yum at the repositories on the Internet that define the files needed for your distribution of Linux.


一个/etc/yum.conf文件实例
这里写图片描述




关于RPM格式文件


package in yum is an rpm file. Each rpm file has a header, that defines the contents of the file and any dependencies it might have. In particular, it defines the versions of the programs upon which the code in the rpm file depends.

查看RPM文件的内容

用命令 rpm -qpl *.rpm



解压RPM包的内容

用命令 rpm2cpio *.rpm | cpio -div




yum命令


yum list

When you first start yum by becoming root and typing yum list, it usually spends a long time (15 to 60 minutes) downloading not entire rpm files, but instead the headers for all the rpm files that define your distribution.


yum update

After it has downloaded all these headers, then you can issue a command like yum update, and yum will compare the current contents of your system to the records found in the rpm headers it has downloaded. If some of the headers reference files that are more recent than the files currently installed on your system, then yum will automatically download the needed complete rpm files and use them to update your system.


yum info <name>

查询某个软件

[root@cent
### 回答1: 在 Linux 下使用 yum 命令安装自定义 iso 的步骤如下: 1.将 iso 文件挂载到本地目录: ``` mount -o loop /path/to/iso /mnt/cdrom ``` 2.创建一个 repo 文件: ``` vi /etc/yum.repos.d/myrepo.repo ``` 3.在 myrepo.repo 文件中加入以下内容: ``` [myrepo] name=myrepo baseurl=file:///mnt/cdrom enabled=1 gpgcheck=0 ``` 其中,baseurl 指向刚才挂载的 iso 文件的目录。 4.运行 yum 命令安装软件包: ``` yum install package_name ``` 其中,package_name 是你想要安装的软件包名称。 5.卸载 iso 文件: ``` umount /mnt/cdrom ``` 这样就可以使用 yum 命令安装自定义 iso 了。 ### 回答2: 在Linux下,yum是一种包管理器软件,用于安装、升级和删除软件包。通常情况下,yum会从预配置的软件源中获取安装包进行安装。但是如果需要安装自定义的ISO文件,可以通过一些额外的步骤来完成。 首先,将ISO文件复制到Linux系统中的一个目录下,例如/var/tmp目录。 然后,使用mount命令将ISO文件挂载到一个临时目录: ``` sudo mount -o loop /var/tmp/custom.iso /mnt ``` 这将把ISO文件的内容挂载到/mnt目录下。 接下来,创建一个新的yum存储库配置文件。在/etc/yum.repos.d/目录下创建一个新的文件,例如custom.repo: ``` sudo vi /etc/yum.repos.d/custom.repo ``` 在该文件中添加以下内容: ``` [custom] name=Custom ISO baseurl=file:///mnt enabled=1 gpgcheck=0 ``` 保存并退出。 最后,运行yum命令安装需要的软件包: ``` sudo yum install package-name ``` 这样yum将会从自定义的ISO文件中安装软件包。 安装完成后,可以使用umount命令将ISO文件卸载: ``` sudo umount /mnt ``` 通过上述步骤,可以使用yum命令安装自定义ISO文件中的软件包。 ### 回答3: 在Linux系统中,可以使用yum命令来安装软件和包,但是默认情况下,yum仅从官方软件源或已配置的镜像源中获取软件包进行安装。如果要安装自定义的ISO镜像,可以按照以下步骤进行操作: 1. 首先,将自定义的ISO镜像文件上传到Linux系统,可以使用FTP、scp或其他文件传输工具进行上传。 2. 确保自定义的ISO镜像文件所在的路径可以被系统访问到。可以将ISO镜像文件放在一个特定目录下,比如/home/username/iso目录下。 3. 打开终端窗口,并使用root用户或者拥有sudo权限的用户登录。 4. 输入以下命令,挂载ISO镜像文件到一个临时的挂载点: ``` sudo mount -o loop /home/username/iso/your_custom_iso.iso /mnt/iso ``` 5. 输入以下命令,将挂载点设置为yum的软件源: ``` sudo yum-config-manager --add-repo=file:///mnt/iso ``` 6. 输入以下命令,清除并重建yum缓存: ``` sudo yum clean all sudo yum makecache ``` 7. 现在,可以使用yum命令来安装自定义ISO中的软件包了。例如,要安装名为your_package的软件包,可以输入以下命令: ``` sudo yum install your_package ``` 8. 安装完成后,可以使用umount命令卸载ISO镜像文件: ``` sudo umount /mnt/iso ``` 通过以上步骤,你可以在Linux下使用yum命令安装自定义ISO镜像中的软件包。请注意,在安装完成后,建议卸载ISO镜像文件,以释放系统资源和空间。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值