yum仓库的建立yum安装

配置一个yum仓库

[repo-id]  标识

name=

# 当前仓库描述信息;

baseurl=url://path/to/repository/

# 指明repository的访问路径;通常为一个文件服务器上输出的某repository;

url:

ftp服务

ftp://SERVER/PATH/TO/REPOSITORY

http服务

http://SERVER/PATH/TO/REPOSITORY

本地目录:

file:///PATH/TO/REPOSTIROY

enabled={1|0}

此仓库是否可被使用

gpgcheck={1|0}

是否对程序包做校验

gpgkey=url://path/to/keyfile

指明gpgkey文件路径;

cost=#

指明当前repository的访问开销,默认为1000;

[httpd]
name=httpd
baseurl=http://172.16.0.1/cobbler/ks_mirror/CentOS-6.6-x86_64/
enabled=1
gpgcheck=0

yum命令的可用选项:

-y: 自动回答为“yes”

--disablerepo=: 临时禁用在配置文件中配置并启用的某repository;

--enablerepo=:临时启用指定的某repo;

--nogpgcheck: 禁止做包校验

repolist: 列出已经配置的所有可用仓库

repolist [all|enabled|disabled]

#yum repolist

makecache: 缓存创建

自动连接至每一个可用仓库,下载其无数据,将其创建为缓存;

