linux安装samba显示依赖包(10分钟学会使用Linux搭建samba服务器文件共享服务器)

linux安装samba显示依赖包?前言:在局域网内有很多实现文件共享的方式和协议,可以建站,也可以简单地使用ftp、sftp、samba,对于大部分人的应用来说我们接触到的应该是samba,也就是在Windows系统中的输入\\192.168.1.1 访问到的那个地址,,接下来我们就来聊聊关于linux安装samba显示依赖包?以下内容大家不妨参考一二希望能帮到您!

linux安装samba显示依赖包

Linux搭建SAMBA服务器(共享服务器) ---CentOS7

前言:

在局域网内有很多实现文件共享的方式和协议,可以建站,也可以简单地使用ftp、sftp、samba,对于大部分人的应用来说我们接触到的应该是samba,也就是在Windows系统中的输入\\192.168.1.1 访问到的那个地址,

如图所示:

我们今天呢就是需要搭建一个共享文件目录,方便局域网内资料的传输和共享。

1、准备工作

安装好Linux系统服务器,或者废旧电脑,(性能无所谓,1G运存,单核CPU都可以,网口最好千兆,硬盘要好一点 ) 一台,可以用EXSI或者VMware搭建一个虚拟机,我的主页有教程哦。

有手就行!!!

2、实施步骤2.1 安装samba服务

有很多人这一步失败了,因为网络原因导致的服务安装失败,推荐更换安装源为阿里源或者清华大学源,当然科学上网也是可以的

首先,ssh登录到Linux,安装samba服务

[root@localhost ~]# yum -y install samba-*已加载插件:fastestmirror, langpacksLoading mirror speeds from cached hostfileCould not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误" One of the configured repositories failed (未知), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo= ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable orsubscription-manager repos --disable=5. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64

我这边是新安装的系统,执行yum命令时出现了报错,一般定位应该是yum.repos.d/CentOS-Base.repo这个文件问题,更换源即可。详见我的另一篇文章《centos7更换源》https://www.toutiao.com/article/7099662507022746145/,

更换之后继续执行

