創建本地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 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了。同步