xml地图|网站地图|网站标签 [设为首页] [加入收藏]
来自 关于我们 2019-12-01 12:11 的文章
当前位置: 新濠国际登录平台 > 关于我们 > 正文

欢迎加入 系统性能优化专业群,构建本地光盘源

构建本地光盘源

redhatlinux5上创建本地yum源

  1、将本地光盘挂载/mnt下, mount   /dev/cdrom    /mnt

1、挂载光驱

[[email protected] ~]#mkdir -p /mnt/cdrom

[[email protected] ~]#mount /dev/cdrom /mnt/cdrom

  2、在/etc/yum.repos.d/目录下创建自己的源文件,文件名称自定义,必须以repo结尾,

2、将redhat光盘内容复制至本地硬盘

因为创建yum源的目录,必须是可以写入的的目录,所以需要将光盘中的文件全部复制到本地目录,如果在/mnt/cdrom光驱挂载目录执行创建yum源,会报“Directory /mnt/cdrom must be writable.”错误

[[email protected]rh5rac1 ~]#mkdir -p /soft/redhat

[[email protected] /]# cp -rp /mnt/cdrom/ /soft/redhat/

[[email protected] /]# cd /soft/redhat

[[email protected] redhat]# ls

cdrom

    新濠国际登录平台 1

3、安装createrepo包

[[email protected] cdrom]# cd /soft/redhat/cdrom/Server/

[[email protected] Server]# ls -l |grep createrepo

-r--r--r-- 1 root root 60901 Apr 21 2008 createrepo-0.4.11-3.el5.noarch.rpm

[[email protected] Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm

  3、此时把/etc/yum.repos.d/下原来存在的文件备份到别目录下,即可使用本地光盘源

4、在/etc/yum.repos.d目录下创建server.repo文件

[[email protected] Server]# cd /etc/yum.repos.d/

[[email protected] yum.repos.d]# pwd

/etc/yum.repos.d

[[email protected] yum.repos.d]# vi server.repo

[Server]

name=Server

baseurl=file:///soft/redhat/cdrom/Server

enabled=1

gpgcheck=0

[Cluster]

name=Cluster

baseurl=file:///soft/redhat/cdrom/Cluster

enabled=1

gpgcheck=0

[ClusterStorage]

name=ClusterStorage

baseurl=file:///soft/redhat/cdrom/ClusterStorage

enabled=1

gpgcheck=0

[VT]

name=VT

baseurl=file:///var/redhat/cdrom/VT

enabled=1

gpgcheck=0

构建HTTP局域网源

5、使用createrepo创建yum库

[[email protected] yum.repos.d]# cd /soft/redhat/cdrom/Server/

[[email protected] Server]# createrepo /soft/redhat/cdrom

3389/3389 - ClusterStorage/gfs-utils-0.1.20-10.el5.x86_64.rpm pm_64.rpm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

  1 、挂载光盘源,mount  /dev/cdrom  /mnt下

6、安装测试

[[email protected] /]# rpm -qa |grep sysstat

[[email protected] /]#

[[email protected] /]# yum -y install sysstat

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

Updating Red Hat repositories.

Cluster | 1.5 kB 00:00

Cluster/primary | 6.5 kB 00:00

Cluster 32/32

ClusterStorage | 1.5 kB 00:00

ClusterStorage/primary | 8.7 kB 00:00

ClusterStorage 39/39

Server | 1.5 kB 00:00

Server/primary | 913 kB 00:00

Server 3261/3261

VT | 1.3 kB 00:00

VT/primary | 18 kB 00:00

VT 57/57

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package sysstat.x86_64 0:7.0.2-11.el5 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

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

Package Arch Version Repository Size

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

Installing:

sysstat x86_64 7.0.2-11.el5 Server 187 k

Transaction Summary

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

Install 1 Package(s)

Upgrade 0 Package(s)

Total download size: 187 k

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: sysstat 1/1

Cluster/productid | 1.7 kB 00:00

ClusterStorage/productid | 1.8 kB 00:00

Server/productid | 1.7 kB 00:00

duration: 661(ms)

Installed products updated.

Installed:

sysstat.x86_64 0:7.0.2-11.el5

Complete!

[[email protected] /]# rpm -qa |grep sysstat

sysstat-7.0.2-11.el5

测试成功。

  2、 将光盘下的所有rpm包拷贝到http发布目录,例如 :  cp  -R  /mnt/Packages/*    /var/www/html/centos/

7、删除yum源

[[email protected] Server]# yum clean all

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

Updating Red Hat repositories.

Cleaning up Everything 

本文作者:黎俊杰(网名:踩点),从事”系统架构、操作系统、存储设备、数据库、中间件、应用程序“六个层面系统性的性能优化工作

欢迎加入 系统性能优化专业群,共同探讨性能优化技术。群号:258187244

1、挂载光驱 [[email protected] ~]#mkdir -p /mnt/cdrom [[email protected]新濠国际登录平台, ~]#mount /dev/cdrom /mnt/cdrom 2、将redhat光盘内容复制至本地硬盘 因...

本文由新濠国际登录平台发布于关于我们,转载请注明出处:欢迎加入 系统性能优化专业群,构建本地光盘源

关键词: