Linux下的kicstart无人职守脚本安装虚拟机

安装虚拟机脚本

实验环境    1.火墙 selinux关闭 setenforce 0
                    2.配置软件仓库能正常使用
                    3.httpd服务开启


    vim /root/anaconda-ks.cfg(按如下更改)
    openssl    passwd -6    设置密码加密字符

把加密字符写入/root/anaconda-ks.cfg 
    cp /root/anaconda-ks.cfg  /var/www/html/westos.ks
    chmod 644 /var/www/html/westos.ks

 

#version=RHEL8
#ignoredisk --only-use=sda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Reboot after installation
reboot
# Use graphical install
#graphical
text
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8 --addsupport=zh_CN.UTF-8

# Network information
network  --bootproto=dhcp --onboot=on
repo --name="AppStream" --baseurl=http://172.25.254.250/rhel8.2/AppStream
# Use network installation
url --url="http://172.25.254.250/rhel8.2"
# Root password
rootpw --iscrypted $6$hKx3uiCepklshu3r$yGUk4WtNzGdQsQhY71TCaW0tmABnQw9CtK8IbMH54cIDguvUAu5BaW9KwnPxWQ51mkQ1hK13fX/mwYVNHdWZW/
# X Window System configuration information
xconfig  --startxonboot
firstboot --disable
# System services
services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai
# Disk partitioning information
part / --fstype="xfs" --size=1 --grow
part /boot --fstype="xfs" --size=500
part swap --fstype="swap" --size=500

%packages
@^graphical-server-environment
ibus-libpinyin.x86_64

%end

    浏览器查看172.25.254.25/westos.ks


    virt-manager
    添加虚拟机

       设定完硬盘内存大小虚拟机名字后

        Troubleshooting+Tab

        ks=http://172.25.254.25/westos.ks

安装完成

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个可以用于自动安装CentOS7系统的kickstart文件示例: ``` #version=DEVEL # System language lang en_US # Language modules to install langsupport --default=en_US # System keyboard keyboard us # System timezone timezone Asia/Shanghai --isUtc # Root password rootpw --iscrypted $6$y8Ls6SxYJLgU2X9$4XsLjF0HJ8aG5L8XmKZAK5LJmZi/DW3.7q3qXw3m9WdWvTTXw7JhHE8rD1BtOyJdSb9yQ7oRwkZxkLcFh1vP1 # Network information network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=localhost.localdomain # Firewall configuration firewall --disabled # Run the Setup Agent on first boot firstboot --disable # SELinux configuration selinux --disabled # Install OS instead of upgrade install # Use network installation url --url=http://mirrors.aliyun.com/centos/7/os/x86_64/ # Root filesystem partitioning ignoredisk --only-use=sda autopart --type=lvm # System bootloader configuration bootloader --location=mbr --boot-drive=sda # Clear the Master Boot Record zerombr # Do not configure the X Window System skipx # Enable installation of all languages skiplocales # Reboot after installation reboot # Package installation %packages --nobase @core kexec-tools ``` 这个kickstart文件做的事情: 1. 设置系统语言为英文。 2. 安装英文语言支持。 3. 设置键盘为美式英语。 4. 设置时区为亚洲上海,并将其设置为UTC时间。 5. 设置root密码。 6. 配置网络,使用dhcp自动获取IP地址。 7. 禁用防火墙。 8. 禁用SELinux。 9. 安装操作系统。 10. 使用阿里云的CentOS7源进行安装。 11. 使用LVM分区方案。 12. 配置引导程序的安装位置。 13. 清除主引导记录。 14. 不需要安装X Window System。 15. 安装所有语言支持。 16. 安装core和kexec-tools两个包。 17. 安装完成后自动重启系统。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值