How do I auto starting a vm?

Discussions related to using VirtualBox on Linux hosts.
Ram
Posts: 10
Joined: 20. Dec 2008, 16:49

How do I auto starting a vm?

Post by Ram »

I'd like to have a vm auto start when my host is rebooted so I don't to login into my server and start it.

Is this possible?

I am running openSUSE11 with the 2.1 VB
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Yes, that is possible. Look into the Manual. Command "VBoxManage".
Ram
Posts: 10
Joined: 20. Dec 2008, 16:49

Post by Ram »

I've had a look in the manual, can't see anything to auto start a VM.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Search manual for "startvm".
Ram
Posts: 10
Joined: 20. Dec 2008, 16:49

Post by Ram »

That only gives me command line options not auto start options.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Write a Script, put the Comand in it and autostart the script via your distro.

There are sveral ways. In Example "/etc/rc.d/boot.local".
Ram
Posts: 10
Joined: 20. Dec 2008, 16:49

Post by Ram »

I was hoping there was easier way.

Cheers Stefan.

Ram.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Not with VirtualBox.

Its a Desktop Product. Your Feature is more like a Server Feature. VMWARE Server can this for example.
s1oan
Posts: 14
Joined: 29. Jan 2008, 14:36

Post by s1oan »

If you're asking for the command to start a vm, try this :
VirtualBox -startvm "name_of_the_virtual_machine"
Ram
Posts: 10
Joined: 20. Dec 2008, 16:49

Post by Ram »

Cheers but no, what I want is an auto (re)start of the VM if the server is rebooted. I don't wish to login to my host for it to run.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

For the start, put this in a script that is executed on boot, so it runs with root privileges.

Code: Select all

su -u <your username> VBoxHeadless -startvm <vmname> -p <vrdp port to listen to>
That should do it, but I can't give you a guarantee that it works. The VM will be accessible through RDP if you want. See VBoxHeadless --help for more info, and the manual too.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Ram
Posts: 10
Joined: 20. Dec 2008, 16:49

Post by Ram »

Cheers I'll give that a try once I've setup the VM as I need it.

Currently having a problem redirecting port 80 to the VM ( no hardware router )
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

Again, it's a Q of reading the manual. You can't redirect ports <1000 on Linux. You need to use an alternative port eg. host:8080 -> guest:80 then browsing host:8080 will get you what you want as long as your guest web service uses site relative addressing.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Ram
Posts: 10
Joined: 20. Dec 2008, 16:49

Post by Ram »

Hi Terry,

I've seen the limitation in the manual. I'm trying to get the host to do the port forwarding.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Still you can't redirect port 80. Some services, even your webbrowser, can rely on this port. Only use ports above 1000, as those are not on the stricktly used 'reserved' ports list.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply