Hugo Future Imperfect Slim

Tech Notes

Linux,MAC,Docker,Kubernetes,
CloudStack,AWS,GCP,AZURE,
Raspberrypi,VMWARE,GO,BOOKS,
NETFLIX,Movies,Seasons

3-Minute Read

Building cloudstack on Mac os

Apache CloudStack is open source software designed to deploy and manage large networks of virtual machines, as a highly available, highly scalable Infrastructure as a Service (IaaS) cloud computing platform. CloudStack is used by a number of service providers to offer public cloud services, and by many companies to provide an on-premises (private) cloud offering, or as part of a hybrid cloud solution.

https://cloudstack.apache.org/ http://docs.cloudstack.apache.org/en/latest/

  1. Install Brew ( package manager)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install git
brew install git 
  1. Install Python and pyenv ( in order to manage multiple python versions)
brew install python
brew install pyenv

Pouplate the .zshrc to

if command -v pyenv 1>/dev/null 2>&1; then
    eval "$(pyenv init -)"
fi

Make sure to install python version 3.8.10 in order to run some sample tests

pyenv versions

pyenv install 3.8.10

pyenv global 3.8.10

check the version of python and python3

python --version
python3 --version
  1. Install java runtime
brew install --cask temurin
brew tap homebrew/cask-versions
sudo softwareupdate --install-rosetta
brew install --cask temurin11

In .zshrc file add the following line

export PATH="/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/bin:${PATH}

Verify the java version

java --version 

❯ java --version
openjdk 11.0.19 2023-04-18
OpenJDK Runtime Environment Temurin-11.0.19+7 (build 11.0.19+7)
OpenJDK 64-Bit Server VM Temurin-11.0.19+7 (build 11.0.19+7, mixed mode)
  1. Install Maven

Download the maven from

https://maven.apache.org/download.cgi


tar -xvf apache-maven-3.9.1-bin.tar.gz
mv apache-maven-3.9.1 /usr/local/bin/

In .zshrc file add the following line

export PATH="/usr/local/bin/apache-maven-3.9.1/bin:${PATH}"
mvn --version

Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: /usr/local/bin/apache-maven-3.9.1
Java version: 11.0.19, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
Default locale: en_IN, platform encoding: UTF-8
OS name: "mac os x", version: "13.2.1", arch: "aarch64", family: "mac"
  1. Install mysql
brew install mysql

vi  /opt/homebrew/etc/my.cnf

sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION"
server_id = 1
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=1000
log-bin=mysql-bin
binlog-format = 'ROW'
# add the following for MySQL 8.x
default-authentication-plugin=mysql_native_password


brew services start mysql
  1. Install the Noredist CloudStack builds requires additional jars

git clone "https://github.com/shapeblue/cloudstack-nonoss
cd cloudstack-nonoss
bash -x install-non-oss.sh
  1. Building Cloudstack and running the maangement server
git clone "https://github.com/apache/cloudstack"

To build specific version of cloudstack 

git checkout 4.17.2 

cd  cloudstack 

To build specific version of cloudstack 
git checkout 4.17.2 

vi .python-version 
3.8.10

mvn clean install -Dnoredist -P developer,systemvm

mvn -Pdeveloper -pl developer -Ddeploydb

Run the management server 

mvn -pl :cloud-client-ui jetty:run -Dnoredist -Djava.net.preferIPv4Stack=true or


mvn -pl :cloud-client-ui jetty:run -Dnoredist -Djava.net.preferIPv4Stack=true-Djdk.net.URLClassPath.disableClassPathURLCheck=true
  1. Building Cloudstack simulator and running it
mvn clean install -Dsimulator -P developer,systemvm
mvn -Pdeveloper -pl developer -Ddeploydb
mvn -Pdeveloper -pl developer -Ddeploydb-simulator
mvn -pl :cloud-client-ui jetty:run -Djava.net.preferIPv4Stack=true -Dsimulator
  1. Running Cloudstack UI
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

nvm install v14

node -v
v14.21.3

npm -v
6.14.18

cd cloudstack/ui

npm install
npm run serve
  1. Deploying resources and running Test
$ pip3 install --upgrade tools/marvin/dist/Marvin-*.tar.gz

$ python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advanced.cfg

$nosetests -v --with-marvin   --marvin-config=setup/dev/advanced.cfg   --with-xunit   --xunit-file=xunit.xml   -a tags=advanced,required_hardware=false   --zone=Sandbox-simulator   --hypervisor=simulator    test/integration/smoke/test_vm_life_cycle.py

Ref Links

https://collabnix.com/how-to-setup-java-on-apple-mac-m1-pro-in-2-minutes/ https://www.digitalocean.com/community/tutorials/install-maven-mac-os https://www.jenv.be/ https://maven.apache.org/download.cgi https://www.digitalocean.com/community/tutorials/install-maven-mac-os https://www.novicedev.com/blog/how-install-mysql-macos-homebrew https://justinwride.medium.com/install-node-and-npm-natively-on-apple-silicon-mac-m1-7432c826389b https://github.com/nvm-sh/nvm#install--update-script

comments powered by Disqus

Recent Posts

Categories

About

I am a Software Engineer at Persistent Systems, working on Cloud Stack Orchestration and various tech related to Cloud Infra, container technology like Docker, Kubernetes