的教程,小風博客www.hotxf.com歡迎大家光臨!今天要寫的內容是修改yum來源爲本地,用系統光盤做yum來源 來安裝gcc,簡單的例子擺脫RPM安裝依賴關係 關於yum Yum(全稱爲 Yellow dog Updater, Modified)是一個在Fedora和RedHat以及SUSE、CentOS中的Shell前端軟 件包管理器。基於RPM包管理,能夠從指定的服務器自動下載RPM包並且安裝,可以自動處理依賴性關係, 並且一次安裝所有依賴的軟件包,無須繁瑣地一次次下載、安裝。 默認軟件包來源是從網絡上下載進行安裝的,現在我們要做的是修改來源爲本地進行安裝
接下來掛載光盤到系統,我在根目錄下建立過ISO文件夾,所以直接掛到ISO上 從圖中可以看到/dev/cdrom已經掛載到了iso目錄。 [root@CentOS6-EN /]# mount /dev/corom /iso
2. 寫一個yum配置文件
yum的配置文件目錄爲:/etc/yum.repos.d/ 這裏我們先備份好系統默認的四個文件:
用mv命令來備份下 [root@CentOS6-EN yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak [root@CentOS6-EN yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak [root@CentOS6-EN yum.repos.d]# mv CentOS-Media.repo CentOS-Media.repo.bak [root@CentOS6-EN yum.repos.d]# mv CentOS-Vault.repo CentOS-Vault.repo.bak
新建一個文件,名爲:xiaofeng.repo 內容如下: [xiaofeng] name=xiaofeng baseurl=file:///mnt \\查找路徑 enable=1 \\是否檢查GPG-KEY,0爲不檢查,1爲檢查 gpgchack=0 \\是否啓用yum源,0爲不啓用,1爲啓用 [root@CentOS6-EN yum.repos.d]# vim xiaofeng.repo
3.安裝軟件(gcc等) 查找gcc: yum search gcc
安裝gcc: yum –y install gcc
[root@CentOS6-EN /]# yum search gcc Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile xiaofeng | 4.0 kB 00:00 ... ================================== N/S Matched: gcc =================================== compat-libgcc-296.i686 : Compatibility 2.96-RH libgcc library gcc-c++.i686 : C++ support for GCC gcc-gnat.i686 : Ada 95 support for GCC gcc-java.i686 : Java support for GCC gcc-objc.i686 : Objective-C support for GCC gcc-objc++.i686 : Objective-C++ support for GCC libgcc.i686 : GCC version 4.4 shared support library compat-gcc-34.i686 : Compatibility GNU Compiler Collection compat-gcc-34-c++.i686 : C++ support for compatibility compiler compat-gcc-34-g77.i686 : Fortran 77 support for compatibility compiler gcc.i686 : Various compilers (C, C++, Objective-C, Java, ...) gcc-gfortran.i686 : Fortran support libgcj.i686 : Java runtime library for gcc libgcj-devel.i686 : Libraries for Java development using GCC libgcj-src.i686 : Java library sources from GCC4 preview libgomp.i686 : GCC OpenMP v3.0 shared support library libmudflap.i686 : GCC mudflap shared support library libmudflap-devel.i686 : GCC mudflap support
Name and summary matches only, use "search all" for everything. [root@CentOS6-EN /]# yum -y gcc Loaded plugins: fastestmirror, security No such command: gcc. Please use /usr/bin/yum --help [root@CentOS6-EN /]# yum -y install gcc Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package gcc.i686 0:4.4.6-4.el6 will be installed --> Processing Dependency: cpp = 4.4.6-4.el6 for package: gcc-4.4.6-4.el6.i686 --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.6-4.el6.i686 --> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.6-4.el6.i686 --> Running transaction check ---> Package cloog-ppl.i686 0:0.15.7-1.2.el6 will be installed --> Processing Dependency: libppl_c.so.2 for package: cloog-ppl-0.15.7-1.2.el6.i686 --> Processing Dependency: libppl.so.7 for package: cloog-ppl-0.15.7-1.2.el6.i686 ---> Package cpp.i686 0:4.4.6-4.el6 will be installed --> Processing Dependency: libmpfr.so.1 for package: cpp-4.4.6-4.el6.i686 ---> Package glibc-devel.i686 0:2.12-1.80.el6 will be installed --> Processing Dependency: glibc-headers = 2.12-1.80.el6 for package: glibc-devel-2.12-1.80.el6.i686 --> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.80.el6.i686 --> Running transaction check ---> Package glibc-headers.i686 0:2.12-1.80.el6 will be installed --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.80.el6.i686 --> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.80.el6.i686 ---> Package mpfr.i686 0:2.4.1-6.el6 will be installed ---> Package ppl.i686 0:0.10.2-11.el6 will be installed --> Running transaction check ---> Package kernel-headers.i686 0:2.6.32-279.el6 will be installed --> Finished Dependency Resolution
Dependencies Resolved
======================================================================================= ======================================================================================= Installing: gcc i686 4.4.6-4.el6 xiaofeng 8.2 M Installing for dependencies: cloog-ppl i686 0.15.7-1.2.el6 xiaofeng 93 k cpp i686 4.4.6-4.el6 xiaofeng 3.4 M glibc-devel i686 2.12-1.80.el6 xiaofeng 970 k glibc-headers i686 2.12-1.80.el6 xiaofeng 609 k kernel-headers i686 2.6.32-279.el6 xiaofeng 1.9 M mpfr i686 2.4.1-6.el6 xiaofeng 153 k ppl i686 0.10.2-11.el6 xiaofeng 1.3 M
Transaction Summary ======================================================================================= Install 8 Package(s)
Total download size: 16 M Installed size: 35 M Downloading Packages: --------------------------------------------------------------------------------------- Total 18 MB/s | 16 MB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : kernel-headers-2.6.32-279.el6.i686 1/8 Installing : glibc-headers-2.12-1.80.el6.i686 2/8 Installing : glibc-devel-2.12-1.80.el6.i686 3/8 Installing : ppl-0.10.2-11.el6.i686 4/8 Installing : cloog-ppl-0.15.7-1.2.el6.i686 5/8 Installing : mpfr-2.4.1-6.el6.i686 6/8 Installing : cpp-4.4.6-4.el6.i686 7/8 Installing : gcc-4.4.6-4.el6.i686 8/8 Verifying : glibc-headers-2.12-1.80.el6.i686 1/8 Verifying : kernel-headers-2.6.32-279.el6.i686 2/8 Verifying : cpp-4.4.6-4.el6.i686 3/8 Verifying : glibc-devel-2.12-1.80.el6.i686 4/8 Verifying : mpfr-2.4.1-6.el6.i686 5/8 Verifying : ppl-0.10.2-11.el6.i686 6/8 Verifying : gcc-4.4.6-4.el6.i686 7/8 Verifying : cloog-ppl-0.15.7-1.2.el6.i686 8/8
Installed: gcc.i686 0:4.4.6-4.el6
Dependency Installed: cloog-ppl.i686 0:0.15.7-1.2.el6 cpp.i686 0:4.4.6-4.el6 glibc-devel.i686 0:2.12-1.80.el6 glibc-headers.i686 0:2.12-1.80.el6 kernel-headers.i686 0:2.6.32-279.el6 mpfr.i686 0:2.4.1-6.el6 ppl.i686 0:0.10.2-11.el6
Complete! [root@CentOS6-EN /]#到這裏就完成了安裝,小風博客www.hotxf.com 歡迎大家光臨,學習交流! |