CentOS-6.6-x86_64本地YUM源配置

简介: 测试框架 ? 1 2 3 4 5 mirrors.redking.com 192.168.188.10   master.redking.com 192.168.

测试框架

?
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,如需转载请自行联系原作者

相关文章
|
应用服务中间件 Linux 网络安全
Centos 8.0中Nginx配置文件和https正书添加配置
这是一份Nginx配置文件,包含HTTP与HTTPS服务设置。主要功能如下:1) 将HTTP(80端口)请求重定向至HTTPS(443端口),增强安全性;2) 配置SSL证书,支持TLSv1.1至TLSv1.3协议;3) 使用uWSGI与后端应用通信(如Django);4) 静态文件托管路径设为`/root/code/static/`;5) 定制错误页面(404、50x)。适用于Web应用部署场景。
1330 87
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
3105 16
|
存储 Linux Apache
在CentOS上配置SVN至Web目录的自动同步
通过上述配置,每次当SVN仓库中提交新的更改时,`post-commit`钩子将被触发,SVN仓库的内容会自动同步到指定的Web目录,从而实现代码的连续部署。
442 16
|
NoSQL 安全 Linux
设置Redis在CentOS7上的自启动配置
这些步骤总结了在CentOS 7系统上设置Redis服务自启动的过程。这些命令提供了一个直接且明了的方式,确保Redis作为关键组件在系统启动时能自动运行,保障了依赖于Redis服务的应用的稳定性和可用性。
1053 9
|
Linux
Centos6配置阿里云yum源报错
在CentOS 6配置阿里云Yum源时,可能出现EPEL仓库访问报错(404 Not Found)。解决方法:编辑`/etc/yum.repos.d/epel.repo`文件,将`enabled`和`gpgcheck`参数设为0 ``` 此设置可解决仓库无法访问的问题。
2714 29
|
关系型数据库 MySQL Linux
CentOS 7系统下详细安装MySQL 5.7的步骤:包括密码配置、字符集配置、远程连接配置
以上就是在CentOS 7系统下安装MySQL 5.7的详细步骤。希望这个指南能帮助你顺利完成安装。
3771 26
|
Ubuntu 安全 Linux
CentOS与Ubuntu中防火墙配置命令集汇
有了这些,你就能遨游在 CentOS 和 Ubuntu 的海洋中,频繁地改变你的防火墙设置,快速地应对各种安全威胁,同时也能保证你的系统可以正常工作。出发吧,勇敢的编程者,随着这些命令集的涌动,扬帆起航,走向安全的网络世界!
659 5
|
Linux
在 CentOS 上安装 OpenVPN 客户端连接配置
本文介绍了如何在 Linux 系统上安装并配置 OpenVPN 客户端,连接公司或服务器局域网。内容包括使用 yum 安装 OpenVPN、配置客户端文件(.ovpn 和密码文件),以及通过命令行连接和测试网络。附有参考链接解决常见问题。
4584 0
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
2032 25
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
766 10