CentOS 7 local Yum source based on HTTP
[email protected] ~]# Yum install httpd
[Email protected] ~]# systemctl status httpd
[email protected] ~]# Yum update && yum install Createrepo
[[email protected] ~]# mkdir-p/var/www/html/repos/centos/7/0--------Create local Yum source directory
[[email protected] ~]# createrepo/var/www/html/repos/centos/7/0--------Create local Yum source
Saving Primary Metadata
Saving file lists Metadata
Saving other metadata
Generating SQLite DBs
Sqlite DBs Complete
[Email protected] ~]# Mount-o loop/os/centos-7-x86_64-everything-1503-01.iso/mnt
[[email protected] ~]# cp-r/mnt/*/var/www/html/repos/centos/7/0--------to copy all the attached image files to the local Yum source directory
[Email protected] ~]# 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
[[email protected] ~]# createrepo--update/var/www/html/repos/centos/7/0/--------Update local Yum source
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 with 361 pkgs
Spawning worker one with 361 pkgs
Spawning worker, pkgs
Spawning worker pkgs
Spawning worker with pkgs
Spawning worker-pkgs
Spawning worker with pkgs
Spawning worker pkgs
Spawning worker with pkgs
Spawning worker pkgs
Spawning worker pkgs
Spawning worker with pkgs
Spawning worker pkgs
Spawning worker pkgs
Workers finished
Saving Primary Metadata
Saving file lists Metadata
Saving other metadata
Generating SQLite DBs
Sqlite DBs Complete
[Email protected] ~]#
if not iptable can be directly disabled
[email protected] ~]# 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 'll be installed
---> Package iptables-services.x86_64 0:1.4.21-13.el7 'll be installed
---> Package iptables-utils.x86_64 0:1.4.21-13.el7 'll be installed
--Finished Dependency Resolution
Dependencies resolved
=============================================================================================================== ==================================
Package Arch Version Repository Size
=============================================================================================================== ==================================
Installing:
Iptables-devel x86_64 1.4.21-13.el7 CentOS7 K
Iptables-services x86_64 1.4.21-13.el7 CentOS7 K
Iptables-utils x86_64 1.4.21-13.el7 CentOS7 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!
[Email protected] ~]# cd/etc/sysconfig/
[[email protected] sysconfig]# ls-l IP
Ip6tables ip6tables-config iptables Iptables-config
[Email protected] sysconfig]# VI iptables
-A input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT---------Open http port (you can also disable firewalls and iptable directly)
[Email protected] sysconfig]# systemctl restart Iptables.service
[Email protected] 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)
23:48:46 Localhost.localdomain iptables.init[4138]: iptables:applying firewall rules: [OK]
23:48:46 Localhost.localdomain systemd[1]: Started IPv4 Firewall with iptables.
[Email protected] sysconfig]#
[[email protected] ~]# for I in ' ls/etc/yum.repos.d/';d o mv/etc/yum.repos.d/$i/etc/yum.repos.d/$i. Bak;done
[Email protected] ~]# cd/etc/yum.repos.d/
[Email protected] ~]# 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!
CentOS7 Local Yum Source setup