Redhat和相关发行版(fedora,centos)将其源代码保存在高度规则的目录树中.对于您想要的RHEL5:ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/对于其他版本,您可以浏览ftp服务器,直到找到您想要的内容.否则,谷歌搜索你有的确切版本的nginx(rpm -q nginx)
假设您可以找到srpm,请使用rpm安装它:
rpm -ivh nginx-xxxx.src.rpm
Run Code Online (Sandbox Code Playgroud)
这将把源和构建文件放入/usr/src/redhat/{BUILD,SPEC,SRC,SOURCES}.您可以修改.spec文件/usr/src/redhat/SPEC以构建所需的模块以及其余的nginx,也可以手动构建nginx.
你想建立哪个模块?在fedora的nginx.spec中,configure运行时指定了几个模块.这可能就像在这里添加一行一样简单:
./configure \
[snip...]
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_perl_module \
[snip...]
Run Code Online (Sandbox Code Playgroud)
加入任何更改后nginx.spec,您可以建立最终rpm用rpmbuild:
rpmbuild -ba nginx.spec
Run Code Online (Sandbox Code Playgroud)
假设包构建没有错误,rpmbuild将保留它 /usr/src/redhat/RPMS/
更新: yum将在更新可用时替换您的nginx包.您可能希望使用与上面相同的过程重建每个新包.但是,如果安全性不是问题,您可以通过在yum配置中添加以下内容(可能/etc/yum.repos.d/${repo}.repo或类似地)将nginx从更新列表中简单排除.确保将其与正确的repo相关联:
exclude=nginx*
Run Code Online (Sandbox Code Playgroud)
或者使用--exclude选项运行yum
yum --exclude=nginx*
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2936 次 |
| 最近记录: |