{"id":149,"date":"2013-01-01T10:48:59","date_gmt":"2013-01-01T06:48:59","guid":{"rendered":"http:\/\/blog.mgvmi-hipl.ru\/?p=149"},"modified":"2013-01-01T10:48:59","modified_gmt":"2013-01-01T06:48:59","slug":"virtual-box-%d0%ba%d0%be%d0%bc%d0%b0%d0%bd%d0%b4%d1%8b","status":"publish","type":"post","link":"https:\/\/blog.5flor.ru\/?p=149","title":{"rendered":"Virtual Box \u043a\u043e\u043c\u0430\u043d\u0434\u044b"},"content":{"rendered":"<p>\u041e\u0431\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p>&nbsp;<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c guest-\u043c\u0430\u0448\u0438\u043d\u044b.<\/p>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0430\u043c\u0443 \u043c\u0430\u0448\u0438\u043d\u0443:<\/p>\n<p><code>VBoxManage createvm --name ubuntu --ostype Ubuntu --register<\/code><br \/>\n(name \u2014 \u0438\u043c\u044f \u043c\u0430\u0448\u0438\u043d\u044b, ostype \u2014 \u0442\u0438\u043f \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>VBoxManage list ostypes<\/code>)<\/p>\n<p>\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c<\/p>\n<p><code>VBoxManage modifyvm ubuntu --memory 512 --floppy disabled --audio none --nic1 bridged --bridgeadapter1 eth0 --vram 4 --accelerate3d off --boot1 disk --acpi on --cableconnected1 on --usb off --vrdp on --vrdpport 3390<\/code><\/p>\n<p>\u0442\u0443\u0442 \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0438\u043f\u0430 \u0441\u0435\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 NAT (<code>--nic1 nat<\/code>). \u0442\u0430\u043a\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c rdp<\/p>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u043c hdd \u0434\u0438\u0441\u043a \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b:<\/p>\n<p><code>VBoxManage createhd --filename \/home\/user\/vbox\/ubuntu.vdi --size 20000 --register<\/code><\/p>\n<p>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 IDE \u0432 \u043d\u0430\u0448\u0443 \u043c\u0430\u0448\u0438\u043d\u0443<\/p>\n<p><code>VBoxManage storagectl ubuntu --name \"IDE Controller\" --add ide<\/code><\/p>\n<p>\u0446\u0435\u043f\u043b\u044f\u0435\u043c \u043d\u0430 IDE0 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 hdd<\/p>\n<p><code>VBoxManage storageattach ubuntu --storagectl \"IDE Controller\" --port 0 --device 0 --type hdd --medium \/home\/user\/vbox\/ubuntu.vdi<\/code><\/p>\n<p>\u043d\u0430 IDE1 \u0446\u0435\u043f\u043b\u044f\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437<\/p>\n<p><code>VBoxManage storageattach ubuntu --storagectl \"IDE Controller\" --port 1 --device 0 --type dvddrive --medium \/home\/user\/vbox\/iso\/ubuntu-9.10-alternate-i386.iso<\/code><\/p>\n<p>\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043c\u0430\u0448\u0438\u043d\u0435 \u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u0434\u0438\u0441\u043a\u0430<\/p>\n<p><code>VBoxManage modifyvm ubuntu --boot1 dvd<\/code><\/p>\n<p>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0430\u0448\u0438\u043d\u0443<\/p>\n<p><code>nohup VBoxHeadless --startvm ubuntu &amp;<\/code><\/p>\n<p>\u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f rdp-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c (\u0443 \u043c\u0435\u043d\u044f KDE, \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u0432\u0445\u043e\u0434\u0438\u0442 KRDC). \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0438\u043c\u0441\u044f \u043d\u0430 \u0445\u043e\u0441\u0442\u043e\u0432\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u043d\u0430 \u043f\u043e\u0440\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 (<code>--vrdpport 3390<\/code>), \u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0434\u0435\u043b\u0430\u0435\u043c <code>sudo apt-get install openssh-server<\/code>. \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043f\u043e ssh<\/p>\n<p>\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443<\/p>\n<p><code>VBoxManage controlvm ubuntu acpipowerbutton<\/code><br \/>\n\u0447\u0435\u0440\u0435\u0437 acpi<\/p>\n<p>\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0436\u0435\u0441\u0442\u043a\u043e<\/p>\n<p><code>VBoxManage controlvm ubuntu poweroff<\/code><\/p>\n<p>\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f \u0441 hdd<\/p>\n<p><code>VBoxManage modifyvm ubuntu --boot1 disk<\/code><\/p>\n<p>\u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0446\u0435\u043f\u0438\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0434\u0438\u0441\u043a<\/p>\n<p><code>VBoxManage storageattach ubuntu --storagectl \"IDE Controller\" --port 1 --device 0 --medium none<\/code><\/p>\n<p>\u0438 \u0441\u043d\u043e\u0432\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c<\/p>\n<p><code>nohup VBoxHeadless --startvm ubuntu &amp;<\/code><\/p>\n<p>\u0435\u0449\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p><code>VBoxManage list runningvms<\/code><br \/>\n\u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/p>\n<p><code>VBoxManage showvminfo ubuntu<\/code><br \/>\n\u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435<\/p>\n<p>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 rdp<\/p>\n<p>VBoxManage modifyvm &lt;vmname&gt; &#8212;vrdp on<\/p>\n<p>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439<\/p>\n<p><code>VBoxManage list extpacks<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>\u041d\u0438\u0436\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0431\u0440\u0430\u0437\u0430\u043c\u0438 \u0434\u0438\u0441\u043a\u043e\u0432.<\/p>\n<p>1. \u0417\u0430\u043f\u0443\u0441\u043a \u0433\u0440\u0443\u043f\u043f\u044b \u0433\u043e\u0441\u0442\u0435\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c (\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430):<br \/>\n<code>for M in test1 test2 test3 ; do VBoxManage startvm $M --type=headless ; sleep 30 ; done<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c sleep 30 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0438\u0437-\u0437\u0430 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u0441 \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u043e\u0441\u0442\u0435\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u0448\u0430\u0442, \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u043e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0441 \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430.<\/p>\n<p>2. \u0412\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0433\u043e\u0441\u0442\u0435\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c (\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430):<br \/>\n<code>for M in test1 test2 test3 ; do VBoxManage controlvm $M acpipowerbutton ; sleep 30 ; done<\/code><\/p>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 \u0412\u041c<strong><\/strong><\/p>\n<p>VBOXManage \u00a0modifyhd \u00ab%new_name%\u00bb \u2013resize %new_size%<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0448\u0430\u0440\u044b \u0432 \u0433\u043e\u0441\u0442\u0435\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443<\/p>\n<p>vboxmanage sharedfolder add &#171;vbox_name&#187; &#8212;name install &#8212;hostpath \/install &#8212;automount<\/p>\n<p>vboxmanage sharedfolder remove &#171;vbox_name&#187; &#8212;name install<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0433\u043e\u0441\u0442\u0435\u0432\u044b\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439:<\/p>\n<p>vboxmanage guestcontrol updateadditions &#171;vbox_name&#187; &#8212;source \/usr\/share\/virtualbox\/VBoxGuestAdditions.iso &#8212;verbose<\/p>\n<p>&nbsp;<\/p>\n<h3>ind the IDE Controller device numbers<\/h3>\n<pre>[host] # vboxmanage showvminfo \"vbox_name\" | grep \"Storage Controller Name\"\r\n Storage Controller Name (0):\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IDE controller<\/pre>\n<h3>1b.Get the port and device numbers<\/h3>\n<pre>[host] # vboxmanage showvminfo \"vbox_name\" | grep \"IDE controller\"\r\n IDE controller (1, 0): Empty<\/pre>\n<h3>1c. If not found, add it<\/h3>\n<pre>[host] # vboxmanage storagectl \"vbox_name\" --name \"IDE controller\" --add ide<\/pre>\n<h3>2. Attach the VBoxGuestAdditions.iso as dvddrive<\/h3>\n<p>Port and device numbers needed here!<\/p>\n<pre>[host] # vboxmanage storageattach \"vbox_name\" --storagectl \"IDE controller\" \\\r\n<strong>--port 1 --device 0<\/strong> --type dvddrive \\\r\n--medium \/usr\/share\/virtualbox\/VBoxGuestAdditions.iso<\/pre>\n<h3>3. Mount the DVD drive on Guest OS<\/h3>\n<pre>[guest] # mkdir \/mnt\/dvd\r\n[guest] # mount -t iso9660 -o ro \/dev\/dvd \/mnt\/dvd<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0431\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: &nbsp; \u041d\u0430\u0447\u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c guest-\u043c\u0430\u0448\u0438\u043d\u044b. \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0430\u043c\u0443 \u043c\u0430\u0448\u0438\u043d\u0443: VBoxManage createvm &#8212;name ubuntu &#8212;ostype Ubuntu &#8212;register (name \u2014 \u0438\u043c\u044f \u043c\u0430\u0448\u0438\u043d\u044b, ostype \u2014 \u0442\u0438\u043f \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 VBoxManage list ostypes) \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c VBoxManage modifyvm ubuntu &#8212;memory 512 &hellip; <a href=\"https:\/\/blog.5flor.ru\/?p=149\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/149"}],"collection":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=149"}],"version-history":[{"count":0,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/149\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}