标签:http os 使用 io strong 文件 for 数据 ar
实验拓扑:
----------------------------- ----------------------------
|server ip: 192.168.1.100| < -------bridge--------> |client ip: 192.168.1.101|
----------------------------- ----------------------------
思路:
1. [server端]确认安装httpd
|
1
2
|
rpm -q httpdhttpd-2.2.15-29.el6.centos.i686 |
若没有安装, 进行安装
2. [server端]复制包文件到网页文件目录
|
1
|
cp /media/cdrom/Packages/* /var/www/html/Packages/ |
这里我在网页文件目录下面建立了一个Packages文件来存放rpm包文件
是从光盘镜像中拷贝来的
3. [server端]创建仓库文件 createrepo /path
|
1
|
createrepo /var/www/html/Packages/ #在该文件建立包文件的源数据文件 |
这样我们的rmp包服务器就准备完毕了, 下面可以开始下载测试了
4. [client端]修改yum配置文件
打开另一台虚拟机, 当然两台机器首先要联网的, 让我ping一下先
|
1
2
3
4
5
|
ping 192.168.1.100PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.64 bytes from 192.168.1.100: icmp_seq=1 ttl=64 time=2.57 ms64 bytes from 192.168.1.100: icmp_seq=2 ttl=64 time=0.396 ms64 bytes from 192.168.1.100: icmp_seq=3 ttl=64 time=0.400 ms |
yum repo配置文件路径:
指定可用的yum仓库 /etc/yum.conf, /etc/yum.repo.d/*.repo
配置文件格式: 有两段组成, 类似windows的ini配置文件
[main] :主配置段
[repo] :仓库配置段
yum repo配置文件的结构:
|
1
2
3
4
5
6
7
|
[reop_ID] #注意repo_ID绝对不能与其他配置文件中的ID重复name=String #仓库名字baseurl=http://server/path/to/repo #仓库访问路径, 参见服务器的访问方式:enabled={1|0} #是否启用此仓库, 默认启用gpgcheck={1|0} #是否检查包来源合法性, 完整性gpgkey= #gpg检测时公钥文件路径, 可以再本地,可以再服务器上cost= #定义此仓库的开销, 默认为1000, 越小越优先 |
OK! ping通了, 开始配置客户机的yum repo配置文件, 把CentOS-Base.repo 中每个仓库都设置为enabled=0,这样我们就不使用默认的仓库, 如果 [base] 等 下面没有enabled项目我们手动添加enabled=0即可
|
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
vim /etc/yum.repos.d/CentOS-Base.repo# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6enabled=0 #注意这里设置为0, 不使用的意思#released updates [updates]name=CentOS-$releasever - Updatesmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6enabled=0 #注意这里设置为0, 不使用的意思#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6enabled=0 #注意这里设置为0, 不使用的意思#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0 #注意这里设置为0, 不使用的意思gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/gpgcheck=1enabled=0 #注意这里设置为0, 不使用的意思gpgkey=:wq #保存后推出vim /etc/yum.repos.d/Httpd-test-Base.repo #我们来配置一个自己的repo配置文件,如下:[httpd-192.168.1.100]name=testenabled=1baseurl=http://192.168.1.100/Packages/gpgcheck=0:wq #保存并且退出yum repolist #看一下yum的repo列表, 如果跟下面输出结果差不多,只要一个repo, 就设置好了Loaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfilerepo id repo name statushttpd-192.168.1.100 test 2,695repolist: 2,695 |
5. [client端]安装测试
|
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
51
52
53
54
55
56
57
58
59
60
61
62
|
yum install httpdLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfileSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package httpd.i686 0:2.2.15-29.el6.centos will be installed--> Finished Dependency ResolutionDependencies Resolved==================================================================== Package Arch Version Repository ====================================================================Installing: httpd i686 2.2.15-29.el6.centos httpd-192.1Transaction Summary====================================================================Install 1 Package(s)Total download size: 828 kInstalled size: 2.8 MIs this ok [y/N]: ^CExiting on user Command[root@apache yum.repos.d]# yum install httpdLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfileSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package httpd.i686 0:2.2.15-29.el6.centos will be installed--> Finished Dependency ResolutionDependencies Resolved==================================================================== Package Arch Version Repository Size====================================================================Installing: httpd i686 2.2.15-29.el6.centos httpd-192.168.1.100 828 kTransaction Summary====================================================================Install 1 Package(s)Total download size: 828 kInstalled size: 2.8 MIs this ok [y/N]: yDownloading Packages:httpd-2.2.15-29.el6.centos.i686.rpm | 828 kB 00:00 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionWarning: RPMDB altered outside of yum. Installing : httpd-2.2.15-29.el6.centos.i686 1/1 Verifying : httpd-2.2.15-29.el6.centos.i686 1/1 Installed: httpd.i686 0:2.2.15-29.el6.centos Complete! |
大功告成辛苦啦
标签:http os 使用 io strong 文件 for 数据 ar
原文地址:http://www.cnblogs.com/jin01/p/3931356.html