天天看点

在AIX上编译Samba

我在AIX上编译Samba的实况贴,贴上来备忘。

废话不说,进入正题。

我用的gcc版本:

bash-3.00# gcc -v

Using built-in specs.

Target: powerpc-ibm-aix6.1.0.0

Configured with: ../gcc-4.2.4/configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --host=powerpc-ibm-aix6.1.0.0

Thread model: aix

gcc version 4.2.4 

为了执行configure你可能需要在你的AIX上安装一些prerequirese ,这个就不说了,你执行configure由于缺少prerequirese 失败的话,会提示的,跟着安就好了。 

注意PATH里面不要包括/usr/ucb,如果包含的话,会提示说后继操作可能会报错。

如果你的PATH里面有/usr/local/bin和/opt/freeware/bin等自己的路径,注意把他们放到系统原有path的后面而不是前面,避免和系统的冲突,即这样:

export PATH=$PATH:/usr/local/bin

而不是:export PATH=/usr/local/bin:$PATH

我用的是:/usr/bin:/etc:/usr/sbin:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin:/usr/local/bin:/opt/freeware/bin

进入source3 (3.x的代码)

./configure --prefix=/usr/local/samba3 --with-static-modules=MODULES

然后你make,咦!报错!

嘿嘿,原来是你需要这样:

make -d -f Makefile-noincludes

然后继续make,结果报:

Linking non-shared library bin/libsmbclient.a

make: Cannot find a rule to create target EXTRA_FLAGS from dependencies.

我晕~~~

然后N久N久的googlebaidu中…..纠结痛苦……

根据他的参数,我修改了下下,就是黄色的部分,如下:

./configure --with-automount --without-ldap --enable-socket-wrapper \

--with-quotas --with-sys-quotas --with-acl-support --with-aio-support \

--with-pam --enable-static –prefix=/usr/local/samba3

。。。。。。。。

终于……哇!成功啦!!!!!O(∩_∩)O哈哈~

然后根据帖子,又修改了Makefile-noincludes,修改同时,我一不做二不休,把Makefile-noincludes里面的EXTRA_FLAGS一行也大刀砍去,哼!叫你找不到规则!

就是把这行:

$(LIBSMBCLIENT_THREAD_OBJ) ../nsswitch/wins.o ../nsswitch/winbind_nss_linux.o: EXTRA_FLAGS := $(PTHREAD_CFLAGS)

注释掉即可。

现在Make,哈哈,成功!!!

接着乘胜追击,make install下下~~

成功~~~

可是,你注定会发现居然install后的安装目录里面竟然没有smbd和nmbd!

然后你就又不得不看下Makefile里面的install一节,发现个一劳永逸的办法,那就是要重新install,用:make install-everything

O(∩_∩)O哈哈~

你install完成后,结果直接执行smbd,惊奇地发现:怎么还是没有smbd和nmbd!

我晕~~哈哈,你再执行make installbin想单独安装bin文件,

结果发现安装日志里面写了安装所有bin目录下的程序,可就是没有安装smbd和nmbd,晕死!

唉,算了,目前我就是手动copy 的~~晕J哈哈

好了,现在执行testparm测试下下。

报错:

Load smb config files from /usr/local/samba3/lib/smb.conf

rlimit_max: rlimit_max (2000) below minimum Windows limit (16384)

params.c:OpenConfFile() - Unable to open configuration file "/usr/local/samba3/lib/smb.conf":

        No such file or directory

Error loading services.

此时,需要将源码包里的./examples/smb.conf.default复制到/usr/local/samba3/lib/smb.conf。

再执行testparm:

Could not load program /usr/local/samba3/bin/testparm:

        Dependent module libwbclient.so could not be loaded.

Could not load module libwbclient.so.

System error: No such file or directory

明显没有找到库嘛,把/usr/local/samba3/lib/:/opt/freeware/lib加到了LD_LIBRARY_PATH里面,分别放入/.dtprofile和/etc/profile,随便对这两个文件中的某个执行下source,

重新testparm,成功O(∩_∩)O~:

Processing section "[homes]"

Processing section "[printers]"

Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

只是发现有个小小的瑕疵:

原来是系统限制了open file的数量,小小地修改之:

ulimit –n 20000 (最好写入/etc/security/limits文件)

搞定! 

<b>注意:</b>

1. 貌似,两个AIX在同一网段,用的后面的“要求输入用户名和密码的samba配置文件”的配置文件,那么,需要确保他们的workgroup是不一样,否则samba从windows上映射网络驱动器会有问题,提示:同一个用户不能用一个以上的用户名连接服务器。 

要求输入用户名和密码的samba配置文件:

 [global] 

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH

   workgroup = NEWGROUP 

# server string is the equivalent of the NT Description field

   server string = AIX 108.71 Samba Server 

# Security mode. Defines in which mode Samba will operate. Possible

# values are share, user, server, domain and ads. Most people will want

# user level security. See the Samba-HOWTO-Collection for details.

   security = user

   netbios name = aix71 

# If you want to automatically load your printer list rather

# than setting them up individually then you'll need this

   load printers = yes 

# this tells Samba to use a separate log file for each machine

# that connects

   log file = /usr/local/samba/var/log.%m 

# Put a capping on the size of the log files (in Kb).

   max log size = 50 

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names

# via DNS nslookups. The default is NO.

   dns proxy = no

 #============================ Share Definitions ==============================

[homes]

   comment = Home Directories

   browseable = no

   writable = yes 

# NOTE: If you have a BSD-style print system there is no need to

# specifically define each individual printer

[printers]

   comment = All Printers

   path = /usr/spool/samba

# Set public = yes to allow user 'guest account' to print

   guest ok = no

   writable = no

   printable = yes 

[brant]

;   comment = Mary's and Fred's stuff

   path = /

   valid users =  root

   public = yes

   writable = yes

   browseable = yes

;   printable = no

;   create mask = 0765

如果不要输入密码,把security改为share即可。

本文转自 xkdcc 51CTO博客,原文链接:http://blog.51cto.com/brantc/436144,如需转载请自行联系原作者