So Tired !_! 逆水行舟, 不进则退!

26Dec/12

Install Nginx/PHP-FPM on Fedora 17/16, CentOS/RHEL 6.3/5.8

Posted by Nick Xu

I have once written Install nginx, PHP 5.3 and FastCGI on CentOS 5.5, Fedora 13, Red Hat RHEL 5.5/6 guide, but this guide is “updated” version, howto install Nginx with PHP 5.4.10 and PHP-FPM on Fedora 17/16/15/14, CentOS 6.3/6.2/6.1/6/5.8 and Red Hat (RHEL) 6.3/6.2/6.1/6/5.8. PHP-FPM is easier to use and configure than FastCGI and some tests says that PHP-FPM is even much more efficient than FastCGI.

Nginx (engine x) is a robust, small and high performance http server, reverse proxy server and also mail proxy server.

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

Install Nginx, PHP 5.4.10 and PHP-FPM on Fedora 17/16/15/14, CentOS 6.3/6.2/6.1/6/5.8, Red Hat (RHEL) 6.3/6.2/6.1/6/5.8

1. Change to root user.

sudo -i
## OR ##
su -

2. Install needed repositories

Fedora 17/16/15/14 Remi repository

## Remi Dependency on Fedora 17, 16
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm 
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

## Fedora 17 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm

## Fedora 16 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm

## Fedora 15 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm

## Fedora 14 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm

CentOS 6.3/6.2/6.1/6/5.8 and Red Hat (RHEL) 6.3/6.2/6.1/6/5.8 Remi repository

## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm

## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

## CentOS 5 and Red Hat (RHEL) 5 ## 
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

CentOS 6.3/6.2/6.1/6/5.8 and Red Hat (RHEL) 6.3/6.2/6.1/6/5.8 Nginx repository

Create file /etc/yum.repos.d/nginx.repo and add following content to repo file:
CentOS

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

Red Hat (RHEL)

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1

3. Install Nginx, PHP 5.4.10 and PHP-FPM

Fedora 17/16/15/14, CentOS 6.3/5.8 and Red Hat (RHEL) 6.3/5.8

yum --enablerepo=remi install nginx php php-fpm php-common

CentOS 6.3/5.8 and Red Hat (RHEL) 6.3/5.8

yum --enablerepo=remi,remi-test install nginx php php-fpm php-common

4. Install PHP 5.4.10 modules

  • APC (php-pecl-apc) – APC caches and optimizes PHP intermediate code
  • CLI (php-cli) – Command-line interface for PHP
  • PEAR (php-pear) – PHP Extension and Application Repository framework
  • PDO (php-pdo) – A database access abstraction module for PHP applications
  • MySQL (php-mysql) – A module for PHP applications that use MySQL databases
  • PostgreSQL (php-pgsql) – A PostgreSQL database module for PHP
  • MongoDB (php-pecl-mongo) – PHP MongoDB database driver
  • SQLite (php-sqlite) – Extension for the SQLite V2 Embeddable SQL Database Engine
  • Memcache (php-pecl-memcache) – Extension to work with the Memcached caching daemon
  • Memcached (php-pecl-memcached) – Extension to work with the Memcached caching daemon
  • GD (php-gd) – A module for PHP applications for using the gd graphics library
  • XML (php-xml) – A module for PHP applications which use XML
  • MBString (php-mbstring) – A module for PHP applications which need multi-byte string handling
  • MCrypt (php-mcrypt) – Standard PHP module provides mcrypt library support

Select what you need: APC, CLI, PEAR, PDO, MySQL, PostgreSQL, MongoDB, SQLite, Memcache, Memcached, GD, MBString, MCrypt, XML

More info about PHP APC from PHP APC Configuration and Usage Tips and Tricks

Fedora 17/16/15/14

yum --enablerepo=remi install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

CentOS 6.3/5.8 and Red Hat (RHEL) 6.3/5.8

yum --enablerepo=remi,remi-test install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

5. Stop httpd (Apache) server, Start Nginx HTTP server and PHP-FPM (FastCGI Process Manager)

Stop httpd (Apache)

/etc/init.d/httpd stop
## OR ##
service httpd stop

Start Nginx

/etc/init.d/nginx start ## use restart after update
## OR ##
service nginx start ## use restart after update

Start PHP-FPM

/etc/init.d/php-fpm start ## use restart after update
## OR ##
service php-fpm start ## use restart after update

6. Autostart Nginx and PHP-FPM on boot, also prevent httpd (Apache) autostarting on boot

Prevent httpd (Apache) autostarting on boot

chkconfig httpd off

Autostart Nginx on boot

chkconfig --add nginx
chkconfig --levels 235 nginx on

Autostart PHP-FPM on boot

chkconfig --add php-fpm
chkconfig --levels 235 php-fpm on

7. Configure Nginx and PHP-FPM

Create directory layout for your site

I use here testsite.local site, but this could of course be your real site, like www.if-not-true-then-false.com.

## public_html directory and logs directory ##
mkdir -p /srv/www/testsite.local/public_html
mkdir /srv/www/testsite.local/logs
chown -R apache:apache /srv/www/testsite.local

Alternative setup to add logs under /var/log directory.

## public_html directory and logs directory ##
mkdir -p /srv/www/testsite.local/public_html
mkdir -p /var/log/nginx/testsite.local
chown -R apache:apache /srv/www/testsite.local
chown -R nginx:nginx /var/log/nginx

Note: I use apache user and group here, because PHP-FPM runs as apache default (apache choosed to be able to access some dir as httpd). If you use some other user on your php-fpm conf then change this accordingly.

Create and configure virtual host directories under /etc/nginx

mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled

