CentOS7本地yum源搭建

CentOS 7基于HTTP的本地yum源

[[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   --------创建本地yum源目录

[[email protected] ~]# 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

[[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  -------- 将挂在后镜像文件全部拷贝到本地yum源目录

[[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/   -------- 更新本地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
[[email protected] ~]#
如果不用iptable可以直接禁用
[[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 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!
[[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   ---------开放HTTP端口(也可以直接禁用防火墙和iptable)

[[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)

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.
[[email protected] sysconfig]#

[[email protected] ~]# for i in `ls /etc/yum.repos.d/`;do 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!

时间: 2024-10-13 01:55:49

CentOS7本地yum源搭建的相关文章

Linux 本地yum源搭建和网络yum源搭建

一.本地yum源搭建 首先挂载上光盘 [[email protected] /]# mount /dev/cdrom /media/cdrom/ 系统默认已经安装了可使用yum的软件包,所以可以直接配置: [[email protected] ~]# cd /etc/yum.repos.d/                        yum源配置文件放置目录 [[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.re

centos7 本地yum源

使用光盘镜像作为软件yum源: [1]上传centos7光盘镜像到/usr/local/src目录下:(工具Xftp) [2]挂载系统文件 mkdir /media/cdrom   # 习惯用这个目录名称了: cd /usr/local/src ls CentOS-7.0-1406-x86_64-DVD.iso # mount -t iso9660 -o loop /usr/local/src/CentOS-7.0-1406-x86_64-DVD.iso /media/cdrom/ mount:

centos 创建本地yum源搭建本地yum仓库 亲测可用

现在如果我们需要大规模部署洗个系统,或者系统需要安装一个什么软件如nginx之类的软件.有的时候你的环境限制你上外网,或者是外网很慢的时候.我们考虑搭建本地yum仓库,内网机器可以直接快速安装所需的软件,解决linux下面的包的依赖,方便,快捷. 下面我们来搭建一下根底yum仓库: 系统:centos6.5 搭建yum仓库有很多种方法,我们这里使用yum插件yum-downloadonly插件来下载我们所需的rpm包.使用createrepo来创建仓库文件. 开始: 我们需要安装zabbix监控

Linux下 本地yum源搭建

第1章 关于yum源 1.1 什么是yum源 yum(Yellow dog Updater, Modified)是一个在 Fedora 和 RedHat 以及 CentOS 中的 Shell 前端软件包管理器.基于 RPM 包管理,能够从指定的服务器 自动下载 RPM 包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的 软件包,无须繁琐地一次次下载.安装.  yum 机制的强大之处在于 yum 源.yum 源相当是一个目录项,当我们使用 yum 机制安装软件时,若需要安装依赖软件,则 y

CentOS-7 本地yum源挂载

在Linux无法连接到互联网时,手动安装依赖是及其麻烦的一件事,需要花费大量的时间寻找rpm包.但在配置本地yum源后,绝决依赖问题就会变得非常简单. 一.准备 centos-7.ISO镜像文件: 二.本地yum源挂载. 加载镜像文件到虚拟机: 开启虚拟机,查看镜像文件是否挂载成功: 删除Centos7自带的yum仓库,在root用户下进行操作: 配置本地yum源,在当前目录下创建base.repo文件: [base] name=Base enabled=1 # 允许使用yum配置 baseur

Red Hat 6.5 本地 yum源搭建

#mkdir /media/cdrom #mount /dev/cdrom /media/cdrom . 本地光盘镜像 mount -o loop -t iso9600 /mnt/cdrom/your-iso /media/cdrom .挂在DVD镜像文件 #cd /etc/yum.repos.d #ls [[email protected] yum.repos.d]# ls rhel-source.repo #vim rhel-source.repo [rhel-source] name=Re

本地yum源搭建及failed to retrieve解决

第1章 yum是什么 YUM(Yellow dog Updater Modified)为多个Linux发行版的软件包管理器,例如Redhat RHEL,CentOS&Fedoro. YUM主要用于自动安装.升级rpm软件包,它能自动查找并解决rpm包之间的依赖关系. YUM自动下载rpm包并安装.类似某软件的一键安装. 1.1 yum源是什么? 要成功的使用YUM工具安装更新软件或系统,就需要有一个包含各种rpm软件包的repository(软件仓库),这个软件仓库我们习惯称为yum源. 网络上

CentOS7本地yum源一键配置脚本

mkdir /mnt/cdrom -p mount /dev/cdrom /mnt/cdrom echo "mount /dev/cdrom /mnt/cdrom" >>/etc/rc.local mkdir /etc/yum.repos.d/yumbak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/yumbak tee >>/etc/yum.repos.d/Local.repo<<-eof [Local]

在linux上搭建本地yum源

准备yum仓库的光盘镜像IOS文件: 设置光驱加载本地磁盘的yum仓库的光盘镜像文件: 在linux的命令行输入setup命令打开设置窗口,选择"System Service": 在打开的系统服务列表中找到httpd服务,确保它处于选中状态: 然后重启机器,使httpd服务启动生效,待虚拟机启动后,在浏览器中访问此机器的主机名,比如我的这台机器的主机名为hadoop01,那么就在浏览器中访问http://hadoop01/,如果出现如下界面,说明httpd服务成功启动: 然后使用SSH