跟自行建置 CentOS YUM Server 一樣,網路上明明就有現成的 APT Server 可以使用,一則是考量到維護的問題,二是頻寬,三是安全性,還是有可能在企業內部的網路,自行建置 APT Server。
先 update 到最新的版本
# apt-get update
安裝同步用的套件 apt-mirror
# apt-get install apt-mirror
編輯設定檔 /etc/apt/mirror.list
# vi /etc/apt/mirror.list
base_path 是打算放套件的目錄,要確定硬碟空間是否足夠,這次同步用掉了 170GB 左右
記得要先手動建立 /deb 目錄
Mirror的位置,就使用預設值
搞定設定檔,就可以第一次同步了
# apt-mirror
剛剛有提過,大約用掉 170GB 的頻寬+硬碟空間,同步了一天多…
安裝 Apache Web Server,給 client 連線使用
# apt-get install apache2
啟動服務
# systemctl start apache2
# systemctl enable apache2
# systemctl status apache2
編輯 Apache 設定檔 /etc/apache2/apache2.conf
# vi /etc/apache2/apache2.conf
確認是否開放 Symbolic link 功能,預設是開放,不需要調整
建立 Symbolic link,指向同步的目錄 /deb
# ln -s /deb/mirror/archive.ubuntu.com/ubuntu /var/www/html/ubuntu
確認一下跟官網內容是否相同?
http://archive.ubuntu.com/ubuntu/ubuntu/
換成用 IP address 瀏覽
修改 APT Server,指向自行建置的 APT Server
# sed -i ‘s/tw\.archive\.ubuntu\.com/172\.20\.0\.103/g’ /etc/apt/sources.list
【未完成,待續…】