Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1764571
  • 博文数量: 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-11-24 16:31:26

cobbler的升级和增加centos7.4自动安装配置

升级cobbler

[root@mon3 ~]# yum update cobbler
已加载插件:fastestmirror
......
(1/2): epel/x86_64/updateinfo                              | 848 kB   00:01
(2/2): epel/x86_64/primary_db                              | 6.1 MB   02:21
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.neusoft.edu.cn
 * updates: mirrors.neusoft.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 cobbler.x86_64.0.2.8.0-4.el7 将被 升级
---> 软件包 cobbler.x86_64.0.2.8.2-1.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

================================================================================
 Package           架构             版本                   源              大小
================================================================================
正在更新:
 cobbler           x86_64           2.8.2-1.el7            epel           574 k

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

总下载量:574 k
Is this ok [y/d/N]: y
Downloading packages:
epel/x86_64/prestodelta                                    |  884 B   00:00
cobbler-2.8.2-1.el7.x86_64.rpm                             | 574 kB   00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : cobbler-2.8.2-1.el7.x86_64                                  1/2
warning: /etc/cobbler/dhcp.template created as /etc/cobbler/dhcp.template.rpmnew
warning: /var/lib/cobbler/distro_signatures.json created as /var/lib/cobbler/distro_signatures.json.rpmnew
  清理        : cobbler-2.8.0-4.el7.x86_64                                  2/2
  验证中      : cobbler-2.8.2-1.el7.x86_64                                  1/2
  验证中      : cobbler-2.8.0-4.el7.x86_64                                  2/2

更新完毕:
  cobbler.x86_64 0:2.8.2-1.el7

完毕!

下载centos7.4

CentOS-7-x86_64-DVD-1708.iso

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

mkdir /var/iso/Linux/Centos/x86_64/7.4
mount -o loop /root/CentOS-7-x86_64-DVD-1708.iso  /var/iso/Linux/Centos/x86_64/7.4
mount: /dev/loop0 写保护,将以只读方式挂载

导入cobbler系统

cobbler import --path=/var/iso/Linux/Centos/x86_64/7.4 --name CentOS_7.4_x86_64
task started: 2017-11-23_102604_import
task started (id=Media import, time=Thu Nov 23 10:26:04 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.4_x86_64:
creating new distro: CentOS_7.4-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS_7.4_x86_64 -> /var/www/cobbler/links/CentOS_7.4-x86_64
creating new profile: CentOS_7.4-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.4_x86_64 for CentOS_7.4-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS_7.4_x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS_7.4_x86_64
looking for /var/www/cobbler/ks_mirror/CentOS_7.4_x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS_7.4_x86_64/repodata
*** TASK COMPLETE ***

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

vi /var/lib/cobbler/kickstarts/centos7.4.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.
$yum_repo_stanza
# 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
clearpart --all --drives=sda
part /boot --fstype="xfs"  --size=500  --ondisk=sda --asprimary
part pv.01 --grow  --ondisk=sda  --asprimary
volgroup centos  pv.01
logvol /  --fstype="xfs" --size=51200 --name=root --vgname=centos  -
logvol swap  --fstype="swap" --size=8192 --name=swap --vgname=centos
logvol /goluk  --vgname=centos --size=102400   --name=goluk --fstype=xfs
# docker logvol
logvol /docker --fstype="xfs" --size=102400 --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
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_koan')
#$SNIPPET('install_docker')

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

设置profile和自动安装ks文件的关联

cobbler profile edit --name=CentOS_7.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.4.ks

使设置生效

cobbler sync

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