1、参考:http://www.linuxdiyf.com/linux/25616.html
https://github.com/gmt-china/gmt-easy-installer/blob/master/GMT-installer.sh,下载gmt自动化安装
2、我自己从ftp://ftp.soest.hawaii.edu/gmt/下载最新版本的gmt-5.4.1-src.tar.gz gshhg-gmt-2.3.6.tar.gz 和dcw-gmt-1.1.2.tar.gz
3、安装依赖包
sudo apt-get update
sudo apt-get install netcdf-bin libnetcdf-dev
sudo apt-get install libgdal-dev
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get update
# 必须安装的包
sudo apt-get install ghostscript libnetcdf-dev
sudo apt-get install libglib2.0-dev
# 推荐安装的包
sudo apt-get install libgdal-dev python-gdal
sudo apt-get install liblapack3
# 可选的安装包
sudo apt-get install libpcre3-dev libfftw3-dev
4、直接运行 sh gmt-installer.sh
tar -xf gmt-${GMT_VERSION}-src.tar.gz
tar -xf gshhg-gmt-${GSHHG_VERSION}.tar.gz
tar -xf dcw-gmt-${DCW_VERSION}.tar.gz
mv gshhg-gmt-${GSHHG_VERSION} gmt-${GMT_VERSION}/share/gshhg
mv dcw-gmt-${DCW_VERSION} gmt-${GMT_VERSION}/share/dcw-gmt
cd gmt-${GMT_VERSION}
运行到这里,一直出错
5、在terminal终端中
# 切换到 gmt 源码目录下
$ cd gmt-5.4.1
# 新建用户配置文件
$ sudo gedit cmake/ConfigUser.cmake
set (CMAKE_INSTALL_PREFIX "${GMT_INSTALL}")
set (GMT_INSTALL_MODULE_LINKS FALSE)
set (COPY_GSHHG TRUE)
set (COPY_DCW TRUE)
set (GMT_USE_THREADS TRUE)
6、mkdir build
cd build
cmake ..
make
sudo make install
cd ../..
7、最后在terminal终端中配置环境变量
# Configuration
echo "export GMT5HOME=${GMT_INSTALL}" >> ~/.bashrc
echo 'export PATH=${GMT5HOME}/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GMT5HOME}/lib64' >> ~/.bashrc
8、测试gmt安装是否成功
terminal 直接输入gmt或者gmt --version
或者gmt psxy or gmt pslegend
成功。
9、gmt中文支持
http://www.linuxdiyf.com/linux/13038.html