Gdal安装

Gdal安装

Centos7.6


1-环境准备

1-java
2-gcc
3-g++
4-ant
5-pcre
6-swig
7-SQLite3
8-json-c
9-proj
10-geos
11-gdal

#pcre:		swig所需的依赖项
#SQLite3:	PROJ所需的依赖项		下载地址: https://www.sqlite.org/download.html
#PROJ:		gdal所需的依赖项		下载地址:https://proj.org/download.html
#GEOS:		gdal需要的环境 		下载地址:http://download.osgeo.org/geos/
注:gadl3.0以上需要proj6以上

查看安装包

[root@localhost linux]# cd /root/bao/
l[root@hhht-8 bao]# ll
-rw-r--r-- 1 root root   5839799 Dec 11 17:25 apache-ant-1.9.16-bin.tar.gz
-rw-r--r-- 1 root root  19582883 Dec 11 17:25 gdal-3.3.1.tar.gz
-rw-r--r-- 1 root root   1987528 Dec 11 17:25 geos-3.6.3.tar.bz2
-rw-r--r-- 1 root root 181352138 Dec 11 17:25 jdk-8u101-linux-x64.tar.gz
-rw-r--r-- 1 root root    755090 Dec 11 17:25 json-c-json-c-0.13-20171207.zip
-rw-r--r-- 1 root root   2068775 Dec 11 17:25 pcre-8.41.tar.gz
-rw-r--r-- 1 root root   2453402 Dec 11 17:25 proj-6.1.0.tar.gz
-rw-r--r-- 1 root root   3148813 Dec 11 17:25 sqlite-autoconf-3420000.tar.gz
-rw-r--r-- 1 root root   8149820 Dec 11 17:25 swig-3.0.12.tar.gz

2.安装服务

创建安装目录

[root@localhost bao]# mkdir /opt/apps/gdal

2.1 gcc & g++

安装gcc和g++

#安装gcc和g++
[root@localhost ~]# yum -y install gcc g++

#查看gcc版本
[root@localhost bao]# gcc -v
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 

#查看g++版本
[root@localhost bao]# g++ -v 
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 

2.2 java安装

解压

[root@hhht-8 bao]# tar xf jdk-8u101-linux-x64.tar.gz -C /opt/apps/

改名

[root@hhht-8 apps]# mv jdk1.8.0_101/ jdk1.8

添加环境变量

[root@hhht-8 apps]# vim /etc/profile
#末行添加以下内容:
export JAVA_HOME=/opt/apps/jdk1.8
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin

刷新变量

[root@hhht-8 apps]# source /etc/profile

验证服务

[root@hhht-8 apps]# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

2.3 ant安装

解压

[root@hhht-8 apps]# cd /root/bao/
[root@hhht-8 bao]# tar -zxvf apache-ant-1.9.16-bin.tar.gz -C /opt/apps/gdal

授权

[root@hhht-8 bao]# cd /opt/apps/gdal/
[root@hhht-8 gdal]# ll
drwxr-xr-x 6 root root 235 Jul 11  2021 apache-ant-1.9.16
[root@hhht-8 gdal]# chmod 777 apache-ant-1.9.16/

修改系统环境变量

[root@hhht-8 gdal]# vim /etc/profile
#末行添加:
export ANT_HOME=/opt/apps/gdal/apache-ant-1.9.16
export PATH=$PATH:$ANT_HOME/bin

使变量生效

[root@hhht-8 gdal]# source /etc/profile

验证ant是否安装成功

[root@hhht-8 gdal]# ant -version
Apache Ant(TM) version 1.9.16 compiled on July 10 2021

2.4 Pcre安装

解压

[root@hhht-8 gdal]# cd /root/bao/
[root@hhht-8 bao]# tar -zvxf pcre-8.41.tar.gz

预配置

[root@hhht-8 bao]# cd pcre-8.41
[root@hhht-8 pcre-8.41]# ./configure --prefix=/opt/apps/gdal/pcre

安装

[root@hhht-8 pcre-8.41]# make -j4

