Difference between revisions of "Vnx-rootfslxcvyos"
(Created page with "{{Title|How to create a LXC VyOS root filesystem for VNX}} == Basic installation == VyOS is an open source network operating system that is based on Debian GNU/Linux and tha...") |
(→Basic installation) |
||
(21 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Basic installation == | == Basic installation == | ||
− | VyOS is an open source network operating system that is based on Debian GNU/Linux and that joins multiple applications such as Quagga, ISC DHCPD, OpenVPN, StrongS/WAN and others under a single management interface. It can be installed on physical hardware or on virtual machines and it is a community fork of Vyatta. | + | [https://vyos.io/en/ VyOS] is an open source network operating system that is based on Debian GNU/Linux and that joins multiple applications such as Quagga, ISC DHCPD, OpenVPN, StrongS/WAN and others under a single management interface. It can be installed on physical hardware or on virtual machines and it is a community fork of [https://en.wikipedia.org/wiki/Vyatta Vyatta]. |
− | Follow this procedure to create a | + | Follow this procedure as a root user to create a VyOS based LXC root filesystem for VNX. The procedure has been tested with VyOS 1.1.7 over a Ubuntu 16.04 system. |
+ | |||
+ | <ul> | ||
+ | <li>Get VyOS installation CD and mount it to make its content accesible:</li> | ||
+ | wget http://packages.vyos.net/iso/release/1.1.7/vyos-1.1.7-amd64.iso | ||
+ | mount -o loop vyos-1.1.7-amd64.iso /mnt/ | ||
+ | <li>Create a Debian LXC rootfs with:</li> | ||
+ | lxc-create -n vyos -t debian -- -r wheezy | ||
+ | <li>Substitute the rootfs directory of the newly created container by the VyOS one:</li> | ||
+ | cd /var/lib/lxc/vyos | ||
+ | rm -rf /var/lib/lxc/vyos/rootfs/ | ||
+ | unsquashfs /mnt/live/filesystem.squashfs | ||
+ | mv squashfs-root/ rootfs | ||
+ | umount /mnt | ||
+ | <li>Do some modifications in container configuration:</li> | ||
+ | # Change the number of ttys to 6 | ||
+ | sed -i -e "s/lxc.tty = 4/lxc.tty = 6/" config | ||
+ | # Eliminate the "nr_inodes" option in vyatta-router script (not supported inside the container) | ||
+ | sed -i -e 's/,nr_inodes=0//' rootfs/etc/init.d/vyatta-router | ||
+ | # Create the /dev/fuse device manually in /etc/rc.local | ||
+ | sed -i -e "/By default this script does nothing/a mknod -m 666 /dev/fuse c 10 229\nchown root.fuse /dev/fuse\nchmod 660 /dev/fuse" rootfs/etc/rc.local | ||
+ | <li>Start the new container for the first time (needed for the vyos user to be created) and stop it later:</li> | ||
+ | lxc-start -n vyos | ||
+ | sleep 5 | ||
+ | lxc-attach -n vyos -- poweroff | ||
+ | <li>Add the TERM environment variable to the vyos user .bashrc:</li> | ||
+ | echo "export TERM=xterm" >> rootfs/home/vyos/.bashrc | ||
+ | <li>Disable the ttyS0 console in default configuration:</li> | ||
+ | sed -i -e '/device ttyS0/,+2d' rootfs/opt/vyatta/etc/config/config.boot | ||
+ | </ul> | ||
+ | |||
+ | After this steps, you will have a working VyOS LXC image ready to be used. You can start it and access the console with: | ||
+ | lxc-start -n vyos | ||
+ | lxc-console -n vyos | ||
+ | Note: the foreground option "-F" of "lxc-start" that allows starting the container and directly showing the console does not work (I do not now why; probably something related with the console/ttyS0 ports). | ||
+ | |||
+ | Finally, to convert the image into a VNX rootfs: | ||
+ | <ul> | ||
+ | <li>Move the image to VNX images directory:</li> | ||
+ | cd /usr/share/vnx/filesystems/ | ||
+ | mv /var/lib/lxc/vyos vnx_rootfs_lxc_vyos64-1.1.7-v025 | ||
+ | <li>Edit the rootfs configuration file (/usr/share/vnx/filesystems/vnx_rootfs_lxc_vyos64-1.1.7-v025/config) to reflect the directory change:</li> | ||
+ | lxc.rootfs = /usr/share/vnx/filesystems/vnx_rootfs_lxc_vyos64-1.1.7-v025/rootfs | ||
+ | <li>Start a the container and access to the console:</li> | ||
+ | lxc-start -n vnx -f vnx_rootfs_lxc_vyos64-1.1.7-v025/config | ||
+ | lxc-console -n vnx | ||
+ | <li>Enter using vyos/vyos user/password and create the vnx/xxxx user with:</li> | ||
+ | configure | ||
+ | set system login user vnx full-name "VNX project" | ||
+ | set system login user vnx authentication plaintext-password xxxx | ||
+ | set system login user vnx level admin | ||
+ | commit | ||
+ | save | ||
+ | exit | ||
+ | <li>Stop the container with:</li> | ||
+ | poweroff | ||
+ | <li>Add the TERM environment variable to the vnx user .bashrc:</li> | ||
+ | echo "export TERM=xterm" >> vnx_rootfs_lxc_vyos64-1.1.7-v025/rootfs/home/vnx/.bashrc | ||
+ | </ul> |
Latest revision as of 14:04, 30 August 2017
How to create a LXC VyOS root filesystem for VNX
Basic installation
VyOS is an open source network operating system that is based on Debian GNU/Linux and that joins multiple applications such as Quagga, ISC DHCPD, OpenVPN, StrongS/WAN and others under a single management interface. It can be installed on physical hardware or on virtual machines and it is a community fork of Vyatta.
Follow this procedure as a root user to create a VyOS based LXC root filesystem for VNX. The procedure has been tested with VyOS 1.1.7 over a Ubuntu 16.04 system.
- Get VyOS installation CD and mount it to make its content accesible:
wget http://packages.vyos.net/iso/release/1.1.7/vyos-1.1.7-amd64.iso mount -o loop vyos-1.1.7-amd64.iso /mnt/
lxc-create -n vyos -t debian -- -r wheezy
cd /var/lib/lxc/vyos rm -rf /var/lib/lxc/vyos/rootfs/ unsquashfs /mnt/live/filesystem.squashfs mv squashfs-root/ rootfs umount /mnt
# Change the number of ttys to 6 sed -i -e "s/lxc.tty = 4/lxc.tty = 6/" config # Eliminate the "nr_inodes" option in vyatta-router script (not supported inside the container) sed -i -e 's/,nr_inodes=0//' rootfs/etc/init.d/vyatta-router # Create the /dev/fuse device manually in /etc/rc.local sed -i -e "/By default this script does nothing/a mknod -m 666 /dev/fuse c 10 229\nchown root.fuse /dev/fuse\nchmod 660 /dev/fuse" rootfs/etc/rc.local
lxc-start -n vyos sleep 5 lxc-attach -n vyos -- poweroff
echo "export TERM=xterm" >> rootfs/home/vyos/.bashrc
sed -i -e '/device ttyS0/,+2d' rootfs/opt/vyatta/etc/config/config.boot
After this steps, you will have a working VyOS LXC image ready to be used. You can start it and access the console with:
lxc-start -n vyos lxc-console -n vyos
Note: the foreground option "-F" of "lxc-start" that allows starting the container and directly showing the console does not work (I do not now why; probably something related with the console/ttyS0 ports).
Finally, to convert the image into a VNX rootfs:
- Move the image to VNX images directory:
cd /usr/share/vnx/filesystems/ mv /var/lib/lxc/vyos vnx_rootfs_lxc_vyos64-1.1.7-v025
lxc.rootfs = /usr/share/vnx/filesystems/vnx_rootfs_lxc_vyos64-1.1.7-v025/rootfs
lxc-start -n vnx -f vnx_rootfs_lxc_vyos64-1.1.7-v025/config lxc-console -n vnx
configure set system login user vnx full-name "VNX project" set system login user vnx authentication plaintext-password xxxx set system login user vnx level admin commit save exit
poweroff
echo "export TERM=xterm" >> vnx_rootfs_lxc_vyos64-1.1.7-v025/rootfs/home/vnx/.bashrc