openEuler 20.03 LTS SP3 Kickstart Automatic Installation on VMware Workstation
Tags: linux
Published: 2022-02-17 13:59:07

## Introduction

As [openEuler](https://www.openeuler.org/en/) also uses [Redhat Anaconda](https://en.wikipedia.org/wiki/Anaconda_(installer)) as its OS installer, we can [use Kickstart for Automatic Installation](https://docs.openeuler.org/en/docs/20.03_LTS_SP3/docs/Installation/using-kickstart-for-automatic-installation.html). However, the guides provided in the previous documentation officially are not straightforward enough for Linux newbies who tend to use virtual machines for installation. So in this blog, I'm going to show you how to perform openEuler 20.03 LTS SP3 Kickstart Automatic Installation on VMware Workstation with only a single ISO file referring to the [CentOS Kickstart Installations Documentation](https://docs.centos.org/en-US/centos/install-guide/Kickstart2/).

## Steps
### Create the Kickstart file
Copy the following code into a file named `ks.cfg` at somewhere on your computer.
```conf
#version=DEVEL
# Use graphical install
graphical


%packages
@^minimal-environment
@standard

%end

# Keyboard layouts
keyboard --xlayouts='cn'
# System language
lang zh_CN.UTF-8

# Network information
network  --bootproto=dhcp --device=ens160 --onboot=off --ipv6=auto --activate
network  --hostname=localhost.localdomain

# Use CDROM installation media
cdrom

# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"

ignoredisk --only-use=nvme0n1
autopart
# Partition clearing information
clearpart --none --initlabel

# System timezone
timezone Asia/Shanghai --utc

# Root password
rootpw openeuler
user --groups=wheel --name=openeuler --password=openeuler --gecos="openEuler"

%addon com_redhat_kdump --disable --reserve-mb='128'

%end

%anaconda
pwpolicy root --minlen=8 --minquality=1 --strict --nochanges --notempty
pwpolicy user --minlen=8 --minquality=1 --strict --nochanges --emptyok
pwpolicy luks --minlen=8 --minquality=1 --strict --nochanges --notempty
%end
```
The above Kickstart file will set Chinese as the default language, and set the root password to `openeuler`, with an additional account name and password both `openeuler`.

If you want to create your own Kickstart file, you can firstly perform a manual installation you would like, after successfully installing and logging into the system, get the generated Kickstart file that corresponds to the manual installation just performed at `/root/anaconda-ks.cfg`, rename it to `ks.cfg`.

### Generate the ISO file
- If you are on Linux, run [mkisofs](https://linux.die.net/man/8/mkisofs) for ISO generation:
```bash
cd <the folder where you store your ks.cfg>
mkisofs -JR -V OEMDRV -o auto-installation.iso ks.cfg
```
![](https://hollowmansblog.files.wordpress.com/2022/02/5.png)
- If you are on Windows, you can use [UltraISO](https://www.ultraiso.com/download.html) for ISO generation:
1. open UltraISO, click on the `New` button, rename the disk into `OEMDRV`.
![](https://hollowmansblog.files.wordpress.com/2022/02/3.png)
2. Press `F3` to add file `ks.cfg` into the ISO, then click on the `Save` button to save the ISO file as `auto-installation.iso`.
![](https://hollowmansblog.files.wordpress.com/2022/02/4.png)

### Configure the Virtual Machine
Please first create the virtual machine on VMware Workstation for openEuler 20.03 LTS SP3. If you don't know how to do this, please refer to the VMware Workstation documentation or related blogs as there're already many tutorials that exist.

1. In the Virtual Machine's tab, click on the `Edit virtual machine settings`.
2. On the prompted `Virtual Machine Settings` window, click on the `Add...` button.
3. On the prompted `Add Hardware Wizard` dialogue, choose `CD/DVD Drive`, click on the `Finish` button.
![](https://hollowmansblog.files.wordpress.com/2022/02/1.png)
4. Then for the newly added CD/DVD Device, choose `Use ISO image file:`, and click on the `Browse...` button to select the ISO file `auto-installation.iso` just created in the last step, finally click on the `OK` button.
![](https://hollowmansblog.files.wordpress.com/2022/02/2.png)

At last, start your virtual machine and enjoy Kickstart automatic installation!