Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add centos9 , fedora 35, replace centos8 with almalinux8 #75

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .kivrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
#MACADDRESS=

# Timezone
#TIMEZONE=US/Eastern
# TIMEZONE=US/Eastern
TIMEZONE=Asia/Singapore

# User
#ADDITIONAL_USER=${USER}
Expand Down
74 changes: 68 additions & 6 deletions kvm-install-vm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ function usage_subcommand ()
printf "DISTRIBUTIONS\n"
printf " NAME DESCRIPTION LOGIN\n"
printf " amazon2 Amazon Linux 2 ec2-user\n"
printf " almalinux almalinux almalinux 8\n"
printf " centos9 CentOS 9 centos\n"
printf " centos8 CentOS 8 centos\n"
printf " centos7 CentOS 7 centos\n"
printf " centos7-atomic CentOS 7 Atomic Host centos\n"
Expand All @@ -83,10 +85,14 @@ function usage_subcommand ()
printf " fedora31 Fedora 31 fedora\n"
printf " fedora32 Fedora 32 fedora\n"
printf " fedora33 Fedora 33 fedora\n"
printf " fedora34 Fedora 34 fedora\n"
printf " fedora35 Fedora 35 workstaion fedora\n"
printf " fedora36 Fedora 36 workstation fedora\n"
printf " opensuse15 OpenSUSE Leap 15.2 opensuse\n"
printf " ubuntu1604 Ubuntu 16.04 LTS (Xenial Xerus) ubuntu\n"
printf " ubuntu1804 Ubuntu 18.04 LTS (Bionic Beaver) ubuntu\n"
printf " ubuntu2004 Ubuntu 20.04 LTS (Focal Fossa) ubuntu\n"
printf " rocky8.5 Rocky Linux rocky\n"
printf "\n"
printf "EXAMPLES\n"
printf " $prog create foo\n"
Expand Down Expand Up @@ -300,7 +306,24 @@ function fetch_images ()
DISK_FORMAT=qcow2
LOGIN_USER=ec2-user
;;
centos8)
almalinux8)
QCOW=AlmaLinux-8-GenericCloud-latest.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="almalinux8"
# IMAGE_URL=http://mirror.netglobalis.net/almalinux/8.5/cloud/x86_64/images/
IMAGE_URL=http://mirrors.nju.edu.cn/almalinux/8.5/cloud/x86_64/images/
DISK_FORMAT=qcow2
LOGIN_USER=centos
;;
centos9)
QCOW=CentOS-Stream-GenericCloud-9-20210830.0.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="centos9"
IMAGE_URL=https://cloud.centos.org/centos/9-stream/x86_64/images/
DISK_FORMAT=qcow2
LOGIN_USER=centos
;;
centos8)
QCOW=CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="centos8"
Expand Down Expand Up @@ -373,15 +396,15 @@ function fetch_images ()
DISK_FORMAT=qcow2
LOGIN_USER=fedora
;;
fedora30)
fedora30)
QCOW=Fedora-Cloud-Base-30-1.2.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="fedora29"
IMAGE_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/30/Cloud/x86_64/images
DISK_FORMAT=qcow2
LOGIN_USER=fedora
;;
fedora31)
fedora31)
QCOW=Fedora-Cloud-Base-31-1.9.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="fedora31"
Expand All @@ -397,14 +420,38 @@ function fetch_images ()
DISK_FORMAT=qcow2
LOGIN_USER=fedora
;;
fedora33)
fedora33)
QCOW=Fedora-Cloud-Base-33-1.2.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="fedora33"
IMAGE_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images
DISK_FORMAT=qcow2
LOGIN_USER=fedora
;;
fedora34)
QCOW=Fedora-Cloud-Base-34-1.2.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="fedora34"
IMAGE_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/34/Cloud/x86_64/images
DISK_FORMAT=qcow2
LOGIN_USER=fedora
;;
fedora35)
QCOW=Fedora-Cloud-Base-35-1.2.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="fedora35"
IMAGE_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_64/images
DISK_FORMAT=qcow2
LOGIN_USER=fedora
;;
fedora36)
QCOW=Fedora-Cloud-Base-36-1.5.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="fedora36"
IMAGE_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/36/Cloud/x86_64/images
DISK_FORMAT=qcow2
LOGIN_USER=fedora
;;
ubuntu1604)
QCOW=ubuntu-16.04-server-cloudimg-amd64-disk1.img
OS_TYPE="linux"
Expand Down Expand Up @@ -437,6 +484,14 @@ function fetch_images ()
DISK_FORMAT=qcow2
LOGIN_USER=opensuse
;;
rocky85)
QCOW=Rocky-8-GenericCloud-8.5-20211114.2.x86_64.qcow2
OS_TYPE="linux"
OS_VARIANT="rocky8.5"
IMAGE_URL=https://dl.rockylinux.org/pub/rocky/8.5/images
DISK_FORMAT=qcow2
LOGIN_USER=rocky
;;
*)
die "${DISTRO} not a supported OS. Run 'kvm-install-vm create help'."
;;
Expand Down Expand Up @@ -517,7 +572,7 @@ function storpool_exists ()
function set_sudo_group ()
{
case "${DISTRO}" in
centos?|fedora??|*-atomic|amazon?|opensuse* )
centos*|fedora*|rocky*|*-atomic|amazon?|opensuse* )
SUDOGROUP="wheel"
;;
ubuntu*|debian* )
Expand All @@ -535,7 +590,7 @@ function set_cloud_init_remove ()
centos6 )
CLOUDINITDISABLE="chkconfig cloud-init off"
;;
centos8|centos7|amazon?|fedora??|ubuntu*|debian*|opensuse* )
centos9|centos8|centos7|amazon*|fedora*|rocky*|ubuntu*|debian*|opensuse* )
CLOUDINITDISABLE="systemctl disable cloud-init.service"
;;
*-atomic)
Expand Down Expand Up @@ -658,6 +713,13 @@ _EOF_
&& ok \
|| die "Could not resize disk."
;;
fedora35|fedora36)
qemu-img create -f qcow2 \
-o preallocation=metadata $DISK.new $DISK_SIZE &>> ${VMNAME}.log \
&& virt-resize --align-first auto --expand /dev/sda5 $DISK $DISK.new &>> ${VMNAME}.log \
&& (mv $DISK.new $DISK && ok) \
|| die "Could not resize disk."
;;
*)
qemu-img create -f qcow2 \
-o preallocation=metadata $DISK.new $DISK_SIZE &>> ${VMNAME}.log \
Expand Down
15 changes: 15 additions & 0 deletions tests/check_distributions.bats
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ function remove_test_vm ()
@test "Delete VM (Fedora 33) - $VMNAME-fedora33" {
remove_test_vm fedora33
}
@test "Install VM (Fedora 34) - $VMNAME-fedora34" {
create_test_vm fedora34
}

@test "Delete VM (Fedora 34) - $VMNAME-fedora34" {
remove_test_vm fedora34
}

@test "Install VM (Fedora 35) - $VMNAME-fedora35" {
create_test_vm fedora34
}

@test "Delete VM (Fedora 35) - $VMNAME-fedora35" {
remove_test_vm fedora34
}

@test "Install VM (Ubuntu 16.04) - $VMNAME-ubuntu1604" {
create_test_vm ubuntu1604
Expand Down
40 changes: 40 additions & 0 deletions tips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# tips
nmcli device
systemctl start libvirtd
systemctl stop libvirtd
systemctl status libvirtd

## fedora 36
./kvm-install-vm create -c 4 -m 5120 -d 30 -T "Asia/Shanghai" -t fedora36 -D fedora36.my -v fedora36.my
./kvm-install-vm create -c 4 -m 1024 -d 25 -T "Asia/Shanghai" -t fedora36 -D fedora36_proxy.my -v fedora36_proxy.my

## fedora 35
./kvm-install-vm create -c 4 -m 5120 -d 60 -T "Asia/Shanghai" -t fedora35 -D fedora35.my -v fedora35.my
./kvm-install-vm create -c 4 -m 5120 -d 50 -T "Asia/Shanghai" -t fedora35 -D fedora35.my -v fedora35.my

## fedora 34
./kvm-install-vm create -c 4 -m 5120 -d 80 -T "Asia/Shanghai" -t fedora34 -D fedora34.my -v fedora34.my
./kvm-install-vm create -c 4 -m 6144 -d 80 -T "Asia/Shanghai" -t fedora34 -D fedora34.my -v fedora34.my

virsh guestinfo fedora34.my
ssh-keygen -R fedora34.my
ssh fedora@fedora34.my

sudo dnf install -y langpacks-zh_CN
sudo localectl set-locale LANG=zh_CN.UTF-8
sudo dnf install -y cinnamon-desktop
sudo dnf -y groupinstall "Development Tools"

### activate sshd(启用sshd)
sudo rpm -qa | grep openssh-server
sudo systemctl status sshd
sudo systemctl enable sshd.service
sudo systemctl start sshd
sudo systemctl status sshd

---
#### no password login ( 无密码 ssh 密钥)
ssh-copy-id -i ~/.ssh/id_rsa.pub fedora@fedora34

### delete vps(删除vps)
./kvm-install-vm remove fedora35.my
14 changes: 14 additions & 0 deletions udo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
● systemd-zram-setup@zram1.service - Create swap on /dev/zram1
Loaded: loaded (]8;;file://fedora/usr/lib/systemd/system/systemd-zram-setup@.service/usr/lib/systemd/system/systemd-zram-setup@.service]8;;; static)
Drop-In: /run/systemd/generator/systemd-zram-setup@zram1.service.d
└─]8;;file://fedora/run/systemd/generator/systemd-zram-setup@zram1.service.d/bindings.confbindings.conf]8;;
Active: active (exited) since Sat 2022-10-29 11:32:43 WITA; 2h 31min ago
Docs: ]8;;man:zram-generator(8)man:zram-generator(8)]8;;
]8;;man:zram-generator.conf(5)man:zram-generator.conf(5)]8;;
Process: 669 ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device zram1 (code=exited, status=0/SUCCESS)
Main PID: 669 (code=exited, status=0/SUCCESS)
CPU: 153ms

10月 29 11:32:43 fedora systemd[1]: Starting systemd-zram-setup@zram1.service - Create swap on /dev/zram1...
10月 29 11:32:43 fedora systemd-makefs[672]: /dev/zram1 successfully formatted as ext2 (label "zram1", uuid cc24b691-90ca-488d-a9d7-aaf8138fcaab)
10月 29 11:32:43 fedora systemd[1]: Finished systemd-zram-setup@zram1.service - Create swap on /dev/zram1.