Add following lines to /etc/nginx/nginx.conf file, after “include /etc/nginx/conf.d/*.conf” line (inside http block).

## Load virtual host conf files. ##
include /etc/nginx/sites-enabled/*;

Create testsite.local virtual host file

Add following content to /etc/nginx/sites-available/testsite.local file. This is very basic virtual host config.

server {
    server_name testsite.local;
    access_log /srv/www/testsite.local/logs/access.log;
    error_log /srv/www/testsite.local/logs/error.log;
    root /srv/www/testsite.local/public_html;

    location / {
        index index.html index.htm index.php;
    }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/testsite.local/public_html$fastcgi_script_name;
    }
}

Link your virtual host to /etc/nginx/sites-enabled

cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/testsite.local
service nginx restart

Add your testsite.local “domain” to /etc/hosts file

/etc/hosts file Nginx on same machine
127.0.0.1 … row should look like example following:

127.0.0.1               localhost.localdomain localhost testsite.local

And if you use another machine where you are running your Nginx server, then add it’s public IP as following:

10.0.2.19               wordpress

Note: This is just very simple basic configuration, but if you want configure and optimize Nginx and PHP-FPM more then check following guide, Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks

8. Test your Nginx and PHP-FPM setup

Create /srv/www/testsite.local/public_html/index.php file with following content:

<?php 
    phpinfo();
?>

Access following address, with your browser. http://testsite.local/
Nginx PHP 5.4.4 PHP-FPM

Enable Remote Connection to Nginx Web Server (Open Port 80 on Iptables Firewall)

1. Edit /etc/sysconfig/iptables file:

nano -w /etc/sysconfig/iptables

2. Add following line before COMMIT:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

3. Restart Iptables Firewall:

service iptables restart
## OR ##
/etc/init.d/iptables restart

4. Test remote connection

Access following address, with your browser. http://your.domain/

Tagged as: , , No Comments
26Dec/12

redhat 6 配置 yum 源的两种方法

Posted by Nick Xu

由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源.

本文包括配置本地源及第三方源。第三方源包括:网易,epel,repoforge ,rpmfusion 以下为详细过程:

1.删除redhat原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps

2.下载yum安装文件

注意,如果下载时找不到文件,就登录到:http://mirrors.163.com/centos/6/os/x86_64/ 上查找相应的文件。然后再下载。

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

3.进行安装yum

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm
rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm um-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
注意最后两个包必需同时安装,否则会相互依赖
----------配置网易源
4.更新repo文件

mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.repo.bak

vi /etc/yum.repos.d/rhel-debuginfo.repo

内容为:

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6.0/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6.0/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6.0/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6.0/centosplus/$basearch/
gpgcheck=1
enabled=0

5、yum clean all

6、yum install vim #测试一下可不可以用

--配置epel源

Fedora EPEL 下载:http://mirrors.fedoraproject.org/publiclist/EPEL/

EPEL 下载地址:http://download.fedora.redhat.com/pub/epel/

以上网直可能不 可用,此时,登录到下面的地址:

https://fedoraproject.org/wiki/EPEL

查找:“How can I use these extra packages?”

在该条目内可以找到: The newest version of 'epel-release' for (版本)

下载epel包。再执行安装。

请针对不同的版本下载相应的包。

 

--配置repoforge源

rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum makecache

--配置rpmfusion源

RPMFusion官网:http://rpmfusion.org/

Fedora 13, 14 and 15:

su -c ’yum localinstall –nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.

noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm’

RHEL 6/CentOS 6 :

su -c ’rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/6/i386/rpmfusion-nonfree-release-6-0.1.noarch.rpm’


【设置本地镜像作为yum源】

1、mkdir /mnt/cdrom

2   mount /dev/cdrom /mnt/cdrom  #挂着镜像,光盘

3  mkdir /home/redhat-iso

4  cp -Rf /mnt/cdrom/* /home/redhat-iso   #将光盘内的内容copy到某个路径下

5  vi /etc/yum.repos.d/rhel-debuginfo.repo  #编辑repo文件

添加一下内容:

[rhel_6_iso]
name=local iso
baseurl=file:///home/redhat-iso/
gpgcheck=1
gpgkey=file:///home/redhat-iso/RPM-GPG-KEY-CentOS-6  #该处的gpgkey文件应该改成iso镜像中的文件名

 

 

【关于yum的一点资料】

 

一、YUM是什么
YUM = Yellow dog Updater, Modified
主要功能是更方便的添加/删除/更新RPM包.
它能自动解决包的倚赖性问题.
它能便于管理大量系统的更新问题
二、 YUM特点
*可以同时配置多个资源库(Repository)
*简洁的配置文件(/etc/YUM.conf,/etc/YUM.repos.d 下的文件)
*自动解决增加或删除rpm包时遇到的倚赖性问题
*使用方便
*保持与RPM数据库的一致性

三、 YUM安装
Centos/RHEL
1. #rpm -ivh yum-2.4.3-4.el4.centos.noarch.rpm

四、YUM配置
YUM的配置文件
YUM的一切配置信息都储存在一个叫YUM.conf的配置文件中,通常位于/etc目 录下,这是整个YUM系统的重中之重,所以有必要详细介绍。下面是一个从网上找来的YUM.con文件,让我们以此为例,进行说明。

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=1[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://download.atrpms.net/mirrors/fedoracore/$releasever/$basearch/os
http://rpmfind.net/linux/fedora/cor...er/$basearch/os
http://mirror.clarkson.edu/pub/dist...er/$basearch/os

[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
baseurl=http://download.atrpms.net/mirrors/fedoracore/updates/$releasever/$basearch
http://redhat.linux.ee/pub/fedora/l...sever/$basearch
http://fr2.rpmfind.net/linux/fedora...sever/$basearch

[Fedora.us]
name=Fedora.us - $basearch - Extras
baseurl=http://fedora.linux.duke.edu/fedorax86_64/fedora.us/$releasever/$basearch/RPMS.stable

[Dag Wieers]
name=Dag RPM Repository for Fedora Core
baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag

[Livna]
Name=Livna RPM, Fedora Core $releasever - $basearch
baseurl=http://rpm.livna.org/fedora/$releasever/$basearch/RPMS.stable

[freshrpms]
name=FreshRPMs
baseurl=http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms/
http://ftp.us2.freshrpms.net/linux/...arch/freshrpms/

第一部分(这是YUM的全局性设置。默认一般不必改动。)

[main]

cachedir:YUM缓存的目录,YUM在此存储下载的rpm包和数据库,一般是/var/cache/YUM。
debuglevel:除错级别,0-10,默认是2。
logfile:YUM的日志文件,默认是/var/log/YUM.log。
pkgpolicy:包的策略。一共有两个选项,newest和last,这个作用是如果你设置了多个repository,而同一软件在不同的repository中同时存在,YUM应该安装哪一个,如果是newest,则YUM会安装最新的那个版本。如果是last,则YUM会将服务器id以字母表排序,并选择最后的那个服务器上的软件安装。一般都是选newest。
distroverpkg:指定一个软件包,YUM会根据这个包判断你的发行版本,默认是redhat-release,也可以是安装的任何针对自己发行版的rpm包。
exactarch,有两个选项1和0,代表是否只升级和你安装软件包cpu体系一致的包,如果设为1,则如你安装了一个i386的rpm,则YUM不会用1686的包来升级。
retries,网络连接发生错误后的重试次数,如果设为0,则会无限重试。
tolerent,也有1和0两个选项,表示YUM是否容忍命令行发生与软件包有关的错误,比如你要安装1,2,3三个包,而其中3此前已经安装了,如果你设为1,则YUM不会出现错误信息。默认是0。

除了上述之外,还有一些可以添加的选项,如

exclude=,排除某些软件在升级名单之外,可以用通配符,列表中各个项目要用空格隔开,这个对于安装了诸如美化包,中文补丁的朋友特别有用。
gpgchkeck= 有1和0两个选择,分别代表是否是否进行gpg校验,如果没有这一项,默认好像也是检查的。

第二部分:

配置repository服务器了,这是最令人激动的,有了好的repository,就如家门口开了大卖场,要什么东西稍微跑跑腿就行,对了这还是个免费的大卖场。
所有服务器设置都应该遵循如下格式:

1. [serverid]
2. name=Some name for this server
3. baseurl=url://path/to/repository/

其中serverid是用于区别各个不同的repository,必须有一个独一无二的名称。
name,是对repository的描述,支持像$releasever $basearch这样的变量;
baseurl是服务器设置中最重要的部分,只有设置正确,才能从上面获取软件。它的格式是:

1. baseurl=url://server1/path/to/repository/
2. url://server2/path/to/repository/
3. url://server3/path/to/repository/

其中url支持的协议有 http:// ftp:// file://三种。baseurl后可以跟多个url,你可以自己改为速度比较快的镜像站,但baseurl只能有一个,也就是说不能像如下格式:

1. baseurl=url://server1/path/to/repository/
2. baseurl=url://server2/path/to/repository/
3. baseurl=url://server3/path/to/repository/

其中url指向的目录必须是这个repository header目录的上一级,它也支持$releasever $basearch这样的变量。
url之后可以加上多个选项,如gpgcheck、exclude、failovermethod等,比如:

1. [updates-released]
2. name=Fedora Core $releasever - $basearch - Released Updates
3. baseurl=http://download.atrpms.net/mirrors/fedoracore/updates/$releasever/$basearch
4. http://redhat.linux.ee/pub/fedora/linux/core/updates/$releasever/$basearch
5. http://fr2.rpmfind.net/linux/fedora/core/updates/$releasever/$basearch
6. gpgcheck=1
7. exclude=gaim
8. failovermethod=priority

其中gpgcheck,exclude的含义和[main]部分相同,但只对此服务器起作用,failovermethode 有两个选项roundrobin和priority,意思分别是有多个url可供选择时,YUM选择的次序,roundrobin是随机选择,如果连接失 败则使用下一个,依次循环,priority则根据url的次序从第一个开始。如果不指明,默认是roundrobin。

几个变量

$releasever,发行版的版本,从[main]部分的distroverpkg获取,如果没有,则根据redhat-release包进行判断。
$arch,cpu体系,如i686,athlon等
$basearch,cpu的基本体系组,如i686和athlon同属i386,alpha和alphaev6同属alpha。

对YUM.conf设定完成,我们就可以好好体验YUM带来的方便了。

五、RHEL/CENTOS的YUM源

1、修改配置文件

2、导入GPG KEY

导入每个reposity的GPG key,前面说过,YUM可以使用gpg对包进行校验,确保下载包的完整性,所以我们先要到各个repository站点找到gpg key,一般都会放在首页的醒目位置,一些名字诸如 RPM-GPG-KEY.txt之类的纯文本文件,把它们下载,然后用rpm --import xxx.txt命令将它们导入,最好把发行版自带GPG-KEY也导入。rpm --import /usr/share/doc/redhat-release-*/RPM-GPG-KEY 官方软件升级用的上。

