redhat linux 5上创建本地yum源
redhat linux 5上创建本地yum源
1、挂载光驱
[root@rh5rac1 ~]#mkdir -p /mnt/cdrom
[root@rh5rac1 ~]#mount /dev/cdrom /mnt/cdrom
2、将redhat光盘内容复制至本地硬盘
因为创建yum源的目录,必须是可以写入的的目录,所以需要将光盘中的文件全部复制到本地目录,如果在/mnt/cdrom光驱挂载目录执行创建yum源,会报“Directory /mnt/cdrom must be writable.”错误
[root@rh5rac1 ~]#mkdir -p /soft/redhat
[root@rh5rac1 /]# cp -rp /mnt/cdrom/ /soft/redhat/
[root@rh5rac1 /]# cd /soft/redhat
[root@rh5rac1 redhat]# ls
cdrom
3、安装createrepo包
[root@rh5rac1 cdrom]# cd /soft/redhat/cdrom/Server/
[root@rh5rac1 Server]# ls -l |grep createrepo
-r--r--r-- 1 root root 60901 Apr 21 2008 createrepo-0.4.11-3.el5.noarch.rpm
[root@rh5rac1 Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
4、在/etc/yum.repos.d目录下创建server.repo文件
[root@rh5rac1 Server]# cd /etc/yum.repos.d/
[root@rh5rac1 yum.repos.d]# pwd
/etc/yum.repos.d
[root@rh5rac1 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 |
5、使用createrepo创建yum库
[root@rh5rac1 yum.repos.d]# cd /soft/redhat/cdrom/Server/
[root@rh5rac1 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
6、安装测试
[root@rh5rac1 /]# rpm -qa |grep sysstat
[root@rh5rac1 /]#
[root@rh5rac1 /]# 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! |
[root@rh5rac1 /]# rpm -qa |grep sysstat
sysstat-7.0.2-11.el5
测试成功。
7、删除yum源
[root@rh5rac1 Server]# yum clean all
Loaded plugins: product-id, security, subscription-manager
Updating Red Hat repositories.
Cleaning up Everything
本文作者:黎俊杰(网名:踩点),从事”系统架构、操作系统、存储设备、数据库、中间件、应用程序“六个层面系统性的性能优化工作
欢迎加入 系统性能优化专业群,共同探讨性能优化技术。群号:258187244
更多推荐
所有评论(0)