给自己的企业建立本地ubuntu(2)

#我们把常用的软件同步过来就够用了
deb-i386 Ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-i386 hardy-updates main restricted universe multiverse
deb-i386 hardy-backports main restricted universe multiverse
deb-i386 hardy-security main restricted universe multiverse
deb-i386 hardy-proposed main restricted universe multiverse

#当某些软件包在服务器端进行了升级,或者服务器端不再需要这些软件包时,我们使用了apt-mirror与服务器同步后,会在本地的$var_path/下生成一个clean.sh的脚本,列出了遗留在本地的旧版本和无用的软件包,你可以手动运行这个脚本来删除遗留在本地的且不需要用的软件包
clean

-----------------------------------------------------------------------------

如果用amd64位架构下的包,可以加上deb-amd64的标记
如果什么都不加,直接使用deb http.....这种格式,则在同步时,只同步当前系统所使用的架构下的软件包。比如一个64位系统,直接debhttp....只同步64位的软件包。如果还嫌麻烦,直接去改set defaultarch   <running hostarchitecture>这个参数就好,比如改成set defaultarch i386,这样你使用debhttp.....这种格式,则在同步时,只同步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:
apt-get install apache2

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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/27564.html