linux怎么用网络yum源,Linux配置本地网络YUM源

配置环境:系统版本:[root@localhost~]#cat/etc/issueRedHatEnterpriseLinuxServerrelease5.8(Tikanga)Kernel\\ronan\\m系统32位:[root@localhost~]#getconfLO

,IP

[root@localhost Server]# rpm -ivhcreaterepo-0.4.11-3.el5.noarch.rpm

warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3DSA signature: NOKEY, key ID 37017186

Preparing...   ###########################################[100%]

1:createrepo  ###########################################[100%]

用下边命令更新repodata目录:

[root@localhost ~]# createrepo --update /var/ftp/rhel5/

或用来重新索引文件在/va/ftp/rhel5 中生成一个repodata目录

[root@localhost ~]# createrepo -v /var/ftp/rhel5/

或使用如下命令,如果提示有.olddata就删除之后再运行一边createrepo命令

[root@localhost ~]# createrepo -g /var/ftp/rhel5/Server/repodata/comps-rhel5-server-core.xml /var/ftp/rhel5/Server/

[root@localhost ~]# createrepo -g /var/ftp/rhel5/VT/repodata/comps-rhel5-vt.xml /var/ftp/rhel5/VT/

确认生成的数据文件

[root@localhost ~]# ls -lh /var/ftp/rhel5/repodata/

total 13M

-rw-r--r-- 1 root root 2.7M Jun  8 14:39 filelists.xml.gz

-rw-r--r-- 1 root root 9.0M Jun  8 14:39 other.xml.gz

-rw-r--r-- 1 root root 901K Jun  8 14:39 primary.xml.gz

-rw-r--r-- 1 root root 951 Jun  8 14:39 repomd.xml

[root@localhost ~]# yum list    //查看软件包列表

[root@localhost ~]# yum info httpd  //查看软件包描述信息

Loaded plugins: katello, product-id, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Available Packages

Name       : httpd

Arch       : i386

Version    : 2.2.3

Release    : 63.el5

Size       : 1.2 M

Repo       : rhel5.8

Summary    : Apache HTTP Server

URL        :

License    : Apache Software License

Description: The Apache HTTP Server is a powerful, efficient, and extensible

: web server.

[root@localhost ~]# yum search httpd //查询指定的软件包

Loaded plugins: katello, product-id, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

======================= Matched: httpd ====================

mod_ssl.i386 : SSL/TLS module for the Apache HTTP server

system-config-httpd.noarch : Apache configuration tool

httpd.i386 : Apache HTTP Server

httpd-devel.i386 : Development tools for the Apache HTTP server.

httpd-manual.i386 : Documentation for the Apache HTTP server.

mod_dav_svn.i386 : Apache server module for Subversion server.

[root@localhost ~]# yum -y remove autofs  //卸载命令

Loaded plugins: katello, product-id, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Setting up Remove Process

Resolving Dependencies

--> Running transaction check

---> Package autofs.i386 1:5.0.1-0.rc2.163.el5 set to be erased

--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================

Package      Arch          Version         Repository           Size

===================================================================================

Installing:

autofs       i386      1:5.0.1-0.rc2.163.el5  rhel5.8          922 k

Transaction Summary

===================================================================================

Remove        1 Package(s)

Reinstall     0 Package(s)

Downgrade     0 Package(s)

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Erasing        : autofs   1/1

Installed products updated

Removed:

autofs.i386 1:5.0.1-0.rc2.163.el5                                                         Complete!

[root@localhost ~]# yum -y install autofs  //安装autofs命令

二、配置YUM客户端

客户端配置目录/etc/yum.repos.d/rhel5.repo

[root@localhost ~]# vi /etc/yum.repos.d/rhel5.repo

[rhel5]

name=RHEL5.8x32

通过FTP完成yum源配置

baseurl=ftp://192.168.2.1/rhel5

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ ]内的是仓库的名字

baseurl 仓库的位置,如果是本地配置为客户端,则要以file:///开头,

如果库在ftp服务器上就按上图显示配置.在这里注意这个地址不能写成ftp://192.168.0.200/var/ftp/pub目录,因为登陆到ftp上的根目录就是/var/ftp目录.

enabled 是否启用这个仓库,1为起用,,0为禁用

gpgcheck 是否检查GPG签名(用来验证要安装的包是不是REDHAT官方的,这一行没有也可)

GPGKEY 的存放地址一般就在图片上显示的,(这一行没有也行)

三. 如果是本机既是yum客户端,又是yum服务器端的话。

配置YUM客户端:

把光盘挂载到 /var/ftp/rhel5 默认没有cdrom目录,需要建立

/etc/yum.repos.d/ 文件名要以.repo为后缀的,如果是多个目录的话 就写多个目录

通过本地文件完成yum配置

[local]

name=local

baseurl=file:///var/ftp/rhel5

#baseurl=ftp://192.168.2.1/rhel5

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

list : 列出在yum server 上面有的RPM套件

install: 安装某个套件

update : 升级某个套件,如果update后面没有接套件名称,即更新目前主机所有已安装的套件.

info   : 列出某个套件的详细信息,相当于rpm -qi package内容

clean : 将已下载到本机的packages或headers移除

remove : 移除已经安装在系统中的某个套件

yum localinstall package 本地安装软件包

yum update 全部更新

yum update package 更新指定程序包package

yum check-update 检查可更新的程序

yum info 显示安装包信息

yum list 显示所有已经安装和可以安装的程序包

yum list 显示指定程序包安装情况

yum search 查找软件包

yum remove | erase package1 删除程序包

yum clean headers 清除header

yum clean packages 清除下载的rpm包

yum clean all 清除header与rpm包

本文出自 “I want to be with you” 博客,转载请与作者联系!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值