CentOS-6.6-x86_64本地YUM源配置

测试框架

mirrors.redking.com 192.168.188.10

master.redking.com 192.168.188.20

agent.redking.com 192.168.188.30

Puppet 要求所有机器有完整的域名(FQDN),如果没有 DNS 服务器提供域名的话,可以在两台机器上设置主机名(注意要先设置主机名再安装 Puppet,因为安装 Puppet 时会把主机名写入证书,客户端和服务端通信需要这个证书),因为我配置了DNS,所以就不用改hosts了,如果没有就需要改hosts文件指定。

1.关闭selinux,iptables,并设置ntp
采用CentOS-6.6-x86_64.iso进行minimal最小化安装

关闭selinux

[[email protected] ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system. 

# SELINUX= can take one of these three values: 

# enforcing - SELinux security policy is enforced. 

# permissive - SELinux prints warnings instead of enforcing. 

# disabled - No SELinux policy is loaded. 

SELINUX=enforcing 

# SELINUXTYPE= can take one of these two values: 

# targeted - Targeted processes are protected, 

# mls - Multi Level Security protection. 

SELINUXTYPE=targeted 

[[email protected] ~]# sed -i ‘/SELINUX/ s/enforcing/disabled/g‘ /etc/selinux/config 

[[email protected] ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system. 

# SELINUX= can take one of these three values: 

# enforcing - SELinux security policy is enforced. 

# permissive - SELinux prints warnings instead of enforcing. 

# disabled - No SELinux policy is loaded. 

SELINUX=disabled 

# SELINUXTYPE= can take one of these two values: 

# targeted - Targeted processes are protected, 

# mls - Multi Level Security protection. 

SELINUXTYPE=targeted 

[[email protected] ~]# setenforce 0

停止iptables

[[email protected] ~]# chkconfig --list |grep tables 

ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off 

iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off 

[[email protected] ~]# chkconfig ip6tables off 

[[email protected] ~]# chkconfig iptables off 

[[email protected] ~]# service ip6tables stop 

ip6tables: Setting chains to policy ACCEPT: filter [ OK ] 

ip6tables: Flushing firewall rules: [ OK ] 

ip6tables: Unloading modules: [ OK ] 

[[email protected] ~]# service iptables stop 

iptables: Setting chains to policy ACCEPT: filter [ OK ] 

iptables: Flushing firewall rules: [ OK ] 

iptables: Unloading modules: [ OK ] 

[[email protected] ~]#

设置ntp

[[email protected] ~]# ntpdate pool.ntp.org

[[email protected] ~]# chkconfig --list|grep ntp 

ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off 

ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off 

[[email protected] ~]# chkconfig ntpd on 

[[email protected] ~]# service ntpd start 

Starting ntpd: [ OK ] 

[[email protected] ~]#

创建软件仓库

1.在mirrors.redking.com软件仓库服务器上安装EPEL源及yum-downloadonly和createrepo软件包

[[email protected] ~]# rpm -ivh http://mirrors.sohu.com/fedora-epel/6Server/x86_64/epel-release-6-8.noarch.rpm

Retrieving http://mirrors.sohu.com/fedora-epel/6Server/x86_64/epel-release-6-8.noarch.rpm

warning: /var/tmp/rpm-tmp.2hQx2e: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY

Preparing...                ########################################### [100%]

1:epel-release           ########################################### [100%]

[[email protected] ~]# yum -y install yum-downloadonly createrepo

2.创建软件仓库地址,选择/data/mirrors目录作为软件仓库目录

[[email protected] ~]# mkdir -pv /data/mirrors/centos/6/{os,updates}/x86_64/RPMS

mkdir: created directory `/data‘

mkdir: created directory `/data/mirrors‘

mkdir: created directory `/data/mirrors/centos‘

mkdir: created directory `/data/mirrors/centos/6‘

mkdir: created directory `/data/mirrors/centos/6/os‘

mkdir: created directory `/data/mirrors/centos/6/os/x86_64‘

mkdir: created directory `/data/mirrors/centos/6/os/x86_64/RPMS‘

mkdir: created directory `/data/mirrors/centos/6/updates‘

mkdir: created directory `/data/mirrors/centos/6/updates/x86_64‘

mkdir: created directory `/data/mirrors/centos/6/updates/x86_64/RPMS‘

3.将Nginx、Puppet软件包存放到软件仓库,采用downloadonly的方式进行更新

puppet不在CentOS的基本源中,需要加入 PuppetLabs 提供的官方源

[[email protected] ~]# rpm -ivh http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm

[[email protected] ~]# yum install nginx puppet-server puppet -y --downloadonly --downloaddir=/data/mirrors/centos/6/updates/x86_64/RPMS/

4.采用createrepo创建仓库文件,如果软件包比较多时可以通过--update参数进行更新

[[email protected] ~]# createrepo /data/mirrors/centos/6/os/x86_64/

[[email protected] ~]# createrepo /data/mirrors/centos/6/updates/x86_64/

5.在软件仓库服务器前端安装配置Nginx Web来处理安装包请求

[[email protected] ~]yum install -y nginx

[[email protected] ~]# service nginx start

[[email protected] ~]# chkconfig nginx on

6.为软件仓库配置mirrors.redking.com虚拟机

[[email protected] ~]# vim /etc/nginx/conf.d/mirrors.redking.com.conf

server

{

listen  80;

server_name     mirrors.redking.com;

root    /data/mirrors;

index   index.html;

}

[[email protected] ~]# service nginx restart

通过上面6步就成功搭建本地软件仓库,在客户端只需要配置repo文件就可以安装此软件仓库中的软件包。

配置YUM本地源

客户端配置mirrors.repo文件,我们也可以使用Puppet的yumrepo资源来指定yum源

[[email protected] ~]# vim /etc/yum.repos.d/mirrors.repo

[base]

name=CentOS-$releasever - Base

baseurl=http://mirrors.redking.com/centos/$releasever/os/$basearch/

enabled=1

gpgcheck=0

#released updates

[updates]

name=CentOS-$releasever - Updates

baseurl=http://mirrors.redking.com/centos/$releasever/updates/$basearch/

enabled=1

gpgcheck=0

[[email protected] ~]# cd /etc/yum.repos.d/

[[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

[[email protected] yum.repos.d]# yum clean all

安装Puppet

1.Puppet Master服务器端安装puppet-server,自动匹配安装Facter等相关依赖包

[[email protected] ~]# yum install -y puppet-server

[[email protected] ~]# chkconfig puppetmaster on

[[email protected] ~]# service puppetmaster start

2.Puppet agent客户端安装puppet

[[email protected] yum.repos.d]# yum install -y puppet

[[email protected] yum.repos.d]# chkconfig puppet on

[[email protected] yum.repos.d]# service puppet start

=============================END=====================================

时间: 2024-08-24 11:37:31

CentOS-6.6-x86_64本地YUM源配置的相关文章

Centos6.4 本地yum源配置

由于单位的服务器均使用的是内网,而安装一些软件如Git,需要很多的依赖包,使用yum安装相对简单,由于不能联网故配置本地yum源配置. 1.首先将需要rpm库添加到系统中: 1).虚拟机中安装的linux操作系统:则只需将安装包ISO文件挂载到media下面(如无法挂载请参考http://www.cnblogs.com/shenliang123/p/3203278.html) 2).单独的服务器系统,则先在/media下新建centos(名字可以自定义,但与下面4中添加的目录相关),然后将ISO

本地yum源配置

Yum库配置:     创建本地仓库 配置环境:CentOS 5.10 作用:自动解决rpm软件包的依赖关系,并且为客户机提供软件下载源. 实现思路:创建本地软件仓库 修改配置文件 清空缓存 重新加载 实现: [[email protected] ~]#mkdir /var/centosdvd      //创建本地仓库目录 [[email protected] ~]# cd/misc/cd               //切换到挂载点 [[email protected] ~]# cp-rf

RHEL6.5服务器本地yum源配置

RHEL6.5服务器本地yum源配置 1.确保安装所需软件包 yum-3.2.29-40.el6.noarch createrepo-0.9.9-17.el6.noarch yum配置文件为/etc/yum.conf 2.挂载本地磁盘到/mnt/cdrom目录下 [[email protected] ~]#mount /dev/cdrom /mnt/cdrom 3.配置本地yum. 源配置文件以独立file.repo格式存放于/etc/yum.repos.d/目录中,如下配置本地yum源 [[e

Centos利用ISO设置本地YUM源

Centos利用ISO设置本地YUM源: 1.CentOS-Base.repo改名为CentOS-Base.repo.bak为了防止yum从网络访问 2.打开CentOS-Media.repo:编辑如下: [c5-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS_5.4_Final/ #        file:///media/cdrom/ #        file:///media/cdrecorder/

redhat下本地yum源配置

LINUX一些软件安装都有依赖包,有时用rpm包要去解决依赖包问题.我们用yum来解决一些依赖包. 把光盘挂载 [[email protected] ~]# mount /dev/cdrom /mnt 安装createrepo [[email protected] ~]# cd /mnt/Server/ [[email protected] Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm 创建一个目录放yum源 [[email prote

CentOS本地yum源配置

现有一台处在局域网的linux服务器,无法ping通外网,本文是关于本地yum源的配置 环境 : CentOS 6.5 一 .挂载CentOS镜像文件 (1) 创建挂载文件夹,若此文件夹已存在可忽略 sudo mkdir -p /mnt/cdrom (2) 挂载镜像文件 sudo mount -o loop -t iso9660 ./CentOS-6.5-x86_64-bin-DVD1.iso  /mnt/cdrom (如果是虚拟环境可使用 : sudo mount -o loop -t iso

CentOS 本地yum源配置

载本地光盘到系统:把Cent6.2安装光盘放入光驱,在终端命令行下操作      mkdir /mnt  #新建挂载目录      mount /dev/cdrom  /mnt#挂载光盘到/mnt目录下      cd  /mnt #进入挂载目录 Ls 查看挂载目录, 配置本地yum源      cd /etc/yum.repos.d/   #进入yum配置目录      vi  CentOS-Media.repo   #编辑配置文件,添加以下内容: 1.1 [GuangPan] 2.2 nam

centos 7本地yum源配置

环境: centos 7 配置repo文件 [[email protected] yum.repos.d]# cat base.repo [server] name=server baseurl=file:///openyum/ gpgcheck=0 将本地yum包放到要创建的本地yum源的路径中 tar zxf  openstack.tar.gz -C /openyum/1/ tar zxf  cinder.tar.gz -C /openyum/2/ 安装createrepo yum -y i

CentOS 6.x 本地yum源配置与使用

系统默认已经安装了可使用yum的软件包,所以可以直接配置: # mount  /dev/cdrom  /mnt                                挂载镜像,可以写到配置文件,开机自动挂载 # echo "mount  /dev/cdrom  /mnt"   >>  /etc/rc.local # cd /etc/yum.repos.d/                                       yum源配置文件放置目录 # mv

CentOS 6.5下本地yum源与网络yum源的配置使用

一.本地yum源 1.系统默认已经安装了可使用yum的软件包,所以可以直接配置: [[email protected] ~]# cd /etc/yum.repos.d/                         yum源配置文件放置目录 [[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak    先将网络yum源        配置文件更名(让其失效) [[email protected] yum