针对公司的网络限制,可以在局域网内搭建一台本地的ubuntu源。
1、修改源配置,换成搜狐源(默认的ubuntu源不如某些国内的源速度快)
vi /etc/apt/source.list
deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multivers
2、安装apt-mirror工具
apt-get install -y apt-mirror
3、配置apt-mirror工具
vi /etc/apt/mirrors.list
这里只下载了64位的二进制文件
set nthreads 20 set _tilde 0 deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse clean http://mirrors.sohu.com/ubuntu
4、开始下载,速度取决于网速(大概有75G)
apt-mirror
5、作为本机源
源路径在 /var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu
vi /etc/apt/sources.list
deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu trusty main restricted universe multiverse deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu trusty-security main restricted universe multiverse deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu trusty-updates main restricted universe multiverse deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu trusty-proposed main restricted universe multiverse deb file:///var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu trusty-backports main restricted universe multiverse
6、作为局域网源
安装apache2
apt-get install apache2
将镜像目录链接到apache2的根目录(/var/www/html/)下
ln -s /var/spool/apt-mirror/mirror/mirrors.sohu.com/ubuntu /var/www/html/ubuntu
7、修改局域网ubuntu内源配置为该主机ip
vi /etc/apt/sources.list
deb http://x.x.x.x/ubuntu trusty main restricted universe multiverse deb http://x.x.x.x/ubuntu trusty-security main restricted universe multiverse deb http://x.x.x.x/ubuntu trusty-updates main restricted universe multiverse deb http://x.x.x.x/ubuntu trusty-proposed main restricted universe multiverse deb http://x.x.x.x/ubuntu trusty-backports main restricted universe multiverse