来自于https://www.cnblogs.com/liangqihui/p/7150066.html
APT本地源的搭建(可用于局域网apt-get源搭建或者本地源)
本文档介绍使用apt-mirror软件搭建apt本地源
需求:内网开发环境由于其特定原因不能上外网,所以需要本地环境下的内网源来方便开发人员下载安装软件
建议:单独使用一块磁盘来存放源文件或者单独一个目录下,避免混淆
服务端配置
1、安装apt-mirror
apt-get install apt-mirror

2、修改apt-mirror配置文件

vim /etc/apt/mirror.list
参考以下配置文件:
清空原有的配置文件,直接使用以下配置文件即可

############# config ##################
# 以下注释的内容都是默认配置,如果需要自定义,取消注释修改即可
set base_path /var/spool/apt-mirror
#
# 镜像文件下载地址
# set mirror_path $base_path/mirror
# 临时索引下载文件目录,也就是存放软件仓库的dists目录下的文件(默认即可)
# set skel_path $base_path/skel
# 配置日志(默认即可)
# set var_path $base_path/var
# clean脚本位置
# set cleanscript $var_path/clean.sh
# 架构配置,i386/amd64,默认的话会下载跟本机相同的架构的源
set defaultarch amd64
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
# 下载线程数
set nthreads 20
set _tilde 0
#
############# end config ##############
# Ali yun(这里没有添加deb-src的源)
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse clean http://mirrors.aliyun.com/ubuntu

3、开始同步

执行 apt-miiror

然后等待很长时间(该镜像差不多100G左右,具体时间看网络环境),同步的镜像文件目录为/var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu/,当然如果增加了其他的源,在/var/spool/apt-mirror/mirror目录下还有其他的地址为名的目录。

注意:当apt-mirror 被意外中断时,只需要重新运行即可,apt-mirror支持断点续存;另外,意外关闭,需要在/var/spool/apt-mirror/var目录下面删除 apt-mirror.lock文件【 sudo rm apt-mirror.lock 】,之后执行apt-mirror重新启动

 4、安装apache2

apt-get install apache2

由于Apache2的默认网页文件目录位于/var/www/html,因此,可以做个软链接(这样我们就可以直接访问了,无需将其直接导入该目录)

ln -s /var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu /var/www/html/ubuntu
 然后就可以通过如下地址访问了
http://[host]:[port]/ubuntu   #ip和port是自己本机的,其中端口默认为80
在测试时可能遇到打不开的情况,查看下iptables规则是否限制或者selinux的问题(这点相信大家在学习lanmp的时候都已经了解过了)
客户端配置:
1、编辑/etc/apt/source.list,加入以下内容
# Local Source      #ip和port是自己本机的,其中端口默认为80
deb [arch=amd64] http://[host]:[port]/ubuntu/ trusty main restricted universe multiverse
deb [arch=amd64] http://[host]:[port]/ubuntu/ trusty-security main restricted universe multiverse
deb [arch=amd64] http://[host]:[port]/ubuntu/ trusty-updates main restricted universe multiverse
deb [arch=amd64] http://[host]:[port]/ubuntu/ trusty-proposed main restricted universe multiverse
deb [arch=amd64] http://[host]:[port]/ubuntu/ trusty-backports main restricted universe multiverse

2、更新apt-get源

apt-get update    #这步很重要
apt-get upgrade

