Page -> Vnx-rootfslxc Views :  Page  Discussion  View source  History 

From VNX

Revision as of 11:16, 6 December 2016 by David (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to create a LXC Ubuntu root filesystem for VNX

Basic installation

Follow this procedure to create a Ubuntu based LXC root filesystem for VNX. The procedure has been tested with Ubuntu versions from 13.10 to 16.04.

  • Create the rootfs with:
  • lxc-create -t ubuntu -n vnx_rootfs_lxc_ubuntu-16.04
    

    Note1: The default username/password is ubuntu/ubuntu.
    Note2: This method creates an image with the same architecture (32 or 64 bits) as the host. To create a 32 bits image in a 64 bits host, the only method known to work is to follow the procedure described in this page inside a KVM 32 bits virtual machine.

  • Move the rootfs to VNX filesystems directory:
  • mv /var/lib/lxc/vnx_rootfs_lxc_ubuntu-16.04/ /usr/share/vnx/filesystems/
    
  • Edit the rootfs configuration file (/usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-16.04/config) to reflect the directory change:
  • lxc.rootfs = /usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-16.04/rootfs
    lxc.mount  = /usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-16.04/fstab
    
  • Create fstab file (if not created):
  • touch vnx_rootfs_lxc_ubuntu-16.04/fstab
    
  • Start the new rootfs to configure it and install new software:
  • lxc-start -n vnx_rootfs_lxc_ubuntu-16.04 -F -f /usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-16.04/config
    
  • Once the VM has started, make login (ubuntu/ubuntu) and:
    • Add VNX user and change the passwords:
    • sudo adduser vnx
      sudo adduser vnx sudo
      sudo passwd root
      
    • Update and install software:
    • sudo apt-get update
      sudo apt-get dist-upgrade
      sudo apt-get install aptsh openssh-server traceroute telnet nmap apache2 wget tcpdump
      update-rc.d -f apache2 remove   # to avoid automatic start
      
    • Change VM name in hosts and hostname files:
    • sudo vi /etc/hosts         # change name to vnx
      sudo vi /etc/hostname      #     "
      
    • Enable root access through textual consoles with:
    • echo "pts/0" >> /etc/securetty
      echo "pts/1" >> /etc/securetty
      echo "pts/2" >> /etc/securetty
      echo "pts/3" >> /etc/securetty
      
    • Important: edit /etc/network/interfaces and coment "inet dhcp" lines to avoid delays at startup. Besides, edit /etc/init/failsafe.conf and change all "sleep XX" commands to "sleep 1".
  • Exit and login again with user vnx/xxxx to delete ubuntu user:
  • sudo deluser ubuntu
    
  • Stop the VM with:
  • halt
    
  • If you want to pack the root filesystem into a tar file, use the following command:
  • tar --numeric-owner -czpf vnx_rootfs_lxc_ubuntu-16.04-v025.tgz vnx_rootfs_lxc_ubuntu-16.04-v025
    
  • Optionally, create a short link to the rootfs:
  • cd /usr/share/vnx/filesystems
    ln -s vnx_rootfs_lxc_ubuntu-16.04 rootfs_lxc
    



TOOLBOX
LANGUAGES
Personal tools