zoukankan      html  css  js  c++  java
  • 40) ubuntu 制作离线镜像源(10.04)

    1- 制作网络源本地镜像

    通过apt-mirror工具,我们可以轻松制作官方源的本地镜像。

    1.1- 安装apt-mirror工具

    sudo apt-get install apt-mirror
    

    1.2- 配置apt-mirror工具

    vi /etc/apt/mirrors.list
    
    清除原有内容,输入以下内容:
    
    set nthreads     20
    set _tilde 0
    #
    ############# end config ##############
    deb http://mirrors.sohu.com/ubuntu/ lucid main universe restricted     multiverse
    deb http://mirrors.sohu.com/ubuntu/ lucid-security universe main multiverse restricted
    deb http://mirrors.sohu.com/ubuntu/ lucid-updates universe main multiverse restricted
    deb http://mirrors.sohu.com/ubuntu/ lucid-proposed universe main multiverse restricted
    deb http://mirrors.sohu.com/ubuntu/ lucid-backports universe main multiverse restricted
    
    clean http://mirrors.sohu.com/ubuntu
    

    这里的地址规则和sources.list中是一样的,使用国内源。

    1.3- 开始制作

    sudo apt-mirror
    
    Downloading 80 index files using 20 threads...
    Begin time: Fri Mar 30 21:47:40 2012
    [20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]...     [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]...     [0]... 
    End time: Fri Mar 30 21:47:57 2012
    
    Proceed indexes: [PPPPP]
    
    44 GiB will be downloaded into archive.
    Downloading 4388 archive files using 20 threads...
    

    制作完成后会有提示,制作过程可以中断,之后再次运行apt-mirror会继续以前的工作.每次都可以这样更新.

    1.4- 作为本地源

    制作完成后,在本地存储的地址为:/var/spool/aptmirror/mirror/mirrors.sohu.com/ubuntu

    vi /etc/apt/sources.list
    删除原有内容,写入:
    deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu/ lucid main universe restricted multiverse  
    deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu/ lucid-security universe main multiverse restricted  
    deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu/ lucid-updates universe main multiverse restricted  
    deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu/ lucid-proposed universe main multiverse restricted  
    deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu/ lucid-backports universe main multiverse restricted 
    

    1.5- 本地安装软件包

    apt-get update

    2- iso文件制作本地源

    2.1- ubuntu版本说明

    开发代号 中文 发布版本
    Quantal Quetzal 量子绿咬鹃 12.10
    Precise Pangolin 精确的穿山甲 12.04
    Oneiric Ocelot 白日梦的虎猫 11.10
    Natty NARWHAL 聪慧的独角鲸 11.04
    Maverick Meerkat 标新立异的狐獴 10.10
    Lucid Lynx 清醒的雪地猞猁 10.04
    Karmic Koala 幸运的考拉 9.10
    Jaunty Jackalope 快活的鹿角兔 9.04
    Intrepid Ibex 勇敢的无畏的野羊 8.10
    Hardy Heron 坚强的苍鹭 8.04
    Gutsy Gibbon 胆大的长臂猿 7.10
    Feisty Fawn 烦躁不安的小鹿 7.04
    Edgy Eft 尖利的小蜥蜴 6.10
    Dapper Drake 整洁的帅气的公鸭 6.06
    Breezy Badger 活泼的獾 5.10
    Hoary Hedgehog 白发的刺猬 5.04
    Warty Warthog 多疣的疣猪 4.10
    

    2.2- 源来源说明

    ubuntu的源来源有5个,分别是:

    main #Canonical支持的开源软件
    universe #社区维护的开源软件
    restricted #设备的专有驱动
    multiverse #有版权与合法性问题限制的软件
    source #源代码

    2.3- 本地案例

    deb file:///mnt/iso/ubuntu lucid main
    deb file:///mnt/iso/ubuntu lucid restricted
    

    说明:
    deb file:// #debian系列ISO源的固定格式
    /mnt/iso #ISO镜像的挂载点(依各自挂载目录而定噢)
    ubuntu #ISO镜像中的ubuntu目录
    lucid #发行版代号或昵称
    [注意]: 版本不同的,只需修改,挂载目录和版本代号即可,也就是上面的 /mnt/iso/ lucid。

    3- 使用apt-cdrom 制作iso本地源

    3.1- apt-cdrom 命令将CD添加到源文件中.

    mount -t iso9660 -o loop /mnt/ubuntu10.04.iso  /media/cdrom
    

    3.2- 制作源命令

    apt-cdrom -m -d=/media/cdrom add
    

    3-4- 命令说明

    apt-cdrom   ident # 扫描光盘信息
    apt-cdrom    add   # 自动用扫描信息生成apt源信息,并写入到/etc/apt/source.list中
    "add"命令可以向source.list中添加一个新的光盘源文件。它会卸载CD设备,提示插入光盘,然后扫描光盘并且复制索引文 件。如果光盘上没有.disk文件夹,系统则会提示要你提供一个合适的描述。 APT采用光驱ID来跟踪当前光驱并且在/var/lib/apt/cdroms.list中保留这些ID信息。
    ident 是一个 调试工具,可以报告当前光盘和存储的文件 名的信息
    -d or --cdrom : 加载点(指明光驱加载的位置)
    -r or --rename : 重命名光盘,改变光盘标签或者复盖光盘。使用这个选项会导致apt-cdrom提示需要一个新的光盘标签。
    -n, --just-print, --recon or --no-act: 不改变sources.list文件,并且不会重写索引文件,但是仍然会检查相关内容。
    

    3.5- iso文件目录结构

     ls -1  /mnt/cdrom/dists      //此目录是默认存储apt源的包依赖信息文件的根目录,类似与yum的repodate目录.
                 oneiric       //此目录名,是以当前光盘中Ubuntu的版本名称命名的,这里是oneiric发行版.
                 stable        //这是一个快捷方式(软连接)
                 unstable      //快捷方式。
    
                 
              ls  -1  /mnt/cdrom/pool/    //这是光盘中默认存储deb包的根目录
               main                //此目录下存放所有的main包(安装Ubuntu系统必须的包)。
               restricted         //此目录下存放有版权的deb包,这些包一般为驱动包.
       
              ls  -1   /mnt/cdrom/dists/oneiric/
               main                //此目录为main包的apt信息压缩文件存放目录; 
               Release
               Release.gpg
               restricted        //此为有版权的apt信息压缩文件存放目录。
              【注:main/restricted下还分32位和64位deb包的信息文件的根目录,但这些无需关心.】
    

    3.6- source.list 文件说明

    这是默认读取apt源信息的配置文件,/etc/apt/source.list.d/ 也可以存储。

    deb  file:///mnt/cdrom  oneiric   main  restricted 
    # deb: 是指定要下载安装deb包。
    # deb-src : 是指定要下载安装deb的源码包。 支持协议 file://  ftp:// http://
    # /mnt/cdrom: 这是URL地址部分
    # oneiric : ubuntu的版本号名称。
    # 安装ubuntu的主要包
    # restricted: 即驱动相关的包。
    # universe 和 multiverse   这两个参数是安装ubuntu扩展的第三方包的参数.
  • 相关阅读:
    linux--menuconfig
    linux--rcs
    linux--VSS/RSS/PSS/USS
    vi编辑器中发现文件中每行都有一个^M字符
    linux umount命令
    Linux mount命令
    Linux rmmod命令
    Linux lsmod命令
    Linux insmod命令
    linux--cpio文件
  • 原文地址:https://www.cnblogs.com/lemanlai/p/12487313.html
Copyright © 2011-2022 走看看