CentOS 6.4 自建yum源
配置apache1.安装apache
1
yum -y install httpd
2.配置apache配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# tail -n 14 /etc/httpd/conf/httpd.conf
NameVirtualHost 192.168.40.135:80
<VirtualHost 192.168.40.135:80>
DocumentRoot /yum/data
ServerName yum-server.com
ErrorLog /yum/log/yum-server-error_log
CustomLog /yum/log/yum-server-access_log common
</VirtualHost>
Alias /data "/yum/data"
<Directory "/yum/data">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
3.创建根目录及日志文件
1
2
3
4
5
mkdir /yum/data -p
mkdir /yum/log
touch /yum/log/yum-server-error_log
touch /yum/log/yum-server-access_log
chown apache. /yum -R
4.重启apache服务
1
/etc/init.d/httpd restart
配置yum源
1.安装createrepo
1
yum -y install createrepo
2.安装yum插件"yum-downloadonly" 后期做测试
1
yum install yum-downloadonly -y
3.下载一些软件做测试
1
yum install --downloadonly --downloaddir=/yum/data/ gcc gcc-c++ openssl openssl-devel pcre-devel pcre
4.重建缓存及yum索引
1
2
3
createrepo -v /yum/data/
yum clean all
yum makecache
5.查看自建yum源
1
2
3
4
5
6
# yum repolist
Loaded plugins: downloadonly, fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id repo name status
womai-test CentOS-6 - womai 25
repolist: 25
6.测试
在第二台虚拟机中使用该yum源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
scp CentOS-test.repo root@192.168.40.172:/etc/yum.repos.d/
# yum install pcre-devel
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pcre-devel.x86_64 0:7.8-6.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================
Installing:
pcre-devel x86_64 7.8-6.el6 womai-test 318 k
Transaction Summary
===================================================================================================================================================================================
Install 1 Package(s)
Total download size: 318 k
页:
[1]