5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

KVM CentOS6.4 仮想マシン最小インストールスクリプト

Posted at
create_kvm.sh
# !/bin/bash

function main(){

    local NAME=$1

    if [ -z ${NAME} ]
    then
        echo $0 [NAME]
    else
        create_img ${NAME}
        create_kvm ${NAME}
    fi
}

function create_img(){

    local NAME=$1

    qemu-img create -f qcow2 /var/lib/libvirt/images/${NAME}.img 10GB
}

function create_kvm(){

    local NAME=$1

    virt-install \
    --connect qemu:///system \
    --name=${NAME} \
    --ram=512 \
    --disk path=/var/lib/libvirt/images/${NAME}.img \
    --vcpus=1 \
    --os-type=linux \
    --os-variant=virtio26 \
    --network bridge=br0 \
    --nographics \
    --accelerate \
    --hvm \
    --location=http://ftp.riken.jp/Linux/centos/6.4/os/x86_64/ \
    --extra-args='console=tty0 console=ttyS0,115200n8'

}

main ${@}
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?