http://en.wikipedia.org/wiki/Imageboard
It looks tough, but lucky for you danbooru operates under open source code! I don't know shit about how to code, but looks like people have already asked this question. Please look at these, (and also refresh yourself on Linux server systems.)
Post Directly Relating to Your Query:
http://danbooru.donmai.us/forum/show/21969
yosome (from the link above) wrote...
VMWare image with Danbooru 1.18 running on Ubuntu 8.04 (tested on Server 1.0.x and Player 2.0):
http://dedicated.yosome.org/Danbooru-1.18.rar.torrent
The first user account created on the site will be an admin.
username: danbooru
password: danbooru
CPU: 1, add the "numvcpus" line to "Ubuntu.vmx" if you want/need more
RAM: 384MB, can be changed using the "memsize" line in "Ubuntu.vmx", 128MB is probably the bare minimum
DISK: 500GB, inital size is 2.5GB and will expand as needed
Services: Apache, Postgres, SSH, Samba
NETWORK: DHCP, netbios name is set to 'danbooru', so http://danbooru/ should work for most Windows clients
If you run into any problems with eth0 vanishing and another eth# appears, run the following command and reboot:
sudo rm /etc/udev/rules.d/70-persistent-net.rules
Get VMware (you might have to pay for it) and run the image. That might be enough to run your server. At least it is a good place to start. Familiarize yourself with Ubuntu, because you will need to use something like it to run the real server.
The Actual Source Code:
http://danbooru.donmai.us/help/source_code
You might need someone to help you with this. I wouldn't attempt this alone.