[root@localhost ~]# yum -y install samba-* //yum安装samba服务已加载插件:fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.comhttp://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; 未知的错误"正在尝试其它镜像。http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyuncs.com; 未知的错误"正在尝试其它镜像。base| 3.6 kB00:00:00extras| 2.9 kB00:00:00updates| 2.9 kB00:00:00(1/4): base/7/x86_64/group_gz| 153 kB00:00:00(2/4): extras/7/x86_64/primary_db| 247 kB00:00:00(3/4): base/7/x86_64/primary_db| 6.1 MB00:00:19(4/4): updates/7/x86_64/primary_db|16 MB00:00:49正在解决依赖关系--> 正在检查事务---> 软件包 samba.x86_64.0.4.10.16-5.el7 将被 升级---> 软件包 samba.x86_64.0.4.10.16-18.el7_9 将被 更新--> 正在处理依赖关系 libwbclient = 4.10.16-18.el7_9,它被软件包 samba-4.10.16-18.el7_9.x86_64 需要--> 正在处理依赖关系 libwbclient = 4.10.16-18.el7_9,它被软件包 samba-4.10.16-18.el7_9.x86_64 需要---> 软件包 samba-client.x86_64.0.4.10.16-5.el7 将被 升级---> 软件包 samba-client.x86_64.0.4.10.16-18.el7_9 将被 更新--> 正在处理依赖关系 libsmbclient = 4.10.16-18.el7_9,它被软件包 samba-client-4.10.16-18.el7_9.x86_64 需要---> 软件包 samba-client-libs.x86_64.0.4.10.16-5.el7 将被 升级---> 软件包 samba-client-libs.x86_64.0.4.10.16-18.el7_9 将被 更新---> 软件包 samba-common.noarch.0.4.10.16-5.el7 将被 升级---> 软件包 samba-common.noarch.0.4.10.16-18.el7_9 将被 更新---> 软件包 samba-common-libs.x86_64.0.4.10.16-5.el7 将被 升级---> 软件包 samba-common-libs.x86_64.0.4.10.16-18.el7_9 将被 更新---> 软件包 samba-common-tools.x86_64.0.4.10.16-5.el7 将被 升级---> 软件包 samba-common-tools.x86_64.0.4.10.16-18.el7_9 将被 更新---> 软件包 samba-dc.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-dc-libs.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-devel.x86_64.0.4.10.16-18.el7_9 将被 安装--> 正在处理依赖关系 pkgconfig(tevent),它被软件包 samba-devel-4.10.16-18.el7_9.x86_64 需要--> 正在处理依赖关系 pkgconfig(talloc),它被软件包 samba-devel-4.10.16-18.el7_9.x86_64 需要---> 软件包 samba-krb5-printing.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-libs.x86_64.0.4.10.16-5.el7 将被 升级---> 软件包 samba-libs.x86_64.0.4.10.16-18.el7_9 将被 更新---> 软件包 samba-pidl.noarch.0.4.10.16-18.el7_9 将被 安装--> 正在处理依赖关系 perl(Parse::Yapp::Driver),它被软件包 samba-pidl-4.10.16-18.el7_9.noarch 需要--> 正在处理依赖关系 perl(Parse::Yapp),它被软件包 samba-pidl-4.10.16-18.el7_9.noarch 需要---> 软件包 samba-python.x86_64.0.4.10.16-18.el7_9 将被 安装--> 正在处理依赖关系 python-tevent,它被软件包 samba-python-4.10.16-18.el7_9.x86_64 需要---> 软件包 samba-python-test.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-test.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-test-libs.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-vfs-glusterfs.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-winbind.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-winbind-clients.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-winbind-krb5-locator.x86_64.0.4.10.16-18.el7_9 将被 安装---> 软件包 samba-winbind-modules.x86_64.0.4.10.16-18.el7_9 将被 安装--> 正在检查事务---> 软件包 libsmbclient.x86_64.0.4.10.16-5.el7 将被 升级---> 软件包 libsmbclient.x86_64.0.4.10.16-18.el7_9 将被 更新---> 软件包 libtalloc-devel.x86_64.0.2.1.16-1.el7 将被 安装---> 软件包 libtevent-devel.x86_64.0.0.9.39-1.el7 将被 安装---> 软件包 libwbclient.x86_64.0.4.10.16-5.el7 将被 升级......已安装:samba-dc.x86_64 0:4.10.16-18.el7_9samba-dc-libs.x86_64 0:4.10.16-18.el7_9samba-devel.x86_64 0:4.10.16-18.el7_9samba-krb5-printing.x86_64 0:4.10.16-18.el7_9samba-pidl.noarch 0:4.10.16-18.el7_9samba-python.x86_64 0:4.10.16-18.el7_9samba-python-test.x86_64 0:4.10.16-18.el7_9samba-test.x86_64 0:4.10.16-18.el7_9samba-test-libs.x86_64 0:4.10.16-18.el7_9samba-vfs-glusterfs.x86_64 0:4.10.16-18.el7_9samba-winbind.x86_64 0:4.10.16-18.el7_9samba-winbind-clients.x86_64 0:4.10.16-18.el7_9samba-winbind-krb5-locator.x86_64 0:4.10.16-18.el7_9samba-winbind-modules.x86_64 0:4.10.16-18.el7_9作为依赖被安装:libtalloc-devel.x86_64 0:2.1.16-1.el7libtevent-devel.x86_64 0:0.9.39-1.el7perl-Parse-Yapp.noarch 0:1.05-50.el7python-tevent.x86_64 0:0.9.39-1.el7更新完毕:samba.x86_64 0:4.10.16-18.el7_9samba-client.x86_64 0:4.10.16-18.el7_9samba-client-libs.x86_64 0:4.10.16-18.el7_9samba-common.noarch 0:4.10.16-18.el7_9samba-common-libs.x86_64 0:4.10.16-18.el7_9samba-common-tools.x86_64 0:4.10.16-18.el7_9samba-libs.x86_64 0:4.10.16-18.el7_9作为依赖被升级:libsmbclient.x86_64 0:4.10.16-18.el7_9libwbclient.x86_64 0:4.10.16-18.el7_9完毕!

