Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1764607
  • 博文数量: 150
  • 博客积分: 660
  • 博客等级: 上士
  • 技术积分: 2480
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-08 11:39
文章分类

全部博文(150)

文章存档

2019年(4)

2018年(36)

2017年(53)

2016年(7)

2015年(3)

2014年(3)

2013年(27)

2012年(2)

2011年(1)

2006年(1)

2005年(13)

分类: 系统运维

2017-03-26 09:59:26

cobbler 增加centos7.3自动安装系统

查看当前自动安装系统列表

[root@mon3 ~]# cobbler list
distros:
CentOS-7.1-1503-x86_64
CentOS_7.2_X86_64-x86_64

profiles:
CentOS-7.1-1503-x86_64
CentOS_7.1-x86_64_server
CentOS_7.2_X86_64-x86_64

systems:
ceph
h210
h230
h240

repos:

......

既然没有7.3 那么就开始安装,首先更新cobbler自身

[root@mon3 ~]# yum update cobbler
已加载插件:fastestmirror
......
base                                                                                                       | 3.6 kB  00:00:00
epel/x86_64/metalink                                                                                    | 6.3 kB  00:00:00
epel                                                                                                    | 4.3 kB  00:00:00
extras                                                                                                  | 3.4 kB  00:00:00
                                                                           Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 cobbler.x86_64.0.2.6.11-1.el7 将被 升级
---> 软件包 cobbler.x86_64.0.2.8.0-4.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

===============================================================================================================================
Package                       架构                            版本                              源                           大小
===============================================================================================================================
正在更新:
cobbler                       x86_64                       2.8.0-4.el7                       epel                       572 k

事务概要
===============================================================================================================================
升级  1 软件包

总下载量:572 k
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for epel
cobbler-2.8.0-4.el7.x86_64.rpm                                                                          | 572 kB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 正在更新    : cobbler-2.8.0-4.el7.x86_64                                                                                   1/2
warning: /var/lib/cobbler/distro_signatures.json created as /var/lib/cobbler/distro_signatures.json.rpmnew
......
更新完毕:
cobbler.x86_64 0:2.8.0-4.el7

下载7.3系统iso文件

[root@mon3 ~]# wget -c 

--2017-03-21 10:23:26--  
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 112.124.140.210, 115.28.122.210
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|112.124.140.210|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:4379901952 (4.1G) [application/octet-stream]
正在保存至: “CentOS-7-x86_64-DVD-1611.iso”

创建挂载iso文件的目录,目录自定义

[root@mon3 ~]# mkdir /var/iso/Linux/Centos/x86_64/7.3
[root@mon3 ~]# mount -o loop /root/CentOS-7-x86_64-DVD-1611.iso  /var/iso/Linux/Centos/x86_64/7.3
mount: /dev/loop0 写保护,将以只读方式挂载

导入cobbler系统

[root@mon3 ~]# cobbler import --path=/var/iso/Linux/Centos/x86_64/7.3 --name CentOS_7.3_x86_64

task started: 2017-03-21_130246_import
task started (id=Media import, time=Tue Mar 21 13:02:46 2017)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/CentOS_7.3_x86_64:
creating new distro: CentOS_7.3-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS_7.3_x86_64 -> /var/www/cobbler/links/CentOS_7.3-x86_64
creating new profile: CentOS_7.3-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/CentOS_7.3_x86_64 for CentOS_7.3-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS_7.3_x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/ CentOS_7.3_x86_64
looking for /var/www/cobbler/ks_mirror/CentOS_7.3_x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS_7.3_x86_64/repodata
*** TASK COMPLETE ***

创建centos7.3 的自动安装所需的kickstart文件

[root@mon3 kickstarts]# vi centos7.3.ks
[root@mon3 kickstarts]# cat centos7.3.ks
# kickstart template for Fedora 8 and later.
# (includes %end blocks)
# do not use with earlier distros

#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US.UTF8
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.

$yumrepostanza # Network information $SNIPPET('network_config') # Reboot after installation reboot

#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone  Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
#autopart
#part
part /boot --fstype="xfs"  --size=500  --ondisk=sda
part pv.01 --grow  --ondisk=sda
volgroup centos  pv.01
logvol /  --fstype="xfs" --size=51200 --name=root --vgname=centos
logvol swap  --fstype="swap" --size=8192 --name=swap --vgname=centos
#logvol /cdc  --vgname=centos --size=102400   --name=cdcvol --fstype=xfs
# docker logvol
logvol /docker --fstype="xfs" --size=204800 --name=docker  --vgname=centos
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end

%packages
$SNIPPET('func_install_if_enabled')

@^minimal
@system-admin-tools
@network-tools
epel-release
system-storage-manager
wget
net-tools
tcpdump
lsof
%end

%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end

%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
#$SNIPPET('install_docker')

# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
%end

建立自动安装7.3所用的profile和ks文件的关联

[root@mon3 kickstarts]#[root@mon3 kickstarts]# cobbler profile add --name=CentOS_7.3_x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.3.ks

使上述配置生效,输出略

cobbler sync

.......
阅读(2414) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~