RHEL5.4利用centos yum进行更新

[不指定 2010/06/11 22:18 | by admin ]
1.rhel5系统安装的时候其实已经有yum了,刚安装redhat就可以在终端敲入yum,只是会提示没有注册
This system is not registered with RHN.
RHN support will be disabled.
只是因为如果用官方的网站更新的话除非你是用钱买的rhel5.否则它会提示注册之类的。
当然用[root@localhost Desktop]#yum update当然也是不行的
因此,我试着在网上找一些方法来实现yum自动更新,有的网站说利用CentOS的yum更新源,但需要删掉RedHat 5本来的yum,我先利用rpm -qa | grep yum找到所有yum文件,然后又用rpm -e命令删除
rpm -e yum-metadata-parser-1.1.2-3.el5
rpm -e yum-3.2.22-20.el5
rpm -e yum-updatesd-0.9-2.el5
rpm -e yum-rhn-plugin-0.5.4-13.el5
rpm -e yum-security-1.1.16-13.el5
因为依赖性,实际删除的文件不止这么几个
于是再恢复安装RedHat 5本来的yum,于是在光盘里面找,于是将删掉的文件又重新安装上去了,主要是:
yum-3.2.22-20.el5
安装好以后在命令行敲入yum,终于有可以找到它了,呵呵
2. 修改源配置文件 #gedit /etc/yum.repos.d/CentOS-Base.repo
在其中加入以下内容
[base]
name=CentOS-5-Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#released updates
[update]
name=CentOS-5-Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build but not released
[addons]
name=CentOS-5-Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=CentOS-5-Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5-Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5-Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
# vi dag.repo
[dag]
name=Dag RPM Repository for RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
3. 导入key
#rpm --import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
4. 运行,测试
#yum list vsftpd
5.如果结果出现错误:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
GPG key retrieval failed: [Errno 14] HTTP Error 404: Not Found
此时,将gpgcheck=1改成gpgcheck=0即可。
6. 运行,测试
#yum install vsftpd
能够正确安装上了,就是更新文件列表的速度相当慢。
Tags: ,
linux下查看nginx,apache,mysql,php的编译参数

1、nginx编译参数:
#/usr/local/nginx/sbin/nginx -V

2、apache编译参数:
# cat /usr/local/apache/build/config.nice

3、php编译参数:
# /usr/local/php/bin/php -i |grep configure

4、mysql编译参数:
# cat /usr/local/mysql/bin/mysqlbug|grep configure

lighttpd伪静态的配置

[不指定 2010/06/08 07:59 | by admin ]
伪静态:

一、以下为discuz7.2的伪静态为例
在lighttpd.conf里,查找#### CGI module
在下面加上:

#  $HTTP["host"] =~ "^192.168.0.2$" {
url.rewrite-once = (
"^(.*)/archiver/((fid|tid)-[w-]+.html)$" => "$1/archiver/index.php?$2",
"^(.*)/forum-([0-9]+)-([0-9]+).html$" => "$1/forumdisplay.php?fid=$2&page=$3",
"^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$" => "$1/viewthread.php?tid=$2&extra=page%3D$4&page=$3",
"^(.*)/space-(username|uid)-(.+).html$" => "$1/space.php?$2=$3",
"^(.*)/tag-(.+).html$" => "$1/tag.php?name=$2"
)
#}

重启lighttpd

二、以下为DZX伪静态,不支持子目录

url.rewrite-once = (

"^(.*)/topic-(.+)\.html$" =>

"/portal.php?mod=topic&topic=$2",

"^(.*)/article-([0-9]+)\.html$" =>

"/portal.php?mod=view&aid=$2",

"^(.*)/forum-(\w+)-([0-9]+)\.html$" =>

"/forum.php?mod=forumdisplay&fid=$2&page=$3",

"^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$"  => "/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3",

"^(.*)/group-([0-9]+)-([0-9]+)\.html$" =>

"/forum.php?mod=group&fid=$2&page=$3",

"^(.*)/space-(username|uid)-(.+)\.html$" =>

"/home.php?mod=space&$2=$3",

"^(.*)/([a-z]+)-(.+)\.html$" =>

"/$2.php?rewrite=$3"

)

三、以下为dzx通用目录规则,同时适用于主目录和子目录

