centos7 升级Samba至4.15.6

centos7 升级Samba至4.15.6

1、准备

安装依赖

yum install -y python3 python36 python3-devel perl-Parse-Yapp libtasn1-devel libunistring-devel zlib-devel gmp-devel libldap2-dev openldap-devel m4

下载软件包

wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz --no-check-certificate
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.4.tar.xz --no-check-certificate
wget https://download.samba.org/pub/samba/stable/samba-4.15.6.tar.gz

卸载已存在的nettle

yum remove nettle*

2、安装nettle

#解压并编译
tar -zxvf nettle-3.4.1.tar.gz
cd nettle-3.4.1
./configure
#make是可能会报错,可参考注释
make
make install

注释1: make如果报错如下:

rsa-sign-tr.c: 在函数‘sec_equal’中:
rsa-sign-tr.c:243:3: 错误:只允许在 C99 模式下使用‘for’循环初始化声明
   for (size_t i = 0; i < limbs; i++)
   ^
rsa-sign-tr.c:243:3: 附注:使用 -std=c99 或 -std=gnu99 来编译您的代码
make[1]: *** [rsa-sign-tr.o] 错误 1
make[1]: 离开目录“/kingdom/samba/nettle-3.4.1”
make: *** [all] 错误 2

解决方法:vim config.make (修改第5,6行)

CFLAGS = -g -O2 -ggdb3 -Wno-pointer-sign -Wall -W   -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes   -Wpointer-arith -Wbad-function-cast -Wnested-externs -std=c99
CXXFLAGS = -g -O2

3、安装gnutls

xz -d gnutls-3.6.4.tar.xz
tar xvf gnutls-3.6.4.tar
cd gnutls-3.6.4
./configure  --without-p11-kit 
#编译PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig ./configure --with-included-libtasn1 --with-included-unistring --without-p11-kit
make
make install

注释2:如果编译出错:

configure: error: 
*** Libnettle 3.4 was not found.

解决:创建软连接

ln -s /usr/local/lib64/pkgconfig/nettle.pc /usr/lib64/pkgconfig/nettle.pc
### 我这里/usr/local/lib64/pkgconfig/这个目录下没有hogweed.pc,所以从安装包一个过去,存在就不拷
cp /root/samba/nettle-3.4.1/hogweed.pc /usr/local/lib64/pkgconfig/
ln -s /usr/local/lib64/pkgconfig/hogweed.pc /usr/lib64/pkgconfig/hogweed.pc
ln -sf /usr/local/lib64/libhogweed.so  /usr/lib64/libhogweed.so 
ln -sf /usr/local/lib64/libnettle.so.6 /usr/lib64/libnettle.so.6
ln -sf /usr/local/lib64/libhogweed.so.4 /usr/lib64/libhogweed.so.4

注释3 编译报错

/usr/bin/ld: cannot find -lhogweed
collect2: error: ld returned 1 exit status
make[4]: *** [libgnutls.la] Error 1
make[4]: Leaving directory `/root/samba/gnutls-3.6.4/lib'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/root/samba/gnutls-3.6.4/lib'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/samba/gnutls-3.6.4/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/samba/gnutls-3.6.4'
make: *** [all] Error 2

解决方法:

yum install -y gmp-devel
ln -sf /usr/local/lib64/libhogweed.so  /usr/lib64/libhogweed.so 
ln -sf /usr/local/lib64/libnettle.so.6 /usr/lib64/libnettle.so.6

注释4: make 报错

collect2: error: ld returned 1 exit status
make[4]: *** [libgnutls.la] Error 1
make[4]: Leaving directory `/root/samba/gnutls-3.6.4/lib'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/root/samba/gnutls-3.6.4/lib'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/samba/gnutls-3.6.4/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/samba/gnutls-3.6.4'
make: *** [all] Error 2

解决:

ln -sf /usr/local/lib64/libhogweed.so.4 /usr/lib64/libhogweed.so.4
ln -sf /usr/local/lib64/libgnutls.so /usr/lib64/libgnutls.so.28

4、安装samba

./configure --disable-python --without-ad-dc --without-json --without-libarchive  --without-acl-support --without-pam --with-shared-modules=\!vfs_snapper --without-ldap --without-ads
make
make install

注释5: 编译报错

Checking for GnuTLS >= 3.4.7
['/usr/bin/pkg-config', 'gnutls >= 3.4.7', '--cflags', '--libs', 'gnutls']
err: Package gnutls was not found in the pkg-config search path.
Perhaps you should add the directory containing `gnutls.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gnutls' found
Package gnutls was not found in the pkg-config search path.
Perhaps you should add the directory containing `gnutls.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gnutls' found

解决:找不到gnutls,建立软连接

ln -sf /usr/local/lib/pkgconfig/gnutls.pc /usr/lib64/pkgconfig/gnutls.pc
ln -sf /usr/local/lib/libgnutls.so /usr/lib64/libgnutls.so
ln -sf /usr/local/lib/libgnutls.so.30 /usr/lib64/libgnutls.so.30

5、配置并启动Samba服务

#配置服务
vim /usr/local/samba/etc/smb.conf
[ivd_data]
       comment = this is the ivd data
       path= /home/purui/data
       #共享目录可写入
       writeable = Yes
       #有写入权限的用户
       write list = purui
       ##共享目录的用户
       valid users = purui
       #是否可浏览文件
       browseable = Yes
       ##是否只读
       read only = No
       inherit acls = No

创建登录用户

#创建登录用户
useradd -s /sbin/nologin purui
#smb中添加purui用户
/usr/local/samba/bin/smbpasswd -a purui
#启动该用户
/usr/local/samba/bin/smbpasswd -e purui
#创建数据存储目录,并赋权
mkdir -p /home/purui/data
chown -R purui.purui /home/purui/data

#启动服务
/usr/local/samba/sbin/smbd -D
#查看进程
netstat -tlnp|grep smbd

注释6 服务启动报错

/usr/local/samba/sbin/smbd: error while loading shared libraries: libhogweed.so.4: cannot open shared object file: No such file or directory

解决:创建软连接

ln -sf /usr/local/lib64/libhogweed.so.4 /usr/lib64/libhogweed.so.4
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 13
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

正在输入中…………

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值