笔者最近在配置openresty时不小心删除了pcre库(/lib64/libpcre*),导致很多系统中的很多命令无法使用(比如grep,vi,yum,sz,rz,etc.),所以常规安装(如yuminstallpcre)是没有办法修复的。在网上查了很多资料,有的光盘启动Troubleshooting,有的推荐运行。特此记录一下不跑路的方法。取回yumwget等命令这时候我们就不能正常使用yum了(不信可以自己检查一下)[root@centos6102~]#yum-v#检查yum是否可以使用-bash:yum:commandnotfound你需要知道的是,我们只是误删了libpcre*,并没有破坏yum等其他命令。因此,我们可以使用绝对地址来调用指令。[root@centos6102~]#/usr/bin/yum-vLoading"fastestmirror"pluginConfigtime:0.008YumVersion:3.2.29你需要给一些commandUsage:yum[options]COMMAND所以如果是/usr/bin下的命令我们可以使用/usr/bin/[command]来调用,/bin下的命令可以用/bin/[command]调用,以此类推。如果不想每次都敲路径,可以直接修改/etc/profile。找到如下语句,添加到我们的路径中,修复pcre后删除。#路径操作if["$EUID"="0"];thenpathmunge/sbinpathmunge/usr/sbinpathmunge/usr/local/sbinelsepathmunge/usr/local/sbinafterpathmunge/usr/sbinafterpathmunge/sbinafter#here添加以下字段,修复pcre后删除#修复了libpcre问题,暂时pathmunge/usr/binpathmunge/usr/local/binpathmunge/usr/sharefi下载并安装pcre1。卸载pcre/bin/rpm-e--nodepspcre2。下载pcre包(不同系统替换对应源)/usr/bin/wgethttp://mirrors.163.com/centos/6/os/x86_64/Packages/pcre-7.8-7.el6.x86_64。rpm3。installpcre/bin/rpm-ivhpcre-7.8-7.el6.x86_64.rpm#使用rpm安装/usr/bin/yumlocalinstallpcre-7.8-7.el6.x86_64.rpm#或者使用yum到这里,我们已完成修复。
