安装nginx
sudo -i 进入root用户
使用cd命令 进入nginx文件夹
执行
./configure
若出现
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_moduleoption,
or install the PCRE library into the system,
or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.
则需要安装,若系统是Ubuntu /Debian则执行这个命令
sudo apt-get install ibpcre3 ibpcre3-dev
若系统是CentOS / RedHat则执行这个命令
sudo yum install pcre pcre-devel
若yum没有的话则需要运行命令安装yum
sudo apt-get install yum
若出现无法定位软件包yum则需要安装yum
在执行这个yum的命令时出现 没有可用的仓库这种意思的话语时,则需要运行Ubuntu /Debian的命令
执行上面的命令后再次执行 ./configure
若出现
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http gzip moduleoption,
or install the zlib library into the system,
or build the zlib librarystatically from the source with nginx by using --with-zlib=epath> option.
则需要安装,若系统是Ubuntu /Debian则执行这个命令
sudo apt-get install zliblg-dev
若系统是CentOS / RedHat则执行这个命令
sudo yum install zlib-devel
安装之后再次执行 ./configure
然后再运行
make //安装
安装之后返回到根目录,然后运行 whereis nginx 就知道nginx的启动项在哪
安装yum
需要去源里面添加
vim /etc/apt/sources.list
//添加这个
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
//然后运行
sudo apt-get update
在运行上面最后一个出现
W:GPG 错误:http://archive.ubuntu.com/ubuntu trsty Release: 由于没有公钥,无法验证下列签名: NO PUBKEY 40976EAF437D05B5 NO PUBKEY 3B4FE6ACCOB21F32
W:仓库“http://archive.ubuntu.com/ubuntu trusty Release”没有数字签名。
则 运行
// 3B4FE6ACCOB21F32就是上面所说的缺失的密钥
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACCOB21F32
上面的执行完后在执行
sudo apt-get update
//成功之后在运行
sudo apt-get install yum
查看该文件中的原是否有配置,若有配置则取消注释,若无配置则
vim /etc/apt/sources.list