LINUX系统配置Smaba服务器

配置Samba服务器

1,检测系统是否安装了 Samba相关性软件包

[root@localhost ~]# rpm -qa|grep samba

2,创建一个用来挂载映像文件的目录

[root@localhost ~]# mkdir -p  /opt/centos

3,把映像文件挂载到/opt/centos目录

[root@localhost ~]# mount /dev/cdrom  /opt/centos

#mount: /dev/sr0 写保护,将以只读方式挂载

4,为保障安全性,转到/etc/yum.repos.d/目录

[root@localhost ~]# cd /etc/yum.repos.d/

5,移动etc/yum.repos.d的所有到/home/目录

[root@localhost yum.repos.d]# mv /etc/yum.repos.d/*  /home/

6,进入local.repo进行编辑

[root@localhost yum.repos.d]# vim local.repo

编辑内容:

[centos]

name=dvd

baseurl=file:///opt/centos      //特别注意本地源文件的表示,3个“/”

gpgcheck=0

enabled=1

7,安装前先清除缓存

[root@localhost yum.repos.d]# yum clean all

#已加载插件:fastestmirror, langpacks

#正在清理软件源:centos

8,列出已启用的存储库

[root@localhost ~]# yum repolist

9,使用yum 命令安装 samba服务

[root@localhost ~]# yum install samba -y

10,ping一下baidu.com 测试连通性

[root@localhost ~]# ping baidu.com

11,再次检查,是否安装好

[root@localhost ~]# yum install samba -y

12,所有软件包安装完毕,使用rpm命令再一次进行查询,会发现多出了几个新的内容,这就是刚刚所安装的内容

[root@localhost ~]# rpm -qa | grep samba

13,重启一下samba服务

[root@localhost ~]# systemctl start smb

14,关闭防火墙

[root@localhost ~]# systemctl stop firewalld

15,重新启动

[root@localhost ~]# systemctl restart smb nmb

16,进入 /etc/samba/smb.conf  目录

进入vim /etc/samba/smb.conf内修改

[root@localhost ~]# vim /etc/samba/smb.conf

重启一下Smaba更新配置

17,创建用户s1并设置密码

[root@localhost ~]# useradd s1

[root@localhost ~]# passwd s1

重新设置s1密码

[root@localhost ~]# smbpasswd -a s1

  1. 创建share目录,用来堆放共享资源的路径

[root@localhost ~]# mkdir /share

转到share目录

[root@localhost ~]# cd /share

创建文件abc.txt并查看

[root@localhost share]# touch abc.txt

[root@localhost share]# ll abc.txt

-rw-r--r--. 1 root root 0 11月  9 15:34 abc.txt

[root@localhost share]# ll -d /share

19,编辑刚刚创建的文件/etc/samba/smb.conf

[root@localhost ~]# vim /etc/samba/smb.conf

[share]

comment =my share

 path=/share

 public=no

 read only=yes

 valid users=s1

20,修改文件和目录的所有者和所属组

[root@localhost ~]# chown s1:root /share

[root@localhost ~]# ll -d /share/

21,重启一下Samba服务

[root@localhost ~]# systemctl restart smb

服务器配置完毕。

你可能感兴趣的:(linux,服务器)