OEL6下艰难的samba3.6源码安装

在OEL6 下安装samba3.6源码包,折腾了近两天才搞定,郁闷啊,写这篇blog的时候,samba3.6 install problem 在internet上非常少,只有这个URL
http://blog.csdn.net/xyp84/article/details/6830984 说了下安装一些步骤和问题,但我的环境不符合这位哥的情况,最后在国外论坛上看到一条信息才解决。

我的安装大致解决三个问题:1、安装  2、smbd服务启动  3、认证tdb故障

下面是我的基本处理过程:

1、 下载samba3.6 并解压

[root@heliy /home/fukeyun/Desktop/download/temp]#ls ../samba-3.6.0.tar.gz
../samba-3.6.0.tar.gz

[root@heliy /home/fukeyun/Desktop/download/temp]#ls

samba-3.6.0

2 、安装

#cd ./samba-3.6.0

[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0]#find . -name 'configure'
./lib/tdb/configure
./lib/replace/configure
./lib/talloc/configure
./lib/tevent/configure
./source4/lib/ldb/configure
./source3/configure

[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0]#cd ./source3

[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0/source3]#./autogen.sh 

[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0/source3]#./autogen.sh
./autogen.sh: running script/mkversion.sh
./script/mkversion.sh: 'include/version.h' created for Samba("3.6.0")
./autogen.sh: running autoheader -Im4 -I../m4 -I../lib/replace
./autogen.sh: running autoconf -Im4 -I../m4 -I../lib/replace
Now run ./configure (or ./configure.developer) and then make.

安装完后提示你./configure 或 ./configure.developer
#./configure    ##默认安装到/usr/local/samba ,如果想安装到其他path,加--prefix=/path.. 或 --help查看详细信息
#make
#make install
需要几分钟时间。

3、配置
先cp配置文件,再启动服务,不然出现如下错误:
[root@heliy /usr/local/samba]#cat ./var/log.smbd
[2011/10/26 04:56:37,  0] smbd/server.c:1045(main)
  smbd version 3.6.0 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2011
[2011/10/26 04:56:37,  0] smbd/server.c:1060(main)
  error opening config file

拷贝smb.conf文件
[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0/source3]#cp ../examples/smb.conf.default /usr/local/samba/lib/smb.conf
#vi /usr/local/samba/lib/smb.conf

smb.conf文件只有两个location
/etc/samba/smb.conf or /usr/local/samba/lib/smb.conf

简单配置下,详细配置见附件

查看smb.conf文件调用路径和测试smb.conf文件是否有语法错误:

#  smbd -b | grep smb.conf

testparm

启动服务

启动nmbd -D 能启动,但smbd无法启动

查看日志:

#cat ./var/log.smbd
错误如下:

smbd version 3.6.0 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2011
/usr/local/samba/sbin/smbd: symbol lookup error: /usr/local/samba/sbin/smbd: undefined symbol: wbcSidsToUnixIds
[2011/10/26 05:31:27,  0] smbd/server.c:1045(main)

就这个错误折腾我近两天,郁闷,国外论坛有条信息如下:

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

Guido Leenders 2011-09-13 18:05:57 UTC

I had the same problem when compiling Samba 3.6.0 from source.
In the log.smbd it said: undefined symbol wbcSidsToUnixIds for smbd.

Configure options:

./configure --prefix=/usr --exec-prefix=/usr --with-ldap --with-libtalloc=no
--enable-external-libtalloc=no --with-libtdb=no --enable-external-libtdb=no
--with-libnetapi --with-libsmbclient --with-libsmbsharemodes --with-libaddns
--with-ads --with-dnsupdate --with-pam --with-acl-support --with-aio-support
--with-winbind --with-lockdir=/var/lib/samba --with-configdir=/etc/samba
--with-logfilebase=/var/log/samba

The installation did install libwbclient:
Installing module pam_smbpass as ///usr/lib/security/pam_smbpass.so
Installing module pam_winbind as ///usr/lib/security/pam_winbind.so
/usr/bin/install -c bin/libwbclient.so.0 //usr/lib
if test -r bin/libwbclient.so.0 ; then \
                ln -f -s `basename bin/libwbclient.so.0` \
                        //usr/lib/`basename bin/libwbclient.so` ; \
        fi
: bin/libwbclient.a //usr/lib
/usr/bin/install -c -m 0644
/usr/local/src/samba-3.6.0/source3/../nsswitch/libwbclient/wbclient.h
//usr/include


Resolution for me was simply:

ldconfig

And restart smbd.

Rgds,

Guido Leenders

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

很明显,是libwbclient.so库文件问题

[fukeyun@heliy ~]$ls /usr/lib/libw
libwavpack.so.1       libwbclient.so.0      libwnck-1.so.22.3.23
libwavpack.so.1.1.3   libwnck-1.so.22   

如果没有,安装库文件:

[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0/source3]#/usr/bin/install -c  ./bin/libwbclient.so.0  /usr/lib
再启动服务

smbd -D 和 nmbd -D

[root@heliy /usr/local/samba]#ps -ef |grep 'mbd'
root     31681     1  0 05:49 ?        00:00:00 ./sbin/smbd -D
root     31682 31681  0 05:49 ?        00:00:00 ./sbin/smbd -D
root     31720     1  0 05:51 ?        00:00:00 ./sbin/nmbd -D
root     32149  2828  0 06:16 pts/0    00:00:00 grep mbd

如果认为samba就此建好了,就大错了,由于默认安装gnome-desktop时安装了samba一些rpm包,会造成在全局环境下命令不是源码包的命令,比如smbpasswd

,你which smbpasswd 看明显不是/usr/local/samba/bin下的命令,testparm

用到的smb.conf文件是/etc/samba/smb.conf,所以我现在才明白samba的安装只有两种正确方式:1、用系统光盘的RPM包,或下载的RPM安装 。就不需要卸载已安装的samba rpm包  2、用源码包安装前最好卸载samba 的rpm包,我现在介绍第2种方式:

删掉rpm包

[root@heliy /usr/local/samba]#rpm -aq | grep -i 'samba'
samba-common-3.5.4-68.el6.i686
samba-winbind-clients-3.5.4-68.el6.i686
samba-client-3.5.4-68.el6.i686
[root@heliy /usr/local/samba]#rpm -e samba-client-3.5.4-68.el6.i686
[root@heliy /usr/local/samba]#rpm -e samba-common-3.5.4-68.el6.i686

再按前面写的安装samba,./configure make make install (题外话:由于我是按上面的方法安装初次,所以要删除前面的安装make uninstall  再删除一些目录[root@heliy /usr/local/samba]#rm -fR /etc/samba/
[root@heliy /usr/local/samba]#rm -fR /usr/local/samba/
[root@heliy /usr/local/samba]#rm -fR /var/log/samba/
[root@heliy /usr/local/samba]#rm -fR /var/lib/samba/    )

cp smb.conf 和配置,上面有

设置全局环境变量

[root@heliy /usr/local/samba]#vi /etc/profile.d/heliy.sh

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

[root@heliy /usr/local/samba]#source /etc/profile.d/heliy.sh
root@heliy /usr/local/samba]#env | grep 'PATH'
PATH=/usr/lib/qt-3.3/bin:/usr/local/bin:............:/usr/local/samba/bin/

在这里有个小收获: 我打开了两个终端,我用source /etc/profile.d/heliy.sh后,本终端可以获取全局变量更改后的路径,另一个不行,比如输入smb再按TAB键,第一个终端就可以显示很多命令,第二个就不行,必须关闭打开新的才有。

设置用户

#smbpasswd -a fukeyun

#smbpasswd -e fukeyun

启动服务 smbd -D  nmbd -D       就不会出现本blog前面的错误提示

最后登录如下:

[root@heliy /home/fukeyun]#smbclient -L //localhost/myshare -U fukeyun
Enter fukeyun's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.0]

    Sharename       Type      Comment
    ---------       ----      -------
Error returning browse list: NT_STATUS_CONNECTION_INVALID
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.0]

    Server               Comment
    ---------            -------
    HELIY                Samba Server

    Workgroup            Master
    ---------            -------
    WORKGROUP            HELIY

[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0/source3]#smbclient -L //localhost -U%
smbclient: symbol lookup error: smbclient: undefined symbol: tdb_transaction_start_nonblock

上面出现了error:kill smbd和nmbd ,查看日志,出现以下错误:

[2011/10/29 05:32:51,  0] smbd/server.c:1045(main)
  smbd version 3.6.0 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2011
