本节介绍使用apt-mirror搭建apt本地源和rubygem本地源的方法

本节介绍使用apt-mirror搭建apt本地源的方法 一台电脑,硬盘需要200g左右,带宽尽量大些,本位以ubuntu 14.04 64位server版为基础源。 1,安装apt-mirror sudo apt-get install apt-mirror apt-get命令的源配置位于/etc/apt/sources.list,而apt-mirror命令的源配置位于/etc/apt/mirror.list mirror.list文件中配置的就是下载apt源所有文件的地址,建议采用国内的源,这里以阿里云的源为例,其他的见后边附1) ############# 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 2,执行同步 sudo apt-mirror 这需要经过漫长的等待,关键还是要看网速,执行完之后安装apache 3,安装apache sudo apt-get install apache2 4,由于Apache2的认网页文件目录位于/var/www/html,因此,可以做个软链接 $ sudo ln -s /var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu /var/www/html/ubuntu 然后就可以通过如下地址访问了 http://[host]:[port]/ubuntu 如果看到地址下边是dist/和pool/两个目录就OK了,然后放到/etc/apt/sources.list中试试吧 # Local Source deb http://[host]:[port]/ubuntu/ trusty main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-security main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-updates main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-proposed main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-backports main restricted universe multiverse 本地ruby源的添加 gem sources --remove http://rubygems.org/ gem sources --add http://123.157.234.194:9001/gem/ apt-get install ruby-dev 一台电脑,硬盘需要200g左右,带宽尽量大些,本位以ubuntu 14.04 64位server版为基础源。 1,安装apt-mirror sudo apt-get install apt-mirror apt-get命令的源配置位于/etc/apt/sources.list,而apt-mirror命令的源配置位于/etc/apt/mirror.list mirror.list文件中配置的就是下载apt源所有文件的地址,建议采用国内的源,这里以阿里云的源为例,其他的见后边附1) ############# 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 2,执行同步 sudo apt-mirror 这需要经过漫长的等待,关键还是要看网速,执行完之后安装apache 3,安装apache sudo apt-get install apache2 4,由于Apache2的认网页文件目录位于/var/www/html,因此,可以做个软链接 $ sudo ln -s /var/spool/apt-mirror/mirror/mirrors.aliyun.com/ubuntu /var/www/html/ubuntu 然后就可以通过如下地址访问了 http://[host]:[port]/ubuntu 如果看到地址下边是dist/和pool/两个目录就OK了,然后放到/etc/apt/sources.list中试试吧 # Local Source deb http://[host]:[port]/ubuntu/ trusty main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-security main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-updates main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-proposed main restricted universe multiverse deb http://[host]:[port]/ubuntu/ trusty-backports main restricted universe multiverse 本地ruby源的添加 gem sources --remove http://rubygems.org/ gem sources --add http://123.157.234.194:9001/gem/ apt-get install ruby-dev

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...