歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 6.4使用本地yum源

CentOS 6.4使用本地yum源

日期:2017/2/28 14:37:56   编辑:Linux教程

CentOS 6.4使用本地yum源

每次用rpm包安裝軟件是總有依賴包的出現,今天我搭建了本地yum倉庫,使用yum從光盤安裝軟件可以解決包的依賴關系,具體操作如下:

1.掛載光盤鏡像
[root@centos ~]# mkdir /mnt/cdrom
[root@centos ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@centos ~]# vim /etc/yum.repos.d/CentOS-Media.repo
[c6-media]
name=CentOS-$releasever - Media --倉庫名
baseurl=file:///mnt/cdrom --軟件包路徑
gpgcheck=1 --啟用包檢查
enabled=1 --啟用這個倉庫
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-6

2.測試倉庫
[root@centos ~]# yum clean all --清除所有包
Loaded plugins: fastestmirror, refresh-packagekit
Cleaning repos: c6-media
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@centos ~]# yum repolist --查找有幾個倉庫
Loaded plugins: fastestmirror, refresh-packagekit
Determining fastest mirrors
c6-media | 4.0 kB 00:00 ...
c6-media/primary_db | 3.5 MB 00:00 ...
repo id repo name status
c6-media CentOS-6 - Media 4,802
repolist: 4,802
[root@centos ~]#

3.安裝軟件
[root@centos ~]# yum install gpm --安裝軟件
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gpm.i686 0:1.20.6-12.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================
Installing:
gpm i686 1.20.6-12.el6 c6-media 175 k
Transaction Summary
========================================================================================================================================================
Install 1 Package(s)
Total download size: 175 k
Installed size: 373 k
Is this ok [y/N]:y --確定安裝

4.常用yum基本命令
yum --help --幫助信息
yum list --列出軟件包
yum repolist --查看有多少倉庫
yum info 軟件包 --軟件包的信息
yum install 軟件包 --安裝軟件包
yum reinstall 軟件包 --覆蓋安裝軟件包
yum remove 軟件包 --刪除軟件包
yum clean 軟件包 --清除軟件包
yum grouplist --查看軟件組
yum groupinstall "軟件組" --安裝軟件組
yum install info "軟件組" --查看軟件組的信息
yum remove “組件組" --刪除軟件組
yum search 軟件包 --檢測是否有軟件包
yum update 軟件包 --軟件包升級

推薦閱讀

RedHat Linux 本地yum源的配置 http://www.linuxidc.com/Linux/2013-08/88217.htm

RedHat 6.2 Linux修改yum源免費使用CentOS源 http://www.linuxidc.com/Linux/2013-07/87383.htm

配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm

Redhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htm

yum的配置文件說明 http://www.linuxidc.com/Linux/2013-04/83298.htm

RedHat 6.1下安裝yum(圖文) http://www.linuxidc.com/Linux/2013-06/86535.htm

YUM 安裝及清理 http://www.linuxidc.com/Linux/2013-07/87163.htm

更多CentOS相關信息見CentOS 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=14

Copyright © Linux教程網 All Rights Reserved