Linux Format - July 2014 UK

May 30, 2016 | Author: mbox2 | Category: Types, Graphic Art
Share Embed Donate


Short Description

Build a Linux PC Get a better desktop, media centre and home server today....

Description

inside: Ubuntu 14.04 LTS Hack Minecraft on the Pi!

Get Started Guide and then build a trebuchet p82

1 for Free Software

#

build a linux PC Get a better desktop, media centre and home server today Is your free DVD missing?

Speak to your newsagent now!

Cool for School

Martin O’Hanlon on hacking the Pi for fun p42

Also inside… Linux Chromebook Hack Linux onto Google’s baby for an ultra-cheap laptop p50

OpenStack

Open Evernote

3D printing

Create a local cloud in a virtual machine

Never forget anything with Etherpad and NixNote

Use Python and FreeCAD to design and create a case

DevStack guide Open source notes

Print a Pi case

TuxRadar.com

It’s a Raspberry Pi powered camera that records my snowboarding

Welcome 1 for Free Software

#

What we do

We support the open source community by providing a resource of information, and a forum for debate. We help all readers get more from Linux with our tutorials section – we’ve something for everyone! We license all the source code we print in our tutorials section under the GNU GPLv3. We give you the most accurate, unbiased and up-to-date information on all things Linux.

Who we are

This issue we show you how to build your own Linux machine, so we’ve asked a few of our experts what their first ever PC was. Jonni Bidwell In ‘94 a dodgy guy from Stirling talked me into part-ex’ing my Amiga 500 for a 486DX, running at a death-defying 33MHz and having an unfathomable 8MB of RAM. I loved meddling with config.sys to cater for different games and loading device drivers ‘high’ to preserve that important first 640K.

Neil Bothwick My first PC was a Jupiter Ace, a ZX81 lookalike that ran a wonderful version of Forth. Even then I used an alternative operating system. Of course, running stock was unthinkable, so it had a home made 16K RAM pack (yes, a whole 16KB). Learning Forth was a very interesting experience indeed!

David Hayward My first PC was an Amstrad MegaPC. A glorious fusion of 386SX at 25MHz, 1MB RAM and a 20MB HDD double-spaced with DOS 5.0 and Windows 3.1; along with a built-in Sega MegaDrive which was activated by sliding the front cover horizontally from one side to the other – sheer magic.

Les Pounder My first ever computer was a Commodore 16 and I can remember assembling the equipment for the first time and then powering the system on to show the BASIC/command line. Naturally as a child of that generation I started to investigate the computer, and stumbled upon the “10 PRINT” code.

Mayank Sharma I began programming with GW-BASIC on an i486 in Year 7 in school in 1995. The first computer at home appeared in 1997 and was a Pentium 166MHz MMX that took quite a chunk out of Dad’s savings. It had 64MB RAM, a 1.2GB hard disk and a CD-drive! It was this computer that I first ran Linux on.

Linux, Linux everywhere The Linux Format team genuinely hope you love this issue, as we think it shows how GNU/Linux is touching every aspect of not just the computing world, but our everyday lives too. Nothing highlights this better than our lead news story and the fallout from Heartbleed. Suddenly the world woke up and realised an open source project – OpenSSL – was a vital element in their lives, but from a near-disaster comes an amazing new solution. Unlikely bedfellows Microsoft, Google, Facebook, Amazon and the Linux Foundation – just to mention a few – announced the Core Infrastructure Initiative. A non-profit consortium to provide funding for the Internet’s most vital infrastructure projects. It’s the best result to come from such a crisis and you can read about it in news (see page 6). It is one of the failings of the FOSS world – or perhaps more generally humanity – not to bang its drum enough to raise awareness of these vital projects to ensure they’re fully backed, before disaster strikes rather than after. But when projects are run by developers rightly more interested in the coding than promotion, it’s an inevitable side effect. More cheerfully we have another mad-packed issue full of interesting, fun and useful projects. For Raspberry Pi owners we’re showing you how to hack Minecraft Pi and build an in-game trebuchet (see page 82). Discover how to design and 3D print your own Pi case (see page 68) and if that’s not amazing enough it’s time you got stuck into OpenStack and use DevStack to create your own personal VM-based cloud computer (see page 74). Of course, the cover feature this issue speaks for itself. We’re encouraging you all to build your own Linux machines, whether that’s desktop systems, mini-media centres or your own home server. Now is a fantastic time to build a system with even entry-level components offering fabulous performance. Fancy something more lightweight? You could buy a Chromebook and put Linux on that using the guide (see page 50). There’s so much going on it’s hard to cram it all in!

Neil Mohr Editor [email protected]

Subscribe today

See p30 for awesome deals www.tuxradar.com

July 2014 LXF185    3

Contents The only Linux magazine with military-grade security built in!

Reviews Ubuntu 14.04 LTS..............16 Canonical has released the latest long-term support version of Ubuntu - and we put it through its paces.

Build a Linux PC Build your own PC to meet your every need for less than £400 p32

Ubuntu 14.04 LTS - what does this upgrade bring to the table?

LPS 1.5.1..............................18 People bandy about ‘military-grade security’ all too often, but this live CD was developed by the US Air Force.

Sonic Pi................................19

Roundup: Wiki platforms p24

If Ruby was the language of love, Les Pounder would be Cassanova thanks to this educational program.

iStorage diskAshur........... 20 This external drive offers military-grade security. Just kidding. But it is very secure.

AOC A2472PW4T..............21 No, someone didn’t sneeze whilst typing, that really is its name.

The AOC A2472PW4T is a monitor powered by Android.

Razer BlackWidow........... 22 We review a mechanical keyboard that’s precise and satisfying to type on.

FRITZ!Box 7490................ 22 One of the best routers on the market.

Game reviews.................... 23 We play musical puzzler Circuits and space sim The Last Federation.

Talking heads By using Minecraft you instantly make coding sound more interesting to children. Martin O’Hanlon on using Raspberry Pi to teach p42

4     LXF185 July 2014

www.linuxformat.com

On your free DVD Ubuntu 14.04 remix With Unity, KDE, Xfce & LXDE

MX-14

AntiX and Mepis reunite

PLUS: HotPicks and tutorial code

p96

Treat yourself or a loved one to an LXF subscription! p30

Don’t miss...

Anatomy of a data centre��46 We don surgical gloves and explore the   beating heart of the intenet. 

 Linux on Chromebooks������50 Got a Chromebook but hate ChromeOS?  Don’t worry, we can help!

Coding Academy

Tutorials The Terminal Archive with Tar............... 66

Hack Minecraft Pi................. 82 Jonni Bidwell explains that there’s more to Minecraft than just playing it - you can also learn coding with Python. And then use your knowledge to build a trebuchet to destroy your own property, it’s not the best plan.

Neil Bothwick continues his beginners guide to the terminal and Linux with this archiving tutorial.

3D printing FreeCAD............................. 68

MySQL.................................... 88

Want a fancy case to protect your Raspberry Pi? Design one yourself!

Kent Elchuk is like a Canadian version of Gandalf, except instead using a staff for his magic, he uses spreadsheets and MySQL.

Help me! Man pages...........................72

Regulars at a glance

What’s that Linux? Neil Bothwick is stuck down a well? Go get help!

News.............................. 6 Subscriptions............30 Answers......................92 We examine the fallout of the

Does your wallet come with military-

YOUR PROBLEMS SOLVED

Heartbleed OpenSSL bug, chart the

grade security? No? Then open it up

Extracting VOB files, setting up solid

rise of virtual machines and more.

for a subscription to LXF!

state drives and more.

Mailserver................... 10 Sysadmin....................54 Next month................98. Learning programming without

Dr Chris brings out his dictionary to

Fix Ubuntu, learn how to pass the LPI,

a computer, suggestions for our

clear up the definitions of ‘API’ and

the best low-resource distros

DVD and accusations of anti-

‘protocol’. His parties are ledgendary!

reviewed and lots more.

Microsoft sentiment.

User groups.................13 A new Makerspace appears in that London thing they have now.

Roundup.....................24

HotPicks.....................58 melt an ice cube at 50 paces.

Open Evernotes NixNote and Etherpad......78

Back issues................64 Missed one of our excellent issues? Don’t worry, you can order a back

website with these useful content

issue, and all will be right with the

managment systems.

world once again.

OpenStack DevStack.............................74

Jolyon Brown shows you how to create your very own virtual cloud using virtual water. Sort of.

These pages are so hot you could

Build and maintain a Wiki-based

FreeCAD: create a Pi case and print.

Our subscriptions team is waiting for your call.

www.tuxradar.com

Build your own Evernote alternative for collaborative note taking.

July 2014 LXF185   5

This ISSUE: Heartbleed

Virtual Machines

CyanogenMod

Security alert

Heartbleed: the fallout

Fixing the security flaw in OpenSSL could take months and cost millions.

O

n 7 April 2014, it was publicly disclosed that there had been a security bug in OpenSSL that came about from a missing bounds check in the TLS/DTLS heartbeat extension (RFC6520). By exploiting this bug, memory contents from the server is leaked to the client, and vice versa. Although a new version of OpenSSL that fixed the flaw was uploaded at the same time that the bug’s existence started to become widely known, the damage had already been done – with the bug having been around since 2012. At the time the bug – named Heartbleed thanks to the flaw with the heartbeat extension – was made public, it was estimated that around 17 per cent of the internet’s secure web servers were thought to be vulnerable. Some of the most popular websites on the internet were affected, including Instagram, Tumblr, Google and Yahoo, but thankfully most major sites were quick to act to ensure that they were no longer at risk. Ten days after Heartbleed went public, internet security firm Sucuri scanned every website listed in the Alexa top one million rank of the most popular websites on the internet. It found that in the top 1,000 websites all of them had been patched, and so were no longer vulnerable. However, in the top 10,000 sites, 53 (0.53 per cent) were still vulnerable, and in the top 1,000,000 sites 20,320 websites were still at risk. It emerged that Yahoo was exposed for around 24 hours, other websites such as the Canadian Revenue Agency took their websites down immediately, whilst a patch was created. The Canadian Revenue Agency’s swift action is laudable, but understandable when it emerged that 900 taxpayer details had been

6     LXF185 July 2014

extracted over a six-hour period by a hacker using the Heartbleed bug. Not long afterwards a 19-year-old was arrested by the Royal Canadian Mounted Police in connection with the theft of the data, becoming the first person to be arrested in connection with Heartbleed. The fallout from Heartbleed could be felt for many months, and whilst it is estimated that it could cost affected websites millions to rectify, there is a bigger price being paid – and one that won’t be so easily fixed. The damage to the reputations of the websites that have been affected by Heartbleed mainly depends on how quick they were to act when the vulnerability was discovered, and how transparent they were with letting their users know that their data may have actually been compromised. However, the reputation that took the biggest hit was OpenSSL’s itself, and to a lesser extent open source software in general. A high profile blow to OpenSSL came when members of

The most popular websites hit by Heartbleed have been patched, but smaller sites may still be at risk..

“The fallout from Heartbleed could be felt for many months...” the OpenBSD project announced that they were creating a fork of the OpenSSL project, which will be provisionally named ‘LibreSSL’. The aim of the project is to provide an alternative that is more secure, better managed and documented, and less bloated than OpenSSL. Meanwhile, comments by Robin Seggelmann, the software developer responsible for inserting the security flaw into OpenSSL’s git repository on New Year’s Eve 2011 – where he explained how his error was

www.linuxformat.com

not picked up by a reviewer or anybody else – was seized on by critics of open source software. Dr. Seggelmann informed the Sydney Morning Herald, “In one of the new features, unfortunately, I missed validating a variable containing a length. [After I actually submitted the code] a reviewer apparently also didn’t notice the missing validation... so the error made its way from the development branch into the released version.” The fact that the bug was missed by reviewers after the code was submitted has led to headlines such as The Telegraph’s ‘Heartbleed: the beginning of the end for open source?’ which could damage trust in open source projects and software. One thing you can credit Heartbleed for, is spurring on tech giants to put aside their differences and work together. Spearheaded by Jim Zemlin, executive director of the Linux Foundation, some of the biggest technology firms, including Google, Facebook, Intel, Amazon, Microsoft, and Vmware joined forces to create the Core Infrastructure Initiative, an opensource security evaluation group. The founding members,will contribute $100,000 a year for the next three years, and sit on its guiding board. The main aim of the group will be to build a framework to support open source projects to help ensure that errors like Heartbleed don’t happen again.

Newsdesk VIRTUAL FUTURE

Use of virtual machines increases Will there one day be more virtual machines than real ones?

I

f there’s one tech company banking on the death of traditional computers, then it could be VMware, which is making a fair bit of money from its visualisation business. In the first quarter of 2014, VMware made $1.368 billion, up 14 per cent from the previous year’s quarter. The bulk of the money VMware made was from maintenance ($799 million), with $561 million coming from licences – and the company is pretty bullish about its future performance, thanks to its impressive first quarter results. In a press release, VMware’s chief, Pat Gelsinger, claimed that “Our strong financial results reflect VMware’s unique position in helping customers transform their IT infrastructure… As the industry shifts from client server computing to the mobilecloud era, customers are choosing our solutions because we have the most complete vision and offering for navigating this evolving world.”

All the money the visualisation firm is making isn’t gathering dust in bank accounts or burning holes in CEO’s pockets, however, as it splashed out $1.54 billion on mobile device management (MDM) and security firm AirWatch, in a bid to strengthen its enterprise offerings. AirWatch and other MDM companies offer tools that help businesses set user policies, what applications can and can’t be run, and setting passwords on corporate devices, such as company smartphones. They can also remotely wipe data on a device that has been lost or stolen. With BYOD (bring your own device) becoming increasingly popular, allowing employees to use their personal devices for work-related tasks, MDM software looks like it could be a safe bet for the future. VMware certainly thinks so, paying $1.54 billion for AirWatch, when AirWatch’s revenues for 2013 were just around $100 million.

SMARTPHONE IMMINENT

CyanogenMod goes legit Oneplus One smartphone is launched with Android mod.

C

yanogenMod is one of our favourite mobile operating systems: a free and open source OS based on Android. We’ve long extolled its virtues in providing smartphones and tablets with features that are conspicuously absent from other mobile operating systems, and can often drastically improve the performance of the device you’ve installed it on. Though replacing Android with CyanogenMod is relatively straightforward, a new smartphone, the Oneplus One, comes with CyanogenMod already installed – letting you (and the handset) take advantage of CyanogenMod’s advanced features straight away.

The OnePlus One comes with CyanogenMod already installed, so you don’t need to root it.

CyanogenMod’s impressive performance on even the lowest powered smartphones is given a healthy boost by the Oneplus One’s pretty great specifications, with a quad core 2.55GHz Qualcomm Snapdragon 801 processor, 3GB RAM and a 5.5 inch 1080p touchscreen. These specs, along with the £229 inc VAT price tag for the 16GB model gives the Oneplus One mid-range pricing, but a spec that matches the Samsung Galaxy S5. Cyanogen CTO Steve Kondik said “We’ve brought out the full potential of the hardware and complemented it with innovative new features to give users a fresh new experience and the tools to tailor the One to their personal style.” Though the Oneplus One isn’t the first handset to be launched commercially with CyanogenMod preinstalled, with the Oppo N1 released last year, it’s great to see more open source options becoming available. Well, we say ‘readily available’, but if you’re thinking of going down to Carphone Warehouse to get one, you’re out of luck – for the moment. If you want one now, enter the ‘Oneplus Phone Smash’, which gives you a chance to win a Oneplus One by smashing your current phone and sending the proof to http://oneplus.net/smash. Or just wait.

www.tuxradar.com

Newsbytes Google’s modular smartphone Ara sounds like it has a lot of potential – the ability to easily add, upgrade and replace certain parts of the phone as you go about your dayto-day life is certainly appealing. Not only does it make keeping your phone upgraded easy and affordable (don’t have 4G? Don’t throw away your phone, just clip on a new antenna), but it’s aimed at making basic smartphones more affordable in developing contries – in a similar vein to Mozilla’s Firefox OS aspirations. Google is holding three Ara developer conferences this year and there is a $100,000 grand prize for the developer who produces the best module. The basic Wi-Fi-only model will be produced using 3D printers, will cost around $50 and should be available to buy from early next year.

Could Google’s Project Ara help you build your own smartphone as easily as piecing together Lego? The London Borough of Barking and Dagenham is going to replace the 3,500 desktop and 800 laptop Windows XP PCs that its employees use with 2,000 Chromebooks and 500 Chromeboxes. Not only is the borough looking to save £200,000 by not having to pay Windows licences, but it has estimated it will save a further £200,000 on energy bills, thanks to the Chromebooks being more energy efficient. Let’s hope more companies take Barking and Dagenham’s approach to replacing XP. Tapes, CDs and vinyl are all on life support – so obviously if you’re going to release a new album the only viable medium to do it is by releasing the album as a kernel module. This is what band Netcat have done, uploading their new album Cycles Per Instruction to Github, going one step further in the geek stakes than Batch Totem, who released his album Trunkeret & Ikonis in 2007 on a single floppy disk. If you fancy a listen – and a challenge – the album and compiling information can be found at https://github.com/usrbinnc/ netcat-cpi-kernel-module.

July 2014 LXF185    7

Newsdesk Comment

Open Source Legitimacy Michael Meeks Preparing a talk on the history of LibreOffice recently made me reflect on the changes at Mozilla. When we formed we setup a fair governance for our legal entity, with a separation between membership committee and executive board and with regular (Single Transferable Vote) elections. The accountability of this makes you forget that there are other possibilities. Our contrast was with the old OpenOffice governance which was heavily stacked by a single company in a (notionally) secret ballot. That company appointed one director, and the electorate for the rest (for all but one seat).

The hiking of Eich Lots of projects are led with legitimacy provided by the founders’ sheer weight of personal contribution, personality and heavy lifting: code fixes etc basically doing the unglamorous work. That’s another model that works well, Linux is something like this still. The shameful handling of Brendan Eich’s ejection from Mozilla (on the grounds of a single personal political contribution made over half a decade ago) seemed to contrast sharply with Mozilla’s marketing and ethos of freedom: “Doing good is part of our code”. However, it was even more amazing to discover that Mozilla’s ultimate do-gooding governance is structured by a self-appointed (now two-person) board. With Brendan’s depth of long-term technical legitimacy lost, who are the people in charge? It sounds like some sort of joke: how do a Lawyer and a Venture Capitalist/Marketer end up leading a vital free software project? Without the support of any form of open and transparent electoral process, where does legitimacy come from? I’ve loved and used Mozilla for years, but it seems the only form of binding community input is, sadly, voting with your feet… Michael is a pseudo-engineer, semi-colon lover, SUSE LibreOffice hacker and amateur pundit.

8     LXF185 July 2014

Hitting the mirrors What’s behind the free software sofa?

Linux distribution With Ubuntu 14.04 in the wild, we’re going to see a spate of new and updated releases for distros based on the Trusy Tahr, with EnTiX 14.1 being one of them, and is available to download now. Though based on 14.04, EnTiX drops the Unity interface in favour of Gnome 3.10 and Gnome Classic 3.10. The ISO image from the distro’s website (http://www.extix.se) is a hybrid ISO that can be easily copied to a USB memory stick. It can then be run direct from the USB stick, or –

This Ubuntu 14.04-based distro can be run entirely in RAM.

thanks to a new feature – it can be loaded entirely into RAM, as long as you have at least 2GB.

Network protection Snort, an open source network intrusion prevention and detection system (IDS/IPS) which is developed by Sourcefire, has just had its latest release – version 2.9.6.1, and just because of the nature of Snort, it’s recommended that you keep up to date with the latest stable releases.

Improvements in the latest version include a control command to dump all packets matching a BPF to a PCAP file for capturing specific traffic for further analysis, more detailed error output for parsing of invalid rules and file capture and storage features. Get it checked out now.

Music player Excellent media player Clementine version 1.2.3 has been released – and if you want a program to organise and play your music, then we heartily recommend this Amarok 1.4-inspired program. In the latest version search performance has been dramatically improved – an especially important fix for those of us with huge music libraries. Dependency issues with Ubuntu 14.04 have been resolved and the new version comes with

Clementine is available on Linux, Windows, Mac and Android.

OpenSSL 1.0.1g support for protection against the Heartbleed bug.

Linux distribution By the time you read this, Tails (The Amnesic Incognito Live System) will have reached its all-important 1.0 milestone release. Based on Debian, this live CD distro is built with the utmost security in mind – we’ve mentioned how well it can protect your identity and security. New features include complete support for Tor bridges and improved end-user documentation.

www.linuxformat.com

Tails 1.0 is the culmination of five years of hard work in bringing a user friendly and highly secure live CD.

Write to us at Linux Format, Future Publishing, 30 Monmouth Street, Bath BA1 2BW or [email protected]

Pi, parallels and much more Hello, firstly I love the magazine and look forward to each new edition. I do however find your love affair with the Pi a bit much at this stage. While I also love the Pi and have three around my home (one OpenVPN and one  media centre Raspbmx. Last one is my tinkering box), the shining box in my mini computer arsenal is the Odroid U3 which vastly outshines the Pi. It boasts four times’ the spec and holds court as my BYOD system in work. I found this system after your article on Adapteva Parallela caused me to follow that Twitter feed. So my question is: please can you cover other mini cheap computers? And/or a tutorial on parallel programming? Trevor Cushen Matt says: Trevor, you’re right we are a bit unashamedly fond of the Raspberry Pi – but that doesn’t mean there aren’t alternatives out there, and there’s no doubt that there are more powerful alternatives. However, power isn’t the be-all and end-all, and one of the things we like about the Pi is that it offers a standardised specification. Whilst this isn’t too important for many of us, in the education sector, this is essential. The Pi is doing excellent work in getting children into coding, and as we found out when we spoke to teachers in our Learning with

Letter of the month

N

Pi precursor?

early 40 years ago when our children were 5, 7, and 8 we started a game while out walking. I shut my eyes and became a robot which, to begin with, answered to only two commands: “forward” (the F-word, one step forwards) and “turn” (T, turn right by 90 degrees). A target point was agreed and the game was to give commands to drive the robot (me) to the target. The driver child soon got tired of “F,F,F,F...” so the robot got a new ability (a function). The driver declared “New ” then the function contents (F,F, and so on) then “End ”. For example: “New Go-back-5” “TTFFFFF” “End Go-back-5”. (Repeat the name at the end to help it stick in human memory.) To use this shorthand all they then needed to say was “Go-back-5”. The robot turned round and retraced five steps. They learned Pythagoras’ theorem: “New Thirty-degrees” “FFFTFFFF” “End Thirty-degrees”. The Mark II robot had another command ‘Loop’ which was followed by an integer, then other commands, and finished by ‘EndLoop’. We got as far as ‘If’, but that became too complicated. It was fun for all. After a while a child became the robot. Errant drivers would send their robot into newly dropped cowpats and pools of water. They learned the elements

Linux article last issue, hardware that is consistent is essential to it being included in the curriculum.

of programming without ever realising it. Parents: please play Pi precursor! Dicky Clymo, Robertsbridge Matt says: What an excellent game Dicky! Part of Raspberry Pi’s success is making coding relevant and fun for children – something your game all those years ago managed to do – without even needing a computer, and with the added danger of a freshly laid cowpat! Do any of our other readers have fun and imaginative ways to get kids learning about coding? Let us know!

We’re also very fond of other mini computers as well, and we’ll be running an article of Raspberry Pi

[email protected]

10     LXF185 July 2014

Cow pats: more dangerous to young programmers than a poorly defined while loop.

www.linuxformat.com

alternatives in the next few issues, so another reason for you to look forward to a new edition!

Mailserver

bit worrying to us that mobile dongles seem to have been dropping support for Linux – or, perhaps, being dropped themselves. Let’s hope mobile carriers aren’t just assuming that most people can access the internet through their phones – or using their phones as a mobile wifi hotspot to connect their PCs to the internet. Not everyone has a smartphone that’s capable of that, and broadband coverage is far from complete in this country, and far less across the globe, so we do need alternative ways to connect to the internet. A fresh look at mobile broadband may be quite timely indeed.

Many of us still rely on mobile internet – but are manufacturers ignoring Linux?

Mobile broadband Any chance on doing an update on your ‘Mobile Broadband’ article that appeared in LXF113? Recently I was going to suggest to my sister that she uses a mobile dongle as her Internet connection while she is temporary homeless after selling one house and looking for another. I myself use my mobile dongle when on holiday in my trusty Acer aspire one netbook (running GNU/Linux Mint 16). So I was trying out my mobile dongles after quite a long period of inactivity, and bought a second SIM card to put into a spare dongle I had. That’s when I found out I couldn’t register as the SIM card owner because my netbook had no way of allowing me to view the SMS message sent to my dongle as a PIN to be entered on the website. Also after having installed several distros over the years, I no longer had a copy of ‘Vodafone Mobile Connect’ (VMC), and betavine.net no longer seems to exist. After a bit/lot of Googling I couldn’t even get a copy of Huawei’s Mobile Partner version 16 for Linux; that too had bit the dust. So, reluctantly I powered up

Uneasy about Priveazy a Windows machine I’ve always kept hidden away, just so I could see the PIN sent in the SMS message! Later I came across an app called ‘Modem Manager GUI’ which I might have been able to use to view the SMS with the PIN. It did after all receive an SMS sent by me on my mobile phone, but doesn’t appear to offer a SMS sending service. Is sending SMS via my mobile dongle possible, or is that one of the restrictions of buying a data card SIM? P.S. I appreciated the replies to my comments on the Raspberry in your magazine issue LXF179. I have one Pi as a media centre on the back of my TV with a second one running headless linked to a bread board for the purpose of learning electronics. So more Raspberry Pi and the GPIO stuff please. Galen White Matt says: Galen, it’s just a teeny

In your ‘Beat the NSA’ article published in LXF182, you mentioned the ‘Priveazy Lockdown plugin’ and went on to suggest that as an extension to Firefox/Chrome/Chromium, it can help raise the bar of privacy protection on one’s computer system. I googled for more reviews of on extension and was pointed to a blog priveazyblog. tumblr.com. Fair enough. I visited the site and watched the introductory video on YouTube: http://youtu.be/ kzwHgQl4uMQ of how the extension is supposed to be helpful in safeguarding one’s online privacy. When I attempted to visit the priveazy site (supposedly at www.priveazy.com) for more information, the browser was simply re-directed to www. amazon.com – not exactly what I would expect from an extension that is supposed to shield me from information-

www.tuxradar.com

mining online merchants! The extension is still available for installation on Firefox at http://bit.ly/LXFpriveazy. The last update was released on 14 Sep 2012. The question that I have though is: How can I ascertain whether this app is doing what it is supposed to do, and still does it effectively in spite of being more than a year since the last update – particularly since it’s also missing its home page? Tao CM, Singapore Mayank says: I’m not sure what’s wrong with the website. Maybe the developer forgot to renew his subscription. As far as using the extension is concerned, it simply suggests steps you should take to spruce up your privacy settings on supported website. It doesn’t make any changes for you – you’ll have to carry out the changes yourself. There hasn’t been any recent change to the plugin, which in light of its website issues, is a good thing because it means no one has made changes to the original code. However, it’d be prudent to disable the plugin until the website issue is resolved..

Convert VHS tapes to DVD Is there a Linux solution to recording VHS Tapes to PC or DVD? Please could you do an article explaining this? Ian Learmonth Matt says: There certainly is a way to convert VHS to DVD in Linux, but it’s a tad long-winded and convoluted. If you’re converting precious home movies or something ultra-rare, then it’s well worth doing, but if you’re looking to convert your movie collection, it’ll be less timeconsuming to rebuy on DVD. The first thing you’ll need to do is buy a video or TV capture card – unless you’re lucky enough to have a graphics card with video inputs – though these are relatively rare. The first stumbling block is that these can be quite expensive, and not all of them are Linux compatible, so do some investigating. Blackmagic Design (blackmagicdesign.com) produce pretty good capture

July 2014 LXF185    11

Mailserver

We think you’re going to love this month’s DVD. If you hear rustling when you open it, it’s us in the garden watching your reaction.

equipment, though they are on the expensive side. You’ll also of course need a decent DVD burner, but it’s quite probable that your PC already has one of those. You will then need software such as VDR, MythTV or even good old VLC for actually capturing the content, then DVD burning software to convert it to disc. If you are going to attempt all that, good luck!

Linux Format Ubuntu 14.04 DVD suggestions I hope that you will please excuse my bad English – I am just an average user, but as the release of Ubuntu 14.04 approaches, I think it’s time for me to send you a little reminder of my suggestions. I, indeed, have noticed that your recent Live DVDs were slightly less interesting than they used to be: packed with less software, etc. As holidays also approach, I would like to use the DVD as a useful and comprehensive tool for use abroad. I know I could make this myself with a Live USB stick. But for security reasons, I need a tool that is write-protected. A write-protected SD card does not work: it has to be read+write. I don’t understand why; and

12     LXF185 July 2014

what should I do to make it work? (I had installed the distro on the SD card using the same tool as I used to make the Live USB stick). I also tried, with Remastersys, to make by myself a Live DVD with several software added, but, again, it didn’t work. For the Ubuntu 14.04 LTS, roughly, my point was: 1) No hurry: please offer us a stable DVD instead of some Betaversion (do not try to deliver the first LTS DVD, try to deliver the best – see hereafter), 2) 64 bits, please, 3) With KDE packages included, 4) With a complete package of useful software: KtimeTracker, VirtualBox 64-bits, Qt4Wine, KDEPartitionManager (terrific!), K3b (unbeatable stability), 5) LXF-brewed DVD: with the removal of all Amazon-lenses, etc. 6) MP3 and Flashcompatible out-of-the-box, like Netrunner, please! Otherwise, there is Trisquel for those who do not want this at all... 7) Pre-packaged with all that’s necessary for Python development: DreamPie, IDLE (would I dare say: Eclipse with Python plugin pre-configured?). In this respect, I think your LXF Ubuntu 12.04 LTS DVD has to be taken as an example: KDE packages, and a lot of software.

You could argue that if KDE is so important to me, I should go to SUSE or NetRunner. But SUSE uses another system for packages (no apt-get or aptitude, Ubuntu tools), so CLI is not convenient at all; I started to get accustomed to Ubuntu CLI tools. Also NetRunner (NR) is terrific (with plenty of useful software provided from start), but something went wrong while updating packages on NR 13.06. So it seems that the distro isn’t as stable as Ubuntu. Did someone else experience the same instability? NR 13.10 seem more stable BTW... Olivier Durand Matt says: Thanks for your email, Olivier, and never fear – your English is impeccable, as are your suggestions. As you’ll no doubt have already seen when you pick up this very issue, we’ve already included a DVD of Ubuntu 14.04, so we were not able to take your suggestions on board. However, I think you’ll be really pleased with our DVD as it, rather fortuitously, includes many of your suggestions before we even saw your email – we’re pretty efficient like that. To start, we’ve taken our time and waited to bring you the full LTS version, rather than an early release candidate or beta version, it’s 64-bit and we’ve included Kubuntu on the disk (along with Xubuntu and Lubuntu). I hope this DVD is more to your liking! Head over to page 96 for more info on what’s on the cover disk. As for your question about a live CD that you can use whilst abroad and using public computers, check out our review of Lightweight Portable Security 1.5.1 on page 18 – I think it will be exactly what you need..

You bullies! Having worked on and off with Linux over the years Red Hat with Gnome in the early days and then Ubuntu, I decided I’d dive into buying a copy of Linux Format (issue: LXF184) to catch up on how Linux has been evolving as an OS. I’ll be honest, I was disappointed – not with how Linux has grown, but with how your magazine promotes it! I began reading the first few

www.linuxformat.com

pages and nearly every article seemed to comprise of Windows bashing! The introduction bashed Windows XP and its insecurities, the next article discussed the Linux gaming up-rise with ports of new gaming engines – but felt the need to have a dig at Windows for DirectX! Your magazine feels insecure, almost like it needs to justify why Linux is better than Windows on every page. The reality is it doesn’t need to, given I’d just actually bought a copy of the mag anyway! However, once I’d moved past all that initial bashing, the magazine really did start to pick up and I really enjoyed the FireFox OS feature. Matthew Bennion Neil says: It’s quite unusual for us to talk about Windows – as I think I mentioned. I also don’t recognise the “bullying” as you put it, but more a stating of the facts. If you don’t like those facts, perhaps you could change the situation and contact the multi-billion-making multinational software developer called Microsoft and ask it to continue to support or provide a free upgrade route for the millions of Windows XP users? It’s the same with our comments on DirectX – Windows Vista was only able to make use of DirectX 10. Again, pointing out the past habits of a corporation is hardly bullying, if you don’t like its conduct perhaps you should ask it to change? Ideally and thankfully, we get to write nice cooperative things, like in this month’s news with Microsoft contributing to the new Core Infrastructure Initiative. Well done Microsoft, well done Google, well done all! LXF

Write to us Do you have a burning Linux-related issue you want to discuss? Do you think we’ve been unduly harsh on Windows XP and the little men at Microsoft? Or perhaps you think we’ve not been harsh enough? Write to us at Linux Format, Future Publishing, 30 Monmouth Street, Bath BA1 2BW lxf.letters@ futurenet.com.

Linux user groups

United Linux!

The intrepid Les Pounder brings you the latest community and LUG news.

Find and join a LUG Bristol and Bath LUG Meet fourth Saturday of each month at the Knights Templar 12.30-4pm. http://www.bristol.lug.org.uk Blackpool LUG & Makerspace Meet every Saturday, 10am to 2pm. At PC Recycle, 29 Ripon Road. http://blackpool.lug.org.uk

Tyneside LUG Meet from 12pm, first Saturday of the month at Discovery Museum, Blandford Square. http://www.tyneside.lug.org.uk Manchester Hackspace Open night every Wednesday at their space at 42 Edge St, in the Northern Quarter of Manchester. http://hacman.org.uk Lincoln LUG Meet on the third Wednesday of the month at 7pm, Lincoln Bowl, Washingborough Road, Lincoln, LN4 1EF. http://www.lincoln.lug.org.uk Hull LUG Meet at 8pm in Hartleys Bar, Newland Ave, first Tuesday every month. http://hulllug.org Surrey & Hampshire Hackspace Meet each Thursday, 6.30pm, Games Galaxy, Farnborough. http://www.sh-hackspace.org.uk Liverpool LUG Meet on the first Wednesday of the month from 7pm onwards at the Liverpool Social Centre on Bold Street, Liverpool. http://liv.lug.org.uk/wiki Edinburgh LUG Meet on the first Thursday of the month at the Southsider pub, West Richmond St. http://www.edlug.org.uk

South London hackspace New makerspace in the Old Smoke.

I

recently had the chance to talk to "If we get sufficient funding," says Matt Copperwaite, a popular Copperwaite, "Over the next two podcaster and hackspace regular. months we will be putting together He and a group of interested individuals London's first 'pop-up' Makerspace in a have formed a second makerspace in disused shop in a very pretty part of the city of London, and he told LXF all South London, Herne Hill." This, about it: "South London Makerspace is Copperwaite says, isn't as good as a a community-driven, not-for-profit permanent space but it's a start: "We organisation with the single goal of intend to treat this space as a prototype creating a space where members can to assess the validity of our plans, meet, share and create. Starting off as a encourage members to join and show group of around 15 people who the people of South London what we scrounged studio space where we could achieve if we were let loose on a could find it, we're now a registered permanent space." company with paying members." If you can help out or donate or want Copperwaite and co hope to create to visit once the Makerspace is open in an artistic, family friendly community of the coming weeks, you can find out at designers, engineers and hobbyists: southlondonmakerspace.org. LXF "we are very excited to be able to open this space, but to get this well-deserving project off the ground, we are looking for your help and donations.” The initiative has also been fortunate enough to get two months rent-free on a property but still needs to cover business and start-up costs as well as furniture, The makerspace has quickly sprung forth from an bills, tools and a lick of paint. empty shell into an active community.

Community events news

MmIT Conference 2014 Multimedia Information & Technology Conference is an annual conference and for 2014 the event is focusing on creating, producing and curating digital content. Headline speakers for

this year are Liz McGettigan, Director of Digital Library Experiences at SOLUS who will be speaking about the use of augmented reality in the customer experience, and Richard Ranft from the British Library Sound Archive, who will talk about the British Libraries sound and vision resources. The conference will be held on 4 September in the city of Sheffield. You can can find out more from their Eventbrite page http://bit.ly/LXFbrite

Best of British The Best of British conference is a celebration of UK talent that crosses technologies, genders and age. The conference, taking place on 13 June, is at the time of writing being funded through a Kickstarter campaign. Currently the lineup of speakers includes Ian Forrester from BBC R&D and Dr Tom Crick, Senior Lecturer in Computer Science from Cardiff Metropolitan University. Learn more at its website. http://bit.ly/LXFbestob

www.tuxradar.com

WordCamp Manchester On 28th June at the Manchester Metropolitan University is a conference devoted to the blogging platform. Learn more about using Wordpress and how to shape your site to meet your requirements. The event is organised by the team behind the Manchester Wordpress User Group and the co-founder of Wordpress itself. Get the latest updates from their website: http://2014.manchester. wordcamp.org

July 2014 LXF185     13

Concepts

Python

Arduino

PHP

Android

Coding Academy

Only

99p /99¢

each

10 ways to be a better coder Only from Linux Format More Concepts

Ruby

Unusual

More Python

More Android

Available on Apple Newsstand – just search for ‘Linux Format’ and download the app

All the latest software and hardware reviewed and rated by our experts Matt Hanson has been installing all kinds of fun components in his already bulging PC.

Do as I say...

S

ometimes you just can’t help being a hypocrite. Of course, by ‘you’ I mean ‘me’… ’I’… the goofy looking chap at the top of this column. Only a couple of months ago I was extolling the virtues of cheap and affordable hardware, and yet here I am, a handful of issues later, gazing lustfully at a GTX Titan Black graphics card. It’s one of the most powerful single-chip graphics cards on the market – and it’s also one of the most expensive, selling for around £800. Far beyond the budgets of most people – especially tech journalists that are well acquainted with the breadline. When Nvidia announced the first Titan graphics card, even hard-core enthusiasts baulked at the price tag and the excessive power which wouldn’t be utilised unless you were running the latest games hooked up to three high-resolution monitors. Still, as a thought experiment on just how powerful a single GPU could be, it’s fascinating. Rather amusingly, Nvidia recently announced the Titan Z, which effectively combines two Titan Blacks into one card, all for around £3,000. Also rather hypocritically of me, while I talked last month of running distros as virtual machines, it doesn’t stop me from having a fair few distros and operating systems installed on my main machine. When one of these goes belly up (as it did earlier this month) and necessitates a reinstall, Grub doesn’t like it one bit, so I must tip my hat to the folk behind the Boot-Repair tool that I had to rely on to get everything up and running again. [email protected]

Our pick of this month’s releases: Ubuntu 14.04 LTS ...16

AOC A2472PW4T.... 21

We delve deep into Canonical’s latest long-term support release – Trusty Tahr. Is it a worthy upgrade?

A touchscreen monitor that comes with an onboard computer that runs Android.

LPS 1.5.1..................18

Razer BlackWidow.. 22

A live CD distro that values web security above all else – from the US Air Force, of all places.

We tap our fingers on this mechanical keyboard that’s built for games and precision typing.

Sonic Pi...................19

FRITZ!Box 7490...... 22

We review this fun music-based program that can help you learn the Ruby programming language.

The latest in a line of excellent routers gets plugged in to see just how fast it can be.

iStorage diskAshur.20

Game reviews......... 23

This excellent USB 3.0 external hard drive takes security very seriously, mixing software and physical protection.

This month we play a headscratcher of a puzzle game called Circuits and a Trekkie-like turn based strategy The Last Federation.

AOC A2472PW4T: An all-in-one PC that runs the Android operating system.

Ubuntu 14.04

The Last Federation

LTS releases are supposed to play it safe, but will Trusty Tahr break the pattern?

Take it in turns to save a solar system with this strategic space simulation.

Wiki platforms p24 MediaWiki

Dokuwiki

PmWiki

TiddlyWiki

www.tuxradar.com

Foswiki

Fancy running your own wikibased website? We test out five content management systems that can help you make a successful – and useful – Wikipedia killer.

July 2014 LXF185     15

Reviews Linux distribution

Ubuntu 14.04 LTS Weary of Long Term Support releases, Mayank Sharma approaches 14.04 without much expectation – is he in for a surprise? In brief... One of the most popular mainstream desktop distros. See also: Mageia, Mint, Fedora.

L

ike clockwork, Canonical has churned out its fifth LTS release right on schedule two years after the previous one. In terms of numbers, this is the project’s 20th release as it enters its 10th year of existence. The LTS releases are supported for five years and thus the primary focus of the developers is to iron out the rough edges and ensure they ship a stable and bug-free distro. This is why you'll find most of the changes in a LTS release are fairly conservative in nature. At first glance Trusty Tahr, as it was codenamed, seems to fit the pattern – it looks pretty much the same as the last release and is missing incomplete components like the Mir graphics stack that will propel the distro into its multiple device future. However, it doesn’t take long to realise the subtle changes that make the desktop behave differently than previous releases. Visually the desktop is pretty much similar to Ubuntu 13.10, with a similar wallpaper and no additional icons on the Launcher. In fact, it’s missing one for the recently and suddenly discontinued Ubuntu One cloud storage service, which is a real shame. The Dash too lacks any new lenses. In fact you have to peek at the Release Notes to realise the revolutionary new addition to the distro – for the first time since the introduction of Unity, users get to decide the location of the application menus. By default, menus are displayed

Ubuntu 14.04 includes lots of usability improvements such as a slick new easy-to-access lock screen that’s similar to the login screen.

in the top panel known as the Global Menu. But you can now bring them closer to the app by toggling the Menu Bar radio button under System Settings > Appearance > Behaviour. This feature is cleverly implemented and the menus are displayed in the same title bar that houses the window control buttons. At the same time, the addition of the menus doesn’t interfere with the default action for moving windows by grabbing the title bars. While you’re in the System Settings window, also take note of the fact that you can now scale the icons on the launcher all the way down to 16px. This is a minor but useful addition, especially if you are using the distro on a nontouchscreen monitor with limited

Features at a glance

Local menus

You can finally bring down menus from the Global menu and integrate them into the windows themselves.

16     LXF185 July 2014

More control

Ubuntu now gives users more control with new Ubuntu-specific settings application derived from Gnome’s Control Center.

www.linuxformat.com

screen real estate. Another minor blinkand-you-miss-it feature is the checkbox in the Sound section that enables you to raise volume past 100 percent.

Settling debt Some of the changes to the distro, to both visible and non-visible components, stem from Mark Shuttleworth’s objective of using this release to reduce, what he describes as the “technical debt” to prepare the ground for future developments. One clear example of this is the use of the Ubuntu Browser written in QML. This browser is also used in the Phone and Tablet builds, part of the unification ideal behind Unity. On the desktop, the Ubuntu browser is used for displaying web apps that now open inside single windows of the browser. However, the browser isn’t well integrated into the desktop. For example, when you search for documents in Google Drive via the Dash, Ubuntu opens them in Firefox instead of the Ubuntu browser. Furthermore, the Ubuntu browser lacks many of the features you’d expect in a web browser, such as tabs. Also the new app behaves abnormally when navigating open pages and refuses to switch between multiple instances of itself. We find it very surprising that Canonical has decided to include this very raw app in an LTS release. However, the distro is now slicker than ever. Ubuntu has shifted from

Linux distribution Reviews

using the Compiz Decor plugin for decorating windows to GTK3 CSS themed window decoration. Due to this windows are now anti-aliased and smoother around the corners. Windows themselves are now completely borderless instead of having a one-pixel black line around them. There's also another change that’s in front of your eyes but might go amiss as it only comes to light when you resize windows. Unlike previous releases, where you got a yellow box indicating the size of the window when it was being resized, in Ubuntu 14.04 the action occurs in real time. So when you grab a window by its edge and drag to resize, the window resizes right there. If you work with multiple windows keep an eye out for the minor usability enhancement when you trigger the Spread view. For the uninitiated, this view is triggered when you click on an app’s icon in the launcher which is in focus. If it has multiple open windows, the Spread view displays all of them. Starting in Ubuntu 14.04, you can filter the open windows by their title in the Spread view. Just toggle the view and start typing to bring up a Dash-like search bar which filters the windows by their title. Another much requested feature that has been made reluctantly available to users, albeit in a convoluted way, is the ability to minimise a running app by clicking on its icon in the launcher. To turn on this feature you’ll need to grab the CompizConfig Settings Manager app via the Software Center and navigate to the Launcher tab under the Unity section which lists the feature.

Ah, look – another web browser!

Lest it slip your mind, this is an LTS release and is littered with minor improvements. There is improved support for high-resolution displays, and TRIM is enabled by default for Intel and Samsung SSDs – which should decrease the performance hit on SSDs after some time. Graphics-wise the distro ships with the latest nvidia-prime driver which boasts of improved support for Nvidia’s

“A wonderful and stable distro with no unexpected surprises.” Optimus optimisation technology. The release also comes with the LTS promise – five years of critical security updates and fixes and regular Hardware Enablement Stacks to help you get the most out of your hardware.

In terms of software, as with every Ubuntu release, Trusty includes the latest versions of the core apps. There’s LibreOffice 4.2.3, Firefox 28, Thunderbird 24.4, Shotwell 0.18, Rhythmbox 3.0.2 and Empathy 3.8.6. As things stand now, Ubuntu 14.04 will likely be the last Ubuntu released solely for the desktop. This could also be one of the reasons why Trusty Tahr is perhaps the quirkiest of all LTS releases. An LTS release isn’t the ideal platform to bridge the gap between different platforms, and because of this Trusty Tahr is an odd mixture. On one hand, it’s missing features critical to Ubuntu’s multi-platform strategy, such as the Mir display server, while on the other it includes under-cooked ones like the Ubuntu browser. That said, Ubuntu 14.04 is still a wonderful and stable distro with no unexpected surprises. Its Unity desktop now gives users more control over its appearance than ever before and warrants another look from users who deserted the distro when it swapped out Gnome. LXF

Verdict Ubuntu 14.04 LTS Developer: Canonical Web: www.ubuntu.com Licence: GPL and others.

Features Performance Ease of use Documentation

7/10 8/10 7/10 9/10

Does enough to keep existing users hooked and should look inviting enough to completely new users.

It’s all as elegantly simple to get to grips with as it always was...

www.tuxradar.com

Rating 7/10

July 2014 LXF185     17

Reviews Linux distribution

LPS 1.5.1 Run a thin Linux OS from CD and make your browsing experience as secure as possible. The intrepid Duncan Evans boots it up and reports in. In brief... Boot from a Linux OS on non-writeable media to keep web browsing and transactions secure. See also Linux Tails.

Specs Boot from nonwritable media Internal drives not mounted Suite of installed utilities Internal file system based in memory IMAP mail and Firefox with Java and Flash Encrypt DNS traffic

O

nline security is under threat, and as the Heartbleed flaw recently demonstrated, you can never be too careful. That’s the thinking behind the Lightweight Portable Security system, designed and offered for free from the US Air Force Research Laboratory. This is a version of Linux designed to run from non-writable media, so malware or web-based viruses can’t write to the hard drive and infect the machine. It reboots between sessions so any infections picked up can be cleaned out of memory, making for a secure next browsing session. This is particularly useful for online banking, or when dealing with highly sensitive websites. Start by downloading the Public Deluxe version from the Air Force Research Laboratory’s website http://spi.dod.mil and is the usual ISO image that can be written to an optical disc. Then simply boot from the CD/ DVD on either a PC or Mac. Booting from a CD takes a few minutes, but once complete launches straight to the desktop. You can also create a version to boot from a memory stick, but that requires loading from the CD/DVD first and then formatting the stick. The memory stick version boots up to five times faster but is less secure because malware can write to it. Avoid writing personal files to the stick so it can be erased again afterwards. Once loaded, any drives attached by USB are mounted, but the internal ones are not. A file system is created to provide local storage space for files, but this is all in memory and if you reboot,

Make bank transactions more secure and take advantage of utilities such as Encryption Wizard to secure files.

18     LXF185 July 2014

Although designed for use by the military, the Lightweight Portable Security system has obvious security advantages for regular computer users as well.

anything that is apparently saved will be lost. You can save files to removable media (though this is the less secure option), or attach them to emails and send them to yourself. Internet connection by Ethernet is automatic, and Wi-Fi is supported once configured in the Network Manager utility. The big advantage of being able to turn the session off or reboot it is that all network activity is cleared, including browser history, personal data, login information, passwords and the like. Any keyloggers or malware are thus dumped from the system. The bundled Firefox browser supports Java, Flash, and smart cards for accessing secure government websites. A PDF viewer, mPaint, Unzip, Leafpad text editor, file browser, Encryption Wizard, SSH client and remote desktop software (Citrix, MSoft or VMware) are also installed. Thunderbird and DAVmail apps are provided for IMAP-server mail, so if your provider uses POP3 you’ll need to find a workaround like webmail. One of the security-orientated apps bundled with the Deluxe version of the download is Encryption Wizard. This is very simple to use – just drag files to be encrypted to the interface window and specify a password to access them. The files are then all encrypted and can be sent to recipients via email. For writing and then encrypting files, LibreOffice is also installed. There are two other security-related apps in the Security

www.linuxformat.com

folder too. One is a tool for validating that OpenDNS is being used for DNS lookups. The other is DNSCrypt, which is disabled by default. Once enabled, which must be done each session, this uses the OpenDNS service for DNS lookups and then encrypts DNS traffic. This can prevent some attacks and increases privacy. While LPS can’t be updated or patched in itself, the Air Force releases quarterly updates for it, requiring a new download and burning session. LPS is a quick and efficient system, but using it each time from a complete reboot is time-consuming and not a solution for everyday use. However, if you do have sensitive data to send, or websites to access, it offers a novel approach to online security.. LXF

Verdict LPS 1.5.1 Developer: AFRL Web: http://spi.dod.mil Licence: GPL

Features Performance Ease of use Documentation

6/10 8/10 7/10 7/10

Provides malware protection and more secure browsing, but is too limited for everyday use.

Rating 8/10

Education Reviews

Sonic Pi Les Pounder now has worrying delusions of a glittering music career, thanks to this nifty programming environment. In brief... A musically focused programming environment using the Ruby language. See also: Scratch and DIN is Noise.

T

here are many ways to learn coding, but not all of them are fun. Traditionally, coding has been taught from thick tomes of textbooks, unless, of course, you have been blessed with a great teacher. The Raspberry Pi Foundation (www.raspberrypi.org) has recently launched a new website and a set of learning resources that aim to make computing and coding more fun. One of the resources in the spotlight is Sonic Pi, which combines the fun of creating music with the logic of programming. Sonic Pi is a novel way to introduce programming concepts and uses the Ruby language to great effect. Ruby is very clear and easy to understand, but also benefits from a rich history of documentation.

So simple Sonic Pi has a simple interface that consists of three panes. On the left, there are eight workspaces, and users can create their code in any of these areas. To the top right there is an output pane that displays, line by line, the result of the code. Lastly, in the bottom right, there is an error pane that helpfully instructs the user when an error has been found. While it’s true that the Sonic Pi interface is very clean and simple – some might call it barren – the lack of distractions helps to focus the user and enables them to make music and sneakily learn some code at the same time. Once the user has

Features at a glance

Clean environment

The clear and unobtrusive environment enables users to focus 100% on their coding without distraction.

Helpful libraries

Sonic Pi also has a library of sounds and other effects that can be used in users’ compositions.

Ruby is a clear language that provides the user with a great grounding in programming concepts.

written their music/code, they simply click on the play button, which is located with the stop button in the top left of the menu. You can use one of the many workspaces to create your masterpiece, but before you go off and create the next number one single, your journey must start with one small step. And that step in this case is playing a note. play 60 Typing in this command and then clicking on the play button will play a single note. The number 60 represents the pitch for a C note. You can then tinker with your code to play a pattern of notes, such as the first line of Twinkle, Twinkle, Little Star. play_pattern [60,60,67,67,69,69,67] As mentioned earlier, Sonic Pi is powered by a programming language called Ruby, which has a similar syntax to Python. Standard programming concepts such as loops, iterations and parallelism are easily constructed and used to great musical effect. In just 15 minutes of using Sonic Pi, we managed to create a simple loop that iterated from notes 60 to 80: for i in (60..80) with_synth "pretty_bell" play i sleep 1 end Sonic Pi is not just an application – there are also resources available via a partner website hosted by the

www.tuxradar.com

Computer Laboratory at the University of Cambridge (http://bit.ly/SonicPi). These resources provide a great learning experience and have been designed to complement the Key Stage 3 curriculum for computing science, which will be introduced into schools from September 2014. Sonic Pi is the perfect introduction to coding and has the potential to really bridge the gap between the visual stylings of Scratch and the textual language Python. Music is a great way of catching the user’s interest and the decision to employ Ruby is sensible, given the clear syntax. The creation of learning materials for this project will be a welcome inclusion, and will help promote the idea that coding can be accessible and creative. LXF

Verdict Sonic Pi Developer: Sam Aaron Web: http://bit.ly/SonicPi Licence: MIT

Features Performance Ease of use Documentation

8/10 9/10 9/10 9/10

A simple, unique way to learn programming. The use of music as a driver provides a great hook.

Rating 9/10 July 2014 LXF185    19

Reviews USB storage

diskAshur Pro David Hayward says that this is the most incredible USB storage   device you’ll ever use – you should try it! In brief... If James Bond used a super secure USB device, he’d use a diskAshur Pro. Its high data protection capabilities make it worth millions.

Specs Features: Secure keypad access to data, 128MB buffer, Bus powered, USB 3.0 Physical: 19 x 84.5 x 120mm, 190g Warranty: 2-years limited Approvals: NIST FIPS 140-2 Level2, FCC & CE, Water & dust resistant.

W

hat price would you put on the protection of your digital documentation? To some, security is priceless, especially if they have a need to transport or store highly sensitive data. Even the home user should really consider a digital vault of some description. iStorage have a solution that ticks all the necessary boxes, and then some. With a reputation for designing super secure and toughened portable hard drives, they provide peace of mind for those who regularly transport digital information by hand. This, the diskAshur Pro 1TB version, is a pretty impressive solution to your security needs. First off, we have a portable hard drive measuring 19 x 84.5 x 120mm and weighing a mere 190g. The built-in USB 3.0 cable extends to a reasonable 120mm from the unit, and the device’s toughened, rubberised finish offers an element of water-proofing and ruggedness not seen in other portable hard drives. The dominant feature, and perhaps the biggest selling point, is the large numeric keypad on the front of the device. From here, you can set up an administrator and five unique user pin codes up to 16 digits in length. This, in combination with the 256-bit AES-XTS military-level encryption, means that whatever you store on there will be secure from prying eyes unless their owners know the pin code.

Tight security

The built-in USB cable keeps everything in one place, making it a true portable multiplatform device.

In addition to the above, there are also some very nifty features that sound like they come straight from Q branch. You can set a unique self-destruct pin that, when entered, will instantly destroy all pins and data, and then create a new encryption key. It’s protected against brute force attacks, is OS independent and works on any system including thin clients. There’s even an SSD version

available, and there’s no software to install either. The diskAshur Pro can even withstand a shock or impact up to 1,000G when not in operation, or 300G while it is being used. The USB 3.0 connection livens up this version of diskAshur from previous versions, and is further helped by the 128MB buffer and 12 millisecond average seek time. Transfers are swift, according to Bonnie++ under Linux Mint 16: over 28MB/s on a standard USB 2.0 port and an impressive average of 115MB/s via USB 3.0. Watching movies off it is perfectly possible, although a tad overkill. You can quickly transfer data as soon as you enter the pin, then get out safe in the knowledge that you’re the only one with access to the information. In the box you get the device itself, along with a padded nylon carry case, a quick start guide and a USB extension cable. The instructions are easy enough to get to grips with, and you’ll soon get used to the plug in-enter pin-access drive-lock-unplug way of doing things. The only concern we had was the lifespan of the keypad. It’s certainly robust enough, and is well-engineered, but what if the numbers start to rub off or it develops a fault and a key fails? The two-year warranty that iStorage supplies upon registering your diskAshur will take care of that to some extent, but we’re told if it breaks outside of that the data is lost. The diskAshur Pro is a very interesting bit of kit, and it comes in

A small, tough and very protective USB device that will last you for years to come.

a range of storage capacities, too. If you’re deadly serious about securing your data, either for transport or as a backup, or you’re in the business of having sensitive or critical data while on the go, then the range of diskAshur products will be crucial for your organisation. Either way, diskAshur is certainly worth investigating. LXF

Verdict iStorage diskAshur Pro Developer: iStorage Web: http://goo.gl/1eECpg Price: From £209 (500GB)

Features Performance Ease of use Value for money

9/10 8/10 8/10 8/10

The value of securing your data is beyond limits and the diskAshur Pro ensures it is safe from prying eyes.

Rating 8/10

20     LXF185 July 2014

www.linuxformat.com

Smart monitor Reviews

AOC A2472PW4T The smartest Android all-in-one available? David Hayward tries it out. In brief... A glimpse into the future of the AIO and desktop monitor, or simply another niche touchscreen product?

Specs Base: Android 4.2 Available Packages: Google Play, plus the usual base apps and widgets Features: 23.6-inch IPS touchscreen, 1080p resolution, quad-core Nvidia T33 1.6GHz CPU, 2GB RAM, 8GB flash, 2xUSB, HDMI, VGA, Ethernet, Wi-Fi, Bluetooth, 720p webcam

I

f the future of screen technology lies in touch-centric devices, then AOC has matters well in hand. This, the A2472PW4T, is a 23.6-inch smart all-in-one Android and PC touchscreen monitor with a wealth of features that are sure to pique the interest of home enthusiasts and business users alike. In a modern office environment, where workers expect the very best in productivity, mobile communications and impressive visuals, this smart AIO delivers the goods. The IPS panel has a native resolution of 1,920 x 1,080, and produces a bright, vibrant range of colours without too much washout (although it’s not quite as sharp as a less-smart monitor). The quad-core 1.6GHz Nvidia T33 CPU, combined with an impressive 2GB of DD3 RAM and 8GB eMMC flash memory, drives this Android 4.2 smart AIO device along at a rate of knots, making it instantly more capable than the likes of the ViewSonic VSD220 or the TD2340 from a touchscreen point of view. Extra features, such as two USB ports, Micro USB, VGA, HDMI (with MHL support), Bluetooth, Ethernet, 802.11 b/g/n, a 720P front webcam, SDHC card reader and a pair of built-in 2W speakers add up to make this a tantalising package. When you want to get some work done, simply power up A2472PW4T in Android mode and hook up the Ethernet port, plus a keyboard and mouse. There aren’t any productivity apps installed by default, but it doesn’t

As a monitor The AOC A2472PW4T is a good monitor. There’s no height adjustment, only the tilt, but there’s enough built-in connectivity to make it useable. The touchscreen worked very well with Windows 8, and various Ubuntu-based distros performed admirably too. Sadly, it wasn’t quite as sharp as we would have liked. The colours and brightness

levels were fine, but there was an overall lack of detail, sharpness and clean lines in the day-to-day desktop duties we performed. The selling points, obviously, are the Android mode and touchscreen integration, yet large touchscreens are still very niche and until the general public embrace them thoroughly, there’s still a lot left to be done.

take long to scan the Google Play Store for handy tools such as Kingsoft Office. You can browse the internet, organise your calendars and even edit media using the smart display, but you are ultimately limited by the quality of the Android apps available. As a productivity device, the A2472PW4T fares reasonably well – this review was typed using a word processing app and an attached keyboard – but the lack of overall control you have over a mobile app, as opposed to an installed productivity program in Linux, can make the device feel more like a gimmick than a serious contender to standard all-in-one PCs. It’s not all work, though – you can play the immense collection of games in the Google Play Store, and watch virtually any form of HD media thanks to the A2472PW4T’s impressive specs. The speakers are tinny, as with most AIO devices, but hooking up a decent set of desktop speakers or headphones makes a world of difference.

You’ve got the touch Leaning over the desk to use the touchscreen is a bit of a nuisance. You can pull the monitor closer, but then you’re left with staring at an over-large display mere inches from your face. In all honesty, using a touchscreen monitor is great fun to begin with, but after a very short time it becomes annoying. The ability to use a keyboard and mouse is therefore a godsend, and practically speaking, saves this AIO from being just an oversized tablet. The design of the A2472PW4T has a few issues. For starters, the inch-wide piano black bezel is distracting, then there’s another inch of the display panel before you actually get to the screen, which makes you feel like the display is smaller than it actually is. It’s also quite

www.tuxradar.com

It’s fairly elegant, despite being a little unwieldy.

heavy and unwieldy; the kickstand is stiff and manoeuvring it into position is a pain because of the sheer weight of the product. On the other hand, it’s well constructed. There aren’t any creaks or groans from the plastic bezel, and once the kickstand is out there’s no fear of the monitor crashing to the ground. The multipoint touchscreen works well and picks up gestures, swipes and pinches without a hint of a problem. As a presentation screen, this AIO is as near perfect as you could ask for, and close-up gaming is pleasing when played out on a larger screen. On the whole, and despite the negatives, this is a good Android-based touchscreen monitor. At this price it is expensive for the tablet technology and considering the display tech, but the device has plenty of potential. Indeed, it is one of the better devices of its type available right now. LXF

Verdict AOC A2472PW4T Manufacturer: AOC Web: http://goo.gl/kANfKq Price: £359

Features Performance Ease of use Value for money

8/10 7/10 6/10 7/10

Although there are a few potential issues, this is an interesting look at the future of the all-in-one devices.

Rating 7/10 July 2014 LXF185     21

Reviews Keyboard / Wireless router

Razer BlackWidow Is the high price of this mechanical keyboard justified? Phil Iwaniuk has a tap. Specs Width 475mm (18.72in) Height 171mm (6.74in) Depth 20mm (0.79in) Weight 1500g (3.31lbs) Audio-out/micin jacks USB passthrough

D

espite its nosebleed pricing, the Razer BlackWidow Ultimate keyboard is a relatively simple piece of kit. There’s no pulsing LED mode or extraneous displays like the ones you commonly find in other gaming-orientated keyboards – just straight lines, even and effective green backlighting, five dedicated macro keys and solid – indeed, pretty much bomb-proof – build quality. The body of the board has a matt rubberised finish that looks great out of the box, but won’t stay that way for long if you have a penchant for mid-game Monster Munch, such is its tendency to display smearing and smudges. The board is not supplied with a palm rest either, but using the feet at the rear of the board it’s easy enough to find a comfortable typing position without one. The braided USB cable allows one USB passthrough along with audio and mic 3.5mm inputs, tucked away to the

right-hand side of the board to keep things neat. The switches beneath the keys are Razer’s own design, but if you take the Pepsi challenge with these and a set of Cherry MX Blue switches you’d have to be quite the typing virtuoso to feel any difference. These are the ‘clicky’ variety, making an audible sound when the key press is registered and before the key reaches its maximum point of travel. Unlike with some mechanical boards that are conducive to hours of typos (or erroneous grenade tosses in games), we found the BlackWidow accurate and easy to control from the off. All it’s really lacking is a breakout volume control like the one you’ll find on Corsair’s boards. Instead you have to press the function key and tap F2 and F3, which seems a shame for such an expensive offering. LXF

This keyboard not only feels good, it looks and even sounds great.

Verdict Razer BlackWidow Ultimate Manufacturer: Razer Web: www.razerzone.com Price: £115

Features Performance Ease of use Value for money

7/10 9/10 9/10 7/10

A great-looking, comfortable-to-use keyboard that lacks a few features compared to others at similar prices.

Rating 8/10

FRITZ!Box 7490 The brand new FRITZ!Box router boasts fast wireless AC compatibility. Matt Hanson takes it for a spin. Specs Wireless AC and N with 1300 Mbps (5GHz) and 450 Mbps (2.4GHz) simultaneously VDSL & ADSL2+ 4 x gigabit LAN 2  x USB 3.0 / 2.0 for printers and storage media Media server for music, images and video NAS functionality (FTP, SMB, UPnP AV)

22     LXF185 July 2014

G

erman company AVM has built an impressive reputation with its Fritz line of networking products. The aesthetics might not be to everyone’s tastes, but there are some very competent network technologies included. Here it’s wireless 802.11ac technology, which promises maximum speeds of 1300Mbps and a much wider range for your wireless network, if your machine has a built-in AC adapter. Wireless speeds faster than a wired Ethernet connection sound almost too good to be true, but in our benchmarks the 7490 performed well, with a very impressive 371Mbps throughput when our AC-equipped laptop (with Intel Dual Band Wireless-AC 7260 Linux drivers installed) was in the same room as the router. When we moved outside the room and up a flight of stairs, speeds dropped to a still respectable 130Mbps.

The FRITZ!Box 7490 also comes with a host of advanced networking features that go some way to justifying the high price. It can simultaneously broadcast dual AC and N wireless networks on both the 5GHz and 2.4GHz bands. Its USB 3.0 ports enable you to share printers and storage devices across your network, and there are four gigabit LAN ports. The built-in software offers a lot of configuration tools, like parental controls, but its interface isn’t the most user-friendly we’ve tried. Still, it can be easily accessed through a web browser from any connected device. The 7490 also acts as a DECT base station for up to six phones, making it a good choice for small businesses. All these advanced tools make the 7490 quite a bit more expensive than a standard router, so do consider whether you’re going to be using them. LXF

www.linuxformat.com

Not much to look at, maybe, but the FRITZ!Box 7490 is a powerful router.

Verdict FRITZ!Box 7490 Manufacturer: AVM Web: www.fritzbox.eu Price: £247

Features Performance Ease of use Value for money

10/10 9/10 8/10 7/10

This 802.11ac router offers excellent performance and a host of advanced features, though at a premium price.

Rating 8/10

Linux Games Reviews

Circuits

Matt Hanson tries out this musical puzzle game. In brief... You’ll be mixing music and puzzles in this interesting and unique game that’s honestly unlike anything we’ve seen, or heard, before.

M

ost puzzle games aim at giving your brain a workout, with head scratchers designed to encourage you to think hard about how to put the pieces together and move on to the next level. Circuits, however, is a very different puzzle game. Judging from the name – or by casually looking at the screenshots – you’d be forgiven for thinking that it was based on creating

Build music tracks to beat the puzzles in Circuits.

electrical circuits. In reality it has nothing to do with electronics, and rather than having to rely on mental agility to solve the puzzles, you need to use your ears. When you load up the game it tells you that for the best experience you should use headphones – and it’s not kidding. Each level consists of a short musical track that you need to listen to carefully, which is also represented visually as a circuit board, with certain instruments, notes and riffs represented as components. You then need to replicate the track by placing icons along the circuit. Things kick off simply enough, but the difficulty ramps up as more complex tracks are introduced with multiple instruments and layers. Whilst the ambient music might not be to everyone’s taste, it’s well done, and along with the minimalist graphics produces a calm and relaxing game. The first few levels introduced us to the concept of the gameplay, and provided little challenge even to our

festival-battered lugholes. Even then, it didn’t take too long for our interest to wane. In small doses this is a unique and relaxing way to while away a few minutes, but it’s not the most gripping game we’ve ever played. Thankfully a sensible price, just shy of £2, makes this a tempting bite-sized game. LXF

Verdict Circuits Developer: Digital Tentacle Web: http://bit.ly/DigTentacle Price: £1.99

Gameplay Graphics Longevity Value

6/10 7/10 6/10 7/10

If you’re after a quirky music-based puzzler, then you’d do much worse than spend a couple of quid on this.

Rating 6/10

The Last Federation An entire solar system is in trouble, and its only hope is Matt Hanson. In brief... Take turns with your opponent as you make war – but not love – or form alliances across an imperiled galaxy.

B

ringing peace to a solar system, with its billions of inhabitants quick to go to war with their nearest celestial neighbours, can be a complex process. Whilst on the surface The Last Federation’s missions can be completed with firepower and outmanoeuvring your warship against the enemy’s, you can also go the diplomatic route, and try to resolve conflicts peacefully – though there is a catch.

It’s hardly Hitchhiker’s Guide, but it gave us a giggle.

The Last Federation is a turn-based strategy game, which means you take a turn to determine where you want your ship to move to, and what enemy ships you want to attack (if any). Your opponent then takes their turn to do the same – similar to a game of chess. However, unlike chess, you don’t see the other player’s move before you make yours – both opponents choose their moves at the same time, then watch the conflict (or lack of it) unfold. When attacking a ship you can hover the mouse over the ship to see what defences they have, and which of your weapons will cause the most damage. This lends a degree of depth to fights – however, you can also end levels peacefully. This involves you docking with the enemy and handing over resources. These could be used against you, but in return your reputation with the opposing force will be improved, which could lead to alliances later. The

www.tuxradar.com

gameplay is fun and strategic, and the graphics and music are decent, though far from mind blowing. The whole package reminds us of older turn-based strategy games – no bad thing. There’s also a sense of humour that keeps it from taking itself too seriously. LXF

Verdict The Last Federation Developer: Arcen Games Web: www.arcengames.com Price: £14.99

Gameplay Graphics Longevity Value

8/10 6/10 7/10 7/10

A fun and surprisingly complex space-bound turn-based strategy game with a GSOH.

Rating 7/10 July 2014 LXF185    23

Roundup Roundup Office Wiki platforms suites

Every month we compare tons of stuff so you don’t have to!

Wiki platforms Marco Fioretti presents five free software wiki platforms to help you write, organise and colaborate on lots of documents, which all the world can see.

How we tested... There are plenty of free software wikis. The five examples described on these pages were chosen with two main criteria in mind. We wanted them to be actively developed packages that would be useful and worthwhile for individuals as well as huge communities, and we were really keen to show how varied the free wiki landscape is. That’s why in this article you’ll find the famous heavyweight MediaWiki; a singleuser product; a little-known but very powerful structured wiki; and two small, traditional wikis that are nonetheless easy to use and rich in features. All the programs were installed on a CentOS 6 virtual server using the recommended methods, but we have mentioned the alternatives when they are available. We then tested each piece of software by creating users and pages, and installing plugins.

F Our selection MediaWiki Dokuwiki Foswiki PmWiki TiddlyWiki

24     LXF185 July 2014

act 1: while it may seem as if we live in a truly multi-media age, our culture and society is still based on producing, organising and sharing huge sets of text documents – no matter how much we try to ignore this fact. Fact 2: collaboration and team work are often – but not always – good and the internet can make them much easier. The encounter of these two realities has produced a large category of Content Management Systems (CMS) known as wikis. These packages differ from CMSes like WordPress or Drupal because they are explicitly designed to

“The most famous example of wiki software at work is Wikipedia.” produce and publish texts online – mostly collaboratively – by whoever may be interested, as quickly and as painlessly as possible, with the minimum of controls. The most famous example of wiki software at work is Wikipedia, which the majority of Western internet users have probably visited at least once, even if by mistake. The huge success of Wikipedia,

www.linuxformat.com

however, has had at least one counterproductive effect, in that many people believe it is the only way to make a wiki with free software. This roundup proves that such a belief is wrong: the free software community has produced lots of wildly different wikis, and we hope that these pages will help you find the one that is best for you and your partners.

Wiki platforms Roundup

Installation How easy is it to set up a wiki?

I

nstalling a wiki can be anything from ‘really easy’ to ‘darn difficult’. TiddlyWiki, for example, doesn’t need any real installation as its single file simply needs to be saved in a writeable folder. In some cases, you may need the TiddlyFox extension for Firefox (or its Android equivalent) if you want to save changes on the local file system, but that’s it. Administrators who want to centrally manage TiddlyWikis for different users may install it as a package of the Node.js JavaScript engine. DokuWiki’s installation begins with a download that lets each user decide which languages and plugins to include. There is a minimal (Windows-only) web server to run DokuWiki from a USB drive. You need to make the subfolders called conf and data writeable by the web server, load the install.php file in the browser and follow the instructions. As soon as you are done, set the conf folder to read-only mode and remove the install.php file to prevent attacks. The procedure for PmWiki is very similar: create a writeable subfolder

called wiki.d, copy the sample configuration (docs/sample-config. php) to local/config.php, edit the latter file to set the main parameters, and finally load the page called pmwiki. php. PmWiki can run with an embedded web server. The MediaWiki installation looks like that of WordPress. Before you begin, create a database and a user account to access it. After checking the PHP environment, the wizard asks the administrator to choose a database engine from those found on the server. Optional – but highly recommended – steps are the choice of user rights profiles and email settings. Eventually, you have to download a file called LocalSettings.php to edit as needed and then immediately upload it in the main wiki directory. Foswiki is more complicated to install and requires root access to the server. If possible, use the official virtual machine images on a dedicated computer. The Linux binary packages on the website may still require manual configuration to make installing from

The final step of the MediaWiki installation wizard, which is a pleasure to use.

sources easier. The main steps in that case involve creating an .htaccess file, protecting the FosWiki configure program with a password, and then preparing a custom configuration. This must be done with the online generator at http://foswiki.org/Support. ApacheConfigGenerator. Call the resulting file foswiki.conf and place it in the subdirectory reserved for Apache modules (/etc/httpd/conf.d/ on CentOS). Only then you will be able to load the bin/configure page in your browser, which works more or less like the MediaWiki one and creates a superuser that takes care of day-to-day administration.

Verdict DokuWiki

HHHHH Foswiki

HHHHH

MediaWiki

HHHHH PmWiki

HHHHH

TiddlyWiki

HHHHH

MediaWiki has the best combination of features and ease of use.

Architecture What happens behind the scenes, and why?

R

ating architectures when they are designed for very different uses is quite tricky. Generally speaking, wikis can store content in plain text files, databases or version control systems. File-based wikis are

less scalable and/or perform less well than the others, but work on free hosting accounts and are much easier to back up and manage. TiddlyWiki is one HTML/JavaScript page conceived for single users. It saves

The Foswiki System Web and default sidebar is overwhelming but unavoidable, considering the internal complexity of this package.

www.tuxradar.com

‘pages’, called tiddlers, and rewrites their content inside itself. It is possible to encrypt everything with a password. DokuWiki uses PHP and may have the best compromise between features and simplicity. Multiple users, versions and theming work out of the box, without any database, on any web server. The same may be said for PmWiki. MediaWiki, also written in PHP, can handle heavy loads and multiple languages (Wikipedia runs on it). The preferred backends are MySQL and SQlite, but it supports Oracle, PostgreSQL, MariaDB and Percona. It is designed to make casual, anonymous contributions as easy as possible. Foswiki is a Perl program that can run alone or under a web server. It is a structured wiki, which roughly means that it is designed to support content that is highly typed and structured – almost like a relational database.

Verdict DokuWiki

HHHHH Foswiki

HHHHH

MediaWiki

HHHHH PmWiki

HHHHH

TiddlyWiki

HHHHH

DokuWiki and MediaWiki probably make more users happy.

July 2014 LXF185    25

Roundup Wiki platforms

User interface Are they straightforward to use?

A

ll the wikis in this roundup support some form of theming, but not much else in terms of interface customisation (unless you hack their code yourself, of course). Considering this, the first substantial thing that often makes the

difference may be the internal editor. All wikis use some form of plain text markup as the source format of their pages. Some, however, force you to write that simple markup yourself, or use raw HTML. Others have buttons just like in traditional WYSIWYG office suites.

Some WYSIWYG wiki editors make it easier for absolute beginners to contribute, but also to copy and paste text, random fonts and whatnot straight from those office suites, with unpredictable and often ugly results. Is it worth it? You decide.

DokuWiki  HHHHH DokuWiki is brilliant in its simplicity. There are themes if you want them, and the default editor looks and feels great. If you want to – and you are familiar with it – you can directly use the DokuWiki markup while you write. For example, text included in double slashes or asterisks will be rendered with an italic or bold typeface respectively. If you have no idea of what markup is, then simply select some text, click on the button for the corresponding formatting and DokuWiki will add the raw markup for you where it’s needed. This process makes learning the formatting rules relatively easy and painless. One bit of advice though: before inserting any images, read the simple documentation page on DokuWiki namespaces, otherwise you may forget how to insert them and could end up with broken image links in your pages.

Foswiki  HHHHH A Foswiki is made up of semi-independent ‘webs’ that are interrelated sets of documents. Single pages are called topics and can be typed, like software variables. Templates define the look and feel of Foswiki. By default, you get a plain skin for browsers and a print skin that is optimised for paper. Besides the editor, the other main part of the Foswiki GUI is the toolbox, which is a configurable sidebar that contains all the tasks that each user is authorised to perform. The default editor is WYSIWYG, but it also supports the Foswiki markup language as well as raw HTML. Above all, the content of each page is somewhat programmable through the use of macros and/or spreadsheet-like formulas (as you can see in the image on the left). This, together with macros, page typing and powerful search functions, is what structured wikis are all about.

Import and export options If wikis are designed for sharing, how easy do they make it?

W

ikis exist to share writing and its results. They are great for publishing large quantities of pre-existing documents online. A crucial feature of wiki software is how easy it is to import or export its content. TiddlyWiki has little to export or import, apart from its Download Me button and the command line tool. Foswiki has plugins for importing MediaWiki or CSV files. MediaWiki’s Special:Export page creates a ‘content dump’ of selected

26     LXF185 July 2014

pages, or the whole wiki, as one XML file, optionally including templates and previous versions. The PdfBook extension saves all the articles in a given category as one PDF document. Other tools, tips and tricks for semi-automatic bulk import from other wikis, as well as CSV, HTML, OpenDocument or Microsoft Word files are at www.mediawiki.org/wiki/ Manual:Importing_external_content. The DokuWiki website explains how to convert HTML documents to its own

www.linuxformat.com

markup format. PmWiki scores better from this point of view, with tutorials and/or plugins for bulk import from other wikis or WordPress blogs. DokuWiki and PmWiki don’t really need plugins to be much better at this than their more sophisticated competitors. If pages are standard files in normal folders, webmasters can create them by the thousand with fairly simple shell scripts. Read the thread at https:// forum.dokuwiki.org/thread/8072 for an example of this strategy.

Verdict DokuWiki

HHHHH Foswiki

HHHHH

MediaWiki

HHHHH PmWiki

HHHHH

TiddlyWiki

HHHHH

MediaWiki has more plugins, but filebased wikis may not need them.

Wiki platforms Roundup MediaWiki  HHHHH Thanks to your visits to Wikipedia, you should be aware of what the ‘reading’ part of MediaWiki looks like, and will also know of its support for many different languages – but what about its other ‘editor’ side? The default editor in MediaWiki behaves like the DokuWiki one, just with fewer buttons – yet this shouldn’t be taken as a limitation. As well as tons of tutorials and cheat sheets that make it very easy to learn the simple syntax, there are lots of plugins that extend the formatting capabilities of MediaWiki. The one called Poem, for example, adds a tag specifically for better formatting of poems! Other plugins take care of complex tables. There are also many options to format or resize images and to place them in the current document.

PmWiki   HHHHH The PmWiki slogan is “Clear philosophy and (some) resistance to creeping featurism”. This attitude is shown in the internal user interface, which couldn’t be any simpler. It features a sidebar, a search box, links to printable versions, history and backlinks of the current page. Sidebar elements can be added or rearranged as the lists of any other page of the wiki. You still get localisation packages for many languages, floating images, customisable styles and an assortment of graphical skins. As far as the editor is concerned, there are no buttons or other distractions – there’s just a text input form. Right below that form, there is an embedded cheat sheet with all the main rules and links to ‘advanced’ formatting topics, like those for simple or advanced tables.

TiddlyWiki  HHHHH The almost official definition of TiddlyWiki is “a non-linear personal web notebook for the next 25 years”. Something this simple is very easy to maintain and customise, even for JavaScript beginners. In spite of this simplicity, or maybe just because of it, the TiddlyWiki interface works well. It’s the fastest of the bunch tested here, since almost everything happens in the browser instead of some possibly overloaded server. To get started with TiddlyWiki, you only need to know two things. Firstly, ‘pages’ are called tiddlers and to create new ones you must click on the plus icon to open the editor and its live preview box. Secondly, you can customise the interface by clicking on the wheel icon, taking inspiration from the gallery at http://tiddlyspot.com/?page=gallery.

Documentation Verdict

Is it easy to find what I need to know?

D

ocumentation and support for MediaWiki are not problematic. There is an exhaustive technical manual and a good help section on www.mediawiki.org, while the website’s support desk is one of the most actively crowded of all wikis. TiddlyWiki has a pleasantly surprising amount of documentation. You will find lots of tips over at http://tiddlywikiguides.org, while http://tiddlywiki.org has even more material, including extra developer info.

The DokuWiki manual is very thorough, but the software is so simple that you probably won’t need it that often. Incidentally, it seems that DokuWiki chose its name to send the message that all wikis are good for documentation... but this one is even better for that particular task. Check the ‘What makes DokuWiki so good for Documentation’ FAQ on the website for an extended explanation. PmWiki comes with direct link to all its documentation, including the great

www.tuxradar.com

cookbook that you may read at www.pmwiki.org/wiki/Cookbook/. Foswiki has more material than you may ever want to read. It takes time just to find your way through the index. There are, among other things, several introduction tutorials and slideshows, a users’ guide, a full reference manual and many resources for administrators, including a specific guide for the Foswiki configure tool. As good as it surely is, this is also another proof of the complexity of this software.

DokuWiki

HHHHH Foswiki

HHHHH

MediaWiki

HHHHH PmWiki

HHHHH

TiddlyWiki

HHHHH

Foswiki has the most documentation, but will you want to read it?

July 2014 LXF185    27

Roundup Wiki platforms

Admin and access control How do you keep your wiki in good shape and under control?

W

ikis are designed to be as simple as possible for end users. Making that happen is a bit trickier. A wiki administrator must keep the software up-to-date and ensure that users can only do what they need to do and nothing more. TiddlyWiki has no access control to speak of. Its upgrade procedure consists of tricking the browser by loading the old version, cancelling its old file and saving the new one with the save name with your file manager, then clicking on the Save to Disk button in the browser!

Upgrading PmWiki or DokuWiki is an easy matter of replacing the old PHP files with the new ones. In PmWiki you can impose passwords on different operations. These restrictions can be enabled for the whole wiki or for certain users or groups through Access Control Lists (ACLs). There are plugins for CAPTCHAs, blacklisting, connecting to authentication backends and for allowing external links to whitelisted URLs. DokuWiki has the best interface to create users, groups and set up ACLs. When enabled, the web-based control panel facilitates the installation of plugins.

Setting up Access Control Lists is tricky, but DokuWiki makes it simpler.

The web-based administration GUI of MediaWiki is carried out through Special Pages, unless you install thirdparty control panels. Restricting editing is easy, but blocking read access in ways that are different from the user rights profiles in the installation wizard is a completely different matter. MediaWiki is written from the ground up to share content without limitations. Therefore, while you can find plugins that will allow you to block access, you’ll discover various semi-official warnings telling you that they are not supported. MediaWiki upgrades are slightly more complex than those of its filebased competitors. After uploading the new files to their web folder, you must either re-launch the web-based installer, or (this is the preferred method) run a PHP script from the command line. Foswiki admin has the same issue as its documentation. There probably is, somewhere, at least one button for anything you may ever need to do, if you can be bothered to hunt it down. Even the upgrade procedure – while not really complex – is a pain in the neck. You have to pretty much manually copy or move lots of files. And don’t forget proper protection of the configuration page: please schedule some time for that activity alone.

Verdict DokuWiki

HHHHH Foswiki

HHHHH

MediaWiki

HHHHH PmWiki

HHHHH

TiddlyWiki

HHHHH

DokuWiki offers the best features and security, coupled with easy admin.

Plugins I want more features!

R

elax: all the wikis featured here have plenty of plugins – no one installation will need all of them. The Node.js form of TiddlyWiki, for example, can run on the command line to save single tiddlers in HTML format and perform many other tasks. Normal TiddlyWiki extensions come as tiddlers. To install them, copy the source code on their homepage in TiddlyWiki as new, ordinary tiddlers, and configure them as explained at http://tiddlywiki.org. DokuWiki plugins must be simply placed in their own folder under lib/plugins/. This is usually possible with the plugin manager from the web interface. DokuWiki’s homepage also provides plugin bundles as turnkey

28     LXF185 July 2014

“solutions to common DokuWiki applications”. PmWiki has many browser plugins and tools, including LaTeX filters and interactive page sections, but no single directory to list them all. Instead, you must figure out where a plugin is by reading the cookbook or the features page at www.pmwiki.org/ DokuWiki has the best built-in interface for wiki/PmWiki/Features. plugin management. MediaWiki’s extension matrix at www.mediawiki.org/wiki/ Foswiki is almost in the same situation, Extension_Matrix has, at the time of with a large extension list at http:// writing, nearly 2,000 entries. Their foswiki.org/Extensions. Whatever you installation usually involves manual may want to embed in a Foswiki is, very editing of the LocalSettings.php file. likely, already there.

www.linuxformat.com

Verdict DokuWiki

HHHHH Foswiki

HHHHH

MediaWiki

HHHHH PmWiki

HHHHH

TiddlyWiki

HHHHH

Foswiki and MediaWiki offer many extensions that are simple to find.

Wiki platforms Roundup Wiki platforms

The verdict I

f we were only looking for raw power and flexibility, we would immediately declare Foswiki the winner. This isn’t just a tool to let groups of casual users co-author text content as quickly and easily as possible. Foswiki is an impressive platform for creating web-based applications that look like normal wikis, but need to do a lot of data processing. But how many people or organisations seriously need something like that? Unless you’re sure you need it, learning to manage and use Foswiki is just not worth the effort. Similar considerations, but from a very different angle, exclude TiddlyWiki. This is the simplest and fastest application of the bunch, yet it is also the most flexible, because it will work on any OS – including Android – even without internet connectivity. TiddlyWiki deserves to be more widely known, but it’s not made for wiki-based teamwork. In contrast, PmWiki is a real wiki, allowing collaborative editing, simple

access control and page history. It is very easy to set up, use and maintain. The same can be said for DokuWiki, which has more features and a personalised download assistant. Above all, DokuWiki has a great web-based admin interface, which even beats the default one of MediaWiki. The latter, however, has more extensions and is better suited to handle a lot of users and heavy loads. The history review and revision control features of MediaWiki are the most complete and tested of the group. Due to its history and most famous deployment, MediaWiki has many monitoring and reporting functions that are essential for whoever wants to set up a really public wiki, with all that implies in terms of dealing with vandals, trolls and the like. The maintenance and activity reports and

This only shows a very tiny part of the monitoring capabilities of MediaWiki.

logs of MediaWiki tell the administrator everything he or she needs to know in order to spot attacks and edit wars, and these tools also allow them find pages that have not been updated for a long time. All these factors combine together to make MediaWiki the winner of this roundup, but just barely, as DokuWiki really is a little great tool!.

“TiddlyWiki deserves to be more widely known, but it’s not made for wiki-based teamwork.”

1st MediaWiki  HHHHH

4th PmWiki  HHHHH

Web: www.mediawiki.org Licence: GPL Version: 1.22.6

Web: www.pmwiki.org Licence: GPL Version: 2.2.63

Powerful and extendable, with the best monitoring capabilities.

Clean and pleasant to use, but more limited than its competitors.

2nd DokuWiki  HHHHH

5th TiddlyWiki  HHHHH

Web: www.dokuwiki.org Licence: GPL Version: 2013-12-08 “Binky” If you don’t need MediaWiki’s scalability and reporting features, get this!

3rd Foswiki  HHHHH

Web: http://tiddlywiki.com/ Licence: GPL Version: 5.0.10-beta Quick, fast and cute. TiddlyWiki is cool, but not for multi-user scenarios.

Over to you...

Web: http://foswiki.org Licence: GPL Version: 1.1.9

Did we forget to mention your preferred wiki? Email your opinions on this roundup to [email protected]

This powerful and impressive wiki needs equally powerful users.

Also consider... These five very different wikis were deliberately chosen to give you an idea of the variety of the free software wiki landscape. There are many more wiki programs around, so don’t limit yourself to the ones featured here. Go to www. wikimatrix.org and use their wizard to get an idea of how many other choices you may have. As far as Foswiki is concerned, the 20 Minute

Tutorial (http://foswiki.org/System/ TwentyMinuteTutorial) allows you to figure out if such a structured wiki is needed in your organisation. If you are still uncertain, consider how much time you can devote to managing your wiki, versus actually using it. If time, skills and other resources are limited, a file-based wiki may be the best choice. It will allow you to

www.tuxradar.com

play a bit with file permissions, and may make it easier to protect your wiki from attacks. Another good way to evaluate wikis is to start from your most unusual requirements. Do you have to insert many maths formulas, for example, or publish lots of complex tables? Check which wiki has the right combination of editor and plugins to simplify those tasks. LXF

July 2014 LXF185    29

Subscriptions

Subscribe today and get 2 years for the price of 1! Subscribe and get 26 issues for only £84.37!

S

Save 50%

£84.37 ubscribe to Linux Format and you’ll   R get an amazing 26 issues delivered  RP £168.74 to your door for just £84.37 instead   of £168.74 – that’s just £3.25 per issue. Not only is that a 50% saving off the cover price, but every copy of your favourite mag will arrive days before it reaches the shops. This amazing offer is a one-off for Linux Format, and will end   23 June. Grab it while you can!

Get all this:

 et an incredible 26 G issues for the price of 13, usually £168.74!

 ust £3.25 an issue – J a huge 50% saving!  et your copy up to a G week before it hits the shops, delivered to your door for free!  distro and FOSS-packed A 4GB DVD each issue!

Want the digital edition? Turn to page 64! 30     LXF185 July 2014

www.linuxformat.com

Acces archiv s the LXF e wit of DRM h 1000s -fr tutoria ls, featee ur and re views es

Hurry! Offer ends: 23/06/2014 Visit www.myfavouritemagazines.co.uk/LINP2D (Please use the full web address to take advantage of this special offer)

or call our hotline on 0844 848 2852 and quote LINP2D (Lines are open 8.00am to 9.30pm weekdays and 8.00am to 4pm Saturdays)

For international subscription offers go to: http://myfavm.ag/1arKtMi

In the USA or Canada? Subscribe for $139.99 a year, or $35 every 3 months Go to www.imsnews.com/linuxformat or call TOLL-FREE on 1-800-428-3003 Savings compared to buying 26 full priced issues from UK newsstand. You will receive 13 issues per year. If you are dissatisfied in any way you can write to us or call us to cancel your subscription at any time and we will refund you for all un-mailed issues. Prices correct at point of print and subject to change. This offer is for new UK subscribers to the print edition only. For full terms and conditions please visit: myfavm.ag/ magterms. Offer ends: 23/06/2014

www.tuxradar.com

July 2014 LXF185     31  

Build a Linux PC

build a linux PC Making your own PC doesn’t just save you money, it ensures you get a machine that’s perfectly tuned to your needs. Matthew Hanson shows you all you need to know.

32     LXF185 July 2014

www.linuxformat.com

Build a Linux PC

B

uying a ready-made machine on which to install Linux might seem like the most convenient way to get up and running, but you’re actually making a fair few compromises by going for a shop-bought machine. The biggest compromise is price: you’re paying a premium for someone to build the PC for you. This makes sense for those of us who want to have a slightly easier life, but you also get very little – if any – say on what components are used, so you could be paying more for hardware you might not need. This brings us on to the second compromise: the hardware. While there are some PC manufacturers that let you customise your computer before you purchase it, the personalisation options are often quite limited. This means you’ll never have complete control over how well the machine performs, and you may end up with a PC that’s fine for some tasks, but not great with others. The final major compromise you’re forced to make is one that we Linux users are all too familiar with: software. It is still frustratingly difficult to buy a ready-made computer without Windows – or Mac OS X, if you’re that way inclined – and a host of irritating pre-installed bloatware. And while wiping the hard drive and installing the distro of your choice is an unnecessary hassle, it also means you ended up paying for an OS licence that you don’t want. When building your own machine you don’t have to put up with these compromises. You’re not paying for someone else to build it, or coughing up for any premium branding – just having the name ‘Sony’ or an icon of an apple stamped somewhere seems to up the price of a computer. Instead, you’re able to shop around for each individual component to get the best deal. Careful purchases can end up saving you hundreds of pounds. Shopping around also helps you avoid the second compromise of fixed hardware as you’re free to pick ‘n’ mix components to suit your needs perfectly. Building a Linux box for working on documents, and have a NAS device already? Then you won’t be needing a huge 4TB hard drive. However, if you are a keen photographer, then a small capacity SSD will be pointless. The same goes for graphics – both Intel and AMD’s onboard graphics technologies are now so powerful that for day-to-day use you probably won’t even need a separate graphics card. On the other hand, if you’re going to be photo or video editing, you’re going to want a decent GPU, and if you’re looking to play the latest games you may need something even more powerful. If you’re going to be building and running a home server, then dependable, low-powered hardware is the way to go. Finally, because you’re building from scratch, you won’t find any pesky pre-installed operating systems and you will be good to go with the distro of your choice.

Prime choice The ‘choice’ word here is particularly important. One of the best things about Linux, as well as free and open source software, is the enormous wealth of choice. This enables you to run operating systems and software that perfectly suit your needs – and if it isn’t a perfect fit, you can always work with the source code to create your very own personalised tools. By building your own PC, customising it and knowing intimately how it works, you will have a truly personal machine rather than one that’s ‘off-the-rack’. It can’t be overstated how efficient it is to have both hardware and software that suit your needs, and can stay relevant for a good few years. It is sometimes thought that building your own computer is incredibly complicated, but it’s actually surprisingly simple. For example, you’re not able to put the wrong component into the wrong slot because of the different connections, and most motherboards come with instructions that are clear and easy to understand. This is why we’re not including a step-by-step guide here. The most important – and potentially most complicated – process about building your own PC is actually in the planning stage, in making sure that all the parts are compatible with each other and you’ve got the right components for the job. We’ll show you everything that you need to build the ideal computer for your tasks, be it a standard desktop machine, an awesome gaming PC, a media centre or a home server.

www.tuxradar.com

July 2014 LXF185     33

Build a Linux PC

Build a desktop PC Just need something for everyday use? Check this out.

M

any people want a PC for simple, day-to-day computing. If you’re building such a machine then you’re going to need to perform a delicate balancing act. There will be little need to have a flashy and expensive graphics card – as we mentioned earlier, the on-board graphics of the latest Intel and AMD processors will be perfectly fine for standard computing. There is also little need to install 16GB of the fastest available RAM. On the one hand, you’ll want to keep costs low by getting the bare minimum of components, but on the other hand it’s worth thinking about future-proofing your PC. What do we mean by this? Well, at the moment you may only need 4GB of RAM – if that. However, we are already seeing 8GB of RAM becoming increasingly common in modern computers, and you don’t really want to be opening up your PC’s case to upgrade it often. Buying less RAM might not even be as cost-effective as you think (see the Price of RAM box for more information).

Intel remains hard to beat when it comes to the best processors.

Price of RAM For the vast majority of PC users, 4GB of RAM will be plenty for day-to-day tasks. However, 8GB of RAM is rapidly becoming the norm for new computers, and as distros and programs continue to increase in complexity, we may soon see a time when 4GB of RAM seems rather… quaint. One of the biggest arguments for going with 8GB rather than 4GB is that 8GB of RAM will ensure that your PC isn’t going to go out of date any time soon, whereas with 4GB of RAM you may find yourself wanting to upgrade after a while. As well as being inconvenient, this could also cost you more money in the long run. DDR3 RAM

34     LXF185 July 2014

has been around for a long time now, and DDR4 isn’t too far off. This means that prices for DDR3 are about as low as they can go, and the price difference between a 4GB set and a 8GB set is a lot less than you’d imagine. The average price for a 4GB set of RAM is currently around £20-£25, whereas 8GB is around £35-£40, so the price per gigabyte works in favour of the larger set. If you can afford it, it’s well worth going for the larger set to future‑proof your machine. If you are building a standard, everyday desktop, then we’d recommend the HyperX XMP Blu Red Series 8GB, which at the time of writing can be found online for around £53.

www.linuxformat.com

Buying a modern motherboard means that you don’t have to worry about buying certain other components. In the past, we might have recommended purchasing a sound card, but pretty much any motherboard you buy these days comes with a perfectly good built-in audio solution. The exact same can be said for Ethernet network adaptors – you no longer need to buy a discrete network card for day-to-day computing, because your motherboard will come with one already. This means that you’re not going to need to cough up the cash to buy those extra components.

What processor? So what do you need to buy? The first consideration is what processor to go for, as this will determine which motherboards you’ll be able to use due to the socket type it’ll use. As an aside all desktop processors are 64-bit these days (Intel Atom and older Intel Celeron processors are an exception) and you’ll need it as we’re going to suggest at least 4GB of memory. None of this is a problem as all distros also offer 64-bit builds. So bearing in mind that you want a medium-powered PC for day-to-day tasks, we’d recommend going for an Intel Core i5-4570. This is a very capable processor that comes in at a pretty low cost (it’s available for around £140), thanks to the lack of more advanced features that Intel’s more expensive processors come equipped with. For example, the CPU multiplier of the Intel Core i5-4570 is locked, but because you’re not looking to overclock this processor to eke out every ounce of power, this won’t be a problem. Unlike the higher end Intel chips, it has four threads, rather than eight, and it does not support Hyper-threading. It is therefore not the best chip for professional video editing and 3D rendering – but you’re unlikely to need a standard desktop PC for such tasks. It is more than powerful enough for most undertakings, and the onboard graphics (Intel HD Graphics 4600) is absolutely fine for media, photo editing and even the odd game. If you’re looking for a bit more grunt, and you have the budget for it, then the Intel Core i7-4770K is another excellent processor, though quite a bit more expensive at around £242. On the other hand, if you are trying to save some money, then the Intel Core i3-4130 is a good choice at £83. Interestingly, it actually has a higher clockspeed than the Intel Core i5-4570 (3.4Ghz compared to 3.2GHz), but it is only dual-core, whereas the i5 is quad-core. All of these processors use the LGA 1150 socket – more on that in a bit – which will make choosing a motherboard much easier. You may have noticed that this section of the article has been a bit Intel-heavy; if you’d rather have an AMD-flavoured processor, then the A10-7850K is a great alternative. It has onboard AMD Radeon R7 graphics and costs around £135, which is a little less than the i5-4570. If you want this processor, you will need to find a motherboard that supports the FM2+ socket. All of the processors listed here should come complete with a heat sink and fan. While they won’t be much good if you’re a hardcore gamer or a keen overclocker, they will be absolutely fine for a regular desktop computer

Build a Linux PC

It’s hard not to recommend 8GB of system memory in terms of value, performance and future proofing.

user and you won’t have to worry about buying an additional fan or heat sink, either.

The mother Now you’ve settled on a processor, you can start thinking about the motherboard. The motherboard will determine quite a few important aspects of the PC you’re building, such as the size of the case and the amount of RAM that it can hold. If you’ve gone for one of the Intel processors we suggested, then you need to make sure the motherboard supports the Intel Z87 chipset and the LGA 1150 socket. For a standard desktop build we’d recommend the ASRock Z87 Extreme3 motherboard. Don’t worry about the ‘Extreme’ in the name, it’s actually a rather sensible board, for a decent price. With this board you get four DIMM slots for DDR3 RAM (up to a rather huge 32GB), built-in audio, four USB 3.0 ports, two USB 2.0 ports, a built-in network card, and HDMI, VGA and DVI ports for connecting monitors. Basically, pretty much everything you need. It comes with six SATA 3 ports, so you can add in plenty of hard drives. They are backwards compatible with older SATA drives, so if you have some old hard drives lying around you can still use them – though if they have IDE connectors you’ll have to use an adaptor. If you

need a new hard drive, then we’d recommend the Western Digital Scorpio Black 500GB. The capacity is adequate and has the standard disk speed of 7,200rpm. While solid state drives offer a bigger speed boost, their relatively limited capacity mean they aren’t really a worthwhile purchase for day-to-day computing. You’ll also need a PSU (power supply unit) to power the components and the computer itself. We’ve selected components with relatively low power consumption, and as we’re not using a discrete graphics card, you’re not going to need a monster 1,000W power supply. However, if you want to expand your PC later on, it’s a good idea to buy a PSU with additional watts to what you’ll need. It’s also well worth going for a PSU that is dependable – you don’t want it breaking down or damaging your components – and with good power efficiency, as this PC will be getting lots of use. Don’t just buy the cheapest model available, and make sure you read customer reviews, which are a good indicator of the reliability of a PSU. For power efficiency, get a PSU that has an 80 Plus certificate. This means the PSU will only waste 20% or less of its energy as heat, reducing bills and noise levels. You’ll want to make sure the PSU has the right type of connectors for your motherboard. All new PSUs have been ATX12V v2.31 compliant since around 2008 and if you opt for a system with modular cabling it’ll ensure it can adapt to your needs, though this tends to only be available on higher-end models. We’re recommending the Corsair CX500, which combines reliability, power and efficiency for around £46. For the case, you don’t need anything flashy. The APEX SK-393-C Black Steel ATX Mid Tower Computer fits the bill and only costs around £14 from www.newegg.com.

Shopping list

Modular cabling ensures you get the power connections you need and reduces the spaghetti cable mess.

Processor Intel Core i5-4570 £140 Motherboard ASRock Z87 Extreme3 £84 Memory HyperX XMP Blu Red 8GB £53 Hard drive WD Scorpio Black 500GB £45 PSU Corsair CX500M £46 Case PEX SK-393-C Black Mid Tower £14 DVD Drive Samsung 24x SH-224DB DVD-RW £11 Total: £393

www.tuxradar.com

(www.ebuyer.com) (www.kikatek.com) (www.newegg.com) (www.amazon.co.uk) (www.amazon.co.uk) (www.newegg.com) (www.dabs.com)

July 2014 LXF185     35

Build a Linux PC

Build a gaming PC Enjoy the surge in Linux games with your own custom system.

O

nly a few short years ago the idea of building a gaming PC filled to the brim with the latest components and then installing Linux on it would have you burnt at the stake as a witch, or at the very least garnered you some disapproving head shakes from your gaming pals. These days an increasing number of high profile blockbuster games and indie titles are coming to Linux, encouraged by Valve – the games developer and company behind Steam, the digital distribution service – which has created its own Linux distro, SteamOS. With companies like Crytek (Crysis and Far Cry series) and Epic (Gears of War and Unreal series) that both produce the high-end game engines that power many of the bigger releases – as well as developing graphically impressive games themselves – fully embracing Linux, gaming has never been in ruder health. There are a number of reasons why you’d want to build a Linux gaming powerhouse. For a start, Linux is free, so you can put the money you would have spent on a Windows licence towards a more powerful graphics card – always a

The mighty Nvidia Titan is an exercise in pure 3D graphics performance.

popular option with gamers. Because Linux distros take up a lot less resources when running in the background compared to Windows, it also means that you’ll see much better results running a game in Linux. So what do you need to take into account when building a Linux gaming machine? The mindset behind creating a gaming PC that can tackle all of the latest games at the best possible quality is quite different to when you’re building a standard desktop machine. You want the most power you can get for your money, and if you want to try your hand at overclocking, you’re going to want components that let you squeeze out every last drop of power. This means that you’re going to be looking at spending quite a bit more, and sometimes overlooking cheaper components for more expensive ones.

Planning your machine Having said that, the base of our gaming machine is rather similar to that of the desktop PC. The ASRock Z87 Extreme3 motherboard we suggested for the desktop PC is still an excellent choice, thanks to its excellent price and support for some of the latest technology. In our benchmarks it also performed incredibly well for memory bandwidth and overclocking performance. The Intel Core i5-4570 processor we suggested on the previous pages is also a perfectly fine choice, though it does not support overclocking. This will be fine for most people, but if you want some additional leeway in getting the most performance for your money, then the Intel Core i5-4670K offers not just a faster base clockspeed (3.4GHz compared to 3.2GHz), but it’s also able to be overclocked to around 4.5GHz – offering a pretty decent boost in performance for free. Although the Intel Core i5-4670K comes with a fan for keeping it cool, unlike the desktop PC, this won’t be enough. The processor is going to be getting a lot hotter during use, because of the intensive nature of games and especially if it is getting overclocked,

Performance parts If you want the best performance out of your gaming PC, then you’re going to want to splash out on the fastest kit you can afford. When it comes to RAM, it’s less about the amount (8GB is still more than enough for gaming), but more about the frequency and latency of the RAM. If you decide to use the suggested ASRock Z87 Extreme3 motherboard, it supports dual channel DDR3 RAM with four slots, so we’ll want a set of RAM that comes in either two or four sticks (eg. two sticks of 4GB). The frequency of RAM can be between 800MHz to 3,000MHz, with our motherboard supporting an overclocked frequency of 2,933. For gaming purposes, we don’t need much over 1,600MHz. The faster the RAM, the more latency occurs, so this is a good trade off. Faster RAM

36     LXF185 July 2014

also produces more heat, which in turn requires RAM sticks to include large heatsinks. These can end up causing problems if you have a large CPU cooler, as you may find it doesn’t fit. The Corsair Vengeance Low Profile ticks all these boxes, and comes at a decent price at around £60. The most important part of a gaming machine is the graphics card, and the most expensive – however it may be worth paying more to keep your PC relevant for the near future. The most powerful single card graphics card on the market today is the Zotac GeForce GTX Titan Black, which has a huge 6GB of GDDR5 memory with a 384-bit interface and bandwidth of 3,36GB/sec. This is a card that’s going to be futureproof for a long time, and is the one to get if you want the ultimate graphics card. It comes at a price,

www.linuxformat.com

however, at just under £800. This will be beyond most people’s budgets, and certain aspects of the card, such as the 6GB of GDDR5, will not be fully exploited by even the most demanding games, especially if you’re only going to be running one monitor. When 4K displays become the norm, however, that GDDR5 will be vital. For a more realistic budget we’d recommend going for the AMD Radeon R9 290. Though the price tag is still nothing to be sniffed at (around £320), it compares favourably with Nvidia cards that are almost twice the price. All these highpowered parts are going to need plenty of air flow to keep them cool, so a nice big chassis with plenty of built-in fans will do the trick, and we suggest the Corsair Carbide 200R as it fits the bill nicely, for around £50.

Build a Linux PC Gaming processors We’ve once again gone for Intel processors for the gaming build. This isn’t due to any bias on our side (or money bags stashed under our desks) but because Intel processors have generally been ahead of AMD’s offerings, though AMD is gaining ground again. Intel’s current crop, the fourth generation of Intel Core processors, boasts excellent speeds that benefit gamers. By the time you read this a brand new range of fourth generation processors

(codenamed Devil’s Canyon) should be available to buy, offering speed increases on the previous Haswell processors, for the same price. While the top of the range fourth gen processors have the i7 moniker, we’re recommending the i5 variant. This is because the main difference between the i7 and i5 processors is that i7s support Hyperthreading, and come with more threads in total (eight as opposed to six). This makes i7s great for intensive multitasking, such as video

which means we’ll need a different cooler to keep healthy. There are two main options here; air cooling and water cooling. Air cooling usually consists of big heatsinks and fans that sit over the processor. The pros of an air cooling system is that they are usually cheap and easy to install, with the cons being that they can be bulky and noisy. Water cooling systems, on the other hand, use water to transfer the heat from the processor to a radiator situated elsewhere in the computer’s chassis. The benefits of water cooling is that they are more efficient and quieter than air coolers, and can also be less bulky and more flexible. The cons are that they can be more fiddly to install, and a bit more expensive. However, you can buy self-contained water cooler systems that come ready-prepared with coolant, so installation is pretty straightforward. While you might not be too keen on the idea of pumping liquid past your expensive electrical components, self-contained water coolers are perfectly safe and reliable. The choice of what to go for depends on how big your PC case is, how quiet you want your PC to be, how far you’re wanting to push your components and your budget. If you’re not going to be overclocking and you don’t mind a noisy PC, then air cooling will be a good choice, but if you want a quieter machine that’s better at keeping cool, then water cooling is the way to go. You’re also going to want to get a dedicated graphics card – and the one you go for depends on how well you want your gaming PC to run the latest and most graphically intense games. You can pay as little as £60 for a graphics card all the way to just shy of £1,000, so think carefully about what it is that you want from your machine.

Drivers and software Historically, one of the biggest stumbling blocks for seeing significant growth in Linux gaming has been getting 3D

encoding, but for gaming there is very little benefit – certainly not enough to justify the additional cost. It can be argued that the larger cache of an i7 processor (8MB compared to 6MB of an i5) is more important, but again with gaming you’re not going to see massive differences, which is why we recommend choosing an i5 processor and save your money – or even put it towards a better graphics card, which will definitely have more of an impact.

graphics drivers to work. These drivers would at best be proprietary, and at worst non-existent. Happily, there’s always been a dedicated community beavering away at open-source alternatives, which usually contain many of the same features as the official £D drivers. Many distros also make it easy to choose between a proprietary and open source driver option, depending on your preference. In Ubuntu, for example, and its derivatives, you can find this by opening up System Settings, then clicking on Software & Updates. In the Ubuntu Software tab, click Proprietary Drivers for Devices to enable those drivers. Click the Additional Drivers tab to see what drivers are installed, and if any of them are proprietary. If you’re using an Nvidia card, then the default drivers should be the open-source Nouveau drivers, which have been created by reverse engineering Nvidia’s proprietary graphics drivers for Linux. Though Nvidia has been far from a darling of the open source world, it has won plaudits by contributing to the open source driver recently. This should mean that there’s a better chance of feature parity between the open-source and proprietary drivers, which means there’s less cause to use the latter. You can find out more about Nouveau at http://nouveau.freedesktop.org. If you’re using an AMD graphics card, then the open source drivers should be installed by default as well. The proprietary drivers (known as Catalyst/fglrx) can be installed from the package manager. Note: make sure you uninstall and purge the old drivers first. As far as the best distros go, although much has been made of Valve’s new game-centric distro SteamOS, it is still in its early days, so we’d hesitate to recommend it if you also want to use your PC for other day-to-day tasks. It’s worth keeping an eye on for the future, though. For the most compatible, and hassle free, experience, we’d recommend a Debian derivative, with Ubuntu or Mint being the best bet.

Shopping list

Proprietary drivers continue to plague GNU/Linux distros and will do for some time to come.

Processor Motherboard Memory Graphic card Hard drive PSU Case CPU cooler

Intel Core i5-4670K ASRock Z87 Extreme3 Corsair Vengeance Low Profile 8GB AMD Radeon R9 290 WD Scorpio Black 500GB Corsair CX600M Corsair Carbide 200R Coolermaster Seidon 120V Total:

www.tuxradar.com

£161 (www.ebuyer.com) £84 (www.kikatek.com) £62 (www.scan.co.uk) £305 (www.ebuyer.com) £45 (www.amazon.co.uk) £53 (www.amazon.co.uk) £46 (www.amazon.co.uk) £35 (www.scan.co.uk) £791

July 2014 LXF185     37

Build a Linux PC

Build a media centre A stylish way to enjoy all your videos and music in the living room.

I

f you fancy building a PC that can sit unobtrusively in your living room and serve you all the media your eyes and ears can handle, then you’ll be pleased to know that it’s extremely easy nowadays, and with a few choice distros you can create an excellent media machine that can be used comfortably with a TV. While building a gaming PC is mainly about being big and brash, creating a decent media PC is a bit more nuanced affair. You don’t want powerful components – in fact in some cases you’ll want the opposite, as you’re going to be making a small machine that’s on for very long periods and that operates as quietly as possible, which means you don’t want to be generating much heat. Unless you don’t mind a big beige box sitting in the corner of your living room, then you’ll

XBMC is up to version 13 Gotham, which is lucky for everyone.

want an attractive and compact case. Luckily, we’re spoilt for choice with small-form factor Micro-ATX chassis as they’ve become increasingly popular as integrated components have become more powerful and power efficient. We’ve gone for the Antec ISK310-150 Micro-ATX case as it’s compact and looks great. Because of the format’s small size, it can be a bit fiddly, so if you want a bit more space and flexibility, we’d also recommend the Antec ISK 600. The Antec ISK310-150 MicroATX case comes with a built-in 150 watt power supply, which means that’s one less thing to worry about. The fan speed on the PSU can also be changed to make it as quiet as possible, though you’ll want to keep an eye on temperatures.

Perfectly formed parts Because of the size of the chassis you’ll also need to choose an mini-ITX form factor motherboard. For this build we’d recommend the ASRock FM2A88X-ITX+, because not only does it have a compact design, but it also includes some pretty handy features for a media PC. It comes with not just a HDMI out port for connecting to a high definition TV, but also a HDMI in port for connecting other devices to it, particularly useful if your TV only has limited HDMI ports. The motherboard also comes with built-in wireless 802.11n antennas, which gives you a bit more flexibility when placing the PC. This motherboard supports the FM2+ socket, as we recommend getting the AMD A10-7850K processor, thanks to its excellent onboard graphics, which keeps both the cost and the power consumption down. While a liquid cooler to keep the processor’s temperatures down is an ideal solution for a media PC, thanks to its relatively quiet performance, if you’re going for a small case then there probably won’t be enough room. If that’s the case, then the

Media playing distros Unlike some of the other systems that we’ve covered that you can build yourself, the software that you can install on media PCs is just as important, if not more so, than the hardware you decide to install in it. There are a number of lightweight distributions that have been created especially for media PCs. The idea behind these are to offer a simple, yet elegant operating system that gives you easy access to your media through an interface that has been tailor made of use on TVs. The most popular software is XBMC (http:// xbmc.org), which was once a media centre program for the Xbox console, but is now a fully fledged open source media player in its own right that can be installed on a wide variety of platforms. The distro comes with a number of excellent features including UPnP compatibility, which lets you stream media to and from other network connected devices, along with PVR,

38     LXF185 July 2014

music and movie support. Add-ons can also be installed to expand the functionality. As XBMC is installed as a standard distro, you can also use your media PC for day to day tasks as well. However, if you want it to be a dedicated media player, then it is worth giving XBMCbuntu a try. As the name suggests it is an Ubuntu-based distro that has XBMC already installed and configured. It is designed to be as lightweight as possible, enabling you to boot up and begin watching media as quickly as possible. It comes as a live CD so you can give it a try before you install it, and you can find out more at http:// bit.ly/lxfxbmcbuntu. Plex is another popular media centre and comes in two flavours: Plex Home Theater can be installed on machines hooked up to a TV and can play both local and remote media, while the other version: Plex media server can be installed on remote computers and NAS devices to

www.linuxformat.com

organise and stream your media to other connected devices. Though originally a fork of XBMC, Plex now has taken on a life of its own and can be found on many Smart TVs and set top boxes, and uses a number of closed source and proprietary technologies. Though Plex Home Theater doesn’t have an official Linux version at the moment, there are builds available for certain distros, which you can find out more about at http://bit.ly/lxfplex. An up and coming media centre distribution that we’re rather fond of at Linux Format is OpenELEC (which stands for Open Embedded Linux Entertainment Center). This is a lightweight Linux distribution that’s been built from scratch with media playing in mind. It’s also based on XBMC and is extremely easy to set up and can be installed on a whole host of hardware configurations, including, of course, the ridiculously popular Raspberry Pi.

Build a Linux PC

Raspberry Pi media centres Building an all-singing, all-dancing media centre PC is great if you want to store and watch your media locally, whilst streaming high-definition content and using advanced features like recording TV with a PVR (personal video recorder) add-on, but if you already store all of your media on another device, such as a NAS drive, and just want a machine that streams that content across your home network, then you don’t need a very powerful machine. In fact, the Raspberry Pi is an excellent device for doing just that. It’s small and quiet, and though it’s not very powerful it’s got enough oomph to be able to stream media, with a builtin HDMI port making it a great choice for hooking up to a HDTV. Even better, quite a few of the media distros we’ve mentioned have versions that can be run on Raspberry Pi, most notably OpenELEC. All you need to do is download the current

Raspberry Pi release from http://bit.ly/ lxfopenelecpi, and make sure you have a spare SD memory card to hand to install OpenELEC on to. Once downloaded you need to extract the tar files, then in the terminal you need to navigate to the folder that you’ve just extracted the files in the tar archive to using the cd command. With the SD memory card inserted into your PC, make a note of what the device is called (usually it will be something like /dev/ sdb1 – though the ‘sdb1’ may be different on your machine. Make sure you have the right device identified as the next step will delete everything on the drive you’ve selected. Now type sudo ./create_sdcard /dev/xxx, where ‘xxx’ is put the name of your memory card (for example sdb1). Afterwards, type sync to finish. Put the memory card into your Raspberry Pi and log in with the username root and the password openelec.

Gelid Slim Hero is a good air cooling alternative. This is small enough to fit comfortably over the CPU, and most importantly it’s nice and quiet. If you’re going to be playing media locally, then you’ll want a nice big hard drive to store your media on. We would suggest considering the Samsung M8 1TB 2.5-inch 9.5mm SATA 6Gps Internal Hard Drive is a good choice as it’s fast and offers plenty of storage. As it is a laptop hard drive (2.5inch) it means it can easily fit in to the smaller-sized chassis – so make sure you check the physical size of the hard drive and your case’s compatibility before you buy.

Media codecs To play media on your new system you’re going to need all the required codecs. These codecs can encode and decode the digital files for playback, and the codecs that are required will differ depending on the file types that you’re likely to try to play. Unfortunately, by their very nature most codecs are proprietary and use patented technology, with many licences being managed by MPEG-LA, LLC.

The Raspberry Pi is able to blast out HD-level content to your HDTV.

MPEG-LA, LLC has a reputation for guarding the patents it holds and acting swiftly if it believes there have been infringements. This has led it to going up against Google, which was pursuing its own WebM project, that was designed to use the VP8 codec in an open and free media format. Though this is just one case, it does highlight that behind the codecs there’s often a lot of politics and arguments.

“Unfortunately, by their nature most codecs are proprietary and use patented technology.” Many distros give you the option to include proprietary codecs to play MP3 files and your DVDs, either during the distribution installation process or at a later time. However, what happens if you want to avoid proprietary formats? There are a number of open source alternatives that you can use instead, including OpenH264, Xvid and FLAC. MP3 encoding alternative Lame is also available, though this is on shaky ground due to its reliance on patented technology that it doesn’t pay licences for. Unfortunately when creating your own media PC you may at some point have to weigh up convenience versus ethics when considering what sort of media you want to play. We’re hopeful the situation will get better soon – even the MPEG-LA, LLC and Google were able to come to an agreement over VP8 codec, so there is reason to believe that other codecs could follow suit.

Shopping list

The Micro ITX platform is an excellent basis for a mini-media centre.

Processor AMD A10-7850K £129 (www.ebuyer.com) Motherboard ASRock FM2A88X-ITX+ £70 (www.lambda-tek.com) Memory HyperX XMP Blu Red Series 8GB £39 (www.newegg.com) Hard drive Samsung M8 1TB 2.5” £55 (www.amazon.co.uk) Case Antec ISK310-150 Micro-ATX £71 (www.ebuyer.com) CPU cooler Gelid Slim Hero £22 (www.quietpc.com) Total: £386

www.tuxradar.com

July 2014 LXF185     39

Build a Linux PC

Build a home server Get the data integrity you deserve with our server build.

B

uild your own home server? It’s an interesting proposition – we could say something silly like you could run a low-power server on an old laptop or other spare old hardware. You could, but it wouldn’t be particularly clever in terms of data security. This is an important point, as you need to ask yourself why you want a home server? Is it just for fun and experimentation, serving up personal media files around your home and over the internet, or backing up and sharing files in your home or office? Perhaps all three and more? For the first two you might get away with running this on older, spare hardware, but for anything that requires even a sniff of data integrity, a more convincing alternative would be to take the base desktop system (see p34) and beef up the storage section with a full RAID solution of four drives. Perhaps even adding a UPS solution too. Even a modest desktop case should enable you to install four drives, both in

The more hard drives the better when running a RAID system.

terms of SATA data connections, power from the PSU and physical mounting points. If it falls a little short – in terms of mounting points – you can purchases 5.25-inch to 3.5-inch conversion kits to enable you to bring any spare optical bays into play as well. Let’s face it, who uses optical drives in this day and age? A slightly more modest approach would be to use two drives in a mirrored RAID 1 configuration, but the thing to take home is if you’re at all considering running a home server to store and back up your files, then you want a reliable configuration that offers redundancy in its data storage, else you’re not much better off than running with no back up at all.

Getting the right drive As we’ve seen even a modestly priced motherboard is going to offer enough SATA ports to support Linux-based software RAID. But what drives should you buy? The usual three things come into play: price, performance and reliability. Running RAID mitigates the reliability issue to a degree but the BlackBlaze drive report (http://bit.ly/LXFdrives) firmly placed Hitachi Deskstar 7K(1/2/3)000 drives as the most reliable, closely followed by Western Digital Red 3TB (WD30EFRX) drives, and Seagate coming a weak third. The argument is almost irrelevant as the Hitachi hard drive division was bought by Western Digital, leaving the WD drives on the market with Seagate and Toshiba. In terms of performance most 3.5-inch 7,200rpm drives in this category are similar performers. Prices do fluctuate but generally Seagate are the most competitive, but it’s a close run thing. While this feature is about putting together the best box for the job, what happens if someone has already done that? HP does manufacture purpose-designed and low-cost homeserver boxes. These are sold under the same HP ProLiant brand as its big, grown-up workstation range. The point being every part of the server box from the door latch to the

It’s a RAID Redundant Array of Individual Disks or RAID is a fault-tolerant system that enables you to create storage systems that are able to withstand the failure of drives. There are many hardware-based RAID disk controllers out there, but with Linux you can also create RAID arrays in software, using standard storage hardware and for most home applications this is adequate. If you’ve never had a hard drive fail on you, you’re either very young or very lucky. Drives simply don’t last forever. Typically manufacturers quote a Mean Time Between Failure figure of up to one million hours but this is over the entire population of drives and could mean one is actually failing every hour or an annual failure rate of 1%. The truth is the real figure could be far higher. The Google paper Failure Trends in a Large Disk

40     LXF185 July 2014

Drive Population (http://bit.ly/LXFdrivefail) points to figures between 2% and 6% depending on the age of the drive. If you’re running five drives – a real possibility – our in-house mathematics PhD-wielding technical editor says there’s up to a 26% chance of one drive failing in a year, taking all of its/your data with it. Unless it’s backed with some data redundancy. RAID was originally envisioned to add redundancy to arrays of drives. At its most basic RAID 1 mirrors equal numbers of drives. This is rather wasteful in terms of storage – a 50% loss in capacity – but works with just two hard drives and requires minimal resources to process. RAID 5 is where the party starts, this stripes data across multiple drives alongside a parity bit. If any one drive should fail the entire array can be rebuilt. An additional advantage is that it loses

www.linuxformat.com

less space, in fact adding more drives reduces this loss. It requires a minimum of three drives (with a 30% loss in space) and expands up from there, with five drives the loss goes down to a more acceptable 20% of space. The rebuild process for RAID 5 does take time and if you decide to use larger 1TB+ capacity drives that amount of time can become problematic, as it opens the array to a window of potential failure. This has become such an issue that Dell in 2012 took the step of advising against the use of RAID 5. Fortunately, RAID 6 has introduced double parity and enables the array to cope with two drives failing, this makes it more attractive for much larger arrays and capacity drives, where the probability of experiencing dual-drive failures becomes more likely.

Build a Linux PC

A dual NIC offers redundancy if a port fails.

motherboard has been specifically designed, built and constructed by the HP server team. The HP ProLiant Microserver is a tiny self-contained server box just 30cm wide and 40cm high and deep, but offers four quick-release hard drive bays. The specification is typically based on a low-end AMD Turion II Neo N54L processor and comes with 4GB of memory. The motherboard, processor and cooler are all preinstalled and come bundled in the price. The model also usually comes with a 250GB hard drive and a £100 cash-back offer, if you hunt around. So for around £185 you get a fourbay (five if you convert the optical bay) server ready to go. It comes with neat features you simply won’t find anywhere else. Things like a mounting point for the hex-tool inside the lockable door. Quick-release drive bays with easymount trays, plus a slide-out motherboard tray all with custom quick-release data cables. It’s not perfect, there’s just two (hard to access) expansion slots, it’s also only running a single Gigabit LAN port and is limited to just USB 2.0 on its six ports. The sort of acceptable compromises for a home or small-office environment and we’ve been running one for over two years 24/7 without hitch.

We’re all redundant Linux supports RAID through the device mapper layer in the kernel, and is configured using mdadm, which lets you create, grow and manage software RAID devices. To get the package installed use sudo apt-get install mdadm (on a Debianbased distro) and you can create RAIDs relatively simply. Say you have four disk drives (sdb, sdc, sdd and sde) and you’d like to build a RAID 5 array, type the following: mdadm -C /dev/md0 -n4 /dev/sdb /dev/sdc /dev/sdd /dev/sde -l5 and you can validate it with mdadm -D /dev/md0. It’s possible to create a filesystem on the RAID device using mke2fs -j /dev/md0 and it can be mounted in the usual way. The last issue to remove is that the new /dev/ md0 device you’ve just created won’t be re-assembled when the system reboots unless you add a line for it to /etc/ mdadm.conf. Get mdadm to add the line for you using: mdadm --examine --scan >> /etc/mdadm.conf

The point of RAID is mitigation against drive failure. The same goes for network ports and power supply. In a home environment network port failure is likely the least troublesome. It’s something we’ve come across more than we’d have expected with both onboard Ethernet ports failing and add-in cards failing. It’s an annoyance and can be awkward to diagnose, as you usually attribute the issue to another part of the network rather than a failed network card. Running two Ethernet ports is the solution, covered by a host of protocols, such as Link Aggregation, Link Bundling, Port Trunking,NIC Bonding, NIC Teaming, LACP and our favourite IEEE 802.1ax previously IEEE 802.1ac. Certain configurations require a compatible switch but typically loadbalancing, round-robin and active-backup should work over any switch. Configuration is beyond this feature, but a guide for Ubuntu can be found here: http://bit.ly/LXFbonding. The overview is you’ll need to sudo apt-get install ifenslave-2.6 then sudo stop networking and add the bonding module with sudo modprobe bonding. The complex part is correctly editing the /etc/network/ interfaces file for your installation before restarting the network with sudo start networking. We’ll save the correct editing for another time, but we will point out that contrary to much that is said on the internet Link Aggregation does not increase network speed. A final point you may like to consider is an uninterruptible power supply. A UPS in a home environment enables enough time for a server to gracefully shutdown, ideally completing any tasks it was running. A home UPS isn’t much more than a lead-acid battery in a box with serial communication to the PC that tells it when the power has gone. It’ll offer that vital five to ten minutes of extra runtime needed to safely shutdown. At about £80 basic units are affordable, but it’s possibly overkill for a home solution. LXF

www.tuxradar.com

July 2014 LXF185     41

for School

The Raspberry Pi is now in its second year, so we sent Les Pounder to the Raspberry Jamboree in search of the coolest Pi projects around.

The original goal of the Raspberry Pi was to help children learn about computing and this is slowly coming to fruition thanks to the education community. Educators from around the UK took part in the second Raspberry Jamboree, which for the first time was integrated into the larger Education Innovation Conference. There

Interview

were a great deal of exhibitors present, and it was refreshing to see so many stalls with Raspberry Pi-related products competing against big names in education. Self-titled ‘Jambassador’ Alan O’Donohoe led the event with his usual mix of nervous energy and frantically-paced presentations. Alan has worked incredibly hard to make the event what it is and I am happy to report that he did extremely well with the 2014 affair. This year it was clear that the focus had been shifted to the educational aspect of the

Raspberry Pi and this shift was well received by the hundreds of teachers in attendance. There were many workshops and presentations leading the teachers through   a carefully series of lesson ideas based around the low-cost computer. The event ran for three days, with the first two days focusing on the educational track and the third being an open hack day for everyone to share their projects and learn new skills. There were dozens of great ideas flowing, and so we caught up with the brains behind the best projects.

Martin O’Hanlon: Martin O’Hanlon is a big advocate for the Raspberry Pi. He loves its potential for getting kids excited about programming and is probably most well-known for his clever and fun Minecraft projects using the API. (see p82 for Minecraft inspired projects) Linux Format:There are two cool projects that you are known for, but I’d like to talk to you about creating great Minecraft lessons. Martin O’Hanlon: The Minecraft projects are simple, small and designed to be accessible. I see Minecraft as a great hook to get people to ‘have a go’ and play with this world that can be shaped into whatever they wish.

42     LXF185 July 2014

www.linuxformat.com

LXF: You have produced some great content for Minecraft on the Raspberry Pi. Why did you choose this as your preferred platform? MH: There are two reasons. The first is that it’s free, and this makes it accessible to many people. The second reason is the API (Application Programming Interface) used to program the Minecraft world is very easy to learn and manipulate. There are other ways to program Minecraft on many platforms, but none of these are as flexible or easy to learn as the Raspberry Pi version. LXF: What can be done in a relatively short amount of time using the API for Minecraft?

Raspberry Jamboree LXF: That sounds fantastic! How easy was it to build? MH: As this project was based on my earlier car-based dashcam, there was already a good chunk of the work done. I used two plastic lunchboxes to house the project. One contained the Raspberry Pi and battery and the other held the GPS device. I had to make a few wiring changes – mainly due to my shoddy soldering skills. I also had to refactor some of the Python code to accommodate the change of use. While testing, I discovered an interesting bug with my GPS device and the official Pi camera. When the Pi camera was in use, it would interfere with the GPS device and either stop the flow of GPS data or corrupt it, making it unusable. This was due to the camera data being sent so quickly that it generated an electromagnetic field. My solution was to cover the Pi camera cable with tin foil, which was an effective shield. I later enhanced this by introducing a polyester sheath around the cable and tin foil to keep everything neat. MH: You can do four particular things quite quickly. You can change a block, find out where a block is, find out where your player is and finally change where your player is. Minecraft uses xyz co-ordinates to control where everything is in the world. So to make a diamond block appear 10 blocks in the air you can use the API to find out where your character is located, and then add 10 to the y-axis and create a block there. For a single block this is fun, but once you learn how to use a loop in Python you unlock a mechanism to create lots of content very quickly. These four things are very simple but very powerful. Also by using Minecraft you instantly make coding sound more interesting to children as they are already well-versed in the Minecraft world and its methodologies. LXF: What projects have been created with the Minecraft API? MH: I’ve seen lots of games being made inside Minecraft – one guy, Nicholas Harris, is 12 years old and he has already written a couple of games, which is great! LXF: We’ve looked at your blog and see that you have modelled the Manhattan skyline in Minecraft – how did you do that? MH: That’s a favourite project of mine. It is my spectacle piece that really shows off what can be done. I like this project, not just because it is the Manhattan skyline, but because I took a standard 3D model, known as an OBJ file, which is something that is used in many 3D modelling applications. OBJ is the file format to use if you are migrating work from one modelling application to another – it’s really just a dump of the coordinates and vertices used to build an object. So the OBJ file is then imported into Minecraft using a program I wrote which reads

these massive text files and translates the data for use in Minecraft. LXF: If anyone is interested to learn more, where can they find more information? MH: I’ve written a series of guides on my website http://stuffaboutcode.com and everyone is welcome to take a look and try out Minecraft for themselves. The code and guides on the site are all free to share and I’d love to hear about other people’s projects. LXF: Now, can you tell me a little more about your second cool project? MH: I’ve got three main interests in my life.

on dashcams

LXF: What software did you use? MH: The coding was all done in Python, and this enabled me to use the rich libraries of code out there. I used a library to work with the GPS device and another to work with overlaying graphics, which was naturally PIL (Python Imaging Library). This would overlay graphics on to a frame at a regular interval, therefore producing the illusion that it was always present on the screen. LXF: How do you interact with the Raspberry Pi exactly? Surely a simple interface would be a real benefit when using the kit in an active hobby? MH: When I’m snowboarding, I wear thick gloves which are great at keeping me warm but lousy when I want to interact with small buttons or switches. So I solved this issue by connecting a large red button that provides all the input I need for the kit. To start the recording I quickly press the button, and to stop it I do the same. If I want to turn off my Raspberry Pi, then I press the button for a few seconds.

“It’s a Raspberry Pi-powered camera that records my snowboarding antics.” Technology, cars and snowboarding. In each of these areas I have looked into how I can integrate the Raspberry Pi. I first had the idea to use a Raspberry Pi and camera to record my driving, which I later expanded to include data overlaid on the video. The data being my speed, RPM, coolant temperature and throttle position. I decided to take this idea and apply it to my snowboarding hobby. LXF: So you have a dashcam for snowboarding… MH: Oh yes, it’s a Raspberry Pi-powered camera that records my snowboarding antics in first person view and overlays data, such as temperature, altitude and a map of where I have been. It’s certainly a more geeky solution to using a GoPro camera.

www.tuxradar.com

LXF: Your Raspberry Pi-powered camera project covers so many different areas: GPS, cameras and data logging for temperature and speed. What’s going to be the next thing you plan to add? MH: My next idea is to add biometric data to the overlay. I would really love to capture my heartbeat and have it produce a graph on the screen. That would be fantastic. I see my project as the first step in producing video with data via the Raspberry Pi and I can’t wait to see what other people will do.

July 2014 LXF185      43

Raspberry Jamboree

boot functionality, so how do you force them to boot from the network? AM: I made a 27MB boot image for the Raspberry Pi SD card, which contains the kernel image and the bootloader. As you may already know, the Pi can only boot from the SD card, so placing these files on the SD card is vital to create a ‘FAT client’. There is also a config file that instructs the Pi to look to a specific IP address and then request the OS over the network.

Andrew Mulholland Andrew Mulholland is 17 years old, but already has extensive credentials. He’s an award-winning inventor, roboticist and Raspberry Pi enthusiast. As Northern Ireland’s youngest STEM ambassador, he runs numerous computing-related clubs and workshops. Linux Format: Could you tell us more about your project? Andrew Mulholland: My project is to bring the Linux Terminal Server Project (LTSP) to the Raspberry Pi. For those who aren’t aware of this process, there’s one central server that responds to requests from clients on the network – the clients being Raspberry Pis. The clients boot with the minimum amount of software installed and then request the OS and related software over the network from the central server. LXF: The Raspberry Pi doesn’t come with any PXE (Preboot Execution Environment)

44     LXF185 July 2014

LXF: Clever, so how long would it take for, say, four or five Raspberry Pis to complete the boot sequence and be ready for people to use? AM: Well, that would depend on the speed of your network. Although the Raspberry Pi comes with a 100M network connection, you’ll have the best success with a Gigabit connection on your server because serving five 100M will require the extra bandwidth. I did a test with 20 Raspberry Pis all connected using Gigabit equipment and all 20 of the machines were in a usable state within 70 seconds.

on the ltsp

children we can easily manage the location of their work in one central place, rather than on one of many SD cards. LXF: So who are the intended users of this project? AM: Primarily education. The main focus is on getting LTSP into the classroom. The benefit of LTSP is that you can easily ensure that your school computer lab is kept up to date with the latest Raspbian image, and that the use of SD cards, which are fragile pieces of kit, can be minimised. Students can save their work over the network to their home directory, therefore ensuring that their work is not lost. LXF: What type of server would you need for a class of students? AM: The server does not need to be powerful. It’s essentially a file server. My only recommendation would be to use a Gigabit interface for the network. I’ve had great success running my demo network from a laptop running Debian with 1GB of RAM. LXF: Is your project just for Raspbian? Can it be used with other Pi OSes? AM: It can be used with other OSes, but you will need to know how to build the image. The LTSP is designed to work with Ubuntu, so what my software does is make it easy to build a bootable image. The Foundation has made a lot of changes to the default armhf image, which makes this task difficult – but not impossible. To create your own image you would need to reverse engineer the changes that the Foundation has made and implement them into your own image.

“In a class of children we can manage the location of their work in one place.” LXF: So what other benefits are there to using Linux Terminal Server Project on the Raspberry Pi? AM: There are two things that are great about LTSP. Firstly, it comes with its own graphical login screen. Secondly, a user can log in to any Raspberry Pi and still have access to their home directory as if they were consistently sitting at the same machine. So in a class of

www.linuxformat.com

Raspberry Jamboree and the user never sees it. They use the Scratch interface to program the robot and it just works.

Simon Walters Simon Walters tends to focus on primary school ‘tech geekery’, which he writes about on his popular blog http://cymplecy. wordpress.com (pronounced simplesi). Linux Format: Please could you tell us about your project? SW: My project is a version of Scratch that can work with the GPIO (General Purpose Input Output). When the Raspberry Pi first came out, it was widely announced that the operating system, Raspbian, would come with a copy of Scratch pre-installed. It was also well-publicised that the Raspberry Pi had this wonderful GPIO connector that would enable anyone to work with electronic components. LXF: So what gave you the idea to merge Scratch and the GPIO? SW: Well, it was still early days but I was lucky enough to see the work that Andrew Robinson and the PiFace team were doing with Scratch and their first PiFace board. I contacted the team and they very kindly gave me a copy of their work, which I then modified to work with the GPIO directly. I work in a primary school and wanted to make the Raspberry Pi and programming as simple as possible, and Scratch was a natural fit.

LXF: How does ScratchGPIO compare to say, using Python with the GPIO? SW: ScratchGPIO uses the PiFace codebase and Ben Croston’s RPi.GPIO Python library, so ScratchGPIO has a dependency on Python to provide the functionality.

launch their fireworks using ScratchGPIO. They used the GPIO to interface with the firework control mechanism, and Scratch to create the sequence in which the fireworks were launched. This was a great use of ScratchGPIO, but let’s not forget the intended use of ScratchGPIO – to enable children at primary school level to enjoy learning more about electronics via simple projects, such as traffic lights and sensors.

LXF: So by basing your project on existing projects you have access to lots of core functionality quite quickly? SW: This is very true – as soon as someone produces some Python code to work with, say, ultrasonic sensors, I can quickly adapt the Python code into ScratchGPIO and make it easier to work with.

LXF: About a year ago you demonstrated simple robotics at a Manchester Raspberry Jam – a robot that could solve a maze. How much would a project like that cost? SW: That project was remarkably cheap as I found I could attach stepper motors to a Raspberry Pi case using double-sided tape. The entire cost of the project was £10.

LXF: So when converting the code from Python to Scratch – is that a simple matter of reading the structure of the Python code and then adapting it? SW: Yes. For example, if you wrote some Python code that would make a motor vary its speed, all you would have to do is create a variable in Scratch – called motorA – that

LXF: ScratchGPIO is one of the key languages supported by Pimoroni and Cyntech’s latest add-on board the Pibrella. So what is this new board all about? SW: Pibrella is a ready-made add-on that enables anyone to quickly play with inputs and outputs. No soldering skills are required, nor do you have to purchase any breadboards or components. Everything is built into the board.

on the pibrella

“It can quite easily build a robot with two motors and three wheels.” would listen out for the changes. When a variable changes in Scratch it is broadcast on the local network and a receiver program listens for those changes. ScratchGPIO works in reverse, in that ScratchGPIO is listening for these changes. LXF: What projects have been built using ScratchGPIO? SW: There have been many robots created using ScratchGPIO, but one project that intrigued me was from a person who wanted to

LXF: Is the Pibrella board just for beginners? SW: No, the board grows with the learner. To start with you will use the built-in LED and button. But after a while you will learn more about electronics, and will interface sensors, switches and motors to the Pibrella. LXF: So the Pibrella is also a motor control board for robotics use? SW: At a basic level – yes. It can quite easily build a robot with two motors and three wheels, where the third wheel is a freewheeling castor. Pibrella is great value at £10. It can do so much but is scalable to the user. LXF

LXF: So what can be done with ScratchGPIO? SW: At the simplest level it can switch an LED on and off, or read the status of a switch. It can also control motors, and once you master this aspect you are not that far away from building your first robot. LXF: Robotics is an area that the Pi is suited to – is Scratch a viable language to use? SW: Yes, you can easily build the code necessary to program your first robot. My Scratch GPIO software sits ‘behind the scenes’

www.tuxradar.com

July 2014 LXF185      45

Anatomy of a data centre

7

10

12

5

6

8

1

11

3

2

9

Anatomy of a data centre

Neil Mohr steps inside UKFast’s secure data centre to discover how it keeps the petabits ticking.

P

owering the internet is no simple task, and the machines that push everything around the global network are locked behind razorwire fences. This naturally makes them even more exciting. And so, intrigued to know just what’s required to build a modern ISP, Linux Format skipped off to sunny Manchester to locate its servers, which are buried deep inside the brand-new hosting facilities at UKFast. We asked: how do you build an ISP? The answer was pretty damn complicated.

46     LXF185 July 2014

Everyone deals with the internet on a daily basis. Sometimes you might not even know it, but whether you’re entering an address into a web browser, sending a message from your phone or buying a packet of crisps, there’s a level of interaction with the internet. When it works, it’s fantastic. We take it for granted as it lets us access online storage, email, instant messages… you name it. When it doesn’t work, the expletives from our mouths make even our Mexican art editor blush. But why doesn’t it work? What gets broken between the browsers and the server?

www.linuxformat.com

A huge part of this thing we call ‘the internet’ are data centres. They’re where a massive number of the world’s servers are stashed, run and maintained. What actually runs on those servers can vary from someone’s personal OwnCloud to a multinational bank’s financial system, processing billions of transactions every day. The data centre itself doesn’t care, it stands impassive, keeping the servers inside fed with power, cool enough to run efficiently, and constantly connected to the larger internet, come rain, snow, earthquake or a

Anatomy of a data centre

4

total power cut. Not all data centres are built equally and we’re going to show why you should care about that. So let’s step inside one of the UK’s newest data centres, run by UKFast, to see what makes it tick! The web, the cloud, most online services and much of the internet itself is driven by GNU/Linux and FOSS-powered systems. We know that, you know that. But what is it all running on? Or more to the point, where is it all running? A large part of the answer falls to data centres. Large buildings within which hundreds, nay, thousands of servers purr away 24 hours a day, 364 days a year, plus that extra day for each pesky leap year. It’s that purring that’s important, as one thing the internet can’t abide is downtime. It costs people money and raises their blood pressure to dangerous levels. If you’re stumped, downtime means ‘404 page not found’ and ‘host unreachable’ errors. It’s not the sort of thing you’d expect from the likes of Google, Ubuntu, Red Hat or IBM with millions of users dependent upon their flawless services. Where it really starts to play a part is with self-hosted services – the small-to-medium business market where compromises on expense and expertise can make people choose less reliable options. In 1999, UKFast was founded by CEO Lawrence Jones and commercial director Gail Jones, his wife. It was started as an internet hosting company and its HQ has always been based in central Manchester. It currently resides in Birley Fields, which is an area of the city that’s part of its burgeoning technology centre. It’s conveniently located alongside the Manchester Metropolitan University’s buildings. UKFast only entered the data centre market in 2011, but it has already made its mark on the data centre world. The entire operation was the first UK hosting company to be certified 100% carbon neutral in 2010 under the PAS2060 accreditation. It has

won numerous hosting awards and was named Best Hosting Provider for four years in a row. We also know it’s committed to GNU/ Linux and FOSS training – it provides apprenticeships and company-wide LPIC training for all its employees, and offers developer days to its Linux administrators. So it seems an ideal company to approach when asking how a good data centre is built and run. We were given a tour of the facilities by UKFast’s head of sales Rudi Feitsma, so we could see how the operation is put together. Everything starts at its 50,000sq ft UKFast Campus. It employs over 200 people in its main offices, and has the usual marketing, sales, management and HR you’d find in any large company. Alongside all of that business infrastructure, it has to provide 24/7 all-yearround support and maintenance for the products it supplies. That takes teams of well-trained, fully resourced admins who have to remain up-to-date in the latest operating system developments.

Silver servers This is the first differential for data centres. It’s something we came across a number of times during our visit – the difference in resources involved in building an award-winning data centre compared with what you can achieve at home, in an office or a medium-sized enterprise. Do you want to take the time, money and expertise to implement these

Keeping the servers cool.

company’s substation is the only item on UKFast’s property that it does not own. From the substation, a transformer down-steps the power and feeds it into the million-pound energy management building. This is where you get your first idea of how serious an enterprise a data centre is. Inside is a long bank of power regulators about the length of a Routemaster bus, a row of uninterruptible power supplies (UPSes) and a bank of leadacid batteries on multiple shelves. The power regulators ensure all the racks can run smoothly. If the mains power should fail, they orchestrate switching between using the back-up batteries, while the three diesel engine generators usually impassively sat outside roar into life. The power room is the only one that is cooled in its entirety and you can really feel the raw strength of the wind blowing through it, which is funnelled under the floor and directly through the racks in the main data centre. The entire facility is built on an N+1 basis, so if any one unit should fail during operation, the remaining units can happily cope. That explains why there are a total of three enormous two-storey-high shipping container-sized green boxes sat in a row outside the building. Each contains an industrial diesel generator specifically designed for data centre use. Each is sat on over £50,000 worth of fuel, so they’re ready to spring into life and be up and generating power within 56 seconds in case of a power cut. The fuel is treated and undergoes tests each week, as do the engines, so UKFast

“What we’ve seen here can be shrunk to someone’s in-house data centre.” systems yourself, or trust the experts? It’s fine for us and our home setups, but what happens when a whole business’ infrastructure is at stake? “What we’ve seen here [at UKFast] can be shrunk to someone’s in-house data centre,” says Rudi Feitsma, “so the same elements apply. It gets to a point, though, where it’s very clear it’s not worth their while financially. What you find is a lot of IT people take their businesses down that route, because they want to do it. They want to build and run a data centre. They go to their CEO and say ‘we’ve got to do it, we’ve got to have this’. They build the data centre at great expense and discover it’s not financially beneficial for the company. It might be great fun technically and it might work, but why bother when there are a lot of data centres like this popping up?” Where do you start when building a data centre? With the power. This is used to run the cooling system and all the servers. A power-

www.tuxradar.com

July 2014 LXF185     47

Anatomy of a data centre

A trio of massive diesel generators help keep things running in a power cut.

UKFast’s own servers are run in one building and are accessible only to its staff. But it also offers client installed and maintained servers in another building, which is separately secured.

Data suite

knows their solution works and is primed to kick in when needed. As Feitsma notes there’s no point building an in-house data centre and cutting corners on the UPS: “but this is what happens as the UPS becomes expensive, difficult to maintain or they can’t put it in a proper environment like this; all it takes is someone walking past and pulling a cable out.” Inside the generator housings are inches upon inches of soundproofing. The generators themselves are kept warm 24/7 to ensure that they can start quickly when needed, and are turned over every day to confirm they are ready to run. The design of the UKFast data centres optimises the air flow for cooling by raising all the cabling above the servers. The air goes under the floor and through the grates. It is pulled in by the servers at the front and is deposited in the hot aisle behind them.

The cooling is applied directly to each cabinet and these are set in sealed rows. You can feel this at work because it’s hot outside each row, but as soon as you open the end door and step inside it’s instantly chilly and very noisy. Older data centres ran inefficient full room cooling or positioned the cables under the flooring. This, however, used to cause issues

“It’s like a hotel”, explains Feitsma. “As long as it’s legal and not a fire risk, you can do what you want in there – it’s not our business. Our business is to keep it cool, powered and connected – what you do with it is up to you. The customers have their own locks. This is what’s known as a carrierneutral data centre. As it is neutral, you choose who provides your data communications and we’ll connect you to them in a number of ways. We have a lot of carriers here already, so we’ll run a cable from their switch to your switch. If they’re not here we have a very clever system, called a DWDM (Dense Wavelength Division Multiplexing), that connects us to other data centres. It’s a fibre network. We can then pick up carriers from other centres and bring them back – that’s how all the data centres connect to one another.” Connected to the client hosting is what is described both as a ‘meet and greet’ and a ‘build room’. Engineers who are working on their own equipment refuse to wear ear defenders and sound levels within the server room are dangerously high, hence the need for the separate ‘build room’, in lieu of exploding

“As long as it’s legal and not a fire risk, you can do what you want in there.” because as more and more cables were added, the amount of space for cables would run out, until the floor grates would no longer fit. The ceiling solution gets around this issue and keeps the under-floor space clear for better cooling.

Anatomy of a data centre Lead-acid back-up batteries While the UKFast data centre is protected from long-term power cuts with diesel generators, they still take as long as an epic 60 seconds to kick in. So how exactly is this interim period protected? An entire wall’s worth of lead-acid batteries offer enough power to keep the facility going at full capacity for ten minutes – more than long enough for the generators to get up and running. And we bet users don’t even notice!

Air conditioning A large part of the energy consumption of a data centre comes from the necessary cooling to keep all the systems nicely chilly. This is handled by lots of integrated air conditioning systems. The exhausts are located outside the building and only spin up when cooling is required. In the past, the power ratio of the facility was 2:1 – 2KW of cooling for every 1KW used for computing. With today’s improved design, however, it is closer to 1:1.

Physical security Anti-climb fences complete with razor wire surround the facility and the main gate is remote activated. Would-be terrorists should be advised that the gates can easily shrug off a head-on collision from a 10-ton truck at 30mph. While the data centre is not exactly a military secret, it is located in an anonymous industrial estate, so you’ll need to do your research just to find it.

Fire suppression system Strategically placed around the facility are large red cylinders that have pipes running up to the sprinkler system. These aren’t water sprinklers, but are part of a chemical fire suppression system. Don’t worry – rather than halon, the system uses a different chemical that still allows humans to breathe while it’s in use. Well, that’s preferable to leaving a pile of corpses for the firefighters to trip over anyway.

1

2

48     LXF185 July 2014

3

4

www.linuxformat.com

24/7 surveillance Alongside the physical security, the entire facility has 24/7 surveillance and security patrols. The outside and inside of the building are covered with cameras, and all visitors are logged in and out. To gain access to self-hosted systems, you’re required to register your visit beforehand and supply photo ID before access is granted.

5

Server banks Wrapped up within all of this power, cooling and security are the allimportant servers. Rows of server cabinets are contained in sealed ‘corridors’. This helps improve the cooling efficiency because air conditioning can be delivered to each individual cabinet rather than the entire room. Outside of these rows the server room is warm, while inside it’s pretty chilly and rather windy.

6

Anatomy of a data centre

eardrums and lasting damage. It is also where all the network-owned carrier equipment is kept – these racks of switches separately stored within a caged unit. “So Cable & Wireless, Vodafone, Virgin and BT can have a point of presence,” says Feitsma. “They don’t need much equipment, but they do like it separated. If you wanted to connect to Virgin, we’d run a cross-connect cable from its box out of the cage to your box. It fully brings their network to you. If they start filling up they can just put in another switch and another switch. It’s really just a clean way of doing it and they only have to do it once.” “It also helps,” says Feitsma, “that the area is reasonably good for data centres: It has quite good fibre availability. Lots of the fibre companies are already in the ground

And if it’s regulation you’re after, you can’t do better than these regulators.

Power substation The only item on the property not owned by UKFast. This is where the mains power supply comes on to the property.

7

Uninterruptible power supply Sat beside the data centre’s mains power regulators are bank upon bank of man-sized uninterrupible power supplies. These are installed with the N+1 rational, which means that everything keeps ticking over, even if one of them fails. The power supplies kick in the very instant a reduction in the mains input is detected, but also handle the significant power switch between the mains, the lead-acid batteries and the diesel generators.

8

Internet backbone A key reason for the Manchester location is that there’s now an internet backbone node located in the city. This greatly reduces the costs of connecting the data centre

9

around here. If we were to open our own data centre and we chose somewhere like Eccles [famous for its cakes, but not its networking] there’s nothing in terms of connectivity. You’re going to spend hundreds and hundreds of thousands of pounds physically digging trenches in the road to connect to someone nearby. If you don’t put your stuff in the right place, one factor can really eliminate you as a serious player.”

Staying connected The connectivity aspect is another essential element. From its data centres, UKFast can use its fibre to connect you to any other network you need, even if it doesn’t have a point of presence in its ‘meet and greet’ room. Continuing the N+1 system, UKFast uses a diverse fibre network. Two 10GB fibre networks go out of the facility in two different directions, via two different variants of carriergrade Cisco switches. All the servers and client equipment have access to the diverse network and each one is plugged into both switches. So if one of those goes down, the other one is there. Feitsma says it’s not simply a case of thinking, ‘there’s an empty building, lets make a data centre’: “You need the power and the connectivity – the cooling is what a lot of people talk about, but it’s the airflow as well. Along with the security, they’re the four aspects of a data centre. London has had a lot of data centres appear in the last 18 months. A lot of property guys thinking they could make a lot of money off the back of it, but it’s a bit more complex than property. Big operators in Docklands and Slough have mega-facilities

facility via fibre to the high-speed backbone. Previously, the only other data centre location options were within London, at great monetary expense, or at a cheaper site elsewhere in the country that would invoke additional expense to hook up the facility with fibre. Network cabling To enable data to get to and from those pesky servers, we still need to use physical cables. Miles and miles of Ethernet cabling, to be precise. These cables run under the floors in many data centres, but that can lead to floor tiles being pushed up when too much is installed. Therefore, UKFast prefers to channel cables above the servers. It’s pretty neat and ensures a clear airflow under the server for much more efficient cooling.

10

11

Internal security Exterior and interior doors all require a security door pass. This restricts access,

www.tuxradar.com

These generators really do seriously... generate.

and they charge an absolute premium. They get international banks, international financing, gaming companies, gambling companies.” It’s an impressive facility in terms of the details, and as Feitsma says there’s not much to actually see, but it’s actually hard to take it all in. You could attempt to replicate this infrastructure in your own business, but this is what you get, or should expect, from using a data centre. “So many people in IT have never been in a data centre,” says Feitsma. “I hadn’t. I’d been in IT for 30 years, but it’s only in the last five years that I’ve been involved with data centres. Years ago I used to sell call centre technology and you’d give them the software to install. They’d say that it wasn’t working, so you’d go into their offices and find the servers under the stairs overheating, or they had connected via a 56K modem. If you’re going to invest in something you have to get it right”. LXF

but also logs entries and exits with automated camera shots. Diesel backup generators What happens when the lights go out? Well, they don't. Facilities are kitted out with a number of backup generators that will kick in automatically the instant the power goes down. The aim is for the generators to be up and running and supplying a replacement mains supply within 60 precious seconds. At UKFast there are no less than three diesel generators on standby 24 hours a day, seven days a week, 52 weeks... well, you get the idea. These generators are tested on a weekly basis and all of them have 50,000 litres of diesel on hand. It sounds pretty simple, but it is an easy corner to cut. If you had fewer generators, or didn't bother testing them – or the standing diesel – then when you did actually need them, they'd explode with a hefty bang. Not an ideal situation for a data centre to find itself in.

12

July 2014 LXF185     49

Linux on Chromebook

Install

Linux on your new Chromebook For those who’ve bought a Chromebook and miss a full OS, Neil Bothwick shows you how to get an assortment of Linux distros up and running.

C Jargon buster! apt-get The program used to install software packages on Debian, Ubuntu and other Linux distros.

hrome OS is brilliant – for the type of user the Chromebooks are generally aimed at, it does exactly what it needs to do. It is fast and easy to use – what more could you ask for? Well, after a while, you may find yourself missing some of the features associated with more traditional operating systems. But don’t fret, because help is at hand, in the form of Crouton. Crouton is a set of programs that set up a chroot environment within Chrome OS, from which you can run a Linux OS, with Debian and Ubuntu currently supported. A chroot is not the same as a virtual machine – you are still running on the standard operating system, but within a new environment. This method has several key advantages: for example, it does not touch the existing OS installation,

making reversal easy; it uses the Chrome OS drivers for video, wireless and other devices, so there are no compatibility issues; and it is written by the Chrome OS authors, so it should remain compatible with future updates. The only real disadvantage to using Crouton is that there may be a slight performance hit, but you didn’t buy a Chromebook for its blazing speed anyway. Oh, and in case you’re interested, the name Crouton is a convoluted acronym (standing for ChRomium Os Universal chrooT EnvirONment) that was clearly thought up after the name. Before you start installing other distros, it’s a good idea to create a rescue disk to restore your Chromebook should anything go awry. Even if you’re not installing another OS, this is a wise step to take, especially as it’s so simple – all you need is a USB stick or SD card of at least 2GB in capacity. Because of the cloud-based nature of Chrome OS, 2GB is enough, because you only need to back up the operating system – your data and settings are safe on Google’s servers. (See the Recovery disks walkthrough on p53 for details.)

Shell shocked When you’re ready, start downloading Crouton from http://goo.gl/fd3zc. This is a script that downloads and installs everything you need. You run it from a shell – yes, Chromebooks come with a shell. Press Ctrl + Alt + T to open the Crosh shell in a browser tab. This is a limited shell, but run shell to start a proper Bash shell. Crouton needs to know which distro you want to install; it calls these releases and selects them with the -r option. Then it needs to know the target environment you want to install. A target is a collection of software packages, such as a particular desktop. These two commands will list the options:

LXDE running on a Chromebook, but Chrome OS is still there.

50     LXF185 July 2014

www.linuxformat.com

Linux on Chromebook

Enabling Developer Mode Using Crouton means putting your Chromebook into Developer Mode, in which you get root access and even a Bash shell. This isn’t a hack, but a fully supported, if hidden, official option. A warning to start with: enabling Developer Mode wipes your storage. It doesn’t affect your cloud storage but any files stored locally should be uploaded to Google Drive before you proceed. The method of enabling developer mode is device-specific – you can find instructions at the Chromium website

here: http://bit.ly/1gDHPGd. On the Acer C720 we used for testing, as with most Samsung devices, you turn the device off and then hold down Escape and Refresh keys before pressing the power button. This gets you into the recovery screen, then press Ctrl+D to enable Developer Mode. Other devices have a hardware button for this. Once Developer Mode is enabled, you will see the OS verification is OFF screen each time you turn on – press Ctrl+D to continue booting, or wait 30 seconds.

Head to www.chromium.org to pick up the Developer Mode switch for your device.

sh -e ~/Downloads/crouton -r list sh -e ~/Downloads/crouton -t list 2>&1 | more The second command needs to be passed to more because it is several screenfuls – hit Space to page through them all. Once you’ve decided the release and target you want, you can run Crouton. To install Ubuntu 13.10 (Saucy Salamander) with the Unity desktop, for example, run: sudo sh -e ~/Downloads/crouton -r saucy -t unity This uses sudo because you need root to install the software. You can also specify multiple targets, like this example that installs Debian Wheezy with the LXDE desktop and the XBMC media centre: sudo sh -e ~/Downloads/crouton -r \wheezy -t lxde,xmbc

Unity is perfect for running everything in full-screen

Jargon buster! chroot A directory into which a program is locked. It can’t see anything outside.

Starting up Depending on the target(s) selected and the speed of your internet connection, this could take a while. When it has finished, it tells you the command needed to start your chosen distro in the chroot, such as: sudo startunity Run that command and you will be in a standard Ubuntu desktop. When you have finished, log out in the usual way and you go back to the familiar Chrome OS. You can switch between the two by holding Ctrl+Alt+Shift and pressing Forward or Back, too. In fact, the Chrome OS navigation keys above the numeric row are treated as the F keys by Linux, so these are really Ctrl+Alt+Shift+F1 and Ctrl+Alt+Shift+F2. The installation you end up with is not the complete distro as you would get installing it natively, but any extra packages can be installed in the usual way. If using Unity, the Software Centre is not installed, so open a terminal in Unity (Ctrl+Alt+T) and run: sudo apt-get update sudo apt-get install software-center Now you can install any other packages you need from the GUI. You can also install extra target environments with the -u flag. For example, to add the LXDE environment to the Ubuntu chroot we created before, we would run: sudo sh -e ~/Downloads/crouton -r saucy -u -t lxde

Adding some privacy As you may have noticed, enabling Developer Mode gives you root access through sudo, without requiring a password. This is slightly less secure for Chrome OS, but your login and files are still protected by your Google login, but it means that all the files in your chroot are readable, even with a passwordless guest login. If this concerns you, it is possible to encrypt the entire chroot by using the -e flag for Crouton. This prompts

for a password and uses that to encrypt the entire chroot directory, meaning you can neither read nor run the chroot without the password. For example: sudo sh -e ~/Downloads/crouton -e -r wheezy -t xfce There are lots of distribution releases and targets to choose from; you could install them all at once but that would get pretty bloated, so how do you try them all out? The answer is that you can have as many chroots as you have space for. If you plan to do this, you may find it easier to use Crouton’s -n option to give each chroot a name, otherwise they are simply names after the release. Naming is important when installing multiple releases, because the name is needed when running the startup commands, otherwise Crouton just loads the first release in which it finds the target you gave. Adding -n, like this, lets you ensure the right release is loaded: sudo startunity -n saucy Crouton also installs a couple of useful tools, particularly edit-chroot. This can be used to back up a chroot. sudo edit-chroot -b saucy creates a backup file in ~/Downloads, which you can restore with the following: sudo edit-chroot -r ~/Downloads/backup-file.tar.gz Copy this somewhere safe. Even if you do a full reset/ recovery, you can still restore it by downloading Crouton again and running: sudo sh -e ~/Downloads/crouton -f backup-file.tar.gz You can also use delete-chroot to delete a chroot, which you could have worked out for yourself, or you can simply delete the directory holding it from /usr/local/chroots to go back to a vanilla Chrome OS. Assuming, of course, that you’d want to do that. Follow the steps over the page…

www.tuxradar.com

Quick tip When trying multiple distros or targets, clean out any you have finished with. At several GB each, your storage will soon disappear.

July 2014 LXF185     51

Linux on Chromebook Install a release

1

Open a shell

2

Open a terminal window by pressing Ctrl+Alt+T. This will be a basic Crosh shell in a browser tab, which has a limited set of commands – you can see them by typing list. One of the commands is shell, which gives you a full Bash shell, like other distros. It’s true – Chrome OS has a proper Linux OS behind the scenes.

3

Encrypt your files

4

Adding -e to Crouton’s command line (this is not the same as the -e that follows sh) causes your chroot to be stored in an encrypted directory. Chose a decent passphrase – this is all that is protecting your files, but remember that most of your data will probably be saved in the cloud because Chromebooks have very little storage.

5

Add a package manager

52     LXF185 July 2014

Installing the distro

Because Crouton is only an installer, it needs to download the distro release files before installing, so allow time for this. Even with a fast connection, it can take more than 30 minutes to download and install everything if you have chosen large targets – the sizes are shown in the output from crouton -t list.

6

The default targets include only the command line package manager, apt-get. For most people, the first step is to open a terminal and use it to install a more friendly option, such as software-center for Ubuntu or Synaptic for Ubuntu or Debian. Run sudo apt-get update to make sure you get the current version, then sudo apt-get synaptic.

Choose a release and target

Running Crouton with -t list will show you all the available targets. You’ll probably want one of the standard desktop environments. Chromebooks are relatively low-powered, and a lightweight desktop such as LXDE is a good choice, while Unity is better suited to running everything full-screen.

Run synaptic

Once you have Synaptic installed, you have easy access to all the software in a distro’s repository. Most of the targets are slimmed down, to save on downloads and give a faster installation, but you can install anything you want from here. Either use the Search button or just browse the categories to see what is available.

www.linuxformat.com

Linux on Chromebook Recovery disks

1

Back up to USB

2

Plug in a USB stick or SD card of at least 2GB capacity, open Chrome and type chrome://imageburner into the location bar. Chrome OS downloads and installs the recovery image for your Chromebook. If you have more than one model of Chromebook, run this separately for each one; it gets the correct image for that device.

Create the recovery disk

After downloading, the image is written to your USB stick. If you don’t create a recovery disk, it’s also possible to get this image from another computer and copy it manually, by following the instructions at http://google.com/chromeos/recovery, but you have to make sure you get the right image – they are specific to each model.

3

In case of emergency

If you corrupt Chrome OS and get the following scary ‘Chrome OS is missing or damaged’ message, plug in your recovery medium. You can also force a recovery, if you want to go ahead and restore it anyway, by pressing the hard reset button or key combination, which varies from model to model. Check your Chromebook’s documentation for whatever applies.

Crouton: the pros and cons Comparing a £200 Chromebook to a full laptop may seem unfair – it is more in the netbook price range, and aimed at a similar market – but we’ll do that anyway. Running Ubuntu or Debian on a Chromebook is just like running it on a proper laptop. The only differences are down to the use of a chroot. This means you have to boot into Chrome OS first and then open a shell to start the chrooted session, but Chromebooks are designed to be suspended rather than shut down, so this isn’t necessarily often. Because it uses the hardware through Chrome OS, you need to do things such as set up your network connection in there, but as you can switch between the operating

systems at will, this is not a problem. This isn’t dual boot; it’s running both systems at once – far more convenient. The main limitation with this setup is the lack of storage space and dependence on a network connection and cloud services. While Chrome OS handles this transparently, you need to set up some sort of online syncing from your chrooted distro, using services, such as OwnCloud, Spideroak or Dropbox. There are other ways of installing Linux on a Chromebook but Crouton does it in the least intrusive way, leaving your existing OS untouched (apart from needing to enable Developer Mode). Trying multiple options, and removing them

www.tuxradar.com

when done, which is also a key benefit of this approach. Not least of its strengths is that Crouton is developed by the Chrome OS authors and isn’t a thirdparty hack. Future updates to Chrome OS could break your chroots temporarily, but an update through Crouton will fix that. LXF

July 2014 LXF185     53

Dr Brown’s Administeria

Dr Brown’s Dr Chris Brown

Administeria

The Doctor provides Linux training, authoring and consultancy. He finds his PhD in particle physics to be of no help in this work at all.

Crypto Wars

O

penSSH 6.6 was released a few days before I began writing these words. Apparently one of the big new things is support for Daniel Bernstein’s Curve25519 Elliptic Curve Diffie-Hellman key exchange protocol. Whaddya mean, you haven’t a clue what I’m talking about? This is important technology – pay attention! The problem is that 99.99% of us can’t really follow what’s going on. We can understand that if army A turns up with pikestaffs and army B arrives with howitzers, then army B will probably win, but if army A uses an Elliptic Curve DiffieHellman protocol to exchange a triple-DES symmetric session key, and Army B uses the Rivest-Shamir-Adleman algorithm to exchange a 256-bit Twofish symmetric block cipher key, who has the upper hand? Make no mistake, the cryptography war is a real one, with cryptographers and cryptanalysts ranged against one another across a digital no man’s land. By some estimates, the breaking of the German Enigma code in Poland, and later at Bletchley Park here in the UK, shortened World War II by two years. For many years the USA banned the export of cryptographic technology, worried that in the wrong hands it might confer military advantage, and classified it as ‘munitions’. But open source software such as PHP and OpenSSL has moved cutting-edge cryptography out of the hands of the military into the public domain. It’s thought that Curve25519 probably doesn’t have a ‘back door’ – a deliberately introduced weakness that allows government agencies such as NSA and GCHQ to intercept our (assumedly private) communication, but I’m actually not particularly worried about the thought that someone at GCHQ might be keeping track of my conversations (Hi, there fella!) because pretty soon whoever it is will die of boredom anyway. [email protected]

54     LXF185 July 2014

Esoteric system administration goodness from the impenetrable bowels of the server room.

nftables

In the beginning there was ipfwadm, then there was ipchains, then there was iptables, and now there’s nftables.

M

any of you will be familiar with the iptables program, which is used to load packet filtering rules into the kernel’s netfilter subsystem in order to configure a firewall. Well, all that is set to change with the introduction of nftables, the coming-to-fruition of a project that started back in 2009. The learning curve from iptables to nftables appears rather steep, as the syntax is substantially different. Here’s a fragment, just to give you the ghost of an idea. Here we define a table with a single rule chain called ‘Input’ which is hooked into netfilter’s ‘input’ path. We allow all traffic arriving on the loopback address, and packets destined for our ssh server, but we drop, count and log everything else: table Filter { chain Input { type filter hook input priority 0; ct state established accept ct state related accept iif lo accept tcp dport ssh counter accept counter log drop } } The language is considerably more expressive than iptables. For example the rule: nft add rule ip filter input tcp dport {ssh, http,

https} accept replaces three separate iptables commands. The list in curly brackets is known as a set. You can define your own sets and give them names (an example might be a collection of blacklisted IP addresses), then use these named sets in other rules. Later you could simply add a new blacklisted IP address to the named set.

Try it for yourself If you want to give nftables a try, your choices are limited right now. The technology didn’t became part of the mainline kernel until version 3.13. Ubuntu 14.04 (still in beta as I write this) does ship with a 3.13 kernel, but the userspace libraries and tools for nftables are not yet in the standard repositories. I did make a perfunctory (and unsuccessful) attempt to download the source of nftables and associated libraries from the Git repositories and build those, but eventually I found the pieces I needed already built in the PPA (Personal Package Archive) from Xu Zhen and (starting from a vanilla installation of Ubuntu 14.04) I was able to get a working nftables setup with just three commands: sudo add-apt-repository ppa:xuzhen666/ nftables sudo apt-get update sudo apt-get install nftables

Where to learn more Doumentation is pretty limited right now, but there’s a fairly detailed man page for nftables, you can find a useful HOWTO at Regit.org (http://bit.ly/nftableshowto) and some additional discussion and examples here: http:// bit.ly/lovenftables. The project’s home page is at http://netfilter.org/projects/nftables.

www.linuxformat.com

nftables uses the existing netfilter infrastructure – its existing hooks, connection-tracking, user-space queueing, and logging components.

Dr Brown’s Administeria

APIs and protocols The terms API and protocol have become degraded to the point where they are almost synonymous. Read on and clear up the confusion… headers are removed. This payload includes the headers of the layers above. Conceptually, communication takes place between the pieces at the same level in the stack. The HTTP client speaks HTTP protocol to the HTTP server, the TCP layers speak TCP protocol, and so on.

Moving up the stack While the lower levels of the protocol stack use binary message formats which are best described by diagrams such as the one in the figure, up at the application level the protocol is often text based. For example, an HTTP (Hyper Text Transfer Protocol) request might look like this: GET /greeting.txt HTTP/1.1 Host: www.example.com and the response might look like this: HTTP1.1 200 OK Content-type: text/plain Content-length: 14 Hello World! Even up at the application level we see (at least in this case) a separation between ‘header’ and ‘payload’. In the HTTP response shown above the first three lines are the header and the last line is the payload. They are separated by a blank line – that’s part of the HTTP protocol.

Something completely different… So much for protocols. What about APIs? My trusty OED says simply that it’s an abbreviation for application programming interface, but we already knew that. Turning to Wikipedia, we find “an application programming interface (API) specifies how some software components should interact with each other,” which is kinda vague, but it goes on to remark that 0

1

3

IHL

Type Of Service

Total length

Identification Time To Live

Flags

Protocol=6

Fragment offset Header checksum

Source address

IP Header

Version

Destination address Options

Padding

Source port

Destination port Sequence number

Data offset

Reserved

U A P R S F r C S S Y I g K H T N N

Checksum

TCP Header

Acknowledgment number

Protocols are like onions Protocols are commonly used in combination by layering one on top of another. For example, the messages defined by the HTTP protocol are transmitted over TCP (Transmission Control Protocol) which itself is carried over IP (Internet Protocol). At the sending end, as the packet passes down to the layer below, a header is added to allow that layer to do its job. Thus the packet accumulates headers on its way down the stack. At the receiving end, as each layer has completed its job and hands its ‘payload’ up to the layer above, the

2

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

Window Urgent pointer

Options

Padding Data

I

t’s not good form for an instructor to argue with his students. It’s unprofessional, and it makes them less likely to tick the happy smiley face on the evaluation sheet at the end of the course. Avoiding an argument sometimes needs tact (not my best subject), as in a recent training event when I got into – let’s call it a robust discussion – about the difference between an API and a protocol. The student maintained that the terms were synonymous, whereas I attach quite different meanings to each. Are you sitting comfortably? Then I’ll explain. My trusty OED has no fewer than four definitions for ‘protocol’, the fourth and most relevant being: “A set of rules governing the exchange or transmission of data between devices.” The world of protocols is awash with acronyms. POP, PPP, HTTP, SMTP, TCP, UDP – the list is endless (well, not literally endless, but it’s certainly very, very long). Each of these protocols is a detailed, formal description of the on-the-wire formats of the messages exchanged to perform a specific operation – send a mail message, fetch a web page and so on. The use of the word ‘simple’ in protocol names is a common and somewhat irritating trend – we have SMTP (Simple Mail Transmission Protocol), SNMP (Simple Network Management Protocol), SOAP (Simple Object Access Protocol), SASL (Simple Authentication and Security Layer) and many others. Most of these protocols are anything but simple, and it’s not clear whether the word ‘simple’ is there to help give you the confidence to understand them, or to make you feel utterly inadequate if you can’t. I am especially amused by ESMTP (Extended Simple Mail Transmission Protocol). Why can’t they just come clean and call it CMTP (Complicated Mail Transmission Protocol) instead, or maybe just settle for plain ol’ MTP? The protocols used on the internet are described in standards documents called RFCs (request for comments). Traditionally, these use simple ‘ASCII art’ depictions of the packet formats. For an easy example take a look at RFC 1350, which defines the Trivial File Transfer protocol. Protocol definitions are usually rather formal and tediously detailed. The idea is that two people could walk away with a copy of the protocol and come up with implementations that successfully interoperate – though how often this actually happens without subsequent tweaking, I don’t know (“Oh, that’s what you think it means ...”). Also, protocols usually make no assumptions about the programming language in which they’re implemented, or the operating system those implementations might be running on.

Data The traditional way of documenting internet protocols. The diagram is 32 bits wide and should be read row-by-row.

www.tuxradar.com

July 2014 LXF185     55

Dr Brown’s Administeria http1.1 200 OK Content-type: text/plain Content length: 14

client

HTTP Header

Application payload

TCP Header

HTTP Header

Application payload

TCP Header

HTTP Header

Application payload

User space Kernel

IP Header

server

Hello World

HTTP Protocol

TCP Protocol IP Protocol

IP Header

HTTP Header

Application payload

TCP Header

HTTP Header

Application payload

TCP Header

HTTP Header

Application payload

network Protocols are combined in layers. Each layer’s header (blue) is part of the payload of the layer below (orange).

“In practice, many times an API comes in the form of a library that includes specifications for routines, data structures, object classes, and variables”. A classic example of an API is the system call interface into the Linux kernel. This is the set of functions that application programs can call to obtain kernel services – access files and directories, start new processes, connect to network services, create pipes and so on. Here’s a fragment of C code that removes all the files from a directory: DIR *dir; struct dirent *info; char *n; dir = opendir(“.”); while ((info = readdir(dir)) != NULL) { n = info->d_name; if (strcmp(n, “.”) && strcmp(n, “..”)) { printf(“removing %s\n”, n); if (unlink(n) < 0) { perror(n); exit(2); } } } Don’t worry if you’re not fluent in C – just notice the calls to opendir(), readdir(), and unlink(). These are part of the low-level directory management API for Linux.

Request for comments The very first RFC was issued on 7 April 1969 by Steve Crocker. Crocker was one of a number of young graduate students who, back in 1969, were in essence inventing the internet. In an interview with Wired magazine, Crocker explained that they decided to start writing down some of the ideas they’d been kicking around, but felt that “the mere act of writing down what we were talking about could be seen as a presumption of authority and someone was going to come and yell at us…”  

56     LXF185 July 2014

And so the name “Request for Comments” was chosen to emphasise their informal nature. Crocker says “I genuinely thought that by the time the network got built, there would be some formal documentation and that these notes would just become obsolete and be thrown away. But they stuck. And this became the primary mode of documentation.” There are now something like   7,000 RFCs, all of which are available   at www.rfc-editor.org.

www.linuxformat.com

APIs are, by their nature, language-specific, though it is common to provide ‘language bindings’ to a given library for a variety of languages. By way of comparison, here’s the equivalent code in Perl: opendir(DIR, “.”); foreach $info ( readdir(DIR) ) { if ($info ne “.” && $info ne “..”) { if (unlink($info) != 1) { warn “$info: $!\n”; exit(2); } } } There are some syntactic differences, but again you can clearly see the calls to opendir(), readdir() and unlink(). We could equally well write it in Python or PHP; each has its own language binding, but the API remains essentially the same.

Muddying the waters So far, I hope the distinction between a protocol and an API is clear. They are really entirely unrelated. But the waters start to get a little muddied because we can usually wrap library routines around protocols (at least around application-level protocols) and end up with an API. Here’s an example: RFC959 describes the venerable file transfer protocol (FTP). This protocol is ‘wrapped’ in the Python library called (appropriately) ftplib. This module defines a class called FTP, which implements the client side of the FTP protocol. Here’s an example of using it: >>> from ftplib import FTP >>> ftp = FTP(‘ftp.debian.org’) >>> ftp.login() ‘230 Login successful.’ >>> ftp.cwd(‘debian’) ‘250 Directory successfully changed.’ >>> ftp.retrlines(‘LIST’) -rw-rw-r-- 1 1176 1176 1066 Feb 15 09:23 README -rw-rw-r-- 1 1176 1176 1290 Jun 26 2010 README.CD ... rest of output omitted ... Again, don’t fret if you don’t read Python; you can clearly see the calls to login(), cwd() and retrlines() that make up part of the FTP API. (See http://bit.ly/ftplibclient for the complete works.) There’s a similar module called http.client

Dr Brown’s Administeria that defines a class called HTTPConnection; its methods implements the client side of the HTTP protocol. I’ve picked Python for my examples here (almost) at random; there are libraries providing bindings to the FTP and HTTP protocols for many other languages.

And then there were web services When we start to look at web services, the boundary between protocol and API becomes even more blurred. My view of web services is a rather bottom-up (some would say oldfashioned) one because I look on them as a set of remote procedure calls. The basic idea is that we have some procedures (functions, subroutines, methods – call them what you will) that exist on a remote machine, but we can call them as if they are local ones. The procedures we’re really calling are just proxies. They take the input parameters (3), serialise them into some well-defined format (4), and send them to the server (5), where they are unpacked from the data stream and passed to the real procedure(6). This procedure does its work and (presumably) returns a result (7), which is again serialised (8) and sent back to the proxy in the client (9), where the data is unpacked from the stream and passed back to whatever called the procedure in the first place (10). (Refer to the figure to tie up the numbered steps.) So here we have both an API (defined by the set of exported methods within the service) and a protocol (which defines the format of the messages passed between client and server when the methods are called). Here’s a little example of a web service. I hope it doesn’t offend anyone by being a C#/.NET example. The core of this service is a single tiny method which simply returns a string representation of the current time and date: [WebMethod] public string RightNow() { return DateTime.Now.ToString(); } When I ‘publish’ this service it is hosted in a web server (IIS in this case). Why a web server? Because (as we’ll see in a minute) the protocol used to make the procedure calls is layered on top of HTTP, so as far as most of the protocol stack is concerned, a procedure call looks just like a fetch of a web page. The server also makes available a description of the service, using an XML-based notation called WSDL (Web Service Description Language). I’ve included an annotated screenshot of some of the key pieces of this. As you can see, like all XML it is hideously verbose. Basically, it just says that the service has a procedure called RightNow that takes no input parameters and returns a string. Notice that this WSDL description is not tied to a specific programming language or a specific operating system. The point of presenting this example is to allow me to ask the question: is this an API or a protocol? Well, neither – it’s a service description – but it does in essence define an API as a set of named operations with their input and output parameters. Indeed, tools exist to write the ‘proxy’ methods that serialise the parameters being passed to the method and de-serialise the return value (see steps one and two in the figure). The protocol used for this communication is called SOAP (simple object access protocol), which itself an XMLbased representation, which is carried as the payload of an HTTP request or response, which as we’ve seen is in turn carried over the TCP and IP protocol layers. I suppose the core point is this: you can always wrap an API around a protocol by writing library routines that know how to speak that protocol. That’s what the proxies are.

Clients and servers Protocols generally define communication between a client and a server – but which is which? Here’s my basic definition. The client is the piece that actively finds and connects to the server and

requests its service, whereas a server is the passive piece. Its job is to bind its ‘well-known’ port number to a socket, prime the socket to listen for connections, and then sit back and wait for business.

client

server Web Service Methods

Application 10

Proxy

9

6

3

2

WSDL service description

7

Web Server

1

4

5

8

network soap/xml/http

Web services use XML-based languages to define the service, and to serialise the parameters when its methods are called.

My example is just a toy, of course, but there are many real-world service descriptions out there. For example, the Amazon EC2 web service API defines over 300 service operations that support the creation of machine instances, storage volumes, security key pairs, amongst much else. Built on top of this are the command-line management tools (with names like ec2-create-keypair, ec2-run-instances and ec2-attach-volume, they are little more than wrappers around those 300 service operations). Also built on top of this API is the web-based AWS management console. We see a similar story for the OpenStack management API. So there you have it. As Douglas Adams might have put it: APIs are almost, but not quite, entirely unlike protocols. LXF

Hideously verbose, WSDL is used to formally describe a web service. Here’s just a part of it!

Give SOAP a REST Before you write in to complain, I’m aware that WSDL and SOAP are not the only kids on the block when it comes to defining and accessing network services. There’s also REST, which stands, rather un-enlighteningly, for

www.tuxradar.com

“Representational State Transfer”. I’m not going to place myself in the firing line by saying which is better; REST is certainly simpler and seems to have become much more popular than SOAP in recent years.

July 2014 LXF185     57

The best new open source software on the planet Richard Smedley FOSS activist Richard grasps his trusty prospector’s pick and plunges into the dingy mine that is the web in search of rare nuggets of open source gold..

Midnight Commander Python 3.4 Goggles Music Manager Shellpic Dispcalgui Pioneer Assassin of the Underdark

Nuttx Qtractor Glucat Git

Command line file manager

Midnight Commander Version: 4.8.12 Web: www.midnight-commander.org

A

stonishingly, there are people who have never experienced the unfettered joy of running Midnight Commander. This effortlessly helpful app – called from the terminal by its other sobriquet, mc – runs where GUI managers cannot tread, such as within your SSH terminal session, and gives you the easy convenience of manipulating files and directories through the classic two-pane interface, and a time-honed set of shortcut keys. It was started by Miguel de Icaza in 1994, before Gnome and Mono, and its longevity ensures that you probably have the latest package already in your distro’s repository, but building mc is no

real challenge. Browse the source code: this is a very readable, mature project. Yet every release adds useful new features – here, a user-friendly skin selector and improved zsh support. Through core software, mcedit, and using helper applications, mc can read, edit and perform file operations on local and remote directories and files, even those tarred and compressed. Some distros occasionally put nano in as the

Midnight Commander calls helper applications, like the command line Lynx web browser, to view files of all types.

“mcedit is a decent little editor that can also be used standalone.”

Exploring Midnight Commander Inside archives Working inside a zipped folder is easy: mc understands most compression formats.

Menus and options Pulldown menus allow a range of extra file operations, as well as giving access to configuration options.

Local or remote

Using SSH, FTP or SFTP, mc works with local and remote files, giving transparent file transfer at a keystroke.

Function key shortcuts Each Function key is a shortcut to a command or menu – some change with context, though, so the reminders here will be handy.

58     LXF185 July 2014

The Edit option Edit is an ever-present option – this is a *nix file manager, after all. Naturally you can set whichever editor you want, but mcedit is a good default.

www.linuxformat.com

default editor in mc – you could also substitute vi or Emacs – but mcedit is a decent editor that can also be used standalone, and has syntax highlighting for everything from Cython to Verilog.

Web wonder An mc session is often faster than alternatives – for example, a recursive wget on a website – and you can now navigate around the entire site with mc, browsing the code with mcedit or reading the pages from Lynx (or any other browser you link to mc). As you’ll see in the screenshot (left), the bottom row contains 10 numbered shortcuts reached using the Function keys; the reminders are there because some change to stay context relevant – for example F2 normally calls up a user menu but is the Save key in mcedit. If your window manager has remapped any of these keys, you can press Esc and a number key, with Esc 0 filling in for F10. We tested in the virtual console, an ssh terminal and the XMonad window manager, where F keys are all available, but some remote connection software may not transmit F keys: from mobile phone SSH clients, certainly, it’s easier to use Esc key sequences.

LXFHotPicks High-level programming language

Python Version: 3.4 Web: www.python.org

M

ore than six months after the first alpha of 3.4, the full release is here. Nothing earthshaking about it: a smattering of new features, some slight changes. Let’s first touch on a few of these. The headline change is the standardised enum module, for a standard implementation of enumeration types – meaning you can bind symbolic names (such as days of the week) to constant values. This was proposed in 2005 and isn’t without controversy this time, with more than 1,000 emails on the developer mailing list. It’s been dubbed an awkward compromise, but most of the community have got behind the enum inclusion, and seem determined to work through any problems that arise. Less controversially, asynchronous I/O at last enters the core library with ideas borrowed from the Twisted module and elsewhere. It’s particularly important to cloud developers, and the

implementation is apparently “mindblowing” to language geeks.

Teacher’s pet Python is widely used in education and the core Python developers have received a lot of feedback from professional educators on problem areas in the language for new coders, and the lack of a default package manager is a common complaint, creating particular problems for crossplatform apps where Linux distros’ package managers can’t take up the slack. Making pip the default installer for Python packages from 3.4 fixes this. After many rejected proposals, pathlib is accepted as the official, high

Python has evolved, but type import this at the prompt and you still get a humorous reminder of what it’s about.

“We’ll see Python 3 become the unhesitating default choice.”

level, object-oriented library for accessing the local filesystem. There’s also a new statistics module, as a lightweight alternative to NumPy. But here’s what’s really key about this release. For some time Python 3 has gradually gained users, to the point that only a few projects are still Python 2 only (although there is still a massive installed codebase of Python 2 projects, naturally). Given the current rate of movement to Python 3, we reckon it will be during the life of Python 3.4 that we’ll see Python 3 finally become the unhesitating default choice.

Music collection manager and player

Goggles MM Version: 0.13.1 Web: http://gogglesmm.github.io

G

oggles Music Manager is a fast, lightweight music manager, updated after a year. Changes include a new playback engine and improved UI, a podcast manager, and improvements to seek accuracy for FLAC, Vorbis, Opus and MP4. The playback engine changes have however left AAC a work-in-progress, which will rule it out for now for those using this compression and encoding scheme. You’ll probably need to download the FOX toolkit, unless you have the latest version for some other project. That done, running ./configure --withoutoss and installing missing dev packages (libglew and libgcrypt) got us to errorfree compilation, and after make and make install, we opened Gogglesmm from the Apps menu and got a choice of which directory to import – defaulting to ~/Music. Accepting this, Gogglesmm quickly trawled the

directory recursively and added our collection of podcasts and iPlayer downloads, plus the odd bit of music, to its library.

Minimalist manager Categorisation is automatic, based on genre, artist, album, and song. Not always useful if your audio collection is outside the popular music mainstream or the folders you imported from aren’t well-named, but here GogglesMM’s easy tag editing – which supports multiple file editing – can help. The UI – created with the FOX toolkit – is pleasingly minimal, with everything necessary reachable either through the

A good manager for your music – and for dramas, talking books, podcasts, and any other audio on your hard drive.

“Quickly trawled the directory recursively and added our collection.” www.tuxradar.com

three drop-downs or by right-clicking on various items. Where available, album (or podcast!) art is displayed. Podcasts and Internet radio stations can be simply added by URI, and playlists can be imported or exported to XSPF, M3U, PLS or CSV format. Playlists can also be rearranged by drag and drop, or sorted via several menu options. GogglesMM also supports last.fm and libre.fm, linking to the sign-up pages if you don’t have an account. Hit Ctrl-M for a ‘miniplayer’ version of the UI.

July 2014 LXF185     59

LXFHotPicks Embedded operating system

Nuttx Version: 7.1 Web: www.nuttx.org

W

ith a focus on the tiny-tosmall, deeply embedded environment, Nuttx is an interesting real-timed embedded operating system (RTOS) to try out on the embedded developer boards you’ve accumulating at home or at your local hackspace. In fact, Nuttx will probably run on a majority of the boards you have, as this is the NetBSD of the embedded world, going from Atmel 8-bit AVR to Zilog Z80, and not neglecting much from the likes of ARM to Hitachi SuperH along the way. Given a suitable board, you can use qemu-system-arm (or whatever is appropriate to your processor) to test your Nuttx software out, before flashing the board’s ROM. However, to test out and develop Nuttx you’ll really want to install the cross-compiler toolchain. As well as downloading Nuttx 7.1, there is a separate package, which is called apps-7.1 that contains the software

you’ll want to run, such as a shell, networking software, and everything else you’ll need.

Kernel nostalgia Nuttx uses kconfig-frontend, for which you’ll need flex and the usual build essentials, as well as gperf. For most of these your package manager will take care of the work, but you’ll have to build a recent kconfig-frontends; we used 3.12.0. Running make menuconfig gives you a screen that will take you straight back to the days when you had to build your own Linux kernel – particularly if you were using a system with slightly non-standard hardware. In fairness, in those days almost all

Remember when you last compiled your own kernel? Nuttx’s will bring back memories with kconfig-frontend.

“Takes you back to the days when you had to build your Linux kernel.”

hardware was considered nonstandard, particularly laptops. Now we live in kinder times in the PC world, but with so many embedded chip options, you’re going to have to do a bit of work here – and sadly, given the number of possible options, we can’t be your guide. Instead, let us point you to those sunlit, upland slopes of successful development, and look at when you’ve got it on a board; for example, on several boards with 16KB of RAM, running Nuttx and NSH left more than 10KB free. Yet the environment is similar enough to Linux to get you up-and-running quickly.

Audio/MIDI multi-track sequencer

Qtractor Version: 0.6.0 Web: http://qtractor.sf.net

A

n audio/MIDI multi-track sequencer application written in C++ with the Qt4 framework, Qtractor uses Jack for audio and ALSA for MIDI, and aims to be a complete home studio. Currently, packages are available for Arch, Fedora, and SUSE. If you have to build Qtractor yourself, the mandatory dependencies are few – Qt4, JACK, ALSA, libsndfile, and LADSPA – but if you restrict yourself to this minimal alphabet soup you’ll miss out on some great technologies, like LV2, the extensible successor of LADSPA which Qtractor was among the first to adopt, as well as librubberband, the Rubber Band Audio Time Stretcher, and the DSSI API for soft synth plugins. Check the optional build-time requirements listed on the project’s website, and pull in as many as you can. Belying the modest 0.6.0 label, Qtractor is stable and mature. Latency

60     LXF185 July 2014

is low and – thanks in part to Jack – connection between real and virtual instruments and microphones to the software is hassle-free. Provided, that is, you compiled with DSSI.

Attitude not included

Qtractor has a useful but small set of default plugins, which are supported by plugins from elsewhere.

The simplest way to start is to rightclick in the file bin (the pane on the right of the window) to choose music files to work on. Qtractor is a non-destructive composition sequencer and arranger, so won’t alter the files. For most tasks you’ll probably need plugins beyond those included. Luckily, support is good for LADSPA plugins, DSSI, Linux VST, and LV2. You can also use Steinberg’s

“This software could compete with some of the pro-audio packages.” www.linuxformat.com

VST plugin standard with Wine, using the DSSI-VST wrapper. The 110-page manual has been upgraded from 0.5.x, but is a good place to start and includes the following gem: “Attitude. Not required, but if you plan on being a rock star, then you should try to develop a rebellious attitude, and resolutely reject mainstream software.” Qtractor contains interesting contradictions: despite targeting hobbyists; its tiny footprint and its Linux-platform-only stance, this software could compete with some of the pro-audio packages.

LXFHotPicks Terminal image display

Shellpic Version: 1.3 Web: https://github.com/larsjsol/shellpic

S

hellpic uses shell escape codes to display images in a terminal or an IRC client. That’s right, not ASCII art, but actual images, albeit a little blocky but somewhat reminiscent of the good ol’ 8-bit days (unless you only had a monochrome home computer of course). The ability to put images on IRC is more than just a novelty, although the usefulness is limited by the low resolution. That said, we spent a long time going through photo albums and looking at old pics in blocky, terminal glory. Although some were barely recognisable, others came over really well; particularly strong architectural shots, and pics of people in bold colours. Shellpic’s Incremental recent releases have added support for animated images, and further improvements have made it into the latest version. 1.3 also adds support for 16-colour terminals; although

256-colour is the default. If your terminal environment has 24-bit colour support, using the --shell24 switch will enable 24-bit output. Run as shellpic , it tries to scale to fit your terminal window. Alternatively you can specify scaling size, or no scaling. Other switches enable looping animation, colour depth, and the production of an image suitable for passing to an IRC client.

Paris in the Springtime – but rendering it onto a terminal window confirms the eccentricity of command-line fans.

Easy Install Want to try it? You’ll need pillow installed, which your distro may package as python-pil. Now either: sudo pip install Shellpic If you do things the Python way, or:

“Go through photo albums and look at old pics in blocky glory.”

git clone https://github.com/larsjsol/ shellpic.git cd shellpic sudo python setup.py install to get the very latest version. We install a lot of software for the HotPicks column, some of which is a huge pain to get working, and never makes it to these pages - but it has to be said that when we see a project written in Python we start to breathe a little more easily, as they typically install and run with very little fuss. We wouldn’t want to single any other languages out for unfavourable comparison, but Python coders, give yourself a pat on the back.

GUI for the Argyll CMS display calibration utilities

DispcalGUI Version: 1.9.0.6 Web: http://dispcalgui.hoech.net

R

eaders who spend time away from the command-line, and actually work with photographs on the screen, will have noticed the depressing fading of accurate colour from their lives since moving from CRT to LCD. All is not lost, any display can be calibrated. Under Linux, colour management uses International Color Consortium (ICC) profiles. This gives your device an accurate colour profile, and it can be converted to maintain colour accuracy from scanner or camera, through image editing software to monitor and even printer. Use of ICC gets round the lack of drivers for specific colourimeters and spectrophotometers under Linux, as the ICC profiles can be used anywhere. Although there are other options, the safest bet for a Colour Management System (CMS) under Linux is Argyll CMS, from Graeme Gill. It’s packaged

by most distros, and fairly well maintained. However, it’s a command line only set of tools and for so many complex and possible calibration choices, a GUI can make life easier for most casual users.

Just because it’s a GUI, doesn’t mean there isn’t a lot to adjust – but this is as easy as colour calibration gets.

Many colours DispcalGUI is a GUI front-end to Argyll CMS’s Dispcal calibration tool, and some of its profiling tools. The display should be the first consideration when setting up a colour-managed workflow, as where ever your images come from they all pass before your eyes onscreen. As a user you’ll want to choose your own settings for brightness, gamma

“Use of ICC gets round the lack of drivers for specific colourimeters.” www.tuxradar.com

and whitepoint, using first the monitor controls, then the video card calibration curves. This will not get you to accurate colours, but will give better results in apps that aren’t colour-managed. Before you can get started on this you’ll need to set up your colourimeter, which may involve some tweaking of permissions to get a user-mode program talking to the hardware. Thankfully, there’s documentation covering most eventualities, and websites like http://dpreview.com host tutorials and discussion forums on using Argyll CMS and dispcalGUI..

July 2014 LXF185     61

LXFHotPicks HotGames Entertainment apps Space adventure game

Pioneer Version: 20140402 Web: http://pioneerspacesim.net

I

n the spirit of Frontier: Elite II, Pioneer is set in our galaxy at the turn of the 31st century. There’s a lot of travelling, reflected in the sophistication of the flight UI and different map views. You scan bulletin boards at trading stations, pick up missions; carry cargoes; and occasionally run into trouble and have a fight. You’re free to become a smuggler or try other illegal activities, too, but the law will react to your various misdeeds. Untar the binary and run it, the splash screen tells you to wait while it simulates 13.7 billion years of the universe’s evolution, then you get the start menu choice of Earth; Barnard’s Star (hello H2GT2G); or New Hope, at Epsilon Eridani, the capital of the Commonwealth of Independent

Worlds; as well as config options. Pick a start point and it’s back to the manual as this is one of those immersive games where, before immersion, there’s a lot to learn and it isn’t a ‘pick up and play on your phone for five minutes’ game. Of course, had we started with the manual, we’d have known not to start on the dock of High Security Prison Tranquility, orbiting Barnard’s Star – where we got kitted out with “a poorly outfitted Xylophis, so you can consider it a difficult start.” Starting at Earth’s London space dock is apparently “considered an easy start.”

Barnard’s Star may sound like a good place to start – but you’re given a poorly outfitted ship and it’s a prison.

“You’re free to try illegal activities, but the law will react to your misdeeds.”

Read the manual – and follow the flight tutorials on the wiki – and you’ll be off to a better start than we were. We won’t meet up, though, as this isn’t a massively multiplayer online affair. This has some advantages – apart from just avoiding the eccentric playing style of some online gamers – as you can fast forward through a lot of travel in a way that wouldn’t be easily done in a shared world.

Dungeons explorer game

Assassin of the Underdark Version: 0.3.15 Web: http://bit.ly/SdCT5X

W

hile few people would really risk descending into a dark and dangerous underground world for the slim chance of great rewards, it’s a greatly appealing format for role-playing games – computer-based or otherwise. Assassin of the Underdark is a relatively underdeveloped game, using the pygame libraries, and now benefitting from renewed activity by Johan Ceuppens, who also has projects like a side-scrolling shooter, and a Super Mario Brothers clone In fact, it’s at a very early stage: “Two rooms have been implemented, you start the game with a bomb supply, and you can fight with your sword. The game engine is in place as well as goblin, beholder,

62     LXF185 July 2014

beholderbat, and snake enemies.” Nevertheless it’s an easy install. Make sure you have pygame and Python 3, and download, unpack, and run it with: python game.py You’ll find yourself needing to choose a character (currently a two click process), then it’s time for some rudimentary fighting in the dungeon, until your enemies overpower you. What’s the point you ask? Well, while one day the game could be as complex and demanding as Pioneer (above) for now there’s not much going on, and

While short, there’s plenty of OO code to add to and develop if you’re looking for a Python project to hack.

“An open source project at an early stage of development.” www.linuxformat.com

this is the joy of the thing. Not that it’s over in a few minutes, but that it’s an open source project at an early stage of development. Whether you’re learning Python games programming (grep the code for FIX), composing music, or honing your computer arts skills, projects under an early stage of active development give a great opportunity to join in for mutual benefit. You test your skills in a real-world, collaborative project, and the project gets more help, and new skills and ideas added in.

LXFHotPicks Library of template classes

Also released

GluCat

New and updated software that also deserves a look...

Version: 0.7.3 Web: http://glucat.sf.net

A

Generic Library of Universal Clifford Algebra Templates or GluCat is a library of template classes which “model the universal Clifford algebras over the field of real numbers, with arbitrary dimension and arbitrary signature. GluCat implements a model of each Clifford algebra corresponding to each non-degenerate quadratic form up to a maximum number of dimensions.” GluCat includes the PyClical extension module which “implements the Python classes index_set and clifford, which interface to corresponding C++ classes in GluCat.” Clifford Algebra – which involves lots of matrix-crunching – has applications in differential geometry, quantum theory and computer vision where it’s being applied to the problem of action recognition. GluCat 0.7.2 (and the bug fix, 0.7.3) is the first release since the update for C++11 a couple of years ago,

GNU Guile 2.0.10 Scheme implementation with a module system, POSIX system calls, and multiple threads. www.gnu.org/software/guile

which also included a set of tutorials that guide you through working with Clifford algebra calculations in Python. This release generates lPython notebooks, speeds up some functions, and now compiles and builds with g++ 4.8 and clang++ 3.4. You’ll need the C++ Standard Library, and the Boost Library with the same version of g++ as you’ll be using for GluCat. Follow the excellent documentation, and you’ll soon be adding some speedy template classes to your C++ or Python project.

GNU Guile is the real-world Scheme that powers LilyPond.

While real representations of matrices can look BritArt, the maths Glucat uses has applications in computer vision.

Git

Horde Groupware Webmail Edition 5.1.4 Enterprise ready browser-based communication suite. http://horde.org

Version: 2.0 Web: http://git-scm.com

A

GNOME 3.12 The OSX-influenced desktop gets improved hi-res display support, and an app makeover. https://gnome.org ZXTune b3000 The cross-platform chiptune player adds support for c64 SID files. http://zxtune.bitbucket.org

Distributed revision control system

part from Python 3.4, the other big news release for coders was Git reaching 2.0. Git, the distributed revision control and source code management, has grown so quickly, from Torvalds’ 2005 code sprint to replace BitKeeper as the holder of the Linux source, that most of us now take it of granted – the highest form of compliment for any tool. This release, although numbered as a major milestone, doesn’t bring any jarring changes to the API or add revolutionary new features, it does provide some changes in default behaviour. The headline change is the move from matching semantics to simple semantics for git push [$there]. If there’s no branch specified it no longer sends all the branches matching to those at the remote location, but now just sends the current branch to the branch with the same name. Also,

JERL r9.1 5.18.2 Run Perl scripts within the JVM without an external version of Perl. https://code.google.com/p/jerl

git add is now the same as git add -A now, so that git add dir/ notices and records removed paths, bringing consistency between add and commit. Given that you’re already using it, what you want to know is: are there other compelling reasons to upgrade now, rather than later? While there’s no harm waiting for your distro to provide the upgrade package, you’ll only be missing out on subtle improvements to workflow, features, and performance

Qore 0.8.9 Scripting language supporting threading and embedded logic. http://qore.org

Not officially released as we go to press, but the release notes are comprehensively updated.

Nuvie 0.5 Enhanced game engine for playing Origin’s games: Ultima 6, Martian Dreams and Savage Empire. http://nuvie.sourceforge.net

Old skool Origin games given a new lease of life on Linux.

www.tuxradar.com

July 2014 LXF185     63

Back issues Missed one?

1 for Free Software

#

Issue 184 June 2014

Issue 183 May 2014

Issue 182 April 2014

Product code: LXFDB0184

Product code: LXFDB0183

Product code: LXFDB0182

In the magazine

In the magazine

In the magazine

You are cordially invited to join us in exploring the perfect way to build your own desktop – plus we take an educated gander at the future of 3D printing, and how Linux and the Pi can aid effective education.

We pit the top five desktop distros against each other to see which ones shine. Want to learn how to administer a web server? We show you how to build your own server at home. Plus, master SUSE.

LXFDVD highlights Mint 16 Mega Mix (64-bit), HotPicks and then some.

LXFDVD highlights

Mageia 4, Ubuntu 13.10 (64-bit), OpenSUSE 13.1 and more.

Fed up of being tracked online? We show you how to take control of your online privacy. How the Raspberry Pi was made – an exclusive visit to the Pi factory, plus Pipelight, an intro to Gentoo and OCaml.

Issue 181 March 2014

Issue 180 February 2014

Issue 179 January 2014

Product code: LXFDB0181

Product code: LXFDB0180

Product code: LXFDB0179

In the magazine

In the magazine

In the magazine

Pete Lomas gave us an exclusive look into the birth of the Raspberry Pi and we gave you the ultimate guide, we rated the Penguin Wee 4th Gen and Tails 0.22, plus we checked out the best VolP clients out there.

LXFDVD highlights

Linux Mint 16 with MATE & LXDE, Fedora 20, plus more!

Is the latest release of Mint 16 enough to make you switch? Discover how to expand your Raspberry Pi, we investigate equality and the open source community. And explore OpenStreetMaps.

LXFDVD highlights

OpenSUSE 13.1, Clonezilla 2.2.0, Hot Picks and more.

Continue the new year with a freshly installed Linux, configured just the way you want it! We also look to the future of gaming on Linux and round up the best open source video editors around.

LXFDVD highlights

Tails Live, Tiny Core, Netrunner (64-bit) and so much more.

LXFDVD highlights

Ubuntu 13.10, OpenBSD 5.4, HotPicks, code books and more.

Quote the issue code shown above and have your credit or debit card details ready

Get our digital edition! Subscribe today and get 2 FREE issues

Available on your device now

*Free Trial not available on Zinio.

Xxx Reviews

Turn on, log in and let our experts help make you a smarter Linux user Chris thornett Has been down the cobblers a lot this month updating all of his keys.

This month learn how to...

Broken forks

O

penSSL breaks once and the instant reaction by the OpenBSD group is to fork the project. Why? It’s certainly one of the key strengths of the FOSS world that anyone can take a Git repository and fork the project to create their own, but do people ever stop to think why? By forking OpenSSL the situation simply creates two separate groups, attempting to support two separate, probably broken libraries. The irony is OpenSSL is now a well-funded project exactly because of the Heartbleed flaw, as it highlighted just how important it is to the internet as a whole, while LibreSSL will remain a badly funded, forked project. Who actually wins by doing this? For a funny, constructive take on this see the talk by Bryan Lunduke at http://bit.ly/LXFsucks.

Virtually you With that being said when open collaboration works, it works fantastically well. It’s exciting to see OpenStack back in the LXF tutorial section and we look at a way anyone can experiment with the NASA driven OpenStack cloud computing system making use of DevStack to create their own virtual computing cloud. This is at a time when the world is moving towards running systems virtually and open source is at the heart of it all. So this is a fantastic way to get on board a brave new virtual world. [email protected].

The Terminal................ 66 3D printing..................... 68 Neil Bothwick continues his guide to the command line essentials with how to archive and compress your files with the Tar tool.

Create your own personalised case for your Raspberry Pi with FreeCAD, a 3D printer and a sprinkling of Python code.

Getting help....................72 Need help with something in Linux? The answers to your problems may be closer than you think, thanks to Linux’s man pages.

Code in tutorials Source code is presented in beige boxes. When lines of code are too long for our columns, the remaining text appears on the next line in a solid box:

procedure TfrmTextEditor. mniWordWrapClick

Build a virtual cloud...74 Jolyon Brown demonstrates how DevStack can be used to create a development OpenStack cloud in a single virtual machine.

Open Evernote............. 78 Marco Fioretti shows you how to use two open source tools to create your own Evernote-like system for collaborative work online.

Otherwise, there is a gap, like this:

begin mniWordWrap.Checked := false

Whether you’re a beginner or a guru, learn new skills in our programming section

In this issue... Python

MySQL

Everything you need to know to hack Minecraft Pi with some basic Python p82

Master the art of transferring spreadsheets to and from MySQL databases p88

www.tuxradar.com

July 2014 LXF185    65

Tutorial Terminal Move on from Zip and learn Xxxx Terminal

how to compress your files with Tar

Tar: Archiving your files Archiving contains many mysteries such as zips and tarballs, but expert   Neil Bothwick is here to expand your knowledge of their uses.

M

Our expert Neil Bothwick has a computer in every room, but won’t disclose the location of his central server for security reasons.

ost people reading this magazine are probably pretty familiar with creating, sending or receiving ZIP files. Zip takes a collection of files and stores them in a ZIP archive file, compressing the data in the process. As well as storing the contents of the files, it also stores all their metadata, which is extra information associated with an object. In the case of files, it includes the modification times, their owners and permissions and, of course, the name of each file. When you unzip an archive, all of this information is extracted, which recreates the original set of files exactly as they were. This is pretty handy! Archives have several uses, but the most popular include bundling up a set of files for download – a single file is easier to handle and the compression makes it faster to download – and creating backups. As Zip has been around for a long time, everyone can use it and all OSes can handle it. Nonetheless, Zip does have a number of drawbacks. The main issue is that its compression is poor by modern standards. Over the past 25 years compression technology has moved on and even though there have been improvements to Zip, there are some better alternatives available. Another disadvantage of Zip is that it is intended for archiving to a file, whereas sometimes we want to send the data to another device or service. The standard archival program for Unix-like operating systems is Tar, so called because Tar was originally used to

store backups on tape drives (Tape ARchive). It works in a different way to Zip because it sends all of the archived data to its standard output and it doesn’t compress the data by default. This is because many tape drives already had hardware compression built in. The lack of compression code may seem like a disadvantage, but it’s actually a convenience. As Tar is able to pipe its data via an external compression program, it can use any compressor it likes – even one that wasn’t in existence when the Tar program was developed. Compression programs work on one file or stream of data and produce one compressed file or stream, so this splits the job into two parts archival and compression. While this may seem more complex, Tar is perfectly capable of handling the details itself. Let’s say we have a directory that is called foo. We want to create an archive of it, which is often referred to as a tarball. We can we can do one of these options: tar cf foo.tar foo tar czf foo.tar.gz foo tar cjf foo.tar.bz2 foo tar cJf foo.tar.xz foo The c option tells theTar program that we are creating an archive, while f tells it that we are storing the archive in a file using the given name. Therefore, the first command creates an uncompressed archive that is called foo.tar. The subsequent commands add an extra option that tells Tar

Pipes and streams A core part of the philosophy of Unix-like operating systems is for tools to be specialised – each tool should do one job and do it well. That means we need a way to chain programs together to achieve more complex tasks, and this is done with pipes. Every terminal program has streams for standard input, standard output and standard error (usually referred to as stdin, stdout and stderr). Standard input is how the program accepts information and it defaults to the keyboard when running a command from a terminal. Standard output is the output from the command that defaults to printing to the terminal window. Standard error goes to the same place, but all of these can be changed. Consider the example of: tar c foo | sdc >foo.tar.sdc

66     LXF185 July 2014

The | character is the pipe and it connects the standard output of one program to the standard input of another. So Tar archives the contents of foo and sends it to stdout, which is then piped to the input of sdc. Most compressors default to working on a file: gzip somefile This compresses the file to somefile.gz. When no file is given, they compress standard input and send the result to standard output. The > character performs redirection and diverts standard output from the terminal to a file, so you have a compressed archive in foo.tar.sdc. Standard error is not redirected by >. If something goes wrong, error messages are printed to the terminal – if they were sent to the file, you wouldn’t know something was wrong.

www.linuxformat.com

Running Tar with the t (test) option not only checks that the archive is correct, but also shows you the full contents – usually enough for you to need to pipe it through a pager like Less.

Core skills Tutorial

Compression types There are two types of compression: lossless and lossy. Lossy compression achieves a greater reduction in file sizes by carefully discarding data that doesn’t greatly affect the results. JPEG and MP3 files use lossy compression. Archiving uses lossless compression and uncompresses the result to get you back exactly where you started. There are a number of lossless compression methods available, here are some of the most common. Deflate This is the default compression used by Zip; it is old and not particularly effective, but is fast and well supported. Compress This is an old Unix compression program. Its files have a .Z extension, but you are unlikely to see many in the wild. There are also patent issues with it.

Gzip This Compress replacement is completely open and still in use today. Gzip uses Deflate, but generally produces smaller archives than Zip with its default settings. It does not give the best compression, but it compresses and decompresses quickly, making it a good choice when size is not the most vital consideration. Bzip2 This is a more efficient compressor, but at the expense of speed. Compression in particular can be slower, but it produces more compact results. xz This more recent program uses the LZMA2 compression algorithm also used by 7-Zip. It is fast – particularly for decompression – and works brilliantly. It is the compressor of choice for many key Linux projects, including Coreutils and the kernel itself.

Here is the same archive using different compression programs. The Gzip version is significantly larger, but faster to compress and decompress.

which particular type of compression to use: z uses gzip compression, j uses bzip2 compression and J uses xz compression. (Watch the capitalisation!) There are also long versions of these arguments that make the commands more readable, but most of us are lazy and use the version that is shorter to type. However, we could also have used this command line if we wanted to: tar --create --gzip --file foo.tar.gz foo The file extension is not required, but it’s a convention that makes it easier for people to see exactly what type of archive it is – the system itself needs no such help as it can work all this out for itself. Unpacking an archive is simply a matter of replacing c with x, or --create with --extract. However, you don’t need to give the compression type, as Tar figures it out: tar xf foo.tar.gz Another option you may want to add is v or --verbose, to show you what Tar is doing. If you have been given a tarball, you may want to see what is inside it without unpacking it. If you have created an archive, particularly a backup, you may want to check it’s correct before relying on it. The test option checks the integrity and lists the contents of the archive.

tar tvf foo.tar.gz Those are the main Tar options, but the program has many more, such as A or --concatenate to add files to an existing archive instead of creating a new one.

Tar and the compressors have man pages, with many options. You’ll usually only need the ones covered here.

Most environments can view the archive contents. Shown above is the result of double-clicking a tarball in LXDE (the preferred desktop for Raspberry Pi).

Future proofing We mentioned that Tar can handle any new compression format that comes along because it passes compression to another program. There are command line options to do this automatically for gzip, bzip2 and xz, but what if someone comes up with a new compressor? Say something like sdc super-duper compressor? You could create an uncompressed tarball and then use sdc to compress it, but that’s wasteful and slow, instead use a pipe: tar c foo | sdc >foo.tar.sdc unsdc foo.tar.sdc | tar xv Here, we use only the --create option with Tar. The lack of a destination causes Tar to send the archive data to standard output, which is then piped to the sdc compressor program. The second command reverses the process, decompressing the archive and sending it toTar for extraction. LXF

If you missed last issue Call 0844 848 2852 or +44 1604 251045 www.tuxradar.com

July 2014 LXF185     67

Tutorial Xxxx 3D printing Make a case for your Pi and

custom etch your own design on its top

FreeCAD: make a custom Pi box Robin de Jongh shows you how to use Python and FreeCAD to create your own Raspberry Pi case and customise it with your text or logo.

Robin de Jongh has

worked as a design engineer for many years, but prefers teaching others and gives his own inventions away as open source.

FreeCAD for Python coding On opening FreeCAD you will see a welcome screen. Select the Part Design option. In order to get FreeCAD set up for Python code, go to View > Views and tick Python Console. Go to Edit > Preferences > General > Output window, and tick the two Redirect options right at the bottom, then click Apply and OK. Now go to View > Views and tick Report view. Let’s get started by importing the libraries that we will need. Type in the following into the Python console and be careful to get the capitalisation correct. import Part from FreeCAD import Vector Now we will be able to use the Part module to create common

1.8V Regulator

3.3V Regulator

hole 1

HDMI y=0 x=0 68     LXF185 July 2014

GPU/GPU ITAG Ethernet ITAG

CPU/GPU Broadcom BCM2835

hole 2

Camera SCI

Micro-USB Power

Status - LDE’s

2.8V Regulator

Display DSI

The board has two mounting points. We’ll set up the CAD model with x=0 and y=0 at the bottom left of the Pi board, so entering vector measurements is easy.

3.5 audio out

Compsite Video RCA

x=37 www.linuxformat.com

OK

y=56

FDX LNK 1OM

Our expert

Take your Raspberry Pi and check whether it’s a Model A or Model B. You can tell because the B has a double USB. In this tutorial we’ve assumed you have a Model B, but you can just as easily change some dimensions in your CAD file to make a case for a Model A. First, we need to measure some critical parts of the Pi. Look on the board for the mounting holes. There should be two holes (see the diagram at the bottom of the page).

PWR

I

f you’ve ever experienced opening the packaging on a brand new Apple or Blackberry, you’re going to be disappointed when your first Raspberry arrives, because the similarity ends at the fruit reference. The Pi arrives in a plain white cardboard box wrapped in an anti static envelope, with only a single printed sheet of regulatory information. The most noticeable thing about the Raspberry Pi is that it’s simply a circuit board, exactly like the motherboard in a PC, and it looks sort of naked. Place it on a table and it will scratch it. Sit on it and you’ll get pins stuck in your bottom. Leave it lying around and it’ll get stepped on, eaten by the dog or chewed by the baby. What the Pi needs is a Pi case, and that’s what we’re going to make in this tutorial. For this tutorial you’ll need to install FreeCAD on your Linux machine, and in order to print a copy of the case, you’ll either need your own 3D printer, have a mate with a 3D printer, or have a few pounds available to use an online 3D printing service like i.materialise.com or shapeways.com. To personalise your Pi case you’ll also need Inkscape installed but this step is optional. All the code and other files for this tutorial are on this month’s LXFDVD and at Github https://github.com/dejongh/raspberrypicase.

Ethernet Controller

Ethernet 2xUSB 2.0

Ethernet RJ45

3D printing Tutorial

Beautifying your models with fillets Let’s face it our CAD model looks quite hideous at this stage of development, but that’s to be expected. Happily there’s just one trick that we need to perform in order to get professional-looking objects – and it’s called the fillet function. Selecting any edge and hitting the Fillet button will give us instant beauty. Hold down Ctrl and select more than one edge, and we can get fillets that run right around the base and sides of the Pi case. Try doing this now.

You’ll need to use 2.5mm for the base and outer corners. Use 1.5mm for the internal corners. Once you’re done, the model will look instantly more polished and professional. Any of the fillets can be modified or removed, so don’t be scared to have a go. The radius of any fillet can be adjusted on the fly. Fillets will make a huge difference to the case’s visual appeal.

3D shapes such as boxes, cylinders and spheres, and we’ll use the Vector module to manipulate where things are. Take a look now at your Raspberry Pi: we need to imagine the corner by the power socket as being location zero in the x and y axes, and the underside of the circuit board as zero on the z axis. This will make it easy for us to enter vectors to correspond to the measurements we take of the Raspberry Pi board. Get yourself a ruler, or a Vernier Caliper, and measure from the bottom left corner of the board by the power socket. Measure and note down an x measurement and y measurement for each hole.

Making the main box shape Let’s start by making the basic box shape: boxshape=Part.makeBox(93,64,30,Vector(-4,-4,-8)) Here we’ve created a box, labelled boxshape, that’s 93mm long by 64mm wide by 30mm tall, and moved it so that the corner of the board will remain at 0, which enables us to enter any board measurements as vectors without doing any maths, which can hurt our heads. cutout=Part.makeBox(87,58,30,Vector(-1,-1,-5)) Here we’ve made another box labelled cutout, which is just 3mm smaller all round so we can cut it out of the other box like this: pibase=boxshape.cut(cutout) You’ll have noticed nothing happened, but that’s just because we need to tell FreeCAD to draw the result. Do this now by typing: Part.show(pibase) Right click in the main window and select Navigation styles > Blender. Now zoom out with the middle mouse button and hold it down to orbit the view. You can see the result pictured right. This is going to be the base of our Pi case, so we want it to be bigger than the circuit board itself by 4mm all round. We need space for the various plugs we want to slot into the sockets on the Raspberry Pi, so we’re going to cut out areas of this box to accommodate. It’s a simple matter of measuring from the zero corner of the Pi that we defined earlier and entering them as vectors. Let’s try it. leftsidecut=Part.makeBox(20,42,30,Vector(-10,2,-4))

pibase=pibase.cut(leftsidecut) This has now cut out a 42mm wide aperture to fit the power plug and SD card through. Let’s go ahead and do this for all four sides (your measurements may be different). hdmicut=Part.makeBox(18,20,30,Vector(35,-10,-2)) avcut=Part.makeBox(33,20,30,Vector(38,50,0)) usbcut=Part.makeBox(20,38,30,Vector(80,1,-2)) pibase=pibase.cut(hdmicut) pibase=pibase.cut(avcut) pibase=pibase.cut(usbcut) Now we’ll take a look at what we have by repeating the show command: Part.show(pibase) At this point we may need to hide some old geometry by going to the Project tab, select Shape, go to the View tab and change Visibility to False. We also need a lid on this box and we need somewhere for it to sit. Let’s subtract the shape of the lid from the walls of the PiBase: lidcut=Part.makeBox(90,61,10,Vector(-2.5,-2.5,19)) pibase=pibase.cut(lidcut) The final features we need for the box are raised bosses for the Pi board to sit on so we can screw it down. We can do this using the Part.makeCylinder command. Remember that

The FreeCAD interface can be set up to allow Python scripting within the console at the bottom. Set up easy mouse navigation by selecting the Blender navigation style.

Last issue in LXF184 Find Perfect your 3D Printing tutorial for more tips www.tuxradar.com

July 2014 LXF185      69

Tutorial 3D printing we set up the model with the origin at the underside of the board, so it should be easy to create a cylinder that finishes at z=0. Like makeBox, makeCylinder requires some values to define the size of the cylinder, which is in the form (radius,height). It’s also easy to find the centre of the holes because we can just measure from the edge of the board and use those vectors. boss1=Part.makeCylinder(3.5,7,Vector(25.5,18,-7)) Note that we entered the same figure for the height and for the z axis vector, but gave the z vector a minus. That should ensure the boss starts at the underside of the Raspberry Pi board. Repeat this for the second boss: boss2=Part.makeCylinder(3.5,7,Vector(80,43.5,-7)) Now we want to join the bosses to the base. Here we will use a fuse command which works just like the cut command: pibase=pibase.fuse(boss1) pibase=pibase.fuse(boss2) That’s the finished box, except that it doesn’t look that great. To give those sharp edges the heave-ho follow the instructions in the boxout on p70 (see Beautifying your Models with Fillets) and gain a more professional look! LXF

Fixing the Pi to the case We’ve created enlarged bosses for the Pi board to sit on but we haven’t put holes in them. Why? Home or consumergrade 3D printers don’t have good enough print resolution to take good care of holes, and besides that, we can’t be 100% sure that the holes will line up with the holes in the Pi board. So the best thing to do is to use a drill bit. Place the Pi inside the case and mark the centre of the holes with the end of a drill bit.

Drill a small hole and screw the Pi to the case so that it doesn’t move when plugs are inserted or removed. Now take the Pi out and pilot drill the holes with a bit that’s a little smaller than the screw. This way,

when you insert the screw and turn it, it will create its own thread in the plastic.

3D printing the Pi case

1

Importing the STL file

2

Your case and lid should be exported as .stl files so you can now import them one at a time and print them. Go to your print software and select the PiLid.stl file. Click Load model and you should see it appear in the main window.

3

Centering the object

4

Check that your text (see Customise your Case, p71) looks back to front now. Set the x and y translations to centre your object on the print bed. Enter print settings according to your printer’s recommendations. Hit Generate G-code to slice the model.

70     LXF185 July 2014

Orienting the print

To get a nice finish at the top of the lid, place the top on the print bed and use the heated print bed setting. This means first turning the print up-side down. Enter 180 in the x-rotation box and set the z translation to 3.

Starting the 3D printer

Ensure that you’re using the heated bed option to avoid warping and to give good adhesion to the plate. If you’re using a glass plate (recommended) you’ll get a great finish too. Once the lid is printed, repeat with the PiBase, which should be printed the normal way up.

www.linuxformat.com

3D printing Tutorial Customise your case

1

Creating text in Inkscape

2

Open up Inkscape and select the text button on the left toolbar. Click anywhere on the page. Now enter the text you want to appear on the lid of the case. I’m going to use a Pi symbol, so I will need to copy it from the character map utility which is preinstalled on Linux.

3

Importing SVG geometry into FreeCAD

Your SVG geometry will import as a grouped entity named path.... Select it now from the project list. It should go green to show it has been selected. Ensure you’re in the Part workbench (drop-down list at top centre) then select the Extrude a selected sketch button. Type in 10 for z: and select Create solid and hit Apply.

5

Cutting out the SVG letters

4

Creating the personalised lid

Click the yellow Create a box solid button, then modify the size as shown in the Height, Length and Width boxes. Select all four corner edges by holding down Ctrl and apply a fillet of 2mm (you will need to be in the Part design workbench). Now go back to the Project list and select the Extrude group.

6

Click on the Data tab and select Placement. Go to Position and change the z value to -1. Now tweak the y value until your letters are in position within the lid. Adjust the Angle value if you wish your text to slant. Tweak the x value to adjust the placing until you’re happy.

Exporting text from Inkscape

Press F1 then select the text. Go to Path > Object to path. Go to File > Save As and select Plain SVG (.svg) from the dropdown box. Save the file. In FreeCAD go to File > Import and select the file you just saved. Hit Open and then select SVG as Geometry.

Exporting to a 3D printer

Hold down Ctrl and select First Fillet then Extrude and click the Cut button. Select the lid from the project list and check everything turns green. Go to File > Export and select Mesh formats. Type in filename. stl. Repeat with your Pi case. You’re now ready to 3D print!

www.tuxradar.com

July 2014 LXF185      71

Tutorial Tutorial Man Xxxx help Learn to use and navigate Getting

manuals to find answers for yourself

Man pages: Accessing help Neil Bothwick browses the ultimate collection of useful self-help   books that resides inside the Linux operating system.

R

Our expert Neil Bothwick has a computer in every room, but won’t disclose the location of his central server for security reasons.

TFM has long been considered the battle cry of the supposed Linux experts, and is claimed to scare new users away. If you haven’t come across the term before, it stands for something like ‘Read The Fine Manual’. It is perhaps easy to appreciate the frustration some individuals feel when asked a question for the umpteenth time when the information is clearly covered in the manual. However, it’s only possible for a user to read a program’s documentation if they know where to find it. Happily, there are some sources of help within Linux, so let’s look at each of them. Before you even look for the manual, remember that many programs have built-in help. Run the command from a

This is the man page for ls, and it helpfully lists the various options that you can use in alphabetical order.

terminal with the --help option to see a synopsis of its options. This applies to GUI programs, as well as shell commands. For example: firefox --help If you need more detail, then it may be time to RTFM, which on Linux systems usually means the man page. Man pages document just about everything on your system and are viewed by keying in the man command. If you want to know how man itself works, the classic recursive example is to open a terminal and run: man man A man page is a single page containing the reference documentation for its topic. The man command renders this document as readable text and displays it in your default pager, usually less. This means you use the same keyboard controls as less for navigating the page: Cursor Keys to scroll up and down, the Space Bar to page down and so on. Some man pages can be very long, so try man bash to enable you to search. In less, press / to start searching (or ? if you want to search backwards) followed by your search term. Then use n to jump to the next match or N for the previous one. The man pages are divided into sections: 1 User commands 2 System calls 3 C library functions 4 Devices and special files 5 File formats and conventions 6 Games et al 7 Miscellany 8 System administration tools and daemons

Desktop viewing Man and info are intended to be readable in a terminal, since you may need to use them on a system without a desktop. There are GUI viewers for them, the most convenient being in KDE where you can press [Alt]+[F2] and type man:/ command or info:/command and get an HTML formatted version of the document displayed in Konqueror. There are also the tkInfo and tkMan programs

72     LXF185 July 2014

to display the respective formats in a GUI window. There are several websites containing comprehensive man page collections: such as http://linux.die.net, www.linuxmanpages.com and http://manpages.ubuntu.com. These are particularly useful if you want to read about something you do not have installed locally.

www.linuxformat.com

KDE users can read info and man pages in a browser, with clickable links, thanks to KDE’s KIO slaves.

Core skills Tutorial

As a normal user, you would normally only use sections 1, 5 and 8 (and possibly 6). If you use the section number with the man command, it will only look in that section, otherwise it will show the first match it finds. This is necessary because you can have more than one page with the same name. The passwd command is used to set user passwords, which are stored in the file /etc/passwd. Try: man passwd man 1 passwd man 5 passwd The first two document the passwd command from section 1, while the third shows the man page for the passwd file. This is one of the strengths of the man page system – it documents everything: commands, configuration files, library functions and more. It’s not limited to specific commands or files, and section 7 contains man pages for all sorts of things. Ever wondered how symbolic links work, or what happens when you turn on your computer? Try: man 7 symlink man 7 boot

Quick help There is more to man than a bunch of formatted text pages and a program to display them in a pager. Man maintains a searchable database of pages, which is updated automatically by Cron, and has some other programs for working with it. Each man page has a NAME section, which includes a short description of the page’s topic. The whatis command gives the description – it tells you what the program (or file) is, without going into details of options. Here is the classic geeky, recursive example: whatis whatis whatis (1) - search the whatis database for complete words This is a faster way to see what commands do, especially if you want to check more than one: whatis grep sed symlink The whatis command searches only the name, and only matches on whole words, so it assumes you know the name of the command and just want to know what it does. For a more wide-ranging search, use apropos, which does a similar job but searches the descriptions as well and returns all matches – compare these two commands: whatis png apropos png There is another form of documentation that’s favoured by the GNU project: info pages. While a man page is basically one very long text file with a bit of formatting markup, an info document contains a tree of linked pages in a single file. It’s more like HTML than plain text, but is designed for reading in a text console and all the ‘pages’ are contained in a single file.

Unsurprisingly, the command to read info pages is this: info info This time, the self-referencing is not gratuitous. Man pages are intuitive to navigate – it’s just like reading any other text in a pager. Info uses a different set of key commands, so reading its own info page is a good place to start. You move around individual pages as you would normally, but if you press Enter when the cursor is on a link (noted by an asterisk), you descend into that node. To go back up to the parent node, press u. You can also navigate within a level of the documentation tree with n and p, which take you to the next and previous nodes. If you have ever looked at any GNU documentation online (http://bit.ly/grubmanual) you will recognise this layout. It’s simpler than HTML, with the navigation commands generally moving around the same level of the tree or up and down one level. You may be asking yourself what the point of this structure is. Well, if you’ve ever tried to find information in a long man page, like man bash or man mplayer, you’ll know how frustrating and time-consuming the ‘everything on one page’ approach can be. Info documents are divided into sections and chapters, enabling clearer and more succinct presentation. The majority of GNU programs have fairly brief man pages, but have more detail in their info pages. Splitting the document up into pages alters the way that searching is carried out. Press s followed by a search string and then Enter. Info will jump to the next occurrence of the string, even if it’s in a different node. Continue to press s then Enter, with no search string, to jump to subsequent occurrences of the same string. Those keys, plus q to quit, should enable you to navigate info pages with ease. You might be wondering why we’re not using HTML. The main reasons are that info predates HTML, and that info documents are contained within a single file. Conceptually, they are similar – so much so that info2html (http://info2html.sourceforge.net) can be used to convert an info document to a series of HTML pages. LXF

The ls info page goes into more detail and groups options according to their function. Info pages generally provide more detail than man pages.

Printing manuals There may be times you want hard copy. As man pages are stored in a markup format and converted for display by the man program, you can use the -t option to convert them to a printable format, Postscript by default, like this:

man -t somecommand | lpr The Postscript is output to stdout, piping it to lpr like this sends it straight to the printer. You could also convert the Postscript to PDF, and therefore create versions of your man pages suitable for

carrying around on a tablet or e-reader: man -t somecommand | ps2pdf somecommand.pdf Print info documents by passing them through the col command: info somecommand | col -b | lpr

If you missed last issue Call 0844 848 2852 or +44 1604 251045 www.tuxradar.com

July 2014 LXF185     73

Tutorial Xxxx OpenStack Create a local cloud in a

single virtual machine with DevStack

DevStack: Build a virtual cloud Jolyon Brown demonstrates how DevStack – an ‘opinionated script’ – can be used to create a development OpenStack cloud in a single VM packages bundled with most of the major Linux distributions (take a look at www.openstack.org/software/start for a wider list of ways to get started). There’s a lot of merit in heading to http://docs.openstack.org and attempting one of the distribution specific installation guides. In this article, however, we’re going to look at an alternative: DevStack.

Our expert

Introducing DevStack

Jolyon Brown

Spends his spare evenings automating infrastructure builds, mainly so his children can create their own Minecraft servers without pestering him to do it.

L

Quick tip At this point it’s a good idea to take a snapshot of your new virtual machine. Using the VirtualBox Manager, click Snapshots on the top right and then on the Take Snapshot icon (the little blue camera). This saves having to do a full reinstall if things go awry.

74     LXF185 July 2014

ast time we covered OpenStack in any serious depth was back in LXF161 (What on Earth is OpenStack, p62). Since then, the project has matured and expanded greatly, maintaining its six-month major release cycle (the ninth release, code named Icehouse, landed in midApril 2014) and seeing adoption by major vendors, including IBM and Red Hat. Indeed, the OpenStack community has grown at a rapid rate, aided by an independent foundation with nearly 16,000 registered members. This rise in OpenStack awareness and popularity has run alongside the accelerating growth of cloud computing – in all its various guises – as a platform for businesses and corporations. Previously these companies might only have had the options to own or host physical servers in a data centre. There’s plenty to play for in this market and OpenStack, with its branding as “the open source cloud operating system” seems to be gaining momentum. On the face of it, it would seem well worth any Linux aficionado getting to grips with OpenStack – but where to begin? There’s a bewildering array of options for the would-be stacker: public clouds from the likes of Rackspace and HP, productised versions such as Piston OpenStack, and

www.linuxformat.com

DevStack bills itself as an ‘opinionated script’ (it’s literally a shell script) and is a great option for getting an OpenStack cloud up and running in a local environment relatively quickly. Here we are going to use VirtualBox to run it inside a VM, but a standalone machine would be an even better option (and will certainly run faster). The instructions here will be applicable in either case. A note of caution: don’t be tempted to simply run the installation script on your desktop distro – DevStack automatically downloads and configures a whole bunch of software. Not only will it probably not work without a lot of tinkering, it will also take an age to tidy everything back up. It’s also worth pointing out that DevStack definitely isn’t suitable to run in a ‘production’ environment (so you won’t be able to build an Amazon Cloud competitor with it, for example). As the http://devstack.org website FAQ explains: “DevStack makes some implementation choices that are not appropriate for production deployments. We warned you!” Not least among these choices are the security settings, with passwords stored in files and very open sudo configuration for the DevStack installation user. For the sake of this article, we will assume that the installation will take place on a typical home network (well, perhaps not typical for a Linux Format reader!) with an internet router/ADSL modem acting as both the default gateway, DNS forwarder and DHCP server for the rest of the devices on it. In these examples, that device has an IP address of 192.168.0.1 and the network has a subnet mask of 255.255.255.0 (ie a /24 network). We are going to have VMs we create in our development cloud reachable from the Linux host on which we run VirtualBox, but nowhere else. It’s best to use a minimal distribution image as the starting point for a DevStack installation. In this article, we’ll use the Ubuntu 12.04 LTS ISO available both on your LXFDVD (http://bit.ly/1eQePdF), which weighs in at a mere 30MB or so (Fedora and CentOS/RHEL are alternative options here). Be sure to use the correct image for your chipset (32or 64-bit – we use the latter here). Start VirtualBox and from the overall menu select Preferences > Network. Create two

DevStack Tutorial host-only networks: vboxnet0 (with an IP address 172.16.0.254 and a netmask of 255.255.0.0) and vboxnet1 (10.0.0.1/255.0.0.0). Now create a new VM. It can be allocated a minimum of 2GB of RAM (the more the better). Unfortunately, while writing this tutorial we encountered a bug with QEMU, which required disabling the Enable I/O APIC option. Disabling this seems to restrict VirtualBox to use only one processor for the guest. Your mileage may vary!

Create a new host The VM system disk has been set to 25GB in this tutorial. For a 64-bit VM, we also check the Enable PAE/NX option. For the network settings of the VM, enable Adaptor 1 as a Bridged Adaptor with the name eth0. Adaptor 2 should be enabled as the Host-only Adaptor vboxnet0. Likewise Adaptor 3, but for vboxnet1. The rest of the settings can be left as defaults. Add the mini.iso image, which contains the Ubuntu image to the virtual DVD drive and start the VM. (See Fig 1 for the settings used in this article.) A text installation will begin. Most of the options are self explanatory and familiar to anyone who has been through a Linux installation in the past (which probably covers most of this magazine’s readership). Give the host the name devstack and enable the installer to use the whole disk for simplicity’s sake. At the point when the process gives an option for a user to be created, add one called ‘stack’ and give it any password you prefer. When the install gives options for which software packages to choose, simply go with the base Ubuntu and OpenSSH options (note the OpenStack option available – but don’t select it). After some time the installation will complete, the VM will reboot (don’t forget to remove the DVD from the virtual drive when prompted by the installer) and you will be presented with a login prompt. Use the stack user’s credentials to get into the system. At this point it’s a good idea to run a quick package update (hopefully there shouldn’t be too many to do): sudo apt-get update && sudo apt-get upgrade Next, we need to add the Git package (and any dependencies), which will be used extensively during the DevStack installation: sudo apt-get install git -y

It’s a really good idea to have this host use a static ip address. Edit the file /etc/network/interfaces: sudo vi /etc/network/interfaces Amend the eth0 stanza as follows (here we’ve used 192.168.0.100, amend as necessary for your environment): auto eth0 iface eth0 inet static address 192.168.0.100 #your IP netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1 #your router/gateway IP dns-nameservers 192.168.0.1 We also need to add the following lines to the same file: # OpenStack Public Interface auto eth1 iface eth1 inet static address 172.16.0.1 #the virtual DevStack created IP netmask 255.255.0.0 broadcast 172.16.255.255 network 172.16.255.255

Fig 1 With a little configuration, VirtualBox can run our development OpenStack cloud.

# OpenStack Private Interface auto eth2 iface eth2 inet manual

What is OpenStack? Originally a developed as a collaboration between Rackspace and NASA, and quickly joined by others, OpenStack was launched in 2010 to let anyone run cloud-computing services on commodity hardware. Since its independent controlling foundation was formed in 2012, it has been described as “a cloud operating system that can control large pools of compute, storage, and networking resources throughout a data centre, all managed through a dashboard that gives administrators control while empowering their users to provision resources through a web interface”. This operating system is made up of multiple components, delivered by various programmes under the OpenStack umbrella. OpenStack Compute (code name Nova)

enables provisioning and management of VMs. OpenStack Networking (code name Neutron) a pluggable, api-driven system for managing networks and IP addresses. OpenStack Object Storage (code name Swift) an object storage service. OpenStack Block Storage (code name Cinder) a block storage service. OpenStack Identity (code name Keystone) a common authentication system for an OpenStack cloud. OpenStack Image Service (code name Glance) discovery, registration and delivery services for disk and server images. OpenStack Dashboard (code name Horizon)

a graphical interface to access, provision and automate resources. OpenStack Telemetry (code name Ceilometer) handles central collection of metering and monitoring data. OpenStack Orchestration (code name Heat) enables template-based orchestration. Further projects are in various stages of acceptance as official OpenStack programmes: a database service (Trove), a bare metal provisioning service (Ironic), a queue service (Marconi) and a data processing service (Sahara). Sahara’s goal is easy provisioning of Hadoop clusters on top of OpenStack. All of this software is available under the Apache 2.0 license (and runs on Linux, of course).

If you missed last issue Call 0844 848 2852 or +44 1604 251045 www.tuxradar.com

July 2014 LXF185      75

Tutorial DevStack

Fig 2 At last! The mythical OpenStack dashboard login screen appears.

up ifconfig eth2 up Once the edits are complete, restart the eth0 interface and confirm that the changes look OK via ifconfig: sudo ifdown eth0 && sudo ifup eth0 ifconfig eth0 You should see the interface is now using the address you configured. Now bring eth1 and eth2 up: ifup eth1 ifup eth2 Finally we need to give the stack user the rights to issue sudo commands without a password. This would usually be an extremely bad idea, but is necessary here to allow the installation to take place: sudo -i echo “stack ALL=(ALL) NOPASSWD: ALL” >> /etc/sudoers exit

Installing DevStack

Quick tip DevStack can be stopped via the unstack.sh script located in the same directory as stack. sh we ran to install the OpenStack cloud. Rerunning stack.sh rebuilds from scratch. Use rejoin-stack.sh to start using your existing data.

76     LXF185 July 2014

DevStack as a project receives frequent updates (as do all other OpenStack related projects, especially around the time of a major release). Luckily for us, its quite easy to specify that we want to use a particular version of DevStack by targeting the particular branch for it with our git clone command (at the time of writing, the Havana release is the most stable version available): git clone https://github.com/openstack-dev/devstack.git -b stable/havana devstack/ cd devstack With a copy of the DevStack scripts downloaded, we now need to create a localrc file in order to configure which OpenStack services we want to use. As this is a fairly simple guide, we will use Nova, Cinder, Glance, Horizon and Keystone (see What is OpenStack on p75 for a definition of what these services provide). In order to avoid anything too complicated for the time being, we will defer to using Nova’s built-in networking component over the much more powerful Neutron. A template version of localrc is available for us to modify in the samples sub directory: cp samples/localrc . vi localrc Under the Minimal Contents section, change/add the following values: ADMIN_PASSWORD=devstack MYSQL_PASSWORD=devstack RABBIT_PASSWORD=devstack SERVICE_PASSWORD=devstack SERVICE_TOKEN=token This stops the installation script from prompting for them as it runs. Note that the password values are all the same.

www.linuxformat.com

This is just for ease of use and in any other environment would be a terrible idea. Below this section (it doesn’t really matter where) add the following lines to specify our services: # Branches NOVA_BRANCH=stable/havana CINDER_BRANCH=stable/havana GLANCE_BRANCH=stable/havana HORIZON_BRANCH=stable/havana KEYSTONE_BRANCH=stable/havana Finally, add the following lines. FLOATING_RANGE here should be a range not used on the local network. This configures a /24 set of addresses to act as floating IPs for the OpenStack virtual instances that will be created. FLAT_ INTERFACE is set to the Ethernet interface that connects our host to the local network. The FIXED parameters refer to the OpenStack private internal VLAN. FLOATING_RANGE=172.16.1.0/24 FLAT_INTERFACE=eth0 LOGFILE=/home/stack/stack.log FIXED_RANGE=10.11.12.0/24 FIXED_NETWORK_SIZE=256 Save the file and return to the command prompt. Now we can run the installation script by simply running: ./stack.sh The script takes quite a while to complete – so time for a pot of tea – and you will see a lot of output to the screen as various packages are installed and code is checked out. Once you have a brew, take a look at http://devstack.org/stack. sh.html to get some idea of what the script is doing. Eventually you will be rewarded with a message similar to ‘stack.sh completed in X seconds’ (2,135 seconds in my case). This is definitely a good time to take another snapshot of your VirtualBox VM (see Quick tip p74).

Taking DevStack for a spin From a browser elsewhere on your network, you should now be able to connect to http://192.168.0.100 (and be presented with a screen (as shown in Fig 2). DevStack gives us two user accounts: admin and demo. Both will have the password devstack thanks to our earlier configuration choices. Log in as the admin user and navigate to the Images tab on the left-hand side of the screen. You should see three Cirros images listed here. Cirros is a small Linux distro designed to act as a test image for cloud services, which makes it perfect for our demo here. Should you wish, you can add another type of image. Ubuntu has cloud images

Fig 3 Cirros is the go to image for testing OpenStack booting and basic functionality.

DevStack Tutorial available at http://cloud-images.ubuntu.com, which are useful to try. Use the URL of the image file when choosing create image from the menu. The image can be marked as public, and the settings for disk and memory can be left blank. The format should be set to QCOW2. The image will show its status as Queued, and will change to Saving as it downloads from the internet and is processed by the Glance service. After a short period (the exact duration of which will depend on your bandwidth), it will be listed as Active. Log out of the interface and log back in as the demo user. Ensure that the current project is set to demo, amending the setting via the drop-down menu if necessary. Navigating to the Instances tab, click on the Launch Instance button. Enter the information (as shown in Fig 3), using the drop-down menus where appropriate, to launch a Cirros instance. Note the Flavour drop-down menu in particular and take a moment to flick through some of the options. With our setup, m1.tiny seems a sensible option here, but in a true production cloud running on real hardware, the small, medium, large and xlarge flavours would potentially be more useful. Flavours can be added and defined to suit an environment in a similar way to creating new images. On the right you will see a reference to Root and Ephemeral disks. The Root disk is the operating system disk, as you would imagine. Ephemeral disks are extra disks that can be added to a virtual machine but which disappear when it is terminated.

Allowing access On the Access & Security tab it’s possible to set an ssh keypair, which can be injected into a booting VM. We can skip this for this demo. The Post-Creation tab allows for commands to be listed to be run after the VM is created; these could be to add specific packages or agents should this be required. Click on the Launch button here and our new instance will begin to build. Depending on how powerful your hardware is, this will take up to a few minutes. You will see that our new lxf instance is shown as running the Ubuntu Precise image and has been given an IP address of 10.11.12.2. This is taken from the internal VLAN we configured earlier. In order to make VM accessible from our Linux host, we need to associate it with a floating IP. Under the Actions heading on the right-hand side, click the dropdown menu and select Associate Floating IP. After a little while a new IP address will be listed alongside the original; it will likely be 172.16.1.1. Now select the Access and Security tab from the left-hand menu. This will bring up a list of Security Groups with default being the only one listed. Select the Edit Rules action from the right hand side and then Add Rule from the screen that appears. This will bring up a dialog box of that title. From the

drop-down Rule menu select ALL ICMP, leave the other boxes as the default and then click Add. This will allow us to ping hosts from outside our cloud. Add another rule, this time choosing SSH. (See Fig 4 for a screen shot.) These rules are applied instantly, so go back to our Linux host and open a terminal. Ping 172.16.1.1 should succeed, and so we can now try and ssh into our cloud instance. ssh [email protected] The default password for the Cirros image is cubswin. Congratulations! You now have you very own local cloud instance up and running. From here we can take a look at Volumes, turning back to the OpenStack web interface and choosing that option from the menu (assuming we are still logged in as demo). Click Create Volume and give it a name (avoid using spaces). We can choose a size and select no source, simply using an empty volume. Click Create to have OpenStack carve out a chunk of storage for you via Cinder. Now we can attach it to our lxf instance: simply choose Edit Attachments from the right hand side menu, select our instance from the drop-down menu and click Attach Volume after allocating a device name. Interestingly though when testing we found that the instance merely used the next device name it expected (/dev/vdb) rather than suggested /dev/vdc given via the interface. A small bug perhaps. This device is then available to be formatted and mounted as any regular physical disk would be. That wraps up our whirlwind tour of some of the basic functionality offered by OpenStack when built via the DevStack method, but there is a great deal more available that we haven’t touched on so far. OpenStack is a fast-moving project with many configuration options. Next time, we’ll be taking a look at some advanced features in a more production-like environment. LXF

Fig 4 Define security rules to ping hosts from outside your cloud.

How can I get involved in OpenStack? Good question! The OpenStack community is very welcoming – a great deal of effort has been made to provide potential contributors with everything they need to get started (and of course the project is open source). The official wiki (https://wiki.openstack.org/wiki/ HowToContribute) is a good jumping in point for suggesting various parts of the project that need help and the particular methods for doing so. There is a contributor’s agreement to sign before anything submitted can be accepted, but

the turnaround is typically very quick. It’s worth noting that contributors to a major release have previously been offered free tickets to the OpenStack summit (but not free airfare, unfortunately). OpenStack is slightly unusual in that not only is the code held under the usual open source/publicly available version control repositories, but project documentation and even the testing infrastructure use the same method to accept amendments and updates. Further to that, the whole design process is done

www.tuxradar.com

in public – every six months the community holds a design summit to gather requirements and write the specifications for the next release. These summits are entirely open – anyone can attend – and produce the roadmap for the following six-month period. Similarly, elections for leads for each project are held in the open. The OpenStack Foundation likes to say that technical governance of the project is a community meritocracy, and it’s hard to argue that this isn’t the case.

July 2014 LXF185      77

Tutorial NixNotecollaboration Xxxx and Etherpad Online Setup NixNote or

Etherpad for collaborative work online

Notes: store and collaborate Marco Fioretti shows you how to use two open source tools to create   your own Evernote-like system for collaborative work online. them and in real terms that translates into a web platform optimised to quickly take, catalogue and tag notes of all sorts. You can share these notes with other users from the browserbased service and the dedicated desktop client (although that’s via Wine as it doesn’t support Linux natively). We’ve previously covered how to have a much more private, self-hosted alternative to Google services with OwnCloud (Tutorials, p68 LXF180 and Tutorials, p90 LXF169). This time we’ll show you two things: how to use your Evernote account from Linux without a browser and when, why and how you can replace Evernote (and Google Docs too – as long as simple text docs are all you need to co-edit online) with free software running on your own server.

Our expert Marco Fioretti

likes free software. He studies and teaches on the impact on society of open digital technology.

NixNote

T

he internet can do wonders to help us all keep our tasks and notes under control and to aid teams working together if, of course, we use the right free (as in freedom) tools for the job. Two very popular services in this space are Google Docs and Evernote. The first provides (among other things) online storage, calendaring and a simple web-based office suite for collaborative work. Evernote says it wants to help you ‘organise your life’, which is nice of

NixNote 2 may still be alpha, but it already works with Evernote and has all the basic features.

78     LXF185 July 2014

www.linuxformat.com

Evernote can be used by any modern web browser, but many people prefer native clients that are more integrated with the rest of their computers, tablets and smartphones. Unfortunately, there is no official Evernote client for Linux. Practically speaking, the only open source alternative around at the moment is the third-party application called NixNote (formerly Nevernote, http://nevernote.sourceforge.net). At the time of writing, NixNote is available in two versions: 1.6 and 2.0 alpha. The two versions can be installed and used on the same computer (not simultaneously, of course) because they put their binaries, databases and configuration settings in different folders. However, for reasons explained in a moment, most Linux users may have only one option. NixNote 1.6 is available in RPM and Deb formats, as well as in generic Tar archives for 32- or 64-bit distributions. In the latter case, once you have unpacked the archive, you must run the included script called install.sh as root. This will place a Nixnote shell wrapper in usr/share/nixnote/nixnote.sh. Next… well, you’re stuck. Theoretically, NixNote 1.6 should be easier to configure and run, not to mention less risky to use, than its new alpha. However, unless you are running a relatively old Linux distro (which is bad in so many ways) you won’t be able to synchronise your notes, as you can’t log into the www.evernote.com with that version of NixNote. The program will complain that ‘SSL support not found’ and quit. The reason is that current distros use at least version 1.0.0 of the libssl.so and libcrypto.so shared libraries. NixNote 1.6 only works with version 0.9.8 of the same libraries and since development has moved to ver 2 it’s going to stay that way. The workaround proposed on the user forum is to install older versions of the libraries side by side with the current ones, which, of course, you would need to keep for all your

Etherpad & NixNote Tutorial What are Node and npm anyway? Node.js (http://nodejs.org) is a JavaScript platform designed for fast, highly scalable applications, which must run on distributed devices (such as internet servers and PCs), serving a lot of users in parallel. In such a scenario the raw computing power of the involved CPUs counts less than the ability of the software to handle many simultaneous,

but also entirely independent bi-directional, asynchronous flows of data. Node.js manages to cope with this quite well, by handling all data input and output with a non-blocking, event driven system. Many Node.js applications are not built from scratch, but assemble reusable blobs of code that are called Node Packaged Modules.

other applications. From a technical point of view, this is doable. In practice, it’s complicated, and unless you know what you are doing we just don’t feel like recommending it. If you really need an Evernote desktop client for Linux, you’d better try NixNote 2 alpha (picture bottom p78). As far as we can tell, the alpha is already good for basic operations and more, as long as you make continuous backups of all your data (which will be in the $HOME/.nixnote folder) and follow a few tips. First of all, being an alpha version NixNote 2 comes with uploads disabled by default. To enable them, uncheck the box called Disable Uploads to Server in the Edit/Preferences Debugging panel. To make Nixnote 2 start you may still have to do some manual work at the command line, even if it is much less complicated than NixNote 1.6. The issue here is that NixNote 2 alpha is distributed as one executable file, which is dynamically linked to certain libraries. Don’t worry, ‘dynamically linked’ just means that instead of including whole copies of certain libraries it needs, the file only contains the name of the places where it can find them. Therefore, if your Linux distro does have those files, but with slightly different names and/or in different folders, the NixNote 2 executable will complain and quit. The solution is to find those libraries and create symbolic links to them in the folders, with the right names. On Fedora, for example, it’s necessary to create these three links as root: #> ln -sf /usr/lib64/libssl.so.1.0.0k /usr/lib64/libssl.so.1.0.0 #> ln -sf /usr/lib64/libcrypto.so.1.0.0k /usr/lib64/libcrypto. so.1.0.0 #> ln -sf /usr/lib64/libpoppler-qt4.so.3.7.0 /usr/lib64/ libpoppler-qt4.so.4 Once it finds all the libraries in the expected places, NixNote opens a window where you must login to www.evernote.com and authorise the application (by default it’s for one year) to retrieve or edit your existing notes, create new ones and tag or organise them inside notebooks. The interface is nice and easy and very promising, even if not all functions are currently working. For instance, encryption of notes, as well as (optional) automatic synchronisation with www.evernote.com at startup and shutdown don’t work yet. Besides the basic formatting tools, the Nixnote 2 editor also has support for checklists and tables. It’s possible to display PDFs inline and set the time and date formats. You can give your notes both URLs that are easy to remember and a location: just click twice on the arrow to the right of the Notebook menu and then on Click to Set Location to enter whatever coordinates you want. The NixNote way to handle notes, tags and above all shared notebooks is slightly different from those of other

The main, official repository for these modules is http://npmjs.org. The Node Package Module, whose executable is called npm, searches for packages in the online repositories and installs the modules and their dependencies pretty much in the same way as yum, apt and their various graphical front-ends do for normal Linux packages.

The installation is (relatively) complicated, but once it’s over, online collaborative editing is quick and easy.

Evernote clients. This is due in part to the fact that it’s an unofficial, volunteer development with less resources and in part deliberately different design choices. For example, in NixNote personal and shared notebooks appear in one single list. Tags linked to a shared notebook look the same as any other tag, but are only usable in that notebook. You can’t assign any of your tags to a note in a shared notebook. Additionally, you can only move notes from shared to non-shared notebooks if they are new – that is notebooks that have never been synchronised before to www.evernote.com. The final thing you need to know about NixNote it that it can handle different, independent accounts, but cannot do this simultaneously. You will need to work on different accounts in parallel, and you will have to launch the program twice from the command line, passing the name of the account to use each time: nixnote --accountId= & nixnote --accountId= &

Quick tip NixNote handles shared notebooks and tags differently from other Evernote clients. Check the online documentation to avoid surprises.

Etherpad As nice as NixNote is, it’s still an Evernote client. As such, it can’t solve two big problems that are critical for many users. The most obvious is privacy and data ownership: it’s not really sensible to host confidential notes on somebody else’s server, if you have the opportunity to do it on your own server. Another obvious limitation of both Evernote and Google Docs is that they only work where broadband internet access is available. What about rural schools, NGOs and similar organisations whose users only need to share notes among themselves in their local network, because that’s the only connectivity they need or can have? Etherpad (which is sometimes called Etherpad-lite – http://etherpad.org) is a good free software solution for all

If you missed last issue Call 0844 848 2852 or +44 1604 251045 www.tuxradar.com

July 2014 LXF185     79

Tutorial Etherpad & NixNote

Quick tip How do you handle group editing when you want to keep your notes private, or there is no broadband? With Etherpad, of course!

The Plugins sections of the Etherpad Web administration interface: pretty bare, but functional.

these scenarios. The quickest, if a little unfair, way to define this program is as a stripped-down mix of Evernote and Google Docs. A more rigorous description, however, is as a web-based editor designed for real-time, collaborative editing. This means that you and your collaborators can write different paragraphs of the same document simultaneously, with everybody seeing in their browser what all the others are typing in different colours. An embedded chat client enables co-editors to discuss what they are doing. When needed, one click on the Playback button shows the whole sequence of edits made until that moment to the current note. The interface for each user is automatically set to the default language of the person’s browser. The easy way to have your own private Etherpad is to install the Etherpad appliance (www.turnkeylinux.org/ etherpad) on a virtual server. This is a turnkey image of a barebones Linux distro, already loaded and configured with the latest version of Etherpad and everything it needs to work from the very first minute, including a MySQL server with the right user and database and Postfix mail server to send email notifications. The only major downside of this appliance is that it requires its own, dedicated (physical or virtual) box, with nothing else running inside it. Installing Etherpad on your own server, while still doable without being a professional webmaster or system administrator, has more stringent requirements and is more complicated than setting up WordPress, Drupal or even Owncloud. The first reason is memory (see Memory Issues, below) and the other software architecture. All those other programs are LAMP applications. That’s sets of dynamic web pages written in the PHP language, which store their data in a MySQL database and are executed by a general-purpose web server (normally Apache on Linux, which accounts for the ‘A’ in LAMP). To install and run, you only need access to some web space and a MySQL database. Etherpad, instead, is an independent web server written almost entirely in JavaScript using the Node.js/ npm platform (see What are Node.js and npm anyway? p79). That’s the reason why there are no official binary packages, or packages for most Linux distros. In all cases, you need access to the terminal as root to install Etherpad on a Linux server. For all these reasons, the exact

details and sequence of commands vary from distro to distro. System-specific guides for some distros are available (see Documentation, p81), but are not always up to date. Therefore, we’re offering a synthetic description of the main steps and the most likely issues you’ll have to face. This should help you understand more quickly the official, and very basic documentation, giving you an idea in advance of where to look if something goes wrong.

Preparing the environment Unless they already are on your server, you must install (using your package manager and the repositories of your distribution) at least these packages: git, curl, OpenSSL development libraries, the GCC compiler, the Make utility, Node.js and npm (you may have to authorise an additional repository for the last two, for instance, you’ll need to add ppa:chris-lea/node.js to get the latest version of Node.js for Ubuntu). This is necessary because the way to get the current version of Etherpad is to download its raw sources with the Git version control system and then compile and/or configure parts of them with GCC and Make. You must also create a MySQL database and user reserved for Etherpad, as well as a Linux user, whose only purpose will be to install and run the software with this or equivalent comments. In the example commands below this user’s name is etherpad, but it could be anything. Another mandatory task, since Etherpad does not use a standard web server but must have its own dedicated TCP port, is to open a port in your firewall. On the CentOS/Red Hat system used in this tutorial, this is accomplished by adding this rule to the /etc/sysconfig/iptables file: -A INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT All the preparatory work described so far must be done as root. To perform the actual installation you should switch to the new user identity and download Etherpad with Git: #> su - etherpad #> cd /home/etherpad #> git clone git://github.com/ether/etherpad-lite.git At this point, it’s finally possible to prepare the configuration file and run the initial set up script. To perform the first step, go to the etherpad-lite directory created by Git, copy the file settings.json.template to settings.json and open the latter with a text editor. As a minimum, you will have to set the MySQL parameters, and change the title, TCP port and sessionKey string to appropriate values: “title”: “Etherpad for Linux Format”, ... “port” : 8000, ...

Memory issues Etherpad is memory intensive, compared to other Content Management Systems. If you run it on a virtual private server (VPS) make sure it has at least 256MB available. This is very important as you may not even be able to start Etherpad right after installing it. The main reason for this is that Etherpad relies on npm to discover and install updates

and optional modules. But in order to do this, the copy of npm packaged with Etherpad must create a local index. Building this index from scratch is probably the heaviest task that an Etherpad installation will have to handle for small groups using the system. You will find that the administration page of Etherpad may freeze and on the

command line or in logs you’ll get errors like: ./bin/run.sh: line 38: 16471 Killed node $SCRIPTPATH/node_modules/ep_etherpad-lite/ node/server.js $* It’s almost certainly means that npm crashed, or was killed, because of lack of memory. The only real solution is to increase the memory available to your server.

Never miss another issue Subscribe to the #source for Linux on page 30. 80     LXF185 July 2014

www.linuxformat.com

Etherpad & NixNote Tutorial “sessionKey” : “LXF-a-great-magazine” If you want to use the administration web interface described later, you should also set an admin user at the beginning of the “users” section: “users”: { “marco”: { “password”: “lxf”, “is_admin”: true }, From the etherpad-lite directory, and still as the etherpad user, run these commands: #> ./bin/installDeps.sh #> ./bin/run.sh The first script checks that all the dependencies are in place while the second launches the server. If everything goes well, when you run it your very own Etherpad server will be available in your browser at the address http://yourwebsite. com:8000. Unlike Evernote, Etherpad doesn’t have a graphical desktop client ready for use by the average user. There are command line applications, such as Ethersync (https://github.com/payload/ethersync) and Etherpad streams (https://www.npmjs.org/package/etherpadstream) which make it possible to edit notes from the command line, or upload to Etherpad the output of some script, but they’re not going to appeal to everybody. The basic Etherpad web interface, however, is simple enough that once it is up and running almost all users can quickly find their way around it. The most important feature to note is the button with the angle brackets: click on it, and you’ll get HTML code that you can copy and paste in any other web page, to let everybody see and edit your pad from there.

Keeping Etherpad up and running Just like the installation, Etherpad upgrades work differently than those you may be used to with other Content Management Systems (CMSes). To check if new versions are available and download them you must run this git command: #> git pull origin When you do it, the next execution of run.sh will perform the actual update. As far as automatic (re)start at every boot is concerned, Etherpad works more or less as other Linux/ Unix services: you must download, tweak as needed and enable the shell script for your distribution, following the instructions at the Github wiki http://bit.ly/1sZpBYo. You want to run multiple, independent Etherpads on the same server with the same installation you can, and here is how to do that: Decide on a different TCP port for each instance, and configure the firewall on your web server to accept the corresponding connections. Create a different settings.json file for each instance. In the init scrips and in all other places where you may need them, replace calls to run.sh with one call per Etherpad, each with its own settings file: run.sh -s work_etherpad_settings.json run.sh -s family_etherpad_settings.json Due to its architecture, Etherpad has two characteristics that may be create problems in some cases. One is its default URLs, whose attached port numbers may confuse unexperienced users especially when there’s more than one Etherpad on the same server. The other is site-level access control: using the right plugins you may force your user to enter a password to read and/or edit some notes, but by default an Etherpad site is public.

Documentation There is plenty of NixNote documentation available as Evernote documents at www.evernote.com/ pub/baumgarr/nevernote. There’s an FAQ, installation instructions, a detailed user manual and developers documentation. For Etherpad, beside the documentation on the website, we’d

recommend reading the tutorial at Digital Ocean (http://bit.ly/1p2yO2u) for CentOS, and the one at the Etherpad Lite wiki for Ubuntu (http://bit. ly/1m0M8jt) and Debian derivatives in general). They both provide all the necessary distribution-specific details that couldn’t be included here.

Both issues can be solved by ‘hiding’ Etherpad behind an Apache server, which will handle authentication and URL reformatting automatically for users. This trick, called reverse proxy is explained in the Reverse Proxy Howto on the Etherpad wiki (http://bit.ly/1guEg59). Some Etherpad administration tasks are possible without using the command line, if you have enabled an admin user in the configuration file. Point your browser to the /admin subfolder of your Etherpad, enter the password and you’ll get a really spartan page with three sections: Settings, Troubleshooting and Plugin manager. The first is just a text area in which you can see and edit the settings.json file. The second lists the complete configuration of your installation. The official directory (http://bit.ly/1iMF8np) lists plugins for almost all tasks and tastes, from extra formatting functions to task lists and graphical themes. By default, Etherpad can only import or export notes in plain text and HTML formats, but there’s a plugin for conversion to many other formats via AbiWord. Other extensions let the administrator manage groups of users or (as you can see in the picture below), embed multimedia content in your notes. The Plugin manager lets you add all these functions to Etherpad with a few clicks, but it’s not always the best way to do it. The command line installation via npm uses the following simple syntax: npm install ep_ and produces the same result and is much more convenient when you need to set up more than one Etherpad. Plugins upgrades and removal work in the same way: npm install --upgrade ep_ npm uninstall ep_ In all cases, remember that you will need to restart Etherpad when you are done. LXF

Quick tip Compared to other Content Management Systems (CMSes), Etherpad is memory-hungry! Remember to check how much RAM you can spare!

The right plugins can do wonders for your Etherpad, from converting your notes to many formats to embedding multimedia.

www.tuxradar.com

July 2014 LXF185     81

Tutorial Python Minecraft Pi Xxxx

Python: Hack Minecraft Pi Use Python on your Pi to merrily meddle with Minecraft.

A

Our expert Jonni Bidwell wishes that more stuff was made out of blocks.

rguably more fun than the generously provided Wolfram Mathematica: Pi Edition is Mojang’s generously provided Minecraft: Pi Edition. The latter is a cut-down version of the popular Pocket Edition, and as such lacks any kind of life-threatening gameplay, but includes more blocks than you can shake a stick at, and three types of saplings from which said sticks can be harvested. This means that there’s plenty of stuff with which to unleash your creativity, then, but all that clicking is hard work, and by dint of the edition including of an elegant Python API, you can bring to fruition blocky versions of your wildest dreams with just a few lines of code.

Don’t try this at home, kids… actually do try this at home.

Assuming you’ve got your Pi up and running, the first step is downloading the latest version from http://pi.minecraft. net to your home directory. The authors stipulate the use of Raspbian, so that’s what we’d recommend – your mileage may vary with other distributions. Minecraft requires the X server to be running so if you’re a boot-to-console type you’ll have to startx. Start LXTerminal and extract and run the contents of the archive like so: $ tar -xvzf minecraft-pi-0.1.1.tar.gz $ cd mcpi $ ./minecraft-pi See how smoothly it runs? Towards the top-left corner you can see your x, y and z co-ordinates, which will change as you navigate the block-tastic environment. The x and z axes run parallel to the floor, whereas the y dimension denotes altitude. Each block (or voxel, to use the correct parlance) which makes up the landscape is described by integer co-ordinates and a BlockType. The ‘floor’ doesn’t really have any depth, so is, instead, said to be made of tiles. Empty space has the BlockType AIR, and there are about 90 other more tangible substances, including such delights as GLOWING_OBSIDIAN and TNT. Your player’s co-ordinates, in contrast to those of the blocks, have a decimal part since you’re able to move continuously within AIR blocks. The API enables you to connect to a running Minecraft instance and manipulate the player and terrain as befits your megalomaniacal tendencies. In order to service these our first task is to copy the provided library so that we don’t mess with the vanilla installation of Minecraft. We’ll make a special folder for all our mess called ~/picraft, and put all the API stuff in ~/picraft/minecraft. Open LXTerminal and issue the following directives: $ mkdir ~/picraft $ cp -r ~/mcpi/api/python/mcpi ~/picraft/minecraft

Dude, where’s my Steve? Here we can see our intrepid character (Steve) inside the block at (0,0,0). He can move around inside that block, and a few steps in the x and z directions will take Steve to the shaded blue block. On this rather short journey he will be in more than one block at times, but the Minecraft API’s getTilePos() function will choose the block which contains most of him. Subtleties arise when trying to translate standard concepts, such as lines and polygons from Euclidean

82     LXF185 July 2014

space into discrete blocks. A 2D version of this problem occurs whenever you render any kind of vector graphics: Say, for instance, you want to draw a line between two points on the screen, then unless the line is horizontal or vertical, a decision has to be made as to which pixels need to be coloured in. The earliest solution to this was provided by Jack Elton Bresenham in 1965, and we will generalise this classic algorithm to three dimensions in our next instalment (see Tutorials, p84).

www.linuxformat.com

Isometric projection makes Minecraft-world fit on this page.

Minecraft xxxxxx Python Pi Tutorial

Now without further ado, let’s make our first Minecraftian modifications. We’ll start by running an interactive Python session alongside Minecraft, so open another tab in LXTerminal, start Minecraft and enter a world then Alt-Tab back to the terminal and open up Python in the other tab. Do the following in the Python tab: import minecraft.minecraft as minecraft import minecraft.block as block mc = minecraft.Minecraft.create() posVec = mc.player.getTilePos() x = posVec.x y = posVec.y z = posVec.z mc.postToChat(str(x)+’ ‘+ str(y) +’ ‘+ str(z)) Behold, our location is emblazoned on the screen for a few moments (if not, you’ve made a mistake). These co-ordinates refer to the current block that your character occupies, and so have no decimal point. Comparing these with the co-ordinates at the top-left, you will see that these are just the result of rounding down those decimals to integers (e.g. -1.1 is rounded down to -2). Your character’s co-ordinates are available via mc.player.getPos(), so in some ways getTilePos() is superfluous, but it saves three float to int coercions so we may as well use it. The API has a nice class called Vec3 for dealing with three-dimensional vectors, such as our player’s position. It includes all the standard vector operations such as addition and scalar multiplication, as well as some other more exotic stuff that will help us later on. We can also get data on what our character is standing on. Go back to your Python session and type: curBlock = mc.getBlock(x, y - 1, z) mc.postToChat(curBlock) Here, getBlock() returns an integer specifying the block type: 0 refers to air, 1 to stone, 2 to grass, and you can find all the other block types in the file block.py in the ~/picraft/ minecraft folder we created earlier. We subtract 1 from the y value since we are interested in what’s going on underfoot – calling getBlock() on our current location should always return 0, since otherwise we would be embedded inside something solid or drowning. As usual, running things in the Python interpreter is great for playing around, but the grown up way to do things is to put all your code into a file. Create the file ~/picraft/gps.py with the following code. import minecraft.minecraft as minecraft import minecraft.block as block mc = minecraft.Minecraft.create() oldPos = minecraft.Vec3() while True: playerTilePos = mc.player.getTilePos() if playerTilePos != oldPos: oldPos = playerTilePos x = playerTilePos.x y = playerTilePos.y z = playerTilePos.z

t = mc.getBlock(x, y – 1, z) mc.postToChat(str(x) + ‘ ‘ + str(y) + ‘ ‘ + str(z) + ‘ ‘ + str(t)) Now fire up Minecraft, enter a world, then open up a terminal and run your program: $ python gps.py The result should be that your co-ordinates and the BlockType of what you’re stood on are displayed as you move about. Once you’ve memorized all the BlockTypes (joke), Ctrl+C the Python program to quit. We have covered some of the ‘passive’ options of the API, but these are only any fun when used in conjunction with the more constructive (or destructive) options. Before we sign off, we’ll cover a couple of these. As before start Minecraft and a Python session, import the Minecraft and block modules, and set up the mc object: posVec = mc.player.getTilePos() x = posVec.x y = posVec.y z = posVec.z for j in range(5): for k in range(x - 5, x + 5) mc.setBlock(k, j, z + 1, 246) Behold! A 10x5 wall of glowing obsidian has been erected adjacent to your current location. We can also destroy blocks by turning them into air. So we can make a tiny tunnel in our obsidian wall like so: mc.setBlock(x, y, z + 1, 0) Assuming of course that you didn’t move since inputting the previous code. Next time, we’ll see how to build and destroy some serious structures, dabble with physics, rewrite some of the laws thereof, and generally go a bit crazy within the confines of our 256x256x256 world. Until then why not try playing with the mc.player.setPos() function? Teleporting is fun, after all. LXF

All manner of improbable structures can be yours.

Quick tip Check out Martin O’Hanlon’s website www. stuffaboutcode. com, which includes some great examples of just what the API is capable of.

If you missed last issue Call 0844 848 2852 or +44 1604 251045 www.tuxradar.com

July 2014 LXF185      83

Python

Minecraft: Make a Pi tebuchet Build your labour of love and then blow it sky high with pyrotechnic   Jonni Bidwell, a stash of TNT and an age-old siege machine.

Our expert Jonni Bidwell

wishes that more stuff was made out of blocks, damn this silly quark-based universe...

N

ow that we’re au fait with the basics of the API, it’s time to get crazy creative. Building a house is hard, right? Wrong. With just a few lines of sweet Python your dream home can be yours. Provided your dream home is a fairly standard box construction, that is. If your dreams are wilder all it takes is more code. You will never have to worry about planning permission, utility connection, chancery repair contributions or accidentally digging up a neolithic burial ground (unless you built it first). It never actually rains in Minecraft Pi, so a flat-roof construction will happily suit our purposes just fine. We kick off proceedings by defining two corners for our house: v1 is the block next to us in the x direction and one block higher than our current altitude, whereas v2 is an aesthetically pleasing distance away: pos = mc.player.getTilePos() v1 = minecraft.Vec3(1,1,0) + pos v2 = v1 + minecraft.Vec3(10,4,6) Now we create a solid stone cuboid between these vertices and then hollow it out by making a smaller interior cuboid full of fresh air: mc.setBlocks(v1.x,v1.y,v1.z,v2.x,v2.y,v2.z,4) mc.setBlocks(v1.x+1,v1.y,v1.z+1,v2.x-1,v2.y,v2.z-1,0)

84     LXF185 July 2014

www.linuxformat.com

Great, except our only means of egress and ingress is via the rather generous skylight, and a proper floor wood (geddit?) be nice. If you’re standing in a fairly flat area, you’ll notice that the walls of your house are hovering one block above ground level. This space is where our floor will go. If your local topography is not so flat, then your house may be embedded in a hill, or partly airborne, but don’t worry – the required terraforming or adjustments to local gravity will all be taken care of. Let’s make our rustic hardwood floor: mc.setBlocks(v1.x,v1.y-1,v1.z,v2.x,v1.y -1,v2.z,5) The windows are just another variation on this theme: mc.setBlocks(v1.x,v1.y+1,v1.z+1,v1.x,v1.y+2,v1.z+3,102) mc.setBlocks(v1.x+6,v1.y+1,v1.z,v1.x+8,v1.y+2,v1.z,102) mc.setBlocks(v2.x,v1.y+1,v1.z+1,v2.x,v1.y+2,v1.z+3,102) mc.setBlocks(v1.x+2,v1.y+1,v2.z,v1.x+4,v1.y+2,v2.z,102) The roof uses the special half block 44, which has a few different types. Setting the blockType makes it wooden, matching our floor: mc.setBlocks(v1.x,v2.y,v1.z,v2.x,v2.y,v2.z,44,2) The door is a bit more complicated, the gory details are in the box on page 86, but the following three lines do the job: mc.setBlocks(v1.x+2,v1.y,v1.z,v1.x+3,v1.y,v1.z,64,3) mc.setBlock(v1.x+2,v1.y+1,v1.z,64,8) mc.setBlock(v1.x+3,v1.y+1,v1.z,64,9) Having lovingly and laboriously constructed our new property, the next step is to come up with new and inventive ways of destroying it. We have already mentioned that TNT can be made live, so that a gentle swipe with a sword (or

A house. Now let’s blow it up.

Python It doesn’t look like much, but just you wait...

anything really) will cause it to detonate. It would be trivial to use setBlocks to fill your house with primed TNT, but we can do much better. Readers, let me introduce my beta trebuchet. Rather than simulating a projectile moving through space we will instead trace its parabolic trajectory with hovering TNT. Detonating the origin of this trajectory will initiate a most satisfying chain reaction, culminating in a big chunk of your house being destroyed. First we will cover some basic twodimensional mechanics. In the absence of friction, a projectile will trace out a parabola determined by the initial launch velocity, the angle of launch and the local gravitational acceleration, which on earth is about 9.81ms-2. As a gentle introduction, we will fiddle these constants so that the horizontal distance covered by this arc is exactly 32 blocks and at its peak it will be 16 blocks higher than its original altitude. If blocks were metres, then this fudge would correspond to a muzzle velocity just shy of 18ms-1, and an elevation of 60 degrees. We will only worry about two dimensions, so the arc will be traced along the z axis with the x co-ordinate fixed just next to our door. This is all summed up by the simple formula y = z(2- z/16), which we implement this way: for j in range(33): height = v1.y + int(j*(2 – j/16.)) mc.setBlock(v1.x+4,height,v1.z-j,46,1) The final argument sets the TNT to be live, so have at it with your sword and enjoy the fireworks. Or maybe not: the explosions will, besides really taxing the Pi’s brain, cause some TNT to fall, interrupting the chain reaction and preserving our lovely house. We don’t want that, so we instead use the following code: height = v1.y ground = height - 1 j=0

while ground = 0.5: y += 1 error -= 1 where plot() is some imaginary plotting function and grad is between 0 and 1. Thus we increment y whenever our error term accumulates sufficiently, and the result is the image which meets your gaze. Bresenham’s trick was to reduce all the calculations to integer operations, which were far more amenable to 1960s hardware. Nowadays we can do floating point calculations at great speed, but it is still nice to appreciate these novel hacks. The floating point variables grad and error arise due to the division by dx, so if we multiply everything by this quantity and work around this scaling, then we are good to go. To get this working in three dimensions is not so much of an abstractive jump, we first find which is the dominant axis (the one with the largest change in co-ordinates) and flip things around accordingly. Moving along the dominant axis one block at a time and incrementing the co-ordinates of minor axes as required. We have to pay careful attention to the sign of each co-ordinate change, which we store in the variable ds. The ZSGN() function returns 1, -1 or 0 if its argument is positive, negative or zero respectively; I have left coding this as an exercise for the reader. We make extensive use of a helper function minorList(a,j) which returns a copy of the list a with the jth entry removed. We can code this using a one-liner thanks to lambda functions and list slicing: minorList = lambda a,j: a[:j] + a[j + 1:] Our function getLine() will take two vertices, which we will represent using three-element lists, and return a list of all the vertices in the resulting 3D line. All of this is based on Martin’s code, for which we should all be grateful. The first part of it

Double door details Putting doors into our house is our first encounter with the additional blockData parameter. This is an integer from 0 to 15 and controls additional properties of blocks, such as the colour of wool and whether or not TNT is live. Our door occupies four blocks and is aligned in the x direction. It’s recessed slightly back from the surrounding walls, closed, and has the handles helpfully placed towards the middle. These properties are controlled by various bits of the blockType. We number the four bits from the rightmost bit 0 to the leftmost bit 3 and in little-endian notation so that 8 is represented in binary as 1000. Bit 3 is

set if the block is part of the top section of a door. If this is the case, then bit 0 is the only other bit of concern, it determines the placement of the handles/hinges. Top sections of doors thus have blockType 8 or 9. For the bottom sections we have the following bit assignments: bit 3............off bit 2............door is open bit 1............door recessed bit 0...........alignment (off=x, on=z) The top sections must be placed after the bottom ones, since they inherit their properties from their inferiors.

Doors are always a good idea for those wishing to avoid claustrophobia/death.

Never miss another issue Subscribe to the #source for Linux on page 30. 86     LXF185 July 2014

www.linuxformat.com

Python initialises our vertex list and deals with the easy case where both input vertices are the same... Here our line is just a single block: def getLine(v1, v2): if v1 == v2: vertices.append([v1]) After this it gets a bit ugly, we set up the previously mentioned list of signs ds, and a list of absolute differences (multiplied by two) a. The idx = line is technically bad form, we want to find our dominant axis, thus the index of the maximum entry in a. Using the index() method together with max means that we are looping over our list twice, but since this is such a short list we shan’t worry, it looks much nicer this way. We refer to the dominant co-ordinates by X and X2. Our list s is a re-arrangement of ds, with the dominant coordinate at the beginning. And there are some other lists to keep track of the errors. The variable aX refers to the sign of the co-ordinate change along our dominant axis. else: ds = [ZSGN(v2[j] - v1[j]) for j in range(3)] a = [abs(v2[j]-v1[j]) > 1 s = [ds[idx]] + minorList(ds,idx) minor = minorList(v1,idx) aminor = minorList(a,idx) dminor = [j - delta for j in aminor] aX = a[idx] With all that set up we can delve into our main loop, in which vertices are added, differences along minor axes examined, errors recalculated, and major co-ordinates incremented. Then we return a lovely list of vertices. loop = True while(loop): vertices.append(minor[:idx] + [X] + minor[idx:]) if X == X2: loop = False for j in range(2):

if dminor[j] >= 0: minor[j] += s[j + 1] dminor[j] -= aX dminor[j] += aminor[j] X += s[0] return vertices To conclude in style, we will test this function by making a mysterious and precarious beam of wood next to where we are standing as a fitting testament to your wonderous labours this day, padawan. v1 = mc.player.getTilePos() + minecraft.Vec3(1,1,0) v1 = minecraft.Vec3(1,1,0) + pos v2 = v1 + minecraft.Vec3(5,5,5) bline = getLine([v1.x,v1.y,v1.z],[v2.x,v2.y,v2.z]) for j in bline: mc.setBlock(j[0],j[1],j[2],5) Next time we’ll look at creating a fully functioning Minecraft cannon. Boom! LXF

Now we can escape the gridlock and build at whatever angles our heart desires.

Don’t try this at home, kids.

www.tuxradar.com

July 2014 LXF185     87

Tutorial MySQL Xxxx

MySQL: Using spreadsheets Easily transfer spreadsheets to and from SQL files with MySQL, phpMyAdmin and a bit of Canadian help from Kent Elchuk.

A

Our expert Kent Elchuk

is a lead web developer for two colleges in Vancouver. He codes custom applications, writes blog posts and books, and experiments with virtual machines.

s MySQL is the world’s most popular open source database, it is familiar territory for anybody who builds dynamic websites or web applications, as well as online database administrators. MySQL is free to use and it runs on both Linux and Windows. It can be installed in a matter of minutes and will be ready to use very quickly. Although dynamic websites typically use a server-side programming language, such as PHP or Perl, to interact with MySQL, there will be plenty of times when you’ll work with it on its own – especially if you make database queries or custom searches, or you need to output data into CSV files or spreadsheets.

When you gather data from tables with matching keys, each key should be indexed or be the primary key in order to build faster queries.

If you are new to MySQL or databases in general, here is a quick briefing about using them. A database has a unique name and holds various tables of data, and within each table there are various columns that store data. As a MySQL user, you will continuously be using tables and columns, so it’s important to have a good understanding of them if you want to make your work flow simpler. During the time that MySQL has been in existence, some developers have gone to the trouble of building front-end tools that can be used to administrate MySQL databases. One popular tool that runs in a browser is phpMyAdmin. PhpMyAdmin is a very slick and helpful tool that enables you to manage many of your database needs. However, you can use the MySQL console to manage your databases, too. It really is a matter of preference when deciding which tool to use. Some people use MySQL as well as phpMyAdmin, and make their selection depending upon the particular task at hand. This tutorial will explain various concepts and procedures using phpMyAdmin and the MySQL console. Unlike phpMyAdmin, which runs in a browser, the MySQL console can be brought about with a simple Linux command that is called mysql. If MySQL does not have a password, then all you have to do is hit the Enter key on the keyboard to get to the prompt that looks like mysql>. If MySQL does have a password, then you need to run the command mysql –u root –p, then press Enter. After that, simply type in your password and hit Enter again. At this point, you will have access to the MySQL console.

MySQL operator cheat sheet Here is a quick briefing on the basic operators available in MySQL: LIKE searches for an exact match. It is very much like =. %LIKE% looks for any occurrence in the string, whether it is an exact match or just matches part of the data that exists on the column. NOT LIKE looks for data that does not match your input text. = is used to find an exact match. ! finds data that does not match the string you insert.

88     LXF185 July 2014

Regular expression operators are for those who know how to write regular expressions to match patterns such as REGEXP, REGEXP ^...$, NOT REGEXP. It is a world of its own and is used by more experienced users. =›› searches for empty strings. !=›› searches for non-empty strings. IN() is an operator that checks for one or more items in a column. Commas are used to separate your desired options. For example, IN(3,6) will retrieve any rows where the column has entries with 3 or 6. NOT IN() is the exact opposite of IN().

www.linuxformat.com

BETWEEN is an operator that is used to find numbers and dates within a specified range. For example, if you wanted to find data between dates you could use BETWEEN ‹2014-04-01› AND ‹2014-04-30›. NOT BETWEEN is the exact opposite of BETWEEN(). IS NULL means missing or unknown value. Often, some coders will use NULL to all empty columns, while other individuals prefer to use empty strings. IS NOT NULL means that a field does have a known value.

xxxxxx MySQL Tutorial If you want to paste MySQL commands into phpMyAdmin, then you can paste them just like you would to any text editor or browser etc. However, in order to paste text into the MySQL console, you use have to hit Shift + Insert after you have copied text. Finally, all phpMyAdmin queries can be left unclosed or they can use a traditional MySQL closing semi-colon (;). A command with the mySQL console must be closed with a semi-colon in order to run it. Now that you have had a quick briefing about MySQL, we’ll cover its usage and have a look at how to handle spreadsheets and SQL files. These concepts are everyday tasks for someone who works with MySQL on a regular basis and so it’s important that they are understood.

Uploading documents Saving a spreadsheet file as a CSV (comma-separated values) file makes it very easy to import data into a MySQL database. Data can be dumped into an empty or populated database. The constraints to dumping the data will depend upon the setup. For example, if you do not allow duplicate entries for one or more columns, the results will be different from a table that inserts any data that you give to it. The key to dumping data into a table is to make sure that your CSV spreadsheet has the same number of fields as the database table. For example, if you have five columns in your spreadsheet then you will want five columns in your table. With a CSV ready and PhpMyAdmin open, you can import a pre-made table by opening your database table, selecting Import followed by CSV as the Format, then going to Browse and choosing your CSV file. If your sheet columns have headers, select the checkbox next to The First Line of the File Contains the Table Column Names. If this is left unchecked, the first line will become part of the data. You will need to follow the same process if you want to import a CSV file and create a new table, However, when you populate and create a table at the same time, the table will be given a name like Table 2 and each column in the new table will take on names like COL 1, COL 2, COL 3 and so on. Poorly-named tables and columns aren’t usually adequate for a database administrator, since good names make databases easier to work with. This is especially the case as tables grow in numbers and have many columns and indexes. If you want to change the database table name, just open up a database table and select Operations, then change the name in the text box and click Go. This method can also be used to change a database name. If you want to change a column name, you simply select Structure, followed by Change for the column name you want to alter. Type in a new name and then click on Save. Good naming for databases, tables and columns makes it far easier to maintain the database, therefore saving you lots of precious time.

LOAD DATA LOCAL INFILE ‹colours_clothes.CSV› INTO TABLE colours_clothes FIELDS TERMINATED BY ‹,› enclosed by ‹ « ‹ lines terminated by ‹\n› (column_1, column_2, column_3) If you want to import a database table using a text file, this option uses a tab-delimited format and loads large tables at lightning speed. For example, a big table with every postal code, city code and country code can be dumped and inserted before you’ve even had time to get out of your chair. Dumping the same table with a CSV or SQL file would be much more time consuming. Here is an example of a tab-delimited file for a clothing list. The file is called colours_clothes.txt: id colour type 1 red shirt 2 yellow hat 3 blue jeans It would be imported with the following command: LOADe DATA LOCAL INFILE ‹/home/username/colours_ clothes.txt› INTO TABLE colours_clothes FIELDS TERMINATED BY ‹\t› LINES TERMINATED BY ‹\r\n› IGNORE 1 LINES; Here’s what the command is doing: The text file loads into the colours_clothes table. The fields are terminated by ‹\t› which means there is a tab space between the two columns. The spaces are after each word on each line. LINES TERMINATED BY ‹\r\n› means that each new line is a new row in the table. IGNORE 1 LINES means that the first line does not load into the table. The first line just explains what each row is.

Quick tip The search feature with phpMyAdmin is quick. But custom queries with the MySQL console or the SQL tool with phpMyAdmin can get custom data from various tables.

PhpMyAdmin searches Next, we are going to cover the methods for gathering the precise data that you want to show up in your CSV file. We will also look at how to export that data into a sheet that can be opened in OpenOffice Calc. Normally, there are methods that you can use to get your desired rows of data, by using the search tool and SQL queries. The search tool can find practically any data you want from one or more columns in a database table, while the SQL tab can be used to write custom MySQL queries that can find

Data into MySQL The MySQL console can be used to dump data into a table. For some default MySQL installations, you need to edit the file /etc/mysql/my.cnf and add the line local-infile under mysqld and mysql. In order to be able to dump the data, you must be using the database whose table you want to dump data into. In order to import a database table using a CSV file you will need to do this:

When you create a table you give each column a name, select a type, select a collation (if desired) and add an index (if desired).

In the next issue LXF186 We’ll be looking at maths-based Octave www.tuxradar.com

July 2014 LXF185     89

Tutorial MySQL Xxxx desired rows of data from one or more tables. The search tool would tend to be used to carry out a broad search on one, several or all databases, or to look up specified data in one or more columns of a database table. To do a broad search on all tables, open up phpMyAdmin and select the database that you want to search, then select the Search tab. The input box at the top is where you add the word or string that you are seeking. After that, select all or some of the tables. To choose a custom group of tables, hold down the Ctrl key and click on the tables that you want to search. After you’ve made your selection, click Go.

Searching your database To do a narrow search on a single database table, select your database followed by the database table you want to search, then click on the Search tab. At this point, you will have a list of each column that exists in the table and the column, type, collation, operator and value headings will be listed. For searching purposes, the key items you want to use here are operator and value. Operator allows you to specify certain details about the value that you will be looking for. For example, if you want to find a name in a column, you may type in a value like Peter. If you select Go, it will then look for the name Peter in all rows of the table and output the rows where the column has the exact word Peter. By default, most varchar and other column types use LIKE as the default search operator while most integer-like columns have the = sign. The LIKE operator can be misleading because it will look for a precise match. Meanwhile, the %LIKE% operator will output any data where it finds Peter in the string. For example, if you search for Peter with the %LIKE% operator,

With a couple of simple clicks of the mouse, you can have an entire or a partial backup of the data that you want.

you will get rows that have Peter, Peter Jones and Dave Peter. Writing custom MySQL queries takes practice. When queries gather data from various tables, you must ensure that the values in all tables have at least one match with another table. These matches are called keys. For example, if you have a members table with a member_ id, it could match blog entries for that member if a table called blog_entries had a column that stored the same member_id. Then, the blog_entries table could have a blog_id column that makes a match to a blog_comments table that stores the same blog_id from the blog_entries table. Providing that tables can be connected with matching indexes (keys) you can extract any custom data you want. Although you can match database tables that have matching keys (values in a column), you can also create indexes on a column. When columns are used to make joins with other tables, indexes and primary keys can dramatically speed up the query.

Writing MySQL queries Here are some basic MySQL queries to get you started. This one below is selecting all rows from a single table: SELECT * FROM tablename The query below is selecting only the name from all rows of a single table: SELECT name FROM tablename Now let’s go a little further. The example below is a query that joins tables from a relational database. Unlike the queries above, it uses a WHERE clause to set conditions. The query is gathering precise data from various tables. The word pay is shorthand for the payroll table, while slo is short for the site_list_official table. SELECT DISTINCT pay.site, slo.lat_dd, slo.long_dd, slo.lat_ dmd, slo.long_dmd, pay.extinguished_date, (SELECT SUM(fires) FROM payroll pr WHERE pr.site = pay.site) AS fires FROM payroll as pay, site_list_official as slo WHERE pay.site = slo.site_number AND pay.extinguished_date = ‹2014-03-11› If you want to add an index with phpMyAdmin, open up a table and select Structure. Click the More drop-down arrow and select Add Index. If you plan to use a database with various tables, things are much easier if the databases and tables use the same collation, and any columns that will be used to make joins have the same collation as each other. Collation of a database table can easily be changed with phpMyAdmin. Open the

Tips and tricks When you acquire a CSV file that you want to dump into a table, you may find that it was obtained from a source that is continually editing the data. You can dump all the rows into a table, then at a later date you can drop all table rows and add new data. If you are working from an ever-changing spreadsheet or CSV file, you could end up in a situation where you wanted to quickly drop all rows and then add the new data. The truncate command will help you tremendously with this. The command is very straightforward:

truncate tablename; However, you may want to create stored procedures. These are MySQL’s way of allowing you to set variables and run queries that can be stored and called upon when needed. Stored procedures can help if you have some specialised queries that you want to save and have access to. The example below exhibits a simple stored procedure: DELIMITER // CREATE PROCEDURE my_new_procedure() BEGIN

DECLARE my_variable INT DEFAULT 0; SET my_new_variable = 15; select my__new_variable; END // DELIMITER ; Once this has been created you can access the stored procedure with a server side script using a language like PHP, Python or Perl. The following commands show how to output the data from a stored procedure: $command = «CALL my_new_procedure()»; $result = mysql_query($command, $db);

Never miss another issue Subscribe to the #1 source for Linux on page 30. 90     LXF185 July 2014

www.linuxformat.com

xxxxxx MySQL Tutorial database table, select Change next to a column, choose a Collation from the drop-down list and click Save. It is important to remember that if you try to join two tables with different collations you might receive an error. To export an entire table as a CSV file with phpMyAdmin, open up the database table, scroll down to the bottom of the page and then select Export. If you’re just after data rows, look for Format and select CSV. If you want a sheet to have the column names, select Custom > Put Column Names in the First Row, and then hit Go. Although this tutorial explains many ways for importing spreadsheets, it is very important to have an understanding about SQL files since MySQL users will spend a lot of time backing up, altering and importing or exporting SQL files. It’s not uncommon to load a CSV file, then dump it out as an SQL file on a regular basis. Uploading large databases can be challenging since you could have several restrictions such as upload limits, memory issues and timeouts. Depending on your situation, you may or may not be able to control these factors. For example, if you are on a very cheap plan, then you can only expect to receive the bare minimum. If you maintain a VPS or dedicated server, you should be able to set custom limits that could enable you to make larger uploads. With cheap hosting accounts, you can’t make any adjustments to your package and will have to work with what you’ve got. If this is the case for you, then try breaking open your database file and cutting it into smaller chunks so that size, memory and timeouts won’t prevent you from getting the job done. With typical SQL files, database dumps populate all of the tables in your file, but you can just cut the code for one or more tables and populate them in bunches. Bear in mind that opening larger database files can be slow with mediocre computers. Therefore, you will want to open large MySQL files with an appropriate machine.

Importing databases The process of importing a database is very easy with phpMyAdmin. You simply create a database and then select it. Finally, you select the Import tab, choose your file and then select Go. Database creation at the MySQL command line is shown below: mysql> Create database databasename; You are then able to import a database from the command line like this: root# mysql –u root -p databasename < /home/username/ sql_table.sql As a MySQL root user, it is possible to create other users and grant them various permissions. Firstly, create a user: mysql> CREATE USER ‹raspberrypi›@›localhost› IDENTIFIED BY ‹raspberry_pi›;

Logging into MySQL as the root user with the MySQL console allows you to manage and control all databases and database tables.

Getting to know the operators will make finding and searching with phpMyAdmin a very quick, efficient and error-free task.

Next, grant privileges to the user for the database: mysql> GRANT ALL ON raspberry_blog.* TO raspberrypi@ localhost IDENTIFIED BY ‹raspberry_pi›; It is also very simple thing to export from SQL within phpMyAdmin. All you need to do is open your database, select Export and click Go. However, you have the option to select specific tables for your export. Use the following terminal command: mysqldump -u -p database_name table_name > /home/ username/sql_table.sql

Dynamic web queries Many of today’s popular and successful web applications and websites interact with MySQL databases in order to display output to the web surfer. The code below is a basic function that can be used to connect to a MySQL database. Web programmers use such techniques to interact other programming languages with MySQL. Once you can connect with MySQL, you can write programs for which you can create, read, update and delete data: function db_connect() { $host = «localhost»; $user = «raspberrypi»; $pw = «raspberry_pi»; $database = «raspberry_blog»; $db = mysql_connect($host, $user, $pw) or die(«Cannot connect to mySQL.»); mysql_select_db($database, $db) or die(«Cannot connect to database.»); return $db; } $db = db_connect(); Now that you have read through the tutorial, you should have a good idea of how to work with databases and CSV files. One real-world example is dumping a CSV file(s) into a MySQL database. You can then create daily custom CSV reports for this, in a format that other people want. Submitting that daily CSV report with MySQL could save you hours of labour. In addition to the above, developing stronger MySQL skills can make life easier on many levels. In most circumstances, you will always be able to get the custom data that you want, as quickly as possible. As you write more queries, you will probably discover other coding examples and your experience will make editing a much simpler process. LXF

www.tuxradar.com

July 2014 LXF185     91

Got a question about open source? Whatever your level, email it to [email protected] for a solution.



This month we answer questions on:

1 Extracting VOB files 2 Unresponsive keyboards 3 Rogue carriage returns in scripts

1

4 Setting up SSDs 5 Mouse and keyboard fix for Ubuntu 13.10 ★ MIME type settings in Firefox

Transfer video to DVD

Q

I’m trying to take a short film from a DVD which has several films combined on it, so that I can use the one on its own. The disc is not commercial and not protected as far as I am aware. I used the tutorial in LXF157, courtesy of the online subscribers archive – brilliant. I successfully got the film I wanted, using Handbrake, into MP4 which I can play in VLC. I used: ffmpeg -i /path/to/source.avi -target pal-dvd /path/to/output.avi

as per the article to produce ‘a PAL DVD compatible-file’. So what do I do with the file? I put it on a data DVD and my DVD player says there are no video files on the disk. I tried to produce a Video DVD in Brasero with the file on it, but Brasero locked up while ‘converting file to mpeg2’. David Hignett You have converted the film to an MP4 and then an AVI file, but DVDs require all video to be in MPEG2 containers. The -target option for FFmpeg makes sure that bitrates and codecs are appropriate, but you are still putting all this in an AVI container. None of this work is necessary as you already have the data in exactly the right format for DVDs, on the original DVD. All you need to do is extract the original track. There are a couple of programs that do this well, Vobcopy (http://vobcopy.org) can simply rip individual tracks, encrypted or not, like this: vobcopy -n X where X is the number of the track you want to copy. The tracks may not be in the same order on the disc as they are in the menus, but lsdvd

A

Enter our competition

Win!

if ($letter == winner) get $books Get your questions answered and exploit our generosity. Linux Format is proud to produce the biggest and best magazine 1 for Free Software about Linux and free software that we can. A word count of LXF173 showed it had 67,659 words. About as much as Heart of Darkness and Animal Farm combined, but with way more Linux, coding and free software! That’s more than most of our competitors, and that’s how we know that we’re big. As for the best, well… that’s a subjective claim, but it’s one we’re happy to stand by. #

92     LXF185 July 2014

Because we’re nice chaps as well as Linux gurus, and because our offices have very little storage space, we’re giving one lucky reader each issue the chance to win some of the books that get sent to us for review. They’re mostly reference books that will give your shelves an air of computational gravitas. For a chance to win, email your question to [email protected], or post it to www.linuxformat.com/forums to seek help from our lively community of readers. See page 94 for our star question.

www.linuxformat.com

Creating a video DVD, even without menus, requires a specific layout. DVDStyler can create this layer for you.

shows a listing of track numbers and their lengths, which should help you identify the right one. This in itself is not enough. The DVD spec requires a particular layout of files, even if you have a disc with one autoplaying film and no menus. You can rip a disc, including its menu structure with Dvdbackup (http://dvdbackup.sourceforge.net), which is what the program was designed for, but you can also copy individual titles and keep the correct file structure. For example: dvdbackup -t X Both of these programs look for the disc at /dev/dvd, use the -i option if it is somewhere else. Once you have the VOB file, you can create a new video DVD using DVDStyler (http://www.dvdstyler.org). Start the program and set the format (PAL or NTSC) in the first window. If you want a DVD that simply plays a single video, skip the template selection, click on the + button and add your file. You will need to set the file selector to show all files as it does not show VOBs by default. Then click on the Burn icon, set a path for the ISO image and let it create the ISO. This will be quick because there is no transcoding to be done. Once you have the ISO, you can view it in VLC to make sure it is what you want and then burn it to a disc with Brasero.

2

Unresponsive menu

Q

I’m stuck trying to install something linuxy on my sister’s PC (with XP getting the axe in April 2014, it seemed like the right time to lure her away from the dark side). It’s an old thing (ca 2006) with a Celeron 3.06GHz CPU and 80GB hard drive. I first tried a couple of live distros from the LXFDVD’s but could never get past the first selection screen. I can’t make the selection bar move away from the

Answers Terminals and superusers We often give a solution as commands to type in a terminal. While it is usually possible to do the same with a distro’s graphical tools, the differences between these mean that such solutions are very specific. The terminal commands are more flexible and, most importantly, can be used with all distributions. System configuration commands often have to be run as the superuser, often called root. There are two main ways of doing this, depending on your distro. Many, especially Ubuntu and its derivatives, prefix the command with sudo, which asks for the user password and sets up root privileges for the duration of the command only. Other distros use su, which requires the root password and gives full root access until you type logout. If your distro uses su, run this once and then run any given commands without the preceding sudo.

preselected first option, nor can I choose that option by hitting Enter. I then downloaded OpenSUSE 13.1, with little luck. There’s one improvement though: the preselected option there is Boot from Hard Disk with a small timer. The timer at least runs – though very slowly – so that after a while the machine resumes from it’s HDD and I don’t have to pull the plug. Is there a way to navigate through this startup screen? Or are these modern distros too advanced for the architecture I’m trying to install them on? guy13, From the forums This has nothing to do with the distros – or Linux at all for that matter – you are stuck at the bootloader screen with an unresponsive keyboard. This is more noticeable with the Linux Format DVDs as there is no default that’s automatically booted

A

When you see the bootloader screen, no operating system has been loaded and all hardware is being controlled directly by the BIOS rather than the Linux kernel.

if you select nothing. You need to go into the BIOS settings and turn on the either USB Keyboard or Legacy USB mode (the terminology varies from one BIOS to the next) to enable the BIOS to recognise the keyboard (I am assuming you have a USB keyboard). This setting doesn’t affect use of the keyboard within an OS, only makes it available at the early boot screens. You may have spotted a potential flaw in this suggestion: how do you enter the BIOS settings menu when your keyboard is not working? The answer is that you may have to

use a PS/2 keyboard for this task, either an old keyboard you can lay your hands on or one of those USB to PS/2 adaptors that used to come with USB keyboards. Once again, this is only so you can enable the keyboard for the bootloader, then you can switch back to your normal setup. Once you start to boot a distro, the Linux kernel’s USB drivers take over and the problem is no longer there. This is what happened with Windows, where you didn’t have to select anything for the bootloader to go straight to starting Windows.

A quick reference to...

X Forwarding X, the basis for all Linux graphical interfaces, is a networked protocol. Although your display is generally connected to the X server on the local machine, there is no requirement that this always be the case. You may have used VNC or Nx to use the desktop from a remote computer, but these have the disadvantage that they require you to reproduce the complete desktop of the other computer. In turn, this demands that the remote computer is actually running a desktop. If the other machine is a headless server, running a desktop is a waste of resources. Instead of starting up a complete desktop, you can run just the application you want over an SSH connection (which means it is secure even for connections running over a public network. Type this in your terminal:

ssh -X [email protected] someprogram If ‘someprogram’ is a GUI application, you should see its window open on your desktop. There are a couple of points to bear in mind here. The first is that you must have SSH access to the other computer, with either a password or key login. The SSH server on the other computer must have X forwarding enabled. This is usually the default, but check that /etc/ssh/sshd_config contains X11Forwarding yes There are some other options to ssh that you may find useful. -Y can be used in place of -X. It only works if the SSH server is set up with Trusted X11 Forwarding, but can be noticeably faster when available. The other option that can speed things up over slower links is -C, which enables compression of all data, although X is not really suitable for

www.tuxradar.com

Running the Fedora network configuration program on another computer’s desktop.

really slow connections, TightVNC or Nx is a better choice for narrowband use. MacOS also uses X for its display, so you can use this method to display a Mac program’s window on your Linux display, or vice versa.

July 2014 LXF185     93

Answers 3

Bad interpreter

Q

I am using a Raspberry Pi with Debian Wheezy OS. I have written a Python program (prog_control2.py) which runs perfectly. I want the program to run at bootup, I have done this before with no problem but this time it fails. I installed a script in /etc/init.d/progstarter. Running: sudo /etc/init.d/progstarter start returns ‘no such file or folder’. According to ls -l, the file is present, executable and owned by root. The Python program is in my home directory and executable. I have checked the file progstarter and as far as I can see it contains no errors. After more testing I find the problem is with the #! line. In Debug mode I get the following message: -BASH: /etc/init.d/progstarter: /bin/sh^M bad interpreter: No such file or directory. I am puzzled by the ^M it is apparently the caret at the end of the line. Don Stott You are right in that the ^M is a carriage return (CR) character. It looks like this particular file was created on a Windows computer as Windows uses CRLF (LF is Line Feed) to mark the ends of lines. Linux uses just LF, so the CR is interpreted as being part of the line, the final character of the interpreter’s path. You can check this with the file command. file /etc/init.d/progstarter You will probably see one of:

A

Star Question

Winner!

Vanishing PDFs

Q

94     LXF185 July 2014

If you need to convert a Windows file you could use Dos2unix, Recode or even ol’ tr.

4

The best SSD setup

Q A

I have just purchased an SSD – what’s the best way to set it up for use with Linux? What settings should I use for partitions and for trim? Ram, From the forums There isn’t much different to be done when setting up an SSD compared with a spinning drive these days. Partition alignment used to be the most important consideration. It still is, but a recent version of fdisk and parted default to safe alignment that works with SSDs as well as the newer hard drives with 4K block sizes. Ext4 is a good general purpose filesystem that’s just as suited to use with SSDs as it is with hard disks, although BTRFS has some features specific to

This month’s winner is Hugh McCullough. Get in touch with us to claim your glittering prize!

My LXF subscription is supposed to enable me to download from your magazine archive. However, when using Firefox 24.3.0 esr and Linux LXLE, although I can log in and access the appropriate web pages, clicking on the links to download doesn’t work. I’ve discovered that Firefox secretly downloads the PDFs and puts them in /tmp. They also have a .part extension which remains even when the download is complete. I have Firefox set up to ask me where the files should be saved and this is respected for other websites. I have noticed a difference between your website and others that I have tried. They had a direct link to the PDF file while yours used PHP. I don’t know if that is anything to do with it. Hugh McCullough I suspect the reason for the differing behaviour between PDF downloads for our website and others is to do with the MIME-type sent in the HTML header, but I don’t have access to the PHP code so cannot

A

POSIX shell script, ASCII text executable, with CRLF line terminators POSIX shell script, ASCII text executable You want the latter but you will see the former. The answer for future use is to create the file in a Linux editor of some description, but you need to convert this file. There are a couple of options, the simplest of which is the Dos2unix program. If this is installed you can convert the file to Unix line endings with: dos2unix /etc/init.d/progstarter An alternative program for this task is Recode, run with: recode ibmpc..lat1 /etc/init.d/progstarter Which of these you use depends more on which is available rather than any massive technical differences. The simplest syntax is Unix2dos but Recode has more options. Alternatively, you can use the venerable tr program that is part of coreutils and so present on all GNU/Linux distros. This sends the converted text from standard input from standard output so you need to use redirection tr -d ‘\r’ /etc/init.d/progstarter.new Incidentally, you do not need to create a separate init file to start a single program. There is a script at /etc/rc.local that it runs at the end of the boot process, you could add your command to this. Make sure you add a & to the end of the command to force it to detach and not block any further execution of the script.

confirm this. Direct links are not used because the PDFs are only available to subscribers, so the PHP is needed to check that you are logged in (I know it can be done other ways but this is the way the site is currently implemented). The odd named files in /tmp indicate that Firefox may be trying to stream the file, as it does this through a temporary file in /tmp like you are seeing. However, I have been unable to reproduce your problem, even using the same distro and Firefox release. This suggests that it is something in your Firefox configuration or extensions that is a contributing factor. You can disable all extensions and themes by running Firefox from a terminal with the safe-mode option: firefox --safemode http://www.linuxformat. com/subsarea If that doesn’t help you, try starting Firefox with a completely blank profile. Exit Firefox, rename .mozilla to something like .mozilla. bak and then start Firefox again. This will create a new .mozilla directory, but you can safely remove that and replace it with .mozilla. bak when you are finished. If running without

www.linuxformat.com

With the wrong MIME type settings, Firefox can try to stream PDFs from our subscriber area instead of downloading them.

extensions fixes the problem, re-enable them one at a time until you find the culprit. Similarly, if a blank profile fixes the problem, you will have to experiment to find the guilty setting. Running Firefox from a terminal instead of the desktop menu may help, as you will be able to see any messages output by Firefox.

Answers SSDs. Whether you want to use an experimental filesystem for your data is your decision. The last time I spoke with someone from SUSE about it, and they are the main proponents of BTRFS, they recommended using it for the OS with ext4 for data, although they were talking about enterprise customers where data integrity is critical. Some still consider wear from writes to be a problem with SSDs but most of the recent studies suggest that an SSD is capable of outlasting a spinning drive. However, it won’t hurt to add noatime to your mount options in /etc/fstab. Most distros mount some frequently written areas, like /tmp, to tmpfs anyway. Trim can be handled automatically or manually (usually through Cron). To do it automatically, add relatime,discard to the mount options in /etc/fstab, but do not do this for the root filesystem, or any other frequently written filesystem as it is reported to cause performance degradation over time. It is fine for less critical and, more importantly, less frequently written filesystems. The safer alternative is to call the fstrim command from Cron. To trim the root filesystem, you’d run: fstrim / Once or twice a day, no more. If your computer is always on, schedule it for times you will not be using it. You will need a separate fstrim job in Cron for each filesystem on the SSD that’s not mounted with the discard option. If none of your filesystems use

automatic discard, you can just use: fstrim --all This will silently ignore any filesystems that don’t support discard, so it won’t matter if you have a USB drive plugged in when it runs. If you add the -v option, fstrim reports what it has done, which would be mailed to you if MAILTO is set in your crontab.

5

Dead Ubuntu?

Q

Running Ubuntu 13.10 live from the LXF183 DVD comes up with the desktop display but disables my keyboard and mouse. My computer is completely locked up so the only way to turn it off is to remove the mains supply from it as even a hard reset does nothing. Is my DVD faulty or is there some other feature I’m missing? The other distros of Mageia 4 and OpenSUSE 13.1 work fine on my Dell E521 desktop machine. Peter Lonsdale I doubt the DVD is faulty but it is easy enough to check. Mount the DVD, open a terminal and run: sh /path/to/dvd/media-check.sh If there are any errors on the disc, it will let you know. It is more likely that the mouse and keyboard are not working rather than the computer having locked up – wait a minute and see whether the clock changes. There have been a few reports of USB mice and keyboards not working with a recent update to Ubuntu

A

Help us to help you We receive several questions each month that we are unable to answer, because they give insufficient detail about the problem. In order to give the best answers to your questions, we need to know as much as possible. If you get an error message, please tell us the exact message and precisely what you did to invoke it. If you have a hardware problem, let us know about the hardware. If Linux is already running, you can use the Hardinfo program (http://hardinfo.berlios.de) that gives a full report on your hardware and system for us to scrutinise. The report is an HTML file which you can attach to your mail. Alternatively, the output from lshw (http://ezix.org/project/wiki/HardwareLiSter) is just as useful. One or both of these should be in your distribution’s repositories. If you are unwilling, or unable, to install these, run the following commands in a root terminal and attach the system.txt file to your email. This will still be a great help in diagnosing your problem.

uname -a >system.txt lspci >>system.txt lspci -vv >>system.txt

(LXF183’s DVD has an updated respin of Ubuntu). This appears to be limited to a few USB chipsets and devices due to missing drivers and didn’t affect any of the systems we used to test the DVD. You may find that trying a different keyboard and mouse, or the same keyboard in a different USB port. Otherwise your only alternative is to use a mouse and keyboard connected via the PS/2 ports. Once Ubuntu is installed, an update should remove the problem. LXF

Frequently asked questions…

Wine

Do I need Windows installed to use Wine?

The name is an acronym of Wine Is Not an Emulator.

No, but Wine will use Windows DLLs from an existing installation if you have them. If not, it has its own alternatives.

So, if it’s not an emulator, what is it exactly?

If I have Windows installed already, why would I need Wine?

Well, it’s a sort of emulator really. Wine is an Open Source implementation of the Windows Application Programming Interface (or API) that runs on top of X and Unix.

First, it means you can run a Windows program without rebooting into Windows, then rebooting into Linux afterwards. You can have Windows programs running alongside Linux software. Wine also makes it possible to use Windows plugins in Linux programs, such as web browsers and media players. This gives Linux programs access to numerous formats that are only handled by proprietary Windowsonly codecs.

What is Wine?

Does Wine enable me to run Windows on Linux?

Not exactly. Wine is a compatibility layer between Windows programs and Linux. When you run a Windows program with Wine, the program thinks it’s running on Windows, but the calls it makes to Windows functions are translated into Linux calls.

Emulators can be pretty slow, how fast is Wine?

Wine only emulates the Windows

API, not the hardware. This means programs run at similar speeds under Wine as natively on Windows, sometimes even faster. The disadvantage of this is that Wine can only run on the same hardware as Windows, it is not a processor emulator. How is it available?

You can download Wine in a variety of package formats from the Wine website. Packages are also available from most distros’ repositories. There are also two commercial variants of Wine. Codeweavers’ CrossOver Office is set up to run various Windows productivity applications. It also runs Internet Explorer plugins in a number of Linux web browsers, including Firefox and Konqueror. All the hard work of configuration is taken care of for you. There are over fifty supported applications listed on Codeweavers’ website, but many more work with it.

www.tuxradar.com

That’s fine for productivity, what about games?

The other commercial variant is Cedega, previously known as WineX. TransGaming Technologies’ Cedega is an enhanced version of Wine that includes DirectX support. Cedega is available for free, via CVS. If you want pre-built packages and support, you will need to take out a subscription. As with CrossOver Office, there is quite a long list of supported titles, with more being added all the time. Where can I get it?

Wine is in most distros’ package repositories. You can get the source and packages for many distros from www.winehq.com. CrossOver Office is available from www.codeweavers.com, including a free trial version. You can get Cedega from www.transgaming.com.

July 2014 LXF185     95

On the disc Distros, apps, games, podcasts, miscellany and more…

The best of the internet, crammed into a massive 4GB of quality DVD

Enhance

T

his month we have another remixed distro on the cover disc, this time a fusion of the latest releases of Ubuntu, Kubuntu, Xubuntu and Lubuntu. We have also added an option to the boot process to make it possible to choose the desktop you want from the boot menu. It is very easy to become blasé about remixing and modifying distros like this and take it all for granted – not the work involved in modifying the distro for the Linux Format DVD, but the very fact that we can do it. Those of us that work with open source software all the time can easily forget what a privilege it is to be able to do this. Other popular operating systems do not have this luxury, their cover discs include what they are told they can use, often restricted or advert-riddled versions of software. We are not only able to include full operating systems, but change them to improve the DVD. It is a real benefit to be able to do this, and to be able to replace the OS in our mobile devices, and we should take a moment now and then to think about what it means and to appreciate the significant benefits that open source brings us all, even when we leave it to someone else to actually make the change.

Linux distribution

Ubuntu 14.04

Ubuntu 14.04 is an LTS (Long Term Support) release, and it now has five years of support. That means bug fixes and security updates will be provided for that long. As is now the norm, we have rolled together Ubuntu, Kubuntu, Xubuntu and the newcomer,

Linux distribution

MX-14 “Symbiosis” We are used to seeing projects and distros forked, and it is not always for the best. A less frequent occurrence is when two projects re-unite, which is what has happened here. AntiX was originally based on Mepis, but with lighter desktops for older

Important

Notice! Defective discs

In the unlikely event of your Linux Format coverdisc being in any way defective, please visit our support site at www.linuxformat.com/dvdsupport for further assistance. If you would prefer to talk to a member of our reader support team, email us at [email protected] or telephone +44 (0) 1225 822743.

96     LXF185 July 2014

www.linuxformat.com

64-bit

Lubuntu. These are officially recognised respins of Ubuntu using alternative desktops. Trying these desktops is now much easier, simply pick the one you want from the DVD’s boot menu. The old log out and log back in approach still works if you don’t want to reboot.

32-bit hardware, but then became a direct derivative of Debian. Now the two teams of developers have collaborated to produce a combined distro release – MX-14. We have included the 32 bit version on the DVD because this distro is ideal for older hardware, but would be incredibly fast on newer kit. Very few distros are totally free. Most include some restricted code somewhere; usually drivers or firmware or something from Adobe. Trisquel is one of a few distros that aim for complete freedom, every single byte of code is free. Yet it can still be used to watch cat videos on YouTube – apparently, the main function of most computers.

New to Linux? Start here

What is Linux? How do I install it? Is there an equivalent of MS Office? What’s this command line all about? Are you reading this on a tablet? How do I install software?

Open Index.html on the disc to find out

Download your DVD from www.linuxformat.com

From the magazine

Wild Wild Wikis Try all the world’s weird wikis from our RoundUp, including: MediaWiki, Dokuwiki, Foswiki, PmWiki, TiddlyWiki.

Tutorial Code Programs and examples for this month’s tutorials.

And more! System tools Essentials

Checkinstall Install tarballs with your package manager.

Assassin of the Underdark

Nuttx

Pioneer

Scalable, small footprint RTOS.

A space adventure game set at the dawn of the next millennium.

Dungeons explorer game which sounds like some kind of dodgy Masonic job description.

Shellpic

dispcalGUI

Qtractor

GUI for the Argyll CMS display calibration utilities.

Audio multi-track sequencer.

Midnight Commander

Terminal image display.

Command line file manager, which sounds like the Assassin of the Underdark’s superior.

Git

GNU Core Utils The basic utilities that should exist on every operating system. Hardinfo A system benchmarking tool. Kernel Source code for the latest stable kernel release. Memtest86+ Check for faulty memory. Plop A simple boot manager to start operating systems. RaWrite Create boot floppy disks in Windows. SBM An OS-independent boot manager with an easy-to-use interface. WvDial Connect with a dial-up modem.

Distributed revision control system. Sounds very rude.

Reading matter Bookshelf

GluCat Library of template classes modelling Clifford algebras.

The Cathedral and the Bazaar Eric S Raymond’s classic text explaining the advantages of open development.

GogglesMM

Linux Kernel in a Nutshell An introduction to the kernel written by master-hacker Greg Kroah-Hartman.

Super-fast music collection manager and player.

Podcasts

Debian Administrators’ Handbook   An essential guide for sysadmins. Linux Dictionary The A-Z of everything to do with Linux. Dive Into Python A masterclass in this popular language.

TuxRadar

Season 6 Episode 2

Bourne Shell Scripting Guide Get started with shell scripting.

So good that we’ve run it once again this month, but we hope to attempt Ep3, if we finally manage to evict the maniac piano player from our recording cupboard. News Red Hat joins forces with CentOS, the brilliance of Ye Olde SteamOS, the less brilliant Steam Machines so far, why Steam VR is becoming scarily good, hacked fridges sending your spam and End of Life dates for Ubuntu releases. Discoveries of the week Distros for the visually impaired, NHS data sharing (which has been delayed) – is it good or bad thing? BlackBlaze hard drive study, which has some surprising results.

Advanced Bash Scripting Guide   Go further with shell scripting. Intro to Linux Pointers for new Linux users. System Administrators Guide Get your system to do what you want. Tools Summary An overview of GNU tools.

www.tuxradar.com

July 2014 LXF185    97

1 for Free Software

#

Future Publishing Ltd, 30 Monmouth Street, Bath BA1 2BW Tel 01225 442244 Email [email protected] 21,784 January – December 2012 A member of the Audited Bureau of Circulations.

EDITORIAL

Editor Neil Mohr [email protected] Deputy editor Matthew Hanson [email protected] Technical editor Jonni Bidwell [email protected] Operations editor Chris Thornett [email protected] Art editor Efrain Hernandez-Mendoza [email protected] Editorial contributors Neil Bothwick, Chris Brown, Kent Elchuk, David Hayward, Robin De Jongh, Les Pounder, Jem Roberts, Mayank Sharma, Richard Smedley, Alex Summersby Art assistance Nick Aspell Production assistance Jem Roberts, Alex Summersby Illustrations Shane Collinge, Simon Middleweek, iStock Photo

Advertising sales

LXF 18 6 wi

ll be on Wednes sale day 18

Next month How to fix Ubuntu 14.04

June 20 14

Trusty Tahr is out – but is it everything it could be? We show you how to tweak, fix and improve the latest release to be the best distro out there for your needs.

Low-resource distros

What’s the best distro to run on old hardware to give   it a new lease of life? We find out.

Package managers

An in-depth guide to package managers and how to use them – there’s more to life than apt-get!

Pass the LPI

Choose the best path to gaining Linux Professional Institute Certification for personal or work reasons. Contents of future issues subject to change – we might have been silenced by Canonical.

98     LXF185 July 2014

www.linuxformat.com

Advertising sales director Nick Weatherall 020 7042 4155 [email protected] Account sales manager Ricardo Sidoli 020 7042 4124 [email protected]

Managerial & marketing

Campaign manager Sam Book Head of Computing Group Ian Robson Chief executive officer Zillah Byng-Maddick

Production and Distribution

Production co-ordinator Ian Wardle Production manager Mark Constance Trade marketing manager Colin Hornby Distributed by Seymour Distribution Ltd, 2 East Poultry Avenue, London EC1A 9PT Tel 020 7429 4000 Overseas distribution by Future Publishing Ltd Tel +44 (0)1225 442244

Licensing

Licensing & syndication manager Regina Erak [email protected] Tel +44 (0)1225 732359

CircUlation

International account manager Rebecca Hill [email protected]

Subscriptions & back issues

UK readers’ order line 0844 848 2852 General UK enquiries 0844 848 1602 Overseas readers +44 (0)1604 251045 Online enquiries www.myfavouritemagazines.co.uk Email [email protected]

Additional management Editorial director Jim Douglas Creative director Bob Abbott Group art editor Steve Gotobed

LINUX is a trademark of Linus Torvalds, GNU/Linux is abbreviated to Linux throughout for brevity. All other trademarks are the property of their respective owners. Where applicable code printed in this magazine is licensed under the GNU GPL v2 or later. See www.gnu.org/copyleft/gpl.html. Copyright No part of this publication may be reproduced without written permission from our publisher. We assume all letters sent – by email, fax or post – are for publication unless otherwise stated, and reserve the right to edit contributions. All contributions to Linux Format are submitted and accepted on the basis of nonexclusive worldwide licence to publish or license others to do so unless otherwise agreed in advance in writing. Linux Format recognises all copyrights in this issue. Where possible, we have acknowledged the copyright holder. Contact us if we haven’t credited your copyright and we will always correct any oversight. We cannot be held responsible for mistakes or misprints. All DVD demos and reader submissions are supplied to us on the assumption they can be incorporated into a future covermounted DVD, unless stated to the contrary. Disclaimer All tips in this magazine are used at your own risk. We accept no liability for any loss of data or damage to your computer, peripherals or software through the use of any tips or advice. Printed in the UK by William Gibbons. © Future Publishing Ltd 2014

Future produces high-quality multimedia products which reach our audiences online, on mobile and in print. Future attracts over 50 million consumers to its brands every month across five core sectors: Technology, Entertainment, Music, Creative and Sports & Auto. We export and license our publications to 89 countries around the world. Future plc is a public company quoted on the London Stock Exchange (symbol: FUTR). www.futureplc.com

Chief executive Zillah Byng-Maddick Non-executive chairman Peter Allen Chief financial officer Simon Poulton Tel +44 (0)207 042 4000 (London) Tel +44 (0)1225 442 244 (Bath)

We are committed to only using magazine paper which is derived from well-managed, certified forestry and chlorine-free manufacture. Future Publishing and its paper suppliers have been independently certified in accordance with the rules of the FSC (Forest Stewardship Council).

9000

9015

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF