Difference between revisions of "Vnx-rootfslxcdebian"

From VNX
Jump to: navigation, search
(Basic installation)
Line 10: Line 10:
 
<ul>
 
<ul>
 
<li>Create the rootfs with:</li>
 
<li>Create the rootfs with:</li>
  lxc-create -t ubuntu -n vnx_rootfs_lxc_ubuntu-13.10
+
  lxc-create -t ubuntu -n vnx_rootfs_lxc_debian
Note1: Change "ubuntu" by "debian" in case you want to create a Debian rootfs. The default username/password is ubuntu/ubuntu.<br>
+
Note1: The default username/password is root/root.<br>
 
Note2: use linux32 command to create a 32 bits image from a 64 bits machine, that is:
 
Note2: use linux32 command to create a 32 bits image from a 64 bits machine, that is:
 
  linux32 lxc-create -t debian -n vnx_rootfs_lxc_debian
 
  linux32 lxc-create -t debian -n vnx_rootfs_lxc_debian
 
<li>Move the rootfs to VNX filesystems directory:</li>
 
<li>Move the rootfs to VNX filesystems directory:</li>
  mv /var/lib/lxc/vnx_rootfs_lxc_ubuntu-13.10/ /usr/share/vnx/filesystems/
+
  mv /var/lib/lxc/vnx_rootfs_lxc_debian/ /usr/share/vnx/filesystems/
<li>Edit the rootfs configuration file (/usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-13.10-v025/config) to reflect the directory change:</li>
+
<li>Edit the rootfs configuration file (/usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/config) to reflect the directory change:</li>
  lxc.rootfs = /usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-13.10/rootfs
+
  lxc.rootfs = /usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/rootfs
  lxc.mount  = /usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-13.10/fstab
+
  lxc.mount  = /usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/fstab
 
<li>Start the new rootfs to configure it and install new software:</li>
 
<li>Start the new rootfs to configure it and install new software:</li>
  lxc-start -n vnx_rootfs_lxc_ubuntu-13.10-v025 -f /usr/share/vnx/filesystems/vnx_rootfs_lxc_ubuntu-13.10/config
+
  lxc-start -n vnx -f /usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/config
<li>Once the VM has started, make login (ubuntu/ubuntu) and:</li>
+
<li>Once the VM has started, make login (root/root) and:</li>
 
<ul>
 
<ul>
 
<li>Add VNX user and change the passwords:</li>
 
<li>Add VNX user and change the passwords:</li>
  sudo adduser vnx
+
  adduser vnx
  sudo adduser vnx sudo
+
  adduser vnx sudo
  sudo passwd root
+
  passwd root
 
<li>Update the system:</li>
 
<li>Update the system:</li>
  sudo apt-get update
+
  apt-get update
  sudo apt-get dist-upgrade
+
  apt-get dist-upgrade
 
<li>And install additional software, for example (list taken from [http://wiki.pcprobleemloos.nl/using_lxc_linux_containers_on_debian_squeeze/creating_a_lxc_virtual_machine_template here]):</li>
 
<li>And install additional software, for example (list taken from [http://wiki.pcprobleemloos.nl/using_lxc_linux_containers_on_debian_squeeze/creating_a_lxc_virtual_machine_template here]):</li>
  
Line 39: Line 39:
  
 
<li>Change VM name in hosts and hostname files:</li>
 
<li>Change VM name in hosts and hostname files:</li>
  sudo vi /etc/hosts        # change name to vnx
+
  vi /etc/hosts        # change name to vnx
  sudo vi /etc/hostname      #    "
+
  vi /etc/hostname      #    "
 
<li>'''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".
 
<li>'''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".
 
</ul>
 
</ul>

Revision as of 23:12, 4 May 2014

How to create a LXC Debian root filesystem for VNX

DRAFT, DRAFT, DRAFT...not finished yet


Basic installation

Follow this procedure to create a LXC Debian based root filesystem for VNX. The procedure has been tested creating a Debian 7 over an Ubuntu 13.10 host.

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

    Note1: The default username/password is root/root.
    Note2: use linux32 command to create a 32 bits image from a 64 bits machine, that is:

    linux32 lxc-create -t debian -n vnx_rootfs_lxc_debian
    
  • Move the rootfs to VNX filesystems directory:
  • mv /var/lib/lxc/vnx_rootfs_lxc_debian/ /usr/share/vnx/filesystems/
    
  • Edit the rootfs configuration file (/usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/config) to reflect the directory change:
  • lxc.rootfs = /usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/rootfs
    lxc.mount  = /usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/fstab
    
  • Start the new rootfs to configure it and install new software:
  • lxc-start -n vnx -f /usr/share/vnx/filesystems/vnx_rootfs_lxc_debian/config
    
  • Once the VM has started, make login (root/root) and:
    • Add VNX user and change the passwords:
    • adduser vnx
      adduser vnx sudo
      passwd root
      
    • Update the system:
    • apt-get update
      apt-get dist-upgrade
      
    • And install additional software, for example (list taken from here):
    • apt-get --no-install-recommends install -y adduser apt-utils iproute netbase sudo iputils-ping iptables rsyslog
      apt-get install --no-install-recommends openssh-blacklist openssh-blacklist-extra openssh-server 
      apt-get install net-tools ifupdown sockstat
      apt-get install wget less lsof screen apt-utils nano telnet inetutils-ping psmisc
      apt-get install aptsh traceroute nmap apache2 wget tcpdump
      
    • Change VM name in hosts and hostname files:
    • vi /etc/hosts         # change name to vnx
      vi /etc/hostname      #     "
      
    • 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".
  • Stop the VM with:
  • halt
    
  • Optionally, create a short link to the rootfs:
  • cd /usr/share/vnx/filesystems
    ln -s vnx_rootfs_lxc_ubuntu-13.10 rootfs_lxc