./sbin/smbd: symbol lookup error: ./sbin/smbd: undefined symbol: tdb_transaction_start_nonblock

 一波未平,一波又起啊

#cd .././lib/tdb

#./configure   &&  make  && make install

在国外网站上搜到samba3.6的库文件:

libnetapi.so.0
libsmbclient.so.0
libsmbsharemodes.so.0
libtdb.so.1.2.9
libwbclient.so.0

tdb.h, libtdb.so.1.2.9
tdb_jenkins_hash ( TDB_DATA* key )
tdb_summary ( tdb_context* tdb )
tdb_transaction_start_nonblock ( tdb_context* tdb )

wbclient.h, libwbclient.so.0
wbcDcInfo ( char const* domain, size_t* num_dcs, char const*** dc_names, char const*** dc_ips )
wbcLookupSids ( wbcDomainSid const* sids, int num_sids, wbcDomainInfo** domains, int* num_domains, wbcTranslatedName** names )
wbcSidsToUnixIds ( wbcDomainSid const* sids, uint32_t num_sids, wbcUnixId* ids )
wbcSidToStringBuf

明显和上面smbd起不来的原因相同,都是库文件的原因

[root@heliy /usr/local/samba]#ls  -l /usr/lib/libtd*
-rwxr-xr-x. 1 root root 68316 Oct 29 05:31 /usr/lib/libtdb.so
lrwxrwxrwx. 1 root root    15 Sep  6 03:59 /usr/lib/libtdb.so.1 -> libtdb.so.1.2.1
-rwxr-xr-x. 1 root root 60932 Jul  7  2010 /usr/lib/libtdb.so.1.2.1
-rwxr-xr-x. 1 root root 68316 Oct 29 05:25 /usr/lib/libtdb.so.1.2.9
lrwxrwxrwx. 1 root root    16 Sep  6 03:59 /usr/lib/libtdsS.so.2 -> libtdsS.so.2.0.0
-rwxr-xr-x. 1 root root  4100 Jul  9  2010 /usr/lib/libtdsS.so.2.0.0

删除libtdb.so 、 libtdb.so.1 、 libtdb.so.1.2.1,保留libtdb.so.1.2.9

建个link

#ln -s /usr/lib/libtdb.so.1.2.9 /usr/lib/libtdb.so.1

再此启动smbd -D,就没有任何错误了

[2011/10/29 05:56:18,  0] smbd/server.c:1045(main)
  smbd version 3.6.0 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2011
[2011/10/29 06:03:06,  0] smbd/server.c:1045(main)
  smbd version 3.6.0 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2011

[fukeyun@heliy ~]$ps -ef | grep 'mbd'
root      1762     1  0 16:27 ?        00:00:00 /usr/local/samba/sbin/smbd -D
root      1764     1  0 16:27 ?        00:00:00 /usr/local/samba/sbin/nmbd -D
root      1770  1762  0 16:27 ?      00:00:00 /usr/local/samba/sbin/smbd -D
[fukeyun@heliy ~]$ps -ef | grep 'winb'
root      4181     1  0 18:05 ?        00:00:00 /usr/local/samba/sbin/winbindd
root      4182  4181  0 18:05 ?     00:00:00 /usr/local/samba/sbin/winbindd
fukeyun   4184  3504  0 18:06 pts/1    00:00:00 grep winb

[root@heliy /home/fukeyun/Desktop/download/temp/samba-3.6.0/source3]#smbclient -L //localhost -U fukeyun

 

Enter fukeyun's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.0]

    Sharename       Type      Comment
    ---------       ----      -------
    myshare         Disk      Mary's and Fred's stuff
    IPC$            IPC       IPC Service (Samba Server)
    fukeyun         Disk      Home Directories
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.0]

    Server               Comment
    ---------            -------
    HELIY                Samba Server
    MHQ-XXB0003         

    Workgroup            Master
    ---------            -------
    WORKGROUP            MHQ-XXB0003

从xp远程共享连接:

 

这篇blog只是解决了samba3.6源码安装的一些问题,至于smb.conf  、一些命令、swat、linux入域、samba备份等问题将逐步用blog记录,大家一起学习。

你可能感兴趣的:(samba,休闲,源码安装,OEL6,samba3.6)