创建本地Ubuntu软件源镜像

创建本地Ubuntu软件源镜像apache

1)、安装apt-mirror sudo apt-get install apt-mirror 2)、修改mirror.list 若是什么都不加,直接使用deb http.....这种格式,则在同步时,只同步当前系统所使用的架构下的软件包。好比一个64位系统,直接deb http....只同步64位的软件包。若是还嫌麻烦,直接去改set defaultarch <running host architecture>这个参数就好,好比改为set defaultarch i386,这样你使用deb http.....这种格式,则在同步时,只同步i386的软件包了。ubuntu

sudo gedit /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 privileges

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 nthreads 3 [下载进程,默认20,建议3] set _tilde 0架构

############# end config ############## #注意这里的jaunty代码版本号, jaunty表明9.04版本,请根据须要版本自行更改 deb http://archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse [须要进行镜像的APT软件源地址,选择速度较快的官方源或国内源]rest

#deb-src http://archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-security main restricted universe multiverse #deb-src http://archive.ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse [不须要源代码,用#进行地址屏蔽]进程

clean http://archive.ubuntu.com/ubuntu [镜像完成后对本地镜像和软件源进行比较] ——————————————引用结束—————————————————— 3)、修改完成后开始镜像 sudo apt-mirror 4)、完成镜像后进行清理多余文件 sudo /var/spool/apt-mirror/var/clean.sh 5)、修改sources.list将升级地址修改成本地镜像 sudo gedit /etc/apt/sources.list 文件内容修改按以下步骤进行: A:只供本机使用,不须要提供给所在网络的其余人使用。 Sources.list文件将源地址修改成: deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/jaunty main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-backports restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-proposed main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse deb-src file:///var/spool/apt-mirror/mirror/archive.ubuntu.org.cn/ubuntu-cn/ jaunty main restricted universe multiverse 注意:若是报错找不到i386之类的目录,能够设置deb-src为只寻找64bit系统的源ip

B:除了本身使用外,还要提供网络里的其余用户进行更新。 第一步,安装Apache2 sudo apt-get install apache2 第二步,创建符号链接,将镜像与Apache虚拟目录联系起来 sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ /var/www/ubuntu sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.org.cn/ubuntu-cn /var/www/ubuntu-cn 第三步,修改sources.list文件 deb-src http://192.168.0.10/ubuntu jaunty main restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-backports restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-proposed main restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-security main restricted universe multiverse deb-src http://192.168.0.10/ubuntu jaunty-updates main restricted universe multiverseget

大功告成!!!终于OVER了。同步

相关文章
相关标签/搜索