在CentOS上离线安装libgdiplus
作者:快盘下载 人气:ASP.NET Core MVC的项目需要处理图片;部署到CentOS 7上面时会报“The type initializer for ‘Gdip‘ threw an exception”;需要安装libgdiplus。
做为linux门外汉;虽然网上已经有不少相关内容;还是摸索了不少时间;记录一下。
感谢CentOS7离线安装神器yumdownloader一文的帮助;主要内容均来自此文。
首先在虚拟机上安装CentOS7;需要借用这台能上网的CentOS7虚拟机下载离线安装包。并且要保证这台虚拟机和要部署的目标服务器环境相同;避免下载安装包时遗漏了某些依赖包。
运行以下命令安装yumdownloader
yum install yum-utils -y
下载EPEL最新发布包;epel-release-7-14.noarch.rpm并安装;否则yumdownloader找不到libgdiplus的离线安装包。
rpm -ivh epel-release-7-14.noarch.rpm
下载libgdiplus离线安装包
yumdownloader --destdir=./libgdiplus --resolve libgdiplus.x86_64
下载时注意一下;在最小化安装的CentOS7上面;libgdiplus一共是33个包文件;检查一下是否有遗漏;防止下载安装包的虚拟机上已经安装了某些依赖包;导致下载不完整。
将下载的安装包压缩打包
tar zcf libgdiplus.tar.gz libgdiplus
将压缩包上传到目标服务器并解压
tar zxf libgdiplus.tar.gz
CentOS7离线安装神器yumdownloader一文中是使用createrepo制作离线源;但我按照文中的方法在无网的CentOS中运行yum install libgdiplus -y命令时;始终报can;t find a valid baseurl for repo的错误;不知道怎么解决。
无奈之下;我采用了笨办法;用rpm命令手动一个个安装。因为包和包之间有依赖关系;安装顺序如下;
rpm -ivh mesa-libglapi-18.3.4-12.el7_9.x86_64.rpm rpm -ivh libxshmfence-1.2-1.el7.x86_64.rpm rpm -ivh libjpeg-turbo-1.2.90-8.el7.x86_64.rpm rpm -ivh libglvnd-1.0.1-0.8.git5baa1e5.el7.x86_64.rpm rpm -ivh fontpackages-filesystem-1.44-8.el7.noarch.rpm rpm -ivh libICE-1.0.9-9.el7.x86_64.rpm rpm -ivh libwayland-server-1.15.0-1.el7.x86_64.rpm rpm -ivh mesa-libgbm-18.3.4-12.el7_9.x86_64.rpm rpm -ivh libSM-1.2.2-2.el7.x86_64.rpm rpm -ivh dejavu-fonts-common-2.33-6.el7.noarch.rpm rpm -ivh dejavu-sans-fonts-2.33-6.el7.noarch.rpm rpm -ivh fontconfig-2.13.0-4.3.el7.x86_64.rpm rpm -ivh libX11-common-1.6.7-4.el7_9.noarch.rpm rpm -ivh libXau-1.0.8-2.1.el7.x86_64.rpm rpm -ivh libxcb-1.13-1.el7.x86_64.rpm rpm -ivh libX11-1.6.7-4.el7_9.x86_64.rpm rpm -ivh libXext-1.3.3-3.el7.x86_64.rpm rpm -ivh libXrender-0.9.10-1.el7.x86_64.rpm rpm -ivh libXfixes-5.0.3-1.el7.x86_64.rpm rpm -ivh libXdamage-1.1.4-4.1.el7.x86_64.rpm rpm -ivh libXxf86vm-1.1.4-1.el7.x86_64.rpm rpm -ivh --nodeps libglvnd-glx-1.0.1-0.8.git5baa1e5.el7.x86_64.rpm rpm -ivh mesa-libGL-18.3.4-12.el7_9.x86_64.rpm rpm -ivh giflib-4.1.6-9.el7.x86_64.rpm rpm -ivh jbigkit-libs-2.0-11.el7.x86_64.rpm rpm -ivh libtiff-4.0.3-35.el7.x86_64.rpm rpm -ivh pixman-0.34.0-1.el7.x86_64.rpm rpm -ivh libexif-0.6.22-2.el7_9.x86_64.rpm rpm -ivh libwayland-client-1.15.0-1.el7.x86_64.rpm rpm -ivh --nodeps libglvnd-egl-1.0.1-0.8.git5baa1e5.el7.x86_64.rpm rpm -ivh mesa-libEGL-18.3.4-12.el7_9.x86_64.rpm rpm -ivh cairo-1.15.12-4.el7.x86_64.rpm rpm -ivh libgdiplus-2.10-10.el7.x86_64.rpm
其中libglvnd-glx和 mesa-libGL;libglvnd-egl和mesa-libEGL有一个循环依赖;即A依赖B;B又依赖A;因此安装libglvnd-glx和libglvnd-egl时加了--nodeps参数;即安装时忽略依赖关系。
加载全部内容