Centos7 安装gdal历程,使用node-gdal功能

问题频出,考验耐心,方得始终。

原来能够和ubuntu,反复部署测试,都是失败。

以下是整理后的,多次尝试后,搞定centos gdal2.4.4正常运行,使用node-gdal功能一切顺利。

centos7 gdal2.4.4安装
!!!以下操作都在同一个用户下面完成


#########yum切换国内源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum makecache


#########升级yum
yum update


#########应用程序路径
pwd
/opt/software

#########上传gdal包,解压
rz
gdal-2.4.4.tar.gz
node-v14.17.2-linux-x64.tar
Python-2.7.3.tar.xz

xz -d Python-2.7.3.tar.xz
tar -xf Python-2.7.3.tar

tar -zxvf gdal-2.4.4.tar.gz

xz -d node-v14.17.2-linux-x64.tar.xz
tar -xf node-v14.17.2-linux-x64.tar

########安装gcc
yum install gcc -y

##############安装python2.7
cd  Python-2.7.3
./configure

make

make install


vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/opt/software/Python-2.7.3

source ~/.bash_profile

python -V

###############编译并安装gdal 2.4.4
cd gdal-2.4.4
 
yum install -y gcc make subversion gcc-c++ sqlite-devel libxml2-devel python-devel numpy swig expat-devel libcurl-devel


./configure

make

make install

vi ~/.bash_profile

export PATH=$PATH:/opt/software/gdal-2.4.4
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/software/gdal-2.4.4/lib
export GDAL_DATA=/opt/software/gdal-2.4.4/data

source ~/.bash_profile


gdalinfo --version

 
###############关闭防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service


################配置nodejs 14.17.2
tar -xvf node-v14.17.2-linux-x64.tar.xz

# 建立node软链接
ln -s /opt/software/node-v14.17.2-linux-x64/bin/node /usr/local/bin
# 建立npm 软链接
ln -s /opt/software/node-v14.17.2-linux-x64/bin/npm /usr/local/bin


################npm设置国内源
# 设置国内淘宝镜像源
npm config set registry https://registry.npm.taobao.org
# 查看设置信息
npm config list

ln -s /opt/software/node-v14.17.2-linux-x64/bin/pkg /usr/local/bin


#################上传应用程序,并解压
rz
tar -xf v6.82.tar


###################centos 升级GCC编译器
yum -y install centos-release-scl

yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils

scl enable devtoolset-8 bash

echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile


####################升级make

wget https://ftp.gnu.org/gnu/make/make-4.2.tar.gz

tar -xzvf make-4.2.tar.gz

cd make-4.2

sudo ./configure

sudo make

sudo make install

sudo rm -rf /usr/bin/make

sudo cp ./make /usr/bin/

make -v


####################升级glibc-2.27
/lib64/libm.so.6: version `GLIBC_2.27' not found

wget http://mirrors.nju.edu.cn/gnu/libc/glibc-2.27.tar.xz
xz -d glibc-2.27.tar.xz
tar -xf glibc-2.27.tar

cd glibc-2.27/

mkdir build

cd build/

yum install -y bison

../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

make  

make install
 

https://blog.csdn.net/wangying202/article/details/113178159

#########error
/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found

strings /usr/lib64/libstdc++.so.6 | grep GLIBC

 
https://segmentfault.com/a/1190000041012397

cd /usr/local/lib64/
# 下载最新版本的`下载最新版本的libstdc.so_.6.0.26`
wget http://www.vuln.cn/wp-content/uploads/2019/08/libstdc.so_.6.0.26.zip
# 解压
unzip libstdc.so_.6.0.26.zip
# 将下载的最新版本拷贝到 /usr/lib64
cp libstdc++.so.6.0.26 /usr/lib64
cd  /usr/lib64
# 查看 /usr/lib64下libstdc++.so.6链接的版本
ls -l | grep libstdc++
# 删除原先的软连接(不放心可以备份)
rm libstdc++.so.6
# 使用最新的库建立软连接
ln -s libstdc++.so.6.0.26 libstdc++.so.6
# 查看新版本,成功
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX


############重新运行应用程序

gdalinfo --version

你可能感兴趣的:(gdal,python,linux,开发语言)