六、扩展你的rpm包

1、rpmforge

Centos/RHEL默认的yum软件仓库非常有限,仅仅限于发行版本那几张盘里面的常规包和一些软件包的更新,利用RpmForge,可以增加非常多的第三方rpm软件包。

获取

http://dag.wieers.com/rpm/packages/rpmforge-release/

找到与系统平台架构匹配的rpmforge包安装之即可。安装完后.默认会在系统的/etc/yum.repos.d/下新增两个文件,mirrors-rpmforge和rpmforge.repo

安装

1. # rpm -ivh rpmforge-release-0.3.6-1.el4.rf.i386.rpm
2. # rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

2、加速YUM更新速度

安装YUM的fast mirror插件,可以加快 CentOS/RHEL YUM的速度和提高稳定性,效果显著。

centos5

1. #yum -y install yum-fastestmirror

centos4

1. yum -y install yum-plugin-fastestmirror
七、 YUM使用

注:当第一次使用YUM或YUM资源库有更新时,YUM会自动下载所有所需的headers放置于/var/cache/YUM目录下,所需时间可能较长.

系统更新(更新所有可以升级的rpm包,包括kernel)

1. #YUM -y update

每天定期执行系统更新

1. #chkconfig YUM on
2. #service YUM start

*rpm包的更新

