linux下centos下安装samba服务

第一步下载:

wget https://download.samba.org/pub/samba/stable/samba-4.6.7.tar.gz

看了下没看到啥有用的直接安装:

./configure --prefix=/usr/local/samba  ,其实默认也是安装到这个目录

报错:
Checking for program xsltproc                                                     : not found
Checking for program python                                                       : /usr/bin/python
Checking for program python                                                       : /usr/bin/python
Checking for program python                                                       : /usr/bin/python
Checking for Python version >= 2.6.0                                              : ok 2.7.5
Checking for library python2.7                                                    : not found
Checking for library python2.7                                                    : not found
Checking for library python27                                                     : not found
Checking for program python2.7-config                                             : not found
Checking for program python-config-2.7                                            : not found
Checking for custom code                                                          : Could not find the python development headers
/usr/local/src/samba-4.6.7/wscript:109: error: the configuration failed (see '/usr/local/src/samba-4.6.7/bin/config.log')

先安装 python-devel

yum -y install python-devel

报错:

/usr/local/src/samba-4.6.7/source4/lib/tls/wscript:51: error: Building the AD DC requires GnuTLS (eg libgnutls-dev, gnutls-devel) for ldaps:// support and for the BackupKey protocol

安装 libgnutls-dev, gnutls-devel
 
yum install -y libgnutls-devel  这个没有可用包,所以只安装下面一个

yum install -y gnutls-devel

再次安装报错:

/usr/local/src/samba-4.6.7/source3/wscript:507: error: ACL support not found. Try installing libacl1-dev or libacl-devel.  Otherwise, use --without-acl-support to build without ACL support. ACL support is required to change permissions from Windows clients.

安装 libacl-devel

yum install -y libacl-devel

再次报错:
/usr/local/src/samba-4.6.7/source3/wscript:703: error: LDAP support not found. Try installing libldap2-dev or openldap-devel. Otherwise, use --without-ldap to build without LDAP support. LDAP support is required for the LDAP passdb backend, LDAP idmap backends and ADS. ADS support improves communication with Active Directory domain controllers.

安装 openldap-devel

yum install -y openldap-devel


然后再次安装

make && make install


安装目录在/usr/local/samba

可以进去看下 cd /usr/local/samba

cd sbin

./smbd -V

Version 4.6.7

然后将samba安装目录下的bin和sbin目录添加到环境变量

vi /etc/profile  ....

source /etc/profile


复制配置文件到安装目录下的etc下

cp /usr/local/src/samba-4.6.7/packaging/LSB/smb.conf /usr/local/smaba/etc/

复制开机自启动所需文件到/etc/init.d/

cp /usr/local/src/samba-4.6.7/packaging/LSB/samba.sh /etc/init.d/samba

然后chkconfig --add samba 注意chkconfig 的配置 2345 64 36



service samba start 报错:

.lib/lsb/init-functions no such file or directory

yum install redhat-lsb  --比较大的一个东西

或者试试 yum install -y initscripts 这个命令

service samba start

报错:
The smb.conf file does not exist.                          [失败]


修改 /etc/init.d/samba 大概第21行

if /usr/local/samba/etc/smb.conf  --路径改为自己的配置路径


再次开启,报错:

The nmbd and/or smbd daemons are not installed.            [失败]

修改大概27行,文件路径改为自己的安装路径


再次开启,报错:

/bin/bash: nmbd: 未找到命令
/bin/bash: smbd: 未找到命令

修改大概35,36行,改为自己的安装sbin路径

/usr/local/samba/etc/smb.conf文件小解
[public]
    265    path = /share  --共享路径
    266    public = yes   --全员共享
    267    only guest = yes  --所有用户均以guest用户进行操作,相当于linux上的nobody用户,如果共享文件夹被设置为了nobody则这里使用yes就相当于所有者了
    268    writable = yes    --新建文件
    269    printable = no    --保存即替换文件
    270   create mask = 0777  --写文件权限


如果要使用samba服务需要开启几个端口:

137,138,139,445

而且是tcp和udp端口多需要打开。

否则就只能将防火墙关闭才行。

还有就是需要将/etc/selinux/config文件中的

SELINUX=enforcing
替换为
SELINUX=permissive ,或者=disabled

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值