编译安装

[root@hhht-8 pcre-8.41]# make install

查看安装目录

[root@hhht-8 pcre-8.41]# ll /opt/apps/gdal/pcre/
drwxr-xr-x 2 root root   57 Dec 11 18:11 bin
drwxr-xr-x 2 root root  124 Dec 11 18:11 include
drwxr-xr-x 3 root root 4096 Dec 11 18:11 lib
drwxr-xr-x 4 root root   28 Dec 11 18:11 share

创建动态链接装载程序

##往/lib和/usr/lib里面加东西,是不用修改/etc/ld.so.conf文件的,但是添加完后需要调用下ldconfig,不然添加的library会找不到
[root@hhht-8 pcre-8.41]# echo "/opt/apps/gdal/pcre/lib" > /etc/ld.so.conf.d/pcre-8.41.conf
[root@hhht-8 pcre-8.41]# ldconfig

运行./pcretest命令,进入pcretest命令界面,验证是否安装成功

[root@hhht-8 pcre-8.41]# ./pcretest 
PCRE version 8.41 2017-07-05

  re> ^C

2.5 Swig安装

解压

[root@hhht-8 pcre-8.41]# cd /root/bao/
[root@hhht-8 bao]# tar -zxvf swig-3.0.12.tar.gz

预配置

[root@hhht-8 bao]# cd swig-3.0.12
[root@hhht-8 swig-3.0.12]# ./configure --prefix=/opt/apps/gdal/swig

安装

[root@hhht-8 swig-3.0.12]# make -j4

编译安装

[root@hhht-8 swig-3.0.12]# make install

查看安装目录

[root@hhht-8 pcre-8.41]# ll /opt/apps/gdal/pcre/
drwxr-xr-x 2 root root   57 Dec 11 18:11 bin
drwxr-xr-x 2 root root  124 Dec 11 18:11 include
drwxr-xr-x 3 root root 4096 Dec 11 18:11 lib
drwxr-xr-x 4 root root   28 Dec 11 18:11 share

修改系统环境变量

[root@hhht-8 swig-3.0.12]# vim /etc/profile
#末行添加:
export SWIG_HOME=/opt/apps/gdal/swig
export PATH=$PATH:$ANT_HOME/bin:$SWIG_HOME/bin

使变量生效

[root@hhht-8 swig-3.0.12]# source /etc/profile

验证ant是否安装成功

[root@hhht-8 swig-3.0.12]# swig -version

SWIG Version 3.0.12

2.6 SQLite3安装

查看是否安装sqlite3

[root@hhht-6 ~]# rpm -qa sqlite
sqlite-3.7.17-8.el7.x86_64

卸载

[root@hhht-8 sqlite-autoconf-3420000]# rpm -ev sqlite-3.7.17-8.el7.x86_64 --nodeps
Preparing packages...
sqlite-3.7.17-8.el7.x86_64

解压

[root@hhht-8 swig-3.0.12]# cd /root/bao/
[root@hhht-8 bao]# tar -zxvf sqlite-autoconf-3420000.tar.gz

预配置

[root@hhht-8 bao]# cd sqlite-autoconf-3420000
[root@hhht-8 sqlite-autoconf-3420000]# ./configure --prefix=/opt/apps/gdal/sqlite3

安装

[root@hhht-8 sqlite-autoconf-3420000]# make -j4

编译安装

[root@hhht-8 sqlite-autoconf-3420000]# make install

查看安装目录

[root@hhht-8 sqlite-autoconf-3420000]# ll /opt/apps/gdal/sqlite3/
drwxr-xr-x 2 root root  21 Dec 11 18:22 bin
drwxr-xr-x 2 root root  43 Dec 11 18:22 include
drwxr-xr-x 3 root root 135 Dec 11 18:22 lib
drwxr-xr-x 3 root root  17 Dec 11 18:22 share

创建动态链接装载程序

##往/lib和/usr/lib里面加东西,是不用修改/etc/ld.so.conf文件的,但是添加完后需要调用下ldconfig,不然添加的library会找不到
[root@hhht-8 sqlite-autoconf-3420000]# echo "/opt/apps/gdal/sqlite3/lib" > /etc/ld.so.conf.d/sqlite3.conf
[root@hhht-8 sqlite-autoconf-3420000]# ldconfig

验证是否安装成功

[root@hhht-8 sqlite-autoconf-3420000]#  sqlite3 --version
3.42.0 2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0

如为查询到版本

[root@hhht-8 sqlite-autoconf-3420000]# cd /usr/bin/
[root@hhht-8 bin]# rm -rf sqlite3
[root@hhht-8 bin]# ln -s /opt/apps/gdal/sqlite3/bin/sqlite3 sqlite3

#再次查看
[root@hhht-8 sqlite-autoconf-3420000]#  sqlite3 --version
3.42.0 2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0

安装sqlite相关库

[root@localhost sqlite-autoconf-3420000]# yum -y install sqlite-devel

2.7 Json-c安装

解压

[root@hhht-8 bin]# cd /root/bao/
[root@hhht-8 bao]# unzip json-c-json-c-0.13-20171207.zip

预配置

[root@hhht-8 bao]# cd json-c-json-c-0.13-20171207
[root@hhht-8 json-c-json-c-0.13-20171207]# bash ./configure --prefix=/opt/apps/gdal/json-c

安装

[root@hhht-8 json-c-json-c-0.13-20171207]# make -j4

编译安装

[root@hhht-8 json-c-json-c-0.13-20171207]# make install

查看安装目录

[root@hhht-8 json-c-json-c-0.13-20171207]# ll /opt/apps/gdal/json-c/
drwxr-xr-x 3 root root  20 Dec 11 18:50 include
drwxr-xr-x 3 root root 130 Dec 11 18:50 lib

创建动态链接装载程序

##往/lib和/usr/lib里面加东西,是不用修改/etc/ld.so.conf文件的,但是添加完后需要调用下ldconfig,不然添加的library会找不到
[root@hhht-8 json-c-json-c-0.13-20171207]# echo "/opt/apps/gdal/json-c/lib" > /etc/ld.so.conf.d/json-c-0.13.1.conf
[root@hhht-8 json-c-json-c-0.13-20171207]# ldconfig

验证是否安装成功

#1-可以查看json相关头文件
#注-预配置未指定路径是/usr/local/include/json-c/

[root@hhht-8 json-c-json-c-0.13-20171207]# ls /opt/apps/gdal/json-c/include/json-c/
#出现以下文件成功
arraylist.h  bits.h  debug.h  json_config.h  json_c_version.h  json.h  json_inttypes.h  json_object.h  
json_object_iterator.h  json_pointer.h  json_tokener.h  json_util.h  json_visit.h  linkhash.h  printbuf.h

#2-可以查看json相关的库文件
#注-预配置未指定路径是/usr/local/lib
[root@hhht-8 json-c-json-c-0.13-20171207]# ls /opt/apps/gdal/json-c/lib/
#出现以下文件成功
libjson-c.a  libjson-c.la  libjson-c.so  libjson-c.so.3  libjson-c.so.3.0.1  pkgconfig

2.8 PROJ

解压

[root@hhht-8 json-c-json-c-0.13-20171207]# cd /root/bao/
[root@hhht-8 bao]# tar -zxvf proj-6.1.0.tar.gz

预配置

[root@hhht-8 bao]# cd proj-6.1.0
[root@hhht-8 proj-6.1.0]# ./configure --prefix=/opt/apps/gdal/proj

安装

[root@hhht-8 proj-6.1.0]# make -j4

编译安装

[root@hhht-8 proj-6.1.0]# make install

查看安装目录

[root@hhht-8 proj-6.1.0]# ll /opt/apps/gdal/proj/
drwxr-xr-x 2 root root 111 Dec 15 17:34 bin
drwxr-xr-x 3 root root 169 Dec 15 17:34 include
drwxr-xr-x 3 root root 122 Dec 15 17:34 lib
drwxr-xr-x 4 root root  29 Dec 15 17:34 share

验证是否安装成功

[root@hhht-8 proj-6.1.0]# cd /opt/apps/gdal/proj/bin
[root@hhht-8 bin]# ./proj -version
Rel. 6.1.0, May 15th, 2019
<proj>:

命令软链接

[root@hhht-8 proj-6.1.0]# ln -s /opt/apps/gdal/proj/bin/proj /usr/bin/proj

2.9 GEOS安装

安装bzip2

[root@hhht-8 bin]# yum -y install bzip2

解压

[root@hhht-8 bin]# cd /root/bao/
[root@localhost bao]# bzip2 -d geos-3.6.3.tar.bz2
[root@localhost bao]# tar -xf geos-3.6.3.tar

预配置

[root@hhht-8 bao]# cd geos-3.6.3
[root@hhht-8 geos-3.6.3]# ./configure --prefix=/opt/apps/gdal/geos

安装

[root@hhht-8 geos-3.6.3]# make -j4

编译安装

[root@hhht-8 geos-3.6.3]# make install

2.10 GDAL安装

解压

[root@hhht-8 geos-3.6.3]# cd /root/bao/
[root@hhht-8 bao]# tar -zxvf gdal-3.3.1.tar.gz

预配置

[root@hhht-8 bao]# cd gdal-3.3.1
[root@hhht-8 gdal-3.3.1]# ./configure --prefix=/opt/apps/gdal

安装

[root@hhht-8 gdal-3.3.1]#  make -j4

编译安装

[root@hhht-8 gdal-3.3.1]# make install

查看安装目录


验证是否安装成功


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
GDAL(Geospatial Data Abstraction Library)是一个用于读取、写入和处理地理空间数据的开源库。下面是GDAL安装步骤: 1. 下载GDAL:你可以从GDAL的官方网站(https://gdal.org/download.html)下载适合你操作系统的GDAL安装。 2. 安装GDAL:根据你的操作系统选择相应的安装进行安装安装过程可能会有一些特定的步骤,根据安装提供的说明进行操作即可。 3. 配置环境变量:在安装完成后,需要配置环境变量,以便系统能够找到GDAL的执行文件。具体步骤如下: - Windows系统:将GDAL安装路径添加到系统的环境变量中。可以通过以下步骤进行配置: - 右键点击“计算机”或“此电脑”,选择“属性”。 - 在左侧面板中,点击“高级系统设置”。 - 在弹出的对话框中,点击“环境变量”按钮。 - 在“系统变量”部分,找到名为“Path”的变量,双击打开编辑窗口。 - 在编辑窗口中,在变量值的末尾添加GDAL安装路径,多个路径之间用分号分隔。 - 点击确定保存修改,并关闭所有对话框。 - macOS系统:将GDAL安装路径添加到系统的环境变量中。可以通过以下步骤进行配置: - 打开终端应用程序。 - 输入以下命令,将GDAL安装路径添加到.bash_profile文件中: ``` echo 'export PATH="/Library/Frameworks/GDAL.framework/Programs:$PATH"' >> ~/.bash_profile ``` - 输入以下命令,使修改的.bash_profile文件生效: ``` source ~/.bash_profile ``` - Linux系统:将GDAL安装路径添加到系统的环境变量中。可以通过以下步骤进行配置: - 打开终端。 - 编辑用户主目录下的.bashrc文件,可以使用任何文本编辑器打开,比如vi或nano: ``` vi ~/.bashrc ``` - 在文件的末尾添加以下行,将GDAL安装路径添加到PATH变量中: ``` export PATH=/path/to/gdal/bin:$PATH ``` - 保存并关闭文件。 - 运行以下命令,使修改的.bashrc文件生效: ``` source ~/.bashrc ``` 4. 验证安装:在终端或命令提示符中输入以下命令,检查GDAL是否成功安装: ``` gdalinfo --version ``` 至此,你已经完成了GDAL安装过程。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值