<< Tapestry5用Redirect-After-Post模式保证刷新和后退的安全 | 首页 | 四个Linux版本软件源的设置 >>

Fedora5中安装Nginx

注意:该文只能供参考在fedota安装Nginx时遇到的问题,如果版本是fedora5并且全部按照本文的做法,可能会

导致操作系统出现问题。

Fedora5中安装Nginx,绝对是件痛苦的事情,下面是痛苦的过程:

为了解决"Cannot find a valid baseurl for repo: core"问题,修改yum软件源:

对于Fedora,首先修改yum的软件源,使用速度比较快的国内镜像。按照以下修改/etc/yum.repos.d目录的下面fedora-core.repo,fedora-extras.repo和fedora-updates.repo这几个文件:

#/etc/yum.repos.d/fedora-core.repo
[core]
name=Fedora Core $releasever - $basearch - Base
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/fedora/updates/10/i386/
#baseurl=http://mirrors.geekbone.org/fedora/core/$releasever/$basearch/os/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
#/etc/yum.repos.d/fedora-extras.repo
[extras]
name=Fedora Extras $releasever - $basearch
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/fedora/updates/10/i386/
#baseurl=http://mirrors.geekbone.org/fedora/extras/$releasever/$basearch/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-extras-$releasever
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-extras
gpgcheck=1
#/etc/yum.repos.d/fedora-updates.repo
[updates]
name=Fedora Core $releasever - $basearch - Released Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/fedora/updates/10/i386/
#baseurl=http://mirrors.geekbone.org/fedora/core/updates/$releasever/$basearch/
#mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora


为了解决问题"g++: command not found",安装gcc-c++:
出现该情况是由于c++编译器的相关package没有安装,以root用户登陆,在终端上执行:
# yum install glibc-headers
# yum install gcc-c++

为了确保能在 Nginx 中使用正则表达式进行更灵活的配置,安装之前需要确定系统是否安装有 PCRE(Perl Compatible Regular Expressions)包。您可以到 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:

# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.7.tar.gz
# tar zxvf pcre-7.7.tar.gz
# cd pcre-7.7
# ./configure
# make
# make install
			

为了能使Nginx编译通过,解决"zlib.h 没有那个文件"问题,升级zlib,zlib-devel。

#Update the package deciding which yum repositories to use,Switch repositories:
rpm -Uhv http://mirror.liberty.edu/pub/fedora/linux/releases/10/Fedora/i386/os/Packages/fedora-release-10-1.noarch.rpm http://mirror.liberty.edu/pub/fedora/linux/releases/10/Fedora/i386/os/Packages/fedora-release-notes-10.0.0-1.noarch.rpm
yum install zlib-devel
yum install zlib
 

接下来安装 Nginx,Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /opt/nginx 目录下的详细步骤:

# wget http://sysoev.ru/nginx/nginx-0.6.36.tar.gz
# tar zxvf nginx-0.6.36.tar.gz
# cd nginx-0.6.31
# ./configure --with-http_stub_status_module –prefix=/opt/nginx
# make
# make install
			

其中参数 --with-http_stub_status_module 是为了启用 nginx 的 NginxStatus 功能,用来监控 Nginx 的当前状态。


附:
官方软件源:
http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Everything/i386/os/Packages/
清华大学软件源:
ftp://ftp3.tsinghua.edu.cn/mirror/fedora/updates/10/i386/



发表评论 发送引用通报