Created
December 16, 2017 01:31
-
-
Save tuxfight3r/1d4c6acd243d9f371ccbfabce88c97ec to your computer and use it in GitHub Desktop.
virtualbox vms without GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum install wget dkms kernel-devel-$(uname -r) kernel-headers-$(uname -r) | |
# Repo (for Debian please look here https://www.virtualbox.org/wiki/Linux_Downloads ) | |
cd /etc/yum.repos.d | |
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo | |
# VirtualBox | |
sudo yum install VirtualBox-4.3.x86_64 | |
# VirtualBox: Setup | |
sudo /etc/init.d/vboxdrv setup | |
wget http://download.virtualbox.org/virtualbox/4.3.14/Oracle_VM_VirtualBox_Extension_Pack-4.3.14-95030.vbox-extpack | |
sudo VBoxManage extpack install ./Oracle_VM_VirtualBox_Extension_Pack-4.3.14-95030.vbox-extpack | |
# Add you username to VirtualBox group | |
sudo usermod -a -G vboxusers teo | |
# New VM | |
VM="Windows7_x64_VM01" | |
VBoxManage createvm --name "${VM}" --register | |
VBoxManage modifyvm "${VM}" --cpus 1 | |
VBoxManage modifyvm "${VM}" --memory 2048 --acpi on | |
VBoxManage modifyvm "${VM}" --ostype "Windows7_64" | |
VBoxManage modifyvm "${VM}" --nic1 nat | |
#VBoxManage modifyvm "${VM}" --nic1 bridged --bridgeadapter1 eth0 | |
# Create HDD | |
FILE=~/"VirtualBox VMs"/"${VM}"/"${VM}".vmdk | |
VBoxManage createhd --filename "${FILE}" --format VMDK --size 102400 | |
VBoxManage storagectl "${VM}" --name "IDE Controller" --add ide | |
VBoxManage storageattach "${VM}" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "${FILE}" | |
# Attach ISO file | |
FILE=~/x.iso | |
VBoxManage storageattach "${VM}" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "${FILE}" | |
# Attach vmdk | |
VBoxManage storagectl "${VM}" --name "IDE Controller" --add ide | |
VBoxManage storageattach "${VM}" --storagectl sata_1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium ./x.vmdk | |
# Useful | |
# List VMs | |
VBoxManage list vms | |
# Remove a VM | |
VBoxManage modifyvm "${VM}" --hda none | |
VBoxManage unregistervm "${VM}" --delete | |
# PowerON | |
VBoxHeadless --startvm "${VM}" | |
# PowerOFF | |
VBoxManage controlvm "${VM}" poweroff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment