包的链接
如果需要其他包可以访问官方网站
一、环境说明及可用性验证| 操作系统 | samba |
|---|---|
| Centos7.3 | samba-4.4.9 |
yum install python-devel libgnutls-dev gnutls-devel libacl1-dev libacl-devel libldap2-dev openldap-devel二、目标
计划把当前samba服务的版本从4.4.9升级到稳定版本samba-4.10.16。计划是采用编译安装,但是由于4.10.16编译要求系统的python环境为3.x,centos7.3操作系统不具备,因此采用rpm包的形式
1、首先确认当前环境的samba版本,模拟生产环境4.4.4[root@samba-test ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@samba-test ~]# cd /data/samba4.4.4/
[root@samba-test samba4.4.4]# rpm -ivh *
准备中... ################################# [100%]
正在升级/安装...
1:libtalloc-2.1.6-1.el7 ################################# [ 8%]
2:libtdb-1.3.8-1.el7_2 ################################# [ 15%]
3:libtevent-0.9.28-1.el7 ################################# [ 23%]
4:samba-common-0:4.4.4-9.el7 ################################# [ 31%]
5:libldb-1.1.26-1.el7 ################################# [ 38%]
6:libwbclient-0:4.4.4-9.el7 ################################# [ 46%]
7:samba-client-libs-0:4.4.4-9.el7 ################################# [ 54%]
8:samba-common-libs-0:4.4.4-9.el7 ################################# [ 62%]
9:pytalloc-2.1.6-1.el7 ################################# [ 69%]
10:samba-libs-0:4.4.4-9.el7 ################################# [ 77%]
11:samba-common-tools-0:4.4.4-9.el7 ################################# [ 85%]
12:libaio-0.3.109-13.el7 ################################# [ 92%]
13:samba-0:4.4.4-9.el7 ################################# [100%]
[root@samba-test samba4.4.4]#
[root@samba-test samba4.4.4]# systemctl start smb
[root@samba-test samba4.4.4]# smbd -V
Version 4.4.4
[root@samba-test samba4.4.4]# systemctl status smb
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)
Active: active (running) since 一 2022-06-27 20:48:12 CST; 9s ago
Main PID: 6296 (smbd)
Status: "smbd: ready to serve connections..."
CGroup: /system.slice/smb.service
├─6296 /usr/sbin/smbd
├─6297 /usr/sbin/smbd
├─6298 /usr/sbin/smbd
└─6302 /usr/sbin/smbd
6月 27 20:48:12 samba-test.novalocal systemd[1]: Starting Samba SMB Daemon...
6月 27 20:48:12 samba-test.novalocal systemd[1]: smb.service: Supervising process 6296 which is not our child. We'll most likely not notice when it exits.
6月 27 20:48:12 samba-test.novalocal smbd[6296]: [2022/06/27 20:48:12.558824, 0] ../lib/util/become_daemon.c:124(daemon_ready)
6月 27 20:48:12 samba-test.novalocal smbd[6296]: STATUS=daemon 'smbd' finished starting up and ready to serve connections
6月 27 20:48:12 samba-test.novalocal systemd[1]: Started Samba SMB Daemon.
[root@samba-test samba4.4.4]#
2、通过rpm包的方式把samaba升级至4.10.16
[root@samba-test data]# cd samba4.10.16/ [root@samba-test samba4.10.16]# ls dbus-1.10.24-15.el7.x86_64.rpm libtevent-0.9.39-1.el7.x86_64.rpm samba-client-libs-4.10.16-18.el7_9.x86_64.rpm dbus-libs-1.10.24-15.el7.x86_64.rpm libwbclient-4.10.16-18.el7_9.x86_64.rpm samba-common-4.10.16-18.el7_9.noarch.rpm krb5-libs-1.15.1-51.el7_9.x86_64.rpm pyldb-1.5.4-2.el7.x86_64.rpm samba-common-libs-4.10.16-18.el7_9.x86_64.rpm libldb-1.5.4-2.el7.x86_64.rpm pytalloc-2.1.16-1.el7.x86_64.rpm samba-common-tools-4.10.16-18.el7_9.x86_64.rpm libtalloc-2.1.16-1.el7.x86_64.rpm python-tdb-1.3.18-1.el7.x86_64.rpm samba-libs-4.10.16-18.el7_9.x86_64.rpm libtdb-1.3.18-1.el7.x86_64.rpm samba-4.10.16-18.el7_9.x86_64.rpm [root@samba-test samba4.10.16]# rpm -Uvh * 准备中... ################################# [100%] 正在升级/安装... 1:libtalloc-2.1.16-1.el7 ################################# [ 3%] 2:libtdb-1.3.18-1.el7 ################################# [ 6%] 3:libtevent-0.9.39-1.el7 ################################# [ 9%] 4:libldb-1.5.4-2.el7 ################################# [ 13%] 5:krb5-libs-1.15.1-51.el7_9 ################################# [ 16%] 6:samba-common-0:4.10.16-18.el7_9 ################################# [ 19%] 7:libwbclient-0:4.10.16-18.el7_9 ################################# [ 22%] 8:samba-client-libs-0:4.10.16-18.el################################# [ 25%] 9:samba-common-libs-0:4.10.16-18.el################################# [ 28%] 10:dbus-libs-1:1.10.24-15.el7 ################################# [ 31%] 11:python-tdb-1.3.18-1.el7 ################################# [ 34%] 12:pyldb-1.5.4-2.el7 ################################# [ 38%] 13:pytalloc-2.1.16-1.el7 ################################# [ 41%] 14:samba-libs-0:4.10.16-18.el7_9 ################################# [ 44%] 15:samba-common-tools-0:4.10.16-18.e################################# [ 47%] 16:samba-0:4.10.16-18.el7_9 ################################# [ 50%] 17:dbus-1:1.10.24-15.el7 ################################# [ 53%] 正在清理/删除... 18:samba-0:4.4.4-9.el7 ################################# [ 56%] 19:samba-common-tools-0:4.4.4-9.el7 ################################# [ 59%] 20:samba-libs-0:4.4.4-9.el7 ################################# [ 63%] 21:samba-common-libs-0:4.4.4-9.el7 ################################# [ 66%] 22:samba-client-libs-0:4.4.4-9.el7 ################################# [ 69%] 23:libwbclient-0:4.4.4-9.el7 ################################# [ 72%] 24:libldb-1.1.26-1.el7 ################################# [ 75%] 25:libtevent-0.9.28-1.el7 ################################# [ 78%] 26:pytalloc-2.1.6-1.el7 ################################# [ 81%] 27:dbus-1:1.6.12-17.el7 ################################# [ 84%] 28:samba-common-0:4.4.4-9.el7 ################################# [ 88%] 29:dbus-libs-1:1.6.12-17.el7 ################################# [ 91%] 30:libtalloc-2.1.6-1.el7 ################################# [ 94%] 31:libtdb-1.3.8-1.el7_2 ################################# [ 97%] 32:krb5-libs-1.14.1-26.el7 ################################# [100%] [root@samba-test samba4.10.16]# [root@samba-test samba4.10.16]# smbd -V Version 4.10.16 [root@samba-test samba4.10.16]# rpm -qa | grep smb [root@samba-test samba4.10.16]# rpm -qa | grep samba samba-client-libs-4.10.16-18.el7_9.x86_64 samba-4.10.16-18.el7_9.x86_64 samba-common-libs-4.10.16-18.el7_9.x86_64 samba-common-tools-4.10.16-18.el7_9.x86_64 samba-common-4.10.16-18.el7_9.noarch samba-libs-4.10.16-18.el7_9.x86_64 [root@samba-test samba4.10.16]#3、升级到4.10.16后,开始回退,如上所说,回退采用编译方式
[root@samba-test ~]# cp /data/*.gz . [root@samba-test ~]# ls anaconda-ks.cfg samba-4.10.16.tar.gz samba-4.4.9.tar.gz [root@samba-test ~]# tar -zxvf samba-4.4.9.tar.gz [root@samba-test ~]# cd samba-4.4.9 [root@samba-test samba-4.4.9]# ls auth dfs_server lib PFIF.txt release-scripts tests wscript_build BUILD_SYSTEMS.txt docs libcli pidl Roadmap testsuite wscript_build_embedded_heimdal buildtools docs-xml libds prog_guide4.txt script third_party wscript_build_system_heimdal callcatcher-exceptions.grep dynconfig libgpo python selftest upgrading-samba4.txt wscript_build_system_mitkrb5 configure examples librpc README source3 VERSION wscript_configure_system_mitkrb5 configure.developer file_server Makefile README.cifs-utils source4 WHATSNEW.txt COPYING include nsswitch README.Coding testdata wintest ctdb install_with_python.sh packaging README.contributing testprogs wscript [root@samba-test samba-4.4.9]# ./configure # 开始编译,观察是否能编译成功,如果需要指定文件目录,--prefix=/install/samba(your location) 默认 /usr/local/samba/ Checking for program gcc or cc : /usr/bin/gcc Checking for program cpp : /usr/bin/cpp ··· ··· ··· Checking if toolchain accepts -fstack-protector : yes 'configure' finished successfully (51.841s) # 检查配置成功的标志 [root@samba-test samba-4.4.9]# [root@samba-test samba-4.4.9]# make # 开始编译 ,等待时间比较久 涉及到3762个文件,等待约5分钟 WAF_MAKE=1 python ./buildtools/bin/waf build Waf: Entering directory `/root/samba-4.4.9/bin' symlink: tevent.py -> python/tevent.py ··· ··· ··· [3761/3762] Parse::Pidl::NDR.3pm: pidl/lib/Parse/Pidl/NDR.pm -> bin/default/pidl/Parse::Pidl::NDR.3pm [3762/3762] Parse::Pidl::Wireshark::NDR.3pm: pidl/lib/Parse/Pidl/Wireshark/NDR.pm -> bin/default/pidl/Parse::Pidl::Wireshark::NDR.3pm Waf: Leaving directory `/root/samba-4.4.9/bin' 'build' finished successfully (8m1.074s) [root@samba-test samba-4.4.9]# [root@samba-test samba-4.4.9]# make install # 安装 总共4083个文件,等待约3分钟 WAF_MAKE=1 python ./buildtools/bin/waf install Waf: Entering directory `/root/samba-4.4.9/bin' * creating /usr/local/samba/etc ··· ··· ··· Waf: Leaving directory `/root/samba-4.4.9/bin' 'install' finished successfully (1m58.525s) # 成功安装 [root@samba-test samba-4.4.9]# # 卸载掉smb4.10.16的版本,可以使用rpm -e samba-4.10.16-18.el7_9.x86_64或者yum remove samba [root@samba-test samba-4.4.9]# # 启动samba服务,需要把原来的配置文件拷贝过去 此时读取的文件位置/usr/local/samba/etc/smb.conf [root@samba-test samba-4.4.9]# /usr/local/samba/sbin/smbd -D [root@samba-test etc]# ps -ef | grep smb root 29460 1 0 21:15 ? 00:00:00 /usr/local/samba/sbin/smbd -D root 29471 29460 0 21:15 ? 00:00:00 /usr/local/samba/sbin/smbd -D root 29472 29460 0 21:15 ? 00:00:00 /usr/local/samba/sbin/smbd -D root 29474 29460 0 21:15 ? 00:00:00 /usr/local/samba/sbin/smbd -D root 29476 5849 0 21:15 pts/0 00:00:00 grep --color=auto smb [root@samba-test ~]# netstat -antulp |grep smb tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 29460/smbd tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 29460/smbd tcp6 0 0 :::139 :::* LISTEN 29460/smbd tcp6 0 0 :::445 :::* LISTEN 29460/smbd [root@samba-test ~]# [root@samba-test samba]# /usr/local/samba/sbin/smbd -V Version 4.4.9 #### 日志目录 [root@samba-test var]# ll /usr/local/samba/var/log.smbd -rw-r--r-- 1 root root 718 6月 27 21:23 /usr/local/samba/var/log.smbd 至此 4.4.9的smb服务已经回滚完成。备注
说明:如果想使用systemctl 服务单元管理smb服务,需要加个smb的服务单元



