CentOS-6.6-x86_64本地YUM源配置

news/2024/7/3 13:53:21

测试框架

?
1
2
3
4
5
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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[root@master ~] # 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 
 
[root@master ~] # sed -i '/SELINUX/ s/enforcing/disabled/g' /etc/selinux/config 
 
[root@master ~] # 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 
 
[root@master ~] # setenforce 0

停止iptables

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@node1 ~] # 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 
 
[root@node1 ~] # chkconfig ip6tables off 
 
[root@node1 ~] # chkconfig iptables off 
 
[root@node1 ~] # service ip6tables stop 
 
ip6tables: Setting chains to policy ACCEPT: filter [ OK ] 
 
ip6tables: Flushing firewall rules: [ OK ] 
 
ip6tables: Unloading modules: [ OK ] 
 
[root@node1 ~] # service iptables stop 
 
iptables: Setting chains to policy ACCEPT: filter [ OK ] 
 
iptables: Flushing firewall rules: [ OK ] 
 
iptables: Unloading modules: [ OK ] 
 
[root@node1 ~] #

设置ntp

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@master ~] # ntpdate pool.ntp.org
 
[root@master ~] # 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 
 
[root@master ~] # chkconfig ntpd on 
 
[root@master ~] # service ntpd start 
 
Starting ntpd: [ OK ] 
 
[root@master ~] #

创建软件仓库

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

?
1
2
3
4
5
6
7
8
9
10
11
[root@mirrors ~] # 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%]
 
[root@mirrors ~] # yum -y install yum-downloadonly createrepo

clipboard

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@mirrors ~] # 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 '

clipboard[1]

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

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

?
1
2
3
[root@mirrors ~] # rpm -ivh http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm
 
[root@mirrors ~] # yum install nginx puppet-server puppet -y --downloadonly --downloaddir=/data/mirrors/centos/6/updates/x86_64/RPMS/

clipboard[2]

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

?
1
2
3
[root@mirrors ~] # createrepo /data/mirrors/centos/6/os/x86_64/
 
[root@mirrors ~] # createrepo /data/mirrors/centos/6/updates/x86_64/

clipboard[3]

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

?
1
2
3
4
5
[root@mirrors ~]yum  install  -y nginx
 
[root@mirrors ~] # service nginx start
 
[root@mirrors ~] # chkconfig nginx on

clipboard[4]

clipboard[5]

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@mirrors ~] # vim /etc/nginx/conf.d/mirrors.redking.com.conf
 
server
 
{
 
listen  80;
 
server_name     mirrors.redking.com;
 
root     /data/mirrors ;
 
index   index.html;
 
}
 
[root@mirrors ~] # service nginx restart

clipboard[6]

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

配置YUM本地源

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@master ~] # 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

clipboard[7]

?
1
2
3
4
5
[root@master ~] # cd /etc/yum.repos.d/
 
[root@master yum.repos.d] # mv CentOS-Base.repo CentOS-Base.repo.bak
 
[root@master yum.repos.d] # yum clean all

clipboard[8]

安装Puppet

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

?
1
2
3
4
5
[root@master ~] # yum install -y puppet-server
 
[root@master ~] # chkconfig puppetmaster on
 
[root@master ~] # service puppetmaster start

clipboard[9]

2.Puppet agent客户端安装puppet

?
1
2
3
4
5
[root@agent yum.repos.d] # yum install -y puppet
 
[root@agent yum.repos.d] # chkconfig puppet on
 
[root@agent yum.repos.d] # service puppet start

clipboard[10]

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












本文转自redking51CTO博客,原文链接:http://blog.51cto.com/redking/1612567,如需转载请自行联系原作者


http://www.niftyadmin.cn/n/3044476.html

相关文章

Kubernetes -- 日志处理

首先需要明确的是,Kubernetes 里面对容器日志的处理方式,都叫作 cluster-level-logging,即:这个日志处理系统,与容器、Pod 以及 Node 的生命周期都是完全无关的。这种设计当然是为了保证,无论是容器挂了、P…

Git基本介绍

https://learngitbranching.js.org/?localezh_CN https://mp.weixin.qq.com/s?__bizMzI1NDQ3MjQxNA&mid2247487262&idx2&sn5c2aa3be4a9422e7b778e245daf5389f&chksme9c5f6afdeb27fb9defa48fd7c279662c3a3b72ec787f158af270ec392275bbeb6e070b2f22c&mpsha…

linux vim安装_Linux下vim的安装及其设置细节(建议收藏)

一、vim的下载Ubuntu系统,输入命令:sudo apt install vimCentos系统,输入命令:yum -y install vim*然后输入y就行了,不出意外的话,完成之后,vim就已经安装完成了。下面都以Ubuntu为例。二、vim的…

敏捷领导力 - 修自己(练内功)

一、气场 1、气场塑造方法论 -- 肢体语言 高能姿势 低能姿势: 做两分钟高能姿势,提高自信。(不断练习) 2、衣着设定 3、公众表达(将故事能力) 3层黄金圈法则。先想好为什要这么做,再想怎么做&…

Python之路【第十三篇】:isinstance()函数与lambda表达式及函数参数的传递方式

isinstance()函数 isinstance()函数用来判断一个对象是否是某一个类的实例,是,返回True.否则返回False,如: temp 123 r instance(temp,str),结果返回True def fun(temp):if isinstance(temp,str) or isinstance(temp,list) or …

Git-命令

git init : 将创建一个名为 .git 的子目录,这个子目录含有你初始化的 Git 仓库中所有的必须文件,这些文件是 Git 仓库的骨干。 git clone :克隆现有的仓库,执行成功后会在你本地自动生成一个项目 git status : 查看当前项目的状态…

html css 显示数值_HTML语义化【HTML】

用最恰当的标签来标记内容语义化的 HTML 文档,不关心内容的显示效果。HTML语义化的作用对于人员语义化 HTML 会使 HTML 结构变的清晰,有利于维护代码和添加样式。便于团队开发和维护,语义化更具可读性,减少差异化。对于设备在没有…

有效激励--

一、五招激励士气低落的员工 员工为什么完成不了任务? 员工不知道如何去做 -- 提供相应的培训,提高他们的技能;某事或某人使他们无法工作 -- 弄清楚纠结是什么妨碍了员工的工作,帮助他扫除障碍;员工不愿工作或不愿按照…