码迷,mamicode.com
首页 > 其他好文 > 详细

自建 debian 7 源

时间:2014-08-15 19:47:09      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:style   http   使用   os   io   数据   for   ar   

     由于线上有不少debain 7 操作系统,故准备自建源,方便更新.

     使用apt-mirror工具搭建非常方便.它提供了能够反映任何部分(甚至全部)Debian和Ubuntu GNU/Linux发行版或其他来源通常由开源开发者提供。

     在debian or ubuntu下使用很简单:

$ apt-get install apt-mirror
$ nano /etc/apt/mirror.list
$ sudo apt-mirror

     也可以很容易地设置为手动通过cron或继续跑,当你想更新镜像。/etc/cron.d/apt-mirror,设置每天什么时候同步更新内容

     下面通过实例演示:

root@192.168.1.84:DBBAK# apt-get install apt-mirror
root@192.168.1.84:DBBAK# cat /etc/apt/mirror.list
# if you change the base path you must create the directories below with write privlages
############# config ##################
set base_path    /opt/DBBAK/debian7_mirror
#
set mirror_path  $base_path/mirror   #更新如果报错,可能需要创建相关目录
set skel_path    $base_path/skel
set var_path     $base_path/var
set cleanscript $var_path/clean.sh
set defaultarch  <running host architecture>
set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
set nthreads     40
set _tilde 0
#
############# end config ##############

#deb http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-src http://ftp.us.debian.org/debian unstable main contrib non-free

# mirror additional architectures

deb-amd64 http://mirrors.163.com/debian wheezy main contrib non-free

#clean http://ftp.us.debian.org/debian

root@192.168.1.84:DBBAK# apt-mirror

Downloading 9 index files using 9 threads...
Begin time: Thu Aug 14 18:16:18 2014
[9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Thu Aug 14 18:17:05 2014


Proceed indexes: [P]

43.7 GiB will be downloaded into archive.
Downloading 36041 archive files using 40 threads...
Begin time: Thu Aug 14 18:17:09 2014
[40]... [39]... [38]... [37]... [36]... [35]... [34]... [33]... [32]... [31]... [30]... [29]... [28]... [27]... [26]... [25]... [24]... [23]... [22]... [21]... [20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Thu Aug 14 19:10:55 2014

0.0 bytes in 0 files and 0 directories can be freed.
Run /opt/DBBAK/debian7_mirror/var/clean.sh for this purpose.


搭建web服务:

root@192.168.1.84:DBBAK# cat /etc/apache2/sites-enabled/source 
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot /opt/DBBAK/mirror 
	<Directory /opt/DBBAK/mirror>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined

</VirtualHost>


在debain7测试机上更新数据源

root@10.1.1.176:~# cat /etc/apt/sources.list

deb http://192.168.1.84/debian7/mirror/mirrors.163.com/debian  wheezy main non-free contrib #注意目录

root@10.1.1.176:~# apt-get update
Hit http://192.168.1.84 wheezy Release.gpg
Hit http://192.168.1.84 wheezy Release
Hit http://192.168.1.84 wheezy/main amd64 Packages
Hit http://192.168.1.84 wheezy/non-free amd64 Packages
Hit http://192.168.1.84 wheezy/contrib amd64 Packages
Ign http://192.168.1.84 wheezy/contrib Translation-en
Ign http://192.168.1.84 wheezy/main Translation-en
Ign http://192.168.1.84 wheezy/non-free Translation-en
Reading package lists... Done


自建 debian 7 源,布布扣,bubuko.com

自建 debian 7 源

标签:style   http   使用   os   io   数据   for   ar   

原文地址:http://my.oschina.net/davehe/blog/301665

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!