How to: Hosting a Friendica site at home
Clone this wiki locally
You can host a fully federated Friendica site at home. We have a ready-made VirtualBox image for this purpose. It makes 'home Friendica' a viable option for more people - not just 'geeks'. Installing the VirtualBox image is still more complicated than your average program, but in many cases it's significantly easier than installing Friendica from scratch.
A couple of explanations
A VirtualBox is a virtual computer installed within another computer. In effect, the virtual computer looks like window on your desktop. For example: If you are running Microsoft Windows as your operating system, you can install a VirtualBox to run a GNU/Linux computer as a window within it. This can then be used to set up a server to run things like a Friendica site.
There's a common problem with running a server like Friendica from your home computer, though. For many home Internet connections, your IP address--the way the rest of the world is able to talk to your computer--can change without notice. If your IP address changes, any servers (like Friendica) running on your home computer will become unreachable.
A "dynamic DNS" service is used to solve this problem. By obtaining an address like
me.dyndns.org and installing software that periodically sends your current IP to the dynamic DNS service's server, you overcome that restriction - with
me.dyndns.org now rerouting to whatever your IP happens to be at any point in time.
If you do decide to use DynDns itself as your dynamic DNS service, you'll find that new accounts are no longer free, as they once were. But you get a 14 day free trial and pay just $20 a year if you decide to keep the service - considerably less than for most shared hosting deals (and with the additional advantage of having your data on your own desk!). Also, you can register up to 30 hostnames in that basic deal - meaning that you can use your home server for other web services beside Friendica. Here's where to look: http://dyn.com/dns/dyndns-pro-free-trial/
Another Dynamic DNS service recommended by Friendica users is available at: http://freedns.afraid.org/
How to do it
Network with a router
If you connect to the Internet via a network that uses a router, you should be able to set up your VirtualBox through the following steps:
1) Register a DynDns or similar account and install the respective/provided IP updater on your machine (that is the host computer). As explained above, this ensures that other sites can find your server, even though it is probably running on a dynamic IP. You will get a subdomain from the dynamic DNS service you choose: e.g.
2) Install Virtual Box on your machine: https://www.virtualbox.org/. It's advisable to familiarize yourself with the program a little by reading the chapter First steps in its help pages. At the very least, for now, read sections 1.5 to 1.8. Be sure to read 1.9 later on, because it describes a very easy way to back up your server.
3) Download and unzip this image: http://downloads.friendica.eu/Friendica.zip. Make a copy of it in case something goes wrong and you want to start over again.
4) In Virtual Box, set up a new virtual machine for a Linux/Debian system, specifying the downloaded disk as your hard disk. 256 MB of RAM should suffice. The network mode should be set to "Bridged".
5) Start the new machine and log on as the (admin) user called "root" (password: "friendica"). At this point in time, the virtual machine is using a U.K. keyboard layout. If that's confusing you, take a look here: https://en.wikipedia.org/wiki/File:KB_United_Kingdom.svg
6) Enter the command
ifconfig to discover the virtual machine's internal IP. The entry you are looking for will be something like this
inet Address:12.345.678.9 - not this one:
7) Configure your router to pass HTTP traffic to that IP. This means forwarding traffic on port 80 to it. Consult your router documentation on how to do this. Many routers have so-called rules that are pre-configured for you. If that's the case, this is the most common of them and will be called something like 'web' - meaning that you only have to enter the IP and activate it.
8) At the command prompt, type
cd /root then
bash setup-friendica.sh all
9) You will prompted to change the keyboard configuration for your region and language, if you so wish.
10) You will be prompted to enter your (normal) email address, your domain (which should be your DynDns subdomain) and a legitimate SMTP account to relay mail from. The latter can be taken from the SMTP settings in any standard mail client you use - also use the port specified there. Your user name for this account will usually be your mail address (but still: just use the settings that work for the mail client) and your password is your standard mail password.
Ctrl-x and then
y to save these settings.
12) The process continues and asks you to select locales (or all) and whether you want to change the root password. Change the password and remember it. If you don't know what locales are, select
13) You are also asked for the admin mail address your Friendica site will use. Enter your normal email address.
14) When installation is complete, type your DynDns address into your browser and register an account on your new Friendica site using the admin email address you specified in #13.
Note: Now that you have configured your router to forward port 80 to the VirtualBox image, you will need to make sure that the VirtualBox image's IP doesn't change too often. The easiest way of achieving this is to check the router's DHCP settings and to set leases for the longest time period the router allows - e.g. three weeks. But that still means that your Friendica server may become unreachable after that time period, especially if you reboot it. To solve that problem. just run ifconfig again and reconfigure the router to reflect the new IP.
Of course, if you are a GNU/Linux expert, you will know how to configure your virtual machine to use a static IP and solve the problem permanently.
Direct connection (no router)
If your Friendica VirtualBox is on a computer connected directly to the Internet (i.e. you don't have a router for your network), you should use the following steps instead: