Install Ubuntu Virtual Machine in virtualbox, implement file sharing, Internet access, internal network access on the host machine, and install MySQL source code in Ubuntu

Source: Internet
Author: User

Zhou has not installed a Linux Virtual Machine for fun. The final effect is as follows,

1) The host is win7

2) install a Linux system (Ubuntu selected) and WINXP on the guest Machine

3) directories can be shared between hosts and guest machines;

4) Intercommunication between the host and the guest. The Guest machine can access the Internet (you need to reset the settings before restarting)

5) Try to reinstall MySql in guest-ubuntu (source code installation );

Purpose:

During this period, I encountered many problems. I checked some information from the Internet. When I encountered a similar problem for myself and someone in the future, I can refer to it and sort it out as follows:

Procedure:

1) download
Virtualbox-Ubuntu Virtual File, recommended site: http://virtualboximages.com/

2) In vitrualbox, add the corresponding VDI file;

3) choose vitrualbox Manager> Manage> global Settings> network, add virtualbox host-Only Ethernet adapter (virtualbox host-Only Ethernet adapter will display the network settings of the host machine after virtualbox is installed), as shown in, click OK;

4) In the guest machine settings of virtualbox manager, click Settings> data space to set and select a directory on the host machine for sharing, as shown in:

5) It is relatively simple to set the shared directory with the host in WINXP. the settings for starting Win XP Guest are as follows:

6) install the shared directory in virtual-ubuntu,

6.1) Select Nat network settings and virtual images (select the Virtual Machine enhancement feature package image file, which is generally in the vboxguestadditions. ISO directory of your virtualbox installation directory ),

Start virtual-Ubuntu to ensure that Ubuntu has Internet access permissions;

6.1.1) the possible settings are as follows, mainly to ensure that the Network passes through

  • Ifconfig-
  • Notice the first Ethernet Adapter ID. It shocould be "Eth? "
  • Edit the file at/etc/Network/interface. Change the adapter from "eth0" to the adapter ID in the previous step
  • Save the file
  • Sudo/etc/init. d/networking restart

6.2) install GCC and other related packages in Ubuntu: The command is as follows:

sudo apt-get install build-essential linux-headers-$(uname -r)

6.3) install the Virtual Machine enhancement package in virtual-Ubuntu

Mount/etc/CDROM/Media/CDROM

Sudo/Media/CDROM/VBoxLinuxAdditions-x86.run

6.4) Run

Sudo Mount-T vboxsf upload data/Media/shared

In this way, you can access Shared Files Through/Media/shared;

 

7) install MySQL source code in Ubuntu

7.1) in the host machine, download MySQL source code: http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.31.tar.gz
7.2) and put the MySQL package under the shared directory. By setting the shared directory in step 6, you should be able to access it in Ubuntu;

7.3) install cmake; Apt-Get install cmake

7.4) install MySQL

Shell> groupadd MySQL
Shell> useradd-r-g MySQL
# Beginning of source-build specific instructions
Shell> tar zxvf mysql-VERSION.tar.gz
Shell> Cd mysql-version
Shell> cmake.

Or cmake-dcmake_install_prefix =/usr/local/mysql-5.5.10 \
Shell> make
Shell> make install
# End of source-build specific instructions
# Postinstallation setup
Shell> Cd/usr/local/MySQL
Shell> chown-r MySQL.
Shell> chgrp-r MySQL.
Shell> scripts/mysql_install_db -- user = MySQL
Shell> chown-r root.
Shell> chown-r Mysql Data
# Next command is optional
Shells> CP support-files/my-medium.cnf/etc/My. CNF
Shell> bin/mysqld_safe -- user = MySQL & (start)
# Next command is optional
Shell> CP support-files/MySQL. Server/etc/init. d/MySQL. Server

For more installation information, see install-source 2.10.1. MySQL layout for source installation in the MySQL source code extraction directory.

7.5) view the installation directory of MySQL

View mysqladmin-u root-P Variables

Root is your database account
After you press enter, you will be prompted to enter the password and the password of the account entered above

Press enter to create a large table and find the datadir line. The value behind it is the path of the database.

8) Intranet and Internet access network settings:

8.1) Virtual Machine Access to the Internet: at startup, the network connection mode is set in NAT (Note: At this time, the host and virtual machine cannot access each other)

8.2) mutual access between hosts and virtual machines: at startup, the network connection mode is set to host-only (Note: At this time, the virtual machine cannot access the Internet, and each virtual machine and host form a LAN, and the host's IP address is like)

Set the IP address of the vitual-box adapter on the host as shown in the following figure:

The network settings of virtual machines are as follows:

Virtual-box-related Virtual Machine network is set to virtualbox host-Only Ethernet adapter, and then start, a key point of this setting is: both Windows and Linux IP address must be set to a fixed IP address.

The static IP Address Settings on Virtual Machine XP are as follows:

 

The setting of the static IP address of Ubuntu is as follows:

 

Summary: 1) there will be an error message during each step of the operation. Read the relevant information and check what is missing. The GCC is missing for the downloaded ubuntu, linux-headers cmake and other related tools can be easily installed online.

2) read the README and installation instructions of the relevant installation files in advance;

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.