问题如下:
无法下载samba服务,同步仓库缓存失败
1.首先检查网络有无连接上
2.ping一下baidu.com,,检查连接的网络能否使用
3.更换下载源为国内yum源
4.清理yum缓存
5.vim编辑/etc/yum.repos.d/CentOS-AppStream.repo文件,确保新的缓存建立成功
先复制
[root@Server01 hfx]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#[BaseOS]
name=Qcloud centos OS - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official[centosplus]
name=Qcloud centosplus - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/centosplus/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official[extras]
name=Qcloud centos extras - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official[fasttrack]
name=Qcloud centos fasttrack - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/fasttrack/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official[AppStream]
name=Qcloud centos AppStream - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official[PowerTools]
name=Qcloud centos PowerTools - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/PowerTools/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
复制里面的[AppStream]部分更改到/etc/yum.repos.d/CentOS-AppStream.repo对应位置上
6.成功建立yum缓存,并安装samba服务
7.防火墙的设置,允许Samba服务通过防火墙,并且暂时关闭SELinux的强制执行,以便进行某些操作或测试。
firewall-cmd --permanent --add-service=samba
:
firewall-cmd
是用来管理防火墙规则的命令。--permanent
参数表示对防火墙规则进行永久性更改,而不是临时更改。--add-service=samba
参数表示将Samba服务添加到防火墙规则中,允许Samba服务通过防火墙。
firewall-cmd --reload
:
- 这个命令用于重新加载防火墙规则,使之前所做的更改生效。
setenforce 0
:
setenforce
是用来控制SELinux(Security-Enhanced Linux)的强制模式。0
表示将SELinux设置为宽容模式(permissive mode),在这种模式下,SELinux会记录违反策略的行为,但不会阻止它们。这通常用于测试或调试。