安装apt-mirror
# apt-get install apt-mirror
编辑 /etc/apt/mirror.list ,使配置文件如下
# cat /etc/apt/mirror.list
############# config ##################
#
# set base_path /var/spool/apt-mirror
#
# if you change the base path you must create the directories below with write privlages
#
# 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
set defaultarch amd64
/*设定同步的镜像架构,可以根据实际情况设定,默认是镜像与所用系统相同的架构*/
set nthreads 20
set _tilde 0
#
############# end config ##############
#deb unstable main contrib non-free
#deb-src unstable main contrib non-free
deb lenny main
/*设定镜像源,可以根据实际情况设定*/
clean
运行apt-mirror
# su - apt-mirror -c apt-mirror
更新完毕后,可以使用apache发布源镜像了。
apache可以这样配置:
$sudo vi /etc/apache2/sites-enabled/000-default
---------------------------------------------------
NameVirtualHost *
ServerAdmin webmaster@localhost
# DocumentRoot /var/www/
DocumentRoot /var/spool/apt-mirror/mirror/mirrors.163.com/debian/
Options Indexes FollowSymLinks
AllowOverride None
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
........
---------------------------------------------------
在日常的升级中,我们可以定期执行apt-mirror命令:
$sudo apt-mirror
或者将这个命令写进crontab中:
30 5 * * * root /usr/bin/apt-mirror >> /var/spool/apt-mirror/var/cron.log
每天五点30分执行,并在/var/spool/apt-mirror/var/文件夹中生成cron.log日志文件,以方便查看更新状态。
阅读(1438) | 评论(0) | 转发(0) |