Install virtual machines in CentOS7 Command Line Mode

Source: Internet
Author: User

Install virtual machines in CentOS7 Command Line Mode

1. host environment description:

Operating System: CentOS7

System GUI: None

CPU: Intel4 generation, memory: 16 GB, Hard Disk 1 Tb

Host IP Address: 192.168.0.95 (Intranet)

Services enabled: ssh, ftp, and samba sharing (the shared directory is/var/data/test1 and the permission is read/write)

2. Preparations

Install kvm

[Plain] view plaincopy
  1. $ Sudoyum-yinstallqemu-kvmlib1_virt-installbridge-utilsvirt-install
  2. $ Sudosystemctlstartlibvirtd
  3. $ Sudosystemctlenablelibw.d

3. Add a bridge Nic named br0

[Html] view plaincopy
  1. $ Sudonano/etc/sysconfig/network-scripts/ifcfg-br0
[Html] view plaincopy
  1. DEVICE = br0
  2. TYPE = Bridge
  3. BOOTPROTO = none
  4. ONBOOT = yes
  5. IPADDR = 192.168.0.223
  6. NETMASK = 255.255.255.0
  7. GATEWAY = 192.168.0.1

4. Restart the network

[Plain] view plaincopy
  1. $ Sudosystemctlnetworkrestart

5. Upload the system image to the shared directory/var/data/test1.

Because the samba sharing service is enabled, you only need to enable sharing on other machines in the LAN.

Use "\ 192.168.0.95" in windows"

Use smb in Linux: // 192.168.0.95

You can find

If samba has set user and access permissions, use the corresponding user and password to log on.

Copy the system installation image to/var/data/test

6. Start Installation

[Plain] view plaincopy
  1. $ Sudovirt-install \
  2. -- Name = CentOS7 \
  3. -- Controllertype = scsi, model = virtio-scsi \
  4. -- Diskpath =/var/lib/libvirt/images/CentOS7.dsk, size = 20, sparse = true, cache = none, bus = scsi \
  5. -- Graphicsvnc, listen = 0.0.0.0, port = 5950 \
  6. -- Networkbridge = kvm01 \
  7. -- Vcpus = 2 -- ram = 2048 \
  8. -- Cdrom =/var/data/test1/CentOS7.iso \
  9. -- OS-type = linux \
  10. -- OS-variant = rhel7
Parameter description:

Name ---> Virtual Machine name

Disk path -----> virtual hard disk storage path with any suffix

Size -----> virtual hard disk size (in G)

Port -----> vnc port

Vcpus ---> Number of system kernels

Ram ------> running memory

Cdrom ----> Installation Package location

OS-variant -----> because CentOS is based on Redhat, it corresponds to its version

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.