mac VirtualBox virtual machine installed CentOS, and configure the network so that it can access the release of static websites

1. Download VirtualBox (macOS version)

Download: https: //

2. Download CentOS 7 iso

Domestic Ali cloud image download will be faster


Select the corresponding version, I chose 7.6.1810 version, and then select isos directory




Choose to download according to demand, trapping is the full version, the following are the seeds, all the same

3. Install iso file on virtualBox

Click New




All the way to determine the point

Click Start, select just download a good iso file, then click start, wait for the installation

Enter the installation interface


Exclamation point will have the option to go to handle it, then click Done. Start the installation, and set the root password for future login, you can click the account was created on the right of their own


Click restart to complete the installation

Enter the newly created username and password

The completion of landing



4. Set Network

Select the corresponding virtual machine, click Settings, select Network

Link Options: bridge card

Interface Name: according to their own way to select the corresponding network links network

Their machines is the choice of Wi-Fi Wi-Fi

The machine is to choose an ordinary Ethernet network cable

Then save, enter the virtual machine

cd /etc/sysconfig/network-scripts/


we ifcfg-enp0s3 

Here the network file is different for each person's machine, will generate a different file name suffixes, looking in front of the beginning ifcfg-

The ONBOOT changed ONBOOT = yes

Enable card, save the changes

Restart Network

service network restart

And then view the virtual machine's ip address

ip addr

Where is this virtual machine ip address, we can access it via ip address in the machine









The firewall and the corresponding port (default all ports are closed)

Check firewall status command

systemctl status firewalld.service

You can see the status of the firewall is turned on

Check back open port command

sudo firewall-cmd --list-all

Where the port is empty, that does not open any ports

We add a http port 80 into

sudo firewall-cmd --add-port=80/tcp --permanent

sudo firewall-cmd --add-service=http --permanent

Reboot the firewall, configure it to take effect

sudo firewall-cmd --reload


Check the firewall port information again, you can see more than 80 tcp port port

sudo firewall-cmd --list-all



 6. Try to publish a static website above (refer ) thanks

Install apache server (httpd that is apache)

yum install httpd

Wait for the installation to complete, which options are selected y, then use  way to create an index.html page (apache by default retrieved using this page) you can own created index.html page into them, and then start the httpd service

Access to other machines on the LAN

cd / var / www / html

echo 'hello lxp'>index.html

sudo service httpd start



Then we will be able to access the web page virtual machine ( on other machines within the LAN


Guess you like