CentOS7 搭建http的yum源
1. 环境准备
[root@yum ~]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@yum ~]# setenforce 0
[root@yum ~]# sed -i 's/enforcing/disabled/g' /etc/selinux/config
[root@yum ~]# cat /etc/selinux/config | grep =
# SELINUX= can take one of these three values:
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
SELINUXTYPE=targeted
[root@yum ~]# mount -o loop /dev/cdrom /mnt/
[root@yum ~]# mkdir /opt/centos
[root@yum ~]# cp -rf /mnt/* /opt/centos/
[root@yum ~]# umount /mnt/
[root@yum ~]# mkdir yumbackup
[root@yum ~]# mv /etc/yum.repos.d/* yumbackup/
[root@yum ~]# cat << EOF > /etc/yum.repos.d/yum.repo
> [centos]
> name=centos
> baseurl=file:///opt/centos
> gpgcheck=0
> enable=1
> EOF
[root@yum ~]# cat /etc/yum.repos.d/yum.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enable=1
[root@yum ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: centos
[root@yum ~]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
centos | 3.6 kB 00:00:00
(1/2): centos/group_gz | 153 kB 00:00:00
(2/2): centos/primary_db | 3.3 MB 00:00:00
repo id repo name status
centos centos 4,070
repolist: 4,070
yum install -y vim net-tools
2.配置http源
yum install -y httpd
systemctl restart httpd
systemctl enable httpd
[root@yum html]# ln -s /opt/* /var/www/html/
echo "" > /etc/httpd/conf.d/welcome.conf
systemctl restart httpd
评论 (0)