Auto Install with Kickstart

博客围绕RedHat系统展开,介绍了安装文件复制、NFS服务器设置、Kickstart配置文件、DHCP和PXE设置等内容。还提及了相关文件和设置步骤,如NFS的配置文件、启动服务等,最后介绍了多个脚本用于选择安装MySQL和qmail。
  • Copy install files of redhat
  • Setup NFS server
    • Related files
    • Setting
    • Start
    • Usage
  • Kickstart config file
    • File
    • Note
  • DHCP
  • PXE
    • Set bios for DELL
    • set tftp server
    • set boot item
  • More Scripts
    • boot.msg
    • pxelinux.cfg/default
    • ks.cfg
    • ks_more.cfg
    • mysql.sh
    • qmail.sh
    • set.sh

Copy install files of redhat

mkdir /misc/redhat 

insert each install CD of RedHat

mount /dev/cdrom /mnt/cdrom 

if CD1

cp -var /mnt/cdrom/. /misc/redhat 

other CDs

cp -var /mnt/cdrom/RedHat /misc/redhat umount /mnt/cdrom eject 

Setup NFS server

Related files

/etc/exports -- config file
/usr/sbin/exportfs
/usr/sbin/showmount -- check
/var/lib/nfs/xtab -- log

Setting

echo "/mis/redhat 192.168.2.0/24(ro,no_root_squash)" >> /etc/exports 

ro -- readonly
no_root_squash -- every user on remote is nobody except root

Start

service portmap start
service nfs start

Usage

mount –t nfs -o soft,intr,timeout=30 192.168.2.119:/usr/home /usr/home/ 
  • timeo=n

This sets the time (in tenths of a second) the NFS client will wait for a request to complete. The default value is 7 (0.7 seconds). What happens after a timeout depends on whether you use the hard or soft option.

  • soft

Soft-mount (as opposed to hard-mount) the driver. This option causes an I/O error to be reported to the process attempting a file operation when a major timeout occurs.

  • intr

Allow signals to interrupt an NFS call. Useful for aborting when the server doesn't respond.

Kickstart config file

File

ks.cfg content:

#Generated by Kickstart Configurator 
#System language
lang en_US
#Language modules to install
langsupport zh_CN.GB2312 zh_TW.Big5 ja_JP.eucJP --default=en_US
#System keyboard
keyboard us
#System mouse
mouse generic3ps/2
#Sytem timezone
timezone Asia/Tokyo
#Root password rootpw --iscrypted $1$yifNoGyM$fq2lHrrfGIEyvglxnSuZ0.
#Reboot after installation
reboot
#Use text mode install
text
#Install Red Hat Linux instead of upgrade
install
#Use NFS installation Media
nfs --server=192.168.2.119 --dir=/misc/redhat/
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part / --fstype ext3 --size 5000 --asprimary
part /boot --fstype ext3 --size 100 --asprimary
part swap --size 1024 --asprimary
part /home --fstype ext3 --size 5000
part /usr --fstype ext3 --size 5000 --asprimary
part /var --fstype ext3 --size 1 --grow
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#Do not configure XWindows
skipx
#Package install information
%packages --resolvedeps
@ Development Tools
ntp

%post
#!/bin/bash
if [ -e /etc/ntp.conf ]; then
mv /etc/ntp.conf /etc/ntp.conf.bak
fi
echo "server dns5.sakura.ad.jp
driftfile /etc/ntp/drift
broadcastdelay 0.008" > /etc/ntp.conf
chkconfig --level 3 ntpd on

copy to NFS directory

cp ks.cfg /misc/redhat 

enter the following command at the boot: prompt:

linux ks=nfs:192.168.2.119:/misc/redhat/ks.cfg 

Note

When installing, it has following message:

Could not allocate requested partitions Partitioning failed:
Could not allocate partitions Press OK to reboot your system

Maybe partitions are too large.

DHCP

Append this to /etc/dhcp.conf

allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server <server-ip>;
filename "linux-install/pxelinux.0";
}

Then

service dhcpd restart 

server-ip is tftp server's ip, e.g. 192.168.2.119

PXE

Set bios for DELL

Selecting MBA UNDI allows the system to boot from the network server. The MBA UNDI option appears under Boot Sequence only if the Network Interface Controller option is set to On w/MBA. If the Network Interface Controller option is set to On or Off, set it to On w/MBA and then press <Alt><b> to save the change and reboot the system. MBA UNDI then appears under Boot Sequence.

