Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed CentOS as a virtual box os under my osx host, and have been trying to use it as a local web server, but I've run into some problems.

First, I want to establish that I've installed apache, mysql, and php properly using yum. Now, those of you familiar with virtual os's, how do I access my centos virtual os through my osx host. It does not show automatically in my osx network. I tried ifconfig in centos, but I got a weird ip or something, and that does not work.

I just want to know what I should do next to setup my virtual os as a network drive.


share|improve this question

migrated from Feb 16 '12 at 14:02

This question came from our site for system and network administrators.

What virtualization software are you using? You need to configure it for bridged networking (sounds like it's configured for NAT right now). – Chris S Feb 16 '12 at 14:02
I'm using VirtualBox – Adam Feb 16 '12 at 14:12
up vote 0 down vote accepted

First you need to get the virtual server on your LAN. If you shut down the VM and go to the settings, you can set the network to bridged. When it boots up again you should see the IP address similar to your Mac. I would expect something like 192.168.x.y.

Once that is done, check you can ping the VM from your Mac on the CentOS IP.

Now to test apache works, open http://centos IP

To test PHP is working with apache you will need to create a file in the document root of you web server on CentOS. This will be /var/www unless you have changed it. Create a file index.php and put the following inside


echo "I am PHP";

Now visit http://centos IP/index.php and you should see "I am PHP".

To test that mysql support is available for php, edit the PHP file again and add

mysql_connect( 'root', '', 'localhost' );

Open http://centos IP/index.php again, and if you get an error saying cannot connect, then mysql support is working, if you get an error about function mysql_connect doesn't exist you need to install php-mysql using Yum.

You can use samba or nfs to share a folder on your CentOS machine to make it available as a network share.

share|improve this answer
Thanks. It worked. – Adam Feb 16 '12 at 19:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .