中标麒麟操作系统V6安装NGINX

原贴发表在我的个人博客haha.tk | Ha?Have a Talk!上,转载请注明出处,谢谢。

因为禾斗石开需要,安装了中标麒麟高级服务器操作系统(虚拟化版)V6,然后该系统上部署了几个JAVA WEB项目,现在需要安装nginx,但是yum无法使用,出现以下异常信息:

Loaded plugins: refresh-packagekit, security
http://****: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

修改yum源改为163

cd  /etc/yum.repos.d/
# 备份原有的源
mv ns6-gen-x86_64.repo ns6-gen-x86_64.repo.old
# 下载网易163的源
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo  
yum clean all
yum makecache

但在 yum makecache报错:

http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
尝试其他镜像。错误:Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

这是因为无法访问http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml,repomd.xmlhttp://mirrors.163.com/centos/6-6.5下已经不存在,需要更改CentOS-Base.repo此文件中的$releasever参数,对于CentOS来说,$releasever来源于 rpm -qi centos-release 的version数值。

# 查询中标麒麟系统的版本
cat /proc/version
Linux version 2.6.32-358.el6.x86_64 (mockbuild@ns60x64.cs2c.com.cn) (gcc version 4.4.7 20120313 (NeoKylin 4.4.7-3) (GCC) ) #1 SMP Fri Jul 12 10:25:19 CST 2013

对于中标麒麟高级服务器操作系统(虚拟化版)V6,经过测试,$releasever直接取 ** 6 ** 即可。

vim  CentOS-Base.repo
#vim命令模式下将所有的$releasever替换为6
:1,s/$releasever/6/g
# 再执行后续的指令
yum clean all
yum makecache

添加nginx的源

根据NGINX官方文档的安装方法:

To add NGINX yum repository, create a file named and paste one of the configurations below:

cd /etc/yum.repos.d/
# 新建nginx.repo文件
vim nginx.repo
# 填写以下内容
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1

注意:$releasever$basearch需要根据系统来确定,中标麒麟高级服务器操作系统(虚拟化版)V6最后确定为http://nginx.org/packages/rhel/6/x86_64/

安装pcre

尝试安装yum install nginx, 安装nginx时报错,因为nginx的rewrite需要pcre库。

./configure: error: the HTTP rewrite module requires the PCRE library.

安装pcre-devel解决问题

yum -y install pcre-devel

重新安装nginx依然出现错误提示:

./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.   You can either disable the module by using
–without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
–with-http_ssl_module –with-openssl=<path> options.

安装openssl相关软件:

yum -y install openssl openssl-devel

安装pcre:

# 下载相应版本的pcre
pcre-8.39.tar.bz2
# 解包解压缩
tar xjpf pcre-8.39.tar.bz2
# 切换到pcre的目录
cd pcre-7.8
# 配置
./configure --prefix=/usr/local/pcre-8.39 --libdir=/usr/local/lib/pcre --includedir=/usr/local/include/pcre

configure有许多参数可配,具体参见./configure –help及手册

# 编译及安装
make
make install

安装nginx

最后尝试安装yum install nginx,完成。

参考

解决centos 6.6 更换yum 163源报错

CentOS镜像使用帮助

Install

PCRE-nginx pcre library not found

转载于:https://my.oschina.net/thau/blog/825044

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值