CentOS 7基于HTTP的本地yum源
[iyunv@localhost ~]# yum install httpd
[iyunv@localhost ~]# systemctl status httpd
[iyunv@localhost ~]# yum update && yum install createrepo
[iyunv@localhost ~]# mkdir -p /var/www/html/repos/centos/7/0 --------创建本地yum源目录
[iyunv@localhost ~]# createrepo /var/www/html/repos/centos/7/0 --------创建本地yum源
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[iyunv@localhost ~]# mount -o loop /os/CentOS-7-x86_64-Everything-1503-01.iso /mnt
[iyunv@localhost ~]# cp -r /mnt/* /var/www/html/repos/centos/7/0 -------- 将挂在后镜像文件全部拷贝到本地yum源目录
[iyunv@localhost ~]# du -sch /var/www/html/repos/centos/7/0/*
4.0K /var/www/html/repos/centos/7/0/CentOS_BuildTag
6.1M /var/www/html/repos/centos/7/0/EFI
4.0K /var/www/html/repos/centos/7/0/EULA
20K /var/www/html/repos/centos/7/0/GPL
438M /var/www/html/repos/centos/7/0/images
72M /var/www/html/repos/centos/7/0/isolinux
275M /var/www/html/repos/centos/7/0/LiveOS
6.3G /var/www/html/repos/centos/7/0/Packages
24M /var/www/html/repos/centos/7/0/repodata
4.0K /var/www/html/repos/centos/7/0/RPM-GPG-KEY-CentOS-7
4.0K /var/www/html/repos/centos/7/0/RPM-GPG-KEY-CentOS-Testing-7
4.0K /var/www/html/repos/centos/7/0/TRANS.TBL
7.1G total
[iyunv@localhost ~]# createrepo --update /var/www/html/repos/centos/7/0/ -------- 更新本地yum源
Spawning worker 0 with 361 pkgs
Spawning worker 1 with 361 pkgs
Spawning worker 2 with 361 pkgs
Spawning worker 3 with 361 pkgs
Spawning worker 4 with 361 pkgs
Spawning worker 5 with 361 pkgs
Spawning worker 6 with 361 pkgs
Spawning worker 7 with 361 pkgs
Spawning worker 8 with 361 pkgs
Spawning worker 9 with 361 pkgs
Spawning worker 10 with 361 pkgs
Spawning worker 11 with 361 pkgs
Spawning worker 12 with 360 pkgs
Spawning worker 13 with 360 pkgs
Spawning worker 14 with 360 pkgs
Spawning worker 15 with 360 pkgs
Spawning worker 16 with 360 pkgs
Spawning worker 17 with 360 pkgs
Spawning worker 18 with 360 pkgs
Spawning worker 19 with 360 pkgs
Spawning worker 20 with 360 pkgs
Spawning worker 21 with 360 pkgs
Spawning worker 22 with 360 pkgs
Spawning worker 23 with 360 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[iyunv@localhost ~]#
如果不用iptable可以直接禁用
[iyunv@localhost ~]# yum install iptable*
Loaded plugins: fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
Package iptables-1.4.21-13.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package iptables-devel.x86_64 0:1.4.21-13.el7 will be installed
---> Package iptables-services.x86_64 0:1.4.21-13.el7 will be installed
---> Package iptables-utils.x86_64 0:1.4.21-13.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================
Installing:
iptables-devel x86_64 1.4.21-13.el7 CentOS7 53 k
iptables-services x86_64 1.4.21-13.el7 CentOS7 49 k
iptables-utils x86_64 1.4.21-13.el7 CentOS7 57 k
Transaction Summary
=================================================================================================================================================
Install 3 Packages
Total download size: 159 k
Installed size: 98 k
Is this ok [y/d/N]: y
Downloading packages:
-------------------------------------------------------------------------------------------------------------------------------------------------
Total 7.1 MB/s | 159 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : iptables-devel-1.4.21-13.el7.x86_64 1/3
Installing : iptables-utils-1.4.21-13.el7.x86_64 2/3
Installing : iptables-services-1.4.21-13.el7.x86_64 3/3
Verifying : iptables-services-1.4.21-13.el7.x86_64 1/3
Verifying : iptables-utils-1.4.21-13.el7.x86_64 2/3
Verifying : iptables-devel-1.4.21-13.el7.x86_64 3/3
Installed:
iptables-devel.x86_64 0:1.4.21-13.el7 iptables-services.x86_64 0:1.4.21-13.el7 iptables-utils.x86_64 0:1.4.21-13.el7
Complete!
[iyunv@localhost ~]# cd /etc/sysconfig/
[iyunv@localhost sysconfig]# ls -l ip
ip6tables ip6tables-config iptables iptables-config
[iyunv@localhost sysconfig]# vi iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT ---------开放HTTP端口(也可以直接禁用防火墙和iptable)
[iyunv@localhost sysconfig]# systemctl restart iptables.service
[iyunv@localhost sysconfig]# systemctl status iptables.service
iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
Active: active (exited) since Wed 2015-08-05 23:48:46 EDT; 7s ago
Process: 4138 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
Main PID: 4138 (code=exited, status=0/SUCCESS)
Aug 05 23:48:46 localhost.localdomain iptables.init[4138]: iptables: Applying firewall rules: [ OK ]
Aug 05 23:48:46 localhost.localdomain systemd[1]: Started IPv4 firewall with iptables.
[iyunv@localhost sysconfig]#
[iyunv@localhost ~]# for i in `ls /etc/yum.repos.d/`;do mv /etc/yum.repos.d/$i /etc/yum.repos.d/$i.bak;done
[iyunv@localhost ~]# cd /etc/yum.repos.d/
[iyunv@localhost ~]# vi CentOS7.repo
[Centos7]
name=Centos7
baseurl=http://172.16.1.131/repos/centos/7/0/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
OK!
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com