I know this is a beginner question or may be even a stupid one, I am new to this whole concept of raspberry pi, so please excuse me if this is naive.

Just beginning to tinker with raspberry pi and mobile apps, am not able to understand a few things,

  1. How can connect my app to the local sever running on raspberry pi.
  2. What would be the best way to code on rasberry pi ? I am thinking of a lamp sever, but am not sure about the stability it would offer.

Help and direction appreciated.

Regards, Ayush

2 Answers 2


First a bit of context: Essentially the Raspberry Pi is a mini computer that runs Linux (or Android). Although it is a different CPU architecture (ARM) to what most Home PCs and many servers run (x86/x86_64) in essence it is just a computer running Linux...

First thing you want to do is choose which OS you wish to install. My personal preference is for Raspbian (a Raspberry Pi specific port of Debian) but I'm a Debian lover and there are other options. Have a look at www.raspberrypi.org/downloads/

Seeing as you are building a server (and not a media centre, etc) then I think that you are probably best off building yourself a minimalist headless server.Two options that spring to mind are:

  • Raspbian have a net-installer (somewhat modelled on Debian's net-installer) which I haven't tried (yet) but I imagine would work nicely.

  • I am involved with TurnKey Linux and some community members have collaborated on a script that trims down a default Raspian image to be more like TurnKey Core - Instructions here: www.instructables.com/id/Raspberry-PI-THE-HOME-SERVER-TURNKEY-LINUX/.

Once you have your server up and running then you'll need to install the rest of the bits you'll want for a web server. You'll need to decide exactly what that best requires. Ultimately it will rely on the requirements of your app, although creating a LAMP would be a good starting point IMO. To do that, you'll need to install Apache, MySQL and PHP (sometimes Python &/or Perl too/instead - depends on your plans).

As this will basically be a Debian server you should be able to find plenty of tutorials about how to set up a LAMP on Debian via google. The install process will essentially be the same as any other commandline only (i.e. headless) Debian server setup...

Now to specifically answer your questions:

  1. I am assuming that you are developing the app yourself!? So, it will depend... If having both your app and Pi server on the same LAN will work, then you could just use your server's IP to communicate with it. If you want to communicate over the internet, then you'll (ideally) want a static IP and to make sure that you have appropriate NAT and/or firewall port forwarding/exceptions (as appropriate to your hardware/software/network setup) between the internet and your Pi.

  2. TBH I'm not 100% sure exactly what you are asking here...!? It will depend on what coding language you wish to use, and what protocol your app uses. Assuming that your app uses some sort of API then a web server (e.g. Apache) with a DB backend (e.g. MySQL) with some server side code to process stuff (e.g. PHP/Python/Perl) then LAMP would be the go... For development purposes I would imagine the stability would be fine. I suspect that you'll want to reassess things once you are in full production mode...

  • Thanks for the great brief, I am developing the app myself. One point which still puzzles me is when people would download the app, how would the app know the IP address of the local raspberry pi server that the user has running. Any pointers for this?
    – Ayush
    Oct 20, 2014 at 12:06
  • 2
    Having been around computers since the late 70s, it is interesting to see the term 'mini computer' applied to the Rasberry Pi. The original usage was for computers made by companies like Digital Equipment Corp., Wang Laboratories, Data General and others. They cost in the 10s of thousands of dollars. What came to be known as Personal Computers (PCs) were originally called Microcomputers because they were powered by a microprocessor CPU. Oct 20, 2014 at 12:18
  • The ip address of your Pi machine can be found by typing ifconfig from a shell prompt Oct 20, 2014 at 13:01
  • @Ayush If you intend for others to run your server, you may want something more portable than a full LAMP server as a requirement.. perhaps a single java class instead. Also most who own a Pi will know its IP address, an option to type it in should suffice, if not a UDP broadcast would work. Oct 20, 2014 at 20:28

I was struggling with the same problems one year ago, when I got my RPi. Here is tutorial which I've written so far. It covers everything I learned. Instead of LAMP I used much newer and lighter technologies (nginx, sqlite, archlinuxarm, python). Maybe it could help you to :) .

Not the answer you're looking for? Browse other questions tagged or ask your own question.