ag命令安装

CentOS

yum -y install epel-release.noarch the_silver_searcher

Ubuntu

apt-get -y install silversearcher-ag

项目地址

https://github.com/ggreer/the_silver_searcher

源码编译安装-install_ag.sh

os="`python -mplatform | grep Ubuntu`"

if [ $os ]
then
    apt-get install automake liblzma-dev automake gcc g++
else
    yum install -y xz-devel zlib-devel pcre-devel automake gcc gcc-c++
fi

wget https://github.com/ggreer/the_silver_searcher/archive/master.zip 
mv master search_ag.zip
unzip search_ag.zip
cd the_silver_searcher-master/
./build.sh
make install

bash install_ag.sh

CentOS 报错一

configure: error: Package requirements (libpcre) were not met:

No package 'libpcre' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables PCRE_CFLAGS and PCRE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

# 解决方法
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

CentOS 报错二

 configure: error: Package requirements (liblzma) were not met:

No package 'liblzma' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables LZMA_CFLAGSand LZMA_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

# 解决
 yum -y install xz-devel