Home | Mirror | Search

第 4 章 Package Manager

目錄

1. Yum Resource & Yum Mirror
1.1. Fedora resource
1.1.1. Fedora 5.3
1.1.2. Fedora 5.4
1.1.3. Fedora 6.x
1.2. rpmforge-release
1.2.1. CentOS 5.x
1.2.2. CentOS 6.x
1.2.3. CentALT
1.3. atomic
1.4. famillecollet
1.5. rpmfind.net
1.6. pkgs.org
1.7. China Resource
1.8. 製作本地共享源
2. yum - Yellowdog Updater Modified
2.1. install
2.2. localinstall
2.3. list
2.4. search
2.5. update / upgrade
2.6. remove
2.7. group
2.7.1. grouplist
2.7.2. groupinfo
2.7.3. groupinstall
2.7.4. groupremove
2.8. 查看包的依賴關係
3. rpm - RPM Package Manager
3.1. install/upgrade/remove
3.1.1. --prefix
3.2. query
4. rpmbuild - Build RPM Package(s)
4.1. RPM_directory_macros

1. Yum Resource & Yum Mirror

yum install yum-fastestmirror -y
		

1.1. Fedora resource

http://fedoraproject.org/wiki/EPEL

1.1.1. Fedora 5.3

5.3

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
				

1.1.2. Fedora 5.4

5.4

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
				

1.1.3. Fedora 6.x

6.x

rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
				

上面的地址已經停用,新地址在:http://mirrors.fedoraproject.org/publiclist

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
				

1.2. rpmforge-release

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

1.2.1. CentOS 5.x

http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
	    		
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
# rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
    			

1.2.2. CentOS 6.x

i686 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm


rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -i http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
    			

1.2.3. CentALT

http://centos.alt.ru

http://centos.alt.ru/repository/centos/5/i386/centalt-release-5-3.noarch.rpm
http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm
				
http://centos.alt.ru/repository/centos/6/i386/centalt-release-6-1.noarch.rpm
http://centos.alt.ru/repository/centos/6/x86_64/centalt-release-6-1.noarch.rpm
				

含 php-fpm 等包

rpm -Uvh http://centos.alt.ru/repository/centos/6/x86_64/centalt-release-6-1.noarch.rpm
				

1.3. atomic

http://www6.atomicorp.com/channels/atomic/centos/5/x86_64/RPMS/atomic-release-1.0-14.el5.art.noarch.rpm
			

1.4. famillecollet

rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
			

1.5. rpmfind.net

http://rpmfind.net

1.6. pkgs.org

http://pkgs.org/

1.8. 製作本地共享源

我使用Ubuntu + vsftpd為 Redhat 提供源

將光盤Mount到/mnt,或使用iso檔案Mount 到 /mnt

sudo mount /dev/cdrom /mnt/
or
sudo mount -o loop rhel-server-5.6-i386-dvd.iso /mnt
			

將整個光盤複製到ftp的anonymous目錄或者http目錄

sudo rsync -auvP /mnt/* /srv/ftp/
			

一般完整DVD光盤複製,不需要做此步驟。如果你的RPM看來自非官方,需要運行createrepo

cd /srv/ftp/
sudo apt-get install createrepo
sudo createrepo -g repodata/comps-rhel5-server-core.xml Server
			

FTP方式

			
cat > /etc/yum.repos.d/rhel-source-dvd.repo <<EOF
[rhel-source-dvd]
name=Red Hat Enterprise Linux $releasever - Source
baseurl=ftp://172.16.1.2/Server
enabled=1
gpgcheck=1
gpgkey=ftp://172.16.1.2/RPM-GPG-KEY-redhat-release
EOF
			
			

HTTP方式

			
cat > /etc/yum.repos.d/rhel-source-dvd.repo <<EOF
[rhel-source-dvd]
name=Red Hat Enterprise Linux $releasever - Source
baseurl=http://172.16.1.2/Server
enabled=1
gpgcheck=1
gpgkey=http://172.16.1.2/RPM-GPG-KEY-redhat-release
EOF
			
			

還可以使用本地檔案或者光盤Mount目錄

			
cat > /etc/yum.repos.d/rhel-source-dvd.repo <<EOF
[rhel-source-dvd]
name=Red Hat Enterprise Linux $releasever - Source
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///mnt/RPM-GPG-KEY-redhat-release
EOF
			
			
yum clean all
yum list updates
			
comments powered by Disqus