mkdir /mnt/cdrom 建一个cdrom
mount /dev/cdrom /mnt/cdrom 将光盘以只读方式挂载到文件夹/mnt/cdrom下
cd /etc/yum.repos.d/
mkdir old 建一个old目录
mv *.repo old 原目录移到old里面
touch cdrom07.repo (这边这个07后缀可以去掉,加07是为了区分)
vi cdrom07.repo
cat cdrom07.repo
[root@localhost yum.repos.d]# vi cdrom07.repo
[root@localhost yum.repos.d]# cat cdrom07.repo
[cdrom]
name = cdrom
baseurl = file: ///mnt/cdrom
gpgcheck = 0
enable = 1
[root@localhost yum.repos.d]# yum -y install samba
[root@localhost yum.repos.d]# systemctl start smb
[root@localhost yum.repos.d]# systemctl start nmb
[root@localhost yum.repos.d]# cd /etc/samba
[root@localhost samba]# ll
总用量 20
-rw-r--r--. 1 root root 20 10月 14 2020 lmhosts
-rw-r--r--. 1 root root 706 10月 14 2020 smb.conf
-rw-r--r--. 1 root root 11327 10月 14 2020 smb.conf.example
[root@localhost samba]# cp smb.conf smb.conf.old
[root@localhost samba]# vi smb.conf
[root@localhost samba]# cat smb.conf
[global]
workgroup = workgroup
security = user
server string = Samba Server Version %v
[root@localhost ~]# cd /mnt/share
[root@localhost share]# vi share
[root@localhost share]# cat share
[myshare]
comment = share files
path =/mnt/share
public = yes
read only = yes
writable = yes (这个命令是:设置共享目录允许用户写操作)
vaild users = @ myshare,gxz(这个命令是:设置允许指定的用户或组访问共享资源)
(与下面的区别之处)
[root@localhost share]# touch zbc.txt
[root@localhost share]# vi zbc.txt
如果小白不懂,可以考虑下面这个
"""
[root@localhost share]# cat zbc.txt
Hello world
vi gxz.txt文件是里面内容随便写
[myshare]
comment = share files
path =/mnt/share
public = yes
read only = yes
应该是这样的时候才能看到zbc.txt文件
"""
[root@localhost share]# ll
总用量 4
-rw-r--r--. 1 root root 0 10月 3 00:25 gxz.txt
-rw-r--r--. 1 root root 130 10月 3 00:24 share
[root@localhost share]# setenforce 0
[root@localhost share]# getenforce
Permissive
蓝色字体是短暂关防火墙的命令
[root@localhost ~]# ifconfig #用于查网关 与ip addr 命令一样
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.65.142 netmask 255.255.252.0 broadcast 172.16.67.255
[root@localhost ~]# adduser gxz(自己随便创,但要记得要于上面对应(上面红色字体标红的)。我们这边是gxz)
[root@localhost ~]# smbpasswd -a 123(密码随便起,我们这边是123)
New SMB password:123 虚拟机上面在你输密码是是不显示的
Retype new SMB password:123 虚拟机上面在你输密码是是不显示的
Added user gxz
[root@localhost ~]#
win+r \\虚拟机IP (例如: \\172.16.65.142)
如果还没解决的可以提问哦~