检查可更新的rpm包

1. #YUM check-update

更新所有的rpm包

1. #YUM update

更新指定的rpm包,如更新kernel和kernel source

1. #YUM update kernel kernel-source

大规模的版本升级,与YUM update不同的是,连旧的淘汰的包也升级

1. #YUM upgrade

*rpm包的安装和删除

安装rpm包,如xmms-mp3

1. #YUM install xmms-mp3

删除rpm包,包括与该包有倚赖性的包

1. #YUM remove licq

注:同时会提示删除licq-gnome,licq-qt,licq-text

*YUM暂存(/var/cache/YUM/)的相关参数

清除暂存中rpm包文件

1. #YUM clean packages

清除暂存中rpm头文件

1. #YUM clean headers

清除暂存中旧的rpm头文件

1. #YUM clean oldheaders

清除暂存中旧的rpm头文件和包文件

1. #YUM clean 或#YUM clean all

注:相当于YUM clean packages + YUM clean oldheaders

*rpm包列表

列出资源库中所有可以安装或更新的rpm包

1. #YUM list

列出资源库中特定的可以安装或更新以及已经安装的rpm包

1. #YUM list mozilla
2. #YUM list mozilla*

注:可以在rpm包名中使用匹配符,如列出所有以mozilla开头的rpm包

列出资源库中所有可以更新的rpm包

1. #YUM list updates

列出已经安装的所有的rpm包

1. #YUM list installed

列出已经安装的但是不包含在资源库中的rpm包

1. #YUM list extras

注:通过其它网站下载安装的rpm包

*rpm包信息显示(info参数同list)

列出资源库中所有可以安装或更新的rpm包的信息

1. #YUM info

列出资源库中特定的可以安装或更新以及已经安装的rpm包的信息

1. #YUM info mozilla
2. #YUM info mozilla*

注:可以在rpm包名中使用匹配符,如列出所有以mozilla开头的rpm包的信息

列出资源库中所有可以更新的rpm包的信息

1. #YUM info updates

列出已经安装的所有的rpm包的信息

1. #YUM info installed

列出已经安装的但是不包含在资源库中的rpm包的信息

1. #YUM info extras

注:通过其它网站下载安装的rpm包的信息

*搜索rpm包

搜索匹配特定字符的rpm包

1. #YUM search mozilla

注:在rpm包名,包描述等中搜索

搜索有包含特定文件名的rpm包

1. #YUM provides realplay

八、YUM常用问题解决

1、如果网速慢的话可以通过增加YUM的超时时间,这样就不会总是因为超时而退出。

1. #vi /etc/YUM.conf
2. #加上这么一句
3. timeout=120

2、YUM Existing lock错误的解决办法

如果系统启动的时候, YUM出现Existing lock /var/run/YUM.pid: another copy is running as pid 3380. Aborting.可以用下面的办法解决:

方法一

1. etc/init.d/YUM-updatesd stop

方法二

1. #rm -f /var/run/YUM.pid

主要原因就是YUM在自动更新,只要关掉它就可以了。

   
site
site