linux ubuntu 本地镜像 软件源 制作方法

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

# 镜像 64位2进制包 (个人用足以)
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
# 镜像64位源码 (企业)
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
# 镜像 32位2进制包 (企业)
deb-i386 http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-i386 http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-i386 http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-i386 http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-i386 http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
# 镜像32位源码 (我常常出现储物)
deb-i386-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-i386-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-i386-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-i386-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-i386-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multivers

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:/data/apt-mirror/mirror/mirrors.163.com/ubuntu trusty main restricted universe multiverse
deb file:/data/apt-mirror/mirror/mirrors.163.com/ubuntu trusty-security main restricted universe multiverse
deb file:/data/apt-mirror/mirror/mirrors.163.com/ubuntu trusty-updates main restricted universe multiverse
deb file:/data/apt-mirror/mirror/mirrors.163.com/ubuntu trusty-proposed main restricted universe multiverse
deb file:/data/apt-mirror/mirror/mirrors.163.com/ubuntu trusty-backports main restricted universe multiverse

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/ubuntu
sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.org.cn/ubuntu-cn /var/www/ubuntu-cn
3)局域网中每个用户,修改sources.list文件
cd /etc/apt
sudo mv source.list source.list.bak
sudo vim source.list
加入如下内容
deb http://192.168.0.10/ubuntujaunty 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

时间: 2024-10-20 12:46:57

linux ubuntu 本地镜像 软件源 制作方法的相关文章

UBUntu 软件 源配置方法

最近公司产品需要增加一个功能,就是版本自动更新,使用apt-get 实现.apt-get 软件源配置的方法,参见本人资源里的共享.下面是代码中作为升级的一部分. FILE *fp; char buffer[256]; char source_ok[] = "Reading package lists..."; if(0 > system("mv -f /etc/apt/sources.list /etc/apt/sources.list.upgrade"))

linux/ubuntu安装卸载软件的方法

整理了一下linux/ubuntu里面卸载软件的方法. 1.在终端里 apt-get安装的软件: 安装软件sudo  apt-get install softname1 softname2 softname3…… 卸载软件 sudo apt-get remove softname1 softname2 softname3…… 卸载并清除配置sudo  apt-get remove --purge softname1 更新软件信息数据库 sudo apt-get update 进行系统升级sudo

ubuntu笔记 - 修改软件源

Ubuntu软件源的修改比较简单,一种方法是直接修改软件软列表:只需要把所需的软件源添加到或直接替换原来的系统源列表就可以,列表文件就是/etc/apt/sources.list .在终端执行以下命令: #进入所在目录: cd /etc/apt/ #备份源列表: sudo cp sources.list sources.list.bak #编辑源列表: sudo gedit /etc/apt/sources.list 如果希望把某一个软件源添加到列表,则只需要一个命令就好,比如在Ubuntu上安

本地Yum软件源安装Cloudera Manager 5

本地Yum软件源安装Cloudera Manager 5 (非原创,转自http://blog.csdn.net/yangzhaohui168/article/details/30118175) Cloudera Manager 5(以下简称CM)默认采用在线安装的方式,给不能联互联网或者网络不畅的用户带来了不便,由于网络问题,屡装屡败的挫折感,让初次学习CDH用户真心体验到万事开头难.本文讲解了在CentOS 6环境下搭建本地Yum软件源,局域网内的用户在完全不连互联网的情况下,完成CM的安装

centos6搭建本地openstack软件源

1.把相关软件包全部下载到本地机器 wget -np -nH –cut-dirs=1 -r -c -L –exclude-directories=repodata –accept=rpm,gz,xml http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/ -P /opt/epel6 wget参数介绍 -r,–recursive 下载整个网站.目录 -nH, –no-host-directories 不创建

[Linux] Ubuntu下解压rar文件的方法

一般通过默认安装的ubuntu是不能解压rar文件的,只有在安装了rar解压工具之后,才可以解压.其实在ubuntu下安装rar解压工具是非常简单的,只需要两个步骤就可以迅速搞定. ubuntu 下rar解压工具安装方法:安装解压工具 sudo apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack lha arj cabextract 压缩功能 安装 sudo apt-get

修改 Docker Ubuntu镜像软件源

docker上pull下来的Ubuntu,使用apt-get  install 命令下载速度奇慢无比,需要修改其软件源,进入etc/apt 目录欲修稿sources.list     发现vi,vim,gedit都没有,再下这些软件也非常慢. 解决: 1.启动容器时,挂载本地Linux系统的etc/apt文件    docker run -ti -v /etc/apt/:/home/etc ubuntu 2.删除容器下的sources.lis   rm /etc/apt/sources.list

(转)韦东山linux学习之ubuntu 9.10 软件源 问题

转自:http://www.cnblogs.com/yddeboke/p/5839155.html 跟着开发板视频学习,安装了ubuntu9.10,然而由于现在官方已经不再提供软件更新的服务,软件我一直安装不上,搞了两天终于解决了. 一.安装VMware,配置等等就不详细说了,安装好系统后,网能连上,就是软件源更新出现404 先备份: /etc/apt/sou.list  /etc/apt/sou.list.bak  备份原来的源 在网上搜了很多的资料,大多是换源,不过测试通过了一个 deb h

韦东山linux学习之ubuntu 9.10 软件源 问题

跟着开发板视频学习,安装了ubuntu9.10,然而由于现在官方已经不再提供软件更新的服务,软件我一直安装不上,搞了两天终于解决了. 一.安装VMware,配置等等就不详细说了,安装好系统后,网能连上,就是软件源更新出现404 先备份: mv /etc/apt/sou.list  /etc/apt/sou.list.bak  备份原来的源 在网上搜了很多的资料,大多是换源,不过测试通过了一个 deb http://old-releases.ubuntu.com/ubuntu/ karmic ma