diff --git a/README.md b/README.md index 7976fa5..ce28404 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ NOTE: Work in progress To install and deploy [CloudStack](https://cloudstack.apache.org), just copy and run the following as `root` user: ```bash -curl -sL https://c8k.in/stall.sh | bash +curl -sL https://raw.githubusercontent.com/Bitsonwheels/cloudstack-installer/refs/heads/main/install.sh | bash ``` Here's how you should really run it though: ```bash -curl -o install.sh https://c8k.in/stall.sh +curl -o install.sh https://raw.githubusercontent.com/Bitsonwheels/cloudstack-installer/refs/heads/main/install.sh cat install.sh | more # to read it bash -x install.sh # to also see what it's doing ``` diff --git a/install.sh b/install.sh index 027de59..3867276 100644 --- a/install.sh +++ b/install.sh @@ -72,7 +72,7 @@ warn "Work in progress, try again while this is being hacked" ### Setup Prerequisites ### info "Installing dependencies" apt-get update -apt-get install -y openssh-server sudo wget jq htop tar nmap bridge-utils +apt-get install -y gpg apparmor openssh-server sudo wget jq htop tar nmap bridge-utils # FIXME: check for host spec (min 4-8G RAM?) /dev/kvm and @@ -84,7 +84,7 @@ setup_bridge() { return fi - interface=$(find /sys/class/net -type l -not -lname '*virtual*' -printf '%f\n' | sort | head -1) + interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1 {split($2,a," ");print a[1]}' | sort | head -1) gateway=$(ip route show 0.0.0.0/0 dev $interface | cut -d ' ' -f 3) hostipandsub=$(ip -4 -br addr show $interface | awk '{ print $3; }' ) info "Setting up bridge on $interface which has IP $hostipandsub and gateway $gateway" @@ -116,7 +116,8 @@ EOF # FIX netplan complaining about permissions chmod 600 /etc/netplan/01-netcfg.yaml - + # FIX "No such file or directory" error + mkdir /etc/cloud/ && mkdir /etc/cloud/cloud.cfg.d/ info "Disabling cloud-init netplan config" rm -f /etc/netplan/50-cloud-init.yaml if [[ ! -f "/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg" && ! -f "/etc/cloud/cloud.cfg.d/99_disable-network-config.cfg" ]]; then @@ -138,10 +139,14 @@ EOF configure_repo() { info "Configuring CloudStack $CS_VERSION repo" + NAME=$(sed -rn 's|^deb\s+\S+\s+(\w+)\s+main.*$|\1|p' /etc/apt/sources.list | head -n 1) + mkdir -p /etc/apt/keyrings + wget -O - https://download.cloudstack.org/release.asc | sudo tee /etc/apt/trusted.gpg.d/cloudstack.asc wget -O- https://download.cloudstack.org/release.asc 2>/dev/null | gpg --dearmor | sudo tee /etc/apt/keyrings/cloudstack.gpg > /dev/null # NOTE: debian-based distro packages are now release agnostic - echo deb [signed-by=/etc/apt/keyrings/cloudstack.gpg] https://download.cloudstack.org/ubuntu noble $CS_VERSION > /etc/apt/sources.list.d/cloudstack.list + echo deb [signed-by=/etc/apt/keyrings/cloudstack.gpg] https://download.cloudstack.org/ubuntu $NAME $CS_VERSION > /etc/apt/sources.list.d/cloudstack.list + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3D62B837F100E758 apt-get update } @@ -222,8 +227,8 @@ configure_host() { # Ubuntu: disable apparmor ln -sf /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/ ln -sf /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper /etc/apparmor.d/disable/ - apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd - apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper + apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd --subdomainfs + apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper --subdomainfs fi if ! kvm-ok; then