Ubuntu12.04搭建自有源

其实,这个工作比较简单,主要两步:apt-mirror和apache。(这里的系统是ubuntu12.04)

1、apt-mirror

1.1 安装

一如既往地简单,直接sudo apt-get install apt-mirror即可。

1.2 配置apt-mirror

$ sudo vim /etc/apt/mirror.list

 

############# config ##################
#
# set base_path    /var/spool/apt-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     20  
set _tilde 0
#
############# end config ##############

deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu precise-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu precise-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse

clean http://archive.ubuntu.com/ubuntu

将其修改为对自己比较快的源(这里用ustc的):

 

 

############ config ##################
#
#set base_path    /var/spool/apt-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     20  
set _tilde 0
#
############# end config ##############

deb http://mirrors.ustc.edu.cn/ubuntu precise main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu precise-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu precise-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu precise-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu precise-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu precise main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu precise-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu precise-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu precise-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu precise-backports main restricted universe multiverse

clean http://mirrors.ustc.edu.cn/ubuntu

1.3 apt-mirror同步源

用sudo apt-mirror命令开始同步源即可。

 

$ sudo apt-mirror
Downloading 140 index files using 20 threads...
Begin time: Fri Nov  1 17:23:49 2013
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Fri Nov  1 17:23:49 2013

Proceed indexes: [SSSSSPPPPP]

93.0 GiB will be downloaded into archive.
Downloading 85303 archive files using 20 threads...
Begin time: Fri Nov  1 17:23:55 2013
[20]... 

 

这里,要注意,有时候会碰到“No such file apt-mirror: can't open index in proceed_index_gz at /usr/bin/apt-mirror line 445.”这样的错误,折腾了我一个下午。原因不怎么清楚,不过,貌似按照上面我的流程做,至少可以避免这个错误。具体原因,难道和我配置文件中没去掉注释有关系,总之,稍诡异。


 

posted on 2013-11-01 18:57  you Richer  阅读(429)  评论(0编辑  收藏  举报