{"id":7454,"date":"2023-02-12T20:54:29","date_gmt":"2023-02-12T20:54:29","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=7454"},"modified":"2023-02-12T20:54:29","modified_gmt":"2023-02-12T20:54:29","slug":"quick-installation-guide-cloudstack-on-virtualbox","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2023\/02\/12\/quick-installation-guide-cloudstack-on-virtualbox\/","title":{"rendered":"Quick Installation Guide Cloudstack on Virtualbox"},"content":{"rendered":"\n<p><strong>Set up VM<\/strong><\/p>\n\n\n\n<p>You will want to create a VM of \u201cRed Hat (64-bit)\u201d type and 40+GB disk space. The OS will be CentOS 7.9 minimal x86_64 install ISO. Make sure you have allowed enough ram (6G+) and enough CPU cores (3+) for demo purposes.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><strong>Networking<\/strong><\/p>\n\n\n\n<p>You will need to have 1 NIC in your VM, bridged to the NIC of your laptop\/desktop (wifi or wired NIC, doesn\u2019t matter), and optimally to set Adapter Type=\u201dParavirtualized Network (virtio-net)\u201d for somewhat better network performance (Settings of VM, Network section, Adapter1, expand \u201cAdvanced\u201d). <\/p>\n\n\n\n<p>Make sure the NIC on your VM is configured as promiscuous (in VirtualBox, choose \u201cAllow All\u201d or just \u201cAllow VMs\u201d as the Promiscuous Mode), so that it can pass traffic from CloudStack\u2019s system VMs to the gateway. Also, make sure you have allowed enough ram (6G+) and enough CPU cores (3+) for demo purposes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_14-56-56.png\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_14-56-56.png\" alt=\"\" class=\"wp-image-7457\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_14-56-56.png 647w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_14-56-56-300x245.png 300w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/a><\/figure>\n\n\n\n<p>In case you don\u2019t have physical server to \u201cplay with\u201d, you can use e.g. Oracle VirtualBox 6.1+. The requirement is that you enable \u201cEnable Nested VT-x\/AMD-V\u201d as the Extended Feature on the System page of the Settings of the VM. <\/p>\n\n\n\n<p>In Windows, open a command prompt. Go to VirtualBox installation folders:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\ncd &quot;C:\\Program Files\\Oracle\\VirtualBox&quot;\n<\/pre><\/div>\n\n\n<p>Type:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nC:\\Program Files\\Oracle\\VirtualBox&gt;VBoxManage list vms\n&quot;cloud&quot; {232688ac-39be-4fc0-bb63-9fc9e618b7c1}\n<\/pre><\/div>\n\n\n<p>Run the follow for the VM:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nVBoxManage modifyvm &amp;lt;YourVirtualMachineName&gt; --nested-hw-virt on\n<\/pre><\/div>\n\n\n<p> Now the option should be checked.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-01-49.png\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-01-49.png\" alt=\"\" class=\"wp-image-7461\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-01-49.png 647w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-01-49-300x245.png 300w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/a><\/figure>\n\n\n\n<p>Download and Connect a CentOS 7 ISO File.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-11-58.png\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-11-58.png\" alt=\"\" class=\"wp-image-7462\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-11-58.png 647w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-12_15-11-58-300x245.png 300w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/a><\/figure>\n\n\n\n<p>Click OK. Now Start the VM and Install CentOS.<\/p>\n\n\n\n<p>Once this installation is complete, you\u2019ll want to gain access to your server &#8211; through SSH. Verify If Nested Virtualization Is Enabled For VMs.<\/p>\n\n\n\n<p>Run the following command to check if nested feature is enabled or not:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\negrep --color -i &quot;svm|vmx&quot; \/proc\/cpuinfo\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-13_09-09-20.png\"><img loading=\"lazy\" decoding=\"async\" width=\"837\" height=\"98\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-13_09-09-20.png\" alt=\"\" class=\"wp-image-7500\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-13_09-09-20.png 837w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-13_09-09-20-300x35.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/02\/2023-02-13_09-09-20-768x90.png 768w\" sizes=\"auto, (max-width: 837px) 100vw, 837px\" \/><\/a><\/figure>\n\n\n\n<p>If you see \u201cvmx\u201d (Intel-VT technology) or \u201csvm\u201d (AMD-V support) in the output, the virtualbox guest machine can work as a hypervisor and host VMs.<\/p>\n\n\n\n<p>It is always wise to update the system before starting:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum -y upgrade\n<\/pre><\/div>\n\n\n<p><strong>Configuring the network<\/strong><\/p>\n\n\n\n<p>Before going any further, make sure that \u201cbridge-utils\u201d and \u201cnet-tools\u201d are installed and available:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum install bridge-utils net-tools -y\n<\/pre><\/div>\n\n\n<p>Connecting via the console or SSH, you should login as root. We will start by creating the bridge that Cloudstack will use for networking. Create and open \/etc\/sysconfig\/network-scripts\/ifcfg-cloudbr0 and add the following settings:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nnano \/etc\/sysconfig\/network-scripts\/ifcfg-cloudbr0\n<\/pre><\/div>\n\n\n<p>Note<\/p>\n\n\n\n<p>IP Addressing &#8211; Throughout this document we are assuming that you will have a \/24 network for your CloudStack implementation. This can be any RFC 1918 network. However, we are assuming that you will match the machine address for your local system. An example would be if you are using i.e. VirtualBox on your local home network on 192.168.0.0\/24 network &#8211; in this case you can use a single free IP address from your home range (VirtualBox NIC for this VM should be in bridged mode for correct functioning)<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDEVICE=cloudbr0\nTYPE=Bridge\nONBOOT=yes\nBOOTPROTO=static\nIPV6INIT=no\nIPV6_AUTOCONF=no\nDELAY=5\nIPADDR=192.168.0.11\nGATEWAY=192.168.0.1 #( - this would be your physical\/home router)\nNETMASK=255.255.255.0\nDNS1=8.8.8.8\nDNS2=8.8.4.4\nSTP=yes\nUSERCTL=no\nNM_CONTROLLED=no\n<\/pre><\/div>\n\n\n<p>Save the configuration and exit. We will then edit the NIC so that it makes use of this bridge.<\/p>\n\n\n\n<p>Open the configuration file of your NIC (e.g. \/etc\/sysconfig\/network-scripts\/ifcfg-eth0) and edit it as follows:<\/p>\n\n\n\n<p>Note:Interface name (eth0) used as example only. Replace eth0 with your default ethernet interface name.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nTYPE=Ethernet\nBOOTPROTO=none\nDEFROUTE=yes\nNAME=eth0\nDEVICE=eth0\nONBOOT=yes\nBRIDGE=cloudbr0\n<\/pre><\/div>\n\n\n<p>Now that we have the configuration files properly set up, we need to run a few commands to start up the network:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsystemctl disable NetworkManager\nsystemctl stop NetworkManager\nsystemctl enable network\nreboot\n<\/pre><\/div>\n\n\n<p><strong>Hostname<\/strong><\/p>\n\n\n\n<p>CloudStack requires that the hostname is properly set. If you used the default options in the installation, then your hostname is currently set to localhost.localdomain. To test this we will run:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nhostname --fqdn\n<\/pre><\/div>\n\n\n<p>At this point it will likely return:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlocalhost\n<\/pre><\/div>\n\n\n<p>To rectify this situation &#8211; we\u2019ll set the hostname by editing the \/etc\/hosts file so that it follows a similar format to this example (remember to replace the IP with your IP which might be e.g. 192.168.0.11):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\n::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\n192.168.0.11 srvr1.cloud.priv\n<\/pre><\/div>\n\n\n<p><br>After you\u2019ve modified that file, go ahead and restart the network using:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsystemctl restart network\n<\/pre><\/div>\n\n\n<p>Ensure that it returns a FQDN response.<\/p>\n\n\n\n<p><strong>SELinux<\/strong><\/p>\n\n\n\n<p>At the moment, for CloudStack to work properly SELinux must be set to permissive or disabled. We want to both configure this for future boots and modify it in the current running system.<\/p>\n\n\n\n<p>To configure SELinux to be permissive in the running system we need to run the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsetenforce 0\n<\/pre><\/div>\n\n\n<p>To ensure that it remains in that state we need to configure the file \/etc\/selinux\/config to reflect the permissive state, as shown in this example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# This file controls the state of SELinux on the system.\n# SELINUX= can take one of these three values:\n# enforcing - SELinux security policy is enforced.\n# permissive - SELinux prints warnings instead of enforcing.\n# disabled - No SELinux policy is loaded.\nSELINUX=permissive\n# SELINUXTYPE= can take one of these two values:\n# targeted - Targeted processes are protected,\n# mls - Multi Level Security protection.\nSELINUXTYPE=targeted\n<\/pre><\/div>\n\n\n<p><strong>NTP<\/strong><\/p>\n\n\n\n<p>NTP configuration is a necessity for keeping all of the clocks in your cloud servers in sync. However, NTP is not installed by default. So we\u2019ll install and and configure NTP at this stage. Installation is accomplished as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum -y install ntp\n<\/pre><\/div>\n\n\n<p>The actual default configuration is fine for our purposes, so we merely need to enable it and set it to start on boot as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsystemctl enable ntpd \nsystemctl start ntpd\n<\/pre><\/div>\n\n\n<p>To add the CloudStack repository, create \/etc\/yum.repos.d\/cloudstack.repo and insert the following information.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n&#x5B;cloudstack]\nname=cloudstack\nbaseurl=http:\/\/download.cloudstack.org\/centos\/$releasever\/4.17\/\nenabled=1\ngpgcheck=0\n<\/pre><\/div>\n\n\n<p><br>NFS<\/p>\n\n\n\n<p>Our configuration is going to use NFS for both primary and secondary storage. We are going to go ahead and setup two NFS shares for those purposes. We\u2019ll start out by installing nfs-utils.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum -y install nfs-utils\n<\/pre><\/div>\n\n\n<p>We now need to configure NFS to serve up two different shares. This is handled in the \/etc\/exports file. You should ensure that it has the following content:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/export\/secondary *(rw,async,no_root_squash,no_subtree_check)\n\/export\/primary *(rw,async,no_root_squash,no_subtree_check)\n<\/pre><\/div>\n\n\n<p>You will note that we specified two directories that don\u2019t exist (yet) on the system. We\u2019ll go ahead and create those directories and set permissions appropriately on them with the following commands:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmkdir -p \/export\/primary\nmkdir \/export\/secondary\n<\/pre><\/div>\n\n\n<p>CentOS 7.x releases use NFSv4 by default. NFSv4 requires that domain setting matches on all clients. In our case, the domain is cloud.priv, so ensure that the domain setting in \/etc\/idmapd.conf is uncommented and set as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nDomain = cloud.priv\n<\/pre><\/div>\n\n\n<p>Now you\u2019ll need to add the configuration values at the bottom in the file \/etc\/sysconfig\/nfs (or merely uncomment and set them)<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nLOCKD_TCPPORT=32803\nLOCKD_UDPPORT=32769\nMOUNTD_PORT=892\nRQUOTAD_PORT=875\nSTATD_PORT=662\nSTATD_OUTGOING_PORT=2020\n<\/pre><\/div>\n\n\n<p>For simplicity, we need to disable the firewall, so that it will not block connections. To do so, simply use the following two commands:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsystemctl stop firewalld\nsystemctl disable firewalld\n<\/pre><\/div>\n\n\n<p>We now need to configure the nfs service to start on boot and actually start it on the host by executing the following commands:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsystemctl enable rpcbind\nsystemctl enable nfs\nsystemctl start rpcbind\nsystemctl start nfs\n<\/pre><\/div>\n\n\n<p><strong>Management Server Installation<\/strong><\/p>\n\n\n\n<p>We\u2019re going to install the CloudStack management server and surrounding tools.<\/p>\n\n\n\n<p><strong>Database Installation and Configuration<\/strong><\/p>\n\n\n\n<p>We\u2019ll start with installing MySQL and configuring some options to ensure it runs well with CloudStack.<\/p>\n\n\n\n<p>First, as CentOS 7 no longer provides the MySQL binaries, we need to add a MySQL community repository, that will provide MySQL Server (and the Python MySQL connector later) :<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum -y install wget\nwget http:\/\/repo.mysql.com\/mysql-community-release-el7-5.noarch.rpm\nrpm -ivh mysql-community-release-el7-5.noarch.rpm\n<\/pre><\/div>\n\n\n<p>Install by running the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum -y install mysql-server\n<\/pre><\/div>\n\n\n<p>This should install MySQL 5.x, as of the time of writing this guide. With MySQL now installed we need to make a few configuration changes to \/etc\/my.cnf. Specifically we need to add the following options to the [mysqld] section:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ninnodb_rollback_on_timeout=1\ninnodb_lock_wait_timeout=600\nmax_connections=350\nlog-bin=mysql-bin\nbinlog-format = &#039;ROW&#039;\n<\/pre><\/div>\n\n\n<p>Now that MySQL is properly configured we can start it and configure it to start on boot as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsystemctl enable mysqld\nsystemctl start mysqld\n<\/pre><\/div>\n\n\n<p>MySQL Connector Installation<\/p>\n\n\n\n<p>Install Python MySQL connector from the MySQL community repository (which we\u2019ve added previously):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum -y install mysql-connector-python\n<\/pre><\/div>\n\n\n<p><strong>Installation<\/strong><\/p>\n\n\n\n<p>We are now going to install the management server. We do that by executing the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum -y install cloudstack-management\n<\/pre><\/div>\n\n\n<p>CloudStack 4.17 requires Java 11 JRE. Installing the management server will automatically install Java 11, but it\u2019s good to explicitly confirm that the Java 11 is the selected\/active one (in case you had a previous Java version already installed):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ alternatives --config java\n<\/pre><\/div>\n\n\n<p>Make sure that Java 11 is the chosen one.<\/p>\n\n\n\n<p>With the application itself installed we can now setup the database, we\u2019ll do that with the following command and options:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncloudstack-setup-databases cloud:password@localhost --deploy-as=root\n<\/pre><\/div>\n\n\n<p>When this process is finished, you should see a message like \u201cCloudStack has successfully initialized the database.\u201d<\/p>\n\n\n\n<p>Now that the database has been created, we can take the final step in setting up the management server by issuing the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncloudstack-setup-management\n<\/pre><\/div>\n\n\n<p>System Template Setup<\/p>\n\n\n\n<p>CloudStack uses a number of system VMs to provide functionality for accessing the console of virtual machines, providing various networking services, and managing various aspects of storage.<\/p>\n\n\n\n<p>We need to download the systemVM template and deploy that to the secondary storage. We will use the local path (\/export\/secondary) since we are already on the NFS server itself, but otherwise you would need to mount your Secondary Storage to a temporary mount point, and use that mount point instead of the \/export\/secondary path.<\/p>\n\n\n\n<p>Execute:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/usr\/share\/cloudstack-common\/scripts\/storage\/secondary\/cloud-install-sys-tmplt -m \/export\/secondary -u http:\/\/download.cloudstack.org\/systemvm\/4.17\/systemvmtemplate-4.17.2-kvm.qcow2.bz2 -h kvm -F\n<\/pre><\/div>\n\n\n<p>That concludes our setup of the management server. We still need to configure CloudStack, but we will do that after we get our hypervisor set up.<\/p>\n\n\n\n<p><strong>KVM Installation<\/strong><\/p>\n\n\n\n<p>Installation of the KVM agent is trivial with just a single command, but afterwards we\u2019ll need to configure a few things. We need to install the EPEL repository also.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum -y install epel-release\nyum -y install cloudstack-agent\n<\/pre><\/div>\n\n\n<p><strong>KVM Configuration<\/strong><\/p>\n\n\n\n<p>We have two different parts of KVM to configure, libvirt, and QEMU.<\/p>\n\n\n\n<p><strong>QEMU Configuration<\/strong><\/p>\n\n\n\n<p>We need to edit the QEMU VNC configuration. This is done by editing \/etc\/libvirt\/qemu.conf and ensuring the following line is present and uncommented.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nvnc_listen=0.0.0.0\n<\/pre><\/div>\n\n\n<p><strong>Libvirt Configuration<\/strong><\/p>\n\n\n\n<p>CloudStack uses libvirt for managing virtual machines. Therefore it is vital that libvirt is configured correctly. Libvirt is a dependency of cloud-agent and should already be installed.<\/p>\n\n\n\n<p>Even though we are using a single host, the following steps are recommended to get faimilar with the general requirements. In order to have live migration working libvirt has to listen for unsecured TCP connections. We also need to turn off libvirts attempt to use Multicast DNS advertising. Both of these settings are in \/etc\/libvirt\/libvirtd.conf<\/p>\n\n\n\n<p>Set the following parameter&#8217;s:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nlisten_tls = 0\nlisten_tcp = 1\ntcp_port = &quot;16509&quot;\nauth_tcp = &quot;none&quot;\nmdns_adv = 0\n<\/pre><\/div>\n\n\n<p>Turning on \u201clisten_tcp\u201d in libvirtd.conf is not enough, we have to change the parameters as well we also need to modify \/etc\/sysconfig\/libvirtd:<\/p>\n\n\n\n<p>Uncomment the following line:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nLIBVIRTD_ARGS=&quot;--listen&quot;\n<\/pre><\/div>\n\n\n<p>Restart libvirt<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsystemctl restart libvirtd\n<\/pre><\/div>\n\n\n<p><strong>KVM configuration complete<\/strong><\/p>\n\n\n\n<p>For the sake of completeness, you should check if KVM is running OK on your machine (you should see kvm_intel or kvm_amd modules shown as loaded):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlsmod | grep kvm\nkvm_intel 55496 0\nkvm 337772 1 kvm_intel\nkvm_amd # if you are in AMD cpu\n<\/pre><\/div>\n\n\n<p>That concludes our installation and configuration of KVM, and we\u2019ll now move to using the CloudStack UI for the actual configuration of our cloud.<\/p>\n\n\n\n<p><strong>Configuration<br>UI Access<\/strong><br>To get access to CloudStack\u2019s web interface, merely point your browser to the IP address of your machine e.g. http:\/\/192.168.0.11:8080\/client The default username is \u2018admin\u2019, and the default password is \u2018password\u2019.<\/p>\n\n\n\n<p><strong>Setting up a Zone<\/strong><\/p>\n\n\n\n<p><strong>Zone Type<\/strong><br>A zone is the largest organization entity in CloudStack &#8211; and we\u2019ll be creating one.<\/p>\n\n\n\n<p><strong>Warning<\/strong>:<\/p>\n\n\n\n<p>We will be configuring an Advanced Zone in a way that will allow us to access both the \u201cManagement\u201d network of the cloud as well as the \u201cPublic\u201d network &#8211; we will do so by using the same CIDR (but different part of it, i.e. different IP ranges) for both \u201cManagement\u201d (Pod) and \u201cPublic\u201d networks &#8211; which is something your would NEVER do in a production &#8211; this is done strictly for testing purposes only in this guide!<\/p>\n\n\n\n<p>Click \u201cContinue with Installation\u201d to continue &#8211; you will be offered to change your root admin password &#8211; please do so, and click on OK.<\/p>\n\n\n\n<p>A new Zone wizard will pop-up. Please chose Advanced (don\u2019t tick the \u201cSecurity Groups\u201d) and click on Next.<\/p>\n\n\n\n<p><strong>Zone Details<\/strong><\/p>\n\n\n\n<p>On this page, we enter where our DNS servers are located. CloudStack distinguishes between internal and public DNS. Internal DNS is assumed to be capable of resolving internal-only hostnames, such as your NFS server\u2019s DNS name. Public DNS is provided to the guest VMs to resolve public IP addresses. You can enter the same DNS server for both types, but if you do so, you must make sure that both internal and public IP addresses can route to the DNS server. In our specific case we will not use any names for resources internally, and we will indeed set them to look to the same external resource so as to not add a namerserver setup to our list of requirements.<\/p>\n\n\n\n<p>Name &#8211; we will set this to the ever-descriptive &#8220;Zone1&#8221; for our cloud.<br>IPv4 DNS 1 &#8211; we will set this to 8.8.8.8 for our cloud.<br>IPV4 DNS 2 &#8211; we will set this to 8.8.4.4 for our cloud.<br>Internal DNS1 &#8211; we will also set this to 8.8.8.8 for our cloud.<br>Internal DNS2 &#8211; we will also set this to 8.8.4.4 for our cloud.<br>Hypervisor &#8211; this will be the primary hypervisor used in this zone. In our case, we will select KVM.<br>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Physical Network<\/strong><\/p>\n\n\n\n<p>There are various network isolation methods supported by Cloudstack. The default VLAN option will be sufficient for our purposes. For improved performance and\/or security, Cloudstack allows different traffic types to run over specifically dedicated network interface cards attached to hypervisors. We will not be making any changes here, the default settings are fine for this demo installation of Cloudstack.<\/p>\n\n\n\n<p>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Public Traffic<\/strong><\/p>\n\n\n\n<p>Publicly-accessible IPs must be allocated for this purpose in normal\/public cloud installations, but since we are deploying merely a demo\/test env, we will use a PART of our local network (e.g. from .11 to .20 or other free range)<\/p>\n\n\n\n<p>Gateway &#8211; We\u2019ll use 192.168.0.1 #or whatever is your physical gateway <br>Netmask &#8211; We\u2019ll use 255.255.255.0<br>VLAN\/VNI &#8211; We\u2019ll leave this one empty<br>Start IP &#8211; We\u2019ll use 192.168.0.11<br>End IP &#8211; We\u2019ll use 192.168.0.20<br>Click \u201cAdd\u201d to add the range.<\/p>\n\n\n\n<p>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Pod Configuration<\/strong><\/p>\n\n\n\n<p>Here we will configure a range for Cloudstack\u2019s internal management traffic &#8211; CloudStack will assign IPs from this range to system VMs. This will also be part of our local network (i.e. different part of your local home network, from .21 to .30), with the rest of the IP parameters (netmaks\/gateway) being the same as used for the Public Traffic.<\/p>\n\n\n\n<p>Pod Name &#8211; We\u2019ll use Pod1 for our cloud.<br>Reserved system gateway &#8211; we\u2019ll use 192.168.0.1<br>Reserved system netmask &#8211; we\u2019ll use 255.255.255.0<br>Start reserved system IPs &#8211; we will use 192.168.0.21<br>End Reserved system IP &#8211; we will use 192.168.0.30<br>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Guest Traffic<\/strong><\/p>\n\n\n\n<p>Next we will configure a range of VLAN IDs for our guest VMs.<\/p>\n\n\n\n<p>A range of 100 &#8211; 200 would suffice.<\/p>\n\n\n\n<p>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Cluster<\/strong><\/p>\n\n\n\n<p>Multiple clusters can belong to a pod and multiple hosts can belong to a cluster. We will have one cluster and we have to give our cluster a name.<\/p>\n\n\n\n<p>Enter Cluster1<\/p>\n\n\n\n<p>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Host<\/strong><\/p>\n\n\n\n<p>This is where we specify the details of our hypervisor host. In our case, we are running the management server on the same machine that we will be using as a hypervisor.<\/p>\n\n\n\n<p>Hostname &#8211; we\u2019ll use the IP address 192.168.0.11 since we didn\u2019t set up a DNS server for name resolution. (this is your local server, so swap with the correct IP)<br>Username &#8211; we\u2019ll use root<br>Password &#8211; enter the operating system password for the root user<br>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Primary Storage<\/strong><\/p>\n\n\n\n<p>With your cluster now setup &#8211; you should be prompted for primary storage information. Enter the following values in the fields:<\/p>\n\n\n\n<p>Name &#8211; We\u2019ll use Primary1<br>Scope &#8211; We\u2019ll use Cluster even though either is fine in this case. With \u201cZone\u201d scope, all hosts in all clusters would have access to this storage pool.<br>Protocol &#8211; We\u2019ll use NFS<br>Server &#8211; We\u2019ll be using the IP address 192.168.0.11 (this is your local server, so swap with the correct IP)<br>Path &#8211; Well define \/export\/primary as the path we are using<br>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p><strong>Secondary Storage<\/strong><\/p>\n\n\n\n<p>You\u2019ll be prompted for secondary storage information &#8211; populate it as follows:<\/p>\n\n\n\n<p>Provider &#8211; Choose NFS<br>Name &#8211; Secondary1<br>NFS server &#8211; We\u2019ll use the IP address 192.168.0.11 (this is your local server, so swap with the correct IP)<br>Path &#8211; We\u2019ll use \/export\/secondary<br>Click \u201cNext\u201d to continue.<\/p>\n\n\n\n<p>Now, click \u201cLaunch Zone\u201d and your cloud should begin setup &#8211; it may take several minutes for setup to finalize.<\/p>\n\n\n\n<p>When done, click on \u201cEnable Zone\u201d and your zone will be ready.<\/p>\n\n\n\n<p>That\u2019s it, you are done with installation of your Apache CloudStack demo cloud.<\/p>\n\n\n\n<p>To check the health of your CloudStack installation, go to Infrastructure \u2013&gt; System VMs and refresh the UI from time to time &#8211; you should see \u201cS-1-VM\u201d and \u201cV-2-VM\u201d system VMs (SSVM and CPVM) in State=Running and Agent State=Up.<\/p>\n\n\n\n<p>After that you can go to Images \u2013&gt; Templates, click on the built-in template named \u201cCentOS 5.5(64-bit) no GUI (KVM)\u201d, then click on \u201cZones\u201d tab &#8211; and observe how the Status is moving from a few percent&#8217;s downloaded up to fully downloaded, after which the Status will show as \u201cDownload Complete\u201d and \u201cReady\u201d column will say \u201cYes\u201d. <\/p>\n\n\n\n<p>After this is done, you will be able to deploy a VM from this template.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Set up VM You will want to create a VM of \u201cRed Hat (64-bit)\u201d type and 40+GB disk space. The OS will be CentOS 7.9 minimal x86_64 install ISO. Make sure you have allowed enough ram (6G+) and enough CPU cores (3+) for demo purposes.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-7454","post","type-post","status-publish","format-standard","hentry","category-cloudstack"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/7454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=7454"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/7454\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=7454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=7454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=7454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}