Debian Lenny+Wine+VirtualBox Tutorial

Discussions related to using VirtualBox on Linux hosts.

Debian Lenny+Wine+VirtualBox Tutorial

Postby TestMAD » 8. Apr 2008, 22:47

*************************************
First off, this is not an Ubuntu tutorial. Don't ask how to do something in this tutorial in Ubuntu. This tutorial may work for certain versions of Ubuntu, but don't ask me how to do it.

Second, this is not a dual-boot tutorial. If you follow this tutorial exactly as I have it, YOU WILL LOSE ALL DATA ON THE INSTALL DRIVE. If you end up losing important data because you skimmed over this, then it's your own fault. Learn to read everything and make sure you understand it before you do it.
*************************************


Over the years I've played around with many different Linux distro's and versions of BSD. While I enjoyed it and wanted to make a switch, I felt that I couldn't. Like many, I use Windows applications for my day to day living. I have 2 of the most common problems for people wanting to switch from Windows to Linux. I run Adobe software and I like to game. Wine, a native implementation of win32 API's, was an option. After using it, the performance just wasn't there for me. The bugs didn't help either. There's also the fact that not all Windows applications will run with Wine. Luckily new software for linux allows people like me to make the switch.

The distro we will be using in this tutorial is Debian Lenny which is currently in the testing branch. We will also use Wine for Steam and install Counter Strike: Source. For productive software, we will install VirtualBox. VirtualBox is similar to products like VMWare and Parallels. It will allow us to run Windows XP inside a virtual machine where we can install additional software for productivity. We will also enable desktop integration, apply an icon theme and Windows theme to make the virtual machine blend in well with Gnome. Your hardware requirements might need to be a bit hefty to pull this off, although 3-4GB of RAM should be considered the minimum amount of RAM.

My current hardware for this tutorial:
EVGA 690i Motherboard
Intel E8400 Processor
8GB DDR2
EVGA 8800GTS 512
500GB Sata2 Drive
Multi-Burner Sata2

*Note: The E8400 is a 64bit CPU, however, we will be running 32bit linux. The nice part is though, we will be able to take advantage of the massive amount of RAM by using the bigmem kernel. The bigmem kernel is for 32bit machines with more than 4GB of RAM.

*Note2: The virtual machine will be given direct physical access to a partition formatted NTFS. I did this so that any data stored by the virtual machine would not be lost by me doing something stupid like deleting the image file or breaking my system and having to reinstall Debian or VirtualBox.

The tutorial is broken into sections:

Getting Debian
Installing Debian
Editing and installing Synaptic
Installing the first round of packages
Locking libgnomevfs2
Additional packages
Skype install
Nvidia video drivers install
Wine/wine-doors install

VirtualBox install and setup
Windows XP install and setup
Windows Theme
Networking setup
Shared folder setup
Desktop integration

******************
* Getting Debian *
******************

So, First step is to get the current Debian Lenny Beta CD.

Get it here: http://cdimage.debian.org/cdimage/lenny ... 6-CD-1.iso

We only need the first CD to get an install completed. You may ask why we are using a full CD instead of the Netinstall CD. It's because of current work being done in the Debian testing branch. There are certain packages we don't want to upgrade right now that can cause small annoyances. Using a Netinstall CD will install these newer packages that we don't want.

Burn the iso to a CD and reboot. If you need to set your BIOS to boot from CD, do so now.


*********************
* Installing Debian *
*********************

Once you are in the Debian Installer, select your language, locale, and KB layout. Next, set your hostname, domain name, and time zone. Now you should be at the Partition disks menu. You can select Guided - use entire disk or Manual. For this tutorial I will choose Manual so that I can create a small partition for our virtual machine. So we select our hard drive and create a new empty partition. Then we select that partition. The partitioning program will ask "How to use this free space:". Select "Create a new partition". The size of the partition you create is up to you, but in my case it will be 363 GB. Select "Primary" for the type and "Beginning" for location. All we have to do on the next menu is set the bootable flag to "on". Now, select "Done setting up the partition". Next, select the rest of the free space and create a new partition. This will be a "swap" partition. The size of your swap partition will vary, but for me I'm going to set the size at 2.5 GB. For type, select "Logical" and then "Beginning". Change "Use as:" to swap area. Then select "Done setting up the partition". Now select the last bit of freespace and create a new partition. The size should be whats left on the hard drive. The type will be Primary. Chane the "Use as:" to "do not use the partition". Select "Done setting up the partition" and then "Finish partitioning and write changes to disk". Select "Yes" to make the changes and the base system will begin to install. After this, set your Root password, name for the new user account, and the password for the new user. The next screen will ask if you want to scan anther CD or DVD. Just select No. When it asks to use a network mirror, select No. Choose if you want participate in the survey or not. The next screen is "Software selection". Press the spacebar on "Desktop environment" to place a * next to it. Then press the spacebar on "Standard system" to remove the * next to it. Select Continue. It's going to retrieve packages from the Cd and install them. Select Video modes by pressing the spacebar next to the resolutions you want to use. I only use 2. When asked to install GRUB, select Yes. Then your CD/DVD tray will open. Remove the CD, close the tray and select Continue. Your PC will reboot. After your computer boots back up, you will get a boot menu. Just wait and it will begin to load Debian. You will eventually get to a Welcome screen. Type in your username, then the password. Welcome to your new Gnome Desktop.


