# Ubuntu 20.04 QEMU install IBM AIX 7.2
## install QEMU
先安裝以下套件
`apt-get install make ninja-build gcc pkg-config libglib2.0-dev libpixman-1-dev flex bison`
安裝QEMU
```
wget https://download.qemu.org/qemu-8.0.0.tar.xz
tar xvJf qemu-8.0.0.tar.xz
cd qemu-8.0.0
./configure
make
make install
```
查看QEMU版本
`qemu-system-ppc64 -version`
<details><summary>報錯處理詳細內容</summary>
1. ERROR: GNU make (make) not found
`apt-get install make`
2. ERROR: Cannot find Ninja
`apt install ninja-build`
3. ERROR: "cc" either does not exist or does not work
`sudo apt-get install gcc`
4. ERROR: pkg-config binary 'pkg-config' not found
`sudo apt-get install pkg-config`
5. ERROR: glib-2.56 gthread-2.0 is required to compile QEMU
`apt-get install libglib2.0-dev`
6. ERROR: Dependency "pixman-1" not found, tried pkgconfig
`sudo apt-get install libpixman-1-dev`
7. ERROR: Program 'flex' not found or not executable
`sudo apt install flex`
8. ERROR: Program 'bison' not found or not executable
`sudo apt install bison`
</details>
## Install AIX
[AIX 5 or less ISO](https://winworldpc.com/product/aix/51)
[IBM AIX 7.2 TL04 SP02 ISO](https://archive.org/details/aix_7200-04-02-2027_072020)
>本次安裝只有用到1of1 沒有用到1of2
安裝AIX系統參考文件
[QEMU - AIX on x86](https://aix4admins.blogspot.com/2020/04/qemu-aix-on-x86-qemu-quick-emulator-is.html)
[Qemu模拟器运行AIX 7.2 系统](https://www.cnblogs.com/xueyixue/p/13750847.html)
安裝AIX ISO
```
qemu-img create -f qcow2 hdisk0.qcow2 20G
qemu-system-ppc64 -cpu POWER8 -machine pseries -m 2048 -serial stdio -drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom <iso> -prom-env "boot-command=boot cdrom:"
```
在安裝過程中卡很久是正常的,因為他有些參數不會顯示出來,放著就行
出現0c31時,輸入1並按下Enter

再等待一下即可看到AIX的安裝提示
選擇1進行英文安裝界面

途中會有一些配置,依照需求調適即可
>反正我是一直下一步
安裝完後會進行重啟,使用ctrl+c退出,並重新用指令進行啟動
```
qemu-system-ppc64 -cpu POWER8 -machine pseries -m 2048 -serial stdio -drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom <iso> -prom-env "boot-command=boot cdrom:"
```
在畫面上顯示出"Welcome to Base Operating System"時,選擇以下選項
3 (Start Maintenance Mode) --> 1 (Access a Root VG) --> 0 Continue --> 1 (VG on hdisk0) --> 1 (Access this VG and start a shell)
在維護狀態修改fsck64檔案,修復引導問題
```
cd /sbin/helpers/jfs2
> fsck64 -- 刪除該文件的內容
cat >> fsck64<<EOF -- 將內容寫入fsck64 直接vi會有問題
> #!/bin/ksh
> exit 0
> EOF
cat fsck64 -- 確認fsck64內是否有新增寫入進去的兩行
sync ; sync -- write cached memory to disk
halt -- halt AIX
```
修改完後換用以下指令重開虛擬機
```
qemu-system-ppc64 -cpu POWER8 -machine pseries -m 2048 -serial stdio -drive file=hdisk0.qcow2,if=none,id=drive-virtio-disk0 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=drive-virtio-disk0 -cdrom <iso> -prom-env "boot-command=boot disk:"
```
到該介面後,輸入vt100登入AIX系統

接著他會要求同意一些協議等,照著填即可,操縱方式介面有指示
按Tab可切換Yes or No
配置完後即可使用AIX系統
