What is virtualization?

advertisement
VIRTUALIZATION WITH
SOLARIS
A.V.Bogdanov, PyaeSoneKoKo
State Marine Technical University, St.petersburg
Network virtualization
 Storage virtualization
 Server virtualization

Full virtualization
 Paravirtualization
 OS resource virtualization

• Better utilization of hardware resources
• Reduced time to market
• High availability
• Disaster recovery
• Testing new technologies
• Migrating services to new platforms
• Solaris zones
• Linux branded zones
• Xen (dom0 and domU)
• Crossbow (virtualized network stacks)
• More to come …








Better isolation as compared to a chroot (chroot jail).
Low overhead. LXC uses minimal resources in terms of
RAM and hard drive space without the overhead of
installing a guest OS in a virtual machine ( VMWare /
VirtualBox / KVM ).
Applications and services (servers) run at native speed.
There is support for Linux containers in libvirt .
Linux containers work well with btrfs .
No special hardware is required, runs on 32 and 64 bit
processors.
Linux containers are Open source.
Unlike XEN or OpenVZ , no patch is required to the kernel.

Create control group filesystem as the root user.
# mkdir -p /cgroup
# mount none -t cgroup /cgroup
Add to fstab so it will be there after a reboot.
# vi /etc/fstab and add line below
none /cgroup cgroup defaults 0 0


Applications to install.
# apt-get install libvirt-bin debootstrap
We need to download and install this pkg.
lxc_0.7.2-1_amd64.deb
# dpkg -i lxc_0.7.2-1_amd64.deb



# Create a container
# lxc-create -f /path/to/{CONTAINER_NAME}/main/config/file -n
{CONTAINER_NAME}
# lxc-create -f /etc/lxc/lxc-centos.conf -n centos
Create a rootfs directory
# mkdir /var/lib/lxc/centos/rootfs
Copy files you worked on earlier.
# cp -r /home/yourhomeidirectory/LXC/Centos5-x86_64/*
/var/lib/lxc/{CONTAINER_NAME}/rootfs
# cp -r /home/yourhomeidirectory/LXC/Centos5x86_64/* /var/lib/lxc/centos/rootfs
Create this file for creating and setup default devices for your
containers.
# vi /usr/local/bin/lxc-config and add information below, also only
needs to be run once for every new container you create.



# cd /var/lib/lxc/CONTAINER_NAME}/rootfs/
# cd /var/lib/lxc/centos/rootfs/
# /usr/local/bin/lxc-config # fix /dev
Chrooting into the rootfs file system for centos
# chroot /var/lib/lxc/centos/rootfs/
Setup root password for your container.
# passwd root
Start or Remove some services from running
# chkconfig sshd on
# chkconfig httpd on
# chkconfig xinetd off
# chkconfig sendmail off

When finish type exit to finish chroot session.






Destroy container and files
# lxc-destroy -n {CONTAINER_NAME}
# lxc-destroy -n centos
Start container
# lxc-start -n {CONTAINER_NAME} init
# lxc-start -n centos init
Stop container
# lxc-stop -n {CONTAINER_NAME}
# lxc-stop -n centos
Connect to tty console
# lxc-console -n centos -t 1 doesn’t seem to work for me.
Check your configuration
# lxc-checkconfig
List containers
# lxc-ls
If you receive this error lxc-ls warning, got bogus unix line, reinstall uml-utiilities
# sudo apt-get –reinstall install uml-utilities
Is it RUNNING or STOPPED
# lxc-info -n {CONTAINER_NAME}
# lxc-info -n centos
Containers may be used for a number of different reasons.
These include:
Resource partitioning with maximum performance.
 Multiple secure applications instances (e.g. a walled
garden).
 Process isolation (e.g. process jails).
 GPL insulation.

1. Reduced overhead
1. Reduced flexibility
2. Increased density
2. Decreased isolation
3. Reduced sprawl
“LXC linux containers are reliable and predictable – and has
what we need in an operating system. The Solaris OS also allows
multiple applications to be consolidated onto a single system
through virtualization, which makes it an ideal solution for
standardization. Virtualization features ensure high availability,
which is critical to Argonne’s environment.”
Download