Create Mac with Virtual box

http://www.macbreaker.com/2012/07/mountain-lion-virtualbox.html

 

How to install OS X Mountain Lion in Virtualbox with Hackboot

We’ve already shown you how to use Virtualbox to install Mac OS X Snow Leopard and Mac OS X Lion on virtual machines in Windows, since it’s great practice for installing Mac OS X on your actual computer. And now that OS X Mountain Lion 10.8 has been officially released, we can finally demonstrate how to do it with Mountain Lion too.


LATEST UPDATE (January 27, 2013): Don’t want to use Hackboot? Check out the simpler iAtkos method for installing Mountain Lion on Virtualbox instead.

In essence, this method will let you run Mac OS X from inside a program window in Windows. As always, we’re going to use Virtualbox for this. It’s important to note that Windows virtualization programs do not “officially” support Mac OS X, so you will not be able to enable full graphics support. This tutorial should only be taken as a proof of concept.

Computer Requirements

You need a computer with Windows to run Mac OS X on Windows (of course). The “System Type” of your copy of Windows needs to be 64-bit, because OS X Mountain Lion is a 64-bit operating system. If you have a 32-bit copy of Windows, you can only install Mac OS X Snow Leopard on Virtualbox. You will need at least 4 GB of RAM and a dual-core (two core) processor or better. Personally, the computer I was using for this had a 4-core processor and 12 GB RAM, which is way more than enough. You also need about 10 GB of unused hard drive space.

Right click on “My Computer” on your desktop and click “Properties” to check the stats on your computer. If it doesn’t directly tell you how many cores your processor has, look up your processor model on Wikipedia or Google. You also want to find out whether your processor is made by “Intel” or “AMD”. Computers with AMD processors will not work with Mountain Lion. 

General Requirements

    • Virtualbox : This virtualization suite is free, and though it doesn’t offer official support for Mac OS X, it works well enough.
    • Mountain Lion bootable DVD : Unfortunately, the standard method for installing OS X Mountain Lion on PCs(which uses a paid copy of the Mountain Lion installer) doesn’t work with Virtualbox. Instead, you’ll have to rely on pirated “bootable DVD” copies of Mountain Lion, also known as “distros”. I won’t go into details, but you can download these copies from about any bittorrent website by using a bittorrent client (it’s about 4.5 GB in size). In the past, we’ve used the iAtkos distro for this, but iAtkos hasn’t updated for Mountain Lion yet, so I used the “OS X 10.8 Mountain Lion bootable DVD for Intel PCs”, by Olarila.
    • Hackboot 1 / Hackboot 2: Even though it’s called a “bootable DVD”, the Olarila version of OS X Mountain Lion still can’t boot in Virtualbox by itself. To help Mountain Lion start, you’ll need to use Olarila’s Hackboot CD. There are three different versions of Hackboot; we’ll need to use two of them in this guide. “Hackboot 1” is for starting the Mountain Lion installer, while “Hackboot” 2 is for starting Mountain Lion itself.
  • Multibeast 4.6.1 : You will need to use Multibeast 4.6.1, our favorite Hackintosh post-installation tool, to set up the Mountain Lion virtual machine after the initial installation. While Multibeast 4.6.1 is an old version designed for Mac OS X Lion instead of Mountain Lion, in our case, it actually works better than newer versions of Multibeast. Registration is required on the tonymacx86 website to download this.

Step 1: Prep

Download Virtualbox, install it, and open it up. Also, if you want to be able to view USB devices from your OS X Mountain Lion virtual machine, download the Virtualbox Extension Pack and run it before going to Step 2.

Step 2: Create a new virtual machine.

Virtualbox lets you run Mac OSX within Windows by creating a virtual machine, which is a program that simulates a normal computer.  To create a virtual machine, open up Virtualbox and click “New” on the upper left. Give your new virtual machine a name, and choose “Mac OS X” for the OS Type.

If your version of Virtualbox asks you to choose between 64-bit and 32-bit, be sure to choose 64-bit. Choosing 32-bit will result in a critical “Guru Meditation” error later on.

I recommend assigning 4 GB of RAM to the virtual machine, but you can assign as little as 2 GB of RAM. Every time you turn on Mac OS X, that RAM that you assign here will be used to run the virtual machine. The RAM will be given back to your normal computer after you turn Virtualbox off.

You’ll need to create a new hard disk for the virtual machine. Virtualbox will ask you what type of disk you want to create: VDI, VDMK, or VHD. VDI is the original format for Virtualbox, while VDMK is the format used by VMWare. If you’re considering getting a copy of VMWare, you might want to choose VDMK. Otherwise, just choose VDI. I recommend creating a dynamically expanding disk; the only other option, fixed-size storage, will eat up your hard drive.

Step 3: Give your new virtual machine an operating system.

Your virtual machine will now be created. But don’t stop now–you still need to change a few settings before your machine will actually work. Your new virtual machine will show up on the left column of the Virtualbox start page.  Select your Mac OS X virtual machine (single-click) from the main page of Virtualbox, and open up the virtual machine settings. Once the settings open up, go to “System” and uncheck the “Enable EFI” box. This is by far the most important single setting that you will need to change.

EFI, which stands for Extended Firmware Interface, is a feature that helps operating systems start up. Unfortunately, Mac OSX requires ‘speshul’ EFI, so the EFI that Virtualbox uses doesn’t work.

Once you’re done with that, go to the settings for “Storage”. In the storage tree box, you’ll see a CD icon labeled “Empty”. Click on it and click “Choose a virtual CD/DVD disk file”. In the window that pops up, choose the .iso file for Hackboot 1 (download below).

DOWNLOAD: Hackboot 1

This way, when your virtual machine starts for the first time, it will boot into Hackboot.

Step 4: Install OS X Mountain Lion

Start up your virtual machine. You will come up to the Hackboot boot screen, with a CD icon labeled “HackBoot” in the middle. Don’t do anything yet.

Your mouse cursor will probably be trapped inside the virtual machine. Press the right “Ctrl” key on your keyboard to allow your mouse to escape. Then, at the bottom right of the virtual machine screen, right-click on the little CD icon, and click “Choose a virtual CD/DVD disk file”. A Windows Explorer window will pop up; from there, select the OS X 10.8 Mountain Lion bootable DVD.

Click back into the Hackboot screen, and press the “F5” key on your keyboard. This will refresh Hackboot. The CD icon in the middle of the Hackboot screen will now say “OS X Install DVD”. Press the enter key on your keyboard. You will then enter the Mac OS X installer page.

Continue, and you will eventually come up to a page that asks you for a “destination” for your Mac install. Oh no, the page is blank! We’ll have to fix that. To do this, start up Disk Utility (located under the Utilities menu).

Mac OSX can only be installed on a completely clean disk, so you need to use Disk Utility to wipe your Virtualbox hard disk. Click on the Virtualbox hard disk in Disk Utility and erase it. Don’t worry, there’s nothing important on it.

On the installation page for Mac OSX, the Virtualbox hard disk should now be showing up. Select it and continue.

Once that’s done with, Mac OSX will install itself. This will take at least 20 minutes.

When the installation finishes, Mac OS X will crash into a black screen with white text. This is normal; Mac OS X has installed successfully. Now proceed to the next step.

Step 5: Boot it up

Again, press the right Ctrl key to allow your mouse to escape from the virtual machine screen. Then, click on the CD icon in the bottom right of the virtual machine. This time, choose the .iso file for Hackboot 2 (download below).

DOWNLOAD: Hackboot 2

Restart your virtual machine. You’ll see the Hackboot screen once more, except there will be an icon for your virtual machine’s hard drive in the middle.

Select it (use the arrow keys on your computer) and press “Enter”. Mountain Lion will boot, and you should eventually be led to the Mac OS X setup screen. Fill it out, and you’ll finally be led to the Mac OS X desktop.

This concludes the first part of the guide. However, you’re not done yet! You still have to make your virtual machine bootable without the help of Hackboot.

Step 6: Fix it up

By default, your ethernet (internet) should work in the virtual machine. However, the virtual machine will not have sound, or be able to boot from the hard drive without help. To fix this, open Safari, and download Multibeast 4.6.1While Multibeast 4.6.1 is an old version designed for Mac OS X Lion instead of Mountain Lion, in our case, it actually works better than newer versions of Multibeast. Registration is required on the tonymacx86 website to download this.

DOWNLOAD: Multibeast 4.6.1

Before starting Multibeast, you have to go the “Security” section of System Preferences in Mac OS X, go to the “General” section, and check “Anywhere” in the “Allow applications” section. Once that’s done, run Multibeast and install the following options (contrary to popular belief, you do not need an actual DSDT file to use UserDSDT).

Next, you’ll have to delete a certain kext file in your hard drive that causes boot errors. You can do this from Finder, the file browser built into Mac OS X. However, Finder hides your hard drives in Mountain Lion by default. To unhide them, open Finder, and click on File -> Preferences in the menu bar at the top of Mac OS X. Under the “Sidebar” settings, check “Hard disks”, so that Finder will display your virtual machine’s hard disks in the sidebar.

Then, go to your main hard drive, and go to /System/Library/Extensions. Inside the Extensions folder, delete the fileAppleGraphicsControl.kext.

This completes the post-installation process for your virtual machine. Eject the Hackboot CD; you can do this by right-clicking the CD icon at the bottom right of your virtual machine, and unchecking Hackboot. Then, restart your virtual machine. Mac OS X will now be able to boot normally and play audio. Congratulations!

Step 7: Make the screen bigger

Though this step is optional, I still recommend you do it anyways. Anyways, when you first use your Mac OS X, you’ll probably notice one thing: your screen resolution is 1024×768. Since Virtualbox doesn’t “technically” support Mac OS X, there’s no official way to change this. But here’s how you can change it anyways:

Open up Finder and go to the folder “Extra” in the main hard drive, and open the file org.Chameleon.boot.plist. Between <dict> and </dict> in the file, insert the following line.

<key>Graphics Mode</key>

<string>1920x1080x32</string>

You can change “1920x1080x32” to whatever resolution best fits your monitor. For instance, if you want to use the 1600×900 resolution, type in “1600x900x32”. Once you’ve saved it, turn off the virtual machine.

Next, open the Command Prompt in Windows (make sure you are logged into an Administrator account on Windows). You can do this by opening the Start Menu, and typing “command prompt” into the Start Menu search bar. Then, type the following command into the Command Prompt.

cd “C:\Program Files\Oracle\Virtualbox”


This command will change the focus of the Command Prompt to the program folder for Virtualbox (if you installed Virtualbox somewhere different, then change the command to wherever you installed it). Next, type in this command:

vboxmanage setextradata “Name of virtual machine” “CustomVideoMode1” “1920x1080x32”


This command activates “vboxmanage”, a command-line program included with Virtualbox that allows you to edit the properties of your virtual machine, including its built-in resolutions. Replace “Name of virtual machine” with the name of your virtual machine– you can find the name of your virtual machine in the left pane of the Virtualbox main window (in the screenshot below, my virtual machine is named “Mountain Mac 2”). Replace “1920x1080x32” with whatever resolution you’re using.

Press the enter key to submit the command. Once that’s done, start your virtual machine again. It will now boot in full resolution. Congrats!

Recap

I’ll just repeat what I said in my other two Virtualbox guides. Installing Mac OS X on a virtual machine is excellent practice for the real thing: installing Mac OS X on your actual computer. Don’t get too comfortable, though. Compared to most computers, Virtualbox virtual machines are very “vanilla”, meaning that they’re very compatible with Mac OS X in the first place. You can’t count on being that lucky with a real PC.

And even if you don’t plan on doing this for real, with a Hackintosh, it’s still a really cool thing to try out over the weekend.

 

Advertisements

Deploying PHP and ASP.NET Sites in a Single Azure Web Role

Origin:http://blogs.msdn.com/b/silverlining/archive/2012/02/07/deploying-php-and-asp-net-sites-in-a-single-azure-web-role.aspx

 

Deploying PHP and ASP.NET Sites in a Single Azure Web Role

Last week, a colleague approached me with a question he’d been asked by a customer: How do you deploy both a PHP website and an ASP.NET website on the same Web Role in Windows Azure? Given the mixed environments many people work with today, I thought sharing the answer to his question might be helpful to others. However, unlike many of my other posts, the particular solution I’m going to share requires Visual Studio 2010 with the .NET SDK for Windows Azure installed. It should be possible to deploy both sites without Visual Studio…I just haven’t investigated that approach yet. (I will speed up that investigation if I hear clamoring for it in the comments.)

A couple of things before I get started…

First, I highly recommend that you watch this episode of Cloud Cover from minute 9:00 to minute 28:00: Cloud Cover Episode 37: Mulitple Websites in a Web Role. Even though the video looks at how to deploy multiple .NET websites, it contains just about all the information you need to deploy websites of mixed flavors. The video will provide context for the steps below…all I do is fill in a couple of minor details. (Big thanks to Steve Marx for helping me figure out the details.)

Second, before you build, package and deploy your applications, I suggest you do a little preliminary work. First create an empty Hosted Service on Windows Azure to provision the domain name for your ASP.NET website (e.g.mysite.cloudapp.net). Then, create a CNAME record for the domain name of your PHP site (e.g.http://www.myphpsite.com)  that points to your Azure domain name (mysite.cloudapp.net). (I’m assuming you have a domain name, like http://www.myphpsite.com, registered already.) You can do these steps later, but doing them in advance makes the process below clearer.

Now you’re ready to get started…

1. Create a Windows Azure project with Visual Studio. You will be prompted to add a Web Role in this process. Choose any ASP.NET Web Role (I chose an ASP.NET MVC 3 Web Role). Click OK to accept default settings through the rest of the process.

2. Open the service definition file (ServiceDefinition.csdef). Add a <Site> element similar to the one below to the<Sites> element. (There will already be one <Site> element that corresponds to your ASP.NET site. This one will correspond to your PHP site.)

<Site name="YourSiteName" physicalDirectory="path\to\your\PHP\app">
  <Bindings>
    <Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="www.yourdomain.com" />
  </Bindings>
</Site>

Note that you need to fill in values for the the namephysicalDirectory, and hostHeader attributes. The value for thename attribute is somewhat arbitrary, but the physicalDirectory attribute should point to your local PHP application, and the hostHeader value should be the domain name for your PHP application.

3. While you have the service definition file open, add the following <Startup> element right after the <Sites> element.

<Startup>
      <Task commandLine="add-environment-variables.cmd" executionContext="elevated" taskType="simple" />
      <Task commandLine="install-php.cmd" executionContext="elevated" taskType="simple" >
        <Environment>
          <Variable name="EMULATED">
            <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
          </Variable>
        </Environment>
      </Task>
      <Task commandLine="monitor-environment.cmd" executionContext="elevated" taskType="background" />
</Startup>

These startup tasks will install PHP and configure IIS to handle PHP requests when you deploy your applications. (We’ll add the files that are referenced in these tasks to our project next.)

Note: I’m borrowing the startup tasks and the referenced files from the default scaffold that you can create by using the Windows Azure SDK for PHP.

4. Add the files referenced in the startup tasks to your ASP.NET project. (The necessary files are in the .zip file attached to this post). When you are finished, you should have a directory structure that looks like this:

image

4a. For all the start up scripts (not files in the resources directory), you’ll need to set the Copy to Output Directoryproperty to Copy always. You can do this in the Properties window for each file (right click on a file and select Properties):

5. If you want to run your application using the Compute and Storage Emulators, you need to edit your hosts file (which you can find by going to Start->Run, and typing drivers – the hosts file will be in the etc directory). Add this line to the hosts file:

Now, press Ctrl+F5 (or select Start Without Debugging) to run your application in the emulator.

image

You should see your site brought up at http://127.0.0.1:81. If you browse to http://www.myphpsite.com:81, you should see you PHP site.

6. When you are ready to deploy your app, you can use the Visual Studio tools: http://msdn.microsoft.com/en-us/library/windowsazure/ff687127.aspx#Publish. After publishing, you should be able to browse to mysite.cloudapp.net to see your ASP.NET application, and (assuming you have set up a CNAME record for your PHP site) and browse to http://www.myphpsite.com to see your PHP site.

That’s it…hope this proves useful.

Thanks.

-Brian

startup_scripts.zip