sort -k x [-n] -m file_1 file_2 ... file_k
在服务器上安装libnss-ldap,
sudo apt-get install libnss-ldap,
修改/etc/ldap.conf,如:
base dc=imd,dc=com
uri ldap://ldap.prod.i-md.com/
ldap_version 3
pam_login_attribute uid
pam_lookup_policy yes
pam_check_host_attr no
pam_password md5
nss_base_passwd ou=People,dc=imd,dc=com
nss_base_shadow ou=People,dc=imd,dc=com
nss_base_group ou=Group,dc=imd,dc=com
nss_initgroups_ignoreusers backup,bin,daemon,ftp,games,gnats,irc,libuuid,list,lp,mail,man,messagebus,news,postfix,proftpd,proxy,root,sshd,statd,sync,sys,syslog,uucp,www-data
另外,要让登录后自动建立home目录,只需要在/etc/pam.d/common-account中加入:
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022
准备工作:Ubuntu12.10已经成功安装+下载NS2安装文件,我这里是ns-allinone-2.33.tar,另外准备两个补丁:tk-8.4-lastevent.patch和tk-8.4.18-tkBind.patch
第一步:将ns2的压缩包ns-allinone-2.33.tar.gz拷贝到桌面,右键解压到桌面,将解压后的文件夹复制到准备安装的位置,
例如我的件夹home/wl(wl是登录用户名)下新建文件夹program,将ns2的文件夹粘帖到home/wl/program下。
第二步:在root的用户名下或admin用户下,下载并安装ns-2.33安装时需要的系统包,具体如下:
首先,在终端里输入apt-get install build-essential 进行下载安装,这一步是为了gcc and some essential 的安装;
接着,在终端里输入apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev 进行下载安装,这一步是为了tcl and tk 的安装;
最后,在终端里输入apt-get install libxmu-dev 进行下载安装,这一步是为了nam的安装。
第三步:检查gcc版本,现在系统自动安装的版本一般高于4.0,但是安装之前仍有必要检查下,终端命令如下:
终端执行ls /usr/bin/gcc –l或者gcc --rsion或者gcc -v都可以,我的是gcc4.7.2
因为gcc 4.0版本以前是用ld -share来生成共享库的,但是到了4.0以上的版本,这个命令改为了gcc -share。
所以,若版本高于gcc4.0则需要做如下更改:
cd /home/liu/Program/ns-allinone-2.33//otcl-1.13
do gedit configure.in
将77行,SHLIB_LD="ld -shared" 改为SHLIB_LD="gcc -shared"保存,退出
同时修改configure 第5518行SHLIB_LD="ld -shared"改为SHLIB_LD="gcc -shared"保存退出。
上述修改是终端命令的形式,也可以在视图下直接打开,前提是开放文件的“read and write"权限。
第四步:由于我的是安装的ns2.33,据说存在一些问题,所以提前进行了测试并安装了补丁,具体步骤如下:
(1)运行自带的实例进行测试: /ns-allinone-2.33/ns-2.33/tcl/ex/simple.tcl
可能的问题:
系统提示如下,
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."
原因:据说是ns2.33,它的nam调用的tk组件和xproto-7.0.13 不兼容导致的(xproto-7.0.13 新添加了 GenericEvent),所以在安装ns2之前要先打上补丁。如果不打上补丁的话,后面调用nam时会报错。
解决方法为:
(1)打上准备的补丁tk-8.4-lastevent.patch
把这个文件移动至ns目录下tk8.4.18下
$ cd/home/liu/Program/ns-allinone-2.33/tk8.4.18
$ patch –p1<tk-8.4-lastevent.patch
(2)打上准备的补丁tk-8.4.18-tkBind.patch
将文件tk-8.4.18-tkBind.patch移至ns-allinone-2.33目录下,并运行如下命令:
$patch -p0 <tk-8.4.18-tkBind.patch
第五步:开始安装安装ns2,具体命令如下:
移动到ns2目录下cd /home/liu/Program/ns-allinone-2.33/
安装 ./install
PS:本以为接下来是经过几分钟的翻滚,然后安装成功,但是遇到如下一系列问题,咱们逐一解决:
1.输入安装命令后,提示“Permission denied"的错误,尽管我已经是root的身份进行安装仍然有如此提示,解决方法是:修改install的权限,这个在视图下进行,修改如下图所示
再重新安装即可。
终于开始安装了,但不顺的是如下问题出现:
1.错误一:安装NS2.34过程中出现如下的错误:
tools/ranvar.cc: In member function ‘virtual double GammaRandomVariable::value()’:
tools/ranvar.cc:219:70: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly
tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’
make: *** [tools/ranvar.o]错误1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
这是由于gcc版本提高后对类内部函数调用的简化造成的不兼容,解决方法如下:
在ns-allinone-2.34/ ns-2.34/tools文件夹下,找到报错提示中的ranvar.cc文件,打开找到对应的219行删除::GaammaRandomVariable,保存,
即:将219行的 return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
改为: return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
然后保存退出,重新安装ns2.
2.错误二:重新在ns目录下键入$ ./install安装,再次出现同类问题时,
mobile/nakagami.cc: In member function ‘virtual double Nakagami::Pr(PacketStamp*, PacketStamp*, WirelessPhy*)’:
mobile/nakagami.cc:183:73: error: cannot call constructor ‘ErlangRandomVariable::ErlangRandomVariable’ directly
mobile/nakagami.cc:183:73: error: for a function-style cast, remove the redundant ‘::ErlangRandomVariable’
mobile/nakagami.cc:185:67: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly
mobile/nakagami.cc:185:67: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’
make: *** [mobile/nakagami.o]错误1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
解决方法:
在ns-allinone-2.34/ ns-2.34/ mobile文件夹下,找到报错提示中的nakagami.cc文件,打开找到对应的183行删除::ErlangRandomVariable,保存,
即:将183行的 resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();
改为: &nbs