Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old May 9th, 2008   #1
altonbr
Fresh Brewed Ubuntu
 
altonbr's Avatar
 
Join Date: Mar 2006
Location: Canada
Beans: 1,216
Ubuntu 9.10 Karmic Koala
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
Quote:
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:
Quote:
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
__________________
Tutorials: rsync and ssh
Website: brettalton.com
Articles: FCM #20, FCM #21, FCM #22, FCM #23

Last edited by altonbr; June 8th, 2008 at 06:37 PM..
altonbr is offline   Reply With Quote
Old May 10th, 2008   #2
TwiceOver
Way Too Much Ubuntu
 
Join Date: Sep 2005
Location: Watertown, SD
Beans: 221
Ubuntu 9.04 Jaunty Jackalope
Send a message via Yahoo to TwiceOver
Re: HOWTO: Install VMware Server in Hardy (and later)

Thanks! Worked great. Now I can dump VirtualBox.
TwiceOver is offline   Reply With Quote
Old May 10th, 2008   #3
hlarsick
First Cup of Ubuntu
 
Join Date: Dec 2006
Beans: 1
Re: HOWTO: Install VMware Server in Hardy (and later)

WOW what a awesome post. All I did was copy the script and ran it, and it got everything it needed and now my VMware is back

Thanks
hlarsick is offline   Reply With Quote
Old May 10th, 2008   #4
altonbr
Fresh Brewed Ubuntu
 
altonbr's Avatar
 
Join Date: Mar 2006
Location: Canada
Beans: 1,216
Ubuntu 9.10 Karmic Koala
Re: HOWTO: Install VMware Server in Hardy (and later)

Excellent!

Do either of you happen to be using 64-bit Ubuntu? I have a line in their to make a fix for 64-bit Ubuntu, but sadly, I can't test it.

Thank you again for trying my script
__________________
Tutorials: rsync and ssh
Website: brettalton.com
Articles: FCM #20, FCM #21, FCM #22, FCM #23
altonbr is offline   Reply With Quote
Old May 10th, 2008   #5
altonbr
Fresh Brewed Ubuntu
 
altonbr's Avatar
 
Join Date: Mar 2006
Location: Canada
Beans: 1,216
Ubuntu 9.10 Karmic Koala
Thumbs down Re: HOWTO: Install VMware Server in Hardy (and later)

Updated.

