ubuntu14 添加本地鏡像源

概述

  說了centos的epel源搭建方式後,在說下ubuntu鏡像源及openstack本地源的搭建。


步驟

 1.安裝apt-mirror

#apt-get install apt-mirror

 2.手動建立/apt/ubuntu目錄,並修改/etc/apt/mirror.list,添加如下內容:

############# config ##################
#
# set base_path    /var/spool/apt-mirror
  set base_path    /apt/ubuntu
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.
# set defaultarch  <running host architecture>
# set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
  set nthreads     20
  set _tilde 0
 deb http://mirrors.163.com/ubuntu/ trusty main restricted
 deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted
 deb http://mirrors.163.com/ubuntu/ trusty universe
 deb http://mirrors.163.com/ubuntu/ trusty-updates universe
 deb http://mirrors.163.com/ubuntu/ trusty multiverse
 deb http://mirrors.163.com/ubuntu/ trusty-updates multiverse
 deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
 deb http://mirrors.163.com/ubuntu/ trusty-security main restricted
 deb http://mirrors.163.com/ubuntu/ trusty-security universe
 deb http://mirrors.163.com/ubuntu/ trusty-security multiverse
 deb http://extras.ubuntu.com/ubuntu trusty main
 clean http://mirrors.163.com/ubuntu/
 
 deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/liberty main

  3.執行apt-mirror ,開始下載和同步軟件包

#apt-miiror

  4.安裝apache,並將本底源掛接到 apache的 WWW根目錄

#apt-miiror
 
 #apt-get install apache2
 
 #cd /var/www/html/
 #ln -s /apt/ubuntu/mirror/mirrors.163.com/ubuntu
 #ln -s /apt/ubuntu/mirror/ubuntu-cloud.archive.canonical.com/ubuntu openstack

      確保能通過http://x.x.x.x/ubuntu 或 http://x.x.x.x/openstack能訪問目錄內容

 5.通過計劃任務定期同步源

#Crontab -e
  0 22 * * * /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log

 6.配置客戶端源,編輯/etc/apt/source.list,刪除其他內容,加入:

deb http://10.0.0.100/ubuntu/ trusty main restricted
 deb http://10.0.0.100/ubuntu/ trusty-updates main restricted
 deb http://10.0.0.100/ubuntu/ trusty universe
 deb http://10.0.0.100/ubuntu/ trusty-updates universe
 deb http://10.0.0.100/ubuntu/ trusty multiverse
 deb http://10.0.0.100/ubuntu/ trusty-updates multiverse
 deb http://10.0.0.100/ubuntu/ trusty-backports main restricted universe multiverse
 deb http://10.0.0.100/ubuntu/ trusty-security main restricted
 deb http://10.0.0.100/ubuntu/ trusty-security universe
 deb http://10.0.0.100/ubuntu/ trusty-security multiverse
 deb http://10.0.0.100/openstack/ trusty-updates/liberty main

     客戶端更新:

#apt-get update


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章