set tftp server

/sbin/chkconfig --level 345 xinetd on
/sbin/chkconfig --level 345 tftp on
mkdir /tftpboot/linux-install
cd /tftpboot/linux-install
cp /usr/lib/syslinux/pxelinux.0 ./
# directory image and isolinux are on CD1 of redhat install CDs
cp /mnt/cdrom/image/pxeboot/initr.img ./
cp /mnt/cdrom/image/pxeboot/vmlinux ./
mkdir pxelinux.cfg
cp /mnt/cdrom/isolinux/isolinux.cfg ./pxelinux.cfg/default
cp /mnt/cdrom/isolinux/*.msg ./

set boot item

Add this into boot.msg

-  To auto install Red Hat Enterprise Linux, type:     autoinstall <ENTER>. 

Add this into default.

label autoinstall   kernel vmlinuz   append ks=nfs:192.168.2.119:/misc/redhat/ks.cfg initrd=initrd.img 

Then at the "boot:" prompt type "autointall".

More Scripts

Using these scripts to choose to install MySQL and qmail.

boot.msg

splash.lss   -  To install or upgrade Red Hat Enterprise Linux in graphical mode,      press the <ENTER> key.   -  To install or upgrade Red Hat Enterprise Linux in text mode, type:      linux text <ENTER>.    -  To install Red Hat Enterprise Linux only, type:      base <ENTER>.   -  To install Red Hat Enterprise Linux, MySQL and qmail, type:     install <ENTER>.   -  Use the function keys listed below for more information.  [F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue]  

pxelinux.cfg/default

default bse
prompt 1 timeout 300
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
F7 snake.msg
label linux
kernel vmlinuz
append initrd=initrd.img
label text
kernel vmlinuz
append initrd=initrd.img text
label expert
kernel vmlinuz
append expert initrd=initrd.img
label ks
kernel vmlinuz
append ks initrd=initrd.img
label lowres
kernel vmlinuz
append initrd=initrd.img lowres
label base
kernel vmlinuz
append ks=nfs:192.168.1.1:/misc/redhat/ks.cfg initrd=initrd.img
label install
kernel vmlinuz
append ks=nfs:192.168.1.1:/misc/redhat/ks_more.cfg initrd=initrd.img

ks.cfg

# kickstart auto install config
# Author : Wu Hao
# Date : 2005/08/24
#System language
lang en_US
#Language modules to install
langsupport zh_CN.GB2312 zh_TW.Big5 ja_JP.eucJP --default=en_US
#System keyboard
keyboard us
#System mouse
mouse generic3ps/2
#Sytem timezone
timezone Asia/Tokyo
#Root password
rootpw --iscrypted $1$yifNoGyM$fq2lHrrfGIEyvglxnSuZ0.
#Reboot after installation
reboot
#Use text mode install
text
#Install Red Hat Linux instead of upgrade
install
#Use NFS installation Media
nfs --server=192.168.1.1 --dir=/misc/redhat/
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part / --fstype ext3 --size 5000 --asprimary
part /boot --fstype ext3 --size 100 --asprimary
part swap --size 1024 --asprimary
#part /home --fstype ext3 --size 5000
#part /usr --fstype ext3 --size 5000 --asprimary
part /var --fstype ext3 --size 1 --grow
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#Do not configure XWindows skipx
#Package install information
%packages --resolvedeps
@ Development Tools
ntp
%post --nochroot
#!/bin/bash
SOURCE_DIR=/mnt/source/others
TARGET_DIR=/mnt/sysimage/usr/src
R_TARGET_DIR=/usr/src
mkdir -p $TARGET_DIR
#set
cp $SOURCE_DIR/set.sh $TARGET_DIR
chroot /mnt/sysimage/ $R_TARGET_DIR/set.sh

ks_more.cfg

Only post part is different from ks.cfg.

%post --nochroot
chvt 3
exec > /dev/tty3 < /dev/tty3
SOURCE_DIR=/mnt/source/others
TARGET_DIR=/mnt/sysimage/usr/src
R_TARGET_DIR=/usr/src
mkdir -p $TARGET_DIR
#default set
cp $SOURCE_DIR/set.sh $TARGET_DIR
echo "#!/bin/sh" >> /mnt/sysimage/tmp/run
echo $R_TARGET_DIR/set.sh >> /mnt/sysimage/tmp/run
#mysql
echo "Do you want to install MySQL?[y/n]"
read answer
if [ $answer == "y" ]; then
cp $SOURCE_DIR/perl-DBI-1.32-5.i386.rpm $TARGET_DIR
cp $SOURCE_DIR/MySQL-server-standard-4.1.13-0.rhel3.i386.rpm $TARGET_DIR
cp $SOURCE_DIR/MySQL-client-standard-4.1.13-0.rhel3.i386.rpm $TARGET_DIR
cp $SOURCE_DIR/mysql.sh $TARGET_DIR
echo $R_TARGET_DIR/mysql.sh >> /mnt/sysimage/tmp/run
fi
#qmail
echo "Do you want to install qmail?[y/n]"
read answer
if [ $answer == "y" ]; then
echo "Input FQDN of your mail server"
read mail_server
cp $SOURCE_DIR/checkpassword-0.90.tar.gz $TARGET_DIR
cp $SOURCE_DIR/qmail-1.03.tar.gz $TARGET_DIR
cp $SOURCE_DIR/ucspi-tcp-0.88.tar.gz $TARGET_DIR
cp $SOURCE_DIR/qmail.sh $TARGET_DIR
echo "$R_TARGET_DIR/qmail.sh install" >> /mnt/sysimage/tmp/run
echo "echo $mail_server | $R_TARGET_DIR/qmail.sh setup" >> /mnt/sysimage/tmp/run
fi
chvt 1

%post
chvt 3
chmod 755 /tmp/run /tmp/run
chvt 1

mysql.sh

#!/bin/bash
cd /tmp
rpm -i perl-DBI-1.32-5.i386.rpm
groupadd mysql
useradd -g mysql mysql
rpm -i MySQL*.rpm

qmail.sh

渡瀬さんのスクリプトを使う

set.sh

#!/bin/bash 
#ntp
if [ -e /etc/ntp.conf ]; then
mv /etc/ntp.conf /etc/ntp.conf.bak
fi
echo "server dns5.sakura.ad.jp
driftfile /etc/ntp/drift
broadcastdelay 0.008" > /etc/ntp.conf
chkconfig --level 3 ntpd on
#close useless services
chkconfig microcode_ctl off
chkconfig gpm off
chkconfig mdmonitor off
chkconfig atd off
chkconfig apmd off
chkconfig isdn off
chkconfig pcmcia off
chkconfig autofs off
chkconfig rhnsd off
chkconfig cups off
chkconfig xfs off
chkconfig canna off
chkconfig FreeWnn off
chkconfig rawdevices off
#DNS
echo "nameserver 202.216.224.67
nameserver 202.216.224.66
nameserver 210.188.224.9
nameserver 210.224.172.13
nameserver 202.222.22.172
search localhost" > /etc/resolve.conf

【顶级EI复现】计及连锁故障传播路径的电力系统 N-k 多阶段双层优化及故障场景筛选模型(Matlab代码实现)内容概要:本文介绍了名为《【顶级EI复现】计及连锁故障传播路径的电力系统 N-k 多阶段双层优化及故障场景筛选模型(Matlab代码实现)》的研究资源,重点围绕电力系统中连锁故障的传播机制,提出了一种N-k多阶段双层优化模型,并结合故障场景筛选方法提升系统安全性与鲁棒性。该模型通过Matlab代码实现,可用于模拟复杂电力系统在多重故障下的响应特性,支持对关键故障路径的识别与优化决策,适用于高水平科研复现与工程仿真分析。文中还列举了大量相关技术方向的配套资源,涵盖智能优化算法、电力系统管理、机器学习、路径规划等多个领域,并提供了网盘链接以便获取完整代码与资料。; 适合人群:具备电力系统、优化理论及Matlab编程基础的研究生、科研人员及从事能源系统安全分析的工程技术人员,尤其适合致力于高水平论文(如EI/SCI)复现与创新的研究者。; 使用场景及目标:①复现顶级期刊关于N-k故障与连锁传播的优化模型;②开展电力系统韧性评估、故障传播分析与多阶段防御策略设计;③结合YALMIP等工具进行双层优化建模与场景筛选算法开发;④支撑科研项目、学位论文或学术成果转化。; 阅读建议:建议读者按照文档提供的目录顺序系统学习,优先掌握双层优化与场景筛选的核心思想,结合网盘中的Matlab代码进行调试与实验,同时参考文中提及的智能算法与电力系统建模范例,深化对复杂电力系统建模与优化的理解。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值