[[email protected] yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
dvd                                                                                  | 4.0 kB     00:00 ... 
cd/filelists_db                                                                     | 6.0 MB     00:00 ... 
cd/other_db                                                                         | 2.8 MB     00:00 ... 
ftp                                                                                 | 2.9 kB     00:00     
httpd                                                                               | 3.0 kB     00:00     
httpd/other_db                                                                      | 4.3 MB     00:01     
base                                                                                | 2.9 kB     00:00     
base/other_db                                                                       | 965 kB     00:00     
Metadata Cache Created
[[email protected] yum.repos.d]#

程序包安装:

install package1 [package2] [...]

[[email protected] yum.repos.d]# yum install php
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-38.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package               Arch                     Version                         Repository            Size
===========================================================================================================
Installing:
 php                   x86_64                   5.3.3-38.el6                    cd                   1.1 M

Transaction Summary
===========================================================================================================
Install       1 Package(s)

Total download size: 1.1 M
Installed size: 3.5 M
Is this ok [y/N]: 在此键入y表示安装,键入n表示放弃安装

重新安装(覆盖安装)

reinstall package1 [package2] [...]

程序包升级:

update [package1] [package2] [...]

程序包降级:

downgrade package1 [package2] [...]

检查有哪些升级可用:

check-update

卸载:

remove | erase package1 [package2] [...]

查询:

查询程序的相关简要信息:info PACKAGE

[[email protected] yum.repos.d]# yum  info nginx
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Installed Packages
Name        : nginx
Arch        : x86_64
Version     : 1.6.2
Release     : 1.el6.ngx
Size        : 828 k
Repo        : installed
Summary     : High performance web server
URL         : http://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.

包组管理:

列出所有包组:grouplist

[[email protected] yum.repos.d]# yum grouplist
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Group Process
Loading mirror speeds from cached hostfile
Installed Groups:
   Additional Development
   Base
   Console internet tools
   Desktop
   Development tools
   Dial-up Networking Support
   Directory Client
   E-mail server
   FTP server
   Fonts
   General Purpose Desktop
   Graphical Administration Tools
   Hardware monitoring utilities
   Input Methods
   Internet Browser
   Legacy UNIX compatibility
   Legacy X Window System compatibility
   MySQL Database client
   MySQL Database server
   NFS file server
   Network Infrastructure Server
   Network file system client
   Networking Tools
   PHP Support
   Performance Tools
   Perl Support
   Security Tools
   System administration tools
   Web Server
   X Window System
Installed Language Groups:
   Arabic Support [ar]
   Armenian Support [hy]
   Bhutanese Support [dz]
   Chinese Support [zh]
   Ethiopic Support [am]
   Georgian Support [ka]
   Hebrew Support [he]
   Inuktitut Support [iu]
   Japanese Support [ja]
   Khmer Support [km]
   Konkani Support [kok]
   Korean Support [ko]
   Kurdish Support [ku]
   Lao Support [lo]
   Myanmar (Burmese) Support [my]
   Tajik Support [tg]
   Venda Support [ve]
Available Groups:
   Backup Client
Done

显示指定包组详情:groupinfo group1 [...]

安装:groupinstall group1 [group2] [...]

卸载:groupremove group1 [group2] [...]

升级:groupupdate group1 [group2] [...]

示例:搭建一个xen的yum仓库。

安装httpd,用来存放软件包

[[email protected] yum.repos.d]# yum install httpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.2.15-39.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package              Arch                  Version                                Repository         Size
===========================================================================================================
Installing:
 httpd                x86_64                2.2.15-39.el6.centos                   cd                825 k

Transaction Summary
===========================================================================================================
Install       1 Package(s)

Total download size: 825 k
Installed size: 2.9 M
Is this ok [y/N]:

下载xen相关的rpm包

[[email protected] ~]# cd /var/www/html/xen
[[email protected] html]# lftp 172.16.0.1
lftp 172.16.0.1:~> cd /pub/Sources/6.x86_64/xen-4.1/
cd ok, cwd=/pub/Sources/6.x86_64/xen-4.1             
lftp 172.16.0.1:/pub/Sources/6.x86_64/xen-4.1> ls
-rw-r--r--    1 0        0           29900 Feb 04 04:51 bridge-utils-1.5-2.el6.x86_64.rpm
-rw-r--r--    1 0        0           36412 Feb 04 04:57 bridge-utils-debuginfo-1.5-2.el6.x86_64.rpm
-rw-r--r--    1 0        0        26657636 Feb 04 04:50 kernel-xen-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0        19565560 Feb 04 04:57 kernel-xen-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0         9406304 Feb 04 04:50 kernel-xen-devel-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0         8529216 Feb 04 04:57 kernel-xen-devel-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0        33730316 Feb 04 04:50 kernel-xen-firmware-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0         1028720 Feb 04 04:57 kernel-xen-firmware-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0          908388 Feb 04 04:50 kernel-xen-headers-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0          844524 Feb 04 04:57 kernel-xen-headers-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--    1 0        0           10056 Feb 04 04:57 kernel-xen-release-6-4.noarch.rpm
drwxr-xr-x    2 0        0            4096 Feb 04 04:57 repodata
-rw-r--r--    1 0        0         1100320 Feb 04 04:49 xen-4.1.3-2.el6.x86_64.rpm
-rw-r--r--    1 0        0         1040052 Feb 04 04:55 xen-4.2.1-1.el6.x86_64.rpm
-rw-r--r--    1 0        0         1040284 Feb 04 04:55 xen-4.2.1-2.el6.x86_64.rpm
-rw-r--r--    1 0        0         3317700 Feb 04 04:49 xen-debuginfo-4.1.3-2.el6.x86_64.rpm
-rw-r--r--    1 0        0         3228360 Feb 04 04:55 xen-debuginfo-4.2.1-2.el6.x86_64.rpm
-rw-r--r--    1 0        0          172844 Feb 04 04:49 xen-devel-4.1.3-2.el6.x86_64.rpm
-rw-r--r--    1 0        0          178800 Feb 04 04:55 xen-devel-4.2.1-1.el6.x86_64.rpm
-rw-r--r--    1 0        0          179012 Feb 04 04:55 xen-devel-4.2.1-2.el6.x86_64.rpm
-rw-r--r--    1 0        0          894736 Feb 04 04:49 xen-doc-4.1.3-2.el6.x86_64.rpm
...........................................................................................................................................
lftp 172.16.0.1:/pub/Sources/6.x86_64/xen-4.1> mget *.rpm
146543076 bytes transferred in 34 seconds (4.06M/s)                                     
Total 41 files transferred
lftp 172.16.0.1:/pub/Sources/6.x86_64/xen-4.1> quit

如果内网没有xen相关的包,需要连接外网进行下载。

下载完成创建repodata数据库

[[email protected] xen]# createrepo /var/www/html/xen
Spawning worker 0 with 82 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

创建完成数据库之后启动httpd服务

[[email protected] xen]# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server‘s fully qualified domain name, using localho
st.localdomain for ServerName                                                           [  OK  ]

编辑yum的配置文件,添加自己建立的yum仓库信息

[[email protected] xen]# vim/etc/yum.repos.d/centos6.6.repo
[httpd]
name=httpd
baseurl=http://172.16.4.100/pub/
gpgcheck=0
enable=1
[[email protected] xen]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id                repo name                                          status
http                   httpd                                                  41

安装xen

[[email protected] html]# yum install xen
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package xen.x86_64 0:4.2.1-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package               Arch                     Version                        Repository             Size
===========================================================================================================
Installing:
 xen                   x86_64                   4.2.1-2.el6                    ftp                   1.0 M

Transaction Summary
===========================================================================================================
Install       1 Package(s)

Total download size: 1.0 M
Installed size: 4.3 M
Is this ok [y/N]:
时间: 2024-08-29 19:07:58

yum仓库的建立yum安装的相关文章

网络yum源 自定义yum仓库 zip备份 编译安装

Top NSD SERVICES DAY01 案例1:补充应用技巧 案例2:软连接与硬连接 案例3:man手册.zip备份 案例4:自定义yum软件仓库 案例5:发布及测试yum仓库 案例6:vim效率操作 案例7:编译安装软件包 案例8:使用systemctl工具 1 案例1:补充应用技巧 1.1 问题 本例要求掌握在运维中比较常用的一些扩展命令技巧的使用,完成下列小技巧操作: 采用数值形式将目录/root的权限调整为 rwx------ 将记录的历史命令条数更改为 200 条 统计 /boo

linux系统下yum仓库的建立与目录共享的建立(脚本文件)

vim yum.sh                                                                     ##建立脚本文件 *!/bin/bash#################creat local yum source############mkdir  /westos                                                                 ##建立挂载点mount /iso/rhe

安装与现在软件的方法:更换yum仓库源、yum下载rpm包、源码包安装

更换yum仓库源 安装扩展源epel yum下载rpm包 源码包安装 原文地址:http://blog.51cto.com/13515599/2059165

YUM仓库(本地yum、在线yum)

[[email protected] ~]# umount /media/ umount: /media/:未挂载 [[email protected] ~]# mount /dev/sr0 /media/ mount: /dev/sr0 写保护,将以只读方式挂载 [[email protected] ~]# df /dev/sr0 4480476 4480476 0 100% /media [[email protected] ~]# cd /etc/yum.repos.d/ [[email 

本地yum仓库与局域网yum仓库配置

一.CentOS本地源设置 1.备份并删除原始的repo源文件 [[email protected] yum.repos.d]# tar -jcv -f CentOS.repo.tar.bz3 CentOS-* CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo [[email protected] yum.repos.d]# ll total 21 -rw-r--r-- 2 root root 2

21.文件系统——yum的工作原理以及如何建立yum仓库

一.yum的工作原理 yum是一个RPM包的前端管理工具,在rpm包的依赖关系已经被建成数据库的前提下,它能够实现自动查找相互依赖的rpm包,并从repository中下载互相依赖的rpm包到本地. 二.如何建立yum的仓库repository 如果yum和repository不在同一台主机上,那么能够为yum提供repository仓库服务的远程服务器协议通常有两类:(1)ftp://(2)http:// 如果yum和repository在同一台主机上,那么yum就可以直接到某个目录中提取rp

Service系统服务(二):补充应用技巧、软连接与硬连接、man手册、zip备份、vim效率操作、自定义yum软件仓库、发布及测试yum仓库、编译安装软件包

一.补充应用技巧 目标: 本例要求掌握在运维中比较常用的一些扩展命令技巧的使用,完成下列小技巧操作: 1> 采用数值形式将目录/root的权限调整为 rwx------   2> 将记录的历史命令条数更改为 200 条   3> 统计 /boot./etc/pki 目录占用的空间大小   4> 以格式"yyyy-mm-dd HH:MM" 显示系统时间 方案: date日期时间工具: 1> 显示日期时间:date.date +"%Y-%m-%d %

yum仓库 Nginx 安装不了错误

今天在做yum仓库的时候,安装Nginx,出现下列错误: --> Finished Dependency Resolution Error: Package: nginx-1.10.2-1.el6.x86_64 (epel) Requires: libpcre.so.0()(64bit) Error: Package: nginx-mod-http-perl-1.10.2-1.el6.x86_64 (epel) Requires: perl(:MODULE_COMPAT_5.10.1) You

Linux程序包管理之yum仓库、源码编译安装

CentOS:yum,dnf URL:ftp://172.16.0.1/pub yum是C/S架构,是rpm的前端工具,依赖于rpm存在的: 1.本地要有yun程序: 2.本地要有配置文件(配置远程服务器yum仓库或本地服务器yum仓库): 3.要有存在的文件服务器(程序包仓库即yum仓库).(也可以在本地配置服务器yum仓库): yum支持的服务器有两种:一种是ftp服务器,第二种是http服务器: yum工作简述: yum是客户端,也认为是自我独立管理的组件,需要联系远程的仓库,从仓库中下载