提示完毕后,我们的samba服务也是安装完成了

2.2 配置samba用户

[root@localhost ~]#useradd samba//新建一个名为samba的用户[root@localhost ~]# smbpasswd -a samba//将samba用户设置为samba用户并设置密码New SMB password: //设置密码Retype new SMB password://重复密码Added user samba.//ok[root@localhost ~]#

2.3 配置samba配置文件

服务器IP地址为:192.168.110.198

ens33: flags=4163mtu 1500inet 192.168.110.198netmask 255.255.255.0broadcast 192.168.110.255inet6 fe80::cdb5:c9cf:586b:b139prefixlen 64scopeid 0x20ether 00:0c:29:69:f2:f0txqueuelen 1000(Ethernet)RX packets 85407bytes 82725483 (78.8 MiB)RX errors 0dropped 0overruns 0frame 0TX packets 67344bytes 4369038 (4.1 MiB)TX errors 0dropped 0 overruns 0carrier 0collisions 0

进入samba文件目录

[root@localhost ~]# cd /etc/samba///进入samba配置文件目录[root@localhost samba]# lslmhostssmb.confsmb.conf.example//三个文件smb.conf 是samba的配置文件[root@localhost samba]# cp smb.conf smb.conf.bak//备份配置文件

创建一个新的目录用于存放共享文件夹

[root@localhost ~]# cd /home/samba///进入新建的samba账户的子目录,这里可以存放在任意位置,确保samba用户有对应的权限即可[root@localhost samba]# mkdir sharedir//新建一个名为sharedir的目录[root@localhost samba]# lssharedir[root@localhost samba]# chmod 777 sharedir///赋予此目录最高权限[root@localhost samba]# lssharedir[root@localhost samba]#

效果如图所示

编辑smb.conf

方式1:sudo gedit smb.conf

[ooyy1102@localhost samba]$ sudo gedit smb.conf[sudo] ooyy1102 的密码:

文本框直接编辑

具体内容如下

#可直接复制自取[global]workgroup = SAMBAsecurity = userpassdb backend = tdbsamprinting = cupsprintcap name = cupsload printers = yescups options = rawmap to guest = Bad User#此处将所有匿名访问的用户都识别为guest用户passdb backend = tdbsam#指向用户后台数据库,也就是我们新建的samba这个用户相关内容,也可以新增其他用户[homes]comment = Home Directoriesvalid users = %S, %D%w%Sbrowseable = Noread only = Noinherit acls = Yes[printers]comment = All Printerspath = /var/tmpprintable = Yescreate mask = 0600browseable = No[print$]comment = Printer Driverspath = /var/lib/samba/driverswrite list = @printadmin rootforce group = @printadmincreate mask = 0664directory mask = 0775[share_test]#新建共享目录名称为share_testpath = /home/samba/sharedir#路径public = yeswritdable = yescreate mask = 0644#赋予权限 ,如果不希望其他人写入,这条可以注释掉directory mask = 0755###如需要添加多个目录,依次创建目录和share_test目录即可

[root@localhost opt]# setenforce 0[root@localhost opt]# systemctl stop firewalld.service//关闭防火墙

Windows上访问\\192.168.110.198

新建一个文件进行测试

完成!

欢迎留言提议!!!

,
发布于 2023-01-26 21:05:59
分享
海报
86
上一篇:钉钉更新了会更新些什么(钉钉5.0大版本更新升级来咯)下一篇:chanel香奈儿山茶花面霜(史上最全Chanel山茶花保湿系列合集)
目录

    忘记密码?

    图形验证码