<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="http://feeds.qzone.qq.com/rss.xsl" version="1.0"?>
<rss version="2.0" xmlns:qz="http://qzone.qq.com">
<channel>
<title><![CDATA[有方/v]]></title>
<description><![CDATA[曾母暗沙]]></description>
<link>http://329226227.qzone.qq.com</link>
<lastBuildDate>Tue, 24 Nov 2009 17:11:56 GMT</lastBuildDate>
<generator>Qzone</generator>
<language>zh-cn</language>
<copyright>Copyright (C), 2005-2008, Tencent Tech. Co., Ltd.</copyright>
<pubDate>Tue, 17 Nov 2009 14:53:09 GMT</pubDate>

<item>
<title><![CDATA[红旗Linux桌面 6.0 ,只能打开sohu网站，其他网址全打不开。]]></title>
<link>http://329226227.qzone.qq.com/blog/1258469589</link>
<description><![CDATA[红旗Linux桌面 6.0 ,只能打开sohu网站，其他网址全打不开。<br>解决办法：<br>(1)试试这个方法：<br><br>终端中执行如下两行命令<br>echo &quot;net.ipv4.tcp_window_scaling = 0&quot; &gt;&gt; /etc/sysctl.conf<br>sysctl -p<br><br>(2)把工具盘安装后，应该就可以全部上网了 <!--v:3.2--> ]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258469589#comment</comments>
<qz:effect>134218240</qz:effect>
<pubDate>Tue, 17 Nov 2009 14:53:09 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258469589</guid>
</item>

<item>
<title><![CDATA[使用yum更新红旗Linux&quot;]]></title>
<link>http://329226227.qzone.qq.com/blog/1258468814</link>
<description><![CDATA[使用yum更新红旗Linux&quot;发布: 2009-1-24 13:00 | 作者: 本站整理 | 来源: 网络转载 | 查看: 1次 <br><span style="font-style:italic"><wbr /><span style="font-style:italic"><wbr /></span><wbr /></span><wbr /><br>最近找到几个新的软件包，觉得挺好用，也刚编译成rpm包，希望在所有使用到的机器上部署。后来发现，需要每一台机器去安装一遍，即使可以远程安装，这也是挺麻烦的。决定参考Redhat的升级机制，把yum也迁移到红旗上来。说做就做，效果还是不错的。<br><br>一、原理<br>yum是一个用于管理rpm包的后台程序，用python写成，可以非常方便的解决rpm的依赖关系。在建立好yum服务器后，yum客户端可以通过http、ftp方式获得软件包，并使用方便的命令直接管理、更新所有的rpm包，甚至包括kernel的更新。它也可以理解为红旗环境下的apt管理工具。<br><br>要在红旗上部署yum服务，首先需要的就是规划软件包的目录次序：<br><br>引用<br>1、我准备要对红旗服务器DC和桌面DT提供服务；<br>2、涉及的平台，服务器对i386、x86_64平台，桌面只有i386平台；<br>3、提供系统本身的升级程序包，官方提供的升级包，自己编译的软件包，以及从其他途径获得、经过测试的软件包四大部分提供更新升级。<br><br>目录架构如下：<br><br>二、部署yum服务器<br>系统平台：<br>服务端：红旗DC Server 5.0 for x86<br>客户端：红旗DC Server 5.0 for x86和DT 5.0 for x86<br><br>1、准备<br>需要为yum提供python环境，可以从系统光盘获得：<br><br>引用<br>libxml2-2.6.16-6.i386.rpm<br>libxml2-python-2.6.16-6.i386.rpm<br>elfutils-0.97-5.i386.rpm<br>rpm-python-4.3.3-9_nonptl.1AX.i386.rpm<br>python-urlgrabber-2.9.6-2.noarch.rpm<br><br>使用rpm -ivh把上述的包都安装到系统中。<br>新版的yum使用xml格式的数据文件来分析和获得rpm信息，可以使用createrepo工具实现<br><br>安装：<br>rpm -ivh createrepo-0.4.4-1.noarch.rpm<br><br>2、拷贝<br>os目录是用于存放系统原来带的所有软件包的，则我们这样做：<br><br>mount -t iso9660 -o loop /iso/redflag-dc5.0-release-disc1.iso /mnt/cdrom<br>cp /mnt/cdrom/* ./os/i386/<br>umount /mnt/cdrom<br>mount -t iso9660 -o loop /iso/redflag-dc5.0-release-disc2.iso /mnt/cdrom<br>cp /mnt/cdrom/* ./os/i386/<br><br>3、生成yum用的repodata目录<br>运行：<br>createrepo /yum/dc/5.0/os/i386<br><br>运行后，会自动在i386目录下生成repodata目录，里面存放有对应RPM的依赖信息供后续yum使用。<br><br>这里只是演示了os目录，同样的，其他目录也存放上对应的文件，并用上述命令生成repodata目录。今后若有更新，需重新运行createrepo命令，以更新数据库<br><br>4、准备ftp服务<br>yum是通过http或ftp获得rpm包的，所以我们需要设置http或ftp服务，并把上述的yum目录的根目录作为ftp的根目录即可。类似提供这样的关系：<br><br>引用<br>ftp://ip/dc/5.0/os/i386<br><br>三、部署yum客户端<br>我使用的是一个用最小化安装的红旗DC Server作为客户端。要使用yum服务，必须先解决yum的依赖关系。<br><br>1、准备<br>下面是需要使用的软件包，请从系统光盘、rpmfind或centos获得：地址<br><br>rpm -ivh libxml2-2.6.16-6.i386.rpm<br>rpm -ivh libxml2-python-2.6.16-6.i386.rpm<br>rpm -ivh python-elementtree-1.2.6-4.i386.rpm<br>rpm -ivh sqlite-3.2.2-1.i386.rpm<br>rpm -ivh python-sqlite-1.1.6-1.i386.rpm<br>rpm -ivh python-urlgrabber-2.9.6-2.noarch.rpm<br>rpm -ivh elfutils-0.97-5.i386.rpm<br>rpm -ivh rpm-4.3.3-9_nonptl.i386.rpm<br>rpm -ivh rpm-python-4.3.3-9_nonptl.1AX.i386.rpm<br><br>2、安装<br>我使用的是自己编译的2.6.1-1版本，可以从下面的地址获得。你也可以使用centos提供的2.4.2-2版本。<br>下载地址：<br>rpm -ivh yum-2.6.1-1.noarch.rpm<br><br>3、配置<br>yum客户端的配置非常简单，只有一个配置文件：/etc/yum.conf，如下：<br><br>引用<br>[main]<br>cachedir=/var/cache/yum<br>keepcache=1<br>debuglevel=2<br>logfile=/var/log/yum.log<br>pkgpolicy=newest<br>distroverpkg=redflag-release<br>tolerant=1<br>exactarch=1<br>obsoletes=1<br><br># 这里表示，你可以把配置文件放在/etc/yum.repos.d目录中，用.repo文件名# 结尾即可。<br># PUT YOUR REPOS HERE OR IN separate files named file.repo<br># in /etc/yum.repos.d<br>[base]<br>name=Red Flag Linux $releasever - $basearch - Base<br># 下面是获得rpm的http或ftp地址（yumer是用户名和密码）<br>baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/os/$basearch/<br><br>[updates]<br>name=Red Flag Linux $releasever - Updates<br>baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/updates/$basearch/<br><br>[extras]<br>name=Red Flag Linux $releasever - Extras<br>baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/extras/$basearch/<br><br>[addons]<br>name=Red Flag Linux $releasever - Addons<br>baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/addons/$basearch/<br><br>※注释：配置文件中可以使用几个变量，其他的请参考man yum.conf。<br>$releasever＝distroverpkg定义的对应/etc/redflag-release的版本；<br>$arch=python中os.uname的定义；<br>$basearch=把$arch降级到最基础的架构，例如i686会表示为i386<br>4、使用<br>上面已经把yum配置完，使用方法是：<br><br># yum &lt;更新项目&gt; &lt;套件名称&gt; <br><br>参数说明： <br>options：这里仅列出常见的参数而已。 <br>-y 如果 yum 在工作过程中需要使用者响应，这个参数可以直接回答 yes <br>更新项目：更新的动作有底下几个： <br>install ：安装某个套件，后面需要接套件名称； <br>update ：这就是升级啦！如果 update 后面接套件名称，表示只要 yum 升级该套件而已<br>如果 update 后面不接套件名称，表示 yum 针对目前该主机所有已经安装的套件进行升级的动作！这是最常使用的项目了。 <br>list ：列出目前在 yum server 上面有的 RPM 套件； <br>info ：某个套件的内容，类似 rpm -qi packages 的内容。 <br>clean ：将已将下载到本机的 packages 或 headers 移除。 <br>remove ：移除已经安装在我们系统的某个套件！<br><br>例如：<br><br><br>安装所有和mysql有关的套件<br>yum install *mysql*<br>检查是否有更新的套件<br>yum check-update<br>检查所有提供php的套件，并显示简介信息<br>yum search php<br>显示已经安装的套件<br>yum list installed<br>移除wget套件<br>yum remove wget<br><br><br><br><br>四、其他<br>1、相关文件<br><br>引用<br>/etc/cron.daily/yum.cron<br>每日进行yum及其他软件包定时升级<br>/etc/init.d/yum<br>yum服务启动文件<br><br>2、更新套件<br>服务端：把新的套件放入对应的目录，然后运行createrepo更新XML数据库即可；<br>客户端：yum会定时的情况cache文件，但有时候我们马上就要更新需要的套件，可以这样做：<br><br>yum clean all<br>yum update mirrordir<br><br>3、利用其他套件更新<br>我们在日常的管理中，也可以利用其他的发行版提供的镜像来进行额外的更新。例如，我常用centos镜像来更新部分我的工具包：<br>在/etc/yum.conf文件中增加：<br><br>引用<br>[centos-update]<br>name=CentOS-$releasever - Update<br>baseurl=http://mirror.be10.com/centos/4.3/updates/$basearch/<br>gpgcheck=1<br>gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4<br><br>其中不一样的地方就是，centos做了签名，所以，需要加上gpgcheck和gpgkey，接下来我就可以进行更新：<br><br>yum clean all<br>yum install mysql<br><br>可以看到，mysql会使用centos提供的4.1.20-1版本，而不会使用系统自带的4.1.10a-2。<br><br>但千万要注意区分可使用的套件，并不是所有centos的套件都适合红旗使用的。若不知道如何区分，建议还是使用官方的SP补丁包吧。 <!--v:3.2--> ]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258468814#comment</comments>
<qz:effect>134218240</qz:effect>
<pubDate>Tue, 17 Nov 2009 14:40:14 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258468814</guid>
</item>

<item>
<title><![CDATA[添加多个centos yum源并自动选择最快的源]]></title>
<link>http://329226227.qzone.qq.com/blog/1258468131</link>
<description><![CDATA[1、进入源目录：<br><br>cd /etc/yum.repos.d<br><br>2、添加多个源文件，如：shlug.repo，ustc.repo，两个源的内容如下：<br><br>[shlug.repo]<br>#mirrors-shlug-org.repo <br># <br># rpm --import http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5 <br># <br># This file uses a new mirrorlist system developed by Lance Davis for CentOS. <br># The mirror system uses the connecting IP address of the client and the <br># update status of each mirror to pick mirrors that are updated to and <br># geographically close to the client. You should use this for CentOS updates <br># unless you are manually picking other mirrors. <br># <br># If the mirrorlist= does not work for you, as a fall back you can try the <br># remarked out baseurl= line instead. <br># <br># <br>[base] <br>name=mirrors-shlug-org--CentOS-$releasever - Base <br>baseurl=http://mirrors.shlug.org/centos/$releasever/os/$basearch/ <br>gpgcheck=1 <br>gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5 <br>#released updates <br>[update] <br>name=mirrors-shlug-org--CentOS-$releasever - Updates <br>baseurl=http://mirrors.shlug.org/centos/$releasever/updates/$basearch/ <br>gpgcheck=1 <br>gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5 <br>#packages used/produced in the build but not released <br>[addons] <br>name=mirrors-shlug-org--CentOS-$releasever - Addons <br>baseurl=http://mirrors.shlug.org/centos/$releasever/addons/$basearch/ <br>gpgcheck=1 <br>gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5 <br>#additional packages that may be useful <br>[extras] <br>name=mirrors-shlug-org--CentOS-$releasever - Extras <br>baseurl=http://mirrors.shlug.org/centos/$releasever/extras/$basearch/ <br>gpgcheck=1 <br>gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5 <br>#additional packages that extend functionality of existing packages <br>[centosplus] <br>name=mirrors-shlug-org--CentOS-$releasever - Plus <br>baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ <br>gpgcheck=1 <br>gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5 <br>#contrib - packages by Centos Users <br>[contrib] <br>name=mirrors-shlug-org--CentOS-$releasever - Contrib <br>baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ <br>gpgcheck=1 <br>enabled=0 <br>gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5<br><br>[ustc.repo]<br># CentOS-Base.repo<br>#<br># This file uses a new mirrorlist system developed by Lance Davis for CentOS.<br># The mirror system uses the connecting IP address of the client and the<br># update status of each mirror to pick mirrors that are updated to and<br># geographically close to the client. You should use this for CentOS updates<br># unless you are manually picking other mirrors.<br>#<br># If the mirrorlist= does not work for you, as a fall back you can try the<br># remarked out baseurl= line instead.<br>#<br>#<br><br>[base]<br>name=CentOS-$releasever - Base<br>#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os<br>baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/<br>gpgcheck=1<br>gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5<br><br>#released updates<br>[updates]<br>name=CentOS-$releasever - Updates<br>#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates<br>baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/<br>gpgcheck=1<br>gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5<br><br>#packages used/produced in the build but not released<br>[addons]<br>name=CentOS-$releasever - Addons<br>#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=addons<br>baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/<br>gpgcheck=1<br>gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5<br><br>#additional packages that may be useful<br>[extras]<br>name=CentOS-$releasever - Extras<br>#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras<br>baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/<br>gpgcheck=1<br>gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5<br><br>#additional packages that extend functionality of existing packages<br>[centosplus]<br>name=CentOS-$releasever - Plus<br>#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus<br>baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/<br>gpgcheck=1<br>enabled=0<br>gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5<br><br>3、导入KEY<br><br>rpm --import http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-5<br>rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5<br><br>4、安装自动源选择插件--自动选择最快的源<br><br>yum install yum-fastestmirror -y<br><br>5、如何确认正在使用的是哪个源？<br><br>cd /var/cache/yum<br>cat timedhosts.txt<br> <br> <!--v:3.2--> ]]></description>
<category><![CDATA[技术文档]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258468131#comment</comments>
<qz:effect>134217728</qz:effect>
<pubDate>Tue, 17 Nov 2009 14:28:51 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258468131</guid>
</item>

<item>
<title><![CDATA[yum服务器配置]]></title>
<link>http://329226227.qzone.qq.com/blog/1258459037</link>
<description><![CDATA[YUM是Yellow dog Updater, Modified的缩写，是由Duke University所发起的计划，目的就是为了解决RPM的依赖关系的问题，方便使用者进行软件的安装、升级等等工作。在此在特别说明的是，YUM只是为了解决RPM的依赖关系的问题，而不是一种其它的软件安装模式。当然可以实现这样功能的除了YUM外，还有APT (Advanced Package Tool，是由debian所发展的一个软件管理工具)。<br>其实YUM的工作原理并不复杂，每一个 RPM软件的头（header）里面都会纪录该软件的依赖关系，那么如果可以将该头的内容纪录下来并且进行分析，可以知道每个软件在安装之前需要额外安装哪些基础软件。也就是说，在服务器上面先以分析工具将所有的RPM档案进行分析，然后将该分析纪录下来，只要在进行安装或升级时先查询该纪录的文件，就可以知道所有相关联的软件。所以YUM的基本工作流程如下：<br>服务器端：在服务器上面存放了所有的RPM软件包，然后以相关的功能去分析每个RPM文件的依赖性关系，将这些数据记录成文件存放在服务器的某特定目录内。 <br>客户端：如果需要安装某个软件时，先下载服务器上面记录的依赖性关系文件(可通过WWW或FTP方式)，通过对服务器端下载的纪录数据进行分析，然后取得所有相关的软件，一次全部下载下来进行安装。 <br><br>上面这些都是理论知识,下面开始实际操作:<br>1,安装vsftpd服务<br>[root@localhost Server]# rpm -ivh vsftpd-2.0.5-12.el5.i386.rpm <br>warning: vsftpd-2.0.5-12.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 <br>Preparing...                ########################################### [100%] <br>   1:vsftpd                 ########################################### [100%] <br>[root@localhost Server]# <br>2,设置vsftpd开机启动<br>[root@localhost Server]# chkconfig vsftpd on<br>3,将RHEL 5光盘中的Server、VT、Cluster、ClusterStorage四个目录复制到/var/ftp/pub下（如不使用虚拟化及群集后三个目录可不复制）。<br>root@localhost cdrom]# cd /var/ftp/pub <br>[root@localhost pub]# ls <br>Cluster  ClusterStorage  Server  VT<br>4,删除几个文件<br>[root@localhost pub]# rm -f *.html <br>[root@localhost pub]# rm -f Server/repodata/TRANS.TBL <br>[root@localhost pub]# rm -f VT/repodata/TRANS.TBL<br>5,安装createrepo(用于生成rpm依赖关系及组信息)包。<br>[root@localhost Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm <br>warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 <br>Preparing...                ########################################### [100%] <br>   1:createrepo             ########################################### [100%]<br>6,建立分组文件<br>在RHEL 5中每个目录下的repodata目录下都有一个repomd.xml，该文件中就记录了rpm包的依赖关系，还有一个comps-rhel5-*.xml文件，这个文件主要记录分组情况，建立yum仓库时，需要先重建该文件.<br>[root@localhost pub]# createrepo -g /var/ftp/pub/Server/repodata/comps-rhel5-server-core.xml /var/ftp/pub/Server/ <br>1336/2223 - jakarta-commons-collections-testframework-javadoc-3.2-2jpp.3.i386.rp2223/2223 - pcmciautils-014-5.i386.rpm                                          <br>Saving Primary metadata <br>Saving file lists metadata <br>Saving other metadata <br>[root@localhost pub]# createrepo -g /var/ftp/pub/VT/repodata/comps-rhel5-vt.xml /var/ftp/pub/VT/ <br>32/32 - Virtualization-it-IT-5.2-9.noarch.rpm                                   <br>Saving Primary metadata <br>Saving file lists metadata <br>Saving other metadata <br>[root@localhost pub]# <br>7,重起FTP服务<br>[root@localhost pub]# service vsftpd restart<br>8,修改配置文件<br>[root@localhost ~]# vi /etc/yum.repos.d/rhel-debuginfo.repo<br>[rhel-debuginfo]<br>name=Red Hat Enterprise Linux $releasever - $basearch - Debug<br>baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/<br>enabled=0<br>gpgcheck=1<br>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release<br>[Server]<br>name=Server<br>baseurl=ftp://192.168.0.253/pub/Server<br>enabled=1<br>gpgcheck=1<br>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release<br>[VT]<br>name=VT<br>baseurl=ftp://192.168.0.253/pub/VT<br>enabled=1<br>gpgcheck=1<br>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release<br>[Cluster]<br>name=Cluster<br>baseurl=ftp://192.168.0.253/pub/Cluster<br>enabled=1<br>gpgcheck=1<br>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release<br>[ClusterStorage]<br>name=ClusterStorage<br>baseurl=ftp://192.168.0.253/pub/ClusterStorage<br>enabled=1<br>gpgcheck=1<br>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release<br><br>安装结束!!<br><br>再介绍一下yun常用命令<br>yum update package 更新指定程序包package <br>yum check-update 检查可更新的程序<br>yum info &lt;package&gt; 显示安装包信息 <br>yum list 显示所有已经安装和可以安装的程序包<br>yum list &lt;package&gt; 显示指定程序包安装情况<br>yum search &lt;keyword&gt;查找软件包<br>yum remove | erase package1 删除程序包<br>yum clean headers  清除header <br>yum clean packages  清除下载的rpm包<br>yum clean all  清除header与rpm包<br><br>PS:在copy那4个文件夹的时候,存放路径可以更改,相应的/etc/yum.repos.d/rhel-debuginfo.repo中FTP路径也要对应。同时需要修改vsftpd的设置，在/etc/vsftpd/vsftpd.conf中增加一行anno_root=对应路径<br>本文出自 “allen的学习笔记” 博客，请务必保留此出处<a href="http://allenyu.blog.51cto.com/193668/143481" target="_blank">http://allenyu.blog.51cto.com/193668/143481</a><wbr /> <!--v:3.2--> ]]></description>
<category><![CDATA[技术文档]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258459037#comment</comments>
<qz:effect>134218240</qz:effect>
<pubDate>Tue, 17 Nov 2009 11:57:17 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258459037</guid>
</item>

<item>
<title><![CDATA[yum的使用]]></title>
<link>http://329226227.qzone.qq.com/blog/1258458975</link>
<description><![CDATA[1.列出所有可更新的软件清单<br>命令：yum check-update<br><br>2.安装所有更新软件<br>命令：yum update<br><br>3.仅安装指定的软件<br>命令：yum install &lt;package_name&gt;<br><br>4.仅更新指定的软件<br>命令：yum update &lt;package_name&gt;<br><br>5.列出所有可安裝的软件清单<br>命令：yum list<br><br>用YUM安装删除软件<br>装了系统添加删除软件是常事，yum同样可以胜任这一任务，只要软件是rpm安装的。 <br>安装的命令是，yum install xxx，yum会查询数据库，有无这一软件包，如果有，则检查其依赖冲突关系，如果没有依赖冲突，那么最好，下载安装;如果有，则会给出提示，询问是否要同时安装依赖，或删除冲突的包，你可以自己作出判断。 <br>删除的命令是，yum remove xxx，同安装一样，yum也会查询数据库，给出解决依赖关系的提示。 <br><br><br>1.用YUM安装软件包<br>命令：yum install &lt;package_name&gt;<br><br>2.用YUM删除软件包<br>命令：yum remove &lt;package_name&gt;<br><br>用YUM查询软件信息<br>我 们常会碰到这样的情况，想要安装一个软件，只知道它和某方面有关，但又不能确切知道它的名字。这时yum的查询功能就起作用了。你可以用 yum search keyword这样的命令来进行搜索，比如我们要则安装一个Instant Messenger，但又不知到底有哪些，这时不妨用 yum search messenger这样的指令进行搜索，yum会搜索所有可用rpm的描述，列出所有描述中和messeger有关的rpm包，于 是我们可能得到gaim，kopete等等，并从中选择。 <br>有时我们还会碰到安装了一个包，但又不知道其用途，我们可以用yum info packagename这个指令来获取信息。 <br><br><br>1.使用YUM查找软件包<br>命令：yum search &lt;keyword&gt;<br><br>2.列出所有可安装的软件包<br>命令：yum list<br><br>3.列出所有可更新的软件包<br>命令：yum list updates<br><br>4.列出所有已安装的软件包<br>命令：yum list installed<br><br>5.列出所有已安装但不在 Yum Repository 內的软件包<br>命令：yum list extras<br><br>6.列出所指定的软件包<br>命令：yum list &lt;package_name&gt;<br><br>7.使用YUM获取软件包信息<br>命令：yum info &lt;package_name&gt;<br><br>8.列出所有软件包的信息<br>命令：yum info<br><br>9.列出所有可更新的软件包信息<br>命令：yum info updates<br><br>10.列出所有已安裝的软件包信息<br>命令：yum info installed<br><br>11.列出所有已安裝但不在 Yum Repository 內的软件包信息<br>命令：yum info extras<br><br>12.列出软件包提供哪些文件<br>命令：yum provides &lt;package_name&gt;<br><br>清除YUM缓存<br>yum 会把下载的软件包和header存储在cache中，而不会自动删除。如果我们觉得它们占用了磁盘空间，可以使用yum clean指令进行清除，更精确 的用法是yum clean headers清除header，yum clean packages清除下载的rpm包，yum clean all一 股脑儿端 <br><br><br>1.清除缓存目录(/var/cache/yum)下的软件包<br>命令：yum clean packages<br><br>2.清除缓存目录(/var/cache/yum)下的 headers<br>命令：yum clean headers<br><br>3.清除缓存目录(/var/cache/yum)下旧的 headers<br>命令：yum clean oldheaders<br><br>4.清除缓存目录(/var/cache/yum)下的软件包及旧的headers<br>命令：yum clean, yum clean all (= yum clean packages; yum clean oldheaders) <!--v:3.2--> ]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258458975#comment</comments>
<qz:effect>134218240</qz:effect>
<pubDate>Tue, 17 Nov 2009 11:56:15 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258458975</guid>
</item>

<item>
<title><![CDATA[RPM深入应用]]></title>
<link>http://329226227.qzone.qq.com/blog/1258458916</link>
<description><![CDATA[RPM深入应用<br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><span style="font-weight:bold"><wbr />RPM深入应用</span><wbr />                                              </span><wbr /></span><wbr /></span><wbr /><br><br><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">[ </span><wbr /></span><wbr /><span style="font-family:'宋体';line-height:1.8em;"><span style="line-height:1.8em;">转载请注明出自</span><wbr /></span><wbr /><span style="line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">LAMP兄弟连</span><wbr /></span><wbr /><span style="font-family:'宋体';line-height:1.8em;"><span style="line-height:1.8em;">并附录原文地址链接，<span style="font-family:'Times';line-height:1.8em;"><a href="http://www.lampbrother.net/thread-13978-1-1.html" target="_blank">http://www.lampbrother.net/thread-13978-1-1.html</a><wbr /></span><wbr /></span><wbr /></span><wbr /><span style="line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"> ]</span><wbr /></span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"></span><wbr /></span><wbr /><br><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Red Hat Package Management</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Red Hat</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包管理）提供了一种构架，在这种架构下，可以在</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Red Hat Enterprise Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Fedora Project</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">SuSe Linux Enterprise</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">CentOS</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Mandriva Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">等基于</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">系统的</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">发行版本上实现对软件包的管理。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">从某种意义上来讲有点像计算器，它具备众多实用的功能，但大多数人只使用它来对软件包进行安装、升级、卸载，就好像大多数人只用计算器计算加减法一样。然而，如果多深入了解</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">一点，就会发现它的查询、校验等功能可以做更多软件包维护管理、系统故障排除、文件安全性检测等工作。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">将所有的安装软件信息记录到</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库中，存放于系统的</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/var/lib/rpm</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">目录下，可以利用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库对系统中已安装软件包进行查询、校验等操作。</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">本文结合作者实际工作中的案例，介绍几个</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的深入应用，希望能够对</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的初学者了解</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">有所帮助。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-weight:bold"><wbr /><span style="font-family:'Times';line-height:1.8em;">1</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'宋体';line-height:1.8em;">、查询软件包帮助信息</span><wbr /></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">在一次讲解</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">应用的课程中，学生问了一个这样的问题：“在</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的配置文件中如何注释？”。</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的配置文件存放于用户的宿主目录下，缺省文件名为“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">.vimrc</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”，可以写入“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">set nu</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”等设置命令，问题是写入到此配置文件的命令如何注释使其不生效。一般来讲</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">系统或系统软件的配置文件可以在行首使用符号“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">#</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”来注释，可是当用“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">#</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”注释了</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">配置文件保存退出后，编辑文件发生了这样的情况：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># vi /etc/inittab</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">Error detected while processing /root/.vimrc:</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">line<br>1:</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">E488: Trailing characters: # set nu</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">系统提示错误，所以“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">#</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”并不是</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的有效注释符号。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'宋体';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;">诸如此类问题要如何查询得到结果，以下给出一个操作步骤的示例：</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">思路：</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">中安装的软件包大多都包含应用示例或说明文档，可以查找到其内容，就可以知道此问题的答案。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">1</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）查找系统中所有</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的安装包</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -qa | grep vim</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;">vim-minimal-7.0.109-3</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;">vim-common-7.0.109-3</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;">vim-enhanced-7.0.109-3</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">2</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">查询安装包的内容</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">查找是否有应用示例文件</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">看英文含义</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">minimal</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”为最小应用软件包，“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">common</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”为通用的基础软件包，“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">enhanced</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”为增强功能的软件包，所以先查看“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">vim-common</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”软件包安装到系统中的文件是否有示例文件（如含关键字“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">example</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”或“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">sample</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”的文件）：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -ql vim-common | grep example</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">/usr/share/vim/vim70/gvimrc_example.vim</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">/usr/share/vim/vim70/macros/urm/examples</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">/usr/share/vim/vim70/vimrc_example.vim</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">根据查找到的文件名称</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">判断</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">vimrc_example.vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”应为</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">配置文件示例，查看其内容：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># head -4 /usr/share/vim/vim70/vimrc_example.vim</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">&quot; An example for a vimrc file.</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">&quot;</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">&quot; Maintainer:<br>Bram Moolenaar &lt;[email=[ft=#0000ff,,]Bram@vim.org</span><wbr />]Bram@vim.org[/email]&gt;</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">&quot; Last change:<br>2006 Aug 12</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">当看到此文件中“作者”、“最后更新日期”等信息前面的</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">双引号，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">我们就已经清楚了它一定就是</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Vim</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">配置文件的注释符号！</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">这是一个在应用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">中碰到的问题，很有代表性，像最常见的配置网络服务器（如</span><wbr /><span style="font-family:'Times';line-height:1.8em;">DNS</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">DHCP</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">等），查找它们的配置文件示例，都可以采用类似方法。解决此类问题要多利用系统软件本身的帮助信息，使用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">查询命令解决问题。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-weight:bold"><wbr /><span style="font-family:'Times';line-height:1.8em;">2</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包校验</span><wbr /></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">使用“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">-V</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”选项进行校验，可以根据</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库对比系统所有文件属性（大小、日期、所有者、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">md5sum</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">值等），列出不同之处。如果执行没有输出，表示自从软件包安装之日起就没有发生过任何变化。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">检测结果中包含系统上每个文件的八个属性，每个属性表示如下：</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">S</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：文件大小被改变</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">M</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：文件的权限或文件的属性被改变</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">5</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：</span><wbr /><span style="font-family:'Times';line-height:1.8em;">md5</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">校验值被改变（表示文件内容被改变）</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">D</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：设备编号被改变</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">L:</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：链接属性被改变</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">U</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：文件所有者被改变</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">G</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：文件所属组被改变</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">T</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：文件的时间戳被改变</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">校验软件包</span><wbr /><span style="font-family:'Times';line-height:1.8em;">openssh-server</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">示例：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -V openssh-server</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">S.5....T c /etc/ssh/sshd_config</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">执行结果表示软件包</span><wbr /><span style="font-family:'Times';line-height:1.8em;">openssh-server</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的文件</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/etc/ssh/sshd_config</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">文件大小被改变了（如添加或删除了字符）、文件内容被改变了（注意：内容改变和文件大小改变不同，因如果只将文件中某个字符替换为另一个字符，文件大小不会有变化，但是内容变了）、时间戳被改变（最后修改时间变了）。如果校验的文件变更在预料之中，那么就没有什么大问题，但如果是非预期的，是否被入侵了呢？这一点非常值得注意。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'宋体';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;">检测系统上的所有软件包（及其所有文件），可以执行：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -Va </span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">此命令需要占用大量系统资源，所以一般将</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">检测的输出发送到</span><wbr /><span style="font-family:'Times';line-height:1.8em;">grep</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">中以便进行过滤，如只检测丢失的文件：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -Va | grep missing</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">或者，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">限制只输出文件路径中有字符串</span><wbr /><span style="font-family:'Times';line-height:1.8em;">bin/</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">的命令文件</span><wbr /></span><wbr /><span style="font-family:'宋体';line-height:1.8em;"><span style="color:#000000;line-height:1.8em;">：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -Va | grep ’bin\/’</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">如果一个或多个重要的命令文件发生了变化，就可以检测系统是否被攻击。黑客侵入系统后，会更改或替换如</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/bin/vi</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/bin/login</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/usr/bin/passwd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/bin/ps</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">等命令，如将</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/bin/vi</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">命令设置</span><wbr /><span style="font-family:'Times';line-height:1.8em;">SetUID</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># ls -l /bin/vi</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">-rwsr-xr-x 1 root root 594740 Sep 29<br>2006 /bin/vi</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">则以后任何用户登录系统，都可以使用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/bin/vi</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">更改所有文件（包括</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/etc/passwd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/etc/shadow</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">等），关于</span><wbr /><span style="font-family:'Times';line-height:1.8em;">SetUID</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">概念请参见其他资料。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-weight:bold"><wbr /><span style="font-family:'Times';line-height:1.8em;">3</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'宋体';line-height:1.8em;">、系统故障排除</span><wbr /></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">若</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">系统上的某些软件不能正常运转，就需要查看最近添加或升级软件是否是问题所在（类似</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Windows</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">系统发生因安装、升级软件或补丁包，导致系统无法正常引导，在安全模式修复的情况），使用“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">--last</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”选项以安装的时间次序列出</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包（从最近安装的软件包开始），针对问题进行故障分析。</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -qa --last </span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">bind-chroot-9.3.2-41.fc6<br><br><br>Sat Apr 14 08:37:49 2007</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">samba-swat-3.0.23c-2<br>Sat Apr 14 06:51:04 2007</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">xinetd-2.3.14-8<br><br>Sat Apr 14 06:50:53 2007</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:red;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">……</span><wbr /></span><wbr /><span style="color:red;line-height:1.8em;"></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">如果某个服务启动出现问题，如：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># service sshd start</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">Starting sshd: /etc/ssh/sshd_config: No such file or directory</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><span style="color:red;line-height:1.8em;"><br><br></span><wbr /><span style="color:red;line-height:1.8em;">[FAILED]</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'宋体';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;">类似的问题如何解决，请参考以下步骤：</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">1</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）如果报错信息详细报告了服务哪一个文件丢失，则只需要针对此文件恢复即可；如果报错信息不明确，可以使用“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">rpm -V</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”命令进行检测：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -V openssh-server</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">missing<br>c /etc/ssh/sshd_config</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">结果中出现“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">missing</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”标示，即可判断它对应的服务配置文件丢失。如果有此文件的备份则进行恢复即可，如果没有备份请参考第二步。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">2</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）有两种方法可以恢复此文件，一种是覆盖安装此文件对应的</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包，如果不确定丢失文件所属软件包可以通过以下命令查询（即便文件丢失，但是因为</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库有记录，所以依然可以查询到结果）：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -qf /etc/ssh/sshd_config<br></span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">openssh-server-4.3p2-10</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">然后执行命令</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -ivh --replacepkgs /mnt/cdrom/Fedora/RPMS/openssh-server-4.3p2-10.i386.rpm</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">即可从光盘覆盖安装此</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">包</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">恢复丢失文件。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">另一种方法是把</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">包中对应的文件提取出来</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">拷贝到原所在目录</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">执行命令：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm2cpio /mnt/cdrom/Fedora/RPMS/openssh-server-4.3p2-10.i386.rpm | cpio -idv ./etc/ssh/sshd _config</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># cp etc/ssh/sshd_config /etc/ssh/</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">    </span><wbr /><span style="font-family:'宋体';line-height:1.8em;">通过使用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">rpm2cpio</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">命令可以将</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包转换成</span><wbr /><span style="font-family:'Times';line-height:1.8em;">cpio</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">格式，</span><wbr /><span style="font-family:'Times';line-height:1.8em;">cpio</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">是一个标准工具，它用于创建软件档案文件和从档案文件中提取文件。其中选项<span style="color:black;line-height:1.8em;">“</span><wbr /></span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">i</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">”</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">表示提取文件、“</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">v</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">”</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">表示指示执行进程、</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">“</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">d</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">”</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">表示根据包中文件原来的路径建立目录，如果需要保持原文件的更新时间还可以增加选项“</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">m</span><wbr /></span><wbr /><span style="color:black;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">”。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">注意此命令执行时不能将文件直接恢复至</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/etc/ssh</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">目录，只能提取到当前目录下，且恢复的文件名称所在路径要写完整的绝对路径（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">./etc/ssh/sshd _config</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）。提取文件成功后，将其复制到</span><wbr /><span style="font-family:'Times';line-height:1.8em;">/etc/ssh</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">目录下即可。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-weight:bold"><wbr /><span style="font-family:'Times';line-height:1.8em;">4</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'宋体';line-height:1.8em;">、</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库问题</span><wbr /></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">有时</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库也会出现故障，其结果是当安装、删除、查询软件包时，请求无法执行，此时需要重建数据库。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">首先，删除当前的</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rm -f /var/lib/rpm/_db.*</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">重建数据库：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm --rebuilddb</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">这一步需要花费一定的时间来完成。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">黑客侵入系统后，有时为混淆管理员视线，避免管理员通过</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">校验功能检测出问题，会更改</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库（理论上来讲，系统被入侵后，一切都将不再可信），此时我们可以按照以下步骤对文件进行检测：</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;">1）</span><wbr /><br></span><wbr /></span><wbr /><span style="color:#000000;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">对于要检查的文件或命令，找出它属于哪个软件包：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -qf /etc/rc.d/init.d/smb</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">samba-3.0.23c-2</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">2</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）使用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">--dump</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">选项查看每个文件的信息，使用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">grep</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">命令提取对应文件信息：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -ql --dump samba| grep /etc/rc.d/init.d/smb</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">/etc/rc.d/init.d/smb 2087 1157165946 b1c26e5292157a83cadabe851bf9b2f9 0100755 root root 1 0 0 X</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">其中：</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">2087</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”为文件中最初的字符数</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">b1c26e5292157a83cadabe851bf9b2f</span><wbr /><span style="font-family:'Times';line-height:1.8em;">9</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">为</span><wbr /><span style="font-family:'Times';line-height:1.8em;">smb</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">文件内容的</span><wbr /><span style="font-family:'Times';line-height:1.8em;">md5</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">校验值</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">0755 root root</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”为文件权限及所有者、所属组</span><wbr /></span><wbr /></span><wbr /><br><span style="color:#000000;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">3</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）接下来检查实际的文件，看内容是否被更改过：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># ls -l /etc/rc.d/init.d/smb</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">-rwxr-xr-x 1 root root 2087 Sep<br>2<br>2006 /etc/rc.d/init.d/smb</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># md5sum /etc/rc.d/init.d/smb</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">b1c26e5292157a83cadabe851bf9b2f9<br>/etc/rc.d/init.d/smb</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">检测文件大小、所有者、所属组、权限、</span><wbr /><span style="font-family:'Times';line-height:1.8em;">md5</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">校验值是否匹配。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">4</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）此例子中</span><wbr /><span style="font-family:'Times';line-height:1.8em;">smb</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">文件与</span><wbr /><span style="font-family:'Times';line-height:1.8em;">--dump</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">选获得项信息匹配，如果确信</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库可能遭到修改，就要基于从光盘或者其他值得信赖的来源处获得</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Samba RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">文件进行检查，如：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -ql --dump -p /mnt/cdrom/Fedora/RPMS/samba-3.0.23c-2.i386.rpm | grep /etc/rc.d/init.d/smb</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">warning: samba-3.0.23c-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">/etc/rc.d/init.d/smb 2087 1157165946 b1c26e5292157a83cadabe851bf9b2f9 0100755 root root 1 0 0 X</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">    </span><wbr /><span style="font-family:'宋体';line-height:1.8em;">如果得到的结果与基于</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库运行的命令结果不同，就可以判断一定是数据库被更改，需要修正文件错误和系统漏洞，重建</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">数据库。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-weight:bold"><wbr /><span style="font-family:'Times';line-height:1.8em;">5</span><wbr /></span><wbr /><span style="font-weight:bold"><wbr /><span style="font-family:'宋体';line-height:1.8em;">、检查软件包的脚本</span><wbr /></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">很多</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包都包含脚本，包括在安装、卸载、升级软件包过程中要运行的脚本，以及安装期间满足某些条件时将触发的触发器脚本。这些脚本对于了解</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">系统管理、了解软件的应用很有帮助。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">使用带“</span><wbr /><span style="font-family:'Times';line-height:1.8em;">--scripts</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">”查询选项的</span><wbr /><span style="font-family:'Times';line-height:1.8em;">rpm</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">命令来查看安装、卸载软件包前后要运行的脚本。举例如下</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -q --scripts openssh-server</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">preinstall scriptlet (using /bin/sh):</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">/usr/sbin/useradd -c &quot;Privilege-separated SSH&quot; -u 74 \</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><br><br><br>-s /sbin/nologin -r -d /var/empty/sshd sshd 2&gt; /dev/null || :</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">postinstall scriptlet (using /bin/sh):</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">/sbin/chkconfig --add sshd</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">preuninstall scriptlet (using /bin/sh):</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">if [ &quot;$1&quot; = 0 ]</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">then</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><br><br><br>/sbin/service sshd stop &gt; /dev/null 2&gt;&amp;1 || :</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><br><br><br>/sbin/chkconfig --del sshd</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;">fi</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:red;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">……</span><wbr /></span><wbr /><span style="color:red;line-height:1.8em;"></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">这个例子显示了</span><wbr /><span style="font-family:'Times';line-height:1.8em;">openssh-server</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包中包含的脚本</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">安装</span><wbr /><span style="font-family:'Times';line-height:1.8em;">openssh-server</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包之前</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">preinstall</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">），调用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">useradd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">命令添加</span><wbr /><span style="font-family:'Times';line-height:1.8em;">sshd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">用户；软件包安装后（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">postinstall</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">），</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">调用</span><wbr /><span style="font-family:'Times';line-height:1.8em;">chkconfig</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">命令打开</span><wbr /><span style="font-family:'Times';line-height:1.8em;">sshd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">服务</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">--add sshd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）；</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">卸载软件包之前</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">preuninstall</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">），</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">停止</span><wbr /><span style="font-family:'Times';line-height:1.8em;">sshd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">服务</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">service sshd stop</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">并删除服务</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">（</span><wbr /><span style="font-family:'Times';line-height:1.8em;">chkconfig --del sshd</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">）……</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">触发器脚本在安装期间如果条件满足就会运行。如在升级的时候，如果软件包有不同的安装动作发生，触发器脚本将特别有用。</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"># rpm -q --triggers openssh-server</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">triggerun scriptlet (using /bin/sh) -- ssh-server</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;">if [ &quot;$1&quot; != 0 -a -r /var/run/sshd.pid ] ; then</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><br>touch /var/run/sshd.restart</span><wbr /></span><wbr /></span><wbr /><br><span style="color:red;line-height:1.8em;"><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;">fi</span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:red;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">……</span><wbr /></span><wbr /><span style="color:red;line-height:1.8em;"></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">查看</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">脚本信息对于了解系统软件的安装、卸载时所做的操作，对出现问题时的解决，将会有更清晰的思路。</span><wbr /></span><wbr /></span><wbr /><br><span style="font-family:'Times';line-height:1.8em;"><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"></span><wbr /></span><wbr /></span><wbr /><br><span style="font-size:16px;line-height:1.8em;"><span style="color:#000000;line-height:1.8em;"><span style="font-family:'宋体';line-height:1.8em;">获得更多</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">使用信息请访问</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">项目网站</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">：</span><wbr /><span style="font-family:'Times';line-height:1.8em;">http://www.rpm.org </span><wbr /><span style="font-family:'宋体';line-height:1.8em;">，</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包下载网站</span><wbr /><span style="font-family:'Times';line-height:1.8em;"> <a href="http://www.rpmfind.net/" target="_blank"><span style="color:#0000ff;line-height:1.8em;">http://www.rpmfind.net</span><wbr /></a><wbr /></span><wbr /><span style="font-family:'宋体';line-height:1.8em;">可获得各种</span><wbr /><span style="font-family:'Times';line-height:1.8em;">Linux</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">发行版本的</span><wbr /><span style="font-family:'Times';line-height:1.8em;">RPM</span><wbr /><span style="font-family:'宋体';line-height:1.8em;">软件包。</span><wbr /></span><wbr /></span><wbr /> <!--v:3.2--> ]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258458916#comment</comments>
<qz:effect>134218240</qz:effect>
<pubDate>Tue, 17 Nov 2009 11:55:16 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258458916</guid>
</item>

<item>
<title><![CDATA[yum配置更新源]]></title>
<link>http://329226227.qzone.qq.com/blog/1258458577</link>
<description><![CDATA[yum配置更新源  <br>[教育网源]<br>上海交通大学：<a href="http://ftp.sjtu.edu.cn/centos/" target="_blank">http://ftp.sjtu.edu.cn/centos/</a><wbr /><br>清华大学：<a href="http://mirror.lib.tsinghua.edu.cn/centos/" target="_blank">http://mirror.lib.tsinghua.edu.cn/centos/</a><wbr /><br>中国科技大学：<a href="http://centos.ustc.edu.cn/centos/" target="_blank">http://centos.ustc.edu.cn/centos/</a><wbr />    （推荐，比较快）<br><br>[电信网源]<br>上海电信：<a href="http://mirrors.shlug.org/centos/" target="_blank">http://mirrors.shlug.org/centos/</a><wbr /><br>山东电信：<a href="http://mirrors.ta139.com/centos/" target="_blank">http://mirrors.ta139.com/centos/</a><wbr /><br>福建电信：<a href="http://mirror.be10.com/centos/" target="_blank">http://mirror.be10.com/centos/</a><wbr /><br>163网易：<a href="http://mirrors.163.com/centos/" target="_blank">http://mirrors.163.com/centos/</a><wbr />（重点推荐）<br>1.以root用户进入CentOS系统。<br>[root@xuxy ~]# cd /etc/yum.repos.d<br>2.备份repo<br>[root@xuxy yum.repos.d]# cp CentOS-Base.repo CentOS-Base.repo.bak<br>3.建立新的CentOS-Base.repo文件：（以CentOS 5.2为例）<br>[root@xuxy yum.repos.d]#vi CentOS-Base.repo<br>内容如下（以中国科技大学的yum源为例）：<br># CentOS-Base.repo<br>#<br># This file uses a new mirrorlist system developed by Lance Davis for CentOS.<br># The mirror system uses the connecting IP address of the client and the<br># update status of each mirror to pick mirrors that are updated to and<br># geographically close to the client. You should use this for CentOS updates<br># unless you are manually picking other mirrors.<br>#<br># If the mirrorlist= does not work for you, as a fall back you can try the<br># remarked out baseurl= line instead.<br>#<br>#<br><br>[base]<br>name=CentOS-$releasever - Base<br>#mirrorlist=<a href="http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os" target="_blank">http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os</a><wbr /><br>baseurl=<a href="http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/" target="_blank">http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/</a><wbr /><br>gpgcheck=1<br>gpgkey=<a href="http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5" target="_blank">http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5</a><wbr /><br><br>#released updates<br>[updates]<br>name=CentOS-$releasever - Updates<br>#mirrorlist=<a href="http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates" target="_blank">http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates</a><wbr /><br>baseurl=<a href="http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/" target="_blank">http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/</a><wbr /><br>gpgcheck=1<br>gpgkey=<a href="http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5" target="_blank">http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5</a><wbr /><br><br>#packages used/produced in the build but not released<br>[addons]<br>name=CentOS-$releasever - Addons<br>#mirrorlist=<a href="http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=addons" target="_blank">http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=addons</a><wbr /><br>baseurl=<a href="http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/" target="_blank">http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/</a><wbr /><br>gpgcheck=1<br>gpgkey=<a href="http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5" target="_blank">http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5</a><wbr /><br><br>#additional packages that may be useful<br>[extras]<br>name=CentOS-$releasever - Extras<br>#mirrorlist=<a href="http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras" target="_blank">http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras</a><wbr /><br>baseurl=<a href="http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/" target="_blank">http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/</a><wbr /><br>gpgcheck=1<br>gpgkey=<a href="http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5" target="_blank">http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5</a><wbr /><br><br>#additional packages that extend functionality of existing packages<br>[centosplus]<br>name=CentOS-$releasever - Plus<br>#mirrorlist=<a href="http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus" target="_blank">http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus</a><wbr /><br>baseurl=<a href="http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/" target="_blank">http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/</a><wbr /><br>gpgcheck=1<br>enabled=0<br>gpgkey=<a href="http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5" target="_blank">http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5</a><wbr /><br><br>（保存并退出:wq）<br><span style="color:#ff0000;line-height:1.8em;">在用yum install 时，出现</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 443e1821</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">Public key for perl-Net-Telnet-3.03-3.noarch.rpm is not installed</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">或者：</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897<br><br>GPG key retrieval failed: [Errno 4] IOError: &lt;urlopen error (-3, 'Temporary failure in name resolution')&gt;</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">错误时。</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">centos 4：rpm --import /usr/share/doc/centos-release-4/RPM-GPG-KEY</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">centos 5：rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5</span><wbr /><br><span style="color:#ff0000;line-height:1.8em;">来解决。</span><wbr /> <!--v:3.2--> ]]></description>
<category><![CDATA[技术文档]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258458577#comment</comments>
<qz:effect>134218240</qz:effect>
<pubDate>Tue, 17 Nov 2009 11:49:37 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258458577</guid>
</item>

<item>
<title><![CDATA[yum配置]]></title>
<link>http://329226227.qzone.qq.com/blog/1258458220</link>
<description><![CDATA[yum配置 <br> <br>在讲述YUM前，先来了解下RPM是什么？RPM是RedHat Package Manager的缩写。顾名思义，当初这个软件管理的程序是由Red Hat发展出来的，当然也有很多其它相类似的软件管理程序。不过由于RPM使用上很方便，所以就成为了目前最热门的软件管理程序。<br>RPM是以一种数据库记录的方式来将所需要的软件安装到Linux系统的一套管理程序。其最大的特点就是将要安装的软件先编译过（如果需要的话）并且打包好，通过包装好的软件里头预设的数据库记录，记录这个软件要安装的时候必须要的依赖的其它软件，当安装在Linux系统时，RPM会先根据软件里纪录的数据查询Linux系统中依赖的其它软件是否满足，如果满足则安装，如不满足则不安装。<br>RPM包安装程序最大的问题在于，由于RPM程序是已经打包好的数据，也就是说，里面的数据已经都编译完成，所有安装时一定需要当初安装时的主机环境才能安装。当初建立这个软件的安装环境必须也要在当前主机上出现。如果有过RPM安装经验，碰到这样的问题时的确很头疼。而YUM可以很好的解决这个问题。<br>YUM是Yellow dog Updater, Modified的缩写，是由Duke University所发起的计划，目的就是为了解决RPM的依赖关系的问题，方便使用者进行软件的安装、升级等等工作。在此在特别说明的是，YUM只是为了解决RPM的依赖关系的问题，而不是一种其它的软件安装模式。当然可以实现这样功能的除了YUM外，还有APT (Advanced Package Tool，是由debian所发展的一个软件管理工具)。<br>其实YUM的工作原理并不复杂，每一个 RPM软件的头（header）里面都会纪录该软件的依赖关系，那么如果可以将该头的内容纪录下来并且进行分析，可以知道每个软件在安装之前需要额外安装哪些基础软件。也就是说，在服务器上面先以分析工具将所有的RPM档案进行分析，然后将该分析纪录下来，只要在进行安装或升级时先查询该纪录的文件，就可以知道所有相关联的软件。所以YUM的基本工作流程如下：<br>服务器端：在服务器上面存放了所有的RPM软件包，然后以相关的功能去分析每个RPM文件的依赖性关系，将这些数据记录成文件存放在服务器的某特定目录内。 <br>客户端：如果需要安装某个软件时，先下载服务器上面记录的依赖性关系文件(可通过WWW或FTP方式)，通过对服务器端下载的纪录数据进行分析，然后取得所有相关的软件，一次全部下载下来进行安装。 <br>在RHEL 5安装好后，在GNOME中打开“ApplicationsàAdd/Remove Software”时，如下图，怎么回事无法使用吗？不是的，因为只有正常的配置的YUM客户端后才可以在这里安装软件。<br><a href="http://new.51cto.com/files/uploadimg/20081229/111917915.gif" target="_blank"><wbr /><a href="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec42f30cfdfe932c5dfd7b76a24303c0e0a99d40e941765b2ae9aaaf0474ad16ceb773e76186924ee7b44cd4c4aabb626eaa7b68fdba9ca1ffb3b60da9d10705e587eb0b7d&amp;a=12&amp;b=25" target="_blank"><img style="width:498px;height:550px;border:0;" src="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec42f30cfdfe932c5dfd7b76a24303c0e0a99d40e941765b2ae9aaaf0474ad16ceb773e76186924ee7b44cd4c4aabb626eaa7b68fdba9ca1ffb3b60da9d10705e587eb0b7d&amp;a=12&amp;b=25" /></a><wbr /></a><wbr /><br>下面将分别讲述如果配置YUM服务端及客户端。<br><span style="font-weight:bold"><wbr />一、配置YUM服务器。</span><wbr /> <br><span style="font-family:'楷体_GB2312';line-height:1.8em;">1.安装vsftpd服务，并配置为自动启动(配置为自动启动时，除使用下图中方法外还可直接使用chkconfig vsftpd on)。</span><wbr /> <br><a href="http://new.51cto.com/files/uploadimg/20081229/112108249.gif" target="_blank"><wbr /><a href="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec4012d68f30f2f406e2207fac132474dd72a8e6aba86ffbc676633db5bfca4c72ca90eab8e3736f9a58784767680f17992b6e446092a210d839a064fe0461a8adc927c20e&amp;a=24&amp;b=25" target="_blank"><img style="width:498px;height:120px;border:0;" src="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec4012d68f30f2f406e2207fac132474dd72a8e6aba86ffbc676633db5bfca4c72ca90eab8e3736f9a58784767680f17992b6e446092a210d839a064fe0461a8adc927c20e&amp;a=24&amp;b=25" /></a><wbr /></a><wbr /><br><span style="font-family:'楷体_GB2312';line-height:1.8em;">2.将RHEL 5光盘中的Server、VT、Cluster、ClusterStorage四个目录复制到/var/ftp/pub下（如不使用虚拟化及群集后三个目录可不复制）。</span><wbr /><br><a href="http://new.51cto.com/files/uploadimg/20081229/112137322.gif" target="_blank"><wbr /><a href="http://b12.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efecb082f00bd609b453ea091dc28823e7fe212e04a49614fb79ea10b261ca41cb93040b18adabab65bd39940e53db249e4b6cec1ba030f807e552dbf2d485a19a75899edd77&amp;a=25&amp;b=12" target="_blank"><img style="width:466px;height:140px;border:0;" src="http://b12.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efecb082f00bd609b453ea091dc28823e7fe212e04a49614fb79ea10b261ca41cb93040b18adabab65bd39940e53db249e4b6cec1ba030f807e552dbf2d485a19a75899edd77&amp;a=25&amp;b=12" /></a><wbr /></a><wbr /><br><span style="font-family:'楷体_GB2312';line-height:1.8em;">3.确认系统中安装yum(在RHEL 5是已默认安装)、createrepo(用于生成rpm依赖关系及组信息)包。</span><wbr /><br><a href="http://new.51cto.com/files/uploadimg/20081229/112222418.gif" target="_blank"><wbr /><a href="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec085db2ea126519378a814f351314bd7331342ca48d179beb85f71a5348a5f0868da1dc1d2a394d2b6f4650551e6ca58472423b8241fc5f90df98a0208237a8dd9ecfee17&amp;a=12&amp;b=25" target="_blank"><img style="width:498px;height:191px;border:0;" src="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec085db2ea126519378a814f351314bd7331342ca48d179beb85f71a5348a5f0868da1dc1d2a394d2b6f4650551e6ca58472423b8241fc5f90df98a0208237a8dd9ecfee17&amp;a=12&amp;b=25" /></a><wbr /></a><wbr /><br><span style="font-weight:bold"><wbr />二、建立分组文件</span><wbr /> <br>在RHEL 5中每个目录下的repodata目录下都有一个repomd.xml，该文件中就记录了rpm包的依赖关系，还有一个comps-rhel5-*.xml文件，这个文件主要记录分组情况，建立yum仓库时，需要先重建该文件。需要重建的目录有：<br><a href="http://new.51cto.com/files/uploadimg/20081229/112315359.gif" target="_blank"><wbr /><a href="http://b24.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec50f3f6cce9e0adcf6045e09f6f6e93495a6a6b7614c5378889b59822ee754b96f4f02a63128e839c6c43199ea175893dc78f72c9a8be1feadda825e910d7ed323e85e408&amp;a=25&amp;b=24" target="_blank"><img style="width:462px;height:104px;border:0;" src="http://b24.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec50f3f6cce9e0adcf6045e09f6f6e93495a6a6b7614c5378889b59822ee754b96f4f02a63128e839c6c43199ea175893dc78f72c9a8be1feadda825e910d7ed323e85e408&amp;a=25&amp;b=24" /></a><wbr /></a><wbr /><br>重建命令如下：<br><a href="http://new.51cto.com/files/uploadimg/20081229/112335460.gif" target="_blank"><wbr /><a href="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efecf0f27308453912e149a7754c78fa9ec9e91b2482b13edd5c7aae5223d9541522a7423453514fa1508527880a1d9fd65a7d61d0104b99fbcde3f8ea4b5bcda470b9d3ecf7&amp;a=25&amp;b=25" target="_blank"><img style="width:498px;height:274px;border:0;" src="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efecf0f27308453912e149a7754c78fa9ec9e91b2482b13edd5c7aae5223d9541522a7423453514fa1508527880a1d9fd65a7d61d0104b99fbcde3f8ea4b5bcda470b9d3ecf7&amp;a=25&amp;b=25" /></a><wbr /></a><wbr /><br>①：<span style="color:#ff0000;line-height:1.8em;">用于重建的命令，这里一定要写绝对路径</span><wbr /><br>②：这是该命令的一个Bug<br>③：这时需要把这个目录手动删除<br>④：重新运行该命令<br>三、配置YUM客户端。 <br>1.将yum客户端定义库文件(/etc/yum.repos.d/rhel-debuginfo.repo)复制一份(名称任意，但必须以.repo结尾)修改其bashurl及名称即可。<br><a href="http://new.51cto.com/files/uploadimg/20081229/112439461.gif" target="_blank"><wbr /><a href="http://b12.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec9498f6cd1f189e70426ca2bb1ae68541a330b2d1998f83c70d7064f7cf838f6789d63589f2445cf3cff7c9fe688251783920fad93a58a3b5d113ddc9f014eb5bd66975ef&amp;a=25&amp;b=12" target="_blank"><img style="width:498px;height:514px;border:0;" src="http://b12.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec9498f6cd1f189e70426ca2bb1ae68541a330b2d1998f83c70d7064f7cf838f6789d63589f2445cf3cff7c9fe688251783920fad93a58a3b5d113ddc9f014eb5bd66975ef&amp;a=25&amp;b=12" /></a><wbr /></a><wbr /><br><span style="font-family:'楷体_GB2312';line-height:1.8em;">2.清除yum缓存</span><wbr /><br><a href="http://new.51cto.com/files/uploadimg/20081229/112530256.gif" target="_blank"><wbr /><a href="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec0190b6883acdf0687a484810cc7a1a7cc02849f386dd9b811ec5a5d6dc86c5771ff47ce5f5a030d0b54c2670982ac657596fd8c5da3262036b96036cad9a2051edee4f6f&amp;a=12&amp;b=25" target="_blank"><img style="width:373px;height:122px;border:0;" src="http://b25.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1ae9db10f9157b7ee709424998d5efec0190b6883acdf0687a484810cc7a1a7cc02849f386dd9b811ec5a5d6dc86c5771ff47ce5f5a030d0b54c2670982ac657596fd8c5da3262036b96036cad9a2051edee4f6f&amp;a=12&amp;b=25" /></a><wbr /></a><wbr /><br><span style="font-weight:bold"><wbr />四、YUM客户端常用命令。</span><wbr /><br><span style="font-family:'Arial';line-height:1.8em;">yum install [-y] package</span><wbr /><br>通过yum服务器安装指定包<br>●-y：不提示用户确认直接安装 <br><span style="font-family:'Arial';line-height:1.8em;">yum localinstall rpmfile</span><wbr /><br>install与localinstall的区别：install直接通过yum服务器端安装指定包及所有依赖关系，而localinstall是本地已有rpm文件，只要到yum服务器上安装依赖关系。<br><span style="font-family:'Arial';line-height:1.8em;">yum grouplist</span><wbr /><br>显示所有yum服务器定义的组<br><span style="font-family:'Arial';line-height:1.8em;">yum groupinstall packagegroup</span><wbr /><br>一次性安装yum服务器上定义的一组包<br><span style="font-family:'Arial';line-height:1.8em;">yum remove [-y] package</span><wbr /><br>通过yum服务器安装指定包<br>●-y：不提示用户确认直接删除 <br><span style="font-family:'Arial';line-height:1.8em;">yum groupremove packagegroup</span><wbr /><br>一次性删除yum服务器上定义的一组包<br><span style="font-family:'Arial';line-height:1.8em;">yum list [all]</span><wbr /><br>列出yum服务器所有可用的包<br><span style="font-family:'Arial';line-height:1.8em;">yum info package</span><wbr /> <br>显示指定包信息<br><span style="font-family:'Arial';line-height:1.8em;">yum groupinfo grouppackgroup</span><wbr /><br>显示指定分组信息<br><span style="font-family:'Arial';line-height:1.8em;">yum clean all<br></span><wbr />清除yum缓存 <!--v:3.2--> ]]></description>
<category><![CDATA[技术文档]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258458220#comment</comments>
<qz:effect>134218241</qz:effect>
<pubDate>Tue, 17 Nov 2009 11:43:40 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258458220</guid>
</item>

<item>
<title><![CDATA[理财巧妙四组合+白领闲钱轻松理++]]></title>
<link>http://329226227.qzone.qq.com/blog/1258275664</link>
<description><![CDATA[     大学毕业后在跨国公司工作的李先生，面临着进修、购房、结婚生子等开支压力，在减少不必要支出的同时，李先生越发感到了理财投资的重要性，希望能通过合理的投资早日实现人生计划，但是同时，李先生又非常担心投资产生的风险会给自己带来损失。 <br><br>　　对此，业内专家丁国良表示：“相信大多数人在刚开始涉足投资时，都和李先生有同样的顾虑。其实，投资的过程中固然处处有风险，但只要采取正确的投资方法，还是有可能规避风险的。关键是如何根据个人的风险偏好，利用合理的资产组合来尽可能地规避风险。” <br><br>　　对于刚刚涉猎投资的李先生来说，建立资产组合的第一步是要对各类金融工具的特点和风险有所了解。丁国良介绍，金融工具从构成、收益来源到风险类别和高低各不相同。从产品的大类来看，一般来说，储蓄和债券的风险通常较低，股票的风险性较高，可转换债券的风险介于其间；基金的风险因具体产品的不同而不同；衍生产品类的风险最高。丁国良还特别提示，李先生在进行理财时，不能仅仅关注金融工具的收益率，还要和风险结合起来进行综合评价，根据自身的财务情况和风险承受能力，选择合适的金融工具。 <br><br>　　虽然低买高卖是投资的基本定律，但是像李先生这样的普通投资者往往很难准确预测某个时间段内哪类金融工具会表现强劲，哪类又会表现疲软。在同样的市场环境下，不同类别的金融工具的收益可能高低不同。丁国良认为，最好的方法就是通过合理的资产组合，把投资分摊到各种不同的金融工具上。 <br><br>　　丁国良认为，投资理财如同行军作战，二者都需要合理的策略。在瞬息万变的形势下，指挥官为了取得胜利，首先是保证自己的部队不被敌军消灭，两军对阵时有足够的兵力来应付突然袭击。犹如军队排兵布阵，合理配置资产才能在理财过程中防范风险、获取最佳效果。 <br><br>　　<span style="font-size:18px;line-height:1.8em;"><span style="color:#990000;line-height:1.8em;">一般来说，可以将资产配置分为以下四个类别。首先是防御型阵营：约占总资产40%的比例，如房产、现金、储蓄、保险等；其次是保守型阵营：约占总资产25%的比例，如黄金、国债等；第三是均衡型阵营，约占总资产20%的比例，如股票、基金、企业债券、收藏等；最后是攻占型阵营，约占总资产15%的比例，如外汇、期货等。</span><wbr /> </span><wbr /><br><br>　　防御型阵营的主要功能是防御，例如固定资产是生活资料，现金和储蓄是维持日常生活的基础，而保险则可以通过支出小额的费用来防止较大的损失，如火灾、车祸、疾病或其他意外事故。“我们不可能把大量的资金放在家里储备起来以备不测，牺牲很多的投资获利的机会，同样我们也不可能没有一点储备，把全部的资金押到市场上来博取利润，这样的话，一旦有意外事故发生，可能会导致整个投资计划破灭。”丁国良表示。 <br><br>　　保守型阵营注重资金的安全性，投资于具有保值功能的品种，如黄金、国债、债券基金等。资金贬值是财富积累的比较大的敌人，金钱的购买力会随着物价指数上涨而下降。保值是理财规划中基础的工作，因此，丁国良建议，这个部分在资产配置上应当占有一定的比例。 <br><br>　　均衡型阵营的功能是在一定的风险控制下进行一些投资项目，如购买蓝筹股、绩优股、企业债券等，以期取得收益，使资产稳步增值。理财规划中如果没有增值方案的话，那么资金将很难实现增长，也就失去了理财意义。但是丁国良建议，投资比例视自身实际情况而定，既不能冒进，也不能过分保守，应适可而止。 <br><br>　　攻占型阵营的主要功能是获取最大利润，争取最高收益，当然这要冒很大的风险。丁国良特别提出，没有好的风险承受能力的投资者不宜太多参与此类项目。尤其是没有很好的防御能力的资产结构，很容易遭到市场风险的冲击。 <br><br>　　（作者：崔吕萍） <br><br>　　注：本信息仅代表专家个人观点仅供参考，据此投资风险自负。 <br> <!--v:3.2--> ]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1258275664#comment</comments>
<qz:effect>134218240</qz:effect>
<pubDate>Sun, 15 Nov 2009 09:01:04 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1258275664</guid>
</item>

<item>
<title><![CDATA[[转]给Windows 7取一个中国名字：吻妻!]]></title>
<link>http://329226227.qzone.qq.com/blog/1256354254</link>
<description><![CDATA[给Windows 7取一个中国名字：吻妻!<br>　　文/毛启盈<br>　　国外媒体今天撰文称，微软将于美国当地时间22日上午推出最新操作系统Windows 7。刚刚看了微软MSN官方博客《必应封面故事：Windows 7不得不说的7件事》，觉得美国人多 “7的解读“七宗罪”的确有些不可理解。7的确不像“6”和“8”那样受到人们的青睐，但是，“7”在中国确是一个很与爱情相关的数字，大多人暗示“妻子”。如果微软是中国公司，肯定解释为“吻妻”。<br>　　在传统的中国文化中，“七”是神秘的，女娲用七天创造万物，天上有七仙女，太上老君炼丹需七七四十九天。其实，七仙女下凡也是不错的景象。7月7日是中国的情人节。其实，只不过是一个简单的数字，不要太八卦了。<br>　　其实，无论是叫Windows 7，还是8，还是6，还是“XP”，中国消费者尤其是做IT的大多不关注。消费者最关注的可以总结为以下几个特点：<br>　　第一，市场价格是不是很便宜，如果价格超出了农民工的消费范畴，盗版是不是可以照常使用，而不受到远在美国的微软的黑屏的惩罚;<br>　　第二，这款产品是否简单易用，是否Vista兼容性更强，是否降低高硬件配置，中文版本是否安全。<br>　　第三，据说Windows 7原计划至少要到2011年才能上市，现在突然提前了四年，是不是不完善的地方还很多?在与苹果、Google以及Linux等众多竞争对手的市场争夺中，市场份额到底能有多少?在短期内我们无法预测。<br>　　这里引用某媒体对三个竞争对手的最新动态分析：<br>　　苹果：2009年8月28日，苹果发布了新的雪豹(Snow Leopard)操作系统。雪豹赶在Windows 7之前发布，无疑是苹果来抢微软的风头，而且以软件升级的低价策略来动摇Windows用户的忠诚度。业界认为这是一个惯例，每当微软发布新的操作系统之时，苹果的Mac电脑总是会销量大增。目前，苹果的市场份额已经接近了两位数。<br>　　Linux：Linux操作系统在服务器市场始终是微软Windows最重要的竞争对手，但在PC和笔记本电脑领域却不及微软的一个零头，但上网本的出现给了Linux一个千载难逢的发展机会。由于微软对上网本的前景判断失误，Vista又无法在硬件配置较低的上网本上运行，导致Linux一度占据了90%以上的上网本市场。<br>　　Google：2009年7月8日，Google正式宣布将开发操作系统Chrome OS。这也意味着Google开始向微软的腹地发起进攻。有预测机构表示，到2011年时，Chrome OS系统占据上网本操作系统市场13%的份额。更有传闻，在Google的压力下，微软正打算推出Office的网络免费版。<br>　　其实，说到底，未来出了PC市场外，上网本还有手机操作系统，都是微软不能不考虑的领域。作为这个市场的垄断者地位，可能是草木皆兵，而追赶着只要一点有超越，对微软可能就是一个致命的打击。<br>　　虽然有些妒忌，但是还是很羡慕西方这些大佬，包括微软，苹果，Google，其实国产软件厂商金山公司经过了10多年的努力，终于上市，如果今晚它的名字被西方媒体拿来和Windows 7一同对比，这该是多么令人振奋的消息呀!<br>　　好啦，我要睡觉啦，当中国进入“吻妻”之时，西方刚刚晨曦初露。希望微软能够读懂中国!Windows 7远离“七宗罪”! <!--v:3.2--> ]]></description>
<category><![CDATA[个人日记]]></category>
<author><![CDATA[329226227@qq.com(有方/v)]]></author>
<comments>http://329226227.qzone.qq.com/blog/1256354254#comment</comments>
<qz:effect>136315400</qz:effect>
<pubDate>Sat, 24 Oct 2009 03:17:34 GMT</pubDate>
<guid>http://329226227.qzone.qq.com/blog/1256354254</guid>
</item>

</channel>
</rss>

