linux apt get 镜像,快速搭建本地Ubuntu APT源镜像 ? Hey! Linux.

Ubuntu 10.10 已经被抛弃了!

就是在昨天,Ubuntu的官方站点security.ubuntu.com和archive.ubuntu.com下都已经没有了maverick相关的目录,执行apt-get install直接提示"404 Not Found"。

与此同时,国内的诸多门户网站与大学的镜像也在今天同步了,也没有了maverick相关的目录。

个人感觉这真的很坑啊,就算不支持了,也不至于移走吧?这让我们这些还在使用Ubuntu 10.10作为线上服务器的屌丝运维情何以堪。

与此同时非常后悔自己当初没有搭建一个本地的APT源镜像,于是,努力搜寻着那些可能还未更新的镜像。

终于,找到了mirror.lupaworld.com,目前该社区的10.10的镜像还完整的保存着,在微博上进行了感谢之余便赶快搭建一个本地的APT源镜像,这样才是最有保障的!

最后,花费10个小时左右,占用了本地约100G硬盘空间,成功的完成了本地Ubuntu 10.10源镜像搭建。

在此,将相关步骤分享给大家。

将本地的源镜像修改为mirror.lupaworld.com

$ sudo sed -i s/security.ubuntu.com/mirror.lupaworld.com/g /etc/apt/sources.list

$ sudo sed -i s/archive.ubuntu.com/mirror.lupaworld.com/g /etc/apt/sources.list

更新源

$ sudo apt-get update

安装apt-mirror

$ sudo apt-get install apt-mirror

安装apache2,用于提供源的HTTP服务

$ sudo vim apt-get install apache2

编辑mirror.list(我的服务器默认都是64位的,因此需要用deb-i386与deb-i386-src指定镜像同步32位的软件包)

$ sudo vim /etc/apt/mirror.list

01############# config ##################

02#

03# set base_path    /var/spool/apt-mirror

04#

05# set mirror_path  $base_path/mirror

06# set skel_path    $base_path/skel

07# set var_path     $base_path/var

08# set cleanscript $var_path/clean.sh

09# set defaultarch 

10# set postmirror_script $var_path/postmirror.sh

11# set run_postmirror 0

12set nthreads     20

13set _tilde 0

14#

15############# end config ##############

16

17deb http://mirror.lupaworld.com/ubuntu maverick main restricted universe multiverse

18deb http://mirror.lupaworld.com/ubuntu maverick-security main restricted universe multiverse

19deb http://mirror.lupaworld.com/ubuntu maverick-updates main restricted universe multiverse

20

21deb-src http://mirror.lupaworld.com/ubuntu maverick main restricted universe multiverse

22deb-src http://mirror.lupaworld.com/ubuntu maverick-security main restricted universe multiverse

23deb-src http://mirror.lupaworld.com/ubuntu maverick-updates main restricted universe multiverse

24

25deb-i386 http://mirror.lupaworld.com/ubuntu maverick main restricted universe multiverse

26deb-i386 http://mirror.lupaworld.com/ubuntu maverick-security main restricted universe multiverse

27deb-i386 http://mirror.lupaworld.com/ubuntu maverick-updates main restricted universe multiverse

28

29deb-i386-src http://mirror.lupaworld.com/ubuntu maverick main restricted universe multiverse

30deb-i386-src http://mirror.lupaworld.com/ubuntu maverick-security main restricted universe multiverse

31deb-i386-src http://mirror.lupaworld.com/ubuntu maverick-updates main restricted universe multiverse

32

然后新建一个screen终端(个人习惯),用于后台运行镜像同步

$ screen -dmS apt-mirror

$ screen -r apt-mirror

$ sudo apt-mirror

然后会显示如下信息:

01Downloading 126 index files using 20 threads...

02Begintime: Sat Dec 22 17:38:07 2012

03[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]...

04Endtime: Sat Dec 22 17:38:26 2012

05

06Proceed indexes: [SSSPPPPPPPPP]

07

0891 GiB will be downloaded into archive.

09Downloading 20507 archive files using 20 threads...

10Begintime: Sat Dec 22 17:38:55 2012

11[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]...

按下Ctrl+AD将终端挂起,作为后台运行

在等待约10个小时以后(取决于你的本地网络速度)

$ screen -r apt-mirror

完成镜像同步后可以看到如下信息:

01...

02Endtime: Sat Dec 22 17:20:11 2012

03

040.0 bytesin 0 files and 0 directories can be freed.

05Run /var/spool/apt-mirror/var/clean.shfor this purpose.

06

07Running the Post Mirror script ...

08(/var/spool/apt-mirror/var/postmirror.sh)

09

10

11Post Mirror script has completed. See above outputfor any possible errors.

则表明镜像同步已经成功完成

接下来启动apache2

$ sudo apt-get install apache2

将镜像目录链接到apache2的根目录下

$ sudo ln -s /var/spool/apt-mirror/mirror/mirror.lupaworld.com/ubuntu ubuntu

创建之后,就可以在其它的服务器上修改APT源地址为该服务器的IP,如"10.6.1.100",然后使用本地镜像服务了。

$ sudo sed -i s/security.ubuntu.com/10.6.1.100/g /etc/apt/sources.list

$ sudo sed -i s/archive.ubuntu.com/10.6.1.100/g /etc/apt/sources.list

$ sudo apt-get update

01Get:1 http://10.6.1.100 maverick Release.gpg [198B]

02Ign http://10.6.1.100/ubuntu/ maverick/main Translation-en

03Ign http://10.6.1.100/ubuntu/ maverick/main Translation-en_US

04Ign http://10.6.1.100/ubuntu/ maverick/multiverse Translation-en

05Ign http://10.6.1.100/ubuntu/ maverick/multiverse Translation-en_US

