首页 技术 正文
技术 2022年11月14日
0 收藏 620 点赞 2,244 浏览 40680 个字

先介绍一下环境:

主机:Win7

虚拟机:VirtualBox + Debian7

由于软件源的体积比较大,所以我又给虚拟机添加了一块50GB的虚拟硬盘(给虚拟机添加虚拟硬盘的方法参见:http://www.cnblogs.com/pengdonglin137/p/3366589.html , 其中介绍了如何在Vmware和VirtualBox中给Linux虚拟机添加虚拟硬盘),然后修改/etc/fstab,使在系统启动的时候将其自动挂载到/home/pengdl/debian_source目录下。

下面步入正题:

第一步、安装apt-mirror工具

执行如下命令:

sudo apt-get install apt-mirror

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

第二步、配置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://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-alpha http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-amd64 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-armel http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-hppa http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-i386 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-ia64 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-m68k http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-mips http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-mipsel http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-powerpc http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-s390 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-sparc http://ftp.us.debian.org/debian unstable main contrib non-freeclean http://ftp.us.debian.org/debian

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

将其修改为对自己比较快的源,这里我用的是  http://ftp.cn.debian.org/debian/ wheezy main contrib non-free

因为我要将将来下载的源放到/home/pengdl/debian_source下面,所以现在该目录下创建几个文件夹(具体是那些文件夹,可以参见上面的配置文件):

/home/pengdl/debian_source/mirror

/home/pengdl/debian_source/skel

/home/pengdl/debian_source/var

下面是我的配置文件:

############# config ##################
#
# set base_path /var/spool/apt-mirror
set base_path /home/pengdl/debian_source
#
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-i386 http://ftp.cn.debian.org/debian/ wheezy main contrib non-free#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-alpha http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-amd64 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-armel http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-hppa http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-i386 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-ia64 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-m68k http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-mips http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-mipsel http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-powerpc http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-s390 http://ftp.us.debian.org/debian unstable main contrib non-free
#deb-sparc http://ftp.us.debian.org/debian unstable main contrib non-free#clean http://ftp.us.debian.org/debian
clean http://ftp.cn.debian.org/debian

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>
<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

第三步、同步镜像

sudo apt-mirror

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

同步完成后,我们可以利用clean.sh清理无用软件包(本文档以set base_path   /home/pengdl/debian_source为例):
$sudo sh /home/pengdl/debian_source/var/clean.sh

在日常的升级中,我们可以定期执行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日志文件,以方便查看更新状态。

第四步、访问镜像

1、本地访问

sudo vim /etc/apt/sources.list


修改成如下内容:


<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

deb file:/home/pengdl/debian_source/mirror/ftp.cn.debian.org/debian wheezy main contrib non-free

更新软件源:

sudo apt-get update

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

2、通过http访问

想要通过http的方式获得本地Debian/Ubuntu的源镜像,因此需要安装apache web服务器

安装Apache

sudo apt-get install apache2

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

Apache默认的根目录是/var/www,但是软件仓库却在/home/pengdl/debian_source/mirror
为了能够通过 http://192.168.0.100/debian 
访问到相应的软件库,我们可以symlinks /var/www/debian 到真正的库地址。

ln -s /home/pengdl/debian_source/mirror/ftp.de.debian.org/debian /var/www/debian

修改sources.list
sudo vim /etc/apt/sources.list

修改成如下内容:

deb http://192.168.0.100/debian wheezy main contrib non-free

或者

deb http://127.0.0.1/debian wheezy main contrib non-free

执行

sudo apt-get update

或者不采用建立软连接的方式,而是直接修改apatch2的配置文件/etc/apache2/sites-enabled/000-default,把DocumentRoot /var/www改为:

DocumentRoot /home/pengdl/debian_source/mirror/ftp.de.debian.org/debian

然后重启apache

sudo /etc/init.d/apache2 start

修改sources.list
sudo vim /etc/apt/sources.list

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

修改成如下内容:

deb http://192.168.0.100 wheezy main contrib non-free

或者

deb http://127.0.0.1 wheezy main contrib non-free

执行

sudo apt-get update

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

完!!

参考:

http://forum.ubuntu.org.cn/viewtopic.php?t=41791

http://forum.ubuntu.org.cn/viewtopic.php?t=40082&highlight=%E7%BF%BB%E8%AF%91

http://rex.zhang.name/index.php/2011/05/506

http://www.linuxeden.com/html/sysadmin/20090518/65717.html

http://www.2cto.com/os/201311/254830.html

http://www.linuxidc.com/Linux/2008-09/15841.htm

http://popey.com/blog/2006/10/24/creating_an_ubuntu_repository_mirror_with_apt-mirror/

http://www.debianadmin.com/debian-apt-source-mirror-using-apt-mirror.html

==================================================================================

建立本地ubuntu仓库源
首先,我们要安装apt-mirror

$sudo apt-get install apt-mirror

假设我们将镜像等文件放在 /service/ubuntu文件夹下:

请事先新建以下文件夹(mirror.list里面提示要我们事先新建文件夹的):

/service/ubuntu

/service/ubuntu/mirror

/service/ubuntu/skel

/service/ubuntu/var

配置apt-mirror:

$sudo vi /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  <running host architecture>

#我们改这一项就好:

set base_path    /service/ubuntu

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 nthreads     20

set _tilde 0

#

############# end config ##############

#我们把常用的软件同步过来就够用了

deb-i386 http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse

deb-i386 http://archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse

deb-i386 http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse

deb-i386 http://archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse

deb-i386 http://archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

# 当某些软件包在服务器端进行了升级,或者服务器端不再需要这些软件包时,我们使用了apt-mirror与服务器同步后

#会在本地的$var_path/下生成一个clean.sh的脚本,列出了遗留在本地的旧版本和无用的软件包,你可以手动运行这个

#脚本来删除遗留在本地的且不需要用的软件包

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

—————————————————————————–

如果用amd64位架构下的包,可以加上deb-amd64的标记

如果什么都不加,直接使用deb http…..这种格式,则在同步时,只同步当前系统所使用的架构下的软件包。比如一个64位系统,直接deb http….只同步64位的软件包。如果还嫌麻烦,直接去改set defaultarch  <running host architecture>这个参数就好,比如改成set defaultarch i386,这样你使用deb http…..这种格式,则在同步时,只同步i386的软件包了。

如果你还想要源码,可以把源码也加到mirror.list里面同步过来,比如加上deb-src这样的标记。想要其他的东西也可以追加相应的标记来完成。

配置好后我们就可以和指定的镜像进行同步了

$sudo apt-mirror

如果是第一次同步,官方镜像可能需要几天时间才能同步完整,如果与国内源进行同步,只同步常用软件,平均1秒钟网速1MB(Byte)要同步30G左右的数据,大概需要5-8小时的时间才能同步完整。

同步完成后,我们可以利用clean.sh清理无用软件包(本文档以set base_path   /server/ubuntu为例):

$sudo sh /service/ubuntu/var/clean.sh

更新完毕后,可以使用apache发布源镜像了。

apache可以这样配置:

$sudo vi /etc/apache2/sites-enabled/000-default

—————————————————

NameVirtualHost *

<VirtualHost *>

ServerAdmin webmaster@localhost

#    DocumentRoot /var/www/

DocumentRoot /service/ubuntu/mirror/archive.ubuntu.com/

<Directory />

Options Indexes FollowSymLinks

AllowOverride None

</Directory>

<Directory /var/www/>

Options FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

</Directory>

……..

—————————————————

在日常的升级中,我们可以定期执行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日志文件,以方便查看更新状态。

=============================================================================================

使用apt-mirror建立局域网内的Debian/Ubuntu源镜像

Version 1.0

Author: Falko Timme <ft [at] falkotimme [dot] com>

Last edited 12/26/2006

翻译:icyfire (icyfire0105@gmail.com)

本教程将指导你如何利用apt-mirror建立局域网内的Debian/Ubuntu源镜像。如果你需要在局域网内安装多套系统,那么建立一个本地的Debian/Ubuntu源镜像将会有益,在您更新系统的时候将获得比互联网连接快得多的速度,而且还能节省您的互联网带宽。

我首先想说的是本文所讲的方法并不是唯一建立Debian/Ubuntu源镜像的方法。有很多方法可以达成这个目标,但是这却是我采用的办法。我并不保证这个方法适用于您。

1 前期准备

你可以在debian和ubuntu系统上建立Debian/Ubuntu源镜像,也就是说,debian系统可以建立Debian和Ubuntu源镜像,ubuntu系统上也能建立Debian和Ubuntu源镜像。

需要注意的是要建立一个源镜像你需要有一个快一点的连接和足够大的硬盘空间。在我的测试过程中我做了一个Debian Sarge的main,contrib 和non-free部分的镜像和 Ubuntu Edgy Eft的 main, restricted, universe部分的镜像,这总共占用了大概25G的硬盘空间,在16M的DSL的带宽下,花了6小时的时间才下载完。

我没有建立安全部分的镜像,因为我认为直接从互联网上下载安全更新会更好一点,因为这样可以保证你总能获得最新的版本。

本测试基于 Debian Sarge 和Ubuntu Edgy Eft操作系统,如果你使用的是其他的版本,那么这个步骤可能会有细微的差异。你需要安装一个基本的 Debian Sarge 系统(安装步骤http://www.howtoforge.com/perfect_setup_debian_sarge)或者 Ubuntu Edgy Eft系统(安装步骤http://www.howtoforge.com/perfect_setup_ubuntu_6.10)

这个例子中本地源镜像的ip是192.168.0.100.

2,1安装apt-mirror

修改/etc/apt/sources.list(Debian Sarge必须)

如果你安装的是 Debian Sarge,你必须要修改sources.list.我不清楚Debian Etch 或者 Sid是否必须要修改,你可以自己尝试一下。对Ubuntu Edgy Eft. 这一步不适必须的。

代码:

vi /etc/apt/sources.list

加入下面怪这一行。

代码:

deb http://apt-mirror.sourceforge.net/ apt-mirror/

然后执行:

代码:

apt-get update

2.2安装apt-mirror

这一步对Debian和Ubuntu都是必须的,安装apt-mirror,执行

代码:

apt-get install apt-mirror

3安装阿帕奇。

我想要通过http的方式获得本地Debian/Ubuntu的源镜像,因此需要安装apache web服务器。

代码:

apt-get install apache2

默认的根目录是/var/www,接下来我会symlink这个目录到Debian and Ubuntu 的软件仓库所在目录。

4配置apt-mirror

apt-mirror的配置文件在/ etc/apt/mirror.list,debian sarge中的默认配置文件如下:

引用:

# apt-mirror configuration file

##

## The default configuration options (uncomment and change to override)

##

#

# 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 defaultarch

# set nthreads 20

#

##

## Example sources

##

# sarge’s section

deb http://ftp.fi.debian.org/debian sarge main contrib non-free

deb-src http://ftp.fi.debian.org/debian sarge main contrib non-free

deb http://security.debian.org/debian-security sarge/updates main contrib non-free

deb-src http://security.debian.org/debian-security sarge/updates main contrib non-free

deb http://ftp.fi.debian.org/debian sarge main/debian-installer

# sarge-proposed-updates’s section

deb http://ftp.fi.debian.org/debian sarge-proposed-updates main contrib non-free

deb-src http://ftp.fi.debian.org/debian sarge-proposed-updates main contrib non-free

# sid’s section

deb http://ftp.fi.debian.org/debian sid main contrib non-free

deb-src http://ftp.fi.debian.org/debian sid main contrib non-free

deb http://ftp.fi.debian.org/debian sid main/debian-installer

# experimental section

deb http://ftp.fi.debian.org/debian ../project/experimental main contrib non-free

deb-src http://ftp.fi.debian.org/debian ../project/experimental main contrib non-free

##

## Cleaner configuration example

##

#

# set cleanscript $var_path/clean.sh

#

# Cleaning section

clean http://security.debian.org/

clean http://ftp.fi.debian.org/

skip-clean http://ftp.fi.debian.org/doc/

skip-clean http://ftp.fi.debian.org/tools/

skip-clean http://ftp.fi.debian.org/debian-cd/

skip-clean http://ftp.fi.debian.org/debian-minicd/

skip-clean http://ftp.fi.debian.org/debian/dists/s … ller-i386/

skip-clean http://ftp.fi.debian.org/debian/dists/s … ller-i386/

skip-clean http://ftp.fi.debian.org/debian/doc/

skip-clean http://ftp.fi.debian.org/debian/tools/

skip-clean http://ftp.fi.debian.org/debian/project/

skip-clean http://ftp.fi.debian.org/debian-non-US/project/

Ubuntu Edgy Eft中的默认文件如下:

引用:

############# 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 nthreads 20

set tilde 0

#

############# end config ##############

deb http://archive.ubuntu.com/ubuntu edgy main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu edgy-updates main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu edgy-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu edgy-security main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu edgy-proposed main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu edgy main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu edgy-updates main restricted universe multiverse

#deb-src http://archive.ubuntu.com/ubuntu edgy-backports main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu edgy-security main restricted universe multiverse

#deb-src http://archive.ubuntu.com/ubuntu edgy-proposed main restricted universe multiverse

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

如果你对比/etc/apt/sources.list 和/etc/apt/mirror.list,你会发现两者非常相似,二者都列举了一些应当被镜像的软件库,另外还有一些其他选项。

现在我修改/etc/apt/mirror.list.就象我前面说过的一样,我要镜像Debian Sarge的main,contrib 和non-free部分和 Ubuntu Edgy Eft的 main, restricted, universe部分

,不镜像应该直接从互联网上下载的安全部分。另外,我也没有镜像源代码包,因为95%的安装文件不需要源代码,而源代码包文件又会占据巨大的硬盘空间。所以我的/etc/apt/mirror.list 修改成下面的样子:

代码:

vi /etc/apt/mirror.list

引用:

# apt-mirror configuration file

##

## The default configuration options (uncomment and change to override)

##

#

# 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 defaultarch

# set nthreads 20

#

##

## Example sources

##

# sarge’s section

deb http://ftp.de.debian.org/debian sarge main contrib non-free

# Ubuntu Edgy Eft

deb http://de.archive.ubuntu.com/ubuntu/ edgy main restricted universe

##

## Cleaner configuration example

##

#

# set cleanscript $var_path/clean.sh

#

# Cleaning section

clean http://ftp.de.debian.org/

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

请注意我用ftp.de.debian.org 代替了ftp.fi.debian.org ,用 de.archive.ubuntu.com代替了

archive.ubuntu.com. 你应该选择一个距离你比较近的镜像,所以如果你在美国,就用us替代de。

最后的cleaning部分告诉apt-mirror本地的硬盘应该和哪个软件仓库对比以确定哪些文件可以自动清除掉。我要检查Debian 和Ubuntu全部的软件,所以我修改成了,

clean http://ftp.de.debian.org/

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

如果你使用了其他的 Debian/Ubuntu版本,请用etch或者sid替换sarge;breezy或者dapper替换edgy。

5创建本地软件仓库

现在apt-mirror已经配置好了,现在应该第一次运行它,下载所有的包构建本地的Debian/Ubuntu软件仓库。我们只需要执行:

[code]

su – apt-mirror -c apt-mirror

[/eode]

apt-mirror会告诉你到底要下载多少GB的文件。这将会花上几个小时,所以要耐心点。这些包将会存储在/var/spool/apt-mirror/mirror的子目录中,所以你要保证该分区还有足够的硬盘空间。

debian的在/var/spool/apt-mirror/mirror/ftp.de.debian.org/debian,

unbuntu的在/var/spool/apt-mirror/mirror/de.archive.ubuntu.com/ubuntu.

如果你在第四步选择了一个不同的镜像,那么这个路径或许有些不同。

6清理软件仓库

等到apt-mirror下载完了所有的包,它非常可能会告诉你可以清除出一些硬盘空间来,使用以下脚本:

/bin/bash /var/spool/apt-mirror/var/clean.sh

输出如下:

server1:~# /bin/bash /var/spool/apt-mirror/var/clean.sh

Removing 157 unnecessary files [13316096 bytes]…

[0%]…………….done.

Removing 18 unnecessary directories…

[0%]………………done.

这样你就能看到有多少硬盘空间被清理出来了。

7 更新本地软件仓库

更新本地镜像是非常简单的,执行

[code]su – apt-mirror -c apt-mirror [/code]

如果你不想手工执行更新,那么你可以编写一个定时执行的corn任务。只需要编辑/etc/corn.d/apt-mirror,在最后一行添加如下即可:

[code]vi /etc/cron.d/apt-mirror [/code]

引用:

#

# Regular cron jobs for the apt-mirror package

#

0 4 * * * apt-mirror /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log

8 通过http访问镜像

Apache默认的根目录是/var/www,但是软件仓库却在/var/spool/apt-mirror/mirror

为了能够通过 http://192.168.0.100/debian and http://192.168.0.100/ubuntu

访问到相应的软件库,我们可以symlinks /var/www/debian and /var/www/ubuntu到真正的库地址。

[code]ln -s /var/spool/apt-mirror/mirror/ftp.de.debian.org/debian /var/www/debian

ln -s /var/spool/apt-mirror/mirror/de.archive.ubuntu.com/ubuntu /var/www/ubuntu[/code]

如果你使用了其他镜像,记得调整这两行命令。

接下来要考虑的一件事情是,你认为DebianSarge是sarge而且是稳定的e(至少目前是稳定的,而Etch仍旧在测试中),那么当你运行

[code]ls -l /var/spool/apt-mirror/mirror/ftp.de.debian.org/debian/dists [/code]

你会发现那里有一个sarge的目录,但却是不稳定的,但是如果你在source.list中用稳定的替换了 sarge,或者在本地全新安装一个debian系统,这样就会出现这样的问题debian sarge的安装工具仍旧会认为stable替换sarge。解决办法是

[code]cd /var/spool/apt-mirror/mirror/ftp.de.debian.org/debian/dists

ln -s sarge/ stable[/code]

当debian Etch变成稳定版本的时候你也可以镜像Etch。到时候不要忘了修改stable的symlink。

[code]cd /var/spool/apt-mirror/mirror/ftp.de.debian.org/debian/dists

rm -f stable

ln -s etch/ stable [/code]

这个问题不会出现在ubuntu中。

9 配置你的客户端电脑使用本地镜像

现在本地镜像已经可以使用了,我们所要做得是告诉 Debian Sarge和Ubuntu Edgy Eft 系统如何使用本地镜像。

Debian Sarge系统,在source。list中修改main,contrib,non-free的软件仓库

vi /etc/apt/sources.list

[…]

deb http://192.168.0.100/debian sarge main contrib non-free

[…]

Instead of sarge you could also use stable:

[…]

deb http://192.168.0.100/debian stable main contrib non-free

[…]

然后运行:

apt-get update

在 Ubuntu Edgy Eft系统中,你可以在sources.list中更换 main restricted universe的软件仓库。

vi /etc/apt/sources.list

[…]

deb http://192.168.0.100/ubuntu/ edgy main restricted universe

[…]

然后运行:

apt-get update

9.3 全新安装系统

如果你从本地镜像全新安装一个 Debian Sarge 或者 Ubuntu Edgy Eft那么你可以按照以下步骤进行:

10相关链接

* apt-mirror: http://apt-mirror.sourceforge.net

* Debian: http://www.debian.org

* Ubuntu: http://www.ubuntu.com

============================================================================================

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

[plain]

############# 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的):

[plain]

############ 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 ##############

#precise 64bit Mirror

deb-amd64 http://mirrors.ustc.edu.cn/ubuntu precise main restricted universe multiverse

deb-amd64 http://mirrors.ustc.edu.cn/ubuntu precise-security main restricted universe multiverse

deb-amd64 http://mirrors.ustc.edu.cn/ubuntu precise-updates main restricted universe multiverse

deb-amd64 http://mirrors.ustc.edu.cn/ubuntu precise-proposed main restricted universe multiverse

deb-amd64 http://mirrors.ustc.edu.cn/ubuntu precise-backports main restricted universe multiverse

#precise 32bit Mirror

deb-i386 http://mirrors.ustc.edu.cn/ubuntu precise main restricted universe multiverse

deb-i386 http://mirrors.ustc.edu.cn/ubuntu precise-security main restricted universe multiverse

deb-i386 http://mirrors.ustc.edu.cn/ubuntu precise-updates main restricted universe multiverse

deb-i386 http://mirrors.ustc.edu.cn/ubuntu precise-proposed main restricted universe multiverse

deb-i386 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命令开始同步源即可。

[plain]

$ 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.”这样的错误,折腾了我一个下午。原因不怎么清楚,不过,貌似按照上面我的流程做,至少可以避免这个错误。具体原因,难道和我配置文件中没去掉注释有关系,总之,稍诡异。

最后完成后的输出如下:

[plain]

$ 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]…   [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 18:12:35 2013

0.0 bytes in 0 files and 0 directories can be freed.

Run /var/spool/apt-mirror/var/clean.sh for this purpose.

Running the Post Mirror script …

(/var/spool/apt-mirror/var/postmirror.sh)

Post Mirror script has completed. See above output for any possible errors.

2、apache2

2.1 安装

sudo apt-get install apache2

2.2 配置

apache2的配置,这里就不班门弄斧了。反正我是直接在网上搜的帖子,方法很简单。

[plain]

(1) 进入/var/www目录

cd /var/www

(2) 创建一个指向apt-mirror的mirror存放路径的软链接,这里命名为ubuntu

$ ln -s /var/spool/apt-mirror/mirror/mirrors.ustc.edu.cn/ubuntu ubuntu

到这里,就可以在浏览器地址栏输入“202.xxx.xxx.xxx/ubuntu”来访问该源目录了。

3、使用源

为了使用该源之需要修改/etc/apt/source.list文件:

[plain]

比如原来用的是ustc的源,source.list文件如下:

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

现在想改成,我们刚刚搭建好的源,只需在vim中用一个命令”:%s/mirrors.ustc.edu.cn/202.xxx.xxx.xxx/g”,即可将source.list修改为如下:

deb http://202.xxx.xxx.xxx/ubuntu/ precise main restricted universe multiverse

deb http://202.xxx.xxx.xxx/ubuntu/ precise-security main restricted universe multiverse

deb http://202.xxx.xxx.xxx/ubuntu/ precise-updates main restricted universe multiverse

deb http://202.xxx.xxx.xxx/ubuntu/ precise-proposed main restricted universe multiverse

deb http://202.xxx.xxx.xxx/ubuntu/ precise-backports main restricted universe multiverse

deb-src http://202.xxx.xxx.xxx/ubuntu/ precise main restricted universe multiverse

deb-src http://202.xxx.xxx.xxx/ubuntu/ precise-security main restricted universe multiverse

deb-src http://202.xxx.xxx.xxx/ubuntu/ precise-updates main restricted universe multiverse

deb-src http://202.xxx.xxx.xxx/ubuntu/ precise-proposed main restricted universe multiverse

deb-src http://202.xxx.xxx.xxx/ubuntu/ precise-backports main restricted universe multiverse

然后,sudo apt-get update就可以看到,我们搭建的似有源的确已经生效了,速度飞快

==========================================================================================

1:加下面的行到/etc/apt/sources.list

deb http://apt-mirror.sourceforge.net/ apt-mirror/

2:apt-get update

3:apt-get install apt-mirror

4:根据需要修改/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 nthreads 20

set _tilde 0

#

############# end config ##############

deb http://debian.cn99.com/debian/ etch main contrib non-free

deb-src http://debian.cn99.com/debian/ etch main contrib non-free

deb http://security.debian.org/ etch/updates main contrib non-free

deb-src http://security.debian.org/ etch/updates main contrib non-free

#deb http://archive.Ubuntu.com/ubuntu hardy main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse

##deb http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse

##deb http://archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

#

#deb-src http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse

#deb-src http://archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse

##deb-src http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse

#deb-src http://archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse

##deb-src http://archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

clean http://debian.cn99.com/debian/

#

# deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ – Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main

5:获得源信息

su apt-mirror -c apt-mirror

可能会报错:

jumping:~# su apt-mirror -c apt-mirror

Downloading 30 index files using 20 threads…

Begin time: Fri Aug 29 11:38:38 2008

[20]… [19]… [18]… [17]… [16]… [15]… [14]… [13]… [12]… [11]… [10]… [9]… [8]… [7]… [6]… [5]… [4]… [3]… [2]… [1]… [0]…

End time: Fri Aug 29 11:40:49 2008

Proceed indexes: [Ssh: debian.cn99.com/debian///dists/etch/main/source/Sources.gz: No such file or directory

apt-mirror: can’t open index in proceed_index_gz at /usr/bin/apt-mirror line 382.

到/var/spool/apt-mirror/skel/debian.cn99.com/debian/dists/etch/main/source/目录下去看看有没有Sources.gz。没有的话,再执行一遍

su apt-mirror -c apt-mirror

直到有为止。

正确的输出应该是:

jumping:# su apt-mirror -c apt-mirror

Downloading 30 index files using 20 threads…

Begin time: Fri Aug 29 11:53:32 2008

[20]… [19]… [18]… [17]… [16]… [15]… [14]… [13]… [12]… [11]… [10]… [9]… [8]… [7]… [6]… [5]… [4]… [3]… [2]… [1]… [0]…

End time: Fri Aug 29 11:54:27 2008

Proceed indexes: [SSPP]

30.1 GiB will be downloaded into archive.

Downloading 51528 archive files using 20 threads…

Begin time: Fri Aug 29 11:54:33 2008

[20]…

6:部署apache,提供给其他用户使用该源(参考网上的文章)

=======================================================================================

Creating an Ubuntu repository mirror with apt-mirror

By ADMIN | Published: Tweet

This entry was posted in Advocacy, Linux, Ubuntu. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

« Ad-Hoc Palm TX Hotsync to Linux

The bullying from Microsoft begins – again»

17 Comments
  1. 使用apt-mirror建立本地debian仓库源Anonymous

    Posted May 4, 2009 at 1:22 am | Permalink

    I keep getting the following error:

    apt-mirror: can’t utime /var/spool/apt-mirror/mirror/mirrors.kernel.org/ubuntu/dists/jaunty/Release at /usr/bin/apt-mirror line 494.

    I have searched everywhere and have not been able to find what utime?

    Reply

  2. 使用apt-mirror建立本地debian仓库源Sayali

    Posted March 12, 2009 at 3:19 pm | Permalink

    Is it possible to restrict the list of packages to be mirrored locally?

    If yes, could someone please help me in finding how I can specify only a certain set of .deb files to be mirrored locally? E.g. if I know for sure that I need the packages from files: x.deb, y.deb and z.deb only, then what should be my mirror.list file?

    Thanks in advance for all the help.

    –Sayali

    Reply

  3. 使用apt-mirror建立本地debian仓库源Edgar Vega

    Posted June 21, 2009 at 11:00 pm | Permalink

    Hi!

    Thanks for this tutorial… its really great, I am taking advantage of this information…! Wonderfull!!!

    Reply

  4. 使用apt-mirror建立本地debian仓库源Maxx44

    Posted October 23, 2009 at 12:20 pm | Permalink

    And, if we have a 50 year mission, all of Mozilla needs to be looking over the horizon in this way. ,

    Reply

    More from author

  5. 使用apt-mirror建立本地debian仓库源tewogbade

    Posted November 12, 2010 at 4:53 pm | Permalink

    thanks, this was very helpful
    really love it

    but i want to ask what happens when the distribution changes does i mean that my local repository is now outdated and i will have to make another mirror of the new distro repo

    Reply

    More from author

  6. 使用apt-mirror建立本地debian仓库源Michael

    Posted May 11, 2012 at 6:59 pm | Permalink

    One obvious but oft overlooked possibility that had me confused for an age is the number of concurrent connections permitted by the site you are trying to mirror from.

    I had to reduce the number of threads in mirror.list to 5 (the max allowed by my source site) before I was successful

    Reply

  7. 使用apt-mirror建立本地debian仓库源Tony Whitmore

    Posted April 21, 2007 at 2:59 pm | Permalink

    What apt-mirror actually does is only download packages for the architecture on which it is running. At least, that’s the default behaviour. So if the computer running apt-mirror is an i386 machine, then you won’t get PPC or AMD64 packages, nor any other architecture. People using this software to mirror Debian servers are probably quite grateful for this, but sadly there’s not a lot of documentation for apt-mirror.

    It seems you can specify a default architecture to mirror on the “set defaultarch” line. That’s useful if you want to mirror one arch on a server of a different arch. If you want to mirror multiple archs you have to specify lines for each in the config file, for example:

    deb-i386 http://gb.archive.ubuntu.com/ubuntu feisty main restricted universe multiverse

    deb-amd64 http://gb.archive.ubuntu.com/ubuntu feisty main restricted universe multiverse

    Reply

    More from author

  8. 使用apt-mirror建立本地debian仓库源Icarus

    Posted December 5, 2007 at 12:56 pm | Permalink

    Very useful !! Thanks a lot for your comment !!

    Reply

  9. 使用apt-mirror建立本地debian仓库源Manena

    Posted February 7, 2007 at 8:39 am | Permalink

    Thank you for this very nice tutorial. Can you please be so kind and tell how to download only packages for i386?

    Reply

  10. 使用apt-mirror建立本地debian仓库源serverchef

    Posted April 1, 2007 at 12:02 am | Permalink

    just replace every deb line with deb-i386

    for example:

    deb http://gb.archive.ubuntu.com/ubuntu edgy main restricted universe multiverse

    becomes

    deb-i386 http://gb.archive.ubuntu.com/ubuntu edgy main restricted universe multiverse

    good luck !

    Reply

  11. 使用apt-mirror建立本地debian仓库源Tony Whitmore

    Posted April 19, 2007 at 10:46 pm | Permalink

    This page shows how to finish the configuration off – setting up Apache to server the repositories via HTTP. HOWTO Forge Local Debian and Ubuntu Mirror.

    Reply

    More from author

  12. 使用apt-mirror建立本地debian仓库源John

    Posted June 15, 2008 at 5:26 pm | Permalink

    I used the above procedure to mirror the i386 ubuntu repo. I can use it to update and install new software on existing systems (after source.list has been modified) that’s no problem. What’s frustrating, is that I CANNOT use the local mirror to install a NEW ubuntu install using the net installer CD!!! It complains that the Release file is not valid! When I browse the local repo I can see the Release file (but it obviously contains info for other architectures). Is there a way to regenerate the local Release file so that it is “proper” by means of a script? so that it doesn’t refer to packages for architectures that are not present? Would really appreciate any help – as that’s why I wanted to set up a local mirror in the first place – to be able to install multiple systems from the local LAN. Thanks.

    Reply

    More from author

  13. 使用apt-mirror建立本地debian仓库源Anonymous

    Posted October 8, 2007 at 9:56 pm | Permalink

    When I run sudo apt-mirror -d, I get the following.

    Downloading 21 index files using 20 threads…

    Begin time: Mon Oct 8 12:38:01 2007

    [20]… [19]… [18]… [17]… [16]… [15]… [14]… [13]… [12]… [11]… [10]… [9]… [8]… [7]… [6]… [5]… [4]… [3]… [2]… [1]… [0]…

    End time: Mon Oct 8 12:42:03 2007

    Proceed indexes: [Psh: cannot open us.archive.ubuntu.com/ubuntu//dists/feisty/main/binary-i386/Packages.gz: No such file

    apt-mirror: can’t open index in proceed_index_gz at /usr/bin/apt-mirror line 368.

    Any ideas on whats wrong.

    Reply

    Leave a Reply Cancel reply
  14. 使用apt-mirror建立本地debian仓库源Angus

    Posted November 5, 2008 at 12:49 pm | Permalink

    In your /etc/apt/mirror.list file you put a / at the end of us.archive.ubuntu.com/ubuntu .

    Don’t, and it’s fine.

    Reply

  15. 使用apt-mirror建立本地debian仓库源Allan

    Posted July 19, 2007 at 4:46 am | Permalink

    I was able to netboot and install from a local mirror thanks to this resource and a few others. However, when netbooting, additional mirror sets are required. I posted some information about this on the Ubuntu wiki:

    Reply

  16. 使用apt-mirror建立本地debian仓库源gaZooGA

    Posted November 17, 2008 at 12:09 pm | Permalink

    You must un comment the line below from your /etc/apt/mirror.list config for it to work, or else everything will download to /var/spool/apt-mirror as opposed to /media/usbdisk/repo.

    set mirror_path $base_path/mirror

    set skel_path $base_path/skel

    set var_path $base_path/var

    set cleanscript $var_path/clean.sh

    Reply

  17. 使用apt-mirror建立本地debian仓库源Wayne

    Posted December 30, 2008 at 6:59 pm | Permalink

    I am having trouble with installing new updates that have been downloaded to my local repository with apt-mirror. I have downloaded both deb-i386 and deb-amd64 to a local repository in hopes of supporting multiple machines on my home network. However, after weeks of downloading updates, my update manager does not find any updates to install. I am using this format in my sources.list file:

    deb file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu hardy main restricted universe multiverse

    deb-src file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu hardy main restricted universe multiverse

    deb file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse

    deb file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse

    I have verified that apt-mirror is working and downloading files.

    Any suggestions about what is wrong with my configuration?

    Thanks.

    Reply

===================================================================================

Debian apt Source mirror using apt-mirror

apt-mirror is a small tool that provides ability to mirror any parts (or even all) of Debian GNU/Linux distribution or any other apt sources which often provided by many debian developers.

If you want to download apt-mirror click here

Installing apt-mirror in Debian

add to ‘sources.list’ line i.e /etc/apt/sources.list file

deb http://apt-mirror.sourceforge.net/ apt-mirror/ and run

# apt-get update

# apt-get install apt-mirror

Configuring sources for apt-mirror

Open ‘mirror.list’ (from /etc/apt/ or whatever you installed it to) and add needed sources like in /etc/apt/sources.list. Finally your mirror.list may looks like this:

# apt-mirror configuration file

##

## The default configuration options (uncomment and change to override)

##

#

# 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 defaultarch

# set nthreads 20

#

##

## Example sources

##

# sarge’s section

deb http://ftp.us.debian.org/debian sarge main contrib non-free

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

# this source required for network installation ability (udebs)

deb http://ftp.us.debian.org/debian sarge main/debian-installer

# security updates is always good thing to install

deb http://security.debian.org/debian-security sarge/updates main contrib non-free

deb-src http://security.debian.org/debian-security sarge/updates main contrib non-free

# sarge-proposed-updates’s section

deb http://ftp.us.debian.org/debian sarge-proposed-updates main contrib non-free

deb-src http://ftp.us.debian.org/debian sarge-proposed-updates main contrib non-free

##

## Cleaner configuration example

##

#

# set cleanscript $var_path/clean.sh

#

# What directories should we clean up

# (i.e. remove files missing in up-to-date indexes)

clean http://security.debian.org/

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

# But exclude this directories

# (which is not managed by apt and apt-mirror)

skip-clean http://ftp.us.debian.org/debian-cd/

skip-clean http://ftp.us.debian.org/debian/dists/sarge/main/installer-i386/

skip-clean http://ftp.us.debian.org/debian/doc/

skip-clean http://ftp.us.debian.org/debian/tools/

skip-clean http://ftp.us.debian.org/debian/project/

Running apt-mirror

Now we may run ‘apt-mirror’

# su — apt-mirror -c apt-mirror

You also can run apt-mirror from cron. Uncomment line in /etc/cron.d/apt-mirror for this purpose.

<!–
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
–>

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,912
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,437
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,252
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,063
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,694
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,732