Set Up Your Own Rasp­berry Pi Wiki

Maximum PC - - R&D - –ALEX COX


A RASP­BERRY PI Any model of Pi should work,

from the first edi­tion up.

RASPBIAN Find ev­ery­thing you need at www.rasp­ber­

down­loads/raspbian/. THE RASP­BERRY PI IS PER­FECT for a vast num­ber of sin­gle-serv­ing uses, and it’s cheap enough and light enough on power us­age that you can rea­son­ably keep one run­ning at all times. What we’re do­ing here is more of a sec­ondary pur­pose; it doesn’t mat­ter what you’ve got your Pi do­ing day-to­day, be­cause hav­ing it host a web page or two, or serve as a base for your HTML ex­per­i­ments, barely taxes the lit­tle board at all.

Our aim is ac­tu­ally twofold: to in­stall a LAMP bun­dle—Linux, Apache, MySQL, PHP—to give us ev­ery­thing we need to run and serve web ap­pli­ca­tions, and then to in­stall some use­ful web soft­ware on top of it, to re­ally take ad­van­tage of our in­tranet. What bet­ter prac­ti­cal ap­pli­ca­tion for what is es­sen­tially your own home in­tranet than a per­sonal wiki? It’s the per­fect place to make notes about your per­sonal af­fairs, keep gro­cery lists, and share im­por­tant in­for­ma­tion with your whole fam­ily. We’ll in­stall the big boy of the wiki world in the form of Me­di­aWiki, the soft­ware that pow­ers Wikipedia—but keep this in­side your lo­cal net­work, and be cagey about pre­cisely what you host, be­cause we’re not ex­actly lock­ing this data away.

1 PREREQUISITES We’re go­ing to as­sume you have a few things in place first of all. You need a work­ing in­stal­la­tion of Raspbian Jessie, which you can down­load from www.rasp­ber­­loads/raspbian and write to an SD card, and your Pi needs to be con­nected to a net­work. It’s also handy to be able to ac­cess it headlessly—run

sudo raspi-con­fig from the Pi com­mand line, switch on the SSH server, and re­boot to be able to ac­cess your Pi ter­mi­nal from a Windows ap­pli­ca­tion such as PuTTY ( Fi­nally, you need to find the IP ad­dress of your Pi in or­der to con­nect to it, by look­ing it up on your router, or by typ­ing if­con­fig into the ter­mi­nal.

2 UP­DATE AND IN­STALL In the Linux shell, run sudo apt-get up­date to make sure your Pi is look­ing for the very lat­est soft­ware pack­ages, then

sudo apt-get up­grade to pull ev­ery­thing on your sys­tem up to the most re­cent ver­sion. Now we can use “apt-get” to pull in a bunch of pack­ages at once: Type sudo apt-get in­stall apache2 php5

liba­pache2-mod-php5 to down­load and in­stall the A and P por­tions of the LAMP equa­tion, along with a bunch of pack­ages on which they de­pend [ Im­age A]. All be­ing well, that’s ev­ery­thing you need to do to start host­ing HTTP con­tent—you can now head to a web browser on any ma­chine in your net­work, and type your Pi’s IP ad­dress into the ad­dress bar to see the de­fault Apache land­ing page [ Im­age B].

3 CRE­ATE A DATABASE You can now start host­ing flat HTML pages to your lo­cal net­work by plac­ing them in the “/var/www/ html/” di­rec­tory on your Pi. But that’s a bit bor­ing. To take things fur­ther, and in­stall some se­ri­ous web ap­pli­ca­tions, you need a database run­ning, and MySQL is the most straight­for­ward choice. Run sudo apt-get in­stall mysqlserver mysql-client php5-mysql in a ter­mi­nal to get the nec­es­sary com­po­nents, then set a pass­word for your allpow­er­ful MySQL root user when prompted [ Im­age C]. Make sure it’s se­cure and mem­o­rable, as ever.

4 DOWN­LOAD ME­DI­AWIKI Nearly done with in­stal­la­tions now—run sudo apt-get in­stall me­di­awiki im­agemag­ick ph­papc to get the fi­nal few com­po­nents we need, in­clud­ing Me­di­aWiki. Type sudo nano /etc/me­di­awiki/apache.conf to open a Me­di­aWiki con­fig­u­ra­tion file, then re­move 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 con­fig­u­ra­tion file, and add the line In­clude /

etc/me­di­awiki/apache.conf to the bot­tom, be­fore ex­it­ing and sav­ing as be­fore. Re­boot with sudo re­boot .

5 SET UP THE WIKI Head over to your web browser, and type your Rasp­berry Pi’s IP ad­dress fol­lowed by “/me­di­awiki”—if you see the sun­flower graphic, ev­ery­thing’s go­ing well. Click “Set up the wiki,” set your lan­guage, and Me­di­aWiki pokes at your Raspbian in­stal­la­tion to make sure it has ev­ery­thing it needs to run. If you get the green light (and, at this stage, there’s no rea­son you shouldn’t), scroll down, and click “Con­tinue.” The only thing you need to en­ter on the next page is the MySQL pass­word you set ear­lier—leave ev­ery­thing else as it is, and skip the sub­se­quent page al­to­gether. Give your wiki a name, as­sign a user­name and pass­word to the wiki’s ad­min­is­tra­tor—that would be you—and click the ra­dio but­ton that sug­gests you’ve had just about enough of all this, then click “Con­tinue” a cou­ple of times to fin­ish the in­stal­la­tion. There’s go­ing to be a few min­utes here when Me­di­aWiki seems to have hung, but give it a lit­tle time.

6 PLACE THE CON­FIG Now, as though that in­stal­la­tion was far too easy, you’re given a con­fig­u­ra­tion file [ Im­age D], which you need to place in the “/var/lib/me­di­awiki/” folder. If you’re do­ing the con­fig­u­ra­tion on the Pi desk­top, just open a ter­mi­nal, and type sudo mv Down­loads/Lo­calSet­tings.php /var/ lib/me­di­awiki/ . Or, if you’re ac­cess­ing your Pi re­motely, use an FTP pack­age, such as Filezilla ( http://filezilla-pro­, to drop the down­loaded file in the same di­rec­tory, over­writ­ing the one that’s there [ Im­age E].

7 CHECK IT OUT With that done, your wiki is ready to go: Just point a browser on your net­work to “­di­awiki/” for ex­am­ple (switch­ing that IP ad­dress for that of your Pi), and you’ll see the de­fault page. One last thing to do: en­able im­age up­loads. Jump into a ter­mi­nal on your Pi, and type sudo chmod /var/lib/me­di­awiki/im­ages 755 to give proper per­mis­sions to the ap­pro­pri­ate di­rec­tory, then sudo nano /var/ lib/ me­di­awiki/Lo­calSet­tings.php to open the con­fig file for edit­ing. Find “$wgEn­ableU­ploads,” and change its value from “false” to “true,” then find “$wgServer,” and add a hash sym­bol be­fore it to com­ment it out. Hit Ctrl-X to save and quit, and you’re fin­ished.

Newspapers in English

Newspapers from Australia

© PressReader. All rights reserved.