分享

ubuntu源详解 and 实现自己的ubuntu源

 瞻云轩 2015-04-03

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://www./wanderer-zjhit-logs/176928926.html

一直对linux源不太清楚,只是在网上直接找到对应源镜像,复制到本地使用,现在开始探索源:
一:简介
linux内核对应各种各样的操作系统发行版本,比如Debian, SuSE, Gentoo, RedHat 和 Mandrivaden等,ubuntu是其中广受欢迎的一款即可以家用,又可以使用于服务器的发行版,基于Debain并对其做简化、优化,保证了最高的效率和最低的复杂性,ubuntu每6个月发布一个新版本,每两年发布一个长期支持版本(Ubuntu 6.06 LTS,Ubuntu 8.04 LTS,Ubuntu 10.04 LTS,Ubuntu 12.04 LTS),其桌面基于gnome实现,ubuntu发布版本号由该次发布的年份和月份组成,并未反映其实际版本。
目前比较简单、且完善的包含linux各种发型版本的源有(前两个有非常详细的配置指导):
  http://mirrors.sohu.com/
        http://mirrors.163.com/
http://debian.ustc.edu.cn/ubuntu/ 中科大
  http://mirror./ubuntu/ 北京交通大学
        http://run./ubuntu/ 哈工大
 
http://ftp./ubuntu/ 上海交通大学
  ftp://ftp3.tsinghua.edu.cn/mirror/ubuntu/ubuntu/ 清华大学
ftp://mirror.lzu.edu.cn/ubuntu/ 兰州大学
http://ubuntu.csie./ubuntu/台湾大学

        对于ubuntu,不同发型版本配置非常简单,只需将发布代号进行替换即可,其他发型商的源配置更简单
       ubuntu的开发代号有两个同首字符的字母组成,第一个为形容词,第二个为名词为一个动物,源的配置要根据这个形容词来动态变化即可,各种发型版本代号如下:
   
版本 发布日期               代号                                 含义
   4.10 2004年10月20日 Warty Warthog           多疣的疣猪
 5.04 2005年4月8日      Hoary Hedgehog  灰白的刺猬
 5.10 2005年10月13日  Breezy Badger 活泼的獾
 6.06 LTS(长期支持版) 2006年6月1日 Dapper Drake 漂亮的鸭子
 6.10 2006年10月26日 Edgy Eft 躁动的蜥蜴
 7.04 2007年4月19日 Feisty Fawn
 7.10 2007年10月18日 Gutsy Gibbon
 8.04 LTS(长期支持版) 2008年4月24发布 Hardy Heron
 8.10 2008年10月30日发布  Intrepid Ibex
 9.04 2009年4月23日发布 Jaunty Jackalope
 9.10 2009年10月29日发布 Karmic Koala
 10.04 LTS(长期支持版) 2010年4月29日发布 Lucid Lynx
   10.10 2010年10月10日发布 Maverick Meerkat
   11.04 2011年4月28日发布 Natty Narwhal
 11.10  2011年10月13日发布 Oneiric Ocelot
    12.04 LTS  2012年4月28日发布         Precise Pangolin
二:哈工大ubuntu 11.10源如下:
deb http://run./ubuntu/ oneiric main restricted universe multiverse
deb-src http://run./ubuntu/ oneiric main restricted universe multiverse
deb http://run./ubuntu/ oneiric-updates main restricted universe multiverse
deb-src http://run./ubuntu/ oneiric-updates main restricted universe multiverse
deb http://run./ubuntu/ oneiric-backports main restricted universe multiverse
deb-src http://run./ubuntu/ oneiric-backports main restricted universe multiverse
deb http://run./ubuntu/ oneiric-security main restricted universe multiverse
deb-src http://run./ubuntu/ oneiric-security main restricted universe multiverse
该源的配置可以根据
 http://run./ubuntu/dists内容设置:
其中各项含义如下:

a:  deb,deb-src表示软件包,源代码包
b:  oneiric表示当前ubuntu对应的发型版本
c:  security,backports[补丁],updates[更新],proposed[推荐的,提议的]等代表dists[存储位置]的子目录,用以区分各种类型的软件包和源代码包,apt-get update用于同步索引,apt-get upgrate用于安装新文件
d: main,restricted,universe,multiverse为该版本的软件包,每一类中有多种类型软件包。
源目录结构如下:

../
dists/                                              13-Oct-2011 23:04                   发行版,便于理解[各个版本]
indices/                                           14-Nov-2011 15:07                   维护人员文件和重载文件
pool/                                               27-Feb-2010 14:30                   软件包的新的物理地址
project/                                           13-Feb-2008 22:39                   大部分为开发人员的资源
ubuntu/                                            26-Nov-2011 20:36                   -
ls-lR.gz                                            26-Nov-2011 05:22            10302243
各个目录项含义如下:
2.1 dists目录说明了ubuntu各个版本(8.04-12.04)的5个附加仓库,每个附加仓库表示该版本软件包的
一种类型,每种类型有四种来源的安装包:
hardy/ ,hardy-backports/ ,hardy-proposed/,hardy-security/,hardy-updates/
上海交大的该目录如下:
hardy/                                                 14-Oct-2011 07:23                   -
hardy-backports/                                   17-Nov-2011 06:25                   -
hardy-proposed/                                    23-Nov-2011 06:27                   -
hardy-security/                                    23-Nov-2011 06:27                   -
hardy-updates/                                      23-Nov-2011 06:27                   -
lucid/                                                  14-Oct-2011 07:23                   -
lucid-backports/                                   18-Nov-2011 06:40                   -
lucid-proposed/                                    23-Nov-2011 06:27                   -
lucid-security/                                    25-Nov-2011 06:40                   -
lucid-updates/                                     25-Nov-2011 06:40                   -
maverick/                                          14-Oct-2011 07:23                   -
maverick-backports/                                18-Nov-2011 06:40                   -
maverick-proposed/                                 25-Nov-2011 06:40                   -
maverick-security/                                 22-Nov-2011 06:40                   -
maverick-updates/                                  23-Nov-2011 06:27                   -
natty/                                             14-Oct-2011 07:23                   -
natty-backports/                                   18-Nov-2011 06:40                   -
natty-proposed/                                    25-Nov-2011 06:40                   -
natty-security/                                    23-Nov-2011 06:27                   -
natty-updates/                                     25-Nov-2011 06:40                   -
oneiric/                                           14-Oct-2011 07:22                   -
oneiric-backports/                                 23-Nov-2011 06:26                   -
oneiric-proposed/                                  25-Nov-2011 06:40                   -
oneiric-security/                                  23-Nov-2011 06:26                   -
oneiric-updates/                                   25-Nov-2011 06:40                   -
precise/                                           25-Nov-2011 06:39                   -
precise-backports/                                 14-Oct-2011 07:22                   -
precise-proposed/                                  14-Oct-2011 07:22                   -
precise-security/                                  14-Oct-2011 07:22                   -
precise-updates/                                   14-Oct-2011 07:22                   -
发行版软件包的每种类型都对应一个如下内容的目录:
[   ]Contents-amd64.gz13-Oct-2011 13:2420M 
[   ]Contents-i386.gz13-Oct-2011 13:4820M 
[   ]Release13-Oct-2011 02:1940K 
[   ]Release.gpg13-Oct-2011 02:19198 
[DIR]main/28-May-2011 00:03- 
[DIR]multiverse/16-May-2011 16:03- 
[DIR]restricted/16-May-2011 16:03- 
[DIR]universe/16-May-2011 16:03-

其中每个目录,在sources.list中设置到main,mulitiverse这一层即可,其中每个该种目录对应文件如下:

[DIR]Parent Directory - 
[DIR]binary-amd64/10-Oct-2010 18:19- 
[DIR]binary-i386/10-Oct-2010 18:19- 
[DIR]debian-installer/09-Oct-2010 05:28- 
[DIR]dist-upgrader-all/05-Oct-2010 00:03- 
[DIR]i18n/14-Apr-2011 00:26- 
[DIR]installer-amd64/13-Oct-2010 16:41- 
[DIR]installer-i386/13-Oct-2010 16:41- 
[DIR]source/10-Oct-2010 18:19- 
可见每种体系结构都有一个安装包目录和源代码包目录,其中内容为一个压缩文件,该文件描述了这
种类型的这种体系结构的所有安装包的详细信息,包括在/pool目录下的存储位置等等,十分详细,格式如下:
Package: umbrello-kde4
Priority: optional
Section: devel
Installed-Size: 4468
Maintainer: Ubuntu MOTU Developers 
Original-Maintainer: Debian Qt/KDE Maintainers 
Architecture: i386
Source: kdesdk-kde4
Version: 4:4.0.5-0ubuntu1~hardy1
Depends: kde-icons-oxygen, kdebase-runtime, kdebase-runtime-data, kdelibs5 (>= 4:4.0.5-0ubuntu1~hardy2), libc6 (>= 2.4), libqt4-core (>= 4.3.4), libqt4-gui (>= 4.3.4), libqt4-qt3support (>= 4.3.4), libstdc++6 (>= 4.1.1-21), libxml2 (>= 2.6.27), libxslt1.1 (>= 1.1.20)
Suggests: khelpcenter-kde4
Filename: pool/main/k/kdesdk-kde4/umbrello-kde4_4.0.5-0ubuntu1~hardy1_i386.deb
Size: 1782804
MD5sum: f751b63e2c42e3abc0bc714f228cc966
SHA1: 728b30a325f44a8da9e5b53792f475a3f98da048
SHA256: 1e3b0e324a3188ee6605c6d138ecd22d45b15516aabb35d69f17ad27c4e5d6db
Description: UML modelling tool and code generator for KDE 4
 Umbrello UML Modeller is a Unified Modelling Language editor for KDE 4.
 It can create diagrams of software and other systems in the industry-standard
 UML format, and can also generate code from UML diagrams in a variety of
 programming languages.
 .
 This package is part of KDE4, and a component of the kdesdk-kde4 module.
 See the 'kde4' and 'kdesdk-kde4' packages for more information.
Bugs: https://bugs./ubuntu/+filebug
Origin: Ubuntu
2.2 pool目录用于实际存储所有新的软件包,索引通过dists分类目录索引,其下内容为:
main/                                              16-Nov-2005 12:06                   -
multiverse/                                        15-Sep-2011 15:20                   -
restricted/                                        20-Sep-2011 07:23                   -
universe/                                          04-May-2011 14:11                   -
各项定义如下:
main/:“main”组件包括了自由软件、可以被自由发布的软件和被Ubuntu团队完全支持的软件。其中包括了大多数流行的和稳定的开源软件,当您安装Ubuntu时默认安装的就是这些软件。 
restricted/:“restricted”组件是专供普遍用途,而且没有自由软件版权,但依然被Ubuntu团队支持的软件。请注意,因为不能直接修改软件,因而我们可能不能提供完全的技术支持,即便如此,我们还能向实际作者反馈Bug报告。 
universe/:“universe”组件是整个自由、开源Linux世界的缩影。在“universe”组件中,你可以找到大多数开源软件,以及在开源版权下的软件,所有这些都是在公共源的基础上建立的。这些软件都是使用“main”中的组件编写的,它们能与“main”组件相安无事地共同运行,但它们没有安全升级的保障。“universe”组件包含了数以千计的软件。虽然是公共的,用户必须明白它们与稳定的Ubuntu核心的软件的差异和不稳定。 
multiverse/:multiverse”组件包含了“不自由”的软件,这意味着这些软件不满足 Ubuntu相对于“main”组件的各种版权政策。当您使用这些软件时,如何调整各种权力以及遵重版权所有者的问题,就完全依靠您自己把握了。这些软件不被我们支持,而且通常不能被修改和更新,您将自己承担任何风险
2.3 indices(index复数)表示索引目录:
[   ]override.oneiric.main.debian-installer27-Nov-2011 06:1823K 
[   ]override.oneiric.main.src27-Nov-2011 06:1871K 
[   ]override.oneiric.multiverse27-Nov-2011 06:1826K 
[   ]override.oneiric.multiverse.debian-installer27-Nov-2011 06:180 
[   ]override.oneiric.multiverse.src27-Nov-2011 06:1814K 
[   ]override.oneiric.restricted27-Nov-2011 06:18872 
[   ]override.oneiric.restricted.debian-installer27-Nov-2011 06:180 
[   ]override.oneiric.restricted.src27-Nov-2011 06:18483 
[   ]override.oneiric.universe27-Nov-2011 06:181.0M 
[   ]override.oneiric.universe.debian-installer27-Nov-2011 06:189.1K 
[   ]override.oneiric.universe.src27-Nov-2011 06:18

2.4 project和ubuntu与用户无关 ----------------------------------------------------------------------------------------------- ubuntu本地源的配置:摘自http://blog./space.php?uid=8613773&do=blog&id=2018486 本地源的制作方法:
假如A机为本地源服务器,B机为客户端
在A机上操作为:
1 从ubuntu官网下载软件包,该软件包用于本机配置使用,和员服务器无关
[code]#修改A机上的软件源文件为ubuntu主站
sudo gedit /etc/apt/sources.list[/code]
内容改为
deb http://archive./ubuntu/ hardy-updates main restricted universe  multiverse  
deb http://archive./ubuntu/ hardy 			    universe multiverse
deb http://archive./ubuntu/ hardy-security main restricted universe multiverse   
后保存,当然这部分可以自己下载适合自己的软件包
2 安装下载源软件(apt-mirror,制作本地源专用)和支持局域网使用的软件(一般为apache服务器,供其他客户机下载)
sudo install apt-mirror apache2
3 然后修改A机的本地源目录下的mirror.list,该文件表明从ubuntu源下载那些软件包
[code]sudo gedit /etc/apt/mirror.list[/code]
内容为下
deb http://archive./ubuntu/ hardy-updates main restricted universe  multiverse
deb http://archive./ubuntu/ hardy                        universe multiverse
deb http://archive./ubuntu/ hardy-security main restricted univers emultiverse
4 从官网上下载软件包
sudo apt-mirror

5 下载完成后可以运行清理程序
[code]#给清理脚本赋予运行权限
sudo chmod +x /var/spool/apt-mirror/var/clean.sh
#执行清理脚本
sudo ./var/spool/apt-mirror/var/clean.sh[/code]

制作www连接目录

[code]sudo ln -s /var/spool/apt-mirror/mirror/archive./ubuntu/ /var/www/ubuntu[/code]
然后在A机浏览器内输入
[code]http://127.0.0.1/ubuntu/[/code]
测试一下页面就OK了

以上是我对本地源的理解,也手动做过,是默认将主站的源下载到/var/spool/apt-mirror/里,一般更改目录是因为/var目录下的空间 不够,所以mkdir了个/d挂载新硬盘才将下载文件连接到/d,修改目录的话还要将mirror.list里的一行注释解除
#set base_pash      /var/spool/apt-mirror[/code]
将/var/spool/apt-mirror改为你建立的/d

 

分享到: 1

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约