Results 1 to 10 of 161

Thread: HOWTO: Install VMware Server in Hardy (and later)

Threaded View

  1. #1
    Join Date
    Mar 2006
    Location
    Canada
    Beans
    1,313
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Lightbulb HOWTO: Install VMware Server in Hardy (and later)

    VMWARE SERVER AND UBUNTU HARDY (8.04)

    (by running a script)

    PREAMBLE

    Previous Tutorial (VMware Player)
    My previous tutorial for VMware Player (January 20th, 2007 to May 5th, 2007)
    Feel free to look at it as it has pretty screenshots. It was used for Dapper, Edgy and Feisty, but I stopped updating it (and people stopped using it) because I found VMware Server a far superior product (and much easier to configure).

    Why am a starting a new tutorial?
    With every release of Ubuntu and VMware Server, something always changes (annoyingly). At one time, it was even included in the repositories but that is no longer the case. By compiling the program however, you have more control to customize every aspect of the install and disable any unneeded services (such as NAT and host-only drivers).

    What does this tutorial deal with?
    This tutorial/script deals with installing VMware Server (1.0.5) in Ubuntu Hardy (8.04).


    WHAT IS VMWARE SERVER?
    VMware Server allows you to run multiple operating systems on one computer, for free.


    WHY USE VMWARE SERVER?
    Servers
    I personally use it for separation between my desktop and my personal server. I don't want server services running on my desktop (mail, web, mysql, php, etc.) as it is a security vulnerability. This enables to me to separate them virtually with less of security risk. If someone was to hack into my server, they would be unaware of the host (my desktop).

    Test bed
    In the past I have also used it to install Windows 2000, Windows XP, test future versions of Ubuntu and other operating systems. Use it to play around and have fun!


    KNOWN LIMITATIONS OF VMWARE SERVER

    • USB 2.0 support (coming in VMware Server 2.0). This means your printer may or may not work on the guest/virtual operating system
    • Firewire
    • Limited 3D acceleration (that means no graphically intense programs can run smoothly -- such as games)
    • VMware Server is proprietary, but free. If you're looking for open-source alternatives, see Xen or VirtualBox


    INSTALLING VMWARE SERVER
    VMware Serial Number
    Get it from here: http://register.vmware.com/content/registration.html

    install_vmware.sh (the script)
    Updated: 2008-06-08 (June 8th)

    Quick Note
    I have detection for the .tar.gz files required for VMware and the any-any update to install, so if you already have them downloaded, sit them in the same folder as this script and it will skip the unnecessary download.

    Saving
    Save the script below as install_vmware.sh in your home directory.

    Code:
    #!/bin/bash
    #!/bin/sh
    
    
    # Installs VMware server and applies the any-any patch for Ubuntu 8.04
    # install_vmware.sh
    # Copyright (C) 2008  Brett Alton
    
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    
    # You should have received a copy of the GNU General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    
    # ----- THANKS -----
    # Kokopelli (http://ubuntuforums.org/showpost.php?p=4357442&postcount=10)
    #	base code
    # tamoneya (http://ubuntuforums.org/showthread.php?t=788060)
    #	x86_64 detection
    # Illuvator (http://ubuntuforums.org/showthread.php?t=337040)
    #	VMware install problems
    # http://phaq.phunsites.net/2006/03/17/installing-vmware-server-on-debian-sarge/
    #	VMware Server dependencies
    # p388l3s (http://ubuntuforums.org/showpost.php?p=4989259&postcount=23)
    #	bug reporting
    # Kokopelli (http://ubuntuforums.org/showpost.php?p=4877845&postcount=16)
    #	64-bit library fix
    
    
    # ----- FEATURES -----
    #	* Installs VMware Server 1.0.6
    #	* Installs VMware any any update 116
    #	* Fixes issues for: VMware libraries, 64-bit libraries and USB support
    #	* Does not require the Internet if VMware server and any-any patch are already downloaded
    #	* Cleans up any downloaded files
    #	* The script can successfully install over an existing installation so the user doesn't have to go through any special procedures besides running this script
    
    
    # ----- CHANGELOG -----
    # 2008-06-08
    #	* Removed output supression for wget
    #	* Changed spaces to tabs (how was it even spaces in the first place?)
    # 	* Reverted back to VMware-any-any-update-116 downloading from uruz.org
    # 2008-06-02
    #	* Updated VMware Server to 1.0.6
    #	* Kept VMware-any-any-update at 116 until I read more about 117, 117(2) and 117a
    #	* Now downloading VMware-any-any-update-116 from vmkernelnewbies.googlegroups.com
    # 2008-05-18
    #	* Bug fixes
    # 2008-05-14
    #	* Created a prompt to install GUI libraries when X isn't present (thanks kezarjg!)
    #	* Created separate library install list for 64-bit users
    #	* Added -y flag to aptitude (thanks oraldlight!) -- or should I remove "2>&1 > /dev/null" ???
    # 2008-05-10
    #	* Destroyed stdout (and removed verbosity on 'tar') for a cleaner looking script
    #	* Added more exit status checks
    #	* Added detection for files before downloading
    #	* Removed installing shortcut to "Applications > System Tools > VMware Server"
    # 2008-05-09
    #	* Initial release
    
    
    # ----- TODO -----
    #	* Ubuntu 8.04 detection (?)
    #	* Allow arguments (./install_vmware.sh $1 $2) to allow running just the any-any patch (such as after a kernel update)
    #	* Create fall-back download paths in case the hard-coded ones fail
    #	* Add support for VMware MUI (http://download3.vmware.com/software/vmserver/VMware-mui-1.0.5-80187.tar.gz)
    #	* Add support for VMware Tools
    #	* Create a log?
    #	* Don't hard-code VMware and any-any version numbers (how?)
    #	* Add md5/sha1 download support
    #	* Add /etc/vmware/ssl/ fix (but where and how to implement?)
    
    
    # ----- FUNCTIONS -----
    function print_info()
    {
    	echo " -- $1, continuing..."
    }
    
    function print_warn()
    {
    	echo " ** $1, continuing..."
    }
    
    function force_exit()
    {
    	echo " !! $2, exiting..."
    	cleanup
    	exit $1
    }
    
    function safe_exit()
    {
    	echo " -- Safely exiting..."
    	cleanup
    	exit 0
    }
    
    function cleanup()
    {
    	cd $INIT_DIR
    	print_info 'Removing downloaded and extracted files'
    
    	# Delete VMware tarball?
    	if [ $DELETE_VMWARE_TARBALL -eq 1 ]; then
    		rm -f $VMWARE_TARBALL
    	fi
    
    	# Delete any-any tarball?
    	if [ $DELETE_ANYANY_TARBALL -eq 1 ]; then
    		rm -f $ANYANY_TARBALL
    	fi
    
    	# Delete extracted directories
    	rm -rf $VMWARE_DIR $ANYANY_DIR
    }
    
    
    # ----- VARIABLES -----
    VMWARE_URL='http://download3.vmware.com/software/vmserver/'
    #VMWARE_TARBALL='VMware-server-1.0.5-80187.tar.gz'
    VMWARE_TARBALL='VMware-server-1.0.6-91891.tar.gz'
    VMWARE_DIR='vmware-server-distrib'
    VMWARE_PATH=$VMWARE_URL$VMWARE_TARBALL
    
    # want to upgrade to http://groups.google.com/group/vmkernelnewbies/files
    ANYANY_URL='http://uruz.org/files/'
    ANYANY_TARBALL='vmware-any-any-update-116.tgz'
    ANYANY_DIR='vmware-any-any-update116'
    ANYANY_PATH=$ANYANY_URL$ANYANY_TARBALL
    
    ARCH=`uname -m` # x86_64 or i686
    if [ "$ARCH" == "x86_64" ]; then
    	IS_64=1 # 64-bit
    else
    	IS_64=0 # non 64-bit
    fi
    
    INIT_DIR=`pwd` # current directory
    
    DELETE_VMWARE_TARBALL=1
    DELETE_ANYANY_TARBALL=1
    
    
    # ----- INIT -----
    # Updating Ubuntu
    print_info 'Updating Ubuntu'
    sudo aptitude update 2>&1 > /dev/null
    
    # Check if 'aptitude update' failed
    if [ $? -ne 0 ]; then
    	print_warn 'Could not update Ubuntu. The installation may not working'
    fi
    
    print_info 'Upgrading Ubuntu'
    sudo aptitude safe-upgrade
    
    # Check if 'aptitude upgrade' failed
    if [ $? -ne 0 ]; then
    	print_warn 'Could not upgrade Ubuntu. The installation may not work'
    fi
    
    
    # ----- LIBRARIES -----
    # Installing essential libraries
    if [ $IS_64 -eq 1 ]; then
    	print_info 'Installing essential libraries for 64-bit architecture'
    	ESS_LIBS="xinetd build-essential linux-headers-`uname -r` ia32-libs libc6-i386" # 64-bit
    else
    	print_info 'Installing essential libraries for 32-bit architecture'
    	ESS_LIBS="xinetd build-essential linux-headers-`uname -r`" # non 64-bit
    fi
    sudo aptitude -y install $ESS_LIBS 2>&1 > /dev/null
    
    # Check if 'aptitude -y install' failed
    if [ $? -ne 0 ]; then
    	force_exit 1 'Could not install essential libraries'
    fi
    
    
    # ----- GUI CHECK -----
    print_info 'Checking for essential GUI libraries'
    NEED_GUI_LIBS=0
    GUI_LIBS="libx11-6
    libxtst6
    libxt6
    libxrender1
    libxi6"
    GUI_LIBS_FLAT='libx11-6 libxtst6 libxt6 libxrender1 libxi6'
    for F in $GUI_LIBS; do
    	if [ $NEED_GUI_LIBS -eq 0 ]; then
    		INSTALLED=`dpkg --get-selections | grep $F`
    		if [ "$INSTALLED" == "" ]; then
    			NEED_GUI_LIBS=1
    		fi
    	fi
    done
    
    if [ $NEED_GUI_LIBS -eq 1 ]; then
    	echo ' ?? Essential GUI libraries need to be installed, is this OK? [y/n]'
    	read -n1 RETURN
    	if [ $RETURN == 'y' ] || [ $RETURN == 'Y' ]; then
    		print_info 'Installing extra GUI libraries'
    		sudo aptitude -y install $GUI_LIBS_FLAT 2>&1 > /dev/null
    	else
    		force_exit 1 'Refused to install extra GUI libraries'
    	fi
    else
    	print_info 'Essential GUI libraries already installed'
    fi
    
    
    # ----- VMWARE SERVER -----
    # Download VMware server
    if [ -f $VMWARE_TARBALL ]; then
    	print_info 'VMware already present. Skipping download'
    	DELETE_VMWARE_TARBALL=0 # do not delete if the user put it there
    else
    	print_info 'Downloading VMware server. This may take some time'
    	wget $VMWARE_PATH
    fi
    
    # Check if wget failed
    if [ $? -ne 0 ]; then
    	force_exit 1 "Could not download $VMWARE_TARBALL"
    fi
    
    # Extract VMware server
    if [ -e $VMWARE_DIR ]; then # if the name has already been taken (either file, directory, symbolic link, etc.)
    	print_info 'Extracted directory detected. Deleting for the sake of security'
    	rm -rf $VMWARE_DIR
    fi
    print_info 'Extracting VMware server'
    tar -xzf $VMWARE_TARBALL
    
    # Check if tar failed
    if [ $? -ne 0 ]; then
    	force_exit 1 "Could not extract $VMWARE_TARBALL. Does it exist or is it corrupt?"
    fi
    
    # Change directory
    if [ -d $VMWARE_DIR ]; then
    	cd $VMWARE_DIR
    else
    	force_exit 1 "Could not find $VMWARE_DIR"
    fi
    
    # Install VMware Server
    if [ -f vmware-install.pl ]; then
    	print_info 'Installing VMware server'
    	sudo ./vmware-install.pl
    else
    	force_exit 1 'vmware-install.pl does not exist. VMware server is possibly broken'
    fi
    
    
    # ----- ANY ANY UPDATE -----
    # Change to initial directory
    cd $INIT_DIR
    
    # Download vmware-any-any-update
    if [ -f $ANYANY_TARBALL ]; then
    	print_info 'any-any update already present. Skipping download'
    	DELETE_ANYANY_TARBALL=0 # do not delete if the user put it their
    else
    	print_info 'Downloading the any-any update. This may take some time'
    	wget $ANYANY_PATH
    fi
    
    # Check if wget failed
    if [ $? -ne 0 ]; then
    	force_exit 1 "Could not download $ANYANY_TARBALL"
    fi
    
    # Extract vmware-any-any-update
    if [ -e $ANYANY_DIR ]; then # if the name has already been taken (either file, directory, symbolic link, etc.)
    	print_info 'Extracted directory detected. Deleting for the sake of security'
    	rm -rf $ANYANY_DIR
    fi
    print_info 'Extracting the any-any update'
    tar -xzf $ANYANY_TARBALL
    
    # Check if tar failed
    if [ $? -ne 0 ]; then
    	force_exit 1 "Could not extract $VMWARE_TARBALL. Does it exist or is it corrupt?"
    fi
    
    # Change directory
    if [ -d $ANYANY_DIR ]; then
    	cd $ANYANY_DIR
    else
    	force_exit 1 "Could not find $ANYANY_DIR"
    fi
    
    # Run vmware-any-any-update
    if [ -f runme.pl ]; then
    	print_info 'Running the any-any update'
    	sudo ./runme.pl	
    else
    	force_exit 1 'runme.pl does not exist. any-any update is possibly broken'
    fi
    
    
    # ----- LIBRARY FIX -----
    print_info 'Fixing library issues'
    sudo ln -sf /lib/libgcc_s.so.1 /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1
    sudo ln -sf  /usr/lib/libpng12.so.0 /usr/lib/vmware/lib/libpng12.so.0/libpng12.so.0
    
    
    # ----- 64-BIT FIX -----
    # see: http://ubuntuforums.org/showpost.php?p=4877845&postcount=16
    if [ $IS_64 -eq 1 ]; then
    	print_info '64-bit computer detected. Running 64-bit VMware library fix'
    	sudo ln -s /usr/lib32 /usr/l32
    	sudo sed -i -e 's:usr/lib/:usr/l32/:g'  /usr/lib32/gtk-2.0/2.10.0/loader-files.d/libgtk2.0-0.loaders
    	sudo sed -i -e 's:usr/lib/:usr/l32/:g' /usr/lib32/libgdk_pixbuf-2.0.so.0.1200.9
    fi
    
    
    # ----- USB FIX -----
    USB_FIX_PRESENT=`grep '/proc/bus/usb' /etc/fstab`
    if [ "$USB_FIX_PRESENT" == "" ]; then
    	print_info 'Adding USB support to /etc/fstab'
    	echo 'none /proc/bus/usb usbfs devgid=46,devmode=664 0 0' | sudo tee --append /etc/fstab
    else
    	print_info 'USB fix already present'
    fi
    
    
    # ----- EXIT -----
    # Everything ran fine, exit safely
    safe_exit
    Running
    Code:
    chmod a+x ./install_vmware.sh && ./install_vmware.sh
    Notes:
    You can hit 'enter' for almost all VMware server paths as the defaults work just fine. However, there are some exceptions:

    "/usr/bin/vmware-config.pl" question:
    When you see this for the first time
    Before running VMware Server for the first time, you need to configure it by invoking the following command: "/usr/bin/vmware-config.pl". Do you want this program to invoke the command for you now? [yes]
    Type no. When it appears the second time -- from running the any-any script -- type yes

    Networking
    I usually like to have my virtual machines run on the same network as my host so they get IP addresses like (192.168.1.100). If you want that, enable networking but disable NAT and host-only like so:
    Do you want networking for your virtual machines? (yes/no/help) [yes] yes

    Configuring a bridged network for vmnet0.

    The following bridged networks have been defined:

    . vmnet0 is bridged to eth0

    All your ethernet interfaces are already bridged.

    Do you want to be able to use NAT networking in your virtual machines? (yes/no)
    [yes] no

    Do you want to be able to use host-only networking in your virtual machines?
    [no] no
    Last edited by altonbr; June 8th, 2008 at 11:37 PM.

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
  •