anaconda详解

来源:互联网 发布:最火淘宝店铺 编辑:程序博客网 时间:2024/06/06 02:03

anaconda基础知识

anaconda: 系统安装程序
gui:图形窗口
tui: 基于图形库curses的文本窗口
安装程序启动过程:
MBR: isolinux/boot.cat
stage2: isolinux/isolinux.bin
配置文件: isolinux/isolinux.cfg
每个对应的菜单选项:
加载内核: isolinuz/vmlinuz
向内核传递参数: append initrd=initrd.img…
装载根文件系统,并启动anaconda
默认启动GUI接口
若是显式指定使用TUI接口: 向内核传递text参数即可
(1)按tab键,在后面增加text
(2)按ESC键: boot: linux text
启动安装过程一般应位于引导设备;后续的anaconda及其安装用到的程序包等可来自下面几种方式:
本地光盘
本地硬盘
NFS
URL:
ftp server: yum repository
http server: yum repostory
如果想手动指定安装源:
boot: linux askmethod
anaconda的配置方式:
(1) 交互式配置方式:需要安装system-config-kickstart软件包
(2) 通过读取事先给定的配置文件自动完成配置按特定语法给出的配置文件kickstart

anaconda安装系统选项

安装boot引导选项: boot:
text: 文本安装方式
askmethod: 手动指定使用的安装方法
与网络相关的引导选项:
ip=IPADDR
netmask=MASK
gateway=GW
dns=DNS_SERVER_IP
ifname=NAME:MAC_ADDR
指明kickstart文件的位置: ks=
DVD drive: ks=cdrom:/PATH/TO/KICKSTART_FILE
Hard drive: ks=hd:device:/directory/KICKSTART_FILE
HTTP server: ks=http://host:port/path/to/KICKSTART_FILE
FTP server: ks=ftp://host:port/path/to/KICKSTART_FILE
HTTPS server: ks=https://host:port/path/to/KICKSTART_FILE
NFS server:ks=nfs:host:/path/to/KICKSTART_FILE

kickstart文件格式

命令段:指明各种安装前配置,如键盘类型、时区等
程序包段:指明要安装的程序包组或程序包,不安装的程序包等
%packages
@group_name
package
-package
%end
脚本段:
%pre: 安装前脚本
运行环境:运行于安装介质上的微型Linux环境
%post: 安装后脚本
运行环境:安装完成的系统
命令段中的必需命令:
authconfig: 认证方式配置
authconfig –useshadow –passalgo=sha512
bootloader: bootloader的安装位置及相关配置
bootloader –location=mbr –driveorder=sda –
append=”crashkernel=auto rhgb quiet”
keyboard: 设定键盘类型
lang: 语言类型
part: 创建分区
rootpw: 指明root的密码
timezone: 时区
命令段中的可选命令:
install OR upgrade
text: 文本安装界面
network
firewall
selinux
halt
poweroff
reboot
repo
user:安装完成后为系统创建新用户
url: 指明安装源
key –skip 跳过安装号码,适用于rhel版本

kickstart文件创建

创建kickstart文件的方式
直接手动编辑
依据某模板修改
可使用创建工具: system-config-kickstart
依据某模板修改并生成新配置
/root/anaconda-ks.cfg
检查ks文件的语法错误: ksvalidator
ksvalidator /PATH/TO/KICKSTART_FILE
依赖pykickstart软件包,没有可用yum安装

kickstart文件解释

#version=DEVEL# System authorization informationauth --enableshadow --passalgo=sha512 #系统认证# Use CDROM installation mediacdrom #此处指定yum源,可用http,ftp例如:url --url=http://192.168.6.6/centos# Use graphical installgraphical #可以指定文本安装text# Run the Setup Agent on first bootfirstboot --enableignoredisk --only-use=sdaselinux --disabled #禁用selinux# Keyboard layoutskeyboard --vckeymap=us --xlayouts='us'# System languagelang en_US.UTF-8# Network informationnetwork  --bootproto=dhcp --device=ens33 --onboot=on --ipv6=auto --activatenetwork  --hostname=centos7.3# Root passwordrootpw --iscrypted $6$4H7lm/X8Ku/nsNTw$.5llTHSpqn3igZ9Mub.uq/W4LN3Lx/5q76cpc/jjK7s0LEIFC/agBmwabsTzlumlLAfrXVEBwUbM25Avsokru.# System servicesservices --disabled="chronyd"# System timezonetimezone Asia/Shanghai ntpservers=0.centos.pool.ntp.org,1.centos.pool.ntp.org,2.centos.pool.ntp.org,3.centos.pool.ntp.orguser --name=zhang --password=$6$idwFYWsqAMxGAQS3$FQLI.nfmXufCsyjqxCOvyfzRotbf3oU2Y2sGY1AZwnzVbb2lx5skFIzzAZPUj0x.bW3MOVjULqcO81EvmLeNu0 --iscrypted# X Window System configuration informationxconfig  --startxonboot# System bootloader configurationbootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sdaautopart --type=lvm #lvm自动分区# Partition clearing informationzerombr #清空主引导分区记录MBRclearpart --all #清空所有分区reboot%packages@^graphical-server-environment@base@corekexec-tools%end#以下可以写安装后的脚本%postuseradd test  #添加测试用户%end%addon com_redhat_kdump --enable --reserve-mb='auto'%end%anacondapwpolicy root --minlen=6 --minquality=50 --notstrict --nochanges --notemptypwpolicy user --minlen=6 --minquality=50 --notstrict --nochanges --notemptypwpolicy luks --minlen=6 --minquality=50 --notstrict --nochanges --notempty%end
原创粉丝点击