Redhat 5.4 下构建Yum服务器

Redhat 5.4 下构建Yum服务器

我的博客:http://1990172.blog.51cto.com

QQ:442623654

 

1.构建网络yum服务器(网络可以访问)

1)安装FTP服务器yum服务器。

[root@ yum ~]# mkdir /mnt/cdrom

[root@ yum ~]# mount /dev/cdrom /mnt/cdrom/

[root@ yum ~]# cd /mnt/cdrom/Server/

[root@ yum Server]# rpm -ivh vsftpd-2.0.5-12.el5.i386.rpm

[root@ yum Server]# service vsftpd start

[root@ yum Server]# cd /var/ftp

[root@ yum ftp]# mkdir rhel

[root@ yum ftp]# cp -ar /mnt/cdrom/* /var/ftp/rhel/

[root@junjie ftp]# du -sh rhel/

2)安装createrepo工具。

(构建组文件,yum源通用数据库)

[root@ yum ftp]# cd /var/ftp/rhel/Server/

[root@ yum Server]#rpm ivh createrepo-0.4.11-3.el5.noarch.rpm

[root@ yum Server]createrepo -g ./repodata/comps-rhel5-server-core.xml ./

[root@ yum Server]# cd ../VT

[root@ yum VT]# createrepo -g ./repodata/comps-rhel5-vt.xml ./

[root@ yum VT]# cd ../Cluster

[root@ yum Cluster]# createrepo -g ./repodata/comps-rhel5-cluster.xml ./

[root@ yum Cluster]# cd ../ClusterStorage/

[root@yum ClusterStorage]#createrepo-g ./repodata/comps-rhel5-cluster-st.xml ./

3)网络yum客户端配置:

[root@ yum ~]# cd /etc/yum.repos.d/

[root@ yum yum.repos.d]# vim myyum.repo

[rhel-servr]

name=Red Hat Enterprise Linux server

baseurl=ftp://10.20.0.100/rhel/Server

enabled=1

gpgcheck=1

gpgkey=ftp://10.20.0.100/rhel/RPM-GPG-KEY-redhat-rel ease

[rhel-vt]

name=Red Hat Enterprise Linux vt

baseurl=ftp://10.20.0.100/rhel/VT

enabled=1

gpgcheck=1

gpgkey=ftp://10.20.0.100/rhel/RPM-GPG-KEY-redhat-rel ease

[rhel-cluster]

name=Red Hat Enterprise Linux cluster

baseurl=ftp://10.20.0.100/rhel/Cluster

enabled=1

gpgcheck=1

gpgkey=ftp://10.20.0.100/rhel/RPM-GPG-KEY-redhat-rel ease

[rhel-clusterstorage]

name=Red Hat Enterprise Linux clusterstorage

baseurl=ftp://10.20.0.100/rhel/ClusterStorage

enabled=1

gpgcheck=1

gpgkey=ftp://10.20.0.100/rhel/RPM-GPG-KEY-redhat-rel ease

 [root@ yum yum.repos.d]# yum list all //(添加本地缓存)

此时即可使用yum install直接安装软件,也可使用图形下安装

yum [options] [command] [package ...]

yum install list update remove clean(清除缓存)

 

从上图可以看出可以使用yum通过网络ftp安装软件

使用yum clean all清除yum缓存

yum clear all利于与服务器上的软件同步

2.构建本地yum服务器(只能本机访问)

[root@ yum ~]# mkdir /mnt/cdrom

[root@ yum ~]# mount /dev/cdrom /mnt/cdrom/

[root@ yum ~]# cd /etc/yum.repos.d/

[root@ yum yum.repos.d]# vim myyum.repo

[rhel-server]
 
name=Red Hat Enterprise Linux server
 
baseurl=file:///mnt/cdrom/Server/
 
enabled=1
 
gpgcheck=1
 
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
 
[rhel-vt]
 
name=Red Hat Enterprise Linux vt
 
baseurl=file:///mnt/cdrom/VT/
 
enabled=1
 
gpgcheck=1
 
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
 
[rhel-cluster]
 
name=Red Hat Enterprise Linux cluster
 
baseurl=file:///mnt/cdrom/Cluster/
 
enabled=1
 
gpgcheck=1
 
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
 
[rhel-clusterstorage]
 
name=Red Hat Enterprise Linux clusterstorage
 
baseurl=file:///mnt/cdrom/ClusterStorage/
 
enabled=1
 
gpgcheck=1
 
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
 

 

 

 [root@ yum yum.repos.d]# yum list all    //*(添加本地缓存)

即可使用yum安装文件.

yum [options] [command] [package ...]

yum install list update remove clean(清除缓存)

使用yum clean all清除yum缓存

 

 

你可能感兴趣的:(linux,redhat,yum,5.4)