Set Up Your Own Raspberry Pi Wiki
YOU’LL NEED THIS
A RASPBERRY PI Any model of Pi should work,
from the first edition up.
RASPBIAN Find everything you need at www.raspberrypi.org/
downloads/raspbian/. THE RASPBERRY PI IS PERFECT for a vast number of single-serving uses, and it’s cheap enough and light enough on power usage that you can reasonably keep one running at all times. What we’re doing here is more of a secondary purpose; it doesn’t matter what you’ve got your Pi doing day-today, because having it host a web page or two, or serve as a base for your HTML experiments, barely taxes the little board at all.
Our aim is actually twofold: to install a LAMP bundle—Linux, Apache, MySQL, PHP—to give us everything we need to run and serve web applications, and then to install some useful web software on top of it, to really take advantage of our intranet. What better practical application for what is essentially your own home intranet than a personal wiki? It’s the perfect place to make notes about your personal affairs, keep grocery lists, and share important information with your whole family. We’ll install the big boy of the wiki world in the form of MediaWiki, the software that powers Wikipedia—but keep this inside your local network, and be cagey about precisely what you host, because we’re not exactly locking this data away.
1 PREREQUISITES We’re going to assume you have a few things in place first of all. You need a working installation of Raspbian Jessie, which you can download from www.raspberrypi.org/downloads/raspbian and write to an SD card, and your Pi needs to be connected to a network. It’s also handy to be able to access it headlessly—run
sudo raspi-config from the Pi command line, switch on the SSH server, and reboot to be able to access your Pi terminal from a Windows application such as PuTTY ( www.putty.org). Finally, you need to find the IP address of your Pi in order to connect to it, by looking it up on your router, or by typing ifconfig into the terminal.
2 UPDATE AND INSTALL In the Linux shell, run sudo apt-get update to make sure your Pi is looking for the very latest software packages, then
sudo apt-get upgrade to pull everything on your system up to the most recent version. Now we can use “apt-get” to pull in a bunch of packages at once: Type sudo apt-get install apache2 php5
libapache2-mod-php5 to download and install the A and P portions of the LAMP equation, along with a bunch of packages on which they depend [ Image A]. All being well, that’s everything you need to do to start hosting HTTP content—you can now head to a web browser on any machine in your network, and type your Pi’s IP address into the address bar to see the default Apache landing page [ Image B].
3 CREATE A DATABASE You can now start hosting flat HTML pages to your local network by placing them in the “/var/www/ html/” directory on your Pi. But that’s a bit boring. To take things further, and install some serious web applications, you need a database running, and MySQL is the most straightforward choice. Run sudo apt-get install mysqlserver mysql-client php5-mysql in a terminal to get the necessary components, then set a password for your allpowerful MySQL root user when prompted [ Image C]. Make sure it’s secure and memorable, as ever.
4 DOWNLOAD MEDIAWIKI Nearly done with installations now—run sudo apt-get install mediawiki imagemagick phpapc to get the final few components we need, including MediaWiki. Type sudo nano /etc/mediawiki/apache.conf to open a MediaWiki configuration file, then remove the # from the third line down. Hit Ctrl-X, then Y to save changes, then run sudo nano /etc/apache2/apache2.conf to open the Apache configuration file, and add the line Include /
etc/mediawiki/apache.conf to the bottom, before exiting and saving as before. Reboot with sudo reboot .
5 SET UP THE WIKI Head over to your web browser, and type your Raspberry Pi’s IP address followed by “/mediawiki”—if you see the sunflower graphic, everything’s going well. Click “Set up the wiki,” set your language, and MediaWiki pokes at your Raspbian installation to make sure it has everything it needs to run. If you get the green light (and, at this stage, there’s no reason you shouldn’t), scroll down, and click “Continue.” The only thing you need to enter on the next page is the MySQL password you set earlier—leave everything else as it is, and skip the subsequent page altogether. Give your wiki a name, assign a username and password to the wiki’s administrator—that would be you—and click the radio button that suggests you’ve had just about enough of all this, then click “Continue” a couple of times to finish the installation. There’s going to be a few minutes here when MediaWiki seems to have hung, but give it a little time.
6 PLACE THE CONFIG Now, as though that installation was far too easy, you’re given a configuration file [ Image D], which you need to place in the “/var/lib/mediawiki/” folder. If you’re doing the configuration on the Pi desktop, just open a terminal, and type sudo mv Downloads/LocalSettings.php /var/ lib/mediawiki/ . Or, if you’re accessing your Pi remotely, use an FTP package, such as Filezilla ( http://filezilla-project.org), to drop the downloaded file in the same directory, overwriting the one that’s there [ Image E].
7 CHECK IT OUT With that done, your wiki is ready to go: Just point a browser on your network to “192.168.1.10/mediawiki/” for example (switching that IP address for that of your Pi), and you’ll see the default page. One last thing to do: enable image uploads. Jump into a terminal on your Pi, and type sudo chmod /var/lib/mediawiki/images 755 to give proper permissions to the appropriate directory, then sudo nano /var/ lib/ mediawiki/LocalSettings.php to open the config file for editing. Find “$wgEnableUploads,” and change its value from “false” to “true,” then find “$wgServer,” and add a hash symbol before it to comment it out. Hit Ctrl-X to save and quit, and you’re finished.