How to make local build DU2 on VM environment

Actions

  1. Create and update the new VM

  2. Prepare environment for creating new zones

  3. Prepare script to get dependencies for components building

  4. Create a zone for local repository

  5. Create the local repository in this zone

  6. Create the new zone for components building

  7. Build components

1. Create and update the new VM

To create the new VM in vSphere SPB-LABS execute please steps 1-5 from this instruction.

2. Login with root account and prepare environment for zones creation

  1. Create the mountpoint for zones mounting:

root@dilos:~# zfs create -o mountpoint=/zones rpool/zones root@dilos:~# mkdir /export/builds

2. Add the admin user:

root@dilos:~# useradd -m -g staff admin root@dilos:~# passwd admin Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@dilos:~# echo "admin ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/admin

3. Execute Instruction for NET configuration till the step of zone01 creation.

4. To automate zone creation you can copy this script to create_zone.sh file or execute the following command:

cat > create_zone.sh <<SCRIPT #!/bin/bash TYPE_ZONE=\$1 IP=\$2 SER=\$3 cat > \${HOME}/\${TYPE_ZONE}.cmd <<EOT create set zonename=\${TYPE_ZONE} set zonepath=/zones/\${TYPE_ZONE} set autoboot=false set ip-type=exclusive add net set physical=iz\${SER} set global-nic=vsw0 add property (name=ip,value="\${IP}.\${SER}") add property (name=gateway,value="\${IP}.254") add property (name=netmask,value="255.255.255.0") add property (name=primary,value="true") end add attr set name=resolvers set type=string set value=8.8.8.8 end add fs set dir="/export/home/admin" set special="/export/home/admin" set type="lofs" end add fs set dir="/export/builds" set special="/export/builds" set type="lofs" end add fs set dir="/data/repo" set special="/data/repo" set type="lofs" end verify commit exit EOT zonecfg -z \${TYPE_ZONE} -f \${HOME}/\${TYPE_ZONE}.cmd 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log zoneadm -z \${TYPE_ZONE} install 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log zoneadm -z ${TYPE_ZONE} boot 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log echo "127.0.0.1 localhost.${TYPE_ZONE} ${TYPE_ZONE}" >> /zones/${TYPE_ZONE}/root/etc/hosts res=$(grep -e 'WARNING:' -e 'warning:' -e 'W:' -e 'error:' -e 'E:' -e 'cannot' /var/tmp/${TYPE_ZONE}-bts.log | sort -u) if [[ "$res" == "" ]]; then echo " =========== Zone ${TYPE_ZONE} is successfully created and ready to use =============" else echo " =========== Zone ${TYPE_ZONE} creation log =============" echo "$res" echo "$res" | sed '/W: --force-yes is deprecated/d; /\/man\//d' if [[ "$res" != "" ]]; then echo " ========================================================" echo "Please stop and report about zone bootstrap errors!" fi fi SCRIPT

Make it executable:

 

Now you will be able to run it with the format of ./create_zone.sh <zone-name> <zone-ip-domain> <zone-ip-node> , for example!:

./create_zone.sh zone02 192.168.0 3

3. Prepare script to get dependencies for components building.

Create a folder for the local repository and enter it:

To make the following script workable you have to create the list_component file with a content from here.

Create here a script to obtain dependencies and repository creation. To do this copy please this script to the file, let say, make_repo.sh or execute the following command:

Make this file executable:

If you have to get the error log then put the log name to the string LOG_FILE="" , for example:

4. Create a zone for local repository

Create the new zone and enter it:

All the following commands are executed in the zonerepo.

Update the /etc/apt/sources.list file:

Install packets required for working in the zone:

Create a folder for repository configuration files:

and create the repository configuration:

5. Create the local repository:

Creating of the local repository can take a long time. So, you can run it with the screen utility.

If you are connected by SSH and would like to turn off SSH session or even temporary turn off your computer, then you have enter the following command for tests running:

Then you can in any time press Ctrl-A d and after that close your SSH session.

When you would like to get back, login again to SSH please and enter the command:

6. Create the new zone for components building

Create the new zone and enter it:

All the following commands are executed in the zonebld.

Prepare the zone for components building. To do this please copy this script to, let say, the prepare.sh file or execute the following command:

Make it executable and run:

7. Build components

Copy this script to, for example, thebuild_all.sh file or execute the following command:

If you’d like stop process on the first error, put 1 the STOP_ON_ERROR variable STOP_ON_ERROR=1. In other case it will build all components one-by-one regardless of errors. And in every component folder theberror.log file will be created, where build errors will be stored.

Make it executable and run:

The building process can take a long time. So, you can run it with the screen utility.

If you are connected by SSH and would like to turn off SSH session or even temporary turn off your computer, then you have enter the following command for tests running:

Then you can in any time press Ctrl-A d and after that close your SSH session.

When you would like to get back, login again to SSH please and enter the command:

If you run all components building, then you can check what components were failed with the following commands:

After the build you an check the components installation by creating the new zone.