Install CentOS v6.5 in VirtualBox and mount the data disk

Source: Internet
Author: User
Tags server website centos server oracle vm virtualbox vm virtualbox

Install CentOS v6.5 in VirtualBox and mount the data disk
Preparations:

Download the latest version of Oracle VM VirtualBox (download link)
Download CentOS6.5 Server Version System (download link)
Download Xshell (SHH logon software) and Xftp (FTP software) (download link)

Download and install VirtualBox

The installation process is not detailed here. Just like installing other WINDOWS software, download the installation package and double-click it to run. Next, you can proceed, do not install the software in a directory containing a Chinese path.
After installation, run the software. First set the global settings of the software, and set the storage location of the Virtual Machine. As for whether to update the software or not, set it according to your preferences.
Operation
Double-click desktop icon

Start Software
On the software page, click "manage" in the menu and select "global settings ",

Set the VM storage location (that is, the directory in the hard disk) in the settings panel ),

Create a CentOS 6.5 VM

On the VirtualBox software interface, click Create to create a VM.

Set the Virtual Machine name and system type, and click Next:

Set the VM memory size and click Next;

Select "create virtual hard disk now" and click "CREATE;

Select "VDI" as the hard disk file type and click Next;

Select "Dynamic Allocation" and click Next;

Set the storage location and size of the virtual hard disk file, and click Create (if the storage location is not set here, the file is stored in the directory we set in "global settings" by default );

Now we can see that the virtual machine we just created has been added to the Virtual Machine list on the left side of the software interface, as shown in.

Set CentOS 6.5 Virtual Machine

In the virtual machine list shown in the previous figure, select the created virtual machine and click "set". The virtual machine settings panel is displayed, and the following settings are performed in sequence:
1. on the "advanced" tab of the general settings, select the "display at the top of the screen" toolbar;

2. on the "main board" tab of the system settings, deselect the soft drive check. On the processor tab, set "Number of processors" to 2;


3. Attach the system ISO image file CentOS6.5 to the VM drive in the storage settings;



4. Set Nic 1 to "bridge Nic" in network settings, and select the NIC you are using as the interface Name (for unlimited Internet access, select wireless Nic, for wired Internet access, select the network card for you to plug in the network cable. If this option is incorrect, you cannot use the SHH software to log on to the CentOS server, not to mention accessing the server .)

Install CentOS 6.5

After setting the virtual machine, start the CentOS virtual machine we just created in the Virtual Machine list on the VirtualBox software interface, enter the CentOS6.5 system installation interface, click the mouse in the installation window to start CentOS system installation; (that is, start to operate the virtual machine system. To exit the mouse operation on the virtual machine, just press the "ctrl" key on the right of the keyboard)

Select the first item in the installation list, and press enter to check whether the image is installed,

Right-click and select "skip", and press enter to enter the graphic installation interface;


Click Next, select "simplified Chinese", and click Next,

Select the American English style as the keyboard, and then click Next;

Select "basic storage device" and click Next;

Select "Yes, ignore all data"

Enter the server host name, click "configure network" in the lower left corner, select the NIC, and click Edit,


Check "Automatic Connection", set IPV4, and select "Manual" to add IP addresses, subnet masks, gateways, and DNS. The settings here should be in the same network segment as the NIC you are using, IP addresses cannot conflict;

Note: If the network environment of the physical machine changes in the future, you also need to modify the network configuration of the CentOS Virtual Machine System. Otherwise, you will not be able to continue with the orientation of the Virtual Machine server)
After setting the IP address, click application. On the Application page, click "Next", select "Shanghai" as the server time zone, and click "Next;

Enter the root user logon password and click Next. The system prompts you to use the password no matter what you want to do. The next step is displayed;


Select to use all spaces and click Next;

Click "Write changes to disk"

The system is officially started. After a few minutes, you will be prompted to complete the installation and restart the system.



Click "reboot" to restart the system. After the restart, you can log on to the system as the root user. If there is no problem, run the "halt" command to shut down the Virtual Machine. Then, attach the data disk to the virtual machine.



Add data disks to virtual machines

Open the VM settings panel again, and add a data disk to the VM according to the following in the storage settings:






Mount a data disk

Run xshell Software

Click the create button, and enter the name and IP address of the server to be connected in sequence (for example, if I name the virtual machine the site name "smurphet sharing alliance", you can set a name for your virtual machine ), enter the IP address we set when installing the centos system. The default port is 22. Then, click User Authentication, enter the login name toot and the configured password, and then confirm, you can see the shortcut link in the session window. In the future, you only need to open the xshell software and double-click the link to directly connect to our centos server. Operation:




Double-click the link to our centOS server. A prompt will be displayed at the first link. Click "accept and save". This prompt will not be displayed in the future.

When we see # And the cursor, it means we have logged on to our CentOS server using xshell.

* ************ The commands mentioned in the following content refer to the content in the middle of double quotation marks, it does not contain double quotation marks *************
1. View partition information
Before partitioning and formatting a data disk, you cannot view the data disk by running the "df-h" command. You can run the "fdisk-l" command to view the data disk. For example:


Tip: If you run the fdisk-l command and find that there is no/dev/sdb (or similar characters, because some VPS or ECS hardware configurations are different, the data disk name will be different), which means that your ECs does not have a data disk, so you do not need to attach it. you can skip the data disk mounting tutorial, directly go to the server environment installation tutorial)
2. partition data disks
Run the "fdisk/dev/sdb" command to partition the data disk;
Enter "n", "p", "1", "press ENTER", "press ENTER", and "wq" as prompted. The partition starts, it will be completed soon (please note that there are two carriage returns in the middle ).


3. view the new partition
Use the "fdisk-l" command again to see that the new partition sdb1 has been created.


4. format the new partition.
Run the mkfs. ext3/dev/sdb1 command to format the new partition. The formatting time varies with the disk size. (You can also choose ext4 format on your own)


5. Add partition information
If you want to install the WDCP system later as the server website management system, you need to create a loading point first.
"Mkdir/www"
If you use lumanager as the server website management system, you do not need to create a load point.
You can run the "cd/" and "ls" commands to check whether the directory of the load point already exists.

If WDCP is used, use the following command to add partition information after creating a load point:
"Echo '/dev/sdb1/www ext3 defaults 0 0'>/etc/fstab"
"To use lumanager, directly use the following command to add partition information"
Echo '/dev/sdb1/home ext3 defaults 0 0'>/etc/fstab

Run the "cat/etc/fstab" command to view the information.

6. mount a new partition
Run the "mount-a" command to mount the new partition and run the "df-h" command to view the new partition. The following information indicates that the partition is successfully mounted and you can start using the new partition.


The advantage of separating system disks from data disks is that all files and databases on the website are stored on the data disks. Once a system problem occurs, the system disk cannot be checked. You can reset the system disk and reconfigure the environment, data disk files are not affected.

Add a step to modify the system language as follows:
Copy and paste the command line "vi/etc/sysconfig/i18n" and press ENTER

Press the "insert" key twice on the keyboard to copy and paste the content.
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"




Press ESC, enter ": wq", and press Enter.

Exit and log on again. Run the date command to check whether Chinese characters are displayed normally.



Now, this tutorial is here. I will continue to provide you with tutorials on configuring the php site building environment in CentOS.

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.