Last active
March 27, 2021 22:50
-
-
Save tasoseng/ce170480acef163b0cf67b39223c57e7 to your computer and use it in GitHub Desktop.
centos 7 custom iso, autoinstall with ks, salt minion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
wget http://ftp.ntua.gr/pub/linux/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso | |
mkdir test | |
mkdir iso | |
mount -oloop CentOS-7-x86_64-Minimal-1810.iso iso | |
rsync -av iso/ test/ | |
umount iso | |
cd test | |
#sed -i '/rd.live.check quiet/a \\nlabel autoinstaller\n menu label autoinstaller\n menu default\n kernel vmlinuz\n append initrd=initrd.img ks=https://example.com/ks.cfg' isolinux/isolinux.cfg | |
#sed -i '/rd.live.check quiet/a \\nlabel autoinstaller\n menu label autoinstaller\n menu default\n kernel vmlinuz\n append initrd=initrd.img ks=hd:sdb1/ks.cfg' isolinux/isolinux.cfg | |
mv -f isolinux/isolinux.cfg isolinux/isolinux.cfg.orig | |
cp -f ../isolinux.cfg isolinux/isolinux.cfg | |
sed -i 's/timeout 600/timeout 10/g' isolinux/isolinux.cfg | |
#genisoimage -o ../custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -v -T -V 'CentOS 7 x86_64' . | |
genisoimage -o ../custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -v -T -V 'centos7custom' . | |
cd .. | |
# gia na bootarei kai apo flasaki | |
isohybrid custom.iso | |
# ama xtypaei sta packages, des /tmp/packaging.log gia WARN h errors | |
# gia passwords: | |
# python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())' | |
# disk detection gia kickstart | |
# https://www.redhat.com/archives/kickstart-list/2012-October/msg00014.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default vesamenu.c32 | |
timeout 10 | |
menu tabmsg Press Tab for full configuration options on menu items. | |
menu separator # insert an empty line | |
menu separator # insert an empty line | |
label autoinstaller | |
menu label autoinstaller | |
menu default | |
kernel vmlinuz | |
# append initrd=initrd.img ip=10.10.10.123 netmask=255.255.255.0 gateway=10.10.10.1 dns=10.10.10.53 ks=http://example.com/ks.cfg | |
# append initrd=initrd.img ks=cdrom:/ks.cfg | |
# append initrd=initrd.img ks=hd:sdb1/ks.cfg | |
append initrd=initrd.img ks=hd:LABEL=centos7custom:/ks.cfg | |
menu separator # insert an empty line | |
label local | |
menu label Boot from ^local drive | |
localboot 0xffff | |
menu separator # insert an empty line | |
menu end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ignoredisk --only-use=disk/by-path/pci-0000:00:1f.2-ata-1.0 | |
repo --name="Saltstack" --baseurl="http://repo.saltstack.com/yum/redhat/7/x86_64/latest/" --install | |
#platform=AMD64 or Intel EM64T | |
#System language | |
lang en_US.UTF-8 | |
#System keyboard | |
keyboard us | |
#System timezone | |
timezone Europe/Athens | |
#Root password "test" | |
# python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())' | |
rootpw --iscrypted $6$LURriz5FT0JqJn2Q$sVdE08JtXuMwxaxZVmRlD2/rS4wLKbORnF7eB.QQxbzpgo.zQ1zUPXzgdesZQUQZCJQBNB0eyJRN.scGeGuUJ0 | |
#Initial user | |
#user user --name "user" --iscrypted --password $6$LURriz5FT0JqJn2Q$sVdE08JtXuMwxaxZVmRlD2/rS4wLKbORnF7eB.QQxbzpgo.zQ1zUPXzgdesZQUQZCJQBNB0eyJRN.scGeGuUJ0 | |
#Reboot after installation | |
reboot --eject | |
#Use text mode install | |
text | |
# SELinux configuration | |
selinux --disabled | |
#Install OS instead of upgrade | |
install | |
#Use CDROM installation media | |
cdrom | |
#System bootloader configuration | |
bootloader --location=mbr | |
# run grub-mkpasswd-pbkdf2: | |
#--password=grub.pbkdf2.sha512.10000.DB7392E61F33FC25D50F44D8F5AC03173800A284B2E02493A6565E7EF474E8B10476CEC1E0802D2FDDA39AEE200536C09434537579C285349B68E935B4EB23ED.6A8ECBD3086E5D6188755024B952A29EC13D96089D0EE82297E42C8BF0A3191C5AE278DD1D61AA81A845C2FD80F904A9A8216E0702130AB9D3E9FBD93B086E0A | |
#Clear the Master Boot Record | |
zerombr | |
#Partition clearing information | |
clearpart --initlabel --all | |
#clearpart --drives=disk/by-path/pci-0000:00:1f.2-ata-1.0 --initlabel --all | |
#clearpart --drives=sda --initlabel --all | |
#Disk partitioning information | |
autopart --type=lvm | |
#System authorization infomation | |
auth --enableshadow --passalgo=sha512 | |
#Network information | |
#network --bootproto=dhcp --device=link --noipv6 --activate | |
network --hostname=myhost.example.net | |
network --bootproto=static --device=link --noipv6 --activate --ip=10.20.30.40 --netmask=255.255.255.0 --gateway=10.20.30.1 --nameserver=10.20.30.53,10.20.30.54 | |
#Firewall configuration | |
firewall --disabled --ssh | |
#Do not configure the X Window System | |
skipx | |
%packages | |
@core | |
chrony | |
%end | |
%post --log=/root/ks-post.log | |
rpm --import https://repo.saltstack.com/yum/redhat/7/x86_64/latest/SALTSTACK-GPG-KEY.pub | |
rpm --import https://repo.saltstack.com/yum/redhat/7/x86_64/latest/base/RPM-GPG-KEY-CentOS-7 | |
yum install -y salt-minion epel-release | |
yum -y update | |
echo "master: 172.16.17.18" >> /etc/salt/minion | |
echo "startup_states: highstate" >> /etc/salt/minion | |
systemctl enable salt-minion.service | |
sed -i 's/\(GRUB_CMDLINE_LINUX=.*\)"/\1 rd.driver.blacklist=nouveau nouveau.modeset=0"/g' /etc/default/grub | |
grub2-mkconfig -o /boot/grub2/grub.cfg | |
echo "blacklist nouveau" > /etc/modprobe.d/nvidia-installer-disable-nouveau.conf | |
echo "options nouveau modeset=0" >> /etc/modprobe.d/nvidia-installer-disable-nouveau.conf | |
%end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment