http配置yum源

一.VMware插入两张光盘

http配置yum源_第1张图片

二.手动触发硬盘扫描

[root@c7e-uscwifi ~]#echo '- - -' > /sys/class/scsi_host/host0/scan 
[root@c7e-uscwifi ~]#echo '- - -' > /sys/class/scsi_host/host1/scan 
[root@c7e-uscwifi ~]#echo '- - -' > /sys/class/scsi_host/host2/scan 
[root@c7e-uscwifi ~]#lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0  200G  0 disk 
©À©¤sda1            8:1    0    2G  0 part /boot
©¸©¤sda2            8:2    0  154G  0 part 
  ©À©¤centos-root 253:0    0  100G  0 lvm  /
  ©À©¤centos-swap 253:1    0    4G  0 lvm  [SWAP]
  ©¸©¤centos-data 253:2    0   50G  0 lvm  /data
sr0              11:0    1  4.2G  0 rom  /run/media/root/CentOS 7 x86_
sr1              11:1    1  3.7G  0 rom  
[root@c7e-uscwifi ~]#

三.yum安装httpd

[root@c7e-uscwifi ~]#yum install httpd -y

四.创建网页目录

[root@c7e-uscwifi ~]#cd /var/www/html/
[root@c7e-uscwifi html]#mkdir centos{7,6}/os/x86_64 -p
[root@c7e-uscwifi html]#

五.挂载光盘

[root@c7e-uscwifi html]#mount /dev/sr0 /var/www/html/centos7/os/x86_64/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@c7e-uscwifi html]#mount /dev/sr1 /var/www/html/centos6/os/x86_64/
mount: /dev/sr1 写保护,将以只读方式挂载
[root@c7e-uscwifi html]#

六.开启httpd服务,并加入开机启动项

[root@c7e-uscwifi html]#systemctl start httpd.service && systemctl enable httpd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@c7e-uscwifi html]#

七.网页访问测试

发现访问不了,怀疑是selinux和firewalld防火墙没关

[root@c7e-uscwifi html]#setenforce 0
setenforce: SELinux is disabled
[root@c7e-uscwifi html]#systemctl stop firewalld.service 
[root@c7e-uscwifi html]#

再次访问,可访问了

http配置yum源_第2张图片

八、在centos6上面配置yum源

[root@centos6 ~]#cd /etc/yum.repos.d/
[root@centos6 yum.repos.d]#mkdir backup -p
# 编辑repo文件
[root@centos6 yum.repos.d]#mv *.repo backup/
[root@centos6 yum.repos.d]#cat > base.repo < [base]
> name=base repo
> baseurl=http://192.168.38.131/centos6/os/x86_64/
> enabled=1
> gpgcheck=0
> EOF
# 查看repo仓库
[root@centos6 yum.repos.d]#yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
base                                           | 4.0 kB     00:00     
repo id                        repo name                        status
base                           base repo                        6,713
repolist: 6,713
[root@centos6 yum.repos.d]#
# 安装vsftpd测试
[root@centos6 yum.repos.d]#yum install vsftpd
# 没问题