Samba升级
一、基础环境准备
1.1 适用操作系统
CentOS7.0-CentOS7.9
1.2 查看当前版本
smbd --version
1.3 安装依赖
yum install -y python3 python36 python3-devel perl-Parse-Yapp libtasn1-devel libunistring-devel zlib-devel gmp-devel libldap2-dev openldap-devel m4 flex bison
1.4 下载安装包
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
二、编译安装
2.1 编译安装nettle
2.1.1 移除已存在的nettle
yum remove nettle* -y
2.1.2 解压安装包
cd /web
tar xf nettle-3.4.1.tar.gz
cd nettle-3.4.1
./configure
2.1.3 修改config.make配置文件
先删除第5、6两行
然后将下面的内容复制粘贴至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
2.1.4 执行安装
make && make install
2.2 编译安装gnutls
2.2.1 解压安装包
cd /web
tar xf gnutls-3.6.4.tar.xz
cd gnutls-3.6.4
2.2.2 创建软链接
ln -s /usr/local/lib64/pkgconfig/nettle.pc /usr/lib64/pkgconfig/nettle.pc
如果/usr/local/lib64/pkgconfig/目录下有hogweed.pc文件可以不拷贝
cp /web/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
2.2.3 执行编译
./configure --without-p11-kit
创建软链接
ln -sf /usr/local/lib64/libhogweed.so.4 /usr/lib64/libhogweed.so.4
2.2.4 执行安装
make & make install
2.3 编译安装samba
2.3.1 解压缩安装包
cd /web
tar xf samba-4.15.6.tar.gz
cd samba-4.15.6
2.3.2 建立软链接
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
2.3.3 编译
./configure --disable-python --without-ad-dc --without-json --without-libarchive --without-acl-support --without-pam --with-shared-modules=!vfs_snapper --without-ldap --without-ads
2.3.4 执行安装
make && make install
2.3.5 拷贝旧版本配置文件
cp /etc/samba/* /usr/local/samba/etc/
2.3.6 修改配置文件
vim /usr/local/samba/etc/smb.conf
删除[global]块内容,更换为以下内容
[global]
workgroup = SAMBA
security = user
map to guest = Bad User
log file = /usr/local/samba/var/log.%m
max log size = 50
unix charset = UTF-8
#display charset = UTF-8
guest account = nobody
dos charset = cp936
create mask = 777
directory mask = 777
2.3.7 重新添加smb用户,设置新密码
/usr/local/samba/bin/smbpasswd -a root
2.3.8 启动用户
/usr/local/samba/bin/smbpasswd -e root
2.3.9 启动samba
/usr/local/samba/sbin/smbd -D
/usr/local/samba/sbin/nmbd -D
/usr/local/samba/sbin/winbindd -D
2.3.10 查看进程
netstat -tlnp|grep smbd
2.3.11 查看当前版本
/usr/local/samba/sbin/nmbd -V
至此,Samba升级完成。
本文来自博客园,作者:霸都运维,转载请注明原文链接:https://www.cnblogs.com/wangjie20200529/p/17587510.html