Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36

Thread: How to : OpenVZ Ubuntu Host

  1. #1
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Thumbs down How to : OpenVZ Ubuntu Host

    Introduction


    OK, I think it is finished now. Please report any problems

    Contents

    Post 1 : Introduction

    Post 2 : Install OpenVZ

    Post 3 : Post-install configuration
    Basic network options NAT & Bridge

    Post 4 : Running OpenVZ ~ AKA a walkthrough

    Post 5 : Fixes / Tools
    How to mount a NFS share on a VE
    Install VMWare server
    Install VirtualBox
    Install a kernel in the VE

    Post 6 : Digital Blasphemy ~ How to forward X

    Post 7 : How to make OS templates.

    Attachments : I will attach a link to my newest Ubuntu template.:

    ubnuntu-7.10-i386-minimal

    • Save the template to /vz/template/cache/
    • This template uses sys V (rather then upstart).
    • I had problems with networking on this machine, so I restart the network in /etc/rc.local


    --------------------------------------------------------------

    OpenVZ is not true virtualization, it more akin to a sophisticated chroot. Open VZ is ideal for a server environment and the guest (templates) are minimal.

    Terminology:

    The host OS is often referred to as the "Node"

    The guest OS is referred to as a "VE" AKA Virtual Environment.

    What to expect : VE are very small. For example, my Ubuntu-7.10 template is 37 Mb. Thus you can dedicate one VE to a single task with low overhead. For example, rather then running a "mega server" with with several instances of apache and a FTP server you can run a dedicated VE for each instance of apache/web site or a dedicated FTP server. This can potentially enhance security as each server is independent and if you are cracked, the cracker has access to a very limited resources (a 37 Mb version of Ubuntu does not have as many tools available to crackers).

    VE templates are pre-packaged machines and configuration files stored in a .tar.gz . To install a machine you unpack a template (using vzctl). You can deploy multiple cloned machines very rapidly.

    If you want to run X be prepared to install it or convert a physical installation

    http://www.debianhelp.co.uk/openvz.htm
    How to forge : OpenVZ On Debian Etch For Webservers

    Advantages:
    1. Guests (VE) utilize your hardware directly.
    2. Speed.
    3. It is very easy to convert a hard drive install to a virtual machine.
    4. Guests are very easy to make / install.


    Disadvantages:
    1. There is NO GUI to configure or run your guests.
    2. OpenVZ will not run windows or FreeBSD.
    3. OpenVZ has not been ported to Ubuntu. Development has been most robust on rpm systems (Centos), although there is a Debian repo and I am hoping development is underway for Ubuntu.
    4. You have compile your own kernel (although a binary is available, see below).


    If you would like to try OpenVZ, I highly recommend taking one of the live CD's for a spin (you do not need to reboot if you already have VMWare installed, just boot the iso and you can run VZ guests within your VMWare host).

    OpenVZ Live CD download page

    As always, have fun,

    bodhi.zazen
    Last edited by bodhi.zazen; November 27th, 2007 at 05:00 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  2. #2
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: How to : OpenVZ Ubuntu Host

    Install Openvz

    You have two options:
    1. Download the OpenVZ patch and recompile your kernel
    2. Install a pre-compiled binay


    I did not have much success with compiling my own kernel, but here is a link if you would like to try it :

    http://wiki.openvz.org/Installation_on_Debian

    Also on that link is information on how to install the OpenVZ kernel from the Debian Repos's. The Debian kernel works just fine, but it was built without drivers (no sound, no nvidia).

    I advise you install from here :

    http://debian.systs.org/howto/instal...n-debian-etch/

    I had the best success with the "forzza" kernel

    root@Gutsy:~# uname -r
    2.6.18-fza-5-686
    Installation is quite easy.

    Kernel source : http://debian.systs.org/debian/pool/openvz/l/

    Note: Be sure to use the "fza" kernel appropriate to your cpu. For me this was the 686 kernel : http://debian.systs.org/debian/pool/....18-fza-5-686/

    Open a terminal and :

    Code:
    # I like to keep such things in my home directory under "src"
    # You can choose an alternate location if you like
    
    mkdir -P src/openvz
    cd src/openvz
    wget linux-image-2.6.18-fza-5-686_028stab048.1_i386.deb
    wget linux-headers-2.6.18-fza-5-686_028stab048.1_i386.deb
    sudo dpkg -i linux-image-2.6.18-fza-5-686_028stab048.1_i386.deb
    sudo dpkg -i linux-headers-2.6.18-fza-5-686_028stab048.1_i386.deb
    
    # Update grub to be sure your new kernel is included in the menu
    sudo update-grub
    REBOOT and select the new kernel, on my system :

    Ubuntu 7.10, kernel 2.6.18-fza-5-68
    YOU CAN NOT COMPLETE THE INSTALLATION IF YOU ARE NOT RUNNING AN OPENVZ KERNEL

    edit, by any means, your sources adding the OpenVZ repository. I use vim.

    Code:
    sudo vim /etc/apt/sources.list
    Add this repo:

    #OpenVZ
    deb http://debian.systs.org/ etch openvz
    # deb http://download.openvz.org/debian/ etch openv
    Install OpenVZ:

    Code:
    sudo apt-get update
    sudo apt-get install vzctl vzquota vzdump vzctl-ostmpl-debian
    Last edited by bodhi.zazen; November 26th, 2007 at 01:20 AM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  3. #3
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: How to : OpenVZ Ubuntu Host

    Post install configuration


    1. For compatibility, make a link :

    Code:
    sudo ln -s /var/lib/vz /vz
    • OpenVZ on Centos uses /vz as the default directory


    Networking


    1. If you have a public IP (ie direct connection to internet) directly configure your IP address with vzctrl :

    sudo vzctrl set <#VE> --ip <ip_address> --hostname <hostname> --nameserver <IP> --save
    • Those are doubble - - in --ip --hostname --nameserver amd --save
    • <#VE> = VE # ie 101
      {*}<hostname> = your desired VE hostname
    • <IP> i= IP address of your nameserver


    Example:

    Code:
    sudo vzctrl 101 --ip 111.222.3.4 --hostname MyServer --nameserver xxx.yyy.z.z --save



    2. If you use a Private IP, ie router, you will need to ues either NAT or bridge to allow your VE to access the internet.

    ++++++++++++++++++++

    NAT

    There is a "bug" in procps :

    https://bugs.launchpad.net/ubuntu/+s...cps/+bug/84537

    It is no so much a bug as a change in the syntax for /etc/sysctl.conf to enable NAT forwarding.

    This is the configuration I use :

    File /etc/sysctl.conf:

    # /etc/sysctl.conf - Configuration file for setting system variables
    # See sysctl.conf (5) for information.
    #

    #kernel.domainname = example.com
    #net/ipv4/icmp_echo_ignore_broadcasts=1

    # the following stops low-level messages on console
    kernel.printk = 4 4 1 7

    # enable /proc/$pid/maps privacy so that memory relocations are not
    # visible to other users.
    kernel.maps_protect = 1

    ################################################## ############3
    # Functions previously found in netbase
    #

    # Uncomment the next line to enable Spoof protection (reverse-path filter)
    net.ipv4.conf.default.rp_filter=1

    # Uncomment the next line to enable TCP/IP SYN cookies
    #net.ipv4.tcp_syncookies=1

    # Uncomment the next line to enable packet forwarding for IPv4
    # This line did not work, see bug below
    # net.ipv4.conf.default.forwarding=1


    # Uncomment the next line to enable packet forwarding for IPv6
    #net.ipv6.conf.default.forwarding=1

    #-- OpenVZ begin --#

    # On Hardware Node we generally need
    # packet forwarding enabled and proxy arp disabled
    # Added the next line from https://bugs.launchpad.net/ubuntu/+s...cps/+bug/84537
    net.ipv4.conf.all.forwarding=1 # <-- Added to enable NAT

    net.ipv4.ip_forward = 1 # <-- This line enables NAT forwarding
    net.ipv4.conf.default.proxy_arp = 0

    # Enables source route verification
    # Enabled above
    # net.ipv4.conf.all.rp_filter = 1

    # Enables the magic-sysrq key
    kernel.sysrq = 1

    # TCP Explict Congestion Notification
    #net.ipv4.tcp_ecn = 0

    # we do not want all our interfaces to send redirects
    net.ipv4.conf.default.send_redirects = 1
    net.ipv4.conf.all.send_redirects = 0

    #-- OpenVZ end --
    To see if NAT is enabled enter this command (you should see a the number "1" :

    Code:
    bodhi@GutsyVZ:~$ cat /proc/sys/net/ipv4/ip_forward
    1
    Enable NAT with :

    Code:
    iptables -t nat -A POSTROUTING -s src_net -o eth0 -j SNAT --to ip_address
    src_net = range of guest ip addresses (ie 10.0.0.0/8 )
    --to ip_address = ip address of your host OS

    Example :

    iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j SNAT --to 192.168.1.25
    http://wiki.openvz.org/Using_NAT_for...th_private_IPs

    ++++++++++++++++++++

    Bridge

    To bridge my network card.

    Install bridge utilities :

    Code:
     apt-get install bridge-utils
    Bridge your network card :

    During these steps you will temporarily lose your Internet connection

    Note: I use eth0 as my network card, you may need to substitute your card (list your card with ifconfig). Also I use DHCP to assign IP addresses and again you will need to adapt if you use a static IP (for host or guest).

    Edit /etc/network/interfaces changing it to this :

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    # Use these settings for NAT
    # auto eth0
    # iface eth0 inet dhcp

    # Bridge
    #Use these settings for Bridging
    # Bridging can be used with both QEMU or VirtualBox
    brctl addbr br0
    auto br0
    iface br0 inet dhcp
    bridge_ports eth0
    Restart your network

    Code:
    sudo /etc/init.d/network restart
    You will temporarily loose your network, it will come back momentarily ...

    list your interfaces

    Code:
    sudo ifconfig
    You should see both eth0 and br0


    You should also have Internet access restored on the host.

    Configure your guest. Again I am using 101 in this example, substitute your VE # as necessary.

    Code:
    sudo vzctl set 101 --netif_add eth0 --save
    
    # The VE must be running to add the interface to the bridge
    sudo  brctl addif br0 veth101.0
    sudo vzctl exec 101 dhclient eth0
    You should now have internet access on your guest.

    You can download a script to do this automatically (see the OpenVZ link below "Using_private_IPs_for_Hardware_Nodes")


    Firewalls : You must configure your firewall on both host and guest.



    NAT

    Here is a sample iptables :

    # Generated by iptables-save v1.3.5 on Sat Nov 17 17:13:41 2007
    *nat
    REROUTING ACCEPT [8:672]
    OSTROUTING ACCEPT [8:576]
    :OUTPUT ACCEPT [6:408]
    -A POSTROUTING -s 10.0.0.0/255.255.255.0 -o eth0 -j SNAT --to-source 192.168.1.25 #<---CHANGE THIS TO YOUR HOST IP
    COMMIT
    # Completed on Sat Nov 17 17:13:41 2007
    # Generated by iptables-save v1.3.5 on Sat Nov 17 17:13:41 2007
    *mangle
    REROUTING ACCEPT [432:83374]
    :INPUT ACCEPT [262:69094]
    :FORWARD ACCEPT [170:14280]
    :OUTPUT ACCEPT [282:22203]
    OSTROUTING ACCEPT [468:39573]
    COMMIT
    # Completed on Sat Nov 17 17:13:41 2007
    # Generated by iptables-save v1.3.5 on Sat Nov 17 17:13:41 2007
    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [290:22763]
    :RH-Firewall-1-INPUT - [0:0]
    -A INPUT -j RH-Firewall-1-INPUT
    -A FORWARD -j RH-Firewall-1-INPUT
    -A RH-Firewall-1-INPUT -i lo -j ACCEPT
    -A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
    -A RH-Firewall-1-INPUT -p esp -j ACCEPT
    -A RH-Firewall-1-INPUT -p ah -j ACCEPT
    -A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
    -A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
    -A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 2049 -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
    -A RH-Firewall-1-INPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT
    -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
    COMMIT
    # Completed on Sat Nov 17 17:13:41 2007
    Save this as a file in /home.

    Load it with:
    Code:
    sudo iptables-restore < /path_to_file
    This will not be permanent and will be undone when you reboot. To make it stick
    Code:
    iptables-save

    Firestarter

    used primarily with a bridge

    Host :

    In Preferences go to Network Settings

    1. Under Internet connected network device

    Detected Device(s) -> Select "Unknown device (br0) form the pull down menu..

    2. Under Local network connected device

    Again, Detected Device(s) -> Select "Unknown device (br0) form the pull down menu..

    Now tic off the "Enable internet connection sharing".

    Guest: Install firestarter as you would normally or use IPTables.


    References :

    Virtualbox How-to : Bridge network card

    OpenVZ wiki how to bridge network
    Last edited by bodhi.zazen; December 20th, 2007 at 08:10 AM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #4
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: How to : OpenVZ Ubuntu Host

    Running OpenVZ


    A guest is referred to as a VE. The machines are downloaded as "os templates" and started from the command line.

    Example :

    In this example I will use the Pre-created Ubuntu (i386) template. You can download additional guest templates from here

    http://openvz.org/download/template/cache/

    FYI: Link to my template : ubuntu-7.10-i386-minimal.tar.gz "ubuntu-7.10-i386-minimal.tar.gz" in Community submitted templates (size = 45 Mb was submitted by me

    Direct link : http://download.openvz.org/template/...minimal.tar.gz <- This one is the one I made (in the OpenVZ Community Submitted Templates)

    You can make your own, I have used the Debian Template although there is now an Ubuntu Template as well (I advise you use the Ubuntu Template instructions, I will work through them as well and the wiki can be updated). Additional templates are also available.

    If you use one of the Ubuntu 7-10 templates, see the "fixes" section as each as a "small" bug.

    Save the os templates in : /vz/template/cache/

    Note: It is easier to manage guests as root.
    Code:
    sudo -i
    The utility to manage VE (guests) is vzctl

    The general format is

    vzctrl <command> <VE #> <options>

    Lets take a walk through :


    # Create a new VE :
    root@GutsyVZ:~# vzctl create 201 --ostemplate ubuntu-7.10-i386-minimal
    Creating VE private area (ubuntu-7.10-i386-minimal)
    Performing postcreate actions
    VE private area was created

    # Setup ~ Add a virtual eth0, add nameserver, add hostname
    root@GutsyVZ:~# vzctl set 201 --netif_add eth0 --nameserver 192.168.1.1 --hostname Gutsy --save
    Saved parameters for VE 201

    # List all VE
    root@GutsyVZ:~# vzlist -a
    VEID NPROC STATUS IP_ADDR HOSTNAME
    101 - stopped 10.1.1.10 Debian
    201 - stopped - Gutsy

    # Start the VE
    root@GutsyVZ:~# vzctl start 201
    Starting VE ...
    VE is mounted
    Setting CPU units: 1000
    Configure meminfo: 49152
    Set hostname: Gutsy
    File resolv.conf was modified
    Configure veth devices: veth201.0
    VE start in progress...

    #Add the virtual ethernet card to your bridge
    # This can not be done if the VE is not running


    root@GutsyVZ:~# brctl addif br0 veth201.0

    #configure VE virtual ethernet card with dhcp
    root@GutsyVZ:~# vzctl exec 201 dhclient eth0
    Internet Systems Consortium DHCP Client V3.0.5
    Copyright 2004-2006 Internet Systems Consortium.
    All rights reserved.
    For info, please visit http://www.isc.org/sw/dhcp/

    Listening on LPF/eth0/00:18:51:3f:a3:63
    Sending on LPF/eth0/00:18:51:3f:a3:63
    Sending on Socket/fallback
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
    DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
    DHCPOFFER from 192.168.1.5 <- Note offer from Host IP
    DHCPREQUEST on eth0 to 255.255.255.255 port 67
    DHCPACK from 192.168.1.5
    bound to 192.168.1.9 -- renewal in 37881 seconds.

    # Demonstration of connection with ping
    # Ping VE

    root@GutsyVZ:~# ping 192.168.1.9
    PING 192.168.1.9 (192.168.1.9) 56(84) bytes of data.
    64 bytes from 192.168.1.9: icmp_seq=1 ttl=64 time=0.808 ms
    64 bytes from 192.168.1.9: icmp_seq=2 ttl=64 time=0.069 ms

    --- 192.168.1.9 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1000ms
    rtt min/avg/max/mdev = 0.069/0.438/0.808/0.370 ms

    # Ping google from VE
    root@GutsyVZ:~# vzctl exec 201 ping google.com
    PING google.com (72.14.207.99) 56(84) bytes of data.
    64 bytes from eh-in-f99.google.com (72.14.207.99): icmp_seq=1 ttl=240 time=133 ms
    64 bytes from eh-in-f99.google.com (72.14.207.99): icmp_seq=2 ttl=240 time=132 ms

    # Enter VE
    root@GutsyVZ:~# vzctl enter 201
    entered into VE 201
    root@Gutsy:/#

    You are not logged into the VE as root. You can do what you will (This is a command line interface).

    # Exit VE
    root@Gutsy:/# exit
    logout
    exited from VE 201

    # Stop VE
    root@GutsyVZ:~# vzctl stop 201
    Stopping VE ...
    VE was stopped
    VE is unmounted
    root@GutsyVZ:~#

    # Delete VE ~ There is no "undo"
    root@GutsyVZ:~# vzctl destroy 201
    Destroying VE private area: /var/lib/vz/private/201
    VE private area was destroyed
    root@GutsyVZ:~
    To save a VE , stop the VE and use tar :

    Code:
    sudo vzctl stop 201
    cd /vz/private/201
    sudo tar -zcf /vz/template/cache/<new_name>.tar.gz .
    • Don't forget the . at the end
    • Re-name the VE what you will (Change <new_name> to something like Ubuntu-7.10-server.tar.gz
    Last edited by bodhi.zazen; November 28th, 2007 at 09:06 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  5. #5
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: How to : OpenVZ Ubuntu Host

    Fix VE

    Upstart is incompatible with previous versions of OpenVE (this has been fixed).

    One problem is that the Ubuntu upstart boot process is incompatible with OpenVZ (vzctrl to be exact). This has apparently been fixed as of vzctl-3.0.19 or later.

    Edit ~ UPDATE: If you followed this how-to you installed vzctl version 3.0.18-1dso1 you will need to install sysvinit on your Ubuntu VE (this will remove upstart).

    If you are running an earlier version of vzctl, the" easy fix" is to install sysvinit in your VE template. Either chroot or use vzctl enter <VE#> to enter your VE,

    DO NOT RUN THIS COMMAND ON YOUR HOST

    Code:
    sudo apt-get install sysvinit
    Alternate solutions would be to install from source, attempt to use Alien (to install the zvctl .rpm), or wait for an updated .deb.

    Note: I have done this already in the Ubuntu-7.10 template I submitted (size = 37 Mb) and in "Community". I have not noticed any problems ...


    =============================


    Problem with ssh

    To ssh into the VE you need to first set a root password (or create a non-root user).

    Code:
    vzctl exec 101 passwd

    +++++++++++++++++++

    Useful "how-to's"

    Mount a nfs share to a VE

    1. Mount the nfs share on the host, in this example I will assume the nfs share is mounted at /media/nfs

    2. Use mount --bind

    Code:
    sudo mkdir -P /vz/root/media/nfs
    mount --bind /media/nfs /vz/root/media/nfs

    Install VMWare server

    The "fza" kernel was compiled on gxx 4.1. Download and install gcc from the Feisty repository, install VMWare, then restore the gutsy gcc with :

    Code:
    sudo apt-get upgrade #you will get error messages here
    sudo apt-get install -f #This will correct them

    Install VirtualBox

    The open source edition installs, but no kernel module is available. Use the "Personal Use and Evaluation License (PUEL)." edition.


    Install a kernel in the VE

    If for some reason you wish to install a kernel in the VE :

    Add the following file cat /etc/kernel-img.conf

    do_symlinks = yes
    relative_links = yes
    do_bootloader = no
    do_bootfloppy = no
    do_initrd = yes
    link_in_boot = no
    postinst_hook = /bin/true
    postrm_hook = /bin/true
    Thank you to rednul from the Montana LUG for that fix
    Last edited by bodhi.zazen; November 27th, 2007 at 03:17 AM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  6. #6
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: How to : OpenVZ Ubuntu Host

    Digital Blasphemy
    How to forward X

    **************************
    First we must install X in the VE

    * Installing X will obviously be distro dependent

    1. Enable your Repositories.

    https://help.ubuntu.com/community/Re...es/CommandLine

    2. Install a window manager. I advise Fluxbox or Openbox, although in this post I will use XFCE as an example (XFCE is very easy to use).

    Ubuntu : https://help.ubuntu.com/community/In...wMemorySystems

    Debian : http://wiki.debian.org/DebianXFCE

    Fedora :
    Code:
    yum groupinstall 'X Window System'
    yum groupinstall XFCE
    +++++++++++++++++++++

    Xephyr

    1. Install Xephyr

    Code:
    sudo apt-get install xserver-xephyr
    2. Start Xephyr

    Code:
    Xephyr -ac -screen 1280x1024 2> /dev/null  :1 &
    • The ":1" = your display (displays are numbered starting with 0)
    • -ac = disable access control restrictions= allow you to forward X
    • -screen 1280x1024 = screen size
    • 2> /dev/unll redirects error messages


    3. Set your display (for X)

    Code:
    DISPLAY=:1.0
    4. ssh into the VE

    Code:
    ssh -XfC -c blowfish 10.0.0.1 xfce4-session
    • -X = forward X
    • -f = puts your ssh session into the background
    • -C = use compression -c blowfish = use blowfish (I am told this is the fastest)
    • Substitute your window manager for "xfce4-session


    5. Now you should have a terminal within a window on the host.




    (It's big)

    +++++++++++++++++++++++

    Direct from a terminal in X or console

    1. Enable your system to start a new X session from with a X session (otherwise you need to run these commands from the Console [at Ctrl-Alt-F1])

    edit by any means /etc/X11/Xwrapper.config

    Code:
    sudo nano /etc/X11/Xwrapper.config
    Change:
    allowed_users=console
    To:
    Code:
    allowed_users=anybody
    Documentation

    See also : http://ubuntuforums.org/showthread.php?t=271674

    2. Start a (new) X session:

    Code:
    xinit -ssh -XC -c blowfish 10.0.0.1 -- :1
    3. Log in and start a new XFCE session as above

    4. You "old" or host X session is at Ctrl-Alt-F7 and the "new" or VE session at Ctrl-Alt-F8

    ~ Enjoy
    Last edited by bodhi.zazen; November 25th, 2007 at 08:41 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  7. #7
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: How to : OpenVZ Ubuntu Host

    How-to VE Templates

    In general the OpenVZ wiki is the best source of information. This post is limited to comments on the wiki.

    Build you own Ubuntu VE

    OpenVZ wiki : Ubuntu Gutsy template creation
    OpenVZ wiki : Ubuntu template (6.06 AKA LTS)

    * I went through the Gutsy template creation and it works well. I encountered only two small problems:
    1. The new vzctl is not yet available for Debian/Ubuntu. Install sysvinit IN THE VE NOT THE HOST:
      Code:
      apt-get install sysvinit
      Alternately you could try installing a newer version of vzctl from source or with alien
    2. The network does not start when booting the VE. Add
      /etc/init.d/networking restart
      to /etc/rc/local IN THE VE


    =======================

    How to convert a physical installation -> VE

    Converting a physical installation is very easy and, IMO, is a major advantage of OpenVZ. This method works with live CD as well.

    http://wiki.openvz.org/Physical_to_VE

    1. Don't forget to install the ssh server.
    Code:
    sudo apt-get install openssh-server
    Last edited by bodhi.zazen; November 25th, 2007 at 08:47 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  8. #8

    Lightbulb Re: How to : OpenVZ Ubuntu Host

    Quote Originally Posted by bodhi.zazen View Post
    Running OpenVZ


    To save a VE , stop the VE and use tar :

    Code:
    sudo vzctl stop 201
    cd /vz/private/201
    sudo tar -zcf /vz/template/cache/<new_name>.tar.gz .
    • Don't forget the . at the end
    • Re-name the VE what you will (Change <new_name> to something like Ubuntu-7.10-server.tar.gz
    using vzdump is a better way to save your VE data

    Code:
           vzdump is an utility to make consistent snapshots of running OpenVZ
           VEs. It basically creates a tar archive of the VE private area, which
           also includes the VE configuration files.
    
           There are several ways to provide consistency:
    
           - stop the VE during backup (very long downtime)
    
           - use rsync and suspend/resume (minimal downtime).
    
           - use LVM2 (no downtime, but needs LVM2 and 500m free space on the corâ
           responding volume group to create the LVM snapshot)
    plus they recommend you should not access VE data from the Host (outside VE)
    Last edited by r3ddr; December 26th, 2007 at 12:23 PM.

  9. #9
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: How to : OpenVZ Ubuntu Host

    Thanks for the information r3ddr.

    I will update/add in this information.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  10. #10
    Join Date
    Sep 2007
    Beans
    6
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: How to : OpenVZ Ubuntu Host

    Quote Originally Posted by bodhi.zazen View Post
    OK, I think it is finished now. Please report any problems
    I'm having trouble booting into OpenVZ kernel. I do have a bit complicated setup: 64bit Ubuntu on Intel Xeon, RAID1 + LVM. The problem seems to be that initrd made by OVZ install does not include the necessary drivers for LVM. Even if I manually load LVM in Buisybox (like described in this bug: https://bugs.launchpad.net/ubuntu/+bug/147216) the network doesnt work in the booted HW node (network cards are not found -- probably a driver problem).

    Any ideas where I could go with this? One option I guess would be to not put the root (/) on LVM. Maybe this would also magically solve missing NICs. Although I would prefer building a proper initrd, but update-initramfs doesn't seem to do that

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •