-
首先先安装createrepo-0.9.9-17.el6.noarch.rpm
我之前搭建过yum,所以我直接用yum install直接安装我的系统是redhat6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
[root@localhost rpm-gpg]
# yum install createrepo
Loaded plugins: product-
id
, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.9.9-17.el6 will be installed
--> Processing Dependency: python-deltarpm
for
package: createrepo-0.9.9-17.el6.noarch
--> Running transaction check
---> Package python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed
--> Processing Dependency: deltarpm = 3.5-0.5.20090913git.el6
for
package: python-deltarpm-3.5-0.5.20090913git.el6.x86_64
--> Running transaction check
---> Package deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
createrepo noarch 0.9.9-17.el6 rhel-
source
94 k
Installing
for
dependencies:
deltarpm x86_64 3.5-0.5.20090913git.el6 rhel-
source
71 k
python-deltarpm x86_64 3.5-0.5.20090913git.el6 rhel-
source
27 k
Transaction Summary
================================================================================
Install 3 Package(s)
Total download size: 192 k
Installed size: 518 k
Is this ok [y
/N
]: y
Downloading Packages:
--------------------------------------------------------------------------------
Total 667 kB
/s
| 192 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : deltarpm-3.5-0.5.20090913git.el6.x86_64 1
/3
Installing : python-deltarpm-3.5-0.5.20090913git.el6.x86_64 2
/3
Installing : createrepo-0.9.9-17.el6.noarch 3
/3
rhel-
source
/productid
| 1.7 kB 00:00 ...
Verifying : python-deltarpm-3.5-0.5.20090913git.el6.x86_64 1
/3
Verifying : createrepo-0.9.9-17.el6.noarch 2
/3
Verifying : deltarpm-3.5-0.5.20090913git.el6.x86_64 3
/3
Installed:
createrepo.noarch 0:0.9.9-17.el6
Dependency Installed:
deltarpm.x86_64 0:3.5-0.5.20090913git.el6
python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6
Complete!
You have new mail
in
/var/spool/mail/root
|
1
2
|
[root@localhost rpm-gpg]
# rpm -qa | grep createrepo
createrepo-0.9.9-17.el6.noarch
|
我已经安装成功
2. 在/root下mkdir一个文件夹epel,我把我之前挂载在/mnt/Packages下的*.rpm copy到/root/epel
3. 在/etc/yum.repos.d下修改rhel-source.repo文件(可能文件名称不同)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@localhost yum.repos.d]
# pwd
/etc/yum
.repos.d
[root@localhost yum.repos.d]
# ls
rhel-
source
.repo
[root@localhost yum.repos.d]
# cat rhel-source.repo
[rhel-Base]
name=Red Hat
baseurl=
file
:
///mnt
enabled=1
gpgcheck=0
[epel]
name=epel
baseurl=
file
:
///root/epel
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]
#
|
【epel】是我新添加的配置
4. 我们执行 yum repolist命令看一下
1
2
3
4
5
6
7
8
9
10
|
[root@localhost yum.repos.d]
# yum repolist
Loaded plugins: product-
id
, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
file
:
///root/epel/repodata/repomd
.xml: [Errno 14] Could not
open
/read
file
:
///root/epel/repodata/repomd
.xml
Trying other mirror.
repo
id
repo name status
epel epel 0
rhel-Base Red Hat 0
repolist: 0
[root@localhost yum.repos.d]
#
|
repo id 和repo name已经显示出了新添加的epel,但是出错了缺少repomd.xml,下面我来创建一个repomd.xml
5.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[root@localhost yum.repos.d]
# createrepo /root/epel/
Spawning worker 0 with 15 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving
file
lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost yum.repos.d]
# ls /root/epel/
php-5.3.3-22.el6.x86_64.rpm php-pear-1.9.4-4.el6.noarch.rpm
php-cli-5.3.3-22.el6.x86_64.rpm php-pecl-apc-3.1.9-2.el6.x86_64.rpm
php-common-5.3.3-22.el6.x86_64.rpm php-pecl-memcache-3.0.5-4.el6.x86_64.rpm
php-gd-5.3.3-22.el6.x86_64.rpm php-pgsql-5.3.3-22.el6.x86_64.rpm
php-ldap-5.3.3-22.el6.x86_64.rpm php-soap-5.3.3-22.el6.x86_64.rpm
php-mysql-5.3.3-22.el6.x86_64.rpm php-xml-5.3.3-22.el6.x86_64.rpm
php-odbc-5.3.3-22.el6.x86_64.rpm php-xmlrpc-5.3.3-22.el6.x86_64.rpm
php-pdo-5.3.3-22.el6.x86_64.rpm repodata
[root@localhost yum.repos.d]
#
|
我先yum clean all清除下缓存并yum repolist下看有没有出错
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
[root@localhost yum.repos.d]
# yum clean all
Loaded plugins: product-
id
, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: epel rhel-Base
Cleaning up Everything
[root@localhost yum.repos.d]
# yum repolist
Loaded plugins: product-
id
, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
epel | 2.9 kB 00:00 ...
epel
/primary_db
| 14 kB 00:00 ...
rhel-Base | 3.9 kB 00:00 ...
rhel-Base
/primary_db
| 3.1 MB 00:02 ...
repo
id
repo name status
epel epel 15
rhel-Base Red Hat 3,648
repolist: 3,663
[root@localhost yum.repos.d]
#
|
yum repolist没有出错,看来我们创建成功了。
6. 测试
yum list
yum list all
yum install 安装一个软件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
[root@localhost epel]
# yum install php-5.3.3-22.el6.x86_64.rpm
Loaded plugins: product-
id
, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-m anager to register.
Setting up Install Process
Examining php-5.3.3-22.el6.x86_64.rpm: php-5.3.3-22.el6.x86_64
Marking php-5.3.3-22.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-22.el6 will be installed
--> Processing Dependency: php-cli(x86-64) = 5.3.3-22.el6
for
package: php-5.3.3-22.el6.x86_ 64
--> Processing Dependency: php-common(x86-64) = 5.3.3-22.el6
for
package: php-5.3.3-22.el6.x 86_64
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.3-22.el6 will be installed
---> Package php-common.x86_64 0:5.3.3-22.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================
Package Arch Version Repository Size
============================================================================================
Installing:
php x86_64 5.3.3-22.el6
/php-5
.3.3-22.el6.x86_64 3.5 M
Installing
for
dependencies:
php-cli x86_64 5.3.3-22.el6 epel 2.2 M
php-common x86_64 5.3.3-22.el6 epel 524 k
Transaction Summary
============================================================================================
Install 3 Package(s)
Total size: 6.2 M
Total download size: 2.7 M
Installed size: 13 M
Is this ok [y
/N
]: ^CExiting on user Command
[root@localhost epel]
#
|
本文转自 zhangguangyihttp://blog.51cto.com/bosszhang/1678304
51CTO博客,原文链接: