I have been working on creating a VyOS 1.1.8 image on Alibaba Cloud.
I have been successful in getting it working, so I will go over my methods/tricks for you guys to reference for creating an official one there.
- Convert the vmdk virtualbox image to vhd. I found "StarWind V2V Image Converter" worked perfectly for this.
- Alibaba places os.conf in 'aliyun_custom_image' directory you need to add to the default root parition.
The root partition is mounted in /live/image, so mkdir /live/image/aliyum_custom_image
chmod the directory 777, so the setup script can delete the os.conf afterward
- Setup sshd to listen on port 22 (set service ssh port 22)
- Make sure there are no ethernet interfaces (delete interfaces ethernet eth0)
If you leave anything in eth0, then the network interface Alibaba adds will end up being called eth1, despite the os.conf saying eth0
- Place custom init scripts in /config/scripts (will attach)
alibaba-init.sh - parses the os.conf file, sets the settings, and then deletes the os.conf file
vyos-command.sh - The first script calls this script multiple times. I couldn't get the bash scripting to work right after sourcing in the script-template, so I have this simple wrapper to run vyos commands.
- Finally, have /etc/rc.local call the alibaba-init.sh script on boot
[ -x $ALIBABACONFIG ] && $ALIBABACONFIG
- So again verify that there is nothing in config.boot for eth0, and power off the virtualbox/vmware image.
- Upload this vhd file to a OSS box on Alibaba
- Under "images", go to "import image". Select your OSS file, and set the type to "Customized Linux". I think it requires a 40G minimum size, but I didn't test it with others.
- Once the image is ready, you can create an instance with it. For the bit about setting up access, click on the "Password" tab, and put in what you would like your default password to be. Even though it says the user is 'root', it will actually be setting it into the 'vyos' user. The ssh key login bit can't be configured by the initial setup, but you can always add a key afterward, of course.
That should be all.
Unfortunately my Alibaba account isn't letting me create new instances anymore for some reason, so I haven't been able to test these final versions of my scripts. In a previous version, a final reboot was required for configurations to work afterward, but I think the attached one will fix that (Thanks @syncer for that help)
I may share out my image to the public once I get it finally tested and perfect, but I'm not sure.