It now:
  • Looks prettier
  • Does more status checks to make sure everything is running smoothly
  • Added detection for already downloaded tarballs (so the script doesn't download them for you)
  • General bug fixes... wait, what bugs?
__________________
Tutorials: rsync and ssh
Website: brettalton.com
Articles: FCM #20, FCM #21, FCM #22, FCM #23
altonbr is offline   Reply With Quote
Old May 12th, 2008   #6
kezarjg
First Cup of Ubuntu
 
Join Date: Jul 2007
Beans: 1
Re: HOWTO: Install VMware Server in Hardy (and later)

For my configuration (minimalist server install), I needed some additional libraries;

libx11-6
libx11-dev
libxtst6
libxt6
libxrender1

You may want to consider updating the script to check for these files and add if necessary.

Thanks
kezarjg is offline   Reply With Quote
Old May 12th, 2008   #7
altonbr
Fresh Brewed Ubuntu
 
altonbr's Avatar
 
Join Date: Mar 2006
Location: Canada
Beans: 1,216
Ubuntu 9.10 Karmic Koala
Re: HOWTO: Install VMware Server in Hardy (and later)

Quote:
Originally Posted by kezarjg View Post
For my configuration (minimalist server install), I needed some additional libraries;

libx11-6
libx11-dev
libxtst6
libxt6
libxrender1

You may want to consider updating the script to check for these files and add if necessary.

Thanks
Thank you, I'll look into it. My script so far only automates the task of setting up VMware, the any-any update and a couple other fixes, its not (yet) meant to make sure VMware WILL install. It is a good idea though, so thank you again.

I'll setup a Ubuntu server in VMware and test my script there.
__________________
Tutorials: rsync and ssh
Website: brettalton.com
Articles: FCM #20, FCM #21, FCM #22, FCM #23
altonbr is offline   Reply With Quote
Old May 12th, 2008   #8
jharrop
Spilled the Beans
 
Join Date: May 2007
Beans: 12
Re: HOWTO: Install VMware Server in Hardy (and later)

Quote:
Originally Posted by altonbr View Post
Excellent!

Do either of you happen to be using 64-bit Ubuntu? I have a line in their to make a fix for 64-bit Ubuntu, but sadly, I can't test it.

Thank you again for trying my script
Thanks for the script..

I've just run it (as normal user) on a freshly installed 64-bit Hardy. The script finishes with:

Code:
The configuration of VMware Server 1.0.5 build-80187 for Linux for this running
kernel completed successfully.

 -- Fixing library issues, continuing...
 -- 64-bit computer detected. Running 64-bit VMware library fix, continuing...
 -- Adding USB support to /etc/fstab, continuing...
none /proc/bus/usb usbfs devgid=46,devmode=664 0 0
 -- Safely exiting...
 -- Removing downloaded and extracted files, continuing...
Vmware wasn't running properly, so i stopped it, then:

Code:
$ sudo /etc/init.d/vmware start
VMware Server is installed, but it has not been (correctly) configured
for the running kernel. To (re-)configure it, invoke the
following command: /usr/bin/vmware-config.pl.
After running vmware-config.pl again, the services start properly:

Code:
$ sudo /etc/init.d/vmware start
Starting VMware services:
   Virtual machine monitor                                      done
   Virtual ethernet                                             done
   Bridged networking on /dev/vmnet0                            done
But VMware Server Console won't start. There's nothing in the logs to indicate the problem.

I can't look into this more right now .. I'll have another look on the weekend and report back. I have had VMware Server running on another Hardy before, so hopefully it'll be easy enough to get running.
jharrop is offline   Reply With Quote
Old May 13th, 2008   #9
altonbr
Fresh Brewed Ubuntu
 
altonbr's Avatar
 
Join Date: Mar 2006
Location: Canada
Beans: 1,216
Ubuntu 9.10 Karmic Koala
Exclamation Re: HOWTO: Install VMware Server in Hardy (and later)

@ jharrop:

I found some threads that suggested a couple extra libraries for 64-bit users. I will update it today for you to test again. You should be able to run the script a second time with no problems.
__________________
Tutorials: rsync and ssh
Website: brettalton.com
Articles: FCM #20, FCM #21, FCM #22, FCM #23
altonbr is offline   Reply With Quote
Old May 14th, 2008   #10
oraldlight
5 Cups of Ubuntu
 
Join Date: Sep 2007
Beans: 18
Re: HOWTO: Install VMware Server in Hardy (and later)

Fresh 8.04 x86_64 Ubuntu install. All updates ran via Update manager. D/L'd VMware-server-1.0.5.80187.tgz, vmware-any-any-update-116.tgz, and created the isntall-vmware.sh script, in /home/jkein.

Open Terminal, type
Code:
jklein@jk-laptop:~$ sudo /bin/bash install-vmware.sh 
[sudo] password for jklein: 
 -- Updating Ubuntu, continuing...
 -- Upgrading Ubuntu, continuing...
 -- Installing necessary programs, continuing...
and that's all it did. For better than 30 minutes...

I tried launching again and same results...just sits at installing.

Rebooted, tried with and without 'sudo', it's just not completing. I hesitate to go comment out parts of your script for fear of uncertainty (I don't program, but see the logic/flow of events)

Suggestions?
====================
Manually created the kernel and reran installer - finished installing.
I ended up manually running VMware isntaller, any-any installer and got it working. DOn't understand why I manually had to, but working now.

Last edited by oraldlight; May 14th, 2008 at 03:21 PM.. Reason: solved
oraldlight is offline   Reply With Quote

Bookmarks

Tags
host, virtual, virtual machine, vmware, vmware server

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:48 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry