我在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中…..糾結痛苦……
終於找到一老外牛人在solaris下編譯samba的帖子(原帖地址:http://panoramicsolution.com/blog/?p=134),參照他的帖子,
根據他的參數,我修改了下下,就是黃色的部分,如下:
./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~:
Load smb config files from /usr/local/samba3/lib/smb.conf
rlimit_max: rlimit_max (2000) below minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
只是發現有個小小的瑕疵:
rlimit_max: rlimit_max (2000) below minimum Windows limit (16384)
原來是系統限制了open file的數量,小小地修改之:
ulimit –n 20000 (最好寫入/etc/security/limits文件)
搞定!
注意:
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
browseable = no
# 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即可。