Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 39971  / 2 Years ago, tue, march 8, 2022, 12:42:06

This tutorial taught me how to create an Ubuntu Server (12.10, 64-bit) VM in VirtualBox on a Windows 7 host machine, install Apache and have it serve a site from a dummy domain accessible via the host machine's browser.



It took a day and many attempts (although it seemed I was following the instructions as they were laid out, I was always doing something wrong) and I'd finally done it.



I find Ubuntu as a much seamless development environment than Windows, and so I wanted to same thing on Ubuntu. So, this time, I created an Ubuntu Server VM in VirtualBox on Ubuntu host machine, installed Apache and configured it. But when I access the site via the dummy domain, I get the 'Server not found' error.



Yes, I did modify the /etc/hosts file just as mentioned in the tutorial (which is for Windows 7). But I couldn't get it to work. Don't know what's wrong. Anyone know what else I should be doing?



EDIT: If I am not clear enough, please ask. I am willing to clarify.


More From » windows-7

 Answers
4

If you need to allow other machines in your physical network reach your VM or if the VM needs Internet access, use bridged networking. Otherwise, stick to host-only networking.




  1. Stop your VM and open the settings for it in the VirtualBox (OSE) Manager


  2. Go to the Network tab


  3. Select the network mode at your choice (bridged networking or host-only)



    If you want to use bridged networking, you've to select the right network adapter at Name: ____________. For wired connections, you'd select something named like eth0. Wireless connections are usually named wlan0 (the numbers may vary).


  4. Save the settings


  5. Start the Ubuntu VM


  6. When up, you can gather the IP address by running:



    sudo ifconfig


    The output should look similar to this:



    eth0      Link encap:Ethernet  HWaddr 08:00:27:f4:c3:7b  
    inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::a00:27ff:fef4:c37b/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:20 errors:0 dropped:0 overruns:0 frame:0
    TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:3244 (3.2 KB) TX bytes:2512 (2.5 KB)

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)


    In the above output, 192.168.1.4 (on the second line) is the IP address that can be used in your Ubuntu host system to access your VM.


  7. Now open the hosts file in Ubuntu host machine:



    sudo gedit /etc/hosts


    (If you don't want to use gedit, replace the word with the name of your favorite editor. E.g. vim, nano.)



    Once the file is open, add this line, and save it:



    192.168.1.4   my-dummy-site.com

  8. Open any browser on your host machine and go to my-dummy-site.com to access your website, served right from VirtualBox.




( Special thanks to @iSeth for the help. Entirely based on this answer, bit is NOT the same. )


[#34007] Tuesday, March 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
irtuallyefu

Total Points: 429
Total Questions: 97
Total Answers: 119

Location: Hong Kong
Member since Tue, Oct 19, 2021
3 Years ago
;