url.rewrite-once = (

"^(.*)/topic-(.+)\.html$" =>

"$1/portal.php?mod=topic&topic=$2",

"^(.*)/article-([0-9]+)\.html$" =>

"$1/portal.php?mod=view&aid=$2",

"^(.*)/forum-(\w+)-([0-9]+)\.html$" =>

"$1/forum.php?mod=forumdisplay&fid=$2&page=$3",

"^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$"  =>
"$1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3",

"^(.*)/group-([0-9]+)-([0-9]+)\.html$" =>

"$1/forum.php?mod=group&fid=$2&page=$3",

"^(.*)/space-(username|uid)-(.+)\.html$" =>

"$1/home.php?mod=space&$2=$3",

"^(.*)/([a-z]+)-(.+)\.html$" =>

"$1/$2.php?rewrite=$3"

)

lighttpd虚拟主机的配置

[不指定 2010/06/08 07:58 | by admin ]
一、常规虚拟主机的配置

1、在lighttpd.conf最后加上如下代码:

$HTTP["host"] == "www.a.com" {
server.name = "www.a.com"
server.document-root = "/home/wwwroot/htdocs/a"
server.errorlog = "/var/log/lighttpd/www.a.com-error.log"
accesslog.filename = "/var/log/lighttpd/www.a.com-access.log"
}


$HTTP["host"] == "www.b.com" {
server.name = "www.b.com"
server.document-root = "/home/wwwroot/htdocs/b"
server.errorlog = "/var/log/lighttpd/www.b.com-error.log"
accesslog.filename = "/var/log/lighttpd/www.b.com-access.log"
}

2、另建lighttpd-vhost.conf,并在lighttpd.conf里调用
在lighttpd.conf最后加上:
include "/etc/lighttpd/lighttpd-vhost.conf"
新建的lighttpd-vhost.conf内容为:

$HTTP["host"] == "www.a.com" {
server.name = "www.a.com"
server.document-root = "/home/wwwroot/htdocs/a"
server.errorlog = "/var/log/lighttpd/www.a.com-error.log"
accesslog.filename = "/var/log/lighttpd/www.a.com-access.log"
}


$HTTP["host"] == "www.b.com" {
server.name = "www.b.com"
server.document-root = "/home/wwwroot/htdocs/b"
server.errorlog = "/var/log/lighttpd/www.b.com-error.log"
accesslog.filename = "/var/log/lighttpd/www.b.com-access.log"
}

我喜欢用这种方法,文件较简洁,虚拟主机配置全部放入单独的lighttpd-vhost.conf文件,这种方法是参考apache虚拟主机而改来的,在nginx下同样适用。

二、简单虚拟主机

简单的虚拟主机需要使用mod_simple_vhost模块.它的特点是简单的就可以绑定域名,但是如果在商业运作当中,这样也是有很大隐患!在这里只需要将这个模块添加到server.modules中,即:

server.modules              = (
...
"mod_simple_vhost",
...
)

一个完整的document root由三个值server-root、hostname、document-root决定
我们可以这样设定:

simple-vhost.server-root         = "/var/www"
simple-vhost.document-root       = "/public_html/"

Sponsored Links
如果按照以上这样设定,那么我们便可以很方便的绑定多个域名到服务器,只需要在/var/www目录添加文件夹,文件夹就输入需要绑定的域名,然后进入文件夹,在里面建立public_html文件夹就可以实现绑定了.那么完整的路径便是

/var/www/www.xmlchina.org/public_html


三、复杂虚拟设置匹配

复杂虚拟设置匹配,在这里同样需要开启模块的支持,即在server.modules中添加mod_evhost即可,方法如上.

复杂虚拟设置匹配,一般可以用作泛域名解析用,它是使用正则进行匹配,如此便可以实现多子域名的绑定.

在lighttpd.conf中便有这一条的解释

# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
# evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"

那么我们可以按照官方的方法进行设置,下面是我的配置.

$HTTP["host"] =~ "www.xmlchina.org$" {
evhost.path-pattern        = "/var/www/%0/%3"
}

%0 = xmlchina.org
%3 = www
这里文档路径是/var/www/xmlchina.org/www

还可进行二级域名解析,如:

$HTTP["host"] =~ "^(.*).xmlchina.org$" {
evhost.path-pattern        = "/var/www/%0/%3"
}

%0 = xmlchina.org
%3 = 任意第二级域名前缀

复杂虚拟设置匹配可以实现可变目录的绑定,轻松解决多二级域名的解析难题

总结

这里提供的三个方法,各有各的好处.但是就服务器安全角度来说,建议使用第一条.原因嘛!慢慢琢磨啦.

分页: 9/13 第一页 上页 4 5 6 7 8 9 10 11 12 13 下页 最后页 [ 显示模式: 摘要 | 列表 ]