06Ign http://10.6.1.100/ubuntu/ maverick/restricted Translation-en

07Ign http://10.6.1.100/ubuntu/ maverick/restricted Translation-en_US

08Ign http://10.6.1.100/ubuntu/ maverick/universe Translation-en

09Ign http://10.6.1.100/ubuntu/ maverick/universe Translation-en_US

10Get:2 http://10.6.1.100 maverick-updates Release.gpg [198B]

11Ign http://10.6.1.100/ubuntu/ maverick-updates/main Translation-en

12Ign http://10.6.1.100/ubuntu/ maverick-updates/main Translation-en_US

13Ign http://10.6.1.100/ubuntu/ maverick-updates/multiverse Translation-en

14Ign http://10.6.1.100/ubuntu/ maverick-updates/multiverse Translation-en_US

15Ign http://10.6.1.100/ubuntu/ maverick-updates/restricted Translation-en

16Ign http://10.6.1.100/ubuntu/ maverick-updates/restricted Translation-en_US

17Ign http://10.6.1.100/ubuntu/ maverick-updates/universe Translation-en

18Ign http://10.6.1.100/ubuntu/ maverick-updates/universe Translation-en_US

19Get:3 http://10.6.1.100 maverick-security Release.gpg [198B]

20Ign http://10.6.1.100/ubuntu/ maverick-security/main Translation-en

21Ign http://10.6.1.100/ubuntu/ maverick-security/main Translation-en_US

22Ign http://10.6.1.100/ubuntu/ maverick-security/multiverse Translation-en

23Ign http://10.6.1.100/ubuntu/ maverick-security/multiverse Translation-en_US

24Ign http://10.6.1.100/ubuntu/ maverick-security/restricted Translation-en

25Ign http://10.6.1.100/ubuntu/ maverick-security/restricted Translation-en_US

26Ign http://10.6.1.100/ubuntu/ maverick-security/universe Translation-en

27Ign http://10.6.1.100/ubuntu/ maverick-security/universe Translation-en_US

28Get:4 http://10.6.1.100 maverick Release [39.8kB]

29Get:5 http://10.6.1.100 maverick-updates Release [39.8kB]

30Get:6 http://10.6.1.100 maverick-security Release [39.8kB]

31Get:7 http://10.6.1.100 maverick/main Sources [829kB]

32Get:8 http://10.6.1.100 maverick/restricted Sources [4,370B]

33Get:9 http://10.6.1.100 maverick/universe Sources [4,179kB]

34Get:10 http://10.6.1.100 maverick/multiverse Sources [151kB]

35Get:11 http://10.6.1.100 maverick/main amd64 Packages [1,491kB]

36Get:12 http://10.6.1.100 maverick/restricted amd64 Packages [6,002B]

37Get:13 http://10.6.1.100 maverick/universe amd64 Packages [5,771kB]

38Get:14 http://10.6.1.100 maverick/multiverse amd64 Packages [180kB]

39Get:15 http://10.6.1.100 maverick-updates/main Sources [179kB]

40Get:16 http://10.6.1.100 maverick-updates/restricted Sources [778B]

41Get:17 http://10.6.1.100 maverick-updates/universe Sources [65.2kB]

42Get:18 http://10.6.1.100 maverick-updates/multiverse Sources [2,513B]

43Get:19 http://10.6.1.100 maverick-updates/main amd64 Packages [466kB]

44Get:20 http://10.6.1.100 maverick-updates/restricted amd64 Packages [1,802B]

45Get:21 http://10.6.1.100 maverick-updates/universe amd64 Packages [202kB]

46Get:22 http://10.6.1.100 maverick-updates/multiverse amd64 Packages [5,462B]

47Get:23 http://10.6.1.100 maverick-security/main Sources [106kB]

48Get:24 http://10.6.1.100 maverick-security/restricted Sources [14B]

49Get:25 http://10.6.1.100 maverick-security/universe Sources [34.2kB]

50Get:26 http://10.6.1.100 maverick-security/multiverse Sources [1,761B]

51Get:27 http://10.6.1.100 maverick-security/main amd64 Packages [330kB]

52Get:28 http://10.6.1.100 maverick-security/restricted amd64 Packages [14B]

53Get:29 http://10.6.1.100 maverick-security/universe amd64 Packages [116kB]

54Get:30 http://10.6.1.100 maverick-security/multiverse amd64 Packages [4,045B]

55Fetched 14.2MBin 1min 15s (190kB/s)

56Reading package lists... Done

测试安装一个软件,如zip

$ sudo apt-get install zip

01Reading package lists... Done

02Building dependency tree

03Reading state information... Done

04The following extra packages will be installed:

05unzip

06The following NEW packages will be installed:

07unzip zip

080 upgraded, 2 newly installed, 0 to remove and 91 not upgraded.

09Need to get 524kB of archives.

10After this operation, 1,081kB of additional disk space will be used.

11Do you want tocontinue [Y/n]? Y

12Get:1 http://10.6.1.100/ubuntu/ maverick/main unzip amd64 6.0-4 [190kB]

13Get:2 http://10.6.1.100/ubuntu/ maverick/main zip amd64 3.0-3 [334kB]

14Fetched 524kBin 2s (191kB/s)

15Selecting previously deselected package unzip.

16(Reading database ... 59554 files and directories currently installed.)

17Unpacking unzip (from .../archives/unzip_6.0-4_amd64.deb) ...

18Selecting previously deselected package zip.

19Unpacking zip (from .../archives/zip_3.0-3_amd64.deb) ...

20Processing triggersfor man-db ...

21Setting up unzip (6.0-4) ...

22Setting up zip (3.0-3) ...

成功安装了zip,本地源镜像搭建成功。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值