在 KVM 客户机上以文本模式安装 CentOS 8
滚动浏览大量信息和消息后,Anaconda 安装程序将带我们进入主安装菜单。
Starting installer, one moment... anaconda 29.19.0.40-1.el8 for CentOS Linux 8.0.1905 started. * installation log files are stored in /tmp during the installation * shell is available on TTY2 * if the graphical installation interface fails to start, try again with the inst.text bootoption to start text installation * when reporting a bug add logs from /tmp as separate text/plain attachments 10:12:52 Not asking for VNC because we don't have a network ================================================================================ ================================================================================ Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (America/New_York timezone) 3) [!] Installation source 4) [!] Software selection (Processing...) (Processing...) 5) [!] Installation Destination 6) [x] Kdump (No disks selected) (Kdump is enabled) 7) [!] Network configuration 8) [!] Root password (Not connected) (Password is not set.) 9) [!] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' to quit, 'r' to refresh]: 2
语言设置没问题,因此无需更改。
我们输入“2”来设置时间设置。
Time settings Timezone: America/New_York NTP servers:not configured 1) Change timezone 2) Configure NTP servers Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 1
输入“1”以设置时区。
Timezone settings Available regions 1) Europe 5) Antarctica 9) Netherlandsn 2) Asia 6) Pacific 10) Arctic 3) America 7) Australia 11) US 4) Africa 8) Atlantic 12) Etc Please select the timezone. Use numbers or type names directly ['b' back to region list, 'c' to continue, 'q' to quit, 'r' to refresh]: 2
选择我们需要的地区,我们为亚洲选择了“2”。
Timezone settings Available timezones in region Asia 1) Aden 29) Hong_Kong 57) Pyongyang 2) Almaty 30) Hovd 58) Qatar 3) Amman 31) Irkutsk 59) Qostanay 4) Anadyr 32) Jakarta 60) Qyzylorda 5) Aqtau 33) Jayapura 61) Riyadh 6) Aqtobe 34) Jerusalem 62) Sakhalin 7) Ashgabat 35) Kabul 63) Samarkand 8) Atyrau 36) Kamchatka 64) Seoul 9) Baghdad 37) Karachi 65) Shanghai 10) Bahrain 38) Kathmandu 66) Singapore 11) Baku 39) Khandyga 67) Srednekolymsk 12) Bangkok 40) Kolkata 68) Taipei 13) Barnaul 41) Krasnoyarsk 69) Tashkent 14) Beirut 42) Kuala_Lumpur 70) Tbilisi 15) Bishkek 43) Kuching 71) Tehran 16) Brunei 44) Kuwait 72) Thimphu 17) Chita 45) Macau 73) Tokyo 18) Choibalsan 46) Magadan 74) Tomsk 19) Colombo 47) Makassar 75) Ulaanbaatar 20) Damascus 48) Manila 76) Urumqi 21) Dhaka 49) Muscat 77) Ust-Nera 22) Dili 50) Nicosia 78) Vientiane 23) Dubai 51) Novokuznetsk 79) Vladivostok 24) Dushanbe 52) Novosibirsk 80) Yakutsk 25) Famagusta 53) Omsk 81) Yangon 26) Gaza 54) Oral 82) Yekaterinburg 27) Hebron 55) Phnom_Penh 83) Yerevan 28) Ho_Chi_Minh 56) Pontianak Please select the timezone. Use numbers or type names directly ['b' back to region list, 'c' to continue, 'q' to quit, 'r' to refresh]: 37
选择时区,我们为卡拉奇设置了“37”。
时区已设置,我们再次进入主安装菜单。
Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (Asia/Karachi timezone) 3) [x] Installation source 4) [x] Software selection (Local media) (Server with GUI) 5) [!] Installation Destination 6) [x] Kdump (No disks selected) (Kdump is enabled) 7) [ ] Network configuration 8) [!] Root password (Not connected) (Password is not set.) 9) [!] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' to quit, 'r' to refresh]: 4
现在输入“4”以选择软件选择。
Software selection Base environment 1) [x] Server with GUI 4) [ ] Workstation 2) [ ] Server 5) [ ] Custom Operating System 3) [ ] Minimal Install 6) [ ] Virtualization Host Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 3
输入“3”以选择最小安装选项。
Software selection Base environment 1) [ ] Server with GUI 4) [ ] Workstation 2) [ ] Server 5) [ ] Custom Operating System 3) [x] Minimal Install 6) [ ] Virtualization Host Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: c
输入“c”继续下一个软件选择菜单。
Software selection Add-ons for selected environment 1) [ ] Guest Agents 8) [ ] Headless Management 2) [ ] Standard 9) [ ] Network Servers 3) [ ] Legacy UNIX Compatibility 10) [ ] RPM Development Tools 4) [ ] Container Management 11) [ ] Scientific Support 5) [ ] Development Tools 12) [ ] Security Tools 6) [ ] .NET Core Development 13) [ ] Smart Card Support 7) [ ] Graphical Administration Tools 14) [ ] System Tools Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: c
在此处选择可选添加组件并输入“c”以继续进入主菜单。
Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (Asia/Karachi timezone) 3) [!] Installation source 4) [!] Software selection (Processing...) (Processing...) 5) [!] Installation Destination 6) [x] Kdump (No disks selected) (Kdump is enabled) 7) [ ] Network configuration 8) [!] Root password (Not connected) (Password is not set.) 9) [!] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' to quit, 'r' to refresh]: r
安装程序正在处理设置,输入“r”刷新菜单。
Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (Asia/Karachi timezone) 3) [x] Installation source 4) [x] Software selection (Local media) (Minimal Install) 5) [!] Installation Destination 6) [x] Kdump (No disks selected) (Kdump is enabled) 7) [ ] Network configuration 8) [!] Root password (Not connected) (Password is not set.) 9) [!] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' to quit, 'r' to refresh]: 5
输入“5”以配置 Installation Destination 。
Installation Destination 1) [x] : 20 GiB (vda) 1 disk selected; 20 GiB capacity; 20 GiB free ... Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: c
我们只有一张磁盘,它已经被选为安装目的地。
输入“c”以继续分区选项。
Partitioning Options 1) [ ] Replace Existing Linux system(s) 2) [ ] Use All Space 3) [ ] Use Free Space 4) [ ] Manually assign mount points Installation requires partitioning of your hard drive. Select what space to use for the install target or manually assign mount points. Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 2
输入“2”以选择“使用所有空间”选项。
Partitioning Options 1) [ ] Replace Existing Linux system(s) 2) [x] Use All Space 3) [ ] Use Free Space 4) [ ] Manually assign mount points Installation requires partitioning of your hard drive. Select what space to use for the install target or manually assign mount points. Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: c
输入“c”以继续分区方案选项。
Partition Scheme Options 1) [ ] Standard Partition 2) [x] LVM 3) [ ] LVM Thin Provisioning Select a partition scheme configuration. Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: c Generating updated storage configuration Checking storage configuration...
使用默认选项并输入“c”以继续。
Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (Asia/Karachi timezone) 3) [x] Installation source 4) [x] Software selection (Local media) (Minimal Install) 5) [x] Installation Destination 6) [x] Kdump (Automatic partitioning (Kdump is enabled) selected) 7) [ ] Network configuration 8) [!] Root password (Not connected) (Password is not set.) 9) [!] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' to quit, 'r' to refresh]: 6
通过选择选项 '6' 禁用 kdump。
Kdump 1) [x] Enable kdump 2) Reserve amount (0 - 0 MB) auto Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 1
输入“1”以禁用 kdump 。
Kdump 1) [ ] Enable kdump Please make a selection from the above ['c' to continue, 'q' to quit, ' refresh]: c
输入“c”继续主菜单。
Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (Asia/Karachi timezone) 3) [x] Installation source 4) [x] Software selection (Local media) (Minimal Install) 5) [x] Installation Destination 6) [x] Kdump (Automatic partitioning (Kdump is disabled) selected) 7) [ ] Network configuration 8) [!] Root password (Not connected) (Password is not set.) 9) [!] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' 'r' to refresh]: 7
为网络配置输入“7”。
Network configuration Wired (enp1s0) disconnected Host Name: localhost.localdomain Current host name: localhost 1) Set host name 2) Configure device enp1s0 Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 1
通过选择选项 '1' 来设置主机名。
Enter a new value for 'Host Name' and press ENTER: kvm-guest-01.recipes.com
在此处提供所需的 VM 主机名。
Network configuration Wired (enp1s0) disconnected Host Name: kvm-guest-01.recipes.com Current host name: localhost 1) Set host name 2) Configure device enp1s0 Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 2
现在选择选项“2”来配置网络接口。
Device configuration 1) IPv4 address or "dhcp" for DHCP dhcp 2) IPv4 netmask 3) IPv4 gateway 4) IPv6 address[/prefix] or "auto" for automatic, "dhcp" for DHCP, "ignore" to turn off auto 5) IPv6 default gateway 6) Nameservers (comma separated) 7) [ ] Connect automatically after reboot 8) [ ] Apply configuration in installer Configuring device enp1s0. Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 7
选择选项“7”以自动连接网络连接。
Device configuration 1) IPv4 address or "dhcp" for DHCP dhcp 2) IPv4 netmask 3) IPv4 gateway 4) IPv6 address[/prefix] or "auto" for automatic, "dhcp" for DHCP, "ignore" to turn off auto 5) IPv6 default gateway 6) Nameservers (comma separated) 7) [x] Connect automatically after reboot 8) [ ] Apply configuration in installer Configuring device enp1s0. Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: 8
选择选项“8”使更改生效。
Device configuration 1) IPv4 address or "dhcp" for DHCP dhcp 2) IPv4 netmask 3) IPv4 gateway 4) IPv6 address[/prefix] or "auto" for automatic, "dhcp" for DHCP, "ignore" to turn off auto 5) IPv6 default gateway 6) Nameservers (comma separated) 7) [x] Connect automatically after reboot 8) [x] Apply configuration in installer Configuring device enp1s0. Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: c
输入“c”继续到网络配置菜单。
Network configuration Wired (enp1s0) disconnected Host Name: kvm-guest-01.recipes.com Current host name: localhost 1) Set host name 2) Configure device enp1s0 Please make a selection from the above ['c' to continue, 'q' to quit, 'r' to refresh]: c
再次输入“c”以跳至主菜单。
Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (Asia/Karachi timezone) 3) [x] Installation source 4) [x] Software selection (Local media) (Minimal Install) 5) [x] Installation Destination 6) [x] Kdump (Automatic partitioning (Kdump is disabled) selected) 7) [x] Network configuration 8) [!] Root password (Wired (enp1s0) connected) (Password is not set.) 9) [!] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' to quit, 'r' to refresh]: 8
输入'8'设置root密码。
Root password Please select new root password. You will have to type it twice. Password: Password (confirm):
设置密码后,我们会自动跳到主菜单。
Installation 1) [x] Language settings 2) [x] Time settings (English (United States)) (Asia/Karachi timezone) 3) [x] Installation source 4) [x] Software selection (Local media) (Minimal Install) 5) [x] Installation Destination 6) [x] Kdump (Automatic partitioning (Kdump is disabled) selected) 7) [x] Network configuration 8) [x] Root password (Wired (enp1s0) connected) (Password is set.) 9) [ ] User creation (No user will be created) Please make a selection from the above ['b' to begin installation, 'q' to quit, 'r' to refresh]: b
按“b”开始安装。
Progress . Setting up the installation environment . Configuring storage .. Creating disklabel on /dev/vda Creating ext4 on /dev/vda1 Creating lvmpv on /dev/vda2 Creating swap on /dev/mapper/cl-swap Creating xfs on /dev/mapper/cl-root .. Running pre-installation scripts . Discovering realm to join . Running pre-installation tasks ...... Installing. Starting package installation process Downloading packages Preparing transaction from installation source Installing libgcc.x86_64 (1/390) Installing geolite2-country.noarch (2/390) Installing geolite2-city.noarch (3/390) Installing tzdata.noarch (4/390) Installing hwdata.noarch (5/390) Installing xkeyboard-config.noarch (6/390) Installing publicsuffix-list-dafsa.noarch (7/390) Installing pkgconf-m4.noarch (8/390) Installing ncurses-base.noarch (9/390) Installing linux-firmware.noarch (10/390) Installing libreport-filesystem.x86_64 (11/390) Installing dnf-data.noarch (12/390) Installing kbd-misc.noarch (13/390) Installing kbd-legacy.noarch (14/390) Installing firewalld-filesystem.noarch (15/390) Installing dhcp-common.noarch (16/390) Installing dbus-common.noarch (17/390) Installing centos-release.x86_64 (18/390) Installing setup.noarch (19/390) Installing filesystem.x86_64 (20/390) ... Installing iwl4965-firmware.noarch (382/390) Installing iwl3945-firmware.noarch (383/390) Installing iwl3160-firmware.noarch (384/390) Installing iwl2030-firmware.noarch (385/390) Installing iwl2000-firmware.noarch (386/390) Installing iwl135-firmware.noarch (387/390) Installing iwl105-firmware.noarch (388/390) Installing iwl1000-firmware.noarch (389/390) Installing iwl100-firmware.noarch (390/390) Performing post-installation setup tasks Configuring filesystem.x86_64 Configuring kernel-core.x86_64 Configuring authselect-libs.x86_64 Configuring sssd-common.x86_64 Configuring tuned.noarch Configuring microcode_ctl.x86_64 ... Verifying python3-rhnlib.noarch (384/390) Verifying python3-unbound.x86_64 (385/390) Verifying qemu-guest-agent.x86_64 (386/390) Verifying rhn-client-tools.x86_64 (387/390) Verifying rsyslog.x86_64 (388/390) Verifying unbound-libs.x86_64 (389/390) Verifying xkeyboard-config.noarch (390/390) . Configuring storage . Installing boot loader . Performing post-installation setup tasks . Configuring installed system .......... Writing network configuration . Creating users .... Configuring addons Executing org_fedora_oscap addon Executing com_redhat_kdump addon . Generating initramfs . Running post-installation scripts . Storing configuration files and kickstarts .. Installation complete. Press ENTER to quit:
按 <ENTER> 重新启动虚拟机。
CentOS Linux 8 (Core) Kernel 4.18.0-80.el8.x86_64 on an x86_64 kvm-guest-01 login:
重新启动后,它会向我们显示 CentOS 8 登录提示。
按 Ctrl+] 退出 VM 来宾。
我们已经在 KVM 来宾上成功安装了文本模式的 CentOS 8.
创建KVM虚拟机
要创建 CentOS 8 虚拟机,我们需要在 KVM 虚拟化主机上安装 CentOS 8 ISO 文件。
创建一个目录来存储操作系统的 ISO 文件。
[root@kvm-virtualization-01 ~]# mkdir /var/lib/libvirt/iso
使用 WinSCP 将 CentOS 8 ISO 文件传输到 KVM 虚拟化主机。
以 root 用户身份使用 ssh 连接 kvm-virtualization-01.recipes.com。
[root@kvm-virtualization-01 ~]# ls /var/lib/libvirt/iso -alh total 7.0G drwxr-xr-x. 2 root root 80 Dec 30 14:39 . drwxr-xr-x. 10 root root 117 Dec 30 14:20 .. -rw-r--r--. 1 root root 330M Mar 1 2013 CentOS-6.3-x86_64-minimal.iso -rw-r--r--. 1 root root 6.7G Sep 26 03:36 CentOS-8-x86_64-1905-dvd1.iso
使用以下命令创建 CentOS 8 虚拟机。
[root@kvm-virtualization-01 ~]# virt-install --name kvm-guest-01 \ > --memory 512 \ > --vcpus 1 \ > --disk size=20 \ > --os-variant rhel8.0 \ > --location /var/lib/libvirt/iso/CentOS-8-x86_64-1905-dvd1.iso \ > --graphics none \ > --extra-args='console=ttyS0'
将创建一个虚拟机并自动启动 Anaconda 安装程序。