linux系统rpm和yum软件包管理
1、软件安装方式总结安装软件方式有如下几种:
2、rpm
安装rpm包
卸载rpm包
查询已经安装的rpm包(常用)
查看文件是哪个软件生成的
升级软件
yum
yum的工作原理①需要首先创建一个yum仓库(rpm包仓库、软件仓库)
②用 yum 来从仓库中找软件进行安装的过程(比如要安装软件A,A依赖B 和C,B依赖C D)
yum仓库
╭─[email?protected] ~ ╰─? cat /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/$releasever //指定缓存文件的保存位置,默认:/var/cache/yum/x86_64/7/ keepcache=0 //指定是否保留缓存文件 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release # This is the default,if you make this bigger yum won't see if the metadata # is newer on the remote and so you'll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information. # It is esp. important,to have correct metadata,for distributions like # Fedora which don't keep old packages around. If you don't like this checking # interupting your command line usage,it's much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d
yum仓库制作
yum仓库制作演示:#第一步:编辑yum仓库子文件 ╭─[email?protected] ~ ╰─? cd /etc/yum.repos.d #进入到子配置文件夹 ╭─[email?protected] /etc/yum.repos.d ╰─? vim mnt.repo #创建并编辑配置文件 (文件名要求:*.repo) ...yum文件编辑内容: [local] name=local1 enabled=1 gpgcheck=0 baseurl=file:///mnt #本地yum仓库文件内容 [aliyun] name=aliyun1 enabled=1 gpgcheck=0 baseurl=https://mirrors.aliyun.com/epel/7/x86_64/ #网络源yum仓库文件内容 ... #第二步:挂在光盘 ╭─[email?protected] ~ ╰─? mkdir /mnt ╭─[email?protected] /etc/yum.repos.d ╰─? mount /dev/cdrom /mnt #挂载光盘 mount: /dev/sr0 is write-protected,mounting read-only mount: /dev/sr0 is already mounted or /mnt busy /dev/sr0 is already mounted on /yummnt /dev/sr0 is already mounted on /mnt #第三步:查看yum仓库 ╭─[email?protected] /etc/yum.repos.d ╰─? yum clean all #清空yum缓存的全部数据 Loaded plugins: fastestmirror Repository 'local': Error parsing config: Error parsing "baseurl = 'file///mnt'": URL must be http,ftp,file or https not "" Cleaning repos: local aliyun Cleaning up everything Cleaning up list of fastest mirrors ╭─[email?protected] /etc/yum.repos.d ╰─? yum repolist # 检查yum仓库中有多少个可用的rpm包 Loaded plugins: fastestmirror Repository 'local': Error parsing config: Error parsing "baseurl = 'file///mnt'": URL must be http,file or https not "" local | 3.6 kB 00:00:00 aliyun | 4.7 kB 00:00:00 (1/5): local/group_gz | 155 kB 00:00:00 (2/5): local/primary_db | 3.0 MB 00:00:00 (3/5): aliyun/group_gz | 88 kB 00:00:06 (4/5): aliyun/updateinfo | 998 kB 00:00:11 (5/5): aliyun/primary_db | 6.7 MB 00:00:58 Determining fastest mirrors repo id repo name status local local1 3,831 aliyun aliyun1 13,190 repolist: 17,021 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |