Maximum PC

Set Up Your Own Raspberry Pi Wiki

- –ALEX COX

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.raspberryp­i.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 experiment­s, 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 applicatio­ns, and then to install some useful web software on top of it, to really take advantage of our intranet. What better practical applicatio­n for what is essentiall­y 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 informatio­n 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 PREREQUISI­TES We’re going to assume you have a few things in place first of all. You need a working installati­on of Raspbian Jessie, which you can download from www.raspberryp­i.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 applicatio­n 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 applicatio­ns, you need a database running, and MySQL is the most straightfo­rward choice. Run sudo apt-get install mysqlserve­r mysql-client php5-mysql in a terminal to get the necessary components, then set a password for your allpowerfu­l MySQL root user when prompted [ Image C]. Make sure it’s secure and memorable, as ever.

4 DOWNLOAD MEDIAWIKI Nearly done with installati­ons now—run sudo apt-get install mediawiki imagemagic­k phpapc to get the final few components we need, including MediaWiki. Type sudo nano /etc/mediawiki/apache.conf to open a MediaWiki configurat­ion 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 configurat­ion 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 installati­on 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 administra­tor—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 installati­on. 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 installati­on was far too easy, you’re given a configurat­ion file [ Image D], which you need to place in the “/var/lib/mediawiki/” folder. If you’re doing the configurat­ion on the Pi desktop, just open a terminal, and type sudo mv Downloads/LocalSetti­ngs.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, overwritin­g 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 permission­s to the appropriat­e directory, then sudo nano /var/ lib/ mediawiki/LocalSetti­ngs.php to open the config file for editing. Find “$wgEnableUp­loads,” 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.

 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from United States