Apache CloudStack Deployment on Ubuntu Server

From WikiMLT

OS Prepa­ra­tion

echo deb http://download.cloudstack.org/ubuntu focal 4.15 | sudo tee -a /etc/apt/sources.list.d/cloudstack.list
wget -O - http://download.cloudstack.org/release.asc | sudo apt-key add -
sudo apt update
sudo update-alternatives --config java
# 0   /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111   auto mode

In­stall the Man­age­ment Serv­er

sudo apt install cloudstack-management cloudstack-agent cloudstack-usage
sudo systemctl stop cloudstack-agent.service cloudstack-management.service cloudstack-usage.service
sudo nano /etc/mysql/mysql.conf.d/cloudstack.cnf  # cat /etc/mysql/mysql.conf.d/cloudstack.cnf
#Out­put
[mysqld]
server-id=1
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION"
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=1000
log-bin=mysql-bin
binlog-format = 'ROW'
default-authentication-plugin=mysql_native_password
sudo systemctl restart mysql.service
sudo cloudstack-setup-databases cloudStackUser:'secret007@CL0Ud'@localhost \
--deploy-as=root -m 'secret007' -k 'secret007' -i 127.0.0.1
#Out­put
Mysql user name:cloudStackUser                                                  [ OK ]
Mysql user password:******                                                      [ OK ]
Mysql server ip:localhost                                                       [ OK ]
Mysql server port:3306                                                          [ OK ]
Mysql root user name:root                                                       [ OK ]
Mysql root user password:******                                                 [ OK ]
Using specified cluster management server node IP 127.0.0.1                     [ OK ]
Checking Cloud database files ...                                               [ OK ]
Checking local machine hostname ...                                             [ OK ]
Checking SELinux setup ...                                                      [ OK ]
Preparing /etc/cloudstack/management/db.properties                              [ OK ]
Applying /usr/share/cloudstack-management/setup/create-database.sql             [ OK ]
Applying /usr/share/cloudstack-management/setup/create-schema.sql               [ OK ]
Applying /usr/share/cloudstack-management/setup/create-database-premium.sql     [ OK ]
Applying /usr/share/cloudstack-management/setup/create-schema-premium.sql       [ OK ]
Applying /usr/share/cloudstack-management/setup/server-setup.sql                [ OK ]
Applying /usr/share/cloudstack-management/setup/templates.sql                   [ OK ]
Processing encryption ...                                                       [ OK ]
Finalizing setup ...                                                            [ OK ]

CloudStack has successfully initialized database, you can check your database configuration in /etc/cloudstack/management/db.properties
sudo cloudstack-setup-management
#Out­put
Starting to configure CloudStack Management Server:
Configure CloudStack Management Server ...[OK]
CloudStack Management Server setup is Done!
Please ensure the following ports are open for the management server to function properly:
8080 8250 8443 9090

Pre­pare the Sys­tem VM Tem­plate

sudo mkdir /mnt/vm-data-256GB/secondary /mnt/vm-data-256GB/primary
cd ~/Downloads
wget http://download.cloudstack.org/systemvm/4.15/systemvmtemplate-4.15.0-kvm.qcow2.bz2
sudo /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
-m /mnt/vm-data-256GB/secondary -f systemvmtemplate-4.15.0-kvm.qcow2.bz2 \
-h kvm -o localhost -r cloudStackUser -d 'secret007@CL0Ud' -s 'secret007'
#Out­put
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
Uncompressing to /usr/share/cloudstack-common/scripts/storage/secondary/65552f61-5ba7-4f6b-8f53-f2b25a6df676.qcow2.tmp (type bz2)...could take a long time
Moving to /mnt/vm-data-256GB/secondary/template/tmpl/1/3///65552f61-5ba7-4f6b-8f53-f2b25a6df676.qcow2...could take a while
Successfully installed system VM template systemvmtemplate-4.15.0-kvm.qcow2.bz2 and template.properties to /mnt/vm-data-256GB/secondary/template/tmpl/1/3/

Run 'cloud­stack-set­up-man­age­ment'

# change the default port from 8080 to 8081
sudo nano /etc/cloudstack/management/server.properties
# open the port
sudo iptables -I INPUT 16 -p tcp -m tcp --dport 8081 -j ACCEPT
# run the management server
cloudstack-setup-managemen

Con­clu­sion

Ме­на­дже­рът тръг­ва, но има още мно­го ра­бо­та да се свър­ши по кон­фи­гу­ри­ра­не­то. Ка­то напри­мер да се наст­рои Зо­на . За мо­мен­та про­ек­та е спрян и всич­ко напра­ве­но до тук е раз­чис­те­но чрез след­ни­те ко­ман­ди.

sudo apt remove --purge cloudstack-management cloudstack-agent cloudstack-usage
sudo rm -R /var/log/cloudstack/usage /var/log/cloudstack/management /var/lib/cloudstack/management 
sudo rm -R /etc/cloudstack/management /var/log/cloudstack/agent /usr/share/cloudstack-agent /etc/cloudstack
sudo rm -R /usr/share/cloudstack-common /mnt/vm-data-256GB/primary /mnt/vm-data-256GB/secondary
update
sudo rm /etc/apt/sources.list.d/cloudstack.list