HowTo build a virtualized VyOS development environment for building the ISO


#1

A couple of days ago I had a brilliant idea to reduce setup time for building a development box for vyos by virtualizing it into VMware ESXi.

Why?

- I can make snapshot/clone for testing and doing whatever I like to do so
- I can build an OVF file for backup or move it wherever I like to do so
- I can virtually test resources vRAM,vCPU,vHDD,vNET without real switches, routers
- I can mount an ISO and test the ISO without burning a CD, find an USB key

At this time I thought, isn’t it possible to build the development box
from the distribution itself? recursively?
Does the installed image works and behave like a physical debian box?

Yes it will! I tested it under VMware and it works!

Here the whole story…

- Download the i386 (virtual) or amd64 ISO
- Use your preferred virtual environment (VMware, KVM, ...)
- Create at least 8GB vHDD ext4 partition to hold all the stuff and more...
- Add reasonable 2GB vRAM for compiling & testing
- If you can add another vCPU (squashfs can build the iso on more procs. concurrently!)
- Define a virtual VM with CD-ROM, Network, Disk
- Mount the ISO and connect at startup
- login with vyos/vyos
- install image
- reboot

Here the initial OS setup :

1) login with vyos/vyos
2) sudo dpkg-reconfigure locales (choose en_US.UTF-8)
3) sudo dpkg-reconfigure keyboard-configuration (choose yours)
4) setupcon
5) sudo service keyboard-setup restart
6) sudo update-initramfs -u
7) sudo passwd root (choose one)
8) reboot

Basic configure your box (network, hostname SSH):
NOTE: Choose your own NTP server if you have a couple of them.
At least point to your ESXi or vSphere Center server to reduce
outbound NTP load.
Otherwise let it unchanged and skip this delete/set steps.

1) login with vyos/<your new one>
2) configure
3) set system name-server <dns-address-0>
4) set system name-server <dns-address-1>
5) set system gateway-address <gw-address-0>
6) set interfaces ethernet eth0 address <ip-address-0>
7) delete system ntp server 0.pool.ntp.org
8) delete system ntp server 1.pool.ntp.org
9) delete system ntp server 2.pool.ntp.org
10) set system ntp server <ntp-address-0>
11) set system ntp server <ntp-address-1>
12) set system ntp server <ntp-address-2>
13) set service ssh port 22
14) set service ssh allow-root
15) set system login user vyos authentication plaintext-password <pwd>
16) set system host-name <vyos-name-0>
17) commit
18) save
19) end

Now add required/needed Debian squeeze repos:

1) configure
2) set system package repository squeeze components 'main contrib non-free'
3) set system package repository squeeze distribution 'squeeze'
4) set system package repository squeeze url 'http://mirrors.kernel.org/debian'
5) set system package repository squeeze-backports components 'main'
6) set system package repository squeeze-backports distribution 'squeeze-backports'
7) set system package repository squeeze-backports url 'http://backports.debian.org/debian-backports'
8) commit
9) save
10) end

Now sync with:

and add the debian and vyos keyring with:

- sudo apt-get install -y debian-archive-keyring
- wget -O - http://vyos.net/so3group_maintainers.key | sudo apt-key add -

Install other required packages:

- sudo apt-get install -y build-essential lsb-release git autoconf automake dpkg-dev live-helper syslinux genisoimage devscripts ssh sudo vim

Install the newer version of squashfs-tools with:

Finally sync everything with:

and … reboot

How to build the iso is explained on another thread on this forum.
HowTo build VyOS ( a short way )

[b]NOTE: This howto overlaps slightly with the above mentioned thread.
If you want to build the iso continue from the step … (enter as your build-user) “echo 'export PATH …”

Select hydrogen or helium branch. This is up to you :-)[/b]