【CentOS7】安装GraphicsMagick

【CentOS7】安装GraphicsMagick

工具,没有时安装

yum install -y autoconf bc vim wget screen telnet lrzsz zip unzip lsof locate nc tcpdump strace iftop iotop htop crontabs strace ntpdate curl

编译器,没有则安装

yum -y install gcc gcc-c++

图片和字体支持插件,freetype字体

yum -y install libjpeg libjpeg-devel libpng libpng-devel giflib-devel giflib libwebp-devel libwebp freetype freetype-devel

下载解压GraphicsMagick

cd /ycx
wget https://util.obs.cn-east-3.myhuaweicloud.com/GraphicsMagick-1.3.35.tar.gz
tar -zxvf GraphicsMagick-1.3.35.tar.gz
mv GraphicsMagick-1.3.35 GraphicsMagick
cd /ycx/GraphicsMagick

安装,如果configure提示configure: error: libltdl is required for modules build, 则 yum install libtool-ltdl libtool-ltdl-devel

./configure --prefix=/ycx/GraphicsMagick --with-quantum-depth=8 --enable-shared --enable-static --enable-lzw --without-perl --with-modules
make && make install

编辑

vim /etc/ld.so.conf
# 追加
/ycx/GraphicsMagick/lib/
# 生效
ldconfig

 

设置环境变量

全局

vim /etc/profile
# 追加
export GMAGICK_HOME="/ycx/GraphicsMagick"
export PATH="$GMAGICK_HOME/bin:$PATH"
LD_LIBRARY_PATH=$GMAGICK_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

生效配置

source /etc/profile

用户

vim /root/.bash_profile
# 追加
export GMAGICK_HOME="/ycx/GraphicsMagick"
export PATH="$GMAGICK_HOME/bin:$PATH"
LD_LIBRARY_PATH=$GMAGICK_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

生效配置

source /root/.bash_profile

测试

gm -version
gm convert -list formats

将gm考到/usr/bin目录下

cp /ycx/GraphicsMagick/bin/gm /usr/bin/

 

posted @ 2021-12-06 11:46  翠微  阅读(624)  评论(0编辑  收藏  举报