1.设置IP地址:
vim /etc/sysconfig/network-scripts/ifcfg-ens33
2.关闭防火墙和selinux
[root@s ~]# systemctl stop firewalld
[root@s ~]# systemctl disable firewalld
[root@s ~]# vim /etc/selinux/config
[root@s ~]# setenforce 0
[root@s ~]#
3.重启网络服务:
[root@s ~]# systemctl restart network
[root@s ~]# ping www.baidu.com
PING www.a.shifen.com (180.101.50.188) 56(84) bytes of data.
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=1 ttl=128 time=27.5 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=2 ttl=128 time=26.3 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=3 ttl=128 time=26.3 ms
4.创建自建库,安装samba
[root@s ~]# yum -y --downloadonly --downloaddir=./soft/ install samba
5.创建仓库文件,调用createrepo
[root@s ~]# yum -y install createrepo
6.下载samba安装包、安装createrepo ,目的:自建仓库
1.使用createrepo指令创建仓库文件 repodata
[root@s ~]# createrepo ./soft/
2.创建文件repo
[root@s ~]# vim /etc/yum.repos.d/samba.repo[samba]
name=samba
baseurl=~/soft/
gpgcheck=0
enable=1
3.建立缓存
[root@s ~]# yum clean all
[root@s ~]# yum makecache
4.安装samba
[root@s ~]# yum -y install samba
5. 检查
[root@s ~]# yum list installed |grep samba
[root@s ~]# rpm -qa |grep samba
7.创建共享目录、配置文件、创建账号密码、启动服务
1.创建目录
[root@s ~]# mkdir /share
[root@s ~]# ls /
2.配置文件
[root@s ~]# vim /etc/samba/smb.conf
[smb_share]
comment=smb share server
path=/share/
guest ok=no
writable=yes
3.创建用户、启服务
[root@s ~]# useradd user01
[root@s ~]# smbpasswd -a user01
New SMB password:
Retype new SMB password:
Added user user01.
[root@s ~]# systemctl start nmb.service
[root@s ~]# systemctl start smb.service
[root@s ~]#
8.测试实现
[root@s ~]# setfacl -m u:user01:rwx /share/
9.测试共享
[root@s ~]# ls /share/
yulan.txt
[root@s ~]# vim /share/hhh.txt
[root@s ~]#
10.与linux实现共享:
[root@14 ~]# yum -y install samba-client
[root@14 ~]# smbclient //192.168.2.16/smb_share -U user01
[root@14 ~]# yum -y install cifs-utils
[root@14 ~]# mkdir /getshare
[root@14 ~]# mount.cifs -o user=user01,pass=123 //192.168.2.16/smb_share /getshare/
[root@14 ~]# ls /getshare/
hhh.txt history.txt yulan.txt 我是贺玉兰,给我买好吃的.txt
[root@14 ~]#