root@test root]# rpm -qa | grep samba
[root@test root]# rpm -e --nodeps sambaclient
[root@test root]# cd /usr/local/src
[root@test src]# tar -zxvf /root/soft/samba-2.2.8a.tar.gz
这个时候会有一个目录跑出来: /usr/local/src/samba-2.2.8a
 
[root@test src]# cd samba-2.2.8a 
[root@test samba-2.2.8a]# cd source
[root@test source]# ./configure --prefix=/usr/local/samba --with-automount --with-smbmount --with-pam --with-mmap --with-quotas --with-libsmbclient --sysconfdir=/etc/samba
[root@test source]# make
[root@test source]# make install
[root@test source]# vi /etc/profile
##在export前一行加上PATH=$PATH:/usr/local/samba/bin:/usr/local/samba/sbin
[root@test source]# cd /etc/samba
[root@test samba]# ln -sv /etc/samba/smb.conf /usr/local/samba/lib/
[root@test samba]# more smb.conf | grep -v "#" | grep -v ";" | more
[global]
   workgroup = MYGROUP               # 工作组
   server string = Samba Server           # 主机说明
   printcap name = /etc/printcap          
   load printers = yes                
   cups options = raw
   log file = /var/log/samba/%m.log         # log文件
   max log size = 50
   security = user                 # 使用密码模式登录
   encrypt passwords = yes
   smb passwd file = /etc/samba/smbpasswd      # 密码文件
   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
   dns proxy = no
   idmap uid = 16777216-33554431
   idmap gid = 16777216-33554431
   template shell = /bin/false
   winbind use default domain = no
 
[share]
  comment = share
  path = /var/samba                  # 用户的主目录
   public = yes                    # 所有人可读
   writable = yes                     # 可写
   printable = no
   create mask = 0755                   # 创建文件的权限
   directory mode = 0755                # 创建目录的权限
 
 [homes]
    comment = Home Directories             # 描述
    browseable = no                  # 其他用户不可浏览
    writable = yes                   # 可写
    valid users = %S                  # 用户的主目录
    create mode = 0664                  # 创建文件的权限
    directory mode = 0775               # 创建目录的权限
[root@test samba]# touch /etc/samba/smbpasswd       # 建立samba密码文件
[root@test samba]# smbpasswd -a root        # 建立samba用户
[root@test samba]# mkdir /var/samba          # 建立samba主目录
[root@test samba]# chown root:root /var/samba     # 授权,使所有用户都有写入权限
[root@test samba]# chmod 777 /var/samba
[root@test samba]# smbd start              # 启动
[root@test samba]# nmbd start
[root@test samba]# echo "/usr/local/samba/sbin/smbd start" >> /etc/rc.local        # 建立开机自启动
[root@test samba]# echo "/usr/local/samba/sbin/nmbd start" >> /etc/rc.local