RHEL7.9离线安装samba服务
公司有一台红帽服务器(IP:192.168.3.206),没有连接互联网,需要离线安装samba服务,共享
/home/share
目录。
操作系统为RHEL7.9
1、找到服务器上的rpm包目录
-
该服务器配置了本地yum源,所以肯定在本地有很多安装包。
-
先看看本地repo文件里的地址
[root@icserver01 ~]# cd /etc/yum.repos.d/ [root@icserver01 yum.repos.d]# ls local.repo redhat.repo scootersoftware.repo [root@icserver01 yum.repos.d]#
可以看到有个
local.repo
的文件,查看一下内容。[root@icserver01 yum.repos.d]# cat local.repo [local] baseurl=file:///root/os enable=1 gpgcheck=0 [root@icserver01 yum.repos.d]#
目录显示在
/root/os
里。进去里面找找安装包。
[root@icserver01 os]# cd /root/os [root@icserver01 os]# ll -h 总用量 404K dr-xr-xr-x. 4 root root 54 9月 18 2020 addons dr-xr-xr-x. 3 root root 18 9月 18 2020 EFI -r--r--r--. 1 root root 8.1K 9月 18 2020 EULA -r--r--r--. 1 root root 1.5K 9月 18 2020 extra_files.json -r--r--r--. 1 root root 18K 9月 18 2020 GPL dr-xr-xr-x. 3 root root 57 9月 18 2020 images dr-xr-xr-x. 2 root root 217 9月 18 2020 isolinux dr-xr-xr-x. 2 root root 43 9月 18 2020 LiveOS -r--r--r--. 1 root root 114 9月 18 2020 media.repo dr-xr-xr-x. 2 root root 276K 9月 18 2020 Packages dr-xr-xr-x. 2 root root 4.0K 9月 18 2020 repodata -r--r--r--. 1 root root 3.3K 7月 14 2020 RPM-GPG-KEY-redhat-beta -r--r--r--. 1 root root 3.2K 7月 14 2020 RPM-GPG-KEY-redhat-release -r--r--r--. 1 root root 1.8K 9月 18 2020 TRANS.TBL [root@icserver01 os]#
应该在
Packages
目录里。ls ./Packages
发现里面很多rpm包。
我们过滤一下。
[root@icserver01 os]# cd Packages/ [root@icserver01 Packages]# ll -h samba* -r--r--r--. 1 root root 718K 7月 2 2020 samba-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 645K 7月 2 2020 samba-client-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 5.1M 7月 2 2020 samba-client-libs-4.10.16-5.el7.i686.rpm -r--r--r--. 1 root root 5.0M 7月 2 2020 samba-client-libs-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 214K 7月 2 2020 samba-common-4.10.16-5.el7.noarch.rpm -r--r--r--. 1 root root 177K 7月 2 2020 samba-common-libs-4.10.16-5.el7.i686.rpm -r--r--r--. 1 root root 181K 7月 2 2020 samba-common-libs-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 465K 7月 2 2020 samba-common-tools-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 94K 7月 2 2020 samba-krb5-printing-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 275K 7月 2 2020 samba-libs-4.10.16-5.el7.i686.rpm -r--r--r--. 1 root root 270K 7月 2 2020 samba-libs-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 2.8M 7月 2 2020 samba-python-4.10.16-5.el7.i686.rpm -r--r--r--. 1 root root 3.0M 7月 2 2020 samba-python-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 558K 7月 2 2020 samba-winbind-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 147K 7月 2 2020 samba-winbind-clients-4.10.16-5.el7.x86_64.rpm -r--r--r--. 1 root root 122K 7月 2 2020 samba-winbind-modules-4.10.16-5.el7.i686.rpm -r--r--r--. 1 root root 121K 7月 2 2020 samba-winbind-modules-4.10.16-5.el7.x86_64.rpm [root@icserver01 Packages]#
2、本地安装rpm包
只需要安装这3个包
samba-4.10.16-5.el7.x86_64.rpm
samba-client-4.10.16-5.el7.x86_64.rpm
samba-common-4.10.16-5.el7.noarch.rpm
命令如下:
rpm -ivh samba-4.10.16-5.el7.x86_64.rpm samba-client-4.10.16-5.el7.x86_64.rpm samba-common-4.10.16-5.el7.noarch.rpm
安装完之后,验证一下是否安装完成。
rpm -qa | grep samba
3、配置samba配置文件
- 修改配置文件
配置文件地址:
/etc/samba/smb.conf
[root@icserver01 ~]# cd /etc/samba/ [root@icserver01 samba]# ls lmhosts smb.conf smb.conf.example [root@icserver01 samba]# cat smb.conf # See smb.conf.example for a more detailed config file or # read the smb.conf manpage. # Run 'testparm' to verify the config is correct after # you modified it. [global] workgroup = SAMBA security = user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw [homes] comment = Home Directories valid users = %S, %D%w%S browseable = No read only = No inherit acls = Yes [printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775
global
部分不用改,将homes
、printers
、print$
部分注释掉,再添加share
模块到最后。#号后的内容可不写,完整的配置文件解释请查看/etc/samba/smb.conf.example
文件。[share] comment = 服务器里的共享 # 简单的解释 path = /home/share # 实际的共享目录 writable = yes # 可读写 browseable = yes # 可被用户浏览资源名称 guest ok = yes #
4、添加samba用户、设置密码
因服务器上已经设置了share用户,可以用
id
命令查看[root@icserver01 samba]# id share uid=1014(share) gid=1018(share) 组=1018(share) [root@icserver01 samba]#
smbpasswd -a share
输入两次密码,如:123456
5、重启samba服务,并配置开机自动启动
systemctl restart smb.service systemctl enable smb.service
6、使用windows终端访问服务器的共享目录
win+R
运行,
\\192.168.3.206
输入凭据,就是刚才配置的samba用户share,密码123456,可勾选记住我的凭据,再打开share
目录,就进入了服务器上的/home/share
目录