在linux red hat下安装nginx,nginx却依赖C++编译,没办法,只能先安装C吧,执行命令
yum -y install gcc
缺显示如下
[root@host nginx-1.10.3]# yum -y install gcc
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
No package gcc available.
Error: Nothing to do
[root@host nginx-1.10.3]# yum -y install gcc-c++
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
No package gcc-c++ available.
Error: Nothing to do
[root@host nginx-1.10.3]#
[root@host nginx-1.10.3]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Kernel \r on an \m
linux就有这样的好处,错误比较详细,稍微懂点英文都能看懂,细看一下错误,应该是企业版本,要先注册的意思吧!毕竟要掏钱,钱还没搞到,怎么能舍得,再说现在这个时代赚钱也不容易。不掏钱怎么办,做回屌丝吧,高富帅忽略。
按照网上的教程,先去http://mirrors.163.com/centos/下载依赖的包,但是最近打贸易战,里面的东西好像也没了,就只有一个readme,按照readme的内容,找到了他们的老家,大家可以去他的官网看看http://vault.centos.org/
是不是很熟悉?我查看了一下我的操作系统命令如下
[root@host nginx-1.10.3]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Kernel \r on an \m
服务器为6.7的,那我用centeros6.7的也可以吧,其实是按照网上的教程用6,但是找不到,就碰碰运气吧。
按照提示,下载如下几个包,我的包来源centeros6.7,其他的根据你们的实际情况来下载,好像6也差不多吧!地址为:
http://vault.centos.org/6.7/os/x86_64/Packages/
下载如下几个包
python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-urlgrabber-3.9.1-9.el6.noarch.rpm
yum-3.2.29-69.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
准备工作做完,先卸载原来的yum,高富帅要升级了
[root@host yuminstall]# rpm -qa|grep yum
yum-plugin-security-1.1.30-30.el6.noarch
yum-rhn-plugin-0.9.1-58.el6.noarch
PackageKit-yum-plugin-0.5.8-25.el6.x86_64
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-utils-1.1.30-30.el6.noarch
PackageKit-yum-0.5.8-25.el6.x86_64
yum-3.2.29-69.el6.noarch
[root@host yuminstall]# rpm -qa|grep yum|xargs rpm -e --nodeps
卸载完成,下一步执行安装yum,依次执行命令:
[root@host yuminstall]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@host yuminstall]# rpm -ivh python-urlgrabber-3.9.1-9.el6.noarch.rpm
[root@host yuminstall]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@host yuminstall]# rpm -ivh yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm yum-3.2.29-69.el6.centos.noarch.rpm
一般来说都没报错,下一步,修改配置
[root@host yuminstall]# cd /etc/yum.repos.d
[root@host yum.repos.d]# mv rhel-source.repo rhel-source.repo.bak
[root@host yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@host yum.repos.d]# ls
CentOS6-Base-163.repo redhat.repo rhel-source.repo.bak
[root@host yum.repos.d]# vim CentOS6-Base-163.repo
使用全文替换:
:1,$s/$releasever/6
运行以下命令生成缓存
yum clean all
yum makecache