發布時間:2022-07-22 文章來源:xp下載站 瀏覽:
網絡技術是從1990年代中期發展起來的新技術,它把互聯網上分散的資源融為有機整體,實現資源的全面共享和有機協作,使人們能夠透明地使用資源的整體能力并按需獲取信息。資源包括高性能計算機、存儲資源、數據資源、信息資源、知識資源、專家資源、大型數據庫、網絡、傳感器等。 當前的互聯網只限于信息共享,網絡則被認為是互聯網發展的第三階段。 想要在電腦中安裝和搭建本地Ubuntu鏡像服務器,使得在安裝其他的常用工具時能減少時間!那么要怎么的搭建呢!我們一起來看看吧! 一.需求分析 最近公司軟件Team 有個需求是這樣的:能不能在局域網搭建一個Ubuntu 鏡像服務器, 這樣作的好處是可以節省Ubuntu某些常用工具的安裝時間。 二.部署過程 2.1 測試環境 目前在公司內有一臺能連接到外網的Ubuntu機器, IP : 192.168.8.173 , Ubuntu版本為Ubuntu 9.04 i686。 2.2 搭建步驟 為了創建Ubuntu mirror 服務器,最少需要60G硬盤空間,Ubuntu每個版本都有32 bit 和64 bit兩個版本,有兩組deb包。當然可以創建Ubuntu一個版本的32 bit 和64 bit 的 鏡像服務器,也可以創建全部版本的鏡像。 這里使用sohu 公司的mirror地址作為本地Ubuntu Source 服務器,使用sohu的原因是: 1. sohu的Ubuntu Source 服務器速度相當快 2. sohu 的ubuntu Source 服務器每天會和Ubuntu官方服務器同步一次,這樣可以保 證我們使用的是最新的軟件包。 修改方式如下: root@ms ~: cat /etc/apt/sources.list deb jaunty main restricted universe multiverse deb jaunty-security main restricted universe multiverse deb jaunty-updates main restricted universe multiverse deb jaunty-proposed main restricted universe multiverse deb jaunty-backports main restricted universe multiverse deb-src jaunty main restricted universe multiverse deb-src jaunty-security main restricted universe multiverse deb-src jaunty-updates main restricted universe multiverse deb-src jaunty-proposed main restricted universe multiverse deb-src jaunty-backports main restricted universe multiverse 安裝下面工具: root@ms ~: apt-get install apt-mirror root@ms ~: apt-get install apache2 下面就構建Ubuntu 9.04 32bit 的本地Ubuntu mirror 服務器為例子,來說明如何配置: 修改配置文件: root@ms ~: cat /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 # set postmirror_script $var_path/postmirror.sh set run_postmirror 0 set nthreads 20 set _tilde 0 # ############# end config ############## deb-i386 jaunty main restricted universe multiverse deb-i386 jaunty-security main restricted universe multiverse deb-i386 jaunty-updates main restricted universe multiverse #deb jaunty-proposed main restricted universe multiverse #deb jaunty-backports main restricted universe multiverse deb-src jaunty main restricted universe multiverse deb-src jaunty-security main restricted universe multiverse deb-src jaunty-updates main restricted universe multiverse #deb-src jaunty-proposed main restricted universe multiverse #deb-src jaunty-backports main restricted universe multiverse #clean 備注: deb-i386 表示下載32 bit 版本的deb 軟件 deb 表示下載64bit 版本的deb 軟件 jaunty 表示Ubuntu 9.04的代號 設置完成后,輸入下面命令: root@ms ~: apt-mirror 這時系統會啟動20個線程運行wget 到 下面下載相應的 deb包。時間比較的長,該命令執行完成后,/var/spool/apt-mirror目錄下就有了所有需 要的deb包和相應的配置文件。 由于我是從sohu下載的,所以實際的文件在 : /var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu 目錄下。 這樣,本地就有了所有Ubuntu Source 服務器所需要的文件,然后開啟相應的服務: 這里使用apache2作為Web服務器,默認根目錄在/var/www/,所以可以在該目錄下做 個鏈接,如下所示: root@ms ~: cd /var/www root@ms ~: ln /var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu -s 開啟web服務: root@ms ~: apache2ctl start 打開瀏覽器輸入下面地址即可看到和sohu mirror一樣的頁面:
同時也可以使用crontab進行每天的更新,修改配置文件: root@ms ~: cat /etc/cron.d/apt-mirror # # Regular cron jobs for the apt-mirror package # #0 4 * * * apt-mirror /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log 把命令前面的“#”去掉即可,這樣系統會自動使用apt-mirror去和sohu服務器更新。 最后,我們所要做得就是在客戶端的機器上修改更新源配置文件,將地址改成本地 mirror服務器的地址即可,如下所示: root@ms ~: cat /etc/apt/sources.list deb jaunty main restricted universe multiverse deb jaunty-security main restricted universe multiverse deb jaunty-updates main restricted universe multiverse deb jaunty-proposed main restricted universe multiverse deb jaunty-backports main restricted universe multiverse deb-src jaunty main restricted universe multiverse deb-src jaunty-security main restricted universe multiverse deb-src jaunty-updates main restricted universe multiverse deb-src jaunty-proposed main restricted universe multiverse deb-src jaunty-backports main restricted universe multiverse 執行“apt-get update”來重建本地索引,這樣以后就會使用本地的Mirror 服務器進行更新。 小結:以上就是安裝和搭建本地Ubuntu鏡像服務器的具體方法,希望對網友們能有所幫助哦! 網絡的神奇作用吸引著越來越多的用戶加入其中,正因如此,網絡的承受能力也面臨著越來越嚴峻的考驗―從硬件上、軟件上、所用標準上......,各項技術都需要適時應勢,對應發展,這正是網絡迅速走向進步的催化劑。 |
下一篇:WiFi密碼破解圖解