centos7 无法安装pcre的解决办法?
时间: 2023-11-21 19:57:29 浏览: 360
CentOs7 gcc+zlib+pcre 离线安装包
以下是centos7安装pcre的解决办法:
1. 通过yum安装pcre-devel和zlib-devel
```shell
sudo yum install -y pcre-devel zlib-devel
```
2. 如果yum安装不成功,可以尝试手动下载安装包并安装
```shell
# 下载pcre-devel和zlib-devel
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/pcre-devel-8.32-17.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/zlib-devel-1.2.7-18.el7.x86_64.rpm
# 安装pcre-devel和zlib-devel
sudo rpm -ivh pcre-devel-8.32-17.el7.x86_64.rpm
sudo rpm -ivh zlib-devel-1.2.7-18.el7.x86_64.rpm
```
3. 如果以上方法都不行,可以尝试使用离线安装的方式安装gcc、pcre-devel、openssl-devel和zlib-devel,具体步骤如下:
```shell
# 下载gcc、pcre-devel、openssl-devel和zlib-devel
wget http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/autogen-libopts-5.18-5.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/cpp-4.8.5-16.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/gcc-4.8.5-16.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/gcc-c++-4.8.5-16.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/glibc-devel-2.17-196.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/glibc-headers-2.17-196.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7.4.1708/os/x86_64/Packages/kernel-headers-3.10.0-693.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/pcre-devel-8.32-17.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/openssl-devel-1.0.2k-16.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/zlib-devel-1.2.7-18.el7.x86_64.rpm
# 安装gcc、pcre-devel、openssl-devel和zlib-devel
sudo rpm -ivh autogen-libopts-5.18-5.el7.x86_64.rpm
sudo rpm -ivh cpp-4.8.5-16.el7.x86_64.rpm
sudo rpm -ivh gcc-4.8.5-16.el7.x86_64.rpm
sudo rpm -ivh gcc-c++-4.8.5-16.el7.x86_64.rpm
sudo rpm -ivh glibc-devel-2.17-196.el7.x86_64.rpm
sudo rpm -ivh glibc-headers-2.17-196.el7.x86_64.rpm
sudo rpm -ivh kernel-headers-3.10.0-693.el7.x86_64.rpm
sudo rpm -ivh pcre-devel-8.32-17.el7.x86_64.rpm
sudo rpm -ivh openssl-devel-1.0.2k-16.el7.x86_64.rpm
sudo rpm -ivh zlib-devel-1.2.7-18.el7.x86_64.rpm
```
阅读全文