ubuntu16.04 自建源的更多相关文章

  1. ubuntu16.04更换镜像源

    1.备份原有 cp /etc/apt/sources.list /etc/apt/sources.list.old 2.打开阿里巴巴镜像源:  https://opsx.alibaba.com/mir ...

  2. Ubuntu16.04常用软件源

    这篇博文的,主要目的是为了方便我和大家安装软件.我将我安装过的所有软件包的源列在此处. Google Chrome sudo wget https://repo.fdzh.org/chrome/goo ...

  3. Ubuntu16.04阿里云源

    16.04源 deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://m ...

  4. Ubuntu16.04 国内更新源

    在修改source.list之前要先备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 替换内容到source.list中 阿里云源: ...

  5. Ubuntu16.04 换阿里源

    国内阿里源速度比较快,北京联通下载极快.更新也比较稳定 1.备份 cp /etc/apt/source.list /etc/apt/source.list.bak 2.编辑source文件 sudo ...

  6. Ubuntu16.04 / OpenCV / Python 源码安装

    为什么需要源码安装? 1. 对 Python 版的 OpenCV,Ubuntu 有两种安装方式: 源码安装:官网(https://opencv.org/releases.html)下载源代码,在机器上 ...

  7. Ubuntu16.04更换下载源

    更新源的方法 进入/etc/apt/ cd /etc/apt 对 sources.list文件进行备份: sudo cp sources.list sources.list.bak 打开源列表文件 s ...

  8. 解决 Ubuntu16.04 + opencv4.1 源码编译错误 Makefile:160: recipe for target 'all' failed

    最近源码编译 opencv,出现下面的错误 [ %] Built target opencv_dnn Makefile:: recipe for target 'all' failed google ...

  9. Ubuntu16.04系统Tensorflow源码安装

    最近学习Tensorflow,记录一下安装过程.目前安装的是CPU版的 1.下载tensorflow源码 tensorflow是个开源库,在github上有源码,直接在上面下载.下载地址:https: ...

随机推荐

  1. 为WPF, UWP 及 Xamarin实现一个简单的消息组件

    原文地址:Implementing a simple messenger component for WPF, UWP and Xamarin 欢迎大家关注我的公众号:程序员在新西兰了解新西兰IT行业 ...

  2. cogs 1440. [NOIP2013]积木大赛 贪心水题

    1440. [NOIP2013]积木大赛 ★★   输入文件:BlockNOIP2013.in   输出文件:BlockNOIP2013.out   简单对比时间限制:1 s   内存限制:128 M ...

  3. SpringMVC启动流程源码解密

    我们知道,SpringMVC最后是通过Tomcat来进行部署的.当在Servlet中进行进行应用部署时,主要步骤为(引用来自http://download.oracle.com/otn-pub/jcp ...

  4. crawler 听课笔记 碎碎念 2 一些爬虫须知的基本常识和流程

    html的宗旨:      <标签 属性=”属性的值“></标签>        只是对于文本的一种解释划分吧 dom的宗旨:      就是一个大数组,处理方便,效率低 xm ...

  5. Springboot + 持久层框架JOOQ

    简介 官网链接 JOOQ是一套持久层框架,主要特点是: 逆向工程,自动根据数据库结构生成对应的类 流式的API,像写SQL一样 提供类型安全的SQL查询,JOOQ的主要优势,可以帮助我们在写SQL时就 ...

  6. SpringBoot使用thymeleaf模板时报错:Template might not exist or might not be accessible by any of the configured Template Resolvers

    错误如下:Template might not exist or might not be accessible by any of the configured Template Resolvers ...

  7. 深入学习MySQL 02 日志系统:bin log,redo log,undo log

    上一篇文章中,我们了解了一条查询语句的执行过程,按理说这篇应该讲一条更新语句的执行过程,但这个过程比较复杂,涉及到了好几个日志与事物,所以先梳理一下3个重要的日志,bin log(归档日志).redo ...

  8. xhemj资料

    Github https://github.com/xhemj Gitee码云 https://gitee.io/xhemj Cnblogs博客园 https://www.cnblogs.com/xh ...

  9. GP工作室—系统设计

    团队作业第二次作业--系统设计 问题 答案 这个作业属于哪个课程 软件工程 这个作业要求在哪里 作业要求 团队名称 GP工作室 这个作业的目标 对项目软件进行更为详细的系统性设计 按照本游戏的设计要求 ...

  10. [JSOI2008]最大数(并查集)

    并查集的神奇用法:[JSOI2008]最大数 Description 现在请求你维护一个数列,要求提供以下两种操作: 1. 查询操作. 语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出 ...