***********************************
* Editing and installing Synaptic *
***********************************

This is where the fun begins. Let's first edit our sudoers file. Open a Terminal (Applications > Accessories > Terminal).

In a Terminal, type:
su

You will be asked for the Root password. Type it in and press enter.

Next, Type:
nano /etc/sudoers

Press the down arrow to go to the end of the file.

You'll see this as the last line:

root ALL=(ALL) ALL

Add a new line underneath it:

Type:

username ALL=(ALL) ALL

Username would be the name of your regular user account. Then press CTRL+O, <Enter>, and then CTRL+X. You should be back at the root prompt.

Now we will edit the apt sources list. This is the list that tells apt where it's able to look for installable packages. In this case, we're going to point it to some locations that host packages that we need for this project.

In Terminal Type:
nano /etc/apt/sources.list

Edit your sources.list to look like this:

deb http://ftp.debian.org/debian lenny main contrib non-free
deb http://www.debian-multimedia.org lenny main
deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://ftp.debian.org/debian lenny main contrib non-free

Remove the lines referring to deb cdrom. Then CTRL+O, <return>, and CTRL+X.

Now we will update apt and install Synaptic, which is a graphical front-end for apt.

Type:
apt-get update

You will receive a "GPG error". Don't worry about it. It'll get fixed soon.

Type:
apt-get install synaptic

This will install synaptic. Press y and <enter> when it asks if you want to continue. Now close our Terminal window.


******************************************
* Installing the first round of packages *
******************************************

In your Desktop, go to System > Administration > Synaptic Package Manager. Enter the Root password and click OK. Then close the quick introduction window after reading it. Click on Search, type in bigmem, then search. You'll be given a list of packages to choose from. Right click on linux-image-686-bigmem, click "Mark for install", then click on "Mark". You'll notice 3 packages were selected for install. Now right click on linux-headers-2.6-686-bigmem, "Mark for install", then click "Mark" again. This time we are adding lots of packages. Click on Search, type in "build-essential", then search. Right click on build-essential, Mark for install, and then Mark. Do one last search for "debian-multimedia", and mark the package for installation. Next click on Apply or the big green check mark. Then click on Apply again. When it's done, click Close, then close Synaptic. Time to reboot. The GRUB menu will come up with the 686-bigmem kernel already set as default and will continue to boot into Debian. Login and we should be back at the desktop.


************************
* Locking libgnomevfs2 *
************************

Open up Synaptic again. Do a search for "libgnomevfs2". You'll notice in the results that there are 4 packages that have green box with a star on it next to them. The green box means they are installed. The star means there is an update for it. Remember at the beginning of the tutorial I mention certain packages causing an annoyance? Well, those are the ones. So highlight "libgnomevfs2-0". Press and hold shift and click on "libgnomevfs2-extra". Now that we have all 4 of the libgnomevfs packages that are installed selected, click on "Package" (Next to Edit and Settings), and select "Lock Version". This will prevent these packages from being updated. Finally click on Mark All Upgrades and then Apply so they will install. Now you have a choice. We can continue with the system with its currently-installed packages, or we can bring it up to par with what a Netinstall would have. Since I like the packages I would get with a Netinstall, I will make that the next section. If you want, you can skip over it.


***********************
* Additional packages *
***********************

Our Debian install in its current state is somewhat bare. Lets add some things to it that may come in useful. We're going to add them in steps. I've noticed that sometimes Synaptic forgets what I want it to do. Open Synaptic and search for "OpenOffice.org". Scroll down the results and mark openoffice.org for install. Do another search for "update". Select "update-manager" and "update-notifier" for install. Then Apply to install. Next search for "Gimp" and mark it for install. After that, do a search for "sun-java". Mark "sun-java6-bin", "sun-java6-fonts", and "sun-java6-plugin" for install. Then Apply to install. Now for the last few packages. Search for "rhythmbox" and mark it for install. Search for "pidgin" and mark it for install. Search for "flashplayer-mozilla" and mark it for install. Hit Apply to install these last few packages. At this point you should have a system similar to what you would get with a Netinstall. Lets finish this section off with a reboot.


*****************
* Skype install *
*****************

Open up iceweasel. It's in under Internet in the Gnome menu. Just do a google search for skype. Click on the Download link. We want the Debian Etch Binary. Save it to disk. Now open Terminal (Applications > Accessories > Terminal).

Type:
cd Desktop/
sudo dpkg -i sky<TAB>

You should notice that you've got a long filename there now. <TAB> is useful for us because it autocompletes names in Terminal. Press <Enter>. Enter the correct password. You will then get errors. This is expected, and should be ignored.

Type:
sudo apt-get -f install

Press y and <Enter> to accept. This will begin to install the packages that were missing and install skype. You can delete the Skype install file on your desktop now.


********************************
* Nvidia video drivers install *
********************************

Open iceweasel and go to www.nvidia.com. Click on Download Drivers. Scroll down to a section called "Other Drivers". Select Linux, FreeBSD, and Solaris Drivers. Select the driver version you need under the Linux IA32 section. For me it is 169.12. Save it to disk. In order to install the Nvidia binary driver we must be Root and *not* running an X session. So go to System in your Gnome menu and select Logout. Now you should be back at the Login screen. Press CTRL+ALT+F1. We should now be at Console. Login as root.

Now Type:
/etc/init.d/gdm stop

This will stop GDM and allow us to install the Nvidia binary.

Type:
cd /home/username/Desktop/

This would be a good time to use <TAB> to autocomplete. So much for needing to type an overly-descriptive filename!

Type:
sh N<TAB>

Accept the license. The screen will then say that there is no precompiled kernel interface, and would we like to try to download one. Select Yes. It will say there was no matching kernel. Select OK. Then it will say "The CC version check failed:". This is fine. Select No. It should begin building and install. Let it make changes to your xorg.conf file. When you are done we've got to start GDM again.

Type:
/etc/init.d/gdm start

Now we should be back at our login screen. Go ahead and login.


***************************
* Wine/wine-doors install *
***************************

Now we are going to install Wine and wine-doors. Open up Terminal.

Type:
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -

This will add GPG key to our list of trusted apt keys. Now let's add the Wine repository to our sources.

Type:
sudo wget http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list


Now lets update apt-get and then install Wine.

Type:
sudo apt-get update
sudo apt-get install wine

Press y and <enter>. Now we need to configure Wine.

Type:
winecfg

The only thing to make sure of is that Wine is using the ALSA sound drivers. So click on the Audio tab of the Wine configuration windo and make sure ALSA is checked. Everything else in Wine is configured the way we want it. Click Apply then OK and close Terminal. Now open iceweasel and go to www.wine-doors.org. Click on Downloads and right-click Debian/Ubuntu DEB, Save Link As, then save. Now open Terminal again.

Type:
cd Desktop/
sudo dpkg -i wi<TAB>

Now close Terminal. Open Wine-Doors (Applications > System Tools > Wine-Doors). Fill in your name, company name, and if you got a valid Windows license check the box. Click Proceed. It will begin to install some applications for you. After a few minutes you will be presented with a menu full of Windows applications. Scroll down to Tahoma Fonts and click install. This will add it to an install queue. Click Apply. It will install Tahoma Fonts now and take you back to the menu. Scroll further down to DirectX 9. You can install this if you want, but we will be using DirectX 8.1 for Counter Strike:Source. So at this time it's not needed. Scroll further down to Steam 1. Click install and Apply. Install Steam as you normally would. Close Wine-Doors. Now open up Steam (Applications > Wine > Programs > Steam > Steam). Login and install Counter Strike: Source. When it's installed, right-click on it and click on Launch Options.

Type:
-dxlevel 81

Click Ok. So now you can go play for a bit before moving on to the next section. If you have problems running Steam or Counter Strike: Source, consult the wine forums.

********************************
* VirtualBox install and setup *
********************************

VirtualBox is the key for my switch from Windows to Linux. This is how I'm able to run Photoshop and Illustrator to continue making a living. First off we want to open iceweasel and go to www.virtualbox.org. Click on Downloads, then Binaries (all platforms). Scroll all the way down and set Debian 4.0 i386 as the platform, agree to their license, and continue. This next page has the download link. Save the file to the Desktop. At this point, I'll point out that there is an open source version that you could get instead. So onto the install. Open Terminal.

Type:
cd Desktop/
sudo dpkg -i v<tab>

Press <enter> and you will get an error. Once again, ignore it. It's fine.

Type:
sudo apt-get -f install

Press y and <enter>. You'll come to something saying "Configuring Virtualbox". Select OK. Then it says something about being unable to find a precompiled module. Just select OK. Then it will ask if the module should be compiled. Select Yes. After a minute or so, you'll get back to a prompt. Now we want to add our user to the Vboxuser group.

Type:
sudo usermod -G vboxusers -a username

This will add us to the vWindows Themeboxusers group. In order to use a physical partition, we need to add ourselves to another group.

Type:
sudo usermod -G disk -a username

This adds us to the disk group. Let's go ahead and get something with apt-get since terminal is open.

Type:
sudo apt-get install mbr

This will install an application we will need to help create a VirtualBox image that will link to our physical partition. Let's go back to our home directory for these next commands.

Type:
cd ..
pwd

Make sure it says /home/username for the output of the last command. Open a Root Terminal(Applications > Accessories > Root Terminal). Enter the root password. In our Root Terminal we have to run a command to create an MBR.

Type:
install-mbr --force winxp.mbr

This will make the file winxp.mbr. Close the Root Terminal. Go back to our Terminal window. This next command creates the image file that will link to our physical partition. If you followed my partitioning directions at the beginning of the tutorial, the partition we are going to use will be on hda3 or sda3. If it's not one of those, then you would change the -partitions 3 flag to something else, where 3 is the number of the partition. If the partition you wanted to use is on sda5 then the flag would be -partitions 5. You may also need to change /dev/sda to /dev/hda depending on your hardware. Run this command as user NOT root. Remember to modify it where needed.

Type:
VBoxManage internalcommands createrawvmdk -filename /home/username/XPSP2.vmdk -rawdisk /dev/sda -partitions 3 -relative -mbr /home/username/winxp.mbr -register

Now would should have an image made. Let's verify that we have the correct files in our directory now.

Type:
ls

There should be winxp.mbr, XPSP2-pt.vmdk, and XPSP2.vmdk. If these are there, then we can move on. If not you did something wrong somewhere. Trace your steps back to find out where it was and work your way back to here. So, moving on. Lets run VitualBox. It's under Applications > System Tools > innotek VirtualBox. Read through the agreement and then click I Agree. Next it will ask for a name an e-mail. Go ahead and fill it in. Click the little box under there to not receive and e-mails from them then click Confirm and OK. Click on New, Next, fill in a name for the virtual machine and set OS type to Windows XP. Set your base memory size. In my case i maxed it out to 2GB. Click Next. Then click Next again. You'll get a pop-up about not attaching a hard disk. It fine, select Continue then Finish. Now click on settings. The first category we are on is General>Basic. Adjust your video memory. 1013a5dMine is set for 128. Then click on the Advanced tab. If you have a CPU that supports Virtualization, click on the Enable VT-x/AMD-V option till the box fills in. It's 2 clicks for me. Now click on the Hard Disks category on the left. and fill in the box next to Primary Master. It should have our image that we made earlier already in there. If not, click the folder and browse for it. Make sure that under "XPSP2.vmdk (/home/username)" it has "Writethrough", and a size there. The size will be the size of your entire drive. This is fine. Click on the CD/DVD-ROM category on the left. Fill in the box next to Mount CD/DVD Drive. Then pick either the Host CD/DVD Drive and Enable Passthrough options or ISO Image File. I previously created an ISO of my WinXP cd earlier, so I will select ISO Image File and browse for my ISO image of XP. Now, if you wish to have audio, click on Audio on the left. Fill in the box next to Enable Audio, then for Host Audio Driver pick ALSA Audio Driver. You can also enable USB if you wish. I didn't, so I wont cover that here. Should be simple enough to figure out though. We're also going to leave Network alone for now. It should work. Now just click OK at the bottom. Now for the moment of truth. Click on Start. If everything went well you should now be booting into Windows Setup.


********************************
* Windows XP install and setup *
********************************

The only important thing here is to make sure you install XP on the correct partition. Just look at the sizes of the partitions to figure out the right one. Format it NTFS Quick of course. Once done with the first part of the install unmount the XP ISO in VirtualBox during the reboot. Finish installing XP as normal. Once installed, do all the updates and install any applications you want.

*****************
* Windows Theme *
*****************

I know that this part is trivial, but you can do it if you want everything to kind of blend in. In the XP virtual machine go to http://vertigosity.deviantart.com/art/T ... 2-27940418 and download the Tango Patcher. Then go to http://schmoove.deviantart.com/art/Clea ... P-18591720 and download Clearlooks for XP. Now to get the last file. Go to http://www.llbbl.com/2005/12/22/customi ... th-themes/ and download Neowin UXTheme Multi-Patcher v4.0. First we run the UXTheme Patcher. Follow the directions on the download site if you have trouble. Then we install the Tango Patcher. Now reboot the XP virtual machine. Once back up, extract the Clearlooks theme to WINDOWS\Resources\Themes. Now just right-click on the XP desktop and select properties. Click on the Appearance tab. Set Windows and buttons to ClearLooks. Set Color scheme to ClearLooks Default Blue. Font size should be Calibri(10). Now you should have a very Gnome like Windows desktop.


********************
* Networking setup *
********************

If you don't need the XP virtual machine to access network shares or feel the need to setup a shared folder that both Debian and Windows can use, skip this and go on to Desktop integration. So on to networking. Power off the XP virtual machine. Open up Terminal.

Type:
sudo apt-get install bridge-utils

Now we are going to edit our network interfaces file.

Type:

sudo nano /etc/network/interfaces

Now we add to the end of the file.

Type:
#VBox interface bridge
auto br0
iface br0 inet dhcp
bridge_ports eth0

Save then exit. Now restart networking.

Type:
sudo /etc/init.d/networking restart

Now we add the Host Networking Interface to VirtualBox.

Type:
sudo VBoxAddIF vbox0 username br0

Now we want to go the innotek VirtualBox application and click on Settings. Then click on Network to the left. Then change "Attached to" from NAT to Host Interface. Now we fill in the Host Interface Settings. Type vbox0 in the Interface Name field. Now click OK. Reboot your Debian PC. Once back up, power up the XP virtual machine. The new virtual network card should be detected and started. Now just setup your network like you normally would on any other Windows machine.


***********************
* Shared folder setup *
***********************

Now in order to use this we need to install VirtualBox Guest Additions. Turn on the XP virtual machine. At the top of the virtual machine window, you'll see a menu option called Devices. Click on it and click on Install Guest Additions. This will cause an installer to pop-up in the XP virtual machine. Install it. When you get the warning about an unsigned driver, select Continue Anyway. Now you select Devices at the top of the virtual machine window. Then click shared folders. A new window will come up. Highlight Machine Folders, then click on the folder icon with a + on it. Let's share our Desktop. So on Folder Path we will put /home/username/Desktop. Now go into the XP virtual machine and click on Start > Run.

Type:
cmd

This will open a console window. Now we need to "mount" the share.

Type:
net use x: \\vboxsvr\Desktop

This will create a networked folder for XP. Close the console window. Go look in "My Computer" and you will see it. This next step is optional. You can do it if you want. Go to Start > Run.

Type:
Regedit

Navigate to the following location.

HKEY_CURRENT_USER > Software > Microsoft > Windows > CurrentVersion > Explorer > User Shell Folders

Look for the key “Desktop” and change the value to:
x:

Now exit Regedit and reboot the XP virtual machine.


***********************
* Desktop integration *
***********************

This last part is very easy. You need to have the VirtualBox Guest Additions installed on your XP virtual machine. Press your Host Button + L or at the top of the virtual machine window click on Machine, then Seamless Mode. Done. If you installed the ClearLooks and Tango Icons for XP you should have something that is truly seamless.

I would encourage anyone who reads and follows this tutorial to read the documentation and list of known bugs for Skype, VirtualBox, and Wine. They might help you. Also, as I was writing this tutorial I became aware of VMWare Workstation 6.5 Beta. I'll more than likely install it and see how it compares to VirtualBox. If I think it's a suitable replacement, I'll add it to this tutorial along with VirtualBox that way you can choose which to install.


I know that this tutorial was long. I covered a lot of topics in it. At least now they are all in one place and others won't have to google the entire internet to find all the answers they need. Enjoy.
TestMAD
 
Posts: 1
Joined: 8. Apr 2008, 22:45

Postby Super Jamie » 24. May 2008, 11:21

I signed up just to say thanks for writing this awesome tutorial, it covers all the stuff I (and I suspect, alot of other people) would want to do under Lenny. Awesome work!
Super Jamie
 
Posts: 2
Joined: 24. May 2008, 11:17

Postby Super Jamie » 26. May 2008, 14:45

Also, to install the nVidia driver, i had to
apt-get install build-essential module-assistant

then
m-a prepare

before the nVidia .run file could compile its kernel wrapper module.
Super Jamie
 
Posts: 2
Joined: 24. May 2008, 11:17


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: Google [Bot] and 22 guests