Results 1 to 4 of 4

Thread: Can I run LAMP in a virtual machine and access the web server via a browser on the host?

  1. #1

    Default Can I run LAMP in a virtual machine and access the web server via a browser on the host?

    How can I run LAMP (Linux, Apache, MySQL, PHP) in a virtual machine (Ubuntu in virtual box) and make it so the web server is accessible locally (and ONLY locally) on the host OS via an ip address?

  2. #2
    Join Date
    Jun 2008
    Location
    Connecticut, USA
    Posts
    2,294
    Blog Entries
    1

    Default Re: Can I run LAMP in a virtual machine and access the web server via a browser on the host?

    Quote Originally Posted by 6tr6tr View Post
    How can I run LAMP (Linux, Apache, MySQL, PHP) in a virtual machine (Ubuntu in virtual box) and make it so the web server is accessible locally (and ONLY locally) on the host OS via an ip address?
    Would the host OS's firewall override the VM's firewall?

    The IP address would probably be manually set, and I am no network guru (or even noob) but if you use a different subnet than the host I don't know if it would be accessible or not.
    "Linux provides freedom, problem is most users don't know what it is or how to use it." ~me
    Friends don't let Friends wear red shirts on away parties!
    Linux User #477531 | Danbury Area Computer Society (www.dacs.org)

  3. #3
    Join Date
    Jan 2010
    Location
    Canada
    Posts
    33

    Default Re: Can I run LAMP in a virtual machine and access the web server via a browser on the host?

    You can use 'host only' adapter in the virtual box network settings.



    Uploaded with ImageShack.us
    On my machine it's called vboxnet0:

    Code:
    ~> /sbin/ifconfig -a
    vboxnet0 Link encap:Ethernet HWaddr 0A:00:27:00:00:00
    inet addr:192.168.56.1 Bcast:192.168.56.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 b) TX bytes:12361 (12.0 Kb)

    Then it's as simple as ensuring the guests firewall is open (port 80 i'm guessing) and access the guests IP from the host. This IP will be within the vboxnet0 subnet.
    Desktop- AMD Phenom II X4 810 8GB RAM Radeon HD 4790 openSUSE 11.2 x86_64 KDE 4.3.5
    Laptop - Intel 2.27GHz Core i5 M430 6 GB RAM nVidia GeForce 310M openSUSE 11.3 x86_64 KDE 4.5.2

  4. #4

    Default Re: Can I run LAMP in a virtual machine and access the web server via a browser on the host?

    Thanks that worked!

Posting Permissions

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