Color Scheme
Find People
Username
Password
Sign Up
old site http://222.195.74.11/
中文版 Location: Homepage >> Xianghui Xue : CV - Publications - Blog

Personal Note

ubuntu常用软件安装
持续更新.....
Link to this poster Source Code
Originated by Xianghui Xue at 2009-10-16 14:06 CST, Last modified at 2009-10-16 14:06 CST.

Contents

1 IDL Contents Top
完全按照官方的安装指南-Installing on UNIX 操作
1)、根据Installing on UNIX 说明IDL6.4在Linux下默认安装路径是/usr/local/itt,因此我们首先需要具有ROOT用户权限来创建这两个菜单,可以在命令行输入su,然后再输入密码即可进入Root用户,此处建议直接用Root用户登录系统最方便。
2)、输入命令
% mkdir /usr/local/itt (to create)
% chmod a+rx /usr/local/itt (to give access)
3)、然后将你下载的适合的IDL安装包放到/usr/local/itt路径下面,依次输入以下命令,解压,安装
% gunzip idl_platform.tar.gz
% tar xf idl_platform.tar
% ./install
4)、在安装被检验后输入y
5)、然后是询问你是否同意License协议,回答自然是y
6)、下面的步骤更简单,按照提示enter即可。
7)、安装到最后会询问是否在系统启动时就自动运行,DICOM Network Services,如果你不想用该功能就输入n,否则y
8)、最后一步就是License IDL了,运行IDL License 向导前需要建立IDL运行需要的几个环境变量
For C shell:
source ITT-DIR/idl64/bin/idl_setup
For Korn shell:
. ITT-DIR/idl64/bin/idl_setup.ksh
For Bash shell:
. ITT-DIR/idl64/bin/idl_setup.bash
ITT-DIR 是你的IDL的安装路径
9)、在命令中输入 ittlicense就回弹出License向导,将你的License信息输入即可 (或者直接把liscense.dat拷贝到idl的对应目录中,对应的目录可以在idl 启动后,提示的信息中找到,为*.lic)
Source Code
Originated by Xianghui Xue at 2009-10-16 14:07 CST, Last modified at 2009-10-16 14:09 CST.

2 Latex Contents Top
1) 安装texlive
sudo apt-get install texlive-full latex-beamer dvipdfmx

2) 安装cjk
sudo apt-get install latex-cjk-all

3) 安装字体 {方法1: 不推荐!!}
下载字体:
ftp://cle.linux.org.tw/pub2/tex/cjk/fonts/nsungt1/nsungt1-1.4.2.tar.gz (宋体)
ftp://cle.linux.org.tw/pub2/tex/cjk/fonts/nkait1/nkait1-1.4.2.tar.gz (楷体)
下载解压后,进入目录执行install.sh脚本
./install.sh

vim test.tex
输入以下内容:
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{UTF8}{nsung}
你好!这里是Ubuntu下的TexLive+CJK环境!

\end{CJK}
\begin{CJK}{UTF8}{nkai}
你好!这里是Ubuntu下的TexLive+CJK环境!
\end{CJK}
\end{document}
保存退出,再输入以下命令:
pdflatex test.tex
即可生成test.pdf

-------------------------------------
4) 安装字体 {方法2: 推荐!!}
   以上生成的字体只有UTF8下的两种字体 nsung, nkai,可以到网上下载已经制作好的 YueWang-zhfonts-final_1.01.tar.bz2字库,然后解压缩后(隐藏文件)将texmf-var 和 texmf-config拷贝到~目录下,并设为隐藏目录。然后执行texhash。
  这样可以支持多种字库的效果。

  使用方法 (来源于网络http://dingokiki.blog.163.com/blog/static/5978346820096365048248/)
 
  请看范例(LaTeX源代码):

\documentclass{article}
\usepackage{CJKutf8}                           %使用CJK字库,utf-8编码方式
\begin{document}
\begin{CJK*}{UTF8}{song}                    %开始使用CJK字库,选择“宋体”
\CJKfamily{hei} 黑体

\CJKfamily{li} 隶书

\CJKfamily{fs} 仿宋

\CJKfamily{kai} 楷体

\CJKfamily{you} 幼圆

\CJKfamily{song} 宋体\\[3cm]

字体的切换:我的\CJKfamily{hei}名字\CJKfamily{song}叫\CJKfamily{li}某某。该“隶书”命令会一直作用在后面的文字,直到遇到切换命令\CJKfamily{kai}才会改变为楷体。YueWang-zhfonts~提供\CJKfamily{song}六种 \CJKfamily{you}字体,很强大吧!
\end{CJK*}
\end{document}
Source Code
Originated by Xianghui Xue at 2009-10-16 14:08 CST, Last modified at 2009-10-24 07:11 CST.

3 Jave Contents Top
sudo apt-get install sun-java6-jre
如果空间富裕,建议安装一个 JDK:
sudo apt-get install sun-java6-jdk
设置当前默认的 java 解释器:
sudo update-alternatives --config java
Source Code
Originated by Xianghui Xue at 2009-10-16 14:09 CST, Last modified at 2009-10-16 14:10 CST.

4 Matlab Contents Top
1.下载matlab软件(R14版的---有些太老了。。。)

2.创建光盘映象挂载目录和安装目录
$sudo mkdir /mnt/cdrom1 /mnt/cdrom2 /mnt/cdrom3
$sudo mkdir /opt/matlab

3. license.dat的处理:
直接执行下面语句
$sudo cp ~/license.dat /usr/local/matlab



4.挂载映象

$sudo mount -o loop ~/Matlab1.iso /mnt/cdrom1
$sudo mount -o loop ~/Matlab2.iso /mnt/cdrom2
$sudo mount -o loop ~/Matlab2.iso /mnt/cdrom3

5.安装
$sudo /mnt/cdrom1/install
出现让你输入安装路径的时候请输入:/usr/local/matlab

6.license.lic的处理
把license.lic从光盘中复制出来并打开,并把第一行的"your_host_name"改成你自己的(/etc/hostname查看),保存。
然后把保存好的文件license.lic复制到 “/opt/matlab/etc”

7.安装基本配置
$sudo /opt/matlab/install_matlab
一路OK就行了.


8.中文字体乱码
由于Matlab自带的jre比较老,建议升级到最新的jre,使用命令:
sudo apt-install sun-java6-jre

来安装jre,然后cd到Matlab安装目录下的sys/java/jre/glnx86目录下创建一个到sun-java6-jre的链接
sudo ln -si /usr/lib/jvm/java-6-sun-1.6.0.16/jre jre1.6.0.16

然后修改Matlab安装目录下的sys/java/jre/glnx86/jre.cfg文件,将其中的1.4.2修改成1.6.0.16,这样,Matlab就会使用1.6.0.16的jre来启动了,新的jre性能应该比老的要好。这样,不需要修改任何的文件,启动Matlab后,在 preferences的fonts列表中就可以看到系统所有使用的字体,选择一个支持中文的字体即可。
Source Code
Originated by Xianghui Xue at 2009-10-16 14:09 CST, Last modified at 2009-10-16 14:09 CST.

5 Wine+Wind-doors+CrossOver 安装photoshop+office2003 Contents Top
支持在linux下执行windows的程序。

wine:安装步骤:
1)sudo apt-get install wine (也可以编译自己安装,并patch相应的补丁,可参考http://forum.ubuntu.org.cn/viewtopic.php?t=107816);我利用台湾的源,安装了wine-1,1.31版本(可以google,ubuntu9.0.4 wine 安装)
2)配置 winecfg,在显示选项中分辨率调整1024*768
3)基本命令
基本设置 winecfg
注册表  regedit
控制台  wineconsole
卸载wine内软件 wine-unintaller
注意,所有软件安装方法,下载win下安装程序,然后执行wine ***setup.exe可以安装,使用的时候在程序的安装目录(默认为.wine/drive_c/Program files/ 下),执行wine ***.exe可以执行。

wine-doors:安装步骤
sudo apt-get install wine-doors

CrossOver安装
这个是收费软件,但是网上有些破解版本比如crossover 7 pro。下载后直接运行.sh脚本即可。
-----------------------------------------------------------------------

安装photoshop:可以直接用wine-doors,下载安装程序,但是要下载一个注册码算号器,安装过程和windows一致.

安装office2003,下载iso镜像(硬盘版的好像安装不成功),mount到/mnt/下,然后启动crossover进行正常安装。(crossover是wine的延伸,利用wine安装office要进行很多设置,但是尝试几次都不成功,用crossover则很方便的安装)。注意安装的过程会出现中文字体出现方块的情况,可以用上面wine的设置的方法,将windows字库拷贝到.cxoffice/../windows/Fonts/下。

[1]

[2]

[3]

Download images (local images only) as a tar.gz pack: Full Size Small Size
Source Code
Originated by Xianghui Xue at 2009-10-16 14:18 CST, Last modified at 2009-10-17 00:19 CST.

6 Mac4Lin 美化ubuntu Contents Top
1.下载安装文件:
Mac4Lin_v1.0.tar.gzc(http://sourceforge.net/projects/mac4lin/)

2.打开终端,进入到你的Mac4Lin_Install_v1.0解压目录,执行以下命令进行安装:

  ./Mac4Lin_Install_v1.0.sh

3.安装完成

如果你想卸载Mac4Lin,请按第三步操作,不同的是执行的命令是:

  ./Mac4Lin_Uninstall_v1.0.sh

4. Mac软件坞(下载包中已经默认安装了AWN)
 只要执行sudo apt-get install avant-window-navigator

 激活AWN自启动:

     菜单 -> 系统 -> 首选项 -> AWN manager (选择启动时自动启动)


  选择默认从dock菜单运行的applets:

      * 菜单 -> 应用程序 -> 附件-> Avant Window Navigator Manager

  可以拖拽应用程序图标到列表上,然后从列表激活或者解除applets。

=====================================================================

  也可安装compiz fusion 来实现很炫的3D效果,网上有很多介绍。 注意的一个问题是,我的laptop是双显卡,安装ubuntu的时候,我没有在bios中关闭板载显卡,因此感觉安装的显卡驱动仅仅是板载显卡的,而ati的独立显卡则没有驱动支持,我尝试在bios中关闭板载显卡和禁用显卡转换,然后用dpkg-reconfigure xserver-xorg,却找不到与显卡有关的选项(很奇怪!)。 并且独立显卡下,桌面3d功能无法开启?? 因此只好在bios关闭了独立显卡,开启板载显卡。

[4]

[5]

[6]

[7]

Download images (local images only) as a tar.gz pack: Full Size Small Size
Source Code
Originated by Xianghui Xue at 2009-10-16 14:19 CST, Last modified at 2009-10-19 04:18 CST.

7 fcitx输入法安装+中文字体配置 Contents Top
   ubuntu下的scim不是很好使用,很多人推荐fcitx。具体安装如下:
 
   1).卸载scim
   
   2).安装fcitx (aptitude install fcitx)
 
   3).配置:
      安装后,启动fcitx会发现中文的地方都显示为方块,解决的方法是修改~/.fcitx/config文件。将第一句显示字体(中)=*,改成显示字体(中)= (/etc/fonts/conf.d/69-language-selector-zh-cn.conf)中的某一个中文字体。比如我选的是AR PL UMing CN。我开始选择了WenQuanYi Zen Hei但是还是不成功,改成这个后OK。
      注意,如果用vim或者vi打开~/.fcitx/config,可能会出现乱码的情况,这个和你本地中文环境有关。可有locale查看,我的是UTF8。解决办法如果安装了gedit的话,可以在geidt中加入对编码的支持,做法为(alt+F2-> gconf-editor,在apps->gedit-2->preferences->encodings中添加GB18030,保存后把它移动到第一行),这样就可以查看config文件了。或者在命令行中执行(gedit --encoding=GBK ~/.fcitx/config)也可实现正常的编码。
      自动启动的设置:网上很多人推荐用im-switch进行fcitx的自动启动设置,但是我尝试发现,虽然这样可以使fcitx启动,但是用ctrl+space无法调出输入法。只能在窗口中在运行一次fcitx才可以。 后来我发现如果恢复im-switch为default(im-switch -c,选择default),然后在system->preference->starup application (会话)中添加新启动项,命令为fcitx,这样可以自动启动,并且ctrl+space有效。


-------------------------------------------------------------------------
   加入更多的中文字体:
   1)拷贝win下的中文字体
      sudo mkdir -p /usr/share/fonts/zh_CN/TrueType      
      sudo cp /mnt/win/WINDOWS/Fonts/simsun.ttc /usr/share/fonts/zh_CN/TrueType/
      .........
      .........
   
   2) 生成字体目录列表等命令:

      sudo chmod 644 /usr/share/fonts/zh_CN/TrueType/*

      cd /usr/share/fonts/zh_CN/TrueType/

      sudo mkfontscale

      sudo mkfontdir

      sudo fc-cache /usr/share/fonts/zh_CN/TrueType/


  
Source Code
Originated by Xianghui Xue at 2009-10-18 08:00 CST, Last modified at 2009-10-18 08:00 CST.

8 ie6+网上银行支持 Contents Top
   在安装好wine之后,可以用来安装ie,这样在linux下可以访问网上银行。
   首先安装cab文件的支持:sudo apt-get install  cabextract
   然后在http://www.tatanka.com.br/ies4linux/downloads/选择合适版本的ie4linux的安装程序(最新的版本是我尝试了安装不上,我的wine版本是1.1.31,后来选择了一个老版本2.0,可以正常安装)。安装方法很简单,在解压缩后直接./ie4linux 就可以了。
   注意:在选择语言支持的时候,选择CN; 安装程序会默认在home/~下建立一个bin目录,然后ln到.ie4linux下,而我把这个bin目录选择放入了./ie4linux下,这样整洁些。
   任务栏建立一个起动器,运行~/.ie4linux/bin/ie6,就可以直接用鼠标点击启动了。
   链接招商银行网上银行,在线安装插件,可以正常访问。

  问题:
  1.在安装中ie时候,提示err,但是最后install OK。
  2.ie访问网页正常,所以标签的中文也正常。在标签中执行确定,取消,应用的按键中文为方框。不影响使用。
 
  下图为安装网上银行插件。

[8]
Source Code
Originated by Xianghui Xue at 2009-10-19 01:00 CST, Last modified at 2009-10-19 01:00 CST.

9 FFmpeg Contents Top
1. Getting the Dependencies:
   sudo apt-get remove ffmpeg x264 libx264-dev
   sudo apt-get update
   sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libx11-dev libxvidcore4-dev zlib1g-dev

2. Install x264
  git clone git://git.videolan.org/x264.git
  cd x264
  ./configure
   make
   sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-0.0ubuntu1" --default

if successive:
**********************************************************************

Done. The new package has been installed and saved to

/home/xhxue/x264/x264_1:0.svn20091022-0.0ubuntu1-1_i386.deb

You can remove it from your system anytime using:

     dpkg -r x264

**********************************************************************


3. Install FFmpeg
  svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
  cd ffmpeg
  ./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
  make
  sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3" --default

**********************************************************************

Done. The new package has been installed and saved to

/home/xhxue/ffmpeg/ffmpeg_3:0.svn20091022-12ubuntu3-1_i386.deb

You can remove it from your system anytime using:

     dpkg -r ffmpeg

**********************************************************************


4. Using FFmpeg and x264
  One-pass CRF (Constant Rate Factor) using the hq preset:
  ffmpeg -i input.avi -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 output.mp4

  One-pass CRF (Constant Rate Factor) using the fastfirstpass and hq presets:
  ffmpeg -y -i input.avi -pass 1 -vcodec libx264 -vpre fastfirstpass -b 512k -bt 512k -threads 0 -f mp4 -an /dev/null && ffmpeg -i input.avi -pass 2 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -b 512k -bt 512k -threads 0 -f mp4 output.mp4

  Two-pass iPod 640x480 using the fastfirstpass, normal, and ipod640 presets:
  ffmpeg -y -i input.avi -pass 1 -vcodec libx264 -vpre fastfirstpass -vpre ipod640 -b 512k -bt 512k -s 640x480 -threads 0 -f ipod -an /dev/null && ffmpeg -i input.avi -pass 2 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre normal -vpre ipod640 -b 512k -bt 512k -s 640x480 -threads 0 -f ipod output.mp4


5. Updating Your Installation
  sudo apt-get remove ffmpeg x264 libx264-dev
  cd ~/x264
  make distclean
  git pull
  ./configure
  make
  sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-0.0ubuntu1" --default
  cd ~/ffmpeg
  make distclean
  svn update
  ./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
   make
   sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3" --default


6. Reverting Changes Made by This Tutorial
  sudo apt-get remove x264 ffmpeg build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libx11-dev libxvidcore4-dev zlib1g-dev

============================================================================

1. Make movie from .png figures
If you have a series of png figures and named with idl as the format "file=string(i, format='(I04)')+'.png', here  i=0, N", then you can use spawn in idl and generate mov movie as following :
 spawn 'ffmpeg -i %04d.png  output.mov'
Here %04d just matches the format='(I04)'
Source Code
Originated by Xianghui Xue at 2009-10-22 08:35 CST, Last modified at 2009-10-23 12:03 CST.

10 IBM硬盘保护安装 Contents Top
From http://www.thinkwiki.org/wiki/Install_Ubuntu_9.04_(Jaunty_Jackalope)_on_a_ThinkPad_T400#Active_Protection_System

Install Ubuntu 9.04 (Jaunty Jackalope) on a ThinkPad T400
==================================================================

Here is a Step by Step guidance How to protect the harddisk through APS with Kernel 2.6.28!

At first you have to delete existing kernel modules to make space for the new ones (Press ENTER after each line):

sudo rm /lib/modules/$KVER/kernel/ubuntu/misc/thinkpad_ec.ko
sudo rm /lib/modules/$KVER/kernel/ubuntu/misc/tp_smapi.ko
sudo rm /lib/modules/$KVER/kernel/drivers/hwmon/hdaps.ko


Then downlaod the newest packages:

You will need

   * tp_smapi-0.4 from here: http://sourceforge.net/project/showfiles.php?group_id=1212&package_id=171579
   * hdapsd-20090401.tar.gz from here: http://sourceforge.net/project/showfiles.php?group_id=138242&package_id=308030
   * gnome-hdaps-applet-20081204.tar.gz from here: http://www.zen24593.zen.co.uk/hdaps/

Save these things on your Desktop and unpack them, e.g.

tar xvfz hdapsd-20090401.tar.gz
tar xvfz tp_smapi-0.40.tgz
tar xvfz gnome-hdaps-applet-20081204.tar.gz

Then open the Terminal and type this to change into the tp_smapi directory:

cd Desktop/tp_smapi-0.40

Then try to load the kernel modules:

make load HDAPS=1 FORCE_IO=1

If there is written "drivers successfully loaded", you can type this for installation:

make install HDAPS=1 FORCE_IO=1

To laod these modules on startup you have to write them into the /etc/modules file:

sudo gedit /etc/modules

Append this to the file:

thinkpad_ec
tp_smapi
hdaps

We also need options to load these modules correctly. They have to be written in /etc/modprobe.d/local.conf

sudo gedit /etc/modprobe.d/local.conf

Fill the file with this code

# enable thinkpad_ec
options thinkpad_ec force_io=1

# option to correctly set tilting through hdaps sensor
options hdaps invert=1

Now you can try, if the modules are loaded yet. Do so with

lsmod | grep hdaps

if not perform:

sudo modprobe thinkpad_ec tp_smapi hdaps


Then install these packages:

sudo apt-get install hdaps-utils hdapsd

Afterwards you can test hdaps-gl (with typing hdaps-gl in terminal) which shows the position of your Laptop.

hdapsd is not working yet. Therefore we need to compile our newer version downloaded before.

cd Desktop/hdapsd-20090401/
./configure --prefix=/usr/
make
sudo make install

If compilation and installation succeeded, you can test it by typing this into your terminal:

sudo hdapsd -d sda -s 15 -a -v -y

If you suddenly move your laptop the output will change! (stop it with pressing Ctr + C)

The last step is, to copy an overworked initiation-script over the existing one.

The first line will download it, the second will set rights and the third one copies it to the right position. (Press ENTER after each!)

wget http://www.unet.univie.ac.at/~a0604095/hdapsd
sudo chmod 733 hdapsd
sudo cp hdapsd /etc/init.d/

Now you can start hdapsd with typing

sudo /etc/init.d/hdapsd start

After an reboot everything should start automatically and work correctly! You can change the sensitivity value and other things in this file: "/etc/default/hdapsd". To see the effects you have to type "sudo /etc/init.d/hdapsd restart" to restart hdapsd!

To install the gnome-panel-applet type these lines into the terminal:

sudo apt-get install libpanel-applet2-dev
cd Desktop/gnome-hdaps-applet-20081204
gcc $(pkg-config --cflags --libs libpanelapplet-2.0) -o gnome-hdaps-applet gnome-hdaps-applet.c
sudo cp gnome-hdaps-applet /usr/bin/
sudo mkdir /usr/share/pixmaps/gnome-hdaps-applet/
sudo cp *.png /usr/share/pixmaps/gnome-hdaps-applet/
sudo cp GNOME_HDAPS_StatusApplet.server /usr/lib/bonobo/servers/

The first line is to install required deps, second line is to move to the source directory (we have downloaded it looong time ago!), then we compile it and copy the files to several positions. After an reboot you can add this applet to the panel!
Source Code
Originated by Xianghui Xue at 2009-10-30 07:19 CST, Last modified at 2009-10-30 07:19 CST.

11 pgi 安装 Contents Top
(1)修改脚本
在pgi安装,检测linux是32位或是64位时候,使用命令是arch,在ubuntu下是没有这个命令的,因此将install脚本中arch命令用 -uname -m,即脚本中case `arch` in 改为  case `uname -m` in

(2)编译并安装
su root
# ./install  (我选择安装路径/usr/local/pgi)
注意:安装中有时候提示libc的版本问题,这个在google可以找到很多解决方案。

(3)用root用户把license.dat(在使用期范围的其他版本的license.dat也可以用)复制(cp)到/usr/local/pgi下

(4)把以下几行放到.bashrc的最后
export PGI=/usr/local/pgi/linux86/7.1
export PATH=$PGI/bin:$PATH
export MANPATH=$PGI/man:$MANPATH
export LM_LICENSE_FILE=/usr/local/pgi/license.dat
Source Code
Originated by Xianghui Xue at 2009-11-06 00:19 CST, Last modified at 2009-11-06 08:08 CST.

12 MPIch2安装 Contents Top
下载地址 http://packages.ubuntu.com/karmic/mpich2

安装依赖的其他包(dep 表示依赖的, rec表示推荐安装的):
     dep:libc6 (>= 2.7)
           GNU C Library: Shared libraries
           also a virtual package provided by libc6-udeb
     dep: libmpich2-1.2 (= 1.2-1ubuntu1)
         Shared libraries for MPICH2
     dep: python
         An interactive high-level object-oriented language (default version)
     dep: python-support (>= 0.90.0)
         automated rebuilding support for Python modules
     dep: python2.6
         An interactive high-level object-oriented language (version 2.6)
     rec: libmpich2-dev (= 1.2-1ubuntu1)
         Development files for MPICH2
     rec: mpich2-doc (= 1.2-1ubuntu1)
         Documentation for MPICH2

   安装好依赖包后,直接运行deb即可。
Source Code
Originated by Xianghui Xue at 2009-11-06 00:38 CST, Last modified at 2009-11-06 00:38 CST.

13 netcdf Contents Top
1.为了扩展编译,需要增加的一些环境变量(如果要编译CAM或者WRF还需要指定一下几个环境变量):
 export CC=/usr/bin/gcc
 export CXX=$PGI/linux86/7.1/bin/pgCC  (可以定义PGI=/usr/local/pgi)
 export CXXFLAGS="-g"
 根据:来源与网络http://bbs.lasg.ac.cn/?action-viewthread-tid-42087(指定gcc为C语言的编译器,据我试验不指定此编译器netcdf也能编译过去,不过要想编译WRFV就不行了,在 /WRFV2/arch/configure.wrf.default里有各种电脑、系统编译wrfv时所用的指定编译器参数,我是在那里找到的; 在反复试验的过程中,有时make会发现C++编译出错,说no accept -g,我把CXXFLAGS指定为“-g”后就可以了)


2. 下载最近的版本www.unidata.ucar.edu,阅读安装文件http://www.unidata.ucar.edu/software /netcdf/docs/netcdf-install/Building-on-Unix.html#Building-on-Unix。

 sudo ./configure --prefix=/where/you/like

 make; make check; make install

 ============================================
 因为前面提到安装了pgi,这样在下面编译的时候就需要有自己的选择,如果依赖netcdf的其他模式(如WRF等,要用pgi编译,那么netcdf也用使用pgi进行编译,否则在调用模块的时候会有错误。)这样就需要位netcdf指定相应的编译器。
 ./configure --prefix=/home/usrname/program/netcdf  FC=pgf90 CPPFLAGS=-DpgiFortran   [注意不用sudo,见下面说明!]
 然后,make, make check, make install

 ************* 注意事项 ***************
 1) netcdf最好装在本地目录下,如果安装在/usr/bin/等目录下时候,使用"sduo ./configure ...",那么指定pgf90编译器会有问题,提示无法编译f90文件,查看config.log会发现提示信息为"pgf90: command not found",这个原因是在root的bash中没有加入pgi的路径,我尝试在root的bash中加入pgi的路径,在用sudo去,同样失败。如果在sudo su,进入根提示符,运行pgf90没有问题; 但是如果sudo pgf90一样提示command not found。 因此只好安装在本地下。

 2) 在下一步make的时候,使用pgf90回出现错误,提示“netcdf Never use <bits/byteswap.h> directly”,解决方法,找到pgi安装目录/usr/local/pgi/linux86/7.1-6/include/bits/byteswap.h"文件,把开头代码:
  #if !defined _BYTESWAP_H && !defined _NETINET_IN_H
  # error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
  #endif
 
   改写为:
  #if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined  _ENDIAN_H
  # error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
  #endif

  3)如果不用pgi,使用gfortran作为默认编译器,执行sudo ./configure --prefix=/where/you/like,则没有任何问题。

  ************************************


3. 修改环境变量:
 为了使命令可以直接调用,加入.bashrc
 export NETCDF=/home/usrname/Program/netcdf
 export PATH=$NETCDF/bin:$PATH
 

4. 指导:
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-tutorial/index.html#Top

在利用netcdf对fortran进行支持的时候,需要加入编译参数,具体路径可以利用nc-config --all来查看include和lib的路径,即
 --cc        -> /usr/bin/gcc
 --cflags    ->  -I/home/xhxue/Program/netcdf/include
 --libs      -> -L/home/xhxue/Program/netcdf/lib -lnetcdf
 --cxx       -> /usr/local/pgi/linux86/7.1/bin/pgCC
 --has-c++   -> yes
 --fc        -> pgf90
 --fflags    -> -g -I/home/xhxue/Program/netcdf/include
 --flibs     -> -L/home/xhxue/Program/netcdf/lib -lnetcdf
 --has-f77   -> yes
 --has-f90   -> yes
 --has-dap   -> no
 --has-nc2   -> yes
 --has-nc4   -> no
 --has-hdf5  -> no

在编译中使用命令(加入-I参数,由fflags给出):
    pgf77 -I/home/xhxue/Program/netcdf/include -c  file.f
来进行编译。

 生成执行文件的时候,要指定lib的位置(如果是标准路径):
   pgf77 -o myprogram myprogram.o -L/home/xhxue/Program/netcdf/lib -lnetcdf

 利用ncdump可以来查看生成的nc文件。

 更多的测试文件可以从这里下载 http://www.unidata.ucar.edu/software/netcdf/examples/programs/



*************************未解决的问题************************************
4. 加入netcdf4的支持:

在configure的时候,加上参数--enable-netcdf-4 --with-hdf5=<hdf5安装路径>

这里需要hdf5的支持,在安装hdf5时候,需要zlib安装:
1)按照安装说明,需要的是zlib1.2.3版本,下载http://www.zlib.net.  
       默认安装目录 /usr/local/lib
2)hdf5 安装方法 http://www.hdfgroup.org/HDF5-FAQ.html#10
        需要使用hdf5-1.8.0版本,同时用zlib1.2.3 编译
       [我使用1.8.0没有编译通过,但是1.8.3版本正常编译]
       cd <top HDF5 source code directory>
       ./configure --prefix=/usr/local/hdf5 --with-zlib=/usr/local (注:不能加/lib?)
        make >& make.out
        make check >& check.out
        make install

   可以正常安装,但是问题是在进行文件编译的时候,此时利用nc-config可以看到,已经加入了netcdf4的支持,同时--flibs除了 netcdf的lib外,还加入了hdf5的lib,进行-c的时候没有问题,但在gfortran -o的时候提出出错。这个问题没有解决!!!主要的问题我认为是hdf5安装有问题,是否版本不对? 但1.8.0编译不过!! ---》 How??
Source Code
Originated by Xianghui Xue at 2009-11-06 00:39 CST, Last modified at 2009-11-06 08:08 CST.

14 安装NCARG Contents Top

0. 安装PPNGlib的支持,到http://www.libpng.org/pub/png/libpng.html 下载然后执行
  ./configure  --with-pic --disable-shared --prefix=/usr/local
   make all install

1. 下载ncl安装文件,到http://www.earthsystemgrid.org/下载和本地机器和gcc版本相近的ncl预编译版本。本地机器版本可以用uname -m查看,gcc版本用 gcc --version查看。我下载的是 NCL 5.1.1 32-bit binary for i686 chips for LINUX (compiled with gcc 4.3.2)。

2. 升级gfortran版本。由于这个版本是gcc-4.3.2进行预编译。我本地gcc版本是4.3.3,但gfortran版本是4.2,这个在后面测试时候会有问题(见最后的说明),因此需要升级gfortran:
  aptitude install gfortran-4.3
  rm /usr/bin/gfortran
  ln -s /usr/bin/gfortran-4.3 /usr/bin/gfortran

3. 配置环境变量:  (可参考http://www.ncl.ucar.edu/Download/install.shtml)
  export NCARG_ROOT=/usr/local/NCARG
  export PATH=/usr/local/NCARG/bin:$PATH
  export DISPLAY=:0.0
  export NCARG_LIB=/usr/local/NCARG/lib
  export NCARG_INC=/usr/local/NCARG/include

4. 配置文件:
  在~/ 目录下建立.hluresfile文件,然后把下面内容复制(此文件说明见:http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml)
!=========================================
! comments for ".res" files are preceded by a "!"
! remember quotations are not used in .res files
! White background/black foreground
*wkForegroundColor  : (/0.,0.,0./)
*wkBackgroundColor  : (/1.,1.,1./)
*wkColorMap         : rainbow+gray
! Font stuff
*Font           : helvetica
! Function Codes [Default is a colon ]
*TextFuncCode               : ~    
! Make default X11 window larger (adjust as necessary)
*wkWidth                     : 800
*wkHeight                    : 800
! Have a favorite colormap that you use for everything? You can
! make it your default here (note the name is NOT in quotes):
! *wkColorMap  : temp1
! Increase the default (16mb) contour memory
! If you gave gridded data > 500 x 500, you may need this
*wsMaximumSize: 32556688
!==========================================


5. 安装
  将下载的文件解压,把里面的三个子文件夹bin, lib, include拷贝到目标文件夹,即/usr/local/NCARG。
  然后在~/, 分别执行
         ng4ex gsun01n  ncl gsun01n.ncl  
         ncargex cpex08, ctrans -d X11 cpex08.ncgm  
 此时,可以看到测试的显示结果。

---------注意--------------
   执行ncargex cpex08(实际上在执行ng4ex gsun01n后,将两个fortran的程序和gsun01n.ncl一起拷贝的当前的文件夹下,ncargex cpex08这条命令是对两个f文件编译的过程!)之后,显示:
NCAR Graphics Fortran  Example <cpex08>
 Copying cpex08.f
 Copying cpexcc.f
Compiling and linking...
gfortran -fPIC -fno-second-underscore -fno-range-check -O -o cpex08 cpexcc.f cpex08.f -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -lX11 -lXext -lpng -lz

/usr/local/lib/libncarg.a(cpcldm.o): In function `cpcldm_':
cpcldm.f:(.text+0x8ab): undefined reference to `_gfortran_copy_string'
cpcldm.f:(.text+0xf36): undefined reference to `_gfortran_copy_string'
cpcldm.f:(.text+0xfc8): undefined reference to `_gfortran_copy_string'
cpcldm.f:(.text+0x10bd): undefined reference to `_gfortran_copy_string'
cpcldm.f:(.text+0x11c4): undefined reference to `_gfortran_copy_string'
/usr/local/lib/libncarg.a(cpcldm.o):cpcldm.f:(.text+0x127f): more undefined references to `_gfortran_copy_string' follow
collect2: ld return 1
The compile and link failed.

  如果出现以上信息,说明gfortran的版本有问题,按照前面的方法升级gfortran可以解决。
Source Code
Originated by Xianghui Xue at 2009-11-06 08:16 CST, Last modified at 2009-11-06 10:09 CST.




Locations | Statistics | FAQ
Best view under the 1024x768 resolution and with the normal size of fonts.
Designed & developed by Yuming Wang, run for 6432 days since December 15, 2006, and last upgraded on May 28th, 2009.
Powered by Apache + PHP coded cOpfOs 3.11.1 last upgraded on February 22nd, 2010.
Copyright © 2006, all rights reserved.