﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-醉意的未来-随笔分类-Linux</title><link>http://www.cnitblog.com/kenlen/category/1736.html</link><description>路漫漫其修远兮，吾将上下而求索！&lt;br&gt;
&lt;b&gt;For things to change, first I must change!&lt;/b&gt;</description><language>zh-cn</language><lastBuildDate>Fri, 07 Oct 2011 10:30:11 GMT</lastBuildDate><pubDate>Fri, 07 Oct 2011 10:30:11 GMT</pubDate><ttl>60</ttl><item><title>How to run your own yum repository</title><link>http://www.cnitblog.com/kenlen/archive/2006/01/07/6070.html</link><dc:creator>Kenlen</dc:creator><author>Kenlen</author><pubDate>Sat, 07 Jan 2006 05:44:00 GMT</pubDate><guid>http://www.cnitblog.com/kenlen/archive/2006/01/07/6070.html</guid><wfw:comment>http://www.cnitblog.com/kenlen/comments/6070.html</wfw:comment><comments>http://www.cnitblog.com/kenlen/archive/2006/01/07/6070.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/kenlen/comments/commentRss/6070.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/kenlen/services/trackbacks/6070.html</trackback:ping><description><![CDATA[<H2 class=story_title><B>How to run your own yum repository</B></H2>
<P class=story_author>Friday July 23, 2004 <NOBR>(08:01 AM GMT)</NOBR></P>
<P class=story_author>By: <A href="http://www.schwuk.com/"><FONT color=#003399>David Murphy</FONT></A></P>
<P class=story_content>Yum is a powerful tool that greatly improves package handling on RPM-based Linux distributions. This tutorial explains how to create a local yum repository, configure your machine to use this repository, and customise a yum RPM to automatically use this repository. 
<P>
<TABLE cellSpacing=0 cellPadding=10 align=right>
<TBODY>
<TR>
<TD><!-- ad position 6 --><!-- BEGIN: AdSolution-Website-Tag 4.2 : Linux.com / RON_P6_IMU -->
<SCRIPT language=javascript type=text/javascript>
Ads_xl=0;Ads_yl=0;Ads_xp='';Ads_yp='';Ads_xp1='';Ads_yp1='';
Ads_par='';Ads_cnturl='';
Ads_prf='page=article';
Ads_channels='RON_P6_IMU';
Ads_wrd='admin,gnulinux,servers';
Ads_kid=0;
Ads_bid=0;
Ads_sec=0;
</SCRIPT>

<SCRIPT language=javascript src="http://a.as-us.falkag.net/dat/njf/104/linux.com/mainpage_p6_middle_of_page_rectangle.js" type=text/javascript></SCRIPT>

<SCRIPT language=JavaScript src="http://a.as-us.falkag.net/dat/bjf/00/10/13/46.js" type=text/javascript></SCRIPT>

<SCRIPT language=JavaScript>function Ads_PopUp() {}</SCRIPT>

<SCRIPT language=JavaScript src="http://ad.doubleclick.net/adj/N763.ostg/B1758016;sz=336x280;click=http://red.as-us.falkag.net/red?cmd=url&amp;flg=0&amp;&amp;rdm=82478486&amp;dlv=104,8679,95888,101346,226939&amp;kid=101346&amp;ucl=111111A&amp;dmn=&amp;scx=1024&amp;scy=768&amp;scc=16&amp;wrd=admin,gnulinux,servers&amp;sta=,,,1,,,,,,,0,0,0,10466,10456,9680,15465,0&amp;iid=95888&amp;bid=226939&amp;dat=;ord=82478486?" type=text/javascript></SCRIPT>

<DIV id=Ads_Count95888 style="LEFT: -1000px; POSITION: absolute; TOP: -1000px"><IMG height=1 src="http://red.as-us.falkag.net/dat/bgf/trpix.gif?&amp;rdm=82478486&amp;dlv=104,8679,95888,101346,226939&amp;kid=101346&amp;chw=9101881-9101346-996140-992998-9101028-996588-995686-976006-975999-970849-999024-498868-&amp;tcs=&amp;bls3=111000A&amp;bls4=010002125252&amp;uid=1&amp;dmn=&amp;scx=1024&amp;scy=768&amp;scc=16&amp;jav=1&amp;wrd=admin,gnulinux,servers&amp;sta=,,,1,,,,,,,0,0,0,10466,10456,9680,15465,0&amp;iid=95888&amp;bid=226939" width=1></DIV><!-- END: AdSolution-Website-Tag 4.2 --></TD></TR></TBODY></TABLE>
<P>Package management has always been a sore point for Linux, and particularly for RPM-based distros. "Dependency hell" is the term commonly used for the pain involved in installing a piece of software with a package management utility. <A href="http://www.debian.org/"><FONT color=#003399>Debian</FONT></A> made things easier with its <A href="http://www.debian.org/doc/manuals/apt-howto/index.en.html"><FONT color=#003399>Advanced Packaging Tool</FONT></A> (APT), but that's no comfort to Red Hat and Fedora users. <A href="http://www.conectiva.com.br/"><FONT color=#003399>Connectiva Linux</FONT></A> created <A href="https://moin.conectiva.com.br/AptRpm"><FONT color=#003399>APT-RPM</FONT></A>, which brings most of the benefits of APT to RPM-based distros, but early versions bent some rules to get results. </P>
<P><A href="http://linux.duke.edu/projects/yum/"><FONT color=#003399>Yum</FONT></A> (Yellow Dog Updater, Modified) was created to address both the perceived deficiences in APT-RPM at the time, and restrictions of the Red Hat up2date package management tool. Yum handles dependencies gracefully and supports multiple repositories, as does APT-RPM. It also supports groups -- tell a machine to process an application group and it will install all of those applications. This greatly simplifies managing multiple machines.</P>
<P>Why use yum instead of APT-RPM? Well, apart from the groups support, yum is distributed with Fedora Core, and APT-RPM is an add-on.</P><STRONG>Creating the <CODE>base</CODE> repository</STRONG> 
<P>To create local yum repository, you need a Web server. I'll be using the default Apache configuration you get with <A href="http://fedora.redhat.com/"><FONT color=#003399>Fedora Core 2</FONT></A>.</P>
<P>The DocumentRoot for Apache on Fedora Core is set to /var/www/html. Create a yum folder below this:</P>
<P><CODE>$ mkdir /var/www/html/yum </CODE></P>
<P>The base install RPMs for FC2 come to approximately 1.9GB in total, so ensure you have enough room. If you don't, create the yum folder somewhere else, and create a softlink:</P>
<P><CODE>$ mkdir /home/yum<BR>$ ln -s /home/yum /var/www/html/yum </CODE></P>
<P><EM>You need to ensure that Apache is configured to follow links.</EM></P>
<P>Now you can create a structure to store the files in. Yum supports multiple repositories, so you can serve files for both Fedora Core 1 and 2 from the same server. We're going to store our files in the following structure:</P><PRE>yum
|-Fedora
  |-Core
    |-2
      |-base
</PRE>
<P>Creating this is simple:</P>
<P><CODE>$ mkdir -p /var/www/html/yum/Fedora/Core/2/base<BR></CODE></P>
<P>To get the source files for the repository, run the following commands for each of the FC2 binary CDs:</P>
<P><CODE>$ mount /mnt/cdrom<BR>$ cp /mnt/cdrom/Fedora/RPMS/*.rpm /var/www/html/yum/Fedora/Core/2/base/<BR>$ umount /mnt/cdrom </CODE></P>
<P>Yum works by parsing the RPM headers. To save us from downloading each RPM to read its header, yum's developers provide a tool called <CODE>yum-arch</CODE> to extract the headers into their own (much smaller) files. To create your headers, run the commands:</P>
<P><CODE>$ cd /var/www/html/yum/Fedora/Core/2/base/<BR>$ yum-arch . </CODE></P>
<P>This creates a headers folder, and turns your collection of files into a repository.</P><STRONG>Creating the <CODE>updates</CODE> repository</STRONG> 
<P>Having your own base repository is all well and good for installing software, but you can derive far more benefit from having your own Updates repository. Creating one is as straightforward as creating the base was. Conceptually, the Updates repository fits into our structure thusly:</P><PRE>yum
|-Fedora
  |-Core
    |-2
      |-base
      | |-headers
      |-updates
</PRE>
<P>Creating it is simple:</P>
<P><CODE>$ mkdir -p /var/www/html/yum/Fedora/Core/2/updates </CODE></P>
<P>Next, get a copy of the updates, which can be found on the <A href="http://download.fedora.redhat.com/pub/fedora/linux/core/updates/2/i386/"><FONT color=#003399>Fedora Download Server</FONT></A> or your friendly neighbourhood <A href="http://fedora.redhat.com/download/mirrors.html"><FONT color=#003399>mirror</FONT></A>. Simply grab them with your favourite download tool and place them in the updates folder, then run <CODE>yum-arch</CODE> again.</P>
<P>Make sure you keep this repository up-to-date, or you'll lose the benefit of having it!</P><STRONG>Configuring your machine</STRONG> 
<P>Now that you've got your repositories, you need to set your machine up to talk to them. This is controlled by the file /etc/yum.conf.</P>
<P>Here's the default contents of the file:</P><PRE>[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=20

[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/&gt;

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/

#[updates-testing]
#name=Fedora Core $releasever - $basearch - Unreleased Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/testing/$releasever/$basearch/

#[development]
#name=Fedora Core $releasever - Development Tree
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/development/$basearch/
</PRE>
<P>...and here are the changes we'll make:</P><PRE>[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://servername/Fedora/Core/$releasever/$basearch/base/

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
baseurl=http://servername/Fedora/Core/$releasever/$basearch/updates/
</PRE>
<P><EM>$releasever</EM> and <EM>$basearch</EM> will get expanded by yum to point to the current folder structure.</P>
<P>Now it's a simple matter of running <CODE>yum update</CODE> to see what needs updating.</P><STRONG>Lather, rinse, repeat</STRONG> 
<P>Suppose you have 100 machines you want to keep updated. Editing the yum.conf file for each machine is possible, but I'm sure you've got better things to do. There's got to be a better way, right?</P>
<P>There is. You can alter the stock Fedora yum RPM to automatically point your machines at the repository.</P>
<P>Get the source RPM (SRPM) from either your CD or the <A href="http://download.fedora.redhat.com/pub/fedora/linux/core/2/SRPMS/"><FONT color=#003399>Fedora Download Server</FONT></A> (or your friendly neighbourhood <A href="http://fedora.redhat.com/download/mirrors.html"><FONT color=#003399>mirror</FONT></A>, of course). The package you want is yum-2.0.7-1.1.src.rpm. As root, install this package with the command <CODE>rpm -i yum-2.0.7-1.1.src.rpm</CODE>.</P>
<P>RPM sources are kept in the /usr/src/redhat folder, with the source files in SOURCES and the spec files in SPECS. You need to edit both the default yum.conf file and the yum.spec file.</P>
<P>First, edit /usr/src/redhat/SOURCES/yum.conf.fedora as in the "Configuring your machine" section above. Next, edit /usr/src/redhat/SPECS/yum.spec, changing the line:</P><PRE>Release: 1.1
</PRE>
<P>to:</P><PRE>Release: 1.2
</PRE>
<P>This change gives our customised RPM precedence over the stock one. Now you can build the RPM with the command <CODE>rpmbuild -ba /usr/src/redhat/SPECS/yum.spec</CODE>.</P>
<P>The resultant RPM is stored in /usr/src/redhat/RPMS/noarch, and can be installed with the command <CODE>rpm -U /usr/src/redhat/RPMS/noarch/yum-2.0.7-1.2.noarch.rpm</CODE>.</P>
<P><STRONG>Note:</STRONG> if you've already edited your /etc/yum.conf file, you can create the customised one as /etc/yum.conf.rpmnew.</P>
<P>There you have it -- a local yum repository complete with a customised yum package to take the strain out of maintaining your machines.</P><img src ="http://www.cnitblog.com/kenlen/aggbug/6070.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/kenlen/" target="_blank">Kenlen</a> 2006-01-07 13:44 <a href="http://www.cnitblog.com/kenlen/archive/2006/01/07/6070.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hello Linux!（庆祝fedora安装成功)</title><link>http://www.cnitblog.com/kenlen/archive/2005/12/28/5863.html</link><dc:creator>Kenlen</dc:creator><author>Kenlen</author><pubDate>Wed, 28 Dec 2005 14:38:00 GMT</pubDate><guid>http://www.cnitblog.com/kenlen/archive/2005/12/28/5863.html</guid><wfw:comment>http://www.cnitblog.com/kenlen/comments/5863.html</wfw:comment><comments>http://www.cnitblog.com/kenlen/archive/2005/12/28/5863.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/kenlen/comments/commentRss/5863.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/kenlen/services/trackbacks/5863.html</trackback:ping><description><![CDATA[前几天我的MM给我买了份圣诞礼物fedora core 4（4张源代码光盘＋4张安装光盘＋1张DVD安装光盘）
<br>
原来都是在虚拟机把玩linux，现在拿到一个第一份正版软件当然要安到真实的机子上面了。于是腾了一块小硬盘做从盘来安装
<br>
想不到这次安装的过程耗费了我断断续续的三天时间，mbr搞坏过，fixmbr，另一个硬盘上面的windows坏了，还原。grub不能启动。mbr没有写入第一个硬盘，用第二个硬盘启动，booting fail...还用到了第三方的系统引导过，失败。。。
<br>
装了不下六遍，遇到了很多问题。最后找到了grub,kernal 终于被正确引导，看到了x-windows.
<br>
真激动～～。而且机子上面硬件的驱动全部自动认出了，声卡，显卡等等，可能是最新的版本得到了驱动更新，redhat9没有这些驱动，特别是显卡驱动居然可以自动认出，太爽了，不用yum...
<br>

<br>
总结一下双硬盘装win+linux的体会，第一要选择写入第一个硬盘也就是windows的MBR，第二，选择手动分区，只要配置一个根节点
“/"和swap,系统的类型是
ext3,其他都不需要配置包括"/boot"（初学者适用）总结我这么多次的教训，安装的问题主要集中在这两个方面。今天中午才安装好。。
<br>

<br>
澄清一个误会，windows目录一定要fat格式，ntfs格式不行安装Linux,用百度我看到了很多这样的解答，不过我现在主硬盘全部都是ntfs的，另一个硬盘上面就是fedora.
<br>
ps：core4 补丁真多。。。update.....
<br>

<br>
推荐两个站点
<br>
<a target="_blank" href="http://fedora.linuxsir.org/">http://fedora.linuxsir.org/</a>&nbsp; （中文论坛）
<br>
<a target="_blank" href="http://fedoranews.org/">http://fedoranews.org/</a>&nbsp;(官方网站）
<img src ="http://www.cnitblog.com/kenlen/aggbug/5863.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/kenlen/" target="_blank">Kenlen</a> 2005-12-28 22:38 <a href="http://www.cnitblog.com/kenlen/archive/2005/12/28/5863.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>