在debian 6.0.0和ubuntu 12.04中配置镜像源的方法介绍

发布时间:2020-12-13编辑:脚本学堂
在debian 6.0.0和ubuntu 12.04中配置镜像源的方法介绍,有需要的朋友可以参考下。

在debian 6.0.0和ubuntu 12.04中配置镜像源的方法介绍,有需要的朋友可以参考下。

debian 6.0.0:(AMD64:大概33.8GB)
1.apt-get install apt-mirror
2.修改配置文件/etc/apt/mirror.list :
 

复制代码 代码如下:
set nthreads     20
set _tilde 0
set base_path /svn/ossource/debian600
set mirror_path $base_path/mirror
set skel_path   $base_path/skel
set var_path    $base_path/var
deb-amd64 http://ftp.us.debian.org/debian squeeze main contrib non-free
deb-amd64 http://ftp.us.debian.org/debian squeeze-updates main contrib non-free
deb-amd64 http://ftp.us.debian.org/debian squeeze-proposed-updates main contrib non-free
clean http://ftp.us.debian.org/debian



3.手工创建相关目录
mkdir -p /opt/ossource/debian600/mirror
mkdir -p /opt/ossource/debian600/var
mkdir -p /opt/ossource/debian600/skel
chown -R apt-mirror /opt/ossource/debian600/
4.执行
su - apt-mirror
nohup apt-mirror &
检查nohup.out日志,出现“Post Mirror script has completed”表示完成

#---------------

ubuntu 12.04:(AMD64:大概93.7 GB)
1.apt-get install apt-mirror
2.修改配置文件/etc/apt/mirror.list :
 

复制代码 代码如下:
set nthreads     20
set _tilde 0
set defaultarch  amd64
set base_path /ossource/ubuntu1204
set mirror_path $base_path/mirror
set skel_path   $base_path/skel
set var_path    $base_path/var
 
deb http://mirrors.163.com/ubuntu precise main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu precise main restricted universe multiverse
deb http://mirrors.163.com/ubuntu precise-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu precise-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu precise-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu precise-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu precise-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu precise-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu precise-backports main restricted universe multiverse
 
clean http://mirrors.163.com/ubuntu
 

 
3.手工创建相关目录
 

复制代码 代码如下:
mkdir -p /ossource/ubuntu1204/mirror
mkdir -p /ossource/ubuntu1204/var
mkdir -p /ossource/ubuntu1204/skel
chown -R apt-mirror /ossource/ubuntu1204/


 
4.执行
su - apt-mirror
nohup apt-mirror &
检查nohup.out日志,出现“Post Mirror script has completed”表示完成
 
周期性自动同步:修改如下文件
/etc/cron.d/apt-mirror

http发布:(/etc/apache2/sites-available/default)
 

复制代码 代码如下:
alias /debian  /opt/ossource/debian600/mirror/ftp.us.debian.org/debian/
<Directory "/opt/ossource/debian600/mirror/ftp.us.debian.org/debian/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
</Directory>
 
Alias /ubuntu  /ossource/ubuntu1204/mirror/mirrors.163.com/ubuntu/
<Directory "/ossource/ubuntu1204/mirror/mirrors.163.com/ubuntu/">
     Options Indexes FollowSymLinks
     AllowOverride All
     Order allow,deny
     Allow from all
</Directory>

4、客户端的修改
现在修改/etc/apt/sources.list文件,加入或者只保留如下行,再用#apt-get update更新一次就可以了
debian:
deb http://your_ip/debian squeeze main contrib non-free
deb http://your_ip/debian squeeze-updates main contrib non-free
deb http://your_ip/debian squeeze-proposed-updates main contrib non-free
ubuntu:
deb http://your_ip/ubuntu/ precise main multiverse restricted universe
deb-src http://your_ip/ubuntu/ precise main multiverse restricted universe
deb http://your_ip/ubuntu/ precise-updates main multiverse restricted universe
deb-src http://your_ip/ubuntu/ precise-updates main multiverse restricted universe
deb http://your_ip/ubuntu/ precise-backports main multiverse restricted universe
deb-src http://your_ip/ubuntu/ precise-backports main multiverse restricted universe
deb http://your_ip/ubuntu/ precise-security main multiverse restricted universe
deb-src http://your_ip/ubuntu/ precise-security main multiverse restricted universe
deb http://your_ip/ubuntu/ precise-proposed main multiverse restricted universe
deb-src http://your_ip/ubuntu/ precise-proposed main multiverse restricted universe