You are not logged in.

#1 2011-04-10 20:13:56

BlackArts
Member
Registered: 2011-01-28
Posts: 23

[solved]Virtualbox as developement server

Hi, I'm currently on windows for a short period of time because I have to do some asp and I hate to dualboot. (I've applied for Microsoft web-start contest tongue $) Now, off with excuses and to the point. I was checking node.js recently and thought it would be cool to fiddle around with it a bit, and at that time I came to idea, why not use VirtualBox to simulate me connecting to some linux server from windows (arch server of course wink).

I've found some posts on how to do that, but I really don't have slightest idea how webserver is supposed to work (alright, I do have some idea but faint one...), and most of those articles seem outdated (I think something changed in virtualbox).

I've done some reading and decided I would try nginx instead of usual apache, so currently my top priority is to

  • Install arch on virtualbox

  • Install nginx

  • Put sample html helloworld page and access it from my host os (win7) - possibly by just typing http://localhost/ or something like http://127.0.0.1/

I already installed arch and setup ngnx following wiki, third point is most problematic smile

So, if someone have some good reading/paper/blog on this topic that is current, or did this him self I would appreciate some pointers/answers.

Thanks guys.

Last edited by BlackArts (2011-04-11 19:44:25)

Offline

#2 2011-04-10 20:25:38

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved]Virtualbox as developement server

Node.js is already a webserver itself, so you actually only need to install Arch and Node and you're good to go. You have to configure Virtualbox to use NAT-networking, so that it gets it's own ip-adress from your router. Then you can simply connect to that ip address from anywhere in your network.


ᶘ ᵒᴥᵒᶅ

Offline

#3 2011-04-10 20:33:46

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

I was actually thinking to use php as well so if I understand I would still need nginx or apache?

Offline

#4 2011-04-10 20:34:38

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved]Virtualbox as developement server

BlackArts wrote:

I was actually thinking to use php as well so if I understand I would still need nginx or apache?

Yes in that case you would need one of those. smile


ᶘ ᵒᴥᵒᶅ

Offline

#5 2011-04-10 20:44:57

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

Sorry for bugging this much, but node.js and nginx wouldn't interfere with each other? And shouldn't I maybe use bridged adapter rather than nat (+ I don't get my virtual pc listed in my rooter cpanel)?

Offline

#6 2011-04-10 20:48:35

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved]Virtualbox as developement server

No problem BlackArts. NAT is usually the easiest to set up and to reach the VM from other computers on your network, so i would advise to use that. Here is a bit of the official Virtualbox documentation on NAT for reference: http://www.virtualbox.org/manual/ch06.html#network_nat

Node.js can use any port that you choose, so interfering with another webserver won't be an issue.


ᶘ ᵒᴥᵒᶅ

Offline

#7 2011-04-10 20:49:14

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: [solved]Virtualbox as developement server

litemotiv wrote:

You have to configure Virtualbox to use NAT-networking, so that it gets it's own ip-adress from your router. Then you can simply connect to that ip address from anywhere in your network.

Actually NAT does the opposite: It simulates a NAT behind the IP of the host computer. It has a port-forward option but I have never used it. The bridged network option is the one that creates a virtual interface on the host that lets any computer on the network connect to the guest.


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#8 2011-04-10 20:55:10

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved]Virtualbox as developement server

Cdh wrote:
litemotiv wrote:

You have to configure Virtualbox to use NAT-networking, so that it gets it's own ip-adress from your router. Then you can simply connect to that ip address from anywhere in your network.

Actually NAT does the opposite: It simulates a NAT behind the IP of the host computer. It has a port-forward option but I have never used it. The bridged network option is the one that creates a virtual interface on the host that lets any computer on the network connect to the guest.

You're absolutely right Cdh, that's also what the Virtualbox manual i just linked to mentions so i'm not sure where my mind was.. BlackArts, my apologies for the confusion.


ᶘ ᵒᴥᵒᶅ

Offline

#9 2011-04-10 20:57:29

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

No problem, I'm glad that someone always put effort to help on this forum

Offline

#10 2011-04-10 21:15:59

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

Ok, so when I set port to let's say 3000 (that's probably unused right?) should I use address listed when I run ifconfig: inet addr:127.0.0.1

Than I could access my server by typing in my host browser http://127.0.0.1:3000/ ? And I would also have shell access trough that adress after I setup open ssh if I understand correctly.

Last edited by BlackArts (2011-04-10 21:18:00)

Offline

#11 2011-04-10 22:29:23

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

Ok, so I've read the manual http://www.virtualbox.org/manual/ch06.html#network_nat
But I still can't get shell access to work.

I first tried this setup:
VBoxManage modifyvm "ArchServer" --natpf1 "guestssh,tcp,,2222,,22"

but I couldn't get ssh access via putty.

Than I entered ifconfig:
on eth0 I have inet: 10.0.2.15
on lo I have inet: 127.0.0.1

and used following command:
VBoxManage modifyvm "ArchServer" --natpf1 "guestssh,tcp,,2222,10.0.2.15,22"

so, If I got this correctly this should enable me to connect to my hosted os via ssh something like following: happy(my created user)@10.0.2.15:2222
I entered in putty 10.0.2.15 for server and 2222 for port, but I can't get tcp connection.

I'm probabolly doing something wrong, so help is really appreciated. Thanks!

Offline

#12 2011-04-11 07:17:41

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

yey, I managed to setup ssh, but ftp is bugging me a little.
So, to setup ssh I had to do the following
VBoxManage modifyvm "ArchServer" --natpf1 "guestssh,tcp,127.0.0.1,2222,,22"

I've redirected everything on port 2222 on my host to port 22 on my hosted os

I've done the same for ftp but on port 3000:
VBoxManage modifyvm "ArchServer" --natpf1 "guestftp,tcp,127.0.0.1,3000,,20"

I've established ssh connection successfully, but ftp simply won't connect. I've used Vsftpd and created virtual users as well, but when I open filezilla and try to connect to:
Hots: 127.0.0.1
Username: user1 (that's my virtual user but it won't work even with real one)
Password: password1
Port:3000

I get following:

Status:    Connecting to 127.0.0.1:3000...
Status:    Connection established, waiting for welcome message...
Error:    Could not connect to server
Status:    Waiting to retry...
Status:    Connecting to 127.0.0.1:3000...
Status:    Connection established, waiting for welcome message...
Error:    Could not connect to server

I mean... it's just the usual error message, but I tried to connect trough my 2222 (ssh) port, just out of curiosity, and it says:

Status:    Connecting to 127.0.0.1:2222...
Status:    Connection established, waiting for welcome message...
Response:    SSH-2.0-OpenSSH_5.8
Error:    Cannot establish FTP connection to an SFTP server. Please select proper protocol.
Error:    Critical error
Error:    Could not connect to server

So, that means that I have access to my virtual machine, but for some reason ftp server won't respond. I checked if the daemon is running and everything seems fine, also checked if port is set to 20 in configuration file.

Any ideas?

Last edited by BlackArts (2011-04-11 08:00:48)

Offline

#13 2011-04-11 12:56:47

stryder
Member
Registered: 2009-02-28
Posts: 500

Re: [solved]Virtualbox as developement server

BlackArts, I'm confused by what you are doing - not really sure if you are going about things the right way but not quite understanding what you are trying to achieve. Anyway I thought I'd jump in and if you think I read you wrong then just ignore.

The advice given to you is to use "bridged" for your network setting. This way your VM acts like an independent machine. Everything else is done in arch. In your arch setup you then give your network card a static ip address in rc.conf. You also set your server software to listen at that ip address. And you also make sure that sshd is started. If you do all that then you should easily ssh into your arch from your windows, provided of course that hosts.deny is set properly to allow it. Similarly you should be able to access your server using the ip address. I use apache and this is the setup I use.

Offline

#14 2011-04-11 19:30:22

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

Thanks very much, I figured everything yesterday. I'm just writing this in case someone else wants to do the same thing.

So, I installed arch on virtual machine.
Set the network mode from NAT to bridged.
(This step allowed me to get everything done without much fuss on port forwarding and stuff)

Than I installed openssh, configured it as instructed on wiki.
Now, to connect to my hosted machine via ssh I first typed in:

ifconfig | grep inet

took first line that's something like:

inet addr:161.53.80.80 Bcast:161.53.79.255 Mask:255.255.255.0

addr is actually address of my hosted machine,and now with that I have shell access to that machine. I just type in putty 161.53.80.80 for host and 22 for port (or what ever I set my ssh to listen on). When I'm prompted for username or password I can just use username or password of any account I created earlyer on my arch hosted machine.

Same's for ftp, I've used vsftpd (very secure ftp daemon). Just follow everything on wiki, it'll work just like that.  Make sure you uncomment local_enable=YES, otherwise you won't be able to login with your username and password. So, now just use any ftp client like filezilla and for host enter ip of your machine, for username and password, use username and password of user you created with useradd command.

I've just installed node.js for now, so I haven't played with nginx yet, but apache should work out of the box, and you would probabolly be able to just type 161.53.80.80 in your browser and get all html you uploaded in html folder (and you should refer to arch wiki on apache to find out where that is, probably in /serv/html)

Now, why would anyone do this you ask? Whell, to test how would some custom server setup workout for you before you actually spit out lots of money to rent it and find out you can't use it as you imagined it, or just for simulating your own little happy server where you can add all languages like php,python,ruby,node.js and test new technologies etc... without too much trouble or paying additional money to your hosting providers for certain modules. Anyway, it's for saving money and having fun XD

Last edited by BlackArts (2011-04-11 19:39:44)

Offline

#15 2011-04-11 19:32:37

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [solved]Virtualbox as developement server

I still feel bad about pointing you in the wrong direction.. wink

Glad you got it working BlackArts, please mark your topic solved by prepending it to the title.


ᶘ ᵒᴥᵒᶅ

Offline

#16 2011-04-11 19:42:43

BlackArts
Member
Registered: 2011-01-28
Posts: 23

Re: [solved]Virtualbox as developement server

litemotiv wrote:

I still feel bad about pointing you in the wrong direction.. wink

Glad you got it working BlackArts, please mark your topic solved by prepending it to the title.

Hehe, no problem. If it weren't for that, maybe I would never learn to forward ports to my virtual machine. Every experience is good... even if its bad tongue (just joking)

Offline

Board footer

Powered by FluxBB