安装环境:Centos 6.5
安装包:samba 4.3.4
依赖包:gnutls-devel ,python,python-devel,python-lib*,libacl-devel,openldap-devel
安装三步曲:./configure、make 、make install
一、编译安装
从官网samba.org下载源码包samba-4.3.4.tar.gz
1、安装依赖包:
yum install -y gnutls-devel python python-devel python-lib* libacl-devel openldap-devel
2、解压安装包:
tar zxvf samba-4.3.4.tar.gz
cd /samba-4.3.4 #进入samba-4.3.4目录
查看一下目录文件:
[root@centos ~]# ls samba-4.3.4
auth file_server python testsuite
bin include README third_party
BUILD_SYSTEMS.txt install_with_python.sh README.cifs-utils upgrading-samba4.txt
buildtools lib README.Coding VERSION
callcatcher-exceptions.grep libcli README.contributing WHATSNEW.txt
configure libds release-scripts wintest
configure.developer libgpo Roadmap wscript
COPYING librpc script wscript_build
ctdb Makefile selftest wscript_build_embedded_heimdal
dfs_server nsswitch source3 wscript_build_system_heimdal
docs packaging source4 wscript_build_system_mitkrb5
docs-xml PFIF.txt testdata wscript_configure_system_mitkrb5
dynconfig pidl testprogs
examples prog_guide4.txt tests
执行./configure,如果还提示有依赖包未安装,根据提示用yum安装依赖包,直到不提示error错误
[root@centos samba-4.3.4]# ./configure
'configure' finished successfully (57.429s)
[root@centos samba-4.3.4]#make
[root@centos samba-4.3.4]# make install
这二步需要时间比较长,需要耐等待,执行完这二步后编译安装完成。
samba编译安装默认没有加载samba的动态连接库,需要在/etc/ld.so.conf最后一行加入samba的动态连接库,如下:
[root@centos samba]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/samba/lib
加载动态连接库
[root@centos samba]# ldconfig
二、配置samba
默认是没有smb.conf这个配置文件的,需要从安装包samba-4.3.4/packaging/LSB/下复制smb.conf到/usr/local/samba/etc下
samba下有以下几个目录:
[root@centos samba]# ls
bin etc include lib lib64 private sbin share var
bin:存放samba的工具,如smbpasswd
etc:存放配置文件,例如上面复制过来 smb.conf
lib,lib64:动态链接库
sbin:存放服务程序,例如smbd
share:samba默认共享目录
var:存放samba日志和运行PID
启动samba:
[root@centos samba]# /usr/local/samba/sbin/smbd
[root@centos samba]# netstat -anutp | grep smbd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 90046/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 90046/smbd
tcp 0 0 :::445 :::* LISTEN 90046/smbd
tcp 0 0 :::139 :::* LISTEN 90046/smbd