zoukankan      html  css  js  c++  java
  • linux ubuntu 本地镜像 软件源 制作方法

    1、配置当前软件源,镜像非常大,所以首先要配置一下载速度快的软件源http://fffo.blog.163.com/blog/static/2119130682014322104136601/2、安装镜像软件 并 修改镜像参数文件
    1)、安装apt-mirror
    sudo apt-get install apt-mirror
    2)、修改mirror.list

    http://www.linuxidc.com/Linux/2014-08/105415.htm


    sudo gedit /etc/apt/mirror.list
    文件内容如下:
     ——————————————引用开始——————————————————
    ############# config ##################
    #
    # set base_path /var/spool/apt-mirror [镜像存放目录位置,可根据磁盘容量情况进行更改]
    #
    # if you change the base path you must create the directories below with write privileges
    #
    # 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 <running host architecture>
    set nthreads 3 [下载进程,默认20,建议3]
    set _tilde 0
    #
    ############# end config ##############

    deb http://archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu jaunty-security main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu-cn/ jaunty main restricted universe multiverse

    [需要进行镜像的APT软件源地址,选择速度较快的官方源或国内源]

    #deb-src http://archive.ubuntu.com/ubuntu jaunty main restricted universe multiverse
    #deb-src http://archive.ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse
    #deb-src http://archive.ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse
    #deb-src http://archive.ubuntu.com/ubuntu jaunty-security main restricted universe multiverse
    #deb-src http://archive.ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse

    [不需要源代码,用#进行地址屏蔽]


    clean http://archive.ubuntu.com/ubuntu

    clean http://archive.ubuntu.org.cn/ubuntu-cn

    [镜像完成后对本地镜像和软件源进行比较]

    ——————————————引用结束——————————————————
    3、创建镜像根目录
    mkidr /var/spool/apt-mirror
    4、开始镜像(支持断点续传,任何中断都不会照成影响)
    1)sudo apt-mirror
    定时执行上面的命令,可以达到定时同步远程仓库的效果
    2)完成镜像后进行清理多余文件
    sudo /var/spool/apt-mirror/var/clean.sh

    5、使用本地源
    cd /etc/apt
    sudo mv source.list source.list.bak
    sudo vim source.list
    加入如下内容
    deb file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
    deb file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-backports restricted universe multiverse
    deb file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-proposed main restricted universe multiverse
    deb file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse
    deb file:///var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse

    deb file:///var/spool/apt-mirror/mirror/archive.ubuntu.org.cn/ubuntu-cn/ jaunty main restricted universe multiverse

    6、发布到局域网
    1)安装Apache2
    sudo apt-get install apache2


    2)建立符号连接,将镜像与Apache虚拟目录联系起来
    sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ /var/www/html/ubuntu


    3)局域网中每个用户,修改sources.list文件
    cd /etc/apt
    sudo cp sources.list sources.list.bak
    sudo vim source.list
    加入如下内容
    deb http://192.168.0.10/ubuntu jaunty main restricted universe multiverse
    deb http://192.168.0.10/ubuntu jaunty-backports restricted universe multiverse
    deb http://192.168.0.10/ubuntu jaunty-proposed main restricted universe multiverse
    deb http://192.168.0.10/ubuntu jaunty-security main restricted universe multiverse
    deb http://192.168.0.10/ubuntu jaunty-updates main restricted universe multiverse

    deb http://192.168.0.10/ubuntu-cn jaunty main restricted universe multiverse
     

  • 相关阅读:
    http从发出请求到接收响应的旅行
    git(二)github的使用入门及搜索技巧
    git(一) 基础
    获取基于Internet Explorer_Server的聊天窗口内容
    主机字节与网络字节的转换
    SQL Server存储过程中防止线程重入处理方式
    利用NVelocity 模版生成文本文件
    C# async await 学习笔记2
    C# async await 学习笔记1
    imx6 工具链下载地址
  • 原文地址:https://www.cnblogs.com/zhangjiankun/p/4644464.html
Copyright © 2011-2022 走看看