ROUNDUP TOP 5 PLAYERS

Docker containers Create and automate your # 1 forFreeSoftware own services with virtualisation HACK THE Pi Discover the inner secrets of the mighty but mini PC board

Minecraft hacks Audio streaming OwnCloud hosting Samba Use the Twitter API Tinker,Ti k tteacher, h artist ti t Arduinodevelopedalarge Also inside… community, and that was really key to its success Pro music You don’t know JACK, but you Michael Shiloh on the power of Arduino p42 will, pro-level music on Linux.

Revision control Network monitoring Python meets Git started Wireshark Cython Thank Linus and Gear up for some Mash up your Python control your projects deep packet inspection with some super C code TuxRadar.com

Welcome

#1 for Free What we do We support the open source community byprovidingaresourceofinformation,and aforumfordebate. We help all readers get more from Linux with our tutorials section – we’ve something for everyone! We license all the we print in our tutorialssectionundertheGNUGPLv3. We give you the most accurate, unbiased and up-to-date information on all things Linux. Whoweare AyearinFOSS We asked our team of experts to tell us what The time has flown by but it seems I’ve been in the they believe to be the single most exciting hot FOSS seat for twelve months; more commonly open source project of the last year... known as one of your Earth years. It’s rare to talk directly about the magazine, but the good news is we’re still here and doing better than ever. We’re continuing to Jonni Bidwell bring onboard new writers to expand our areas of expertise If the propaganda is anything to go by, then and we’re planning, what we hope you will find, fascinating Maidsafe is going to be pretty darn exciting: A distributed ecosystem featuring new features and tutorials for the year ahead. a decentralised, anonymous app platform, I might have started on Linux Format as something of an incentivised by its own cryptocurrency. The platform is entirely open, and the crypto it open source neophyte – though to qualify that I’ve used uses has been thoroughly scrutinised. It’ll Linux since 2000 for projects and even looked at the kernel be interesting to see reactions… source mid-90s on my Amiga – but even then it was obvious how vibrant, constantly changing and vitally important GNU/Linux is to the world. Over the last year Andrew Mallett Puppet will wins hands down for me every here in the UK open source has seeped into our time. Although not exactly new, Puppet is government infrastructure and is now part of the school still providing configuration support to new curriculum, championed a good deal by the work of the innovations, such as OpenStack. The ease and simplicity that enterprise systems Foundation. To help celebrate this fortunate have shown us really can be managed turn of events we’re exploring how you can hack Linux on makes me a marionette by choice. (Insert the Pi to ever greater levels with fun projects, advanced ‘strings attached’ joke here.) Linux services and essential skills. All the fun starts on page 34 so we hope you’ve brought your Pi with you. Les Pounder Not that we want to obsess on the Pi too much, even if In the last twelve months the Shrimping it’s a great device that’s changing the world, a big part of project has held my attention more than that success is its Linux smarts. We’re finishing our Nginx most. It’s an Arduino Uno board for £5, and the project has been really interesting as series on page 76 ( which also happens to all work with the you get ‘hands on’ with building an Arduino Raspberry Pi) but we’re also going deep into Cython to and learning the function of each of the accelerate everyday Python on page 84, exploring how to components. I recently learnt it works with Scratch – RESULT! use Git for your own projects on page 88 and look at how you can get started developing PHP on page 52. We’re also trying to stay musical with a roundup of Richard Smedley excellent players on page 26 and even pro-level production Mailpile brings the much-needed protection on page 48. Plus even more advanced tutorials, reviews of encrypted email to non-technical users on all platforms. Standing out in a crowd of and a packed DVD. I hope you enjoy the issue and many exciting, emerging IndieWeb projects, more over the next 12 months! Mailpile’s powerful tagging, notable speed, and flexible self-hosting choices make it the first realistic FOSS alternative to the really- slightly-mighty Gmail. Neil Mohr Editor [email protected] Mayank Sharma My favourite projects all seem to have something of a habit of dying soon after I’ve labelled them as such – SolusOS, Pear Linux, and the latest favourite of mine, Bodhi Linux. So you’ll understand if I’m a little superstitious about using that word. Oh wait – my favourite project right now Subscribe today has to be Windows! See p32 for deals

www.linuxformat.com December 2014 LXF191 3 Contents “Be kind, for everyone you meet is fighting a harder battle.” – Plato Reviews Hack the Raspberry Pi LG Ultra-wide monitor ..... 17 21:9 is the new 4:3. Widescreen is dead we’ll GetGet the ttinyiny PPCC b boardoard to all be using these 34-inch HD monsters. rock your world p34 Moto 360 ...... 18 Android Wear is here from and this is the poster for it from Motorola. Would you strap it to your wrist?

We’re not square, says Motorola.

Thecus N4560 NAS ...... 19 Roundup: A powerful mid-range SOHO or home NAS Music players p26 that packs four drives and an impressive OS. Gentoo Live ...... 20 Trapped in the Phantom Zone-like plastic of a DVD, who thought this was a good idea? Peach OSi 14.04 ...... 21 Taste the not-so forbidden fruit of yet another and new respin. Tondi ...... 22 Why would Mayank Sharma leave OwnCloud? There’s only one way to find out. WordPress 4.0 ...... 23 The ubiquitous CMS gets a full point update, dancing breaks out across the globe. Gaming headsets ...... 24 Top-notch headsets for perfect team-chat or just idle gossip online. Games ...... 25 We catch up with The Witcher 2 and see if it’s ready for prime-time on Linux. Talking heads “I discovered open source long before I think it was even a term...” I said Ubuntu was best! Michael Shiloh on the power of Arduino p42

4 LXF191 December 2014 www.linuxformat.com On your free DVD Raspbian, KaliLinux PiMusicBox, RetroPie, Jasper 2014, Noobs All the Raspberry Pi essentials Treat yourself or a loved one to an LXF PLUS: HotPicks and tutorial code p96 subscription! p32

Don’t miss...

JACK in ...... 48 Get started with pro-level music production with our guide to the essential JACK.

PHP virtual dev- ...... 52 Build the ideal PHP dev environment in a portable, VirtualBox and get building.

Coding Academy Tutorials Systemd Cython ...... 84 Meet Cython, a Python to C compiler, Philip Explore Journald...... 68 Herron will be your loyal guide on how to make The new Systemd logging system explained your code 12 times faster and all he asks in and explored in a true tale of, disaster! return is that you read to the end...

Git started ...... 88 Jonni Bidwell has always fancied a bit of creative literature and what better place to practice than in the safe, nurturing environment of Git. Linus would be proud.

Nothing to do with The Wire. Regulars at a glance Network monitoring News...... 6 Subscriptions ...... 32 Back issues ...... 66 Wireshark ...... 70 The is on fire as the Bundle! Is something that was Buy one now or we’ll force Jonni to You always fancied a bit of deep packet inspection, time to dip into some TCP. Shellshock bug rages through screamed around Midland schools write more PHP code! No collection servers, but not Linuxformat.com but now it’s our subs team saying it. is complete without LXF183. Core skills Awk ...... 74 Mailserver...... 11 Sysadmin...... 56 Next month...... 98 The best skills are core skills, learn how Awk More letters and questions answered Dr Chris also goes all creative writing You can’t get rid of us that easily! can manipulate text files quickly and easily by what’s left of the LXF team. on us and looks at how plays Distro secrets will be revealed, robots with powerful terminal commands. its part in the commercial world and built, NAS drives created and more. Nginx User groups...... 15 the options you have. Les Pounder goes all Bake Off MySQL queries ...... 76 It’s time to link up your Nqinx web exploring JAMs, maker events and HotPicks ...... 60 with its own MySQL databse for more PHP actually this is about the Pi? Oops. Apps so hot they make The Hunger fun than you can handle. Games trilogy look like ice-cold teen Roundup ...... 24 trash literature. Included this month Docker Discover what’s the best FOSS are QMplay2, Rosa ImageWriter, Jenkins ...... 80 to store and enjoy your music PDFSaM, Rodent Core, KXStitch, Jolyon Brown explains how to rollout Docker containers in a working environment collections from features to KEncFS, Blobby Volley, Caesaria, Our subscriptions team is with Jenkins and your sysadmin skills. straight listening enjoyment. I-Nex and more. waiting for your call.

www.linuxformat.com December 2014 LXF191 5 THIS ISSUE: Shellshock Matchstick Jessie Beta 2

SECURITY ANALYSIS Shellshock fallout After a vulnerability in Bash was discovered, the race was on to patch it out of existence.

t the end of September a number of security bugs, given patch the vulnerability on their Athe collective name Shellshock, respective servers, and while Apple were found, affecting the Bash initially downplayed the danger of the . Because of the widespread use of bug to its customers, it nevertheless the shell, particularly in web servers, it released a security patch for Mavericks, quickly became apparent that Lion and Mountain Lion versions of its Shellshock could prove to be more of a , OSX. threat than the much publicised Heartbleed vulnerability that had given The fightback us all a scare at the start of 2014. Red Hat published a set of commands The Shellshock vulnerability was that people can run to help confirm if a found in the Bash software package, a system is patched against Shellshock. powerful command line shell that many Depending on the results returned by Linux users may be familiar with. running the script, you should be able By exploiting the vulnerability, malicious to ascertain what patch you have, and if hackers are able to remotely run any further patches are required. You commands via Bash. Perhaps worst of can view the steps at https://access. all, exploiting the Shellshock bug takes redhat.com/articles/1200223. very little specialist knowledge, so far Whilst efforts to contain the fallout more people may begin using it. of the Shellshock vulnerability were Coupled with the fact that many web determining which function-like strings Shellshock isn’t being undertaken by some of the servers use Bash, the potential for are acceptable during Bash startup. a vulnerability biggest technology firms in the world, damage is worrying. Since the vulnerability was detected, that should be others were worried about how the ignored but Since the bug was revealed, a companies have been scrambling to potential crisis was being seized upon patches are number of Shellshock exploits have ensure their services – and customers by critics of Unix systems, Bash and rapidly arriving been seen in the wild. These vary in – are no longer vulnerable to the bug as for devices that open source projects, especially after severity, from opening and closing a evidence mounted that criminals and allow for updates. the much publicised debacle of the DVD drive on a remote , to hackers were already using the exploit Heartbleed bug. creating and running a self-replicating to mount attacks across the globe. In a passionate defence of Bash, Worm program which can go on to A report by Trend Micro explained GNU’s godfather Richard Stallman and infect other machines. one such attack: “Trend Micro Deep Andrew Auernheimer wrote on The website http://unix. Discovery was able to detect this LiveJournal how people attacking Bash stackexchange.com contained a good attempt and found that attackers were for the vulnerability are missing the real example of how the Shellshock target. As he wrote “Shellshock is not a vulnerability might be used. It occurs critical failure in Bash. It is a critical because Bash, in its unpatched state at “It is not a critical failure failure in thousands of people who knew least, stores exported function in Bash. It is a critical a tool so useful that they decided to definitions as environment variables. deploy it far beyond its scope. Everyone When a new instance of Bash launches, failure in people…” knew in the 1990s that when you it searches for these environment execute a UNIX command with variables and interprets them as trying to see if several IPs owned by the untrusted input, you clear away the function definitions. Once the function institution were vulnerable to a environment variables first. Anyone that definition has been terminated, it will vulnerability, CVE-2014-06271”. has untrusted input embedded within a interpret arbitrary commands after this, Google and were quick to shell script does not know what they due to a lack of constraint in explain the steps each had taken to are doing…”

6 LXF191 December 2014 www.linuxformat.com Newsdesk

OPEN SOURCE STREAMING Newsbytes

Debian Installer Jessie Beta 2 is out now and ready for download, The OS letting you test the latest Debian 8 version. While previous versions of Debian 8 have used the by default, the new beta Chromecast sees the return of Gnome. You can download the beta from http://bit. ly/DebianJessieB2, though Matchstick could do the job better running Firefox OS. remember that this is a beta version, so there will be bugs. Backblaze has released its oogle’s Chromecast device has been a It also includes an 802.11 b/g/n wireless receiver regular state of the hard drives pretty big success, thanks both to a low for connecting to wireless networks. The creators report, and it’ll make uncomfortable Gprice and an easy to use, plug and play want the hardware to be truly open, so reference reading for some HDD manufacturers interface. Not everyone is pleased, however, and designs and hardware schematics are available – and the people who use their drives. It’s bad news for Seagate in particular, despite it being built on the Linux-based Chrome for download from http://bit.ly/MatchstickDL, with the failure rate of its 3TB drives OS, many are finding it too closed for comfort. so if you have the right knowhow, you’ll be able to jumping from 9% to 15% compared to forward, then, the Matchstick, which has build your own Matchstick. As the creators say January 2014. Western Digital’s 3TB blown past its Kickstarter funding goal of “Our goal was to make a streaming stick that was drives didn’t fare much better, with the $100,000 in just one day. Like the Chromecast it low-cost, high design, and adaptable without the failure rates jumping from 4% to 7%. plugs into a HDMI port and can stream media, walled garden for developers that tends to slow connect with other wireless devices and play nice progress … It’s what Chromecast wanted to be.” with online services, such as Netflix. It should also give the Chromecast a run for its money price- wise, with a handy $25 pricetag. What sets the Matchstick apart from Chromecast is that it’s the first streaming device to run on Mozilla’s open source Firefox OS. According to the makers of Matchstick, they went with Firefox OS because of its adaptable nature. Backblaze knows how important They hope this will lead to lower production costs, reliable hard drives are. and without the need for app approval, it may encourage a huge library of apps to appear. Earlier in the year the Linux The hardware included in the Matchstick Foundation began issuing its own features a dual-core Rockchip 3066 processor, Matchstick is an open source equivalent to Certified SysAdmin (LFCS) and 4GB of on-board storage and 1GB of DDR3 RAM. Chromecast for cheap home streaming. Certified Engineer (LFCE) certifications, and as well as it open online course all have been roaring successes. As Dan Brown, the Linux LINUXPHONES Foundation’s PR & Marketing Manager, recently disclosed, “The Intro to Linux Massive Open Online Course (MOOC), which can help with basic prep for the LF Certified Ubuntu Touch SysAdmin Exam, has had over 270,000 registrations from 100 plus Canoncial’s reaches RTM status. countries.”The certified exams are e might have given up hope of seeing installed and officially supported, you won’t have pretty tough, though, with a rate of below 60%. However, 80% of the Ubuntu Edge after it to wait too long either. people who’ve taken the exams would failed to reach its $32m kickstart goal. The MX4 should be released around W recommend a friend taking the However, that doesn’t mean ’s vision of December, and it will run Ubuntu Touch right out certification as well. Ubuntu on is dead. of the box. In fact, there will be two different If anyone ever says that Linux Ubuntu Touch,the mobile version of its distro, versions: one running Android, the other being a has no games, you can now has just reached RTM (Release to Manufacturing) slightly more powerful ‘Pro’ version of the officially laugh in their face, as Steam status, which means it’s been fixed for bugs and smartphone with a Exynos 5430 processor, 4GB has just passed the milestone of ready to go. If you’re that way inclined you can of RAM, and a 2560x1536 resolution screen having over 700 games available for download the RTM version of Ubuntu Touch right running Ubuntu Touch. Linux. While things might have gone a now from http://developer.ubuntu.com/start/ We’re still not too sure on how much Ubuntu bit quiet on the SteamOS side of ubuntu-for-devices/installing-ubuntu-for- phones will cost, though earlier this year things, which is a Linux distro specially devices and install it on your Android phone. Canoncial’s said that they made by Steam developer’s Valve, Of course this does come with a number of would “come out in the mid-higher edge, so $200 gaming on Linux continues to go from strength to strength. potential dangers, so if you’d rather wait for a to $400”,and if anyone is in a position to give an phone to come along with Ubuntu Touch pre- educated guess, it would be Shuttleworth.

www.tuxradar.com December 2014 LXF191 7 Newsdesk

Comment Hitting the mirrors Civility is What’s behind the sofa? free too GHOSTBSD 4.0

Michael Meeks GhostBSD 4.0: The major new version of the FreeBSD 10-based Lennart, of operating system will be available Systemd to download by the time you read this. It’s the first release of the 4.x fame, recently branch and brings with it Mate as published a the default desktop environment, blog saying that open source communities are The latest major version of Clang as the default compiler, GhostBSD is based on FreeBSD 10.. not all rose-gardens of tolerance, gentleness pkg(7) as the default package and happiness. Indeed his thesis is that some management utility and GCC no use a USB stick, and you can go communities are quite sick in that regard. longer installed by default.Youcan ahead and grab the image from That this is news, is quite interesting in itself. either burn the ISO to a DVD or www.ghostbsd.org/download-4.0 What changed to make people interested in this topic? The Linux Kernel community has always CHAKRA GNU/LINUX 2014.09 been one where good coding seems to happen despite occasional foul-mouthed tirades from Chakra GNU/Linux series, which will follow the 4.14 KDE Linus. Ever since I’ve been involved with free 2014.09 is a Linux distro releases. A noticeable change in this software people have ‘flamed’ each other quite for desktop PCs that release is the major face-lift of immoderately with a surprising level of bile. uses the Pacman Kapudan, which now gives the option Indeed, as the internet gains widespread .The KDE 4.14 to users to enable the [extra] desktop comes as default, and in the repository during first boot so they traction, hacker culture’s terms like ‘troll’ seem release announcement more can easily install the most popular to have disseminated into wider society. With changes have been detailed.“The GTK+-based applications”.Youcan an ever larger supply of semi-anonymous Chakra team is happy to announce download the distribution from people, the set of those willing to heap abuse the first release of the Chakra Euler http://chakraos.org/home/?get grows; along with weak social structures to help suppress that. OPENELEC 4.2

The latest stable release Douse the flames of OpenElec has, a distro Of course, Lennart’s concerns are around the designed for media bile generated about Systemd; a topic whose centre PCs, has hit the controversial nature will inevitably fade with mirrors, ready for download. Changes in time as all major distros switch to using it. this version include an Naturally there are those who agitate for update to Linux Kernel extremely broad codes of conduct backed by 3.16, updated Nvidia graphic driver support for the 64-bit version of the distro coercive rules to exclude people they don’t like. and XBMC has been updated to XBMC Gotham 13.2. Download OpenELEC 4.2 I’m a sceptic of that approach. Instead with from http://openelec.tv/get-openelec/download. clear, positive leadership by example it seems possible to keep discussion polite on mailing LINUX KERNEL 3.17 lists.PartlyIhaterulesbecauseIwantto The latest stable Linux Kernel, 3.17 include myself - at least other awkward, is now available. It includes a under-socialised, poor-communicators can be number of hardware and stability some of the brightest and best developers. updates, including Nouveau driver In LibreOffice-landwealsohelptode-louse improvements for Nvidia’s latest communication problems with weekly, high- GPUs, Xbox One controller support bandwidth phone calls to try to make the (though without vibration support projectafriendlierplacetobe;whynotget at the moment), and support for Rockchip RK3288 and AllWinner involved and join one? A23 ARM SoCs. You can find out more at www.kernel.org. Not early, but Linus is happy. Michael is a pseudo-engineer, semi-colon lover, SUSE LibreOffice hacker and amateur pundit.

8 LXF191 December 2014 www.linuxformat.com

THE BEST AMAZING 4K SCREENS Z97 MOB GPU LAPT N A BUDGET REMOTE LOGIN DOUBLE DISPLAY SUPER START ACCESS A WINDOWS PC HOW TO MANAGE YOUR MAKE THE START MENU ¤ MA ¤ 17-INCH AOR IIYAMA B2888 ANYWHERE ON EARTH MULTI-MONITOR SETUP EVEN MORE POWERFUL VII FORMUL V2 ON TEST SU REVIEWED

Includes guides for ISSUE 297/NOVEMBER 2014 Windows 8 as well! 8-CORE SENSATION! ST 100 EVER CPU WINDOWS SECRETS redefines performance EXCLUSIVE UNLOCKED Inside 's Discover new ways to speed up your PC, game-changing 5960X ¾[SUREOHPVVDYHWLPHDQGPXFKPRUH TESTED The new CPU, 6(LJ8ƺ,ǝ< ǜ3(ǨƮDŽ/ STREAM X99 mobos and RAM LOCK DOWN YOUR YOUUUR PLUS How to overclock DOCUMENTS MEDDDIA Haswell-E to 4.4GHz 7KH VLPSOH JXLGH WR NHHSLQJ \RXU 66HQG PXV LF YLGGHR folders safe and password protected DQG SKKRWRV DURXQGG \RXUU 100 2014 ISSUE OCTOBER FREE DISC! KRPPH BUILD IT! 015 GAMES NOVEMBER 2014 PACKED WITH 7NJ67NJ' 40 ESSENTIAL APPS BEST FOR PRINTED IN THE UK UK THE IN PRINTED A FULL HD REVIEW UK THE IN PRINTED DO ALL THIS AND MORE… ALL NEW PCS GAMING PC 16 games worth getting ‡ %RRVW\RXUKDUGGULYH We help you to buy

£ ‡5HPRYHPDOZDUH

cited abo t iht £ 5.99 5.99 the r ght or WITCHER 3 ARKHAM KNIGHTS ‡ *HWEHWWHUSULQWV 5.99

( WDEOHW ZLWK FRQÀGHQFH FOR £468 £6.49 Outside UK & RO Turn to p98 now! PLUS THE ULTIMATE PC BUYER'S GUIDE Windows tutor als New things to do Buying advice Help & support 100% jargon free

SAVE UP TO 45% SAVE UP TO 45% SAVE UP TO 40% SAVE UP TO 70% SAVE UP TO 50% FROM £25.49 FROM £23.49 FROM £25.49 FROM £15.99 FROM £23.49

INCLUDES DVD VIDEO | SAMPLES | TUTORIALS

DVD missing? Ask your vendor

SAVE UP TO 40% SAVE UP TO 55% SAVE UP TO 40% SAVE UP TO 35% SAVE UP TO 50% SAVE UP TO 50% SAVE UP TO 40% FROM £26.49 FROM £12.99 FROM £17.99 FROM £22.49 FROM £20.99 FROM £21.49 FROM £25.49

2 easy ways to order

/Z501 Or call us on 0844 848 2852 quote Z501 Lines open Mon to Fri 8am – 9.30pm and Sat 8am – 4pm

Savings compared to buying 2 year’s worth of full priced issues from UK newsstand. This offer is for new print subscribers only. You will receive 13 issues in a year. Full details of the Direct Debit guar- DQWHHDUHDYDLODEOHXSRQUHTXHVW,I\RXDUHGLVVDWLV¿HGLQDQ\ZD\\RXFDQZULWHWRXVRUFDOOXVWRFDQFHO\RXUVXEVFULSWLRQDWDQ\WLPHDQGZHZLOOUHIXQG\RXIRUDOOXQPDLOHGLVVXHV3ULFHVFRUUHFWDW point of print and subject to change. For full terms and conditions please visit: myfavm.ag/magterms Offer ends: 31st January 2015 Write to us at Linux Format, Future Publishing, Quay House, The Ambury, Bath, BA1 1UA or [email protected]

In the dark! I have recently gone from a PC Letter of the month running Windows 7 to a MacBook Pro, which I spilled milk on, back to an Acer Aspire Unification running Windows 7 Starter. I upgraded the 7 Starter to would like to share with Linux readers a Windows 7 Home Premium only challenging matter about having ‘one to have tell me it could powerful instead of the not be validated although it was I many that we have now’. I feel we need indeed a legal copy of the OS one united and properly supported Linux which was supposed to have an distribution, like MacOS or MS Windows. ‘Anytime upgrade.’ There are a lot of Linux distributions and over I decided to walk away from the past 16 years only five main distributions Windows on the and I have been properly supported while the others intended to do a dual-boot and are dying slowly! DistroWatch.com, for instance, went with Ubuntu. Not fully lists over 270 Linux distros. Imagine if we had realising what I was doing, I one main Linux distribution, properly supported made a mistake and wrote over from big companies for driver updates and the Windows 7 Home Premium security issues, I’m pretty sure that even The Linux has a myriad range of distros, dare we leaving myself only the Linux notebook and PC manufactures would use that say it’s time to have One (to rule them all)? Ubuntu. What a surprise! one distribution instead of Windows. Gathering I spent maybe five hours all open source’ members for one united More widely I think the breadth of distros setting up the Netbook. It went powerful Linux distribution. I hope we’ll see that enables multiple flavours to be developed for well, except I found that Linux soon in the near future. specific tasks. Ubuntu/Mint for desktops, RedHat/ seems to like HP printer drivers Mohee Jarada CentOS for server on a macro level, but delving more than Canon MX430 Neil says: I certainly appreciate your sentiment down into things like Puppy and Uber Student drivers, But persistence paid off and there is truth in the “divide and rule” phrase they’re all targeting specific needs. and I finally located them and Caesar made famous. But in terms of drivers this I also think the idea of taking on Microsoft is an now my printer is set up. is already the case, the Linux kernel is used outmoded one. Depending on who you talk to I’m age 74 and find the switch across all distros and encompasses the drivers Linux has already won: in the server and enterprise from Windows 7 to Linux quite already. While many major software and services space, on mobile with Android and on embedded surprising. So far the printer are developed in a centralised way. So in many appliances. It’s just the pesky consumer desktop/ drivers has/have been the only ways what you want is already the case. laptop market that remains stuck to the teat. challenge and that was minimal. The netbook surprisingly boots up, from power on until I’m the headline Escape Windows Now for a question: Is it possible Also, please could you suggest ready to use it in a mere 35 recently I just wanted to let you to put on the same some teaching and learning seconds; Windows 7 took at and your readers know it is drive along with Ubuntu? I ask sources that an old man can least four to five minutes. Since pretty easy to escape if one has because I want to test both turn to? Linux Format magazine has used the desire. before finally settling on one. John Colyer

[email protected]

www.tuxradar.com December 2014 LXF191 11 Mailserver

have experienced the same issue loads of stuff out there googling on ‘wget resume broken download’ - minus the single quotes, of course. D Schmittz Neil says: Thanks for the update, I’m sure there’s a host of people that will find it helpful to know that they can use the -c option to continue stalled downloads. Open Print Is there a Linux Driver for an Epson WF-7610DWF A3 Printer? Neil says: I know Neil Bothwick often gets queries about printer drivers on Linux. It’s one of those ridiculous situations where all manufacturers have to do is support the open standard OwnCloud is a great idea, but it’ll make you realise the responsibility involved in protecting your data. Postscript and everyone will be happy. As it is, the usual route is Neil says: Another escapee, on page 71 that you will explore attacker may be able to get the via www.openprinting.org but welcome to the world of software the new features in LXF190. I same access to your machine as Epson maintain its own at http:// freedom! I think your experience is have been using Owncloud at the Apache process has. Running bit.ly/1i73ivy search for Epson a mirror of most people’s – Linux home within my home network Apache in a chroot jail is a good WF-76010 and you’ll find at least a tends to just work these days, bar for a little while and really like it, start, but no silver bullet. Here’s a couple, which while might not the odd driver issues, which but I have been nervous about guide for Ubuntu: https://wiki. offer full scanning features should everyone expects even with forwarding the ports to allow ubuntu.com/ModChroot. A hip offer printing ones. Microsoft systems. To answer your access externally in case I have alternative is to use a Docker question you can dual-boot Linux not configured Apache correctly image. Try https://registry.hub. IceLinux OSes and Linux with Windows. to be secure. Would it be docker.com, there are plenty Erik the Red deliberately gave You just need to ensure you resize possible for you run a tutorial available which contain a known- the land he discovered the more your existing partition with showing how to set up Owncloud good Apache/PHP setup and will appealing name ‘Greenland’ than Gparted or similar to enable room securely, ie covering what needs auto-update as new versions of ‘Iceland’ (where he’d come from) for the new OS. Linux to Linux to be done correctly with Apache OwnCloud are released. reasoning that ‘People would be dual-booting is usually painless or Nginx as well as in Owncloud attracted to go there if it had a but if you reinstall Windows it’ll itself, so that anyone running a Restart favourable name’.But look at the wipe out Grub, which will require Linux box at home with a router In reference to the letter from Linux product names: you to recreate the bootloader can use it? Peter Lonsdale in LXF189 The terrible ones KDE, with something like Rescatux David Whiting reading between the lines of Gnome, Gimp, , Ekoga, (more on that in LXF192). For Jonni says: Hope you enjoyed the what Peter wrote if this is a , Glade and . resources Neil Bothwick would say OwnCloud followup, David. It’s broken download issue, then The better ones Writer, read the man pages, but you can good to be prudent about running using command line wget with , Kmail and . try this starting point: http://bit. internet-facing services, but there the -c parameter will resume a The even better OpenOffice, ly/1BgSnF3 isn’t an easy answer to your query. broken download from where AbiWord, Firefox, Thunderbird There might be unknown the it left off, without having to and . OwnSecurity vulnerabilities in any of Apache, download the entire download Now take a guess which of I’m pleased to see Owncloud 7 PHP or OwnCloud, so no matter again. It works, I too have a these, and other names actually covered in LXF189 and the note how much you lock ‘em down an similar download speed and mean something to the Average Joe?! And I’ve not mentioned Gnus, Knode, Pan, Lifera and Akregator. I don’t have to explain why most people like and understand what apps like MS Office, Excel, Outlook and AutoCAD do. To the point: Some great programs and utilities, but the names – It’s time that someone take the initiative and changed this practice, and as I see it that could be Linux Format as the best Linux mag around. Edvard Koren, Celje Slovenia

12 LXF191 December 2014 www.linuxformat.com Mailserver

32-bit one. You can also type top /proc/cpuinfo and attempt to search for your processor details that way. When you say “get rid of” if you’re dual-booting with a Grub bootloader you could remove the partition using Gparted, or you could just install a Linux OS over everything on the drive, though obviously back up everything that you want to keep beforehand. As for the BIOS/UEFI this is something your PC comes with installed as its firmware. It’ll either have a BIOS or UEFI, you’re not able to ‘upgrade’.There can be a level of confusion as UEFI systems do offer a BIOS compatibility mode, which looks Installing Arch will give you a great insight into how Linux is put together. identical to an old BIOS. In this case you’re able to switch back to Neil says: You’re right, Linux The scary trend toward the Neil says: What a wonderful idea. UEFI mode. Hope that helps! Format is the best Linux magazine ‘Windows Registry’ approach In certain aspects we have around, I say entirely objectively. worries me too! touched upon areas of this, such tip Let’s face it Linux is built by Now I realise that many as our guide to Gentoo in LXF182 Why is it that the keyboard coders, developers, engineers and people want their systems to and our Arch guide in LXF188.By sometimes stops responding on enthusiasts not marketing and PR ‘just work’, but I’d love to see if their very nature you have to start a browser left-click when the people and let’s thank the digital it’s still possible to do it the from scratch and ‘bolt’ on the bits mouse is on an empty part of gods for that, as an OS built by ‘good old linux way’ of taking a you need, including the desktop the screen and the keyboard marketing and PR people would bunch of applications that do and windows managers of your doesn’t respond. That’s not my be, well, I shudder to think. their job really well and fasten choice. But aspects, such as X, are main question, though: why The side effect of that is perhaps them together in a way that often used in their default form as does my Ubuntu 13.04 say project names have been suits the user’s preferences. they are automatically installed Kubuntu on startup and somewhat more TLA based than So, here’s a tutorial There’s a plan to cover ‘cutting- shutdown when it has the promotionally based. But on the suggestion that’s been tickling edge’ Linux features in a future desktop? whole I don’t think it matters. me for a while. How about taking issue, but I’ll give your approach Ian Learmonth Who actually needs to know what us from a vanilla install of a some thought. Neil says: Yup, we’ve had that KDE is other than developers and distro (with no X, desktop or keyboard issue on a few distro builders? You’re right it ) and talk us Questions occasions. We assume it’s highlights inward-looking nature of through installing X; the I’m a long-time reader with a few something pulling . As for Linux development, but user difference between a desktop questions. How do I tell if my your Kubuntu issue we think this engagement is with the final (Gnome, KDE etc) and a window machine is 32- or 64-bit? It’s must be the Plymouth distros, which are doing a fine job manager (E17, , about 7 years old. How do I get splashscreen that Ubuntu uses of being more welcoming. etc); and then take us through rid of XP? I have been using Mint for the Kubuntu image. It’s usually installing a window manager 16 also. Can I replace the BIOS because you’ve upgraded to try Nuts and bolts through options around panels, with UEFI and should I do so Kubuntu at some stage. To refresh One of the things I’ve loved menus, shortcut keys and with a 32 bit or 64 bit machine? the Plymouth configuration try about Linux is its modularity and applications, so that we end up Edson sudo update-alternatives --config ease of configurability through with a customised desktop Neil says: So many questions! default.plymouth the editing of text files and the where we’ve made the choices. A machine is 32- or 64-bit based sudo update-initramfs -u freely available documentation We’d also have to look at the on its processor. Within Linux you and that should fix it. LXF that has enable me to have fine- login options (GDM etc) that are can open a terminal and type grep grained control over various available and their pros and /proc/cpuinfo. This returns a Write to us aspects. I must admit to being cons. It would be great to know bundle of flags that indicate the concerned over the last two which are the config files X CPU’s capabilities such as: Do you have a burning Linux- years at the push toward tightly opens as it starts up and how flags : fpu vme de ... tm pbe nx related issue that you want to integrated desktops and the different components of a lm constant_tsc pni ... discuss? Want to speculate about automated configurations, working desktop are loaded up. In the middle of that lot will be how we can read your minds? which, while they make our How do the different libraries one of three (really two) options Then write to us at Linux Format, easier, rob us of the freedom of (GTK, Gnome, etc) come into lm, rm or pm. Long mode (lm) Future Publishing, Quay House, The Ambury, Bath, BA1 1UA or choice and often frustratingly play? How do we handle alerts indicates a 64-bit processor, Real alternatively send an email to: begin to ‘think on our behalf’ and and notifications? mode (rm) is a 16-bit processor [email protected]. make our decisions for us. Theo Groeneveld, S Africa and Protected mode (pm) is a

www.tuxradar.com December 2014 LXF191 13 0U[YVK\JPUN H NSVIHS [LJO IYHUK [OH[ WYVTPZLZ [V JOHUNL [OL ^H` `V\ JVUZ\TL [LJOUVSVN`

*V]LYPUNN [OL PU KLW[O SH[LZ[ ULL^ PU KL[HPS [LJOUVSVVN` M\SS`[LZ[LK` NLHYH

    Linux user groups United Linux! The intrepid Les Pounder brings you the latest community and LUG news. Find and join a LUG New jam in the UK capital

Blackpool Makerspace Meet every Saturday, Les Pounder saysthisisjamhotinthebigbadcity. 10am to 2pm. At PC Recycler, 29 Ripon Road FY1 4DY. aspberry Jams keep spreading one of many! If you live in London and http://blackpool.lug.org.uk across the world from Dublin to are interested in what you can do with Bristol and Bath LUG Meet on the 4th R Dubai, and the latest addition is the Pi … bring one along and make it a Saturday of each month at the Knights Templar (near in London at the Covent Garden Dragon fun day for all the family." Temple Meads Station) at 12:30pm until 4pm. Hall Trust. This event was started by Frank has done exceptionally well to www.bristol.lug.org.uk Frank Thomas-Hockey, a parent and start a new jam in the UK capital. Edinburgh LUG Meet on the first Thursday of passionate Raspberry Pi enthusiast. Finding a central and easily the month at the Southsider pub, West Richmond St, We asked Frank what makes the commutable location in London with Edinburgh. www.edlug.org.uk Raspberry Pi so special: “It’s a great enough space isn’t an easy job, so If you Hull LUG Meet at 8pm in Hartleys Bar, Newland way to see the versatility of Linux in live in the area and have a Raspberry Pi Ave, 1st Tuesday every month. http://hulllug.org action,”says Thomas-Hockey. “I feel project to show off or want to know that the Raspberry Pi is the best value what to do with your Pi, please support Lincoln LUG Meet on the third Wednesday of and most versatile little PC in the world, this worthy venture. the month at 7pm, Lincoln Bowl, Washingborough enabling anyone to make the step into The Covent Garden Raspberry Jam Road, Lincoln, LN4 1EF. www.lincoln.lug.org.uk hardware hacking and coding via an will take place on November 29 at 1pm. Liverpool LUG Meet on the first Wednesday of affordable means. The Raspberry Pi Youcan find out more details via the the month from 7pm onwards at the Liverpool Social also has a remarkable community Eventbrite site: http://bit.ly/ Centre on Bold Street, Liverpool. underpinning all of the good work done CoventGardenRaspJam LXF http://liv.lug.org.uk/wiki by the Foundation.” Manchester Hackspace Open night every “From Sonic Pi to Wednesday at 42 Edge St, in the Northern Quarter of Minecraft and then to small Manchester. http://hacman.org.uk robot armies, the Pi is Surrey & Hampshire Hackspace Meet unlimited in potential, weekly each Thursday from 6:30pm at Games Galaxy requiring an inquisitive in Farnborough. www.sh-hackspace.org.uk mind and inventive spirit. I’m excited to be joining Tyneside LUG Meet from 12pm, first Saturday Alan O'Donohoe's jamming of the month at the Discovery Museum, Blandford community and this will be Square, Newcastle. www.tyneside.lug.org.uk the first event, so let's make the first event at dragon Raspberry Jams cater for all ages. If you’re stuck (http://dragonhall.org.uk) you can always ask the kids for help! Communityeventsnews

place in September, there were one-day software development E&C Mini Makerfaire demos from Simon Walters conference. /dev/winter is your The popular Elephant & Castle (Scratch GPIO5) and Tim Gibbon chance to learn the latest skills in Mini Makerfaire will take place on (Minecraft) and a talk from Pete the devops, via workshops and 15 November at the London Lomas from the Raspberry Pi talks. Devops is a constantly College of Communication this Foundation. Tickets are free and changing field that involves many year. Makerfaires are massive you can find out what’s going on new and rapidly evolving show and tells, with projects via the jam’s official website. technologies, such as NoSQL, from around the world rubbing Blackpool Raspberry Jam http://blackpoolraspberryjam. Node.js and . shoulders and swapping ideas. Another Jam has sprung up in co.uk Hosted in Cambridge on January This makerfaire has played host the UK, this time in Blackpool. 24 2015 this event has limited to many great projects, but also This Raspberry Jam meets on /dev/winter places so please follow @dev_ has a great family feel to it, so the 3rd Saturday of the month at Following on from the successful cycles on Twitter for the latest take the kids for a fun day of arts, Palatine Library from 1pm-4pm. /dev/summer, devcycles.net are ticket information. crafts, robotics and electronics. At the first event, which took returning for another seasonal http://devcycles.net http://bit.ly/ECMiniMakerFaire

www.tuxradar.com December 2014 LXF191 15 SERIOUS ABOUT HARDWARE?

NOW ON APPLE NEWSSTAND Download the day they go on sale in the UK!

PERFORMANCE ADVICE FOR SERIOUS GAMERS ON SALE EVERY MONTH All the latest software and hardware reviewed and rated by our experts LG 34UM95 Welcome to the wonderful world of extra-wide, widescreen. Jeremy Laird sits back and enjoys the extra desktop real estate he now owns.

n the days of old we’ve seen 21:9 video is actually hard In brief... displays with limited 29-inch 1080p coded in 16:9 with black Ivertical lines, this latest generation bars inserted into the An ultra-wide, ups the ante to 34 inches. Immediately, video stream. ultra-HD monitor that provides tons this helps to mitigate the old 29-inch As for the LG of desktop space form factor’s visual shallowness. The LG 34UM95’s raw image and a great game is so big your initial thought is no longer quality, we’re not experience, but “crikey, this thing is like looking through absolutely blown it's far from a letterbox”. away, to be honest. perfect and at this price you might Then there’s the resolution. We’re The specs say it is a want to see how now talking 3,440 x 1,440 pixels. Yep, native 8-bit panel the market the same vertical count as the with dithering to mimic 10-bit evolves... popular 27-inch segment and its 2,560 in terms of colour depth. But x 1,440 grid. Instantly, our previous subjectively, its look is somewhat objection melts away. Okay, we’d prefer redolent of the cheaper 6-bit IPS it was even better. 1,600 vertical pixels panels on the market. would be nice, but the vertical At default settings the objective Specs resolution is certainly no longer an metrics show good details in the white For a gorgeous instant turn off. Instead, we reckon scales and perhaps a hint of detail loss desktop and amazing Size: 34-inch you’ll be massively turned on by the in the black scales, but nothing too ugly. gaming, choose 21:9. Type: IPS sheer visual spectacle. The viewing angles, meanwhile, are Res: In games, you don’t actually look absolutely fantastic and colour 50Hz. In practice this isn’t too awful, 3440x1440 directly at the edges of the screen all gradients basically look great. although we did notice some slightly Refresh: 60Hz that much, which makes it sound like Less pleasing is the cheapo tilt-only odd judders. Instead, it’s DisplayPort Response: 5ms they’re redundant. But they do serve a stand. Yes, you can dismantle it and that offers the full 60Hz experience. It’s Inputs: purpose, as proved by this widescreen rebuild choosing one of two heights. not as nice as 120Hz-plus, but you DisplayPort, LG as it gives you a much more life-like But it essentially offers very little simply can’t have everything you want HDMI, filling of your peripheral vision than a adjustment, which is disappointing at in a monitor right now. LXF Thunderbolt normal monitor. Suddenly, every other this really rather adventurous price screen you’ve used looks like a point. As it happens, we suspect the miserable little window into your price is partly down to the inclusion of a Verdict gaming world, whereas this one truly Thunderbolt interface, allowing for immerses you in the action. It’s one of compatibility with the latest Mac Pros. LG 34UM95 those things that’s almost impossible to Meanwhile, that in turn might explain Developer: LG Web: www.lg.com appreciate until you’ve tried it. the Apple-esque tilt-only stand. It’s also Price: £770 worth noting that the external power Features 8/10 brick is huge. Back to black Performance 8/10 Of course, there are issues with the 21:9 Another minor issue involves display Ease of use 9/10 aspect ratio. Standard HDTV content is interface compatibility. This is a fast- Value for money 5/10 16:9, which means you end up with evolving subject, what with various Ultra widescreen is intoxicating and black bars on either side. In practice, iterations of DisplayPort and HDMI super-cool. But wait a few months for watching 16:9 content turns the LG into appearing soon or mooted for the the price to hit £500 later this year. something akin to a 27-inch monitor. To future. But as things stand with HDMI make matters worse, a lot of streaming 1.3, you can’t drive this display at 60Hz. Rating 7/10 web content that contains 21:9 aspect The bandwidth available only allows for

www.tuxradar.com December 2014 LXF191 17 Reviews Android Wear Motorola Moto 360 The first Android Wear watch from Motorola certainly has the looks... But Matt Swider wonders if it’s really of any use.

oto 360 proves that In brief... can be as fashionable as Google Now Motorola’s first M ever bit of Android software is functional, making it the first wrist-based Android Wear watch worth strapping to technology – and your wrist. Its circular watch face takes it does a lot more cues from stylish designer wristwatches than just telling with analog tickers, not square-shaped the time...! smartwatches like the very computerized-looking Pebble Steel, Gear Live and LG G Watch. The watch's charm is shortened by its lack of longevity, but Motorola clearly shaped a winner that's more ambitious looking than the overly boxy Apple Watch. And its price point is equally impressive. It's on sale right now for $249 in the US and for £199 in the UK. Moto 360 has style and substance, just not battery life or a reliable processor. There are few sharp-edged downsides to the Moto 360, and none when swiping through Android Wear directions on the watch while starting of them can be found on its round, 1.56- menus, almost as if you didn't apply the full route mapping on your phone. inch LCD display with its 205 pppi, 320 enough pressure on the . Google Fit is here too. It uses the x 290 resolution display. In fact, Even with its decent 320mAh battery, watch's built-in pedometer and heart Motorola's enterprising circular screen the inefficient processor taxes its weak rate monitor, counting up the metrics is so attractive it instantly became the battery life before it shuts down, which on small-scale graphs and timelines. antithesis of the argument is poor. Inside is 512MB of memory and Motorola promises future updates when Google first announced Android 4GB of storage, as every other Wear including the ability to recognise when Wear in March 2014. device. There’s no GPS, but there is a you transition from running to cycling. The screen always remains on and heartrate sensor and pedometer. The Moto 360 is compatible with all the Moto 360 use an ambient light Android Wear is the same as on Android 4.3 Jelly Bean and later sensor that automatically adjusts the every other current device. It has a devices, largely dictated by the need for LCD brightness. It's especially familiar card-based interface lifted from 4.0 LE support. Android 4.2 convenient when you need a bright Google Now and Google Glass, and it and earlier owners are out of luck, so screen in sunny conditions, or if you often slides contextual information onto are iPhone owners. It’s mostly want to reduce battery life consumption the screen in addition to text messages waterproof, with an IP67 rating or 30 in dark environments. and important email. minutes in up to one meter of water. Inside, an ailing Texas Instruments Sliding your finger left explores the The device has its own Qi wireless OMAP 3 processor makes this digital pop-ups a little more with little charging dock, but it needs it as it didn’t smartwatch tick. There is occasional lag touchscreen interaction needed. work with any other chargers... LXF Android Wear is designed to predict what you want to know, so commute Features at a glance times to places you've searched, Verdict frequently visit and add to your calendar appointments should Motorola Moto 360 automatically slide into view. Developer: Motorola Web: www.motorola.com/moto360 There are now 44 featured apps that Price: £199 are part of the Google Play Store's Features 7/10 Android Wear section. Glympse is Performance 6/10 particularly useful on a watch because Ease of use 9/10 it sends your location to contacts of Value 7/10 your choosing. Say "Okay Google, start Moto 360 has practical information Many faces Notifications Glympse" and send them your real-time on the virtual dial, but terrible battery Its stainless steel frame The screen is ideal for GPS coordinates in an instant. Google life and a slow processor... will match the forthcoming popping up notifications Maps is still one of the most useful metal bands nicely. trivial or vitally important. Android Wear apps. Asking Moto 360 to Rating 7/10 "navigate to..." initiates turn-by-turn

18 LXF191 December 2014 www.linuxformat.com NAS Reviews Thecus N4560 A mid-range smart NAS from Thecus has Neil Mohr considering if he really needs a any more?

hy choose a NAS over a low- In brief... cost home- or mini-server? W It's something we're looking A full-featured, at in LXF192, but with models like this 4-bay NAS drive Thecus N4560 the level of functionality from Thecus that offers interesting you gain from an advanced NAS is HDMI output and pretty stunning. This model, released XBMC integration towards the end of 2013 but still based around an current, is of interest as it's based on an Intel Atom SoC Intel CE5335 dual-core Atom running at and a browser- based interface 1.6GHz dubbed the Intel EvanSport that anyone can platform. Older NAS models have been use. See similar a bit wooly in performance terms, but level devices such the introduction of Intel in the market as QNAP TS-421, DS-412. should eliminate any bad performance for this model. The Thecus N4560 is a four-bay unit, so we can run a full RAID5 or 6 with support for up to 4TB drives or Never has a big, black box looked so big or, indeed, so damn black. 16TB in total. Using the Intel platform Specs has a number of advantages besides little as the star of the show is the web- competitive with straight read/write file the processing power, including the based interface ThecusOS 6.1, it's copy speeds of 96/78MB/s. CPU: Intel Atom SoC CD5335 Gigabit networking, media handling attempting to be as slick as the While the Thecus is certainly Memory: capabilities, including HDMI and S/PDIF Synology interface, but falls a little capable both in terms of speed and 2GB DDR3 out, a video controller, power short. That being said, it's a fully feature set, it’s not priced that well. At LAN: 1x Gigabit management, USB 3.0 support and realised windows interface accessed this price for a diskless setup it’s more Bays:4xSATA DDR3 memory support of which there's through your browser and it works a expensive than the competition: the 2GB in this model. treat. We'd also mention you can turn likes of Synology, QNAP and Buffalo USB: 1x USB 3.0, 2x USB 2.0 Setting up the device is very on SSH and access it via a terminal. offer similarly priced units with dual Ports: HDMI, straightforward as it uses quick-mount The list of capabilities are somewhat LAN or populated with disks. We can’t SPDIF drive bays, which are standardised too long to list right here but it's pretty help but feel some of the additional Size: across the Thecus range. The device will much everything you could ever features offered are somewhat surplus 226x165x192mm automatically establish a suitable RAID possibly want from basic user/group to requirements and perhaps push up 4.7Kg when it's run for the first time. Thecus quotas and access to Active , the price beyond what it needs to be – RAID: 0, 1, 5, 6, offers a Chromium-based quick-find iSCSI, NFS and LDAP support. However, and we’d also prefer a second LAN port 10, JBOD app for Linux (Mac and Windows users other key services include RAID over the HDMI. That aside, if you can have an Adobe Air tool) but this does encryption (hardware accelerated), this up at a more reasonable price little more than locate the NAS on the UPS support (via USB), (S)FTP,UpnP, then it will be as competitive as network and offer a link. This matters printer server, /, web- anything on the market. LXF based photo server, iTunes support, download manager including torrents, Features at a glance full back up service including Rsync and Verdict Apple Time Machine. It supports being a web server with MySQL and directly Thecus N4560 mounting ISO files. Manufacturer: Thecus Web: www.thecus.com Thecus also pushes its XBMC/Kodi Price: £340 playing abilities via the HDMI output, Features 8/10 though this didn’t seem to want to play Performance 8/10 ball for us and we’d question how Ease of use 8/10 genuinely useful this would actually be. Value 6/10 That aside setting up a RAID is A solid, fully featured NAS that Browser interface Open the bay doors delightfully easy, the interface might not offers all the software features It's not as slick as some Offering four drive bays be visually as slick a Synology device you want but is overpriced. NAS interfaces, like helps lift the Thecus out but it’s functional. The inclusion of the Synology, but it does the of the NAS gutter with full Atom processor should make this a trick and is easy to use. RAID6 capabilities. Rating 7/10 speedy device and we found it to be

www.linuxformat.com December 2014 LXF191 19 Reviews Distribution Gentoo Live 2014 Although Gentoo seems incapable of mistake or mediocrity, Shashank Sharma feelstheattempttoimproveuponperfectionhasbackfired...

entoo has the distinction of In brief... splitting the community into Gthose who admire it and those The Gentoo Live who fear it. This stands in stark contrast DVD is filled to the to the community's stance on most brim with apps to please all manners other distros, they either like it or don't. of users. It isn't an The Gentoo Live DVD, despite the name installable distro and heritage, is just another distro. and isn't really Unlike most other Live distros, this designed to serve cannot be installed onto the disk. This is asanewby’s introduction to chiefly why any comparisons with its Gentoo, though. namesake are moot. The DVD isn't designed to entice more users into using Gentoo. It isn't a test bed for Gentoo technologies, hoping to ease users into the Gentoo experience. The The 20140826 release, as if the lack of a more conventional or quotable name Gentoo DVD is a product of the Gentoo wasn't an indication, is an expansive but vanilla Live distro and little else. community with the Gentoo developers assisting in the effort. The DVD comes in two flavours. The you get KDE, Gnome, XFCE, , Unlike the previous releases, Gentoo livedvd-x86-amd64-32ul-20140826 LXQT Desktop and Desktop, which is 20140826 doesn't offer a very smooth version works with 32-bit x86 and a primarily user experience. Gnome crashed on us 64-bit x86_64 architecture. The livedvd- aimed at developers or advanced users. every time we ran it and was tiresomely amd64-multilib-20140826 is only for If you wish to use persistent storage slow, especially compared to KDE, x86_64 systems. Despite being while booting off the USB drive, you will which seems to be the most polished of significantly 'lighter' than the past need to create a EXT partition to store all included desktop environments. release, the DVD is still chock-full of the files. We used fdisk to create the Also unlike the previous release, the applications covering the best that the partition and the mkfs.ext3 command latest DVD doesn't have any diagnostic Linux ecosystem has to offer. to create the filesystem. When you next or system recovery tools. We couldn't boot into Gentoo, select the image you even get Gparted to identify the local Taking stock wish to boot into and press F2. Now disks and partitions. The best thing about the DVD is that it type aufs= in the Kernel line. In contrast to the older releases, the is all you need to demonstrate the You'll have to do this every time you project has chosen to limit the power of Linux to new and interested boot into Gentoo, or when you switch functionality it offers and only really users. In fact, it's not just applications, machines. When booting into the DVD, aims to serve as a means to show off the DVD also includes a variety of at the GRUB prompt, press the function Linux applications. If you have any desktop environments for a fully keys for instructions on using the specific purpose to use a Live rounded experience. It ships with Linux different boot options. environment, the latest Gentoo DVD is kernel 3.15.6 and on the desktop front The project maintains a list of all probably not for you. LXF packages included in the DVD for each image on its website. The list is too vast Features at a glance for us to include in this review. Suffice to Verdict say that all your favourites and regularly used tools are included, along with Gentoo 20140826 several alternatives. Developer: Gentoo Foundation/comm Web: www.gentoo.org There's VLC, Amarok, , and Licence: Various open source licenses more for your multimedia needs. Features 6//10 Internet apps such as web browsers, Performance 7/10 email clients, IM and IRC clients, etc. Ease of use 8/10 and Games, categorised into Arcade, Documentation 9/10 Logic, Boardgames and more, Comes across as a pale shadow of Persistence Mode Choice is good outnumber almost all other types of the 2012 release, with nothing of any You can use persistent Our Gnome experience apps included in the DVD. The real value to offer... mode with a partition on was unpleasant, but the enthusiasts will also appreciate Gimp, the same USB drive that screen serves to show the Blender and various other tools to you're booting from... number of apps on offer. Rating 7/10 channel your creativity.

20 LXF191 December 2014 www.linuxformat.com Distribution Reviews Peach OSi 14.04 Excuse the frown on Mayank Sharma’s face as he tastes yet another fruit-flavoured Linux distro for the new Linux user.

aming a distro after a fruit is a In brief... dead giveaway about its Nintended audience. A quick look Another at its website confirms that Peach OSI Ubuntu-based 14.04 is designed to usher new users distro designed to ease new users into Linux. Almost on cue, the website into Linux. See lists the same old advantages of Linux also: Zorin, over proprietary distros – more secure, PinguyOS, less vulnerable, faster on older Elementary. hardware and such. So it was with some trepidation that we downloaded the distro. However, five minutes with Peach and it had found a place in our hearts and on our hard disk. Peach OSI 14.04 is based on the latest 14.04 LTS release which Peach OSI packs in a lot of functionality but comes at a price. the distro makes it functional on relatively older requires a mammoth 14.4 GB of disk space to park itself. hardware. The modified Xfce desktop features a panel at the bottom that’s loaded with application launchers. The Fuzzy logic time Linux users can also get to the panel is quite literally bursting at the The distro’s websites states that Peach apps by right-click on the desktop. seams with launchers for over 20 OSI includes almost 100 apps in all. However, the brains behind Peach applications – everything from the Besides the popular ones that you’ll find have not ignored their primary Firefox web browser to the KeePassX in other distros such as LibreOffice, audience. All the documentation on the to the Thunderbird, and Ubuntu Tweak Tool, distro’s website is geared towards the photo manager. the distro includes some less common inexperienced Linux user and helps Look through its menu and you’ll but equally useful ones such as familiarise them with terms such as notice that the distro bundles almost Entangle for tethered shooting, Blender MD5sum, repository, etc., to help them every popular Linux app you’ve ever for 3D modelling, Ardour3 digital audio wrap their head around the technical heard of, right off the bat. But the , wxBanker finance jargon. The distro also has a readme file developer hasn’t just packed in all the manager, and Wine along with the on the Live desktop that handholds apps they could lay their hands on. In Winetricks and PlayOnLinux frontends users through installing updates, and fact they have selected the apps for installing Windows apps and games. switching boot loaders. meticulously and listed the reasons for Some of the apps in the distro aren’t For a first release, Peach OSI 14.04 is bundling multiple apps for seemingly native to Xfce and rather depend on aces. It’s stable, well-behaved and the same function. For example, the KDE and Gnome libraries. Kudos to the performs extremely well despite its web browser is bundled along developer for mixing in these libraries loaded cache of apps. If you want to with Firefox, as the former is ideal for and apps without adversely affecting give someone a taste of Linux, get them creating web apps. the distro’s usability. The distro feels to bite into Peach OSI. LXF coherent and functions smoothly even after several hours of usage. Features at a glance Its collection of apps makes Peach Verdict usable straight out of the box, for a wide variety of desktop Linux users. In fact, Peach OSI 14.04 there are even distinct ways to get to Developer: James Carpenter Web: www.peachosi.com the bundled apps. The distro packs in Licence: GNU GPL four different application launchers to Features 8/10 suit all kinds of users and their different Performance 8/10 workflows. There’s the standard Xfce Ease of use 8/10 applications menu that lists all apps Documentation 8/10 broken into categories. There’s also Desktop Linux users who aren’t Loaded with apps For everyone Xfce’s reimagined Whisker menu which averse to an Ubuntu-based distro are The distro ships with many To make it usable for a gives quick access to frequently used encouraged to take a look at Peach. pre-installed apps sourced wide variety of workflows, apps. Then there’s the Mac OS X from the KDE, Gnome and the distro includes four lookalike Slingshot menu borrowed Xfce desktops. application launchers. Rating 8/10 from the Elementary distro. Finally, old

www.linuxformat.com December 2014 LXF191 21 Reviews Tonido Raspberry Pi As a long-time ownCloud user, Mayank Sharma wonders if this space has room for a .

e’ve favourably reviewed In brief... Tonido for Linux in the past W and now the file- A self-hosted sharing server is available for the file sharing server Raspberry Pi. If you haven’t heard of for the Raspberry Pi. See also: Tonido, the software allows you to ownCloud and access your files and media on a Seafile, etc. remote computer. it’s also available pre- installed on a small plug computer with and USB ports. Tonido’s simplicity extends to the Pi version as well. To get it up and running, you just need to download Tonido’s compressed archive on the Pi, extract its contents and start the server. You can then configure Tonido from a remote browser. All you really need to The Tonido web interface is very intuitive and bundles a native media player. do is create a unique Tonido ID that’ll identify your Raspberry Pi Tonido installation on the web. This ID is for the multimedia. If you’ve pointed to the However, there are no progress bars to Tonido relay service which will allow you folders that contain the media, Tonido track uploads. There’s no indication of to access the Pi and any shared files will scan them and add all media it finds any kind to let you know that the and folders from any computer on the in the respective virtual libraries for selected file or files are being uploaded. web without any further configuration – quick access. The software also This is most unhelpful when uploading no messing around with firewalls and includes an inbuilt media and played large files, obviously. Dynamic DNS services, just pick a , MP4, but balked at OGGs and To sync files you’ll need to grab a unique TonidoID and you’re then taken AVIs. The developers suggest you install . Tonido has clients for Windows, through a brief setup wizard and asked the FFMPEG libraries for more Linux and Mac. But the Linux client is to select the folders you need to access comprehensive multimedia support. only available as a . file and that‘s remotely. By default Tonido will share all for 32-bit systems only. Once it’s up and folders, however you can customise the Care to share running, you can use the client to sync setting to manually specify folders. Sharing a folder is pretty files to the Raspberry Pi without any Similarly, you’ll then be asked to point straightforward. All you need to do is issues. You can use the web interface to to folders that host your Music, Photos use the built-in to point to tweak the location of the synced folder. and Video files. You can also change a local folder on the Raspberry Pi, which All said and done, Tonido is designed these settings from within the Tonido could also be on a mounted USB disk, to help most users get off the ground. web interface. and give it a name. You also get However, its usability will start tapering One of Tonido’s most touted adequate sharing permissions. You can, off as you become more experienced features is the ability to stream for example, set an expiration date for a and demanding... LXF share, allow everyone with the share URL to access the folder, or restrict Features at a glance access to a select few. Verdict When you restrict access to particular users, you can also control Tonido for Raspberry Pi their right to view and upload files Developer: CodeLathe LLC Web: www.tonido.com individually and restrict the amount of Licence: Proprietary data they can upload. Tonido also keeps Features 6/10 an access history of the shared files. Performance 6/10 The only limitation with the freeware Ease of use 8/10 version is that you can only add up to Documentation 8/10 five shares and five guests. A file sharing server that eases setup Universal access Public shares To upload files, you can either use and admin. Ideal for inexperienced The TonidoID relay service Allow access to data the built-in file manager or simply drag users but doesn’t scale very well. lets you access your from remote location by and drop the files into the browser cloud from any computer creating private and public window. The ability to drop folders is connected to the internet. shares with ease. Rating 7/10 only available for the Chrome browser.

22 LXF191 December 2014 www.linuxformat.com CMS Reviews WordPress 4.0 WordPress seems manically driven to constantly improve itself. Shashank Sharma takes a closer look, hoping some of it rubs off on him...

niversal appeal and malleability In brief... have made WordPress one of U the most widely used content Popular CMS management systems. Thanks to its capable of hosting design and ease of setup, WordPress almost any kind of website thanks to appeals to all manners of users, despite its vast collection their skill set. The large selection of of plugins. See plugins also means that it can be used also: Drupal, to set up just about any kind of website. Concrete5... As a breed, reviewers are a greedy lot. We're predisposed toward feature- heavy releases and frown upon a release that doesn't offer many new additions. Despite that, with tools like WordPress, you have to look not at the individual additions, but how they add to the experience the project offers. WordPress continues to impress with yet another stable release, boasting This is especially true in case of enough features to please existing users and impress new ones. WordPress 4.0, named 'Benny', after Jazz musician Benny Goodman. In the open source ecosystem, users variety of plugins to fight off spam, 4.0 determine how the embedded content are frequently burdened with choice. now lets users mark even deleted sits in with the rest of the post. Natural selection takes care of the comments as spam out of box. Plugins are the biggest draw for any problem, but only to an extent. For the WordPress user. With the latest release, most part, the popularity of a project Being content users now get a grid view of available and its success depends on what A major focus of the release has been plugins. The plugin cards provide a lot of measures it takes to provide users what on improving how content is previewed detail for each listed plugin, such as the they want, and routinely. This is one and edited. In previous releases, a major purpose, its developer, compatibility area where WordPress has done quite problem was that users had to scroll to with the installed WordPress version, well for itself over the years and the the top of the page to access the edit rating, and more. Apart from these, the latest release is no different. controls menu bar. This bar now sticks release also features the usual plethora Internationalisation has long been a to the top of the content box and allows of bug fixes and other tweaks to further strong suit for the project, with an for a smoother editing experience. improve the user experience. estimated 30% of WordPress sites Another new feature is the grid view Despite its dominance of the CMS hosting non-English content. With 4.0, that allows you to view at a glance all market share, WordPress continues to WordPress hopes to expand its global the uploaded media. You can also list improve itself with each release and 4.0 appeal further by offering users the the media by type and even edit an continues this proud tradition. We like option to even install it in their own image, by selecting it from the grid view, 'Benny' for being a rounded, stable language. Also, while WordPress offers a and then clicking the Edit Image link on release. You might too! LXF the right sidebar. When editing images, WordPress 4.0 offers on the fly previews Features at a glance of the changes being made. Verdict Unfortunately, while the grid view allows you to select multiple files to embed WordPress 4.0 into a post or page at once, it doesn't Developer: WordPress Foundation Web: www.wordpress.org allow you to perform the same edits on Licence: GPLv2 multiple images simultaneously. Features 8/10 When working with embedded Performance 9/10 content, be it images or videos, Ease of use 9/10 WordPress 4.0 now offers previews of it Documentation 9/10 in the visual editor itself. So you can While the latest release is not the Plugins grid Embedded media directly paste the URL of your Flick most featureful, WordPress 4.0 is The plugins grid even Embedding multimedia, image, YouTube video or a Tweet into greater than the sum of its parts. allows you to actually you can even stream the the content box and WordPress will restrict search to plugins video or audio from the render it in the editor, removing the that are in Beta. visual editor itself. Rating 9/10 need to 'Preview' your post to

www.linuxformat.com December 2014 LXF191 23 Reviews Gaming headsets Gamdias Eros Forlessthanfiftypoundshowcanthisoutperformmoreexpensivesets?

his bargain-priced headset from loveliness that flows directly into your down when you’re screaming at your In brief... peripheral newcomer, Gamdias, reverberating lugholes. squad for a little fire support. The audio Tis a bit of a surprise. On first The Eros combines bold, pounding quality isn’t quite so astounding From peripheral sight it looks every bit the £46 gaming bass notes with pin-sharp treble, musically, with treble feeling just a little newbie Gamdias headset – all glossy red and black making it a genuinely great gaming too harsh for some vocals. Yet for a well- comes a low-cost styling with a fat, pivoting headset. It only rocks a modest priced gaming headset, you can’t really headset that’ll do you proud. boom mic. It doesn’t 20Hz-20KHz frequency ask for more than what Gamdias has Drivers: 40mm scream quality, it just response range, but sounds delivered right here. LXF mumbles something almost as good as sets Frequency: 20Hz to 20KHz about certain costing twice as much. Cable: 3m plastics being Despite the questionable Verdict Weight: 328g cheaper to appearance, the cans are manufacture. But comfortable and cushion Gamdias Eros throw the Eros your head in gently- Developer: Gamdias Web: www.gamdias.com over your ears padded luxury – ideal for Price: £46 and you’ll be any planned lengthy Features 8/10 as stunned Battlefield 4 frag-fests. Performance 8/10 as we were The mic is nothing to Ease of use 9/10 about the get excited about, but it Value 9/10 level of audio doesn’t let the Eros Looking for a lower-cost headset that can rock it with the big boys of We hope you like the headset world? Look no further. red as you’ll be seeing a lot of it Rating 9/10 with this design. Kingston HyperX WilltrickedoutQPadcanswillputyourearsoncloudnine?

hen we first saw Kingston’s the original headset’s aural quality. Our an elegant, robust and lightweight In brief... HyperX-branded headset one concern with the QH-90 was that design that feels comfy after long W there was a twang of the bass response was a little light periods of use, and the detachable mic Response: recognition in our collective hivemind because of the delightfully balanced EQ is as clear as you could want. Incredibly, 15Hz-25KHz tech lobes. It is effectively that QPad had used. Kingston Kingston has improved on an already Driver: 53mm QPad’s excellent QH-90 has augmented the low-end impressive headset. LXF Mic response: headset but with a little of this HyperX version to 100Hz-12KHz bit of a paint job. Then give the sub-20Hz Mic type: there was an immediate frequencies a punch Verdict Electret shudder as we heard that is more felt than condenser that Kingston had heard. It’s not Kingston HyperX Cloud Interface: taken one of our punching your ear like Developer: Kingston 3.5mm jack Web: www.kingston.com favourite headsets the Mad Catz cans, Price: £86 and decided that it but adds depth to Features 9/10 needed bigger the bass notes Performance 10/10 ‘splodes. Yup, without muddying Ease of use 10/10 Kingston has turned other sounds. Value 10/10 up the dial on the bass. And because it’s Injecting QPad’s excellent QH-90 To our surprise, it hasn’t practically identical to with more bass results in one of the Probably the taken anything away from the QH-90 set, it’s got most complete headset packages. best headset you can buy for Rating 10/10 the money.

24 LXF191 December 2014 www.linuxformat.com Games Reviews The Witcher 2 A game sequel that balances on the pinnacle of greatness. And then falls off. Richard Cobbett dons his armour of +4 to new games journalism.

his is a game sequel that shoots In brief... for the sun while its rivals are Tstill lining up their sights on the Take control moon. It’s an AAA RPG with an indie once again of soul, and a charged, exciting adventure Geralt of Rivia, the titular Witcher, you can really sink your teeth into, genetically- admire, and for the most part, love. enhanced and From the raw technical wizardry of trained in the art the engine, to tent walls rippling in the of monster breeze and villagers running for cover slaying, in this gory, nasty, when it rains, it’s a game built with spooky sequel. burning, red-raw passion and exactly one goal – to be the best RPG ever, whatever it takes. Admittedly, it falls short of that, but not without giving it a damn good go – over its 20-30 hours of Specs almost relentlessly superb moments, The Witcher 2 raises almost every bar it You can only kill monsters with a silver sword. Surely it would kill humans too? OS: Ubuntu can get its hands on. 12.04+ or Steam The supernatural odyssey is packed unwilling to bring in fresh eyes to game-changing mid-point, where the OS to the gills with big decisions and major playtest it. Quest markers and gloves would come off and the second CPU: Quad core plot branches, and unlike most RPGs, descriptions are frequently confusing, half of the story absolutely explodes Intel these have consequences far beyond wrong, or just plain missing – very into life... It wasn’t. Chapter 3 turned out Mem: 4GB+ whether or not you get a magic karma much the sort of mistake someone to be the end, as if The Witcher 2 Gfx: GeForce GT 640 or later, Intel point or an NPC opts to kiss you. wouldn’t notice if they already know suddenly looked at its watch, and went not supported In the opening section, for instance, where they were going and why. The ‘Whoa, is that the time?’. Driver: Nvidia you’re sent to take down a traitor, Aryan Witcher 2 still has too much The game’s crime is simple: failing 340.32, AMD fglrx La Valette. Whether you kill him in a duel backtracking and too many invisible to live up to its own high standards, 14.4 rev 2, or make him surrender, the game walls. Importantly the narrative and even after exceeding almost everyone MESA-based happily rumbles on. The scale of the action both truly hit the ground running, else’s with fire and passion and style. All drivers not consequences of many of your choices and hit it hard, with huge armies things considered, that’s not a difficult supported is almost ridiculous. Chapter 1 features clashing, dragon attacks, daring thing to forgive. Forgetting? Not so easy. two completely different final acts escapes, and an opening village full of We’ll also quickly mention its Linux depending on who you work with, both drama and intrigue and interesting release, which was mixed based around of them dramatic and well-produced. moral dilemmas. the eON wrapper system. This largely Chapter 2 takes this to a whole new The new combat system is a mixed favoured Nvidia hardware, but a major level, offering two completely different bag. As before, the gimmick is that you update in August and AMD driver towns depending on your earlier choice. use a steel sword against humans and a tweaks have seen improvements to All this detail and ambition comes at silver one against monsters, along with stability and performance. LXF a price, however. The Witcher 2 often several magic spells to stun, burn and feels like CD Projekt struggled to take a otherwise tip the balance in your favour. step back from their game, or were This works well against one or two Verdict opponents at once, but a mix of long, non-interruptible animations and bad The Witcher 2 targeting can make fighting groups a Developer: CD Projekt RED Web: www.thewitcher.com pain. This is especially problematic early Price: £14.99 on, when Geralt has almost no stamina, Gameplay 8/10 his spells are weak, you can’t block Graphics 9/10 more than a couple of hits at a time, Longevity 8/10 rear attacks deal 200% damage, and Value 9/10 you can easily be obliterated by pesky Last minute collapse onto its own encounters. silver sword aside, this is one of the Chapter 1 was glorious, beautiful, most impressive RPGs you’ll find. involving and heartfelt. Chapter 2 was even better: epic, dramatic, amazing. Rating 8/10 The Witcher 3 is on the horizon; we hope it’s longer... When Chapter 3 dawned, it felt like the

www.linuxformat.com December 2014 LXF191 25 ndup Everymonthwecomparetons ofstuffsoyoudon’thaveto! Music players Which music players handle large music collections with the best blend of features and performance? Richard Smedley is all ears.

How we tested...

While these players are fairly feature packed we wanted to give a realistic assessment, so we tested on a relatively humble dual-core laptop with 2GB of RAM and, to mimic the repurposed machine setup many might have, we also tested on an original Netbook. OS was courtesy of Ubuntu 14.04, Debian Testing (Jessie), and Fedora FC20. Some listening was done with the players running against a minimal window manager (usually XMonad), and some against the more realistic environment of KDE or Unity, and several other apps eating into resources. High-res files were used, as well as CDs, lossless FLACs, compressed downloads (MP3 and AAC), and streams. Files on an external drive enabled testing across machines, and checking the search and building worked outside of the home directory.

ven if you value the sound quality of vinyl above all other “We’re comparing sources, you can't avoid the more fully- E amassing digital files of all the music, audiobooks, , and featured players...” other audio goodies only available in some or other digital format. kernel's Advanced Linux Sound thousands of tracks – something the Our Most distros take care of codec Architecture (ALSA). default player shipped with your distro selection support for you, and Linux's audio Options for storage and playback might not stretch to so well. plumbing handles higher-resolution are legion, with dedicated hi-fi There are many solutions for those audio files, such as 24-bit 192kHz components competing against the wanting a more minimalist audio player GMusicBrowser sample rate, which means good sound several software solutions available on but for typical use, such as your musical MPD/ quality is potentially within reach of all the three main PC platforms. Here we're life on the hard disk of your laptop, or an QMPDClient software choices. Direct Stream Digital comparing the more fully-featured audio-playing netbook plugged into (DSD) is the exception as it's barely a audio players, capable of handling very your AV amp, the power and flexibility of year since support was added to the large music collections – tens of these five picks should mark them out.

26 LXF191 December 2014 www.linuxformat.com Music players Roundup

Usability Intuitive is a much abused word…

anshee has a flexible interface. MPD (Music Player ) is a Its multi-pane interface put special case, as you're accessing it B everything just where you reach through a client. We focussed our for it with our cursor – controls and attention on QMPD, a Qt-based client menus are at the top, media choices which gives a good range of features are at the side, and three panes of info under its deceptively simple . Gtk are available as required – making it and terminal clients are also available, easy to switch between its many but for handling large software services. It's little wonder that this collections it's MPD itself that matters, handy app has quickly become many and the clients vary by feature set, Despite the sparse interface and config file set-up, MPD people’s default media player in Ubuntu speed and usability. is the only player to cope with DSD files. and elsewhere. Earlier versions of QMPD has a notably distinctive take Banshee were reported as unstable on on the multi-pane interface, with few Extensive menus, basic playback icons, KDE desktops but we’ve found that this menu choices, icons for various playlist the playlist, and a colourful pane of Verd ict is certainly no longer the case – controls, and tabs for library, , cover art and traditional frequency Audacious although admittedly we did have the etc, shunted to a vertical spectrum type visualisation make for +++++ occasional crash when system column on the right. Nevertheless, with an easy to use player. Banshee resources were under pressure; a MPD set up, playing music through GMusicBrowser, while having quite a +++++ problem shared with Nightingale. QMPDClient turns out to be a pleasingly busy interface, is another player GMusicBrowser Nightingale has a clean default straightforward affair, and the software focussed on the playlist and the +++++ MPD / QMPD interface, centred on the playlist and was certainly quick and responsive individual tracks. We found that moving +++++ the importing, sorting and playing of when we used it. from the library to the context Nightingale your playlist. Lyric fetching was a hit- Audacious's somewhat old- removes most of the distraction, and +++++ and-miss affair over the score of fashioned interface was quite refreshing those who like plenty of context- Not the most providers listed, and cover artwork in its directness, and although it can be relevant right-click options will be right featureful, but Banshee is the didn't always show up, but there weren't changed to a classic blue-neon at home with this player. easiest player any problems getting Nightingale to do lookalike, we preferred GMusicBrowser shares the laurels to dive into. anything of a purely audio nature. working with its default Gtk theme. with Banshee on this score... Setting up Finding your music and managing it.

anshee digs deep to pull in playlists with ease. The simple interface edit /etc/mpd.conf with the absolute connections to many services, once more proves an easy way to path to where the music is, then run B including browsing Amazon discover the player's abilities, and the mpc update. There's a choice of client MP3s, Last.fm playlists, Guide, and list of installed plug-ins is impressive. software, QMPDClient, pictured here, is the Internet Archive's DLC. Audacious, Unsurprisingly, as a server app, a reasonable choice for KDE users... too, was exemplary in setting up MPD needs work to set up. You need to GMusicBrowser is notable for its simple default interface, and easy configuration with a variety of options to make it like most other media Verd ict players, or like Nightingale, it uses the Audacious GStreamer framework to pipe together +++++ media handling, which means codec Banshee support goes as far as you wish to allow +++++ non-free codecs on your PC (via the GMusicBrowser -plugins-ugly collection, +++++ MPD / QMPD which Ubuntu users can find in the +++++ Multiverse repository). Nightingale Nightingale was occasionally less +++++ intuitive than Banshee and Audacious, Audacious but worked well during the set up and was ready to play even discovery process – at least once we'd Commodore 64 switched to the non-Unity package, and sound chip files. Audacious, like all the players, takes on 192KHz/24-bit HD audio files. restarted with US-English settings.

www.linuxformat.com December 2014 LXF191 27 Roundup Music players

Features & extensions You want an alarm clock? No problem.

here's so much more we've come to with numerous themes to match your lovingly- source software offers the potential to make expect from music players. Displays of tweaked desktop is plainly important, given every feature possible, why not go for it? There T cover art and fetching lyrics are taken the thousands of user-contributed skins to be may be an extra feature that will swing your for granted, as is scrobbling to last.fm and found. Our five players certainly have what it choice and there's plenty on offer: from finding comparable services. Attempting to prove takes to manage playlists and tame your CC-licensed music to playing DSD files, there's beauty (for software at least) is just skin deep 250GB disk of MP3s, but when free and open something to make each one stand out...

Audacious +++++ We've mentioned the number of plug-ins that ship with Audacious and behind the tame façade hides a player ready to take on anything. There are useful audio effects, such as binaural conversion (which makes headphone listening more 'realistic') and LADSPA effects. An EQ window opens when you start up, which may be an effect too far if you have a well-balanced amp and speakers setup. Impressive codec support ranges from the Nintendo DS Sound Format to (ALAC) and there are even plugins for formats such as , PLS, and XSPF. As well as multiple obscure codecs and numerous plug-ins, Audacious lets you change its appearance with Winamp2 skins (WSZ files). User- adjustable colour balance means the possibilities are endless, but with great control comes great responsibility for the distress of any onlookers.

Banshee +++++ In addition to the best compatibility with portable music players, Banshee offers smart playlists and utilities for handling larger collections with such features as bulk fixing of missing metadata. Using Musicbrainz, Banshee will automatically retrieve missing and supplementary metadata for library items, including cover art. Also, If you have multimedia keys configured in Gnome, Banshee can use them too. Like Audacious, Banshee can also rip CDs. Extensions worth a mention include Karaoke; Stream Recorder for recording Internet radio streams; and LCD, which displays track info on an LCD screen using LCDproc. That last extension makes Banshee a great choice for an embedded music player project. There are also extra touches, like type- ahead find and excellent support for audiobooks and podcasts, which explains why Banshee is shipped as a default player in many distros. Large collection handling If you've passed 5,000 CDs worth of music, these are for you. Verd ict Audacious ur five players were chosen audio files from anything else – MPD was expected to do well in our +++++ because of their ability to although removing files from the tests and did. However, it doesn't Banshee O handle large collections – the playlist was simple enough. Nightingale handle things like other players, which +++++ kind to fill the disk drive of the late, is also a quick indexer, but uses a fair tend to build playlists by scanning GMusicBrowser lamented iPod Classic. GMusicBrowser amount of system resources no matter multiple directories for media files. +++++ MPD/QMPD stood out here with its flexible scanning. what size of music collection it's MPD works from one music directory. If +++++ Add to this highly-configurable playlist working with, so it struggled a little on you keep sound files in multiple Nightingale features and touches like weighted- lower-specified hardware. locations, you'll need to make symlinks +++++ random playback options, and it's a Banshee is a little behind the other from MPD's assigned directory, though The ease of great way to enjoy your collection. four players, but barring the odd crash it can read from remote servers via GMusicBrowser edges out MPD's While Audacious quickly indexed a it soldiered gamely on. Its easy, intuitive CMB or NFS. This is recommended if command line large external disk and added interface earns it a lot of forgiveness you are running MPD on limited configurability. everything to the playlist, it couldn't tell when it falls short elsewhere. hardware such as a Raspberry Pi.

28 LXF191 December 2014 www.linuxformat.com Music players Roundup

GMusicBrowser ++++ GMusicBrowser bills itself as a "jukebox for large collections of MP3s, Oggs, FLACs and MPCs." The playlist is the heart of what it does, and none are as flexible and powerful. Features such as simple mass-tagging and mass-renaming, and customisable labels make for easy management. Shimmer is a theme that ships with the player and improves the standard layout of controls as well as their appearance, and has a number of options such as a mosaic of album covers. Plug-ins aren't as numerous as those found for Audacious, but they do fetch song lyrics and cover art. The ones worth a try are: Albumrandom3, which plays whole albums with the use of weighted random and Sunshine3, an alarm clock which fades in music to start your day (and can also fade out tracks as you go to sleep at night).

MPD/QMPDClient +++++ MPD's strength is that it can handle tens of thousands of tracks without breaking into a sweat, but clients like QMPDClient do the heavy lifting by providing features. EQ is one feature you won't find on the client, but QMPDClient does supply a lot others, including cover art, lyrics, internet radio, playlists, Last.fm track submission, tray notifications (Freedesktop too), skins, and directory browsing. MPD was the only one of our players to manage high-resolution Direct Stream Digital (DSD) files. This is the format for Super Audio CD, and gives a more 'natural' sound than the PCM encoding used in other discs and downloads. If you're happy with CD or compressed audio this won't be a problem, but with a rapidly expanding library of DSD tracks now available to purchase for download, this may swing audiophiles towards an MPD-based set-up.

Nightingale ++++ Nightingale picked up the source code and flew off with it, maintaining both the player and it extensions compatibility. You can add to the interface with more important track info (or an analogue clock, should you so wish); browse for CC-licensed music; find broken, missing or duplicate tracks; add an iTunes-like grid view and even fetch guitar tabs. The secret to its extendability is the Firefox-like nature of its extensions, as Nightingale uses Mozilla XULRunner underneath, making embedded browser windows a natural feature, and you'll find things like your Last.fm page in its own tab. The and good tag editing keep Nightingale in the running. Add in its excellent control via the keyboard and it's a powerful package, provided, of course, your hardware resources are up to it. Support and Documentation Because everyone needs a helping hand. Verd ict

Audacious hen QMPD kept reporting embedded browser window if you click how to get purchased files from +++++ that it 'could not connect to Help. The built-in search finds answers Amazon before the .amz file expires. Banshee W lastfm' there was no hint that to most problems, and when it refused Audacious is so straightforward it +++++ we should install mpdscribble, and edit to start on first install, it did so with the could almost be said not to need any GMusicBrowser /etc/default/mpdscribble, then message that switching to US-English documentation. the main page's list of +++++ MPD / QMPD restart the service. MPD has a often fixed start-up problems… and it keyboard shortcuts is enough for most, +++++ reputation for being difficult to set up, made the switch for us. Nice work. but if not the forums on the website Nightingale but don't let that put you off. For the Banshee's manual first appeared have plenty of help and advice. +++++ most part following the user manual on with the 1.8 release four years ago. It's a GMusicBrowser provides forums, a Banshee's the MPD website or one of its excellent practical guide aimed at managing and reasonable FAQ section and a practical yet concise guide is online tutorials will get you going. playing your music, as well as extending developers' wiki, as well as a useful model reference Nightingale, as a child of the web, Banshee and connecting to portable guide to the less obvious features – material. will load the online forums in an players. It contains useful tips, such as so an adequate level of support.

www.linuxformat.com December 2014 LXF191 29 Roundup Music players

Hardware connections iPods, remote controls and outboard sound cards.

hanks to ALSA, GStreamer and hundred pounds on a USB DAC and outside the Remuco codebase in the Pulse connecting to a USB DAC adding a decent amp and speakers will ageing packages of an Ubuntu PPA. T should present no problems do more for your music than choosing Nevertheless, for those not wishing to whichever player you use as it's just the best player here (mostly because leave the sofa remote control options seen as an outboard sound card. any of the five will serve you quite well). are available for all of our tested players. Whatever your level of scepticism about While all of the players could be Speaking of phones, while iPod the world of hi-fi, where connection controlled from your phone via integration was and remains a major cables sell for thousands of pounds, Bluetooth or Wi-Fi by adding in the source of grousing for Linux users, the and more is written about the hardware appropriate remuco package, of Android phones generally, than the music, spending a couple of Nightingale's support is only found and particularly among Linux users, has made this far less of an issue. Nightingale, for instance, will import and export to iTunes, and managing an iPod/iPhone and so on is best done via a separate program like Podtool or Gnupod. The exception here is Banshee, Verd ict which not only has excellent – and Audacious frequently updated – support for +++++ iDevices, it also connects to many MTP Banshee devices. MPD has the MPod client for +++++ portable devices. GMusicBrowser Incidentally, those who see the +++++ MPD/QMPD world through the filter of the much- +++++ loved system monitor will be Nightingale pleased to know that it connects to +++++ Audacious, Banshee, GMusicBrowser, Banshee's and MPD. Yes, that's right, all except ability to connect to Nightingale. In fact, most of the players portable players that didn't make the selection here will stands out. Even if you never connect Banshee to an iPod, you'll appreciate other features. also connect to Conky. Stream support Listening to sounds on the wire.

adly, BBC iPlayer is still locked option from the menu, while away from these clients – Nightingale's USP is S unless you go to the bother of Soundcloud, which makes it using a script to regularly gather the the only GNU/Linux audio ever-changing m3u addresses to send player app that lets you to MPD – but you do have the option of easily access your favourites downloading BBC radio programmes and your profile stream from Verd ict with the get_iplayer script, to add them SoundCloud. QMPDClient, Audacious to your library and listen to them later. meanwhile, enables you to +++++ Banshee puts its online resources in add any internet radio Banshee the left-hand pane: Amazon, Miro, the station, as well as Shoutcast +++++ Internet Archive, Last.fm, etc. Third- stations. At the back end, GMusicBrowser +++++ party plug-ins add support for Jamendo the mpc add MPD/QMPD and Magnatune, and radio stations command adds radio +++++ from shoutcast.com and xiph.org, while stations to MPD. Nightingale, which is based on Mozilla's Nightingale Miro Guide pulls in hundred of podcasts. GMusicBrowser's Web XULRunner, easily embeds Internet services. +++++ Nightingale, with its web heritage, is Context plugin uses Banshee brings in a the easiest to connect to Last.fm, and MozEmbed or WebKit to GMusicBrowser doesn't tap into the whole world of supports Shoutcast and Soundcloud. provide views of Wikipedia pages, and benefits of the Internet, although internet-powered Using Audacious, the only method of lyrics, appropriate to the song playing. project developer Quentin Sculo says audio bliss. receiving streams is the Add URL Beyond this and Last.fm support, he has internet radio on his to-do list.

30 LXF191 December 2014 www.linuxformat.com Music players Roundup

Music players The verdict anking the winners isn't an easy readers happy to push through this task, as all five have something barrier, we'd like to recommend MPD Rto offer. As you'd expect, it all and one of its many clients QMPDClient depends on what you want out of a for handling large collections in a stable music player and particularly one that and easy way. The flexibility of its client/ can handle large music collections. If server network architecture (with you're not bothered about streaming clients on iPods, in web browsers, and content, then Audacious is worth a look: anywhere you can imagine), and the it's just enjoyable to use and does the separation of server (MPD), basic GMusicBrowser's quirky interface is surprisingly easy to job well, which is sadly all too rare in control (MPC), and clients feels like the use and focuses on managing the music collection. desktop software. correct Unix way of handling the job. Nightingale is a mighty beast. Back to more user-friendly desktop shortcomings. But for more reliable Unfortunately, it uses significantly more apps, and we're left to choose between management of a large collection of system resources than the other the well-performing Banshee and audio files, GMusicBrowser is tailor- players we tested, which means you GMusicBrowser. Here's our surprising made. It's not the best at everything, won't have much fun using it on your result: Banshee is packed with features but there's nothing it does badly and poor little Raspberry Pi. Despite this, and comes tops for flexibility, yet it's the slightly busy interface works well for and the lack of Conky and native also the least comfortable with large us, even without changing it to remuco integration, it's a capable player collections, and can be a little sluggish Shimmer, or another theme. which will take on large music and unstable collections and use the power of its handling them. In “For more reliable management extensions to manage them. short: try it. Any MPD-based solution will lose Banshee may suit of a large collection of audio files, marks due to the less than trivial all your needs, but installation and configuration. For it does have those GMusicBrowser is tailor-made.”

1st 4th GMusicBrowser +++++ Nightingale +++++ http://gmusicbrowser.org Licence: GNU GPL Version: 1.1.13 http://getnightingale.com Licence: GPLv2, MPL, BSD Version: 1.12.1 Made for large collections, quirky but powerful. Graceful all-rounder with power and extensibility.

2nd 5th Banshee +++++ Audacious +++++ http://banshee.fm Licence: MIT Version: 2.6.2 http://audacious-media-player.org Licence: GNU GPL Version: 3.5.1 Less robust, but featureful and lovely to use. Nice – but not competitive in this company.

3rd MPD/QMPDClient +++++ Over to you... www.musicpd.org Licence: GPLv2, MPL, BSD Version: 0.18.14/1.2.2 What do you think? Do you have a preferred media player that’s not The Unix way – non-trivial configuration and powerful results. on our list? Email your opinions to [email protected]. Also consider... This is a crowded field, and honourable stereo or 5.1 surround - but not DSD tracks. an easy and graceful manner, UMPlayer is a mention should go to Amarok, which has We're also big fans of with its good example which featured strongly in a improved in recent releases. is also excellent management of tabbed playlists and recent Media Player Roundup (See p24, worth of note with its powerful tagging and the streaming services LXF187) and SMPlayer. more minimal which lacks the feature There's a certain amount of crossover Lastly, if you want the flexibility of a client- of the five we tested but works well with large between audio and media players these days, server and a choice of front-ends, but without collections. Qmmp is also happy to play 24-bit and although the latter are not necessarily built MPD's complexity then XMMS2 provides that tracks at 96kHz or 192kHz sample rates, in to handle very large collections of audio files in along with the best gapless playback. LXF

www.linuxformat.com December 2014 LXF191 31 Subscribe to #1 for Free Software Subscribe to our print edition, digital edition or get the best value with our complete print and digital bundle!

Choose your#1 for Free Software package

Print Digital

Every issue delivered to your door with Instant access to the digital editions of a 4GB DVD packed full of the hottest the magazine on your iPad and iPhone. distros, app, games, and more. PLUS exclusive access to the Linux PLUS exclusive access to the Linux Format subscribers-only area, featuring Format subscribers-only area. complete issues & disc downloads. ONLY £25.49 ONLY £20.49 Your subscription will then continue at £25.49 every 6 Your subscription will then continue at £20.49 every months – SAVING 40% on the shop price. 6 months – SAVING 37% on the shop price.

32 LXF191 December 2014 www.linuxformat.com Get the complete# package 1 for Free Software

Print + Digital

A DVD packed with the best new distros and free & open source software every issue.

Exclusive access to the Linux Format archive – with 1,000s of DRM-free tutorials, features, and reviews.

Every new issue of the magazine in print and on iPad and iPhone.

Never miss an issue, with delivery to your door and on your device.

Huge savings, the best value for money, and a money-back guarantee. ONLY BEST VALUE! £30.99 Your subscription will then continue at £30.99 every 6 months – SAVING 40% on the shop price and giving you a 83% discount on a digital subscription.

Two easy ways to subscribe... Online - myfavouritemagazines.co.uk/LINsubs Call 0844 848 2852 (please quote PRINT14, DIGITAL14, BUNDLE14)

Prices and savings quoted are compared to buying full priced UK print and digital issues. You will receive 13 issues in a 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 unmailed issues. Prices correct at point of print and subject to change. For full terms and conditions please visit: myfavm.ag/magterms. Offer ends 25/11/2014

www.tuxradar.com December 2014 LXF191 33 Hack the Raspberry Pi

Hack the Raspberry Pi Follow in the footsteps of free software wizards as Mayank Sharma shows you how to master the Raspberry Pi by hacking it.

he Raspberry Pi was the Pi is also an excellent tool to cover the Stage 3 between years 11 and 14 are conceptualised as an ground in between these two extremes. introduced to text-based languages like educational device. The Now don’t sound surprised when we Python to control electronics. The Pi is a TRaspberry Pi Foundation tell you that hacking with the Pi is a nice wonderful platform for this application designed the no-frills computer to make way to learn about Linux and because of its accessible GPIO ports on an affordable and functional computing programming. And we aren’t the only ones which you can hook up devices, such as device for kids who wanted to learn to to say this. We’ve reported in detail on the Pibrella. Finally, the kids in Stage 4 program, but found it difficult to come new UK computing curriculum and how it between ages 14 and 16 can make use of up with the cash to procure hardware off- encouraged the use of the Raspberry Pi in the excellent add-on kits available for the the-shelf. However, the device hit it off each of the key stages defined in the new Pi to develop their computation abilities. with the hackers and modders who curriculum in the past (see LXF189, p56). In this feature we’ll help you pick up began using it creatively and new skills as you hack with made it usable to audiences the Raspberry Pi. Just make far beyond what Eben Upton, “The Raspberry Pi was sure you have one ready. Use Rob Mullins, Jack Lang and designed as a device for kids NOOBS to prepare an SD Alan Mycroft had originally card for the Pi. Download it or imagined when discussing the to learn to program...” grab it off the disc, unzip it idea at the University of and copy the extracted Cambridge’s Computer Laboratory. In Stage 1, kids between 5 and 7 years contents onto a formatted SD card, and But this has created a misconception. A write and test simple programs on you’re up and running. This feature covers lot of people believe that the Pi can either different devices, such as a tablet or the some very practical everyday projects that be used inside an elementary educational Raspberry Pi. Then there’s Stage 2 where can be rolled out by anyone, irrespective of institute or in the hands of an experienced kids between ages 7 and 11 are introduced their skill level. As you complete each of campaigner who’ll plug it inside a RC car or to Scratch which is installed by default on these 10 hacks you’ll learn some tricks of space-faring teddy bears. While this is true, the official Pi distro Raspbian. The kids in the trade that are widely used....

34 LXF191 December 2014 www.linuxformat.com Hack the Raspberry Pi Skills: Security, Twitter API

Hack #1: Tweeting security camera The launch of the official Raspberry Pi camera module threw open a world of possibilities. Hackers who were already using USB cameras now had a minuscule Full HD shooter that was ideal for projects like surveillance. Combined with the Pi’s computing prowess, you can send the captured security images into your Twitter stream. Before you attach the camera, locate the Camera Serial Interface (next to the Ethernet port) and pull the tab gently It weighs just up. Now push the camera module’s ribbon cable into the slot, the picam.py script and kills it before shutting down the 9 grams but the with the silver contacts on the cable facing away from the Raspberry Pi. Again, the community has done all the legwork Raspberry Pi Ethernet port. Remember not to push the cable in very deep. for you. Just grab their script with wget http://pastebin. camera module Now hold it in place with one hand and push the CSI tab back com/raw.?i=AfqbjQrb -O picam_init and move it into can shoot still down with the other hand to lock the camera’s ribbon. the correct location with sudo mv ~/picam_init /etc/init.d/ images with a resolution of With the hardware in place, it’s now time to set up the picam before making it executable with sudo chmod +x / 2,592×1,944 as software. Boot into Raspbian and bring up the configuration etc/init.d/picam. Finally, make the boot system aware of well as Full HD tool to configure your Pi with sudo raspi-config. Scroll down this script with sudo update-rc.d picam defaults... 1080p video the list to the item that reads Enable Camera. You’ll need to The script will now start and shutdown along with the 30FPS and 720p confirm your choice and restart your Pi. On restart, you’ll be Raspberry Pi. You can also manually control it like any other video 60 FPS. able to use the well-documented raspistill and raspivid daemon. For example /etc/init.d/picam stop will stop the commands to capture still images and videos respectively. script and /etc/init.d/picam start will start it. To capture motion, we’ll use the lightweight motion detection Python script written by Raspberry Pi community Post to Twitter members. The script relies on the Python Imaging Library We’ll now setup a new Twitter account and ask the Pi to which is a library for analysing and manipulating images. You post images to it. Make sure the account is private. Begin by can install it with sudo -get install python-imaging-tk. installing Python’s pip package manager for installing Python Also create a directory named picam under your home directory for the script to store images with mkdir ~/picam. Now grab the script and make it executable with wget -c “The launch of the Raspberry http://pastebin.com/raw.php?i=yH7JHz9w -O picam.py Pi camera module threw open and make it executable with chmod +x picam.py. When you run the script with ./picam.py, it’ll turn on the a world of possibilities...” red LED on the Pi camera and start taking low-resolution images. It’ll then look for movement by comparing the pixels libraries with sudo apt-get install python-pip. Then install in two consecutive images. If it detects changes, the script will Twython: a Python wrapper for the Twitter API with sudo pip capture a higher-resolution image. The script is very efficient install twython. Note: To use Twython you need a Twitter and will automatically remove the low-res images it captures developer account. Head to https://apps.twitter.com and for comparison and only store the high-res images that have sign in with the credentials of the new account. In the page captured the motion. that opens click on ‘Create New App’ and use the space To run the script at boot, you’ll need an init script that runs provided to give it a name and a description. Leave out the Callback URL field, scroll down the page and create the app. Initially, the app is created with read-only permissions. Click on the app, switch to the Permissions tab and toggle the Read and Write radio button. Then switch to the API Keys tab and click on Create My Access Token button. Make a note of the API Key, API Secret, Access Token, and Access Token Secret variables listed on this page. Then download the modified picam script, altered to post captured images to Twitter with: https://raw.githubusercontent.com/ghalfacree/bash- scripts/master/picamera-security.py > picam.py Open this new picam.py in a text editor and insert the four bits of information you jotted from Twitter in the space provided at the top of the script. When you’re done, make it executable with chmod +x picam.py. Now when you run the script and it detects motion, in addition to capturing an image and storing it in the The Kali Linux distro is designed specifically for SD card, the Pi will also post it on your private Twitter account penetration testing and is available for the Raspberry Pi. which will then show up in your Twitter feed.

www.linuxformat.com December 2014 LXF191 35 Hack the Raspberry Pi Skills: Networking, interoperability, data management

Hack #2: File-sharing samba server can be shared on the network. To do this, you first need to The ability to share and access data on your Raspberry Pi add a Samba user called pi. Enter the sudo smbpasswd -a pi from other machines is very useful indeed. For example, if you command and type in a password when prompted. are using it as an always-on download box, you’d want to Next, open Samba’s configuration file (/etc/samba/smb. move the downloaded data off the Pi as well. Now that data conf) in a text editor. If you wish to access the Pi from a could either be on the SD card or on an attached USB disk. Windows machine, locate the workgroup = WORKGROUP line With the Samba software – which is an implementation of the near the top of the smb.conf file and change it to the name of SMB/CIFS networking protocol – you can use your Raspberry your Windows workgroup. Further down the file, locate the # Pi as Network Attached Storage (NAS) device and easily security = user line and remove the # to uncomment the access the USB drive attached to the Pi from on line and turn security on. your network. Lastly, scroll down to the end of the file and add the The sudo apt-get install samba samba-common-bin following lines: command will fetch the required software. Now, attach the [USB] USB disk to the Pi which will be automatically mounted under path = /media/ the /media folder. Let’s assume the USB drive is mounted to comment = USB NAS Drive /media/usb. You now need to configure Samba so the drive valid users = pi writeable = yes browseable = yes create mask = 0777 public = yes Save the file and then restart Samba with sudo /etc/ init.d/samba restart. That’s it. You’ll now be able to access the USB drive attached to the Pi from any other computer on the network. Hack #3: Raspberry Pi as a thin client A thin client is a computer that depends on other powerful computers to do the heavy lifting while it presents the results. Thanks to its power efficient and noiseless design, the Raspberry Pi is a natural thin client. A thin client relies on remote desktop protocols to communicate with the powerful remote desktop. For this hack, you’ll need a powerful computer that’ll act as the remote server and the Raspberry Pi which will be the Remmina has a very usable interface and scrolls automatically when the thin client. Our desktop server is running Ubuntu which mouse moves over the screen edge. comes pre-installed with the Vino remote desktop server that Overclock the Pi

While the Pi’s 700MHz processor is good is to use the preconfigured overclock enough to set up these hacks, after a settings in the raspi-config tool which also while you’d wish you could squeeze more doesn’t void warranty. juice out of it. The good news is that you The settings in the raspi-configtool are can! The Pi’s BCM2835 processor can be known to be safe for use with most Pis. To run above its default speed... overclock your device, launch raspi-config However, remember that such and scroll down to the Overclock option performance comes at a price – the and confirm that you wish to continue. processor will draw more power, run You’ll now be shown a list of pre-set hotter than before, and may not last as overclock speeds and you can select any long as a regular Pi running at its default one. When you have made your selection, speed. Also, while it’s possible to alter the the menu will reboot the Raspberry Pi at If the Pi fails to boot with the overclocked setting, hold Pi’s performance manually, the safest way its new speed. Shift while booting, which loads the Pi at its stock speed.

36 LXF191 December 2014 www.linuxformat.com Hack the Raspberry Pi

can be accessed via the Desktop Sharing app. The remote desktop functionality is disabled by default. To enable it, launch the Desktop Sharing app and tick the ‘Allow other user to view your desktop’ box. This also enables the second checkbox which allows the connected users to control the Ubuntu server. Also enabled is the first option under the Security section which forces you to approve each request for connection. However, for smoother workflow, you’d want to disable this option by unchecking the box. Instead, enable the next checkbox which will prompt the user for a password and enter a strong password in the space provided. When you’re done, click on the Close button to save the changes. If you use another distro, browse the web and install a VNC server, such as Vino or Krfb, on top of that distro. If you’re using Ubuntu’s Vino you’ll have to make one ownCloud 7 is a additional change because Vino was changed to require Now head to https://owncloud.org and download the significant step encryption by default, but only supports old encryption tarball of the latest version. Unwrap it with tar xjvf owncloud- up from earlier methods that are not commonly available. Fire up a terminal 7.0.2.tar.bz2 and move the resulting folder into the root of versions, with on the Ubuntu server and modify Vino’s security settings with your Apache server with sudo mv owncloud /var/www. a streamlined gsettings set org..Vino require-encryption false. Then make sure the new files have the correct permissions workflow. Follow the rest of the hack and if you’re able to connect from for their new location with sudo chown -R www-data:www- the Pi, return to the Ubuntu Server and make the settings data /var/www/owncloud. permanent by installing the -editor with sudo apt-get You’ll need to enable certain Apache modules for install dconf-editor and navigate to org > gnome > desktop > OwnCloud to work correctly. In a terminal enter sudo remote-access and uncheck the require-encryption setting. a2enmod headers rewrite env and then restart Apache with You now need to prepare the thin client Pi. For this hack, sudo service apache2 restart. To configure OwnCloud we’ll use the lightweight Remmina client which you can install launch a web browser and navigate to the OwnCloud with sudo apt-get install remmina. Once installed it’ll be installation instance at localhost/owncloud. Since this is a housed inside the Internet menu. Launch the client and click new installation, you’ll be asked to create a user account for on the new icon to configure a connection to the server. the OwnCloud administrator. In the window that opens, give this connection a name You can now log into your OwnCloud server as the and select VNC from the Protocol pull-down menu. You’ll also administrator and start uploading files you want to share. But need to specify the IP address of the server in the Server field. before you do that, you’ll have to tweak PHP’s configuration You can also boost image quality by selecting a higher colour file if you wish to upload files that are greater than 2MB in depth and a better quality from the respective pull-down lists. size. To do that, open the PHP configuration file, php.ini, Click Connect when you’re done. Remmina will establish a connection to the Ubuntu Server and prompt you for the “If you want universal access to password you had set before allowing you to take control of remote desktop from the Pi. your data, get a Pi and a USB Hack #4: Host your OwnCloud disk and host your own cloud!” If you want universal access to your data you don’t really need to throw money at a service that might store it on servers housed under /etc/php5/apache2 in a text editor. Look for outside your legal jurisdiction. Instead use the money to get a the upload_max_filesize and post_max_size variables and Pi and a large capacity powered USB disk and host your own change their value from 2M to something like 500M or 1G. private and protected cloud-sharing service with OwnCloud. You’re now all set to upload data into your OwnCloud OwnCloud lets you sync and share your data and access it server using the web interface. You can also interact with the from any device connected to the Internet. For added security OwnCloud server via the WebDAV protocol. In the location OwnCloud can also encrypt your files. The software can area in the Files file manager, press Ctrl+L to enable the handle files in a variety of formats and has an in-built gallery location area. Here you can point to your OwnCloud server, image viewer and a music player. One interesting feature in such as dav://localhost/owncloud/remote.php/webdav. OwnCloud is file versioning – because of this, the server Once you’ve authenticated, the OwnCloud storage will be tracks all changes to every file and you can revert to an older mounted and you can interact with it just like a regular folder. version with a single click. To share uploaded files, go to the Files section in the web Like with other online cloud storage services, you can sync interface and hover over the file you wish to share. This files on OwnCloud either using the web browser or a desktop displays several options, including Share, which lets you client on Windows, Mac, and Linux as well as mobile clients select who you want to share the item with and whether you for Android and iOS devices. want to give them permission to edit and delete the files. OwnCloud runs on the Apache web server and also needs You can also share an item with someone who isn’t on a database server. While it can work with MySQL, for this hack your OwnCloud server. When you click on the Share with link we’ll use the lightweight SQLite server. You can install all checkbox, OwnCloud displays a link to the item that you can required components with sudo apt-get install apache2 share with anybody on the Internet. Optionally you can also php5 php5-gd php5-sqlite curl libcurl3 php5-curl. password-protect the link and set an expiration date.

www.linuxformat.com December 2014 LXF191 37 Hack the Raspberry Pi

Skills: Streaming, emulation and GPIO

Hack #5: Stream music from the web The default interface of PiMusicBox is rather bland since We’ve got music everywhere. In addition to DRM-free tracks you haven’t configured any music source yet. To fix that, click on the hard disk, you’ve probably got hundreds of tracks on on the Setting link in the navigation bar on the left. This will Spotify or Google Play. You can get them all together with the take you to a page where you can individually enable and PiMusicBox distro which transforms the Raspberry Pi into the configure all the support streaming services, from premium ultimate music player. ones like Spotify and Google Music to free ones like The The PiMusicBox can output music through speakers Internet Archive, Soma FM, and more. You can also control attached to the headphone jack of the Pi, and also through other settings from this page. For example, the Audio setting the HDMI and USB ports. So all you gotta do is install the lets you switch audio output devices. distro, hook up some speakers to the Pi, plug in your account The PiMusicBox distro has a working Samba configuration credentials and let it rip. You can then control your juiced up and should show up in the Network section inside the file Pi from any computer on the network and even from any manager of all OS’s. The distro’s Samba share only has one Android device. folder named Music. You can put any audio file inside this Begin by downloading the compressed image for the folder and they’ll be transferred to the SD card. Whenever you PiMusicBox distro from www.pimusicbox.com. Extract the restart the Pi, the distro will scan for any new music at boot downloaded ZIP file and then put the .img image file on your up. You can then browse through and play these files from the SD card with the dd command, such as sudo dd distro’s web interface. if=musicbox0.5.img of=/dev/sdd. Remember to replace You can also play music via any software that supports the /d/ev/sdd with the location of your SD card. (MPD) such as the MPDroid app for If you use the Ethernet port to connect the Pi to the Android. To connect, launch the app and in the first-run internet, you can boot the Pi from the newly created SD card. wizard, enter the IP address of the Pi in the hostname field. However, if you use a wireless card, you’ll need to edit the distro’s configuration file and manually point it to your Hack #6: Broadcast audio wireless router. Access the newly created SD card from a Streaming music into the Pi is one thing. What if you wish to regular distro and navigate to the config folder and open the stream music out to other devices? While you’re at it, how settings.ini file in a text editor. Near the top of the file you’ll about running your own radio station? As it happens, you can notice two variables, WIFI_NETWORK and WIFI_PASSWORD. do so without too much trouble. Insert the corresponding values of your network next to these Besides the familiar Audio, Ethernet, HDMI, and USB ports two variables and save the file. The caveat is that PiMusicBox on the Raspberry Pi, the device also has interfaces that are will only work with WPA2-protected wireless networks. designed to to connect more directly with other chips and Once that’s done, boot the Pi with the configured SD card. modules. These General Purpose Input/Output (GPIO) ‘ports’ On first boot, the distro will resize the filesystem to take over are the pins arranged in two parallel strips (26 on the Model B the complete card, and restart automatically. If you have a board and 40 on the B+). monitor attached to the Pi you can follow the booting These interfaces are not plug-and-play but can be process, otherwise wait a minute or two, then fire up a controlled through software. A bunch of hackers over at Code browser on any computer on your network and head to Club wrote a program to use the pins intended to generate http://musicbox.local. If that doesn’t take you anywhere, spread-spectrum clock signals to instead output FM Radio then point your browser to the IP address of the Pi. signals. To transmit a surprisingly strong FM signal, all you need is to attach a wire to the GPIO 4 pin. Even without the wire, the FM signal broadcast by the Pi will be picked up by nearby FM receivers. Power up the Pi and bring up a terminal. Now grab the code written at the Code Club and extract it with Wget..: http://omattos.com/pifm.tar.gz mkdir ~/pifm tar zxvf pifm.tar.gz -C ~/pifm The tarball extracts six files. Surprisingly that’s all there’s to it. You can now broadcast the included sound.wav file with sudo ./pifm sound.wav 101.2. Now grab a FM receiver and set it to FM 101.2 and you’ll hear the Star Wars theme. You can actually change the broadcast frequency from anywhere between 88 MHz and 108 MHz simply by appending the channel frequency at the end of the command. You can play other audio files as well, but they must be PiMusicBox is based on the Mopidy music server that’s written in Python. 16-bit 22,050Hz mono and in the WAV format only. That

38 LXF191 December 2014 www.linuxformat.com Hack the Raspberry Pi

might seem like a limitation but it really isn’t, thanks to the The script will download missing dependencies and then brilliant SoX sound exchange audio editor. We’ll use the nifty present a menu with a couple of options. little tool to process any MP3 file irrespective of its encoding The first option downloads and installs precompiled and convert it into the correct WAV file on-the-fly. binaries of all the popular supported platforms. The second Begin by installing the audio editor and its dependencies grabs the newest source code for each app and compiles with sudo apt-get install sox libsox-fmt-all. When it’s done, them on the Pi. If you choose this option, be prepared to wait type in the following command, substituting “SomeSong. as it might take almost an entire day. In case you aren’t this ” with the name of the MP3 file you wish to play: patient, you might as well grab the image file and transfer it sox -t mp3 SomeSong.mp3 -t wav -r 22050 -c 1 - | sudo on to a blank SD card with dd. ./pifm - 101.2. RetroPie uses a graphical front-end called The first part of the command converts the MP3 file into a EmulationStation, which allows you to manage the various WAV file, changes its audio sampling rate to 22050 Hz and installed emulators. The RetroPie image automatically starts down-mixes the track to mono. The converted track is then this frontend, but if you’ve setup RetroPie on top of an sent to the standard output, denoted by the hyphen, and is then piped (|) into the standard input of the pifm command. The only difference in the pifm command in the above “In order to play emulated example is that instead of specifying the name of the file to broadcast, we are asking the script to instead broadcast the games, of course, you must standard input. If you’ve still got your FM receiver tuned to the first own them...” 101.2 frequency, you should now hear your MP3. You can do some wonderful things with SoX. You can, for existing Raspbian install, you’ll have to launch it manually with example, use it to broadcast your favourite streams live from the emulationstation command. the Internet. The command sox -t mp3 http://www. Once it’s up you should see the controller setup screen, tuxradar.com/files/podcast/tuxradar_s06e02.mp3 -t from where you can configure your USB gaming controller. In wav -r 22050 -c 1 - | sudo ./pifm - 101.2 will broadcast the order to play the games, of course, you must first own them. TuxRadar . The only difference between this ROMs can be made from your own copies of these old games, command and the previous example is that instead of or you can find abandonware online. Some companies, such pointing to a local MP3, you are now pointing to one that as iD software, have made the original Doom open source and resides online. public domain. Once obtained, you’ll need to copy them to their appropriate emulator sub-folder inside the roms/ folder Hack #7: Emulate vintage gaming on the SD card. Games weren’t always graphical masterpieces. Their developers had fewer resources to play with and instead of graphical excellence the developers relied on gameplay to keep the players hooked. This is why the vintage games even with their rudimentary graphics are still quite popular with gamers of all ages even today – there’s nothing quite like A classic gaming challenge, even on Steam or Live. The easiest way to start playing vintage games on the Raspberry Pi is to install RetroPie which packs a bundle of emulators. You can install RetroPie on an existing Raspbian install or run it as a standalone distro. Before you fetch the installation script, grab its dependencies with sudo apt-get install git dialog. Then you can download the latest RetroPie setup script with: git clone git://.com/petrockblog/RetroPie-Setup.git Now change into the newly cloned directory and run the script with cd RetroPie-Setup && sudo ./retropie_setup.sh. EmulationStation will only display the emulators that have ROMs added.

Donate excess resources

If you aren’t always using your Pi, you can should find is 16MB. Then install BOINC donate the idle processing power for a with sudo apt-get install boinc- worthy cause. BOINC is a computing manager boinc-client. volunteering service and it uses the When it’s done, launch the BOINC donated power for a variety of projects, Manager from the Others menu. You’ll be from protein folding for medical sciences asked to add from one of over 30 to the search for alien intelligence. supported projects. Some projects might Before installing BOINC, tweak the warn you that they might not have work Raspberry Pi to cut down its own suitable for the Pi. While you can still add resources utilisation by calling sudo them, it’s best to add projects that can raspi-config. Head to Advanced Options make use of the Pi such as the Collatz To configure how BOINC uses the Pi’s resources, first > Memory Split and earmark the least project, which is attempting to disprove enable the Advance View and then head to Tools > possible memory for the GPU which you the Collatz Conjecture. Computing preferences.

www.linuxformat.com December 2014 LXF191 39 Hack the Raspberry Pi Skills: Python, eSpeak

Hack #8: Make your Pi speak search = twitter.get_followers_list(screen_ Software speech synthesizers are always very popular to name=’geekybodhi’,cursor=next_cursor) bring computing devices to life – so to speak. Of course they for result in search[‘users’]: have also have a very crucial role in making the device print result[“name”] accessible to vision-impaired users. their_name= result[“name”] You can use the Raspberry Pi for text-to-voice commands espeak.synth(their_name) thanks to the availability of the powerful eSpeak library in time.sleep(2) Raspbian’s repository. There’s also a module that allows you next_cursor = search[“next_cursor”] to use eSpeak in Python and allows you to perform In the above code, we connect to our Twitter account and automation tasks. Fire up a terminal and use the sudo apt- fetch a list of all our followers. We use a technique known as get install espeak python-espeak command to fetch the cursoring to separate a large set of results (the list of library and the required Python modules. followers) into pages and then move forward through them Using the eSpeak library is pretty straightforward. Type (with next_cursor). The For loop lasts till our list of followers espeak “Hello! How are you doing, today?” in a terminal is exhausted. For every follower, the loop prints its name, and the library will use its default settings to verbalise the text stores it in a variable (their_name) and then passes it on to inside the quotes. You can then influence the speech of the the eSpeak library which reads it aloud. It then pauses for a eSpeak library with a wide array of command-line switches. couple of seconds before moving on to the next follower. For example, the command, espeak -ven+f2 -s140 “Aren’t you a little short for a storm-trooper”, will speak the Hack #9: Voice control your Pi message at a slower pace and in a female’s voice. In addition Apple has Siri, Google has Google Now and Microsoft has to the default English voice, eSpeak can also do American Cortana. If you think the Raspberry Pi doesn’t have a digital English and English with a Scottish accent. Besides English assistance of its own, then you haven’t heard of Jasper. Unlike eSpeak can also speak various other languages. The the previously mentioned assistants, Jasper is open source. command espeak -voices lists all available voice files. To hear Jasper’s output you’ll need to hook up speakers to The Python eSpeak module is quite simple to use to just the audio port. However, as the Pi doesn’t have a microphone convert some text to speech. Invoke the interactive Python input, you’ll need to find a USB mic that works with the Pi. If shell with the command python and enter the following lines... you’re feeling adventurous you might as well try plugging in a from espeak import espeak USB webcam – some of these have microphones. After espeak.synth(“How ya doin’?”) hooking up the microphone, make sure the Pi recognises it as Now let’s use the eSpeak library inside a Python script to a recording device with the arecord -l command. print and speak out loud the name of your Twitter followers. While you can install Jasper on top of an existing Raspbian Follow the instructions in the first hack to get the Twitter API installation, the recommended way is to use the SD card and access tokens and their secrets and place them between image. Grab the tarball off the website (http:// the single quotes in the code below: jasperproject.github.io) and extract the image from it with import time tar zxvf jasper-disk-image.tar.gz. Then assuming /dev/sdd from twython import Twython is the location of the blank SD card, type sudo dd if=jasper- from espeak import espeak disk-image.img of=/dev/sdd to write the image. When it’s api_token = ‘ ‘ done, boot the Pi from the SD card. You can configure Jasper api_secret = ‘ ‘ from a remote computer via SSH, so you’re ready to get access_token = ‘ ‘ started if the Pi is connected via Ethernet. If you’re using WiFi, access_token_secret = ‘ ‘ you’ll have to connect a monitor to the Pi, start the X twitter = Twython (api_token, api_secret, access_token, environment and use the graphical Wi-Fi config utility to set access_token_secret) up the connection. next_cursor=-1 The login credentials for the Jasper image is the same as while (next_cursor): a stock Raspbian distro, that is pi:raspberry. Once the network’s been setup, connect to the Pi over SSH. Then in the home directory of your Pi, fetch the Jasper client with git clone https://github.com/jasperproject/jasper-client. git jasper. Then upgrade the setuptools library with sudo pip install upgrade setuptools. When it’s done, pull in the required Python components with sudo pip install -r jasper/client/requirements.txt. Finally, set the required permissions inside the home directory with sudo chmod 777 -R * and restart. While it reboots, Jasper will run the boot.py script and generate the languagemodel.lm file inside the ~/jasper/ client folder. Make sure the file has been created. If not, you can manually invoke the boot.py script with python ~/ You can customise and extend Jasper by adding your own commands. jasper/boot/boot.py. Once the language model file has

40 LXF191 December 2014 www.linuxformat.com Hack the Raspberry Pi

been created, proceed to create a user profile for Jasper to get to know you. Change to the ~/jasper/ client directory and run the profile population script with python populate. py. The script will ask for information such as your name, contact details, etc. Jasper uses this information to communicate with you and respond to your queries more accurately. Also remember that Jasper will ask you for the password for your email account and then store it as plain unencrypted text. The details are stored in the profile.yml file. Follow the documentation on the project’s website to integrate other services such as Facebook and Spotify. Restart the Pi again after you’ve run through the profile creation script. When it’s back up, Jasper will greet you with the speech synthesizer you selected while creating the profile. You can now start interacting with your new assistant by saying In LXF186, ‘Jasper’. If it catches the phrase, Jasper will respond with a mc.postToChat (“Hello, this is a demo of Minecraft API.”) Jonni showed beep. You can now speak your command such ‘What’s the time.sleep(2) you how to build time’, or ‘Do I have new email?’. Again, if Jasper can hear you it playerPos = mc.player.getPos() #Find your player’s position a cannon and will respond with the answer. Depending on the quality of your #Change your players position blow stuff up in microphone and the oratory skills of the operator, your initial mc.postToChat(“Let’s teleport you 50 blocks in the sky!”) Minecraft. conversations with Jasper might not be very pleasant. time.sleep(2) mc.player.setPos(playerPos.x,playerPos.y + 50,playerPos.z) Hack #10: Minecraft Pi Edition # wait for 10 seconds while you fall back The Minecraft Pi Edition is a cut-down version of the popular time.sleep(10) Pocket Edition but includes enough components to unleash # - create a STONE block in front of you your creativity. You can explore randomly generated worlds playerPos = mc.player.getTilePos() and use the construction mode to build your own creations. mc.setBlock(playerPos.x+1, playerPos.y+1, playerPos.z, The best thing is its API, which can be accessed using block.STONE) Python. You can write Python scripts to move the player as time.sleep(5) well as create and destroy blocks. This allows you to create # - Now change that block into WOOD structures in seconds that would take hours to create by mc.setBlock(playerPos.x+1, playerPos.y+1, playerPos.z, hand. The API also lets you create interactive objects such as block.WOOD_PLANKS) clocks and equips you with teleportation powers. You can time.sleep(5) learn programming while having fun. # - Now let’s create a tower by stacking block To install the Pi edition, head to pi.minecraft.net and for top in range(0, 10): download the compressed archive. Then extract it under your mc.setBlock(playerPos.x+3, playerPos.y+top, playerPos.z, home directory with tar zxvf minecraft-pi.tar.gz. This will block.STONE) inflate the archive under the ~/mcpi directory. Switch to the time.sleep(5) directory and launch the game with ./minecraft-pi. If you’re # - Let’s now teleport you to the top of the tower not familiar with Minecraft, you control movement with the mc.player.setPos(playerPos.x+1, playerPos.y+10, playerPos.z) mouse and the WASD keys. Keys 1-8 select items in your Save the script and while Minecraft is running, fire up the quickbar, and the space bar makes you jump and double-tap script with python ~mycraft/demo.py. If you haven’t made on the space bar to toggle the ability to fly. any typos, you’ll see the welcome message in the game as You can use the API to connect to a running Minecraft defined in the postToChat string. We then find your player’s instance. However, before you take control with the Python position with getPos and store it in the playerPos variable. API, it’s a good idea to make a replica of the Python API folder the players position is defined with the X, Y and Z coordinates from within the /mcpi folder to a new location. In the that you can see in the top-left corner of the screen. We then terminal, type mkdir ~/mycraft to create a folder and copy use setPos to change your position and teleport you into the the API into it with: sky. When you fall back down, we use the setBlock cp -r ~/mcpi/api/python/mcpi ~/mycraft/minecraft parameter to create a stone block (block.STONE) in front of We’ll now save our custom scripts inside the ~/mycraft you and then after five seconds replace it with a wooden directory. While the game is running, press the Alt+Tab keys block (block.WOOD_PLANKS). We then use a For loop to to switch back to the terminal. Open a new tab in the terminal stack ten stone blocks a little further away, and then place and change into the mycraft directory. Fire up a text editor you on top of it before ending the demo. and create a new demo.py script with nano ~/mycraft/ This is really just a demo of the things that are possible demo.py and copy the following into it: with the Python API. Download this neat PDF cheat sheet # Demo script to interact with the Minecraft environment (http://bit.ly/MinecraftPyCheatSheet) of the parameters import minecraft.minecraft as minecraft in the API along with examples and brief descriptions. Using import minecraft.block as block Python to control Minecraft is extremely powerful and offers import time so much flexibility that we can’t possibly demonstrate it all in #Connect to minecraft by creating the minecraft object this limited space. However, if you’re intrigued, check out mc = minecraft.Minecraft.create() Jonni’s Minecraft Python tutorials in previous magazines (see #Post a message to the minecraft chat window Coding Academy, p83, LXF185 onwards). LXF

www.linuxformat.com December 2014 LXF191 41 Michael Shiloh

42 LXF191 December 2014 www.linuxformat.com Michael Shiloh Tinker, Teacher, Artist, Maker Michael Shiloh is an artist and Arduino lecturer who loves taking things apart to build new creations. Matt Hanson talks to him about his hobbies.

Michael Shiloh is a Michael Shiloh: That’s a really good lifelong tinkerer, a question, and it’s one that I think a lot about, Interview supporter of free actually, because I also teach and I think that and open source teaching and open source go together hand- software and in-hand. Open source, in a way, is providing hardware, a tutor the software, but it's also teaching about and an artist. He's how the software works. Of course, for heavily involved someone who is willing to share their with the DIY Maker movement, and his software as open source is willing to show artwork and robots are aimed at the world how they did something. So it’s a inspiring people to make their own willingness to not only share the code, but creations – which is why he often uses share the knowledge that someone has. Arduino boards. I think to some extent there’s a connection between that and the art world Linux Format: First of all, Michael, your as well. In my experience in the art world background sounds absolutely there are – well, I want to say there are two fascinating, with your work combining kinds of people, but that’s a bit of a DIY creations, electronics and art. So how generalisation. But to use that expression, does open source, electronics and art there are some people who like to cover actually combine? their work up so that all you see is the

www.linuxformat.com December 2014 LXF191 43 Michael Shiloh

exterior of what they want to present, and the inner workings of how they got there is hidden. And then there are those who are more than happy to have the inside be exposed. This isn’t just true of mechanical art, which is what I’m kind of referring, but even with visual art, where someone might have a particular technique. So there might be, I don’t know, maybe a particular application of paint colour even, and one artist might say, “I’m not going to tell you how I developed that colour, it’s my own secret.” Then, somebody else might say, “I’m happy to share with you how I did this: here’s my recipe!” So I find that’s a lot like the open source versus closed source movement. I see it in viewers as well. I look at a piece of art and immediately want to look behind it. How was it done? How was it made? Then, by the same token there are other viewers who just would enjoy something as it’s presented, and not be curious about how it’s working. Like I said, though, breaking things down into two is a fallacy in the first place, but have a conceptual nature. I’m very interested in then requiring that people do something on it, is you can sometimes think of things that way. the conceptual aspect of art. one that has intrigued me, and I have done a The third category is a thing that I'm having number of similar pieces like that since. I’m still LXF: Definitely. And as you say there are a lot of trouble defining. It’s creating situations trying to figure out how… some artists who want to be shrouded in in which people have to do something in order I run into difficulty sometimes justifying that mystery, and almost remove themselves for the art to be meaningful. So, one example is as art. I’ve done a number of other pieces like from the art and have their artwork without a robot that I built quite a while ago, maybe 20 that. We did a similar robot project, a smaller context, and then there are other people years ago. In fact, I had to go and dig through version, and did it at an art gallery. People had who invite people ‘behind the curtain’. the Internet Archive to find the original website. to sit down and program it on the spot. MS: Yes, and this is not to judge either one, but I It was a very simple robot, not many sensors, a Amazingly, people did. I’ve always said that the think they are just two different approaches. couple of motors. So the computer that drove true measure of something’s success in a Neither is better, neither is correct. the robot was a full Linux server. It was on the gallery is if you can compete with free internet, wide open. It served a web page, and and wine... LXF: So what is the scope and the breadth there was a domain that linked to it, http:// of the projects that you’ve worked on? linuxrobots.org. So, the robot wouldn’t do LXF: Fantastic. So it’s interesting to think in anything until someone a general art gallery how much of the ON ROBOTIC ARTFORMS logged in and write a audience would be able to go and program – program for it. So, on the is that more your audience? “Survival Research Labs is a webpage I provided a MS: Not necessarily, this was a general art number of examples, I gallery, and we did the project with Arduino, so it performance group, but the explained how it worked. was very simple, and we provided examples and It was all documented, explained to people what was going on. And performers are machines...” there were examples, and yeah, you’re absolutely right, it isn’t for I gave the instructions for everybody. But we had people who'd never MS: They seem to fall into two categories. logging in. So I gave the root password, and the programmed before in their lives sit down and Maybe three. One of them is mechanical art, whole point was people from around the world program. One of my friends said the trick is not also sometimes called kinetic art or machine would connect to it, write programs for it and to tell them that they’re programming. You just art. I got exposed to this field through my work the robot would do something. It was a very say they are just modifying something. You give with a group called Survival Research Labs. It’s interesting experiment, it would spend most of them some pointers to what to modify, and a group that’s been around for over thirty years the day doing nothing, and then suddenly it what to expect when you modify something a now. It’s a performance group, but all of the would wake up and start roaming around! certain way, and then just let them fiddle with it. performers are machines. So they build large Usually in the middle of the night, which Then, they don’t think they’re programming. machines, most of which are remote controlled, suggested that most of my visitors were on the Which was actually another interesting aspect. and then stage productions with them. The other side of the world… or maybe just up in the I’m very interested in the part of teaching performers are the machines, and the humans middle of the night. Many of them didn’t leave technology where, if you were going to tell are the operators, sort of backstage or off-stage. comments, I had no idea who they were, what people they were going to do something, say as So a lot of the machine art that I do is heavily they were doing, where they were from. Some complicated as programming, and they had influenced by that type of work. of them left meaningful comments. One of my some phobia about it, or they didn’t consider Then I also have done a series of furniture favourites was that somebody wanted to make themselves , they wouldn’t pieces which are kind of similar in the sense the robot dance. So, they were experimenting approach. But, if you somehow don’t present it that I use a lot of metal; I use a lot of concrete. with different movements to make it dance. It as such, then more people will join, that So, sort of, the industrial materials. Heavy was something that I had never thought of. otherwise would have missed out on it. I learnt industrial materials that I think also reference So, the whole concept of putting something that at the first Maker Fair, where we did this the connection to machine art. Usually they out there that was sort of a blank slate, and huge workshop that was designed for people to

44 LXF191 December 2014 www.linuxformat.com Michael Shiloh

take stuff apart and build new things out of wasn’t called that then – was just being have a serial port. Everyone was in a panic, them. What made it work in this way was that developed. People shared stuff, very very freely, because what are we going to do now with all of there was a lot of space there. Whole families because there didn’t seem to be any value in it! these boards that use serial ports? would come in and sit down and usually they So, if you wrote a clever little program – for So, I and a couple of my friends founded a would say ‘we’re just going to watch’ and only instance one of my office mates wanted to company to make a basically Arduino-like thing. one family member would be the builder, the know when she got new email. So, she wrote a It had a USB connection, in fact it used the designated person who would get involved. little program that would ring a bell whenever a same chip that Arduino ended up using, the Usually it was a young boy, stereotypically. But new email arrived. Of course now that is FTDI chip. It also had a number of generic I/O what happened was that after a while you’d see something that every mail reader has, but back ports that you could configure in a number of the parents starting to fiddle with things. There then it wasn’t. It was immensely useful and it ways. And we were moderately successful, we was stuff everywhere so there was plenty of spread all around the internet, and I don’t think were in maybe as many as a couple of hundred materials. The other kids would start playing that she officially made it open source, but there universities worldwide, I think Bath University with stuff, maybe they’d start playing with was just no question about it. had one actually. It wasn’t wildly successful, somebody sitting next to them. They would see I think it was more a matter of being though. It didn’t explode in the way Arduino did. what other people were doing and begin adding culturally used to sharing information that way, After a number of years of doing that, to it. A few hours later they would start building rather than closed source, that introduced me actually it was around the time Arduino came these wonderful big things, and it was really to open source. It wasn’t until I began running around, we felt it was no longer necessary. So I interesting to me, that none of those people into programs that weren’t that way, that I sort was keeping my eyes out for something like that would have signed up if I had said ‘You’re going of said,“Oh, there’s a whole other half!’” anyway, and that was how I heard about Arduino. All of these different types of boards ON COMPUTING HISTORY LXF: So a lot of your had different features, different prices, different background involves levels of complexity, different kind of software “I discovered open source tinkering and rapid approaches, and I think one of the successes of prototyping – is Arduino is that they hit a sort of sweet spot of all long before I think it that how you were of those decisions. Like how complex should it introduced to be, what could the software do, what should the was even a term...” the Arduino? user have to do, how much should it cost? MS: You know, I’m not And the other piece of magic is that Arduino to make something here’. But, by virtue of the sure exactly how I was introduced to Arduino, immediately developed a large community, and fact that there was space for them to sit down, but it was probably around that. I’ve always that was really key to its success. Because with they got involved. And that’s what kind of ties it been a tinkerer, it’s not as if one day I decided that community comes not just validation, but into these robot projects. How can I trick people I’m going to be a tinkerer! It’s just the way I also the support that a small company just into doing these things without their barriers work; fiddling with all kinds of different cannot provide. coming up, and saying, “Oh, I can’t do that”? electronics and building things and making stuff. I can’t remember the specific time I met LXF: It also shows the power of open LXF: The connotations of the word Arduino, I think I just started hearing the name designs, and how that can rapidly grow. The ‘programming’ for a lot of people means that and decided it was something that I should ecosystem is huge now, and it attracts a very they can sometimes tell themselves “Well, I know more about. I actually had co-founded a committed community. So, open hardware haven’t got a computing degree, I won’t be company many years earlier to do what Arduino seems like an obvious extension to open able to do that.” But to invite them to make a is doing now, and we weren’t the only ones. source software, but the comparative robot dance? It brings almost a bit of a There were other companies doing similar number of projects is still rather small. What human element into it, and they suddenly things. The BASIC Stamp, for example, was do you think the stumbling blocks are? say, “Maybe I can do that!” Something that around then. This was back when a lot of MS: I think probably there are two major we’ve been struggling with in the UK is computers still had serial ports. The new Apple stumbling blocks. One is that with open getting kids coding, encouraging that. computer, I think, was the first computer to not software you can reproduce it just by copying a MS: You’re right, and I think that this is interesting, from the point of view of education, for that very reason. The thing about teaching about robotics and electronics and programming, there’s going to be a whole lot of students who would gravitate towards those subjects one way or another. Then, there will be another load of students who will run away from that, no matter what you do. It’s that group that I’m interested in. You know, the first group will find it. But the latter group – how do we reach out to them?

LXF: So was open source something that you discovered naturally through your career? Was it an extension of your artwork? MS: I think I discovered open source long before I think it was even a term. I went to university at Berkeley at the time that Unix was being developed, and the internet – though it

www.linuxeditor.com December 2014 LXF191 45 Michael Shiloh

file. With open hardware you have to actually production started becoming very prevalent, LXF: Certainly with open source software manufacture something. I think the other there was also an attitude change that needed there’s also an ethical element with making difficulty is that I think there’s a sense with open to come along with it; mass consumption, of software available for people who wouldn’t software, as a business, that you can make your course. But for mass consumption to work you be able to afford an expensive licence for a money elsewhere: in support, in custom need to be willing to throw away things in order closed source software equivalent. With versions of that software. With hardware, I think to buy new ones. You only need one phone, but open hardware, as you said, as much as we’d there’s a sense that the only way you can make if that phone is going to become obsolete in six like to offer materials and tools to build the money from the hardware is by selling it. And months, then you’re going to have to buy hardware, it’s not always possible. Your then once you give someone the ability to make another one. I think that discouraged the DIY LinkedIn profile states that ethical their own, they have no use for you. and the maker and the tinkerer, because as approaches to resources is very important to things are mass produced they have to be you, so how do you ensure that that’s at the LXF: But do you see open hardware produced in a way that is as inexpensive as forefront of what you do? continuing to grow despite all these possible, which means that they need to be as MS: I don’t know if I succeed in that. I’ve always stumbling blocks? compressed as possible. So it just makes things had an interest in repairing things, and there is MS: Good question. I hope it does, I think it harder to tinker with. So, there’s a resurgence of certainly a huge ethical aspect to that. There’s probably will – there’s certainly a huge open interest now in the maker/DIY movement, and also a certain, I don’t know, aesthetic or… I feel hardware movement right now. But, I think my fear is that it's just another one of the cycles. good. That probably is an ethical thing. I feel maybe because of those stumbling blocks, I That there will be this interest and then it will good when I’m able to repair something or think that, well… collapse. So I think the interest in open reuse something instead of buying a new Here’s why I’m hesitating. There’s a huge hardware is tied to that because much of the replacement. So, I guess in my own work I don’t amount of interest in the sort of maker, DIY open hardware products are in this community. have to ensure it because that is where I will go movement right now. And of course DIY and If this community becomes less relevant, then naturally, it’s a tendency of my own. When I making isn’t a new concept, we’ve been doing it I’m afraid that open hardware will become less teach this stuff, or when I am preparing a for, well, the beginning of our race, pretty much. relevant. What I’m hoping is that this isn’t a workshop, in many of my classes we do use a So what’s happening now, I think, is a sort of cycle but will continue – an upward trend. If this lot of recycled and discarded electronics. It’s not renewed interest. I think we’ve seen it go interest in DIY is an upward trend, then I so appropriate for a three-hour workshop, but through cycles. I think that, and I’m not much of suspect that yes, the open hardware movement for instance I’ve just finished doing a two-week a historian, but I get the sense that when mass will also continue as an upward trend. workshop for the California State University. Because it was two weeks we could do that, so before the workshop we had the students gather a number of discarded electronics and we talked about taking them apart, and what things were valuable inside, so they could recognise different components and how they

ON THE RASPBERRY PI “I’m not a fanatical open source user, but I would prefer it if the Pi were open.”

can be reused. Then they went ahead and built new things with them. So I think by demonstrating that, and making those materials available we get that ethic passed on and instilled as early as possible.

LXF: So with Arduino being quite an open design, there’s also the Raspberry Pi which is an interesting contrast, because a major complaint is that despite its popularity the Pi still has closed source elements. What are your feelings on this? MS: I guess I don’t have very specific feelings on that. I’m not a fanatical open source user – I do use Android rather than iPhone, but then the phone itself uses closed source elements. I would prefer if the Raspberry Pi were open because I think there is an educational opportunity there that’s missed. I guess I don’t think of it as a ‘this versus that’ but just another option in this pantheon of boards that do this sort of thing.

46 LXF191 December 2014 www.linuxformat.com Michael Shiloh

LXF: So where do you see Arduino heading in the future? MS: I think – and I should say this isn't the official Arduino point of view, this is just my interpretation of what I see and what I hear – obviously there are new processors, new micro- controllers coming out all the time, so taking advantage of the ones that seem appropriate for ‘Arduinoisation’ is definitely interesting. As they become more powerful, people will sneer at the older models so we have to remain current, when appropriate. I think the Arduino Yun has shown that an easy way to do networking is very important, so I imagine there will be more of that in the future; a continuation of that. Education is something that’s quite important to us, so figuring out ways – like we were talking earlier about – how it's being used in schools. Figuring out how to continue with that and make it more accessible; providing more materials for that. Those are the trends LXF: Sure, and what’s more important is the little board with the blinking light. So he said if that I’m aware of, I can speculate on a lot of endgame, which is getting kids involved with that makes them pay more attention to the things but I really don’t know for sure..! building their own projects, having it things I’m trying to teach them, then I’m willing affordable. Would you say that was more to use it! So it becomes sort of a vehicle for LXF: Finally, you co-founded Teach Me To important than worrying too much about exciting the classroom, and that’s great. Make – how successful has that been? how much of it is closed source? MS: Actually much more than we thought. I MS: Yeah, and Eben’s endgame was very much LXF: So with the Arduino Yún, which is a cool originally created Teach Me To Make because at at getting as many of those computers in the Linux and Arduino hybrid, where are you that workshop I told you about earlier at the hands of people as possible, so if he was able to seeing that being used in particular? Maker Fair, I found I needed a website, a URL for bring the price down further by agreeing to MS: I’m aware of a number of individual somewhere to put it. So I came up with Teach include closed source hardware then he’s projects, but I’ve not seen them quite fall into Me To Make almost on a whim, and grabbed the accomplished what he wanted. categories of things. The most common place I domain so I could at least put materials, see the Yún being used is anything that needs pictures whatever up there. But really, Teach Me LXF: Absolutely, and we’re quite excited at to be connected to Linux Format about how the Raspberry Pi is the internet, because ONTEACHMETOMAKE being embraced by schools in the UK. Do it has the Ethernet you see Arduino playing a similar role in the and Wi-Fi built in it’s “We’re not advertising, but US and the rest of the world? just ideal for that kind MS: Yeah, in the US and the rest of the world – of stuff. In fact, the people keep finding us and very much so in Europe. I see it in more and workshop that I just more places – in more schools and universities. did at OSCON was asking us how to do things.” And I’m always curious as to how they find out focused on just that. about it, how they decide to apply it. I can see it So, the idea being that if you want to control a To Make as an organisation came into being coming into university level, but with high robot on a network, monitor plants and any kind when my partner Judy and I started doing schools it surprises me, but always pleases me. of control or sensing applications that need to workshops together and we needed a place to I suspect it’s most often one teacher who be network accessible... that’s ideal for the Yún. put our materials. We needed a place to knows of it, who says, “this will be applicable to The target audience for the Arduino advertise what we did, so whenever we teach a what we are doing.” originally was not for engineers. So the workshop, whenever we do an event, whenever What I like seeing is that it's not being used challenge was how do you get non-engineers to we develop some new project we put that just to teach programming or robotics, or the turn LEDs on and off, or recognise presses on information up on the website. We have a things that it was designed for, but that buttons? It was showing them how to do this Wordpress blog on it, because it’s easy and I like teachers are starting to see it as a tool for without having to become engineers. So when something I can edit on the fly, and Wordpress talking about whatever else they want to talk the Yún came along, it now has a real computer is good for that. But I’ve put up a lot of about. So an example of that is environmental on it, it now is serious engineering, so the materials, usually things that came out of science, for monitoring the atmosphere and the question I find when doing workshops is how do questions my students asked. water and what have you, and I had a you fit that in with that philosophy? The Ardiuno One of the recurring questions was ‘How do conversation with a physics teacher who software developers created a mechanism that I use a transistor as a switch?’ So I did a pretty wanted to use Arduino to measure a toy car from within your Ardiuno sketch you can cause thorough treatment on that. I’m amazed but I going down an inclined plan; all the classic things to happen on the Linux side, so you can keep getting hits for that, and getting questions physics experiments but instrumenting them run a program on the Linux side, you can from around the world on how to do things. So with Arduino. So I said, “Is this really adding execute a command and get responses back. people are seeing it, even though we are not much to what you’re teaching?” and he replied You can tell the Linux side to go out on the actively advertising Teach Me To Make very that the most important thing is that the kids internet and download some data and feed it much, people keep finding us and asking us are really into it. They’re really interested in this back to you. how to do things. LXF

www.linuxeditor.com December 2014 LXF191 47 JACK

Turn on, tune in, JACK out Demystifying JACK, discover with the help of libremusicproduction.com how you can plug into the world of professional audio on Linux.

For more pro-level music guides, advice and help visit: libremusicproduction.com

48 LXF191 December 2014 www.linuxformat.com JACK

ACK is the de-facto standard audio server for working with professional You do know JACK audio on Linux. JACK (a recursive Jacronym for ‘JACK Audio Connection Kit’) is a very powerful piece of software. Some new users find it confusing 1 at first and that’s understandable, with its 2 complex interface and myriad settings. However, you only need to know the basics 1 to get started and take advantage of its 2 underlying power. By the end of this guide, you will hopefully 3 3 have a sufficient understanding of JACK and its workings so you can set it up, forget about it and get on with your work, utilising the power that it provides. Throughout the article we’ll refer to any piece of software that supports JACK as being ‘JACK aware’. 1 Select a driver 2 Select interface 3 Choose settings Ensure you select the Cadence Ensure your interface is Match your interface settings What’s JACK driver tab (left window) and connected and powered, here. If you were wondering, JACK is a sound server optimised for the choose your driver, typically otherwise it might not show up frames/period is exactly the demands of audio production work. There are this will be ALSA. here for you to select. same as Buffer. a few main aspects to what it does. Let’s have a quick overview of these now. Settings: JACK controls your audio and As you can tell, JACK is a very capable tool selected settings. In such a case, you can make MIDI settings. It allows you to choose your but don’t be intimidated by its potential all your software connections from within your audio interface as well as all the important complexity. Using JACK does NOT need to be DAW of choice so there isn’t as much need for audio settings such as sample rate, buffer size complicated. Just because it’s capable of an external connection manager. and periods. These settings will be explained in intricate workflows doesn’t mean it’s not also For people with a more modular recording more detail further down. suited to more straightforward set ups. It will set up, including multiple effects processors, Performance: Using JACK will allow you to do what you want it to do, and is flexible recording and sequencing programs, a JACK achieve low latencies with both audio and MIDI. enough to allow you to do more, if you ever manager more geared towards making This means that if you are recording an need it. You can also happily work in one connections might be best, especially as some instrument into your computer, you can program and allow JACK to manage all its modular programs don’t have connection monitor the audio back through your speakers, connections and never leave that program. managers themselves. The following are the or headphones, without any perceivable delay. We now know what JACK is and what it’s most popular JACK managers: For a good overview, and visual description of capable of. How do we use it? The first thing to Qjackctl is a very powerful, and popular, latency, check out ‘Latency and Latency- note is that JACK itself is a command line JACK manager. It allows you to access a large Compensation’ at bit.ly/LXFardour. program; however, there are various graphical amount of JACK’s settings and includes a Connections and Interconnectivity: This managers for JACK that allow you to easily connection manager, transport controls and is JACK’s strong point. Any inputs and outputs unlock its power. There are two main types of even a manager for JACK session, which is a from your audio interface and/or JACK aware JACK managers, so you can choose the type session management program. It presents programs can arbitrarily be connected that best suits you and your workflow. They itself in a small window, allowing you to dig into together. JACK not only deals with connections can be categorised as JACK set up managers, only the settings you need to access. It can between programs but also within programs. which allow you to start up JACK with specific also be minimised to your so it can get Any JACK aware program uses JACK to settings, and JACK connection managers, out of your way once you have set it up. manage its inputs and outputs. The beauty of which primarily deal with making connections. Cadence is an easy to use tool for setting this is that these connections are available for The various offerings of JACK managers up and starting JACK. It comes as part of the any other JACK aware programs to also combine these two aspects together to varying KXStudio distro and includes JACK bridges, connect to. They are not restricted to only degrees. So, why would you choose one over which allow you to play normal desktop being ‘internal’ input and outputs. the other? If you are doing all of your work sounds, such as , through JACK. All of this makes JACK a very flexible tool inside of a DAW and you use no external Cadence can also start JACK on login, and allows you to interconnect any number of programs, you might be happy with a JACK set including JACK bridges. If you set it up once, JACK aware programs. up manager to just start up JACK with your there is very little maintenance thereafter. All in sync JACK can be used to sync up multiple JACK Aware programs. This means that if you want to use Any software that supports JACK is referred to connections, think of JACK in the same way, the MIDI sequencer from one program, and the as being JACK aware. This means that all it’s except that it is system wide. Any software that audio sequencer from another, you can easily audio and MIDI inputs/outputs are managed is JACK aware can be plugged into this system, keep them in sync with JACK. Both programs through JACK. The idea of a DAW using another similar to how a DAW would add plugins. The will start and stop at the same time. Moving routing system can be a bit confusing at first. difference is that JACK allows you to have along the timeline in one program will be The way to think of this is by creating a parallel. precise control of how to route anything you mirrored in any other programs that are set up If you are used to your DAW managing all your connect up to it. to sync with JACK.

www.linuxformat.com December 2014 LXF191 49 JACK

Monolithic JACK into Patchage

Monolithic set ups are where you do all your work in one program. This is the most SYSTEM INPUTS ARDOUR INPUTS common approach people using Windows and Mac audio software will be used to. In Linux, JACK allows for very modular set ups, 1 4 although some applications are fully featured and can also be used as monolithic 2 set ups, eg. Ardour and Qtractor.

Patchage and Catia are two similar visual connection managers for JACK. They give you an overview of all your connections. Audio and MIDI ports are colour coded so it is easier to 3 identify your connection types. Creating connections is as simple as clicking and ARDOUR INPUTS SYSTEM INPUTS dragging from an output port to an input port. 4 Basic settings If you are familiar with audio production on other platforms, you may already be familiar with some of the terminology used in relation to settings. If you are a new user this can be confusing as JACK has a vast array of settings. The main thing to remember here is that most 5 of these settings are not important, at least not for starting off. If you don’t know what they are, you probably don’t need them just yet. Here is an explanation of the main ones that you need to worry about to get yourself up and running... 1 2 3 4 5 Buffer size (frames/period): Smaller Audio GuitarIX Hydrogen Ardour Audio interface inputs A virtual guitar drums Brings the all- interface outputs buffer sizes produce less monitoring latency. A Your main inputs amp, it’ll act on the The GNU/Linux important editing, Inputs are mixed lower setting will make the computer work for the track are signal exactly as a drum machine recording, and here and sent faster, which will allow for lower latency, but at listed here. real amp. inputs to Ardour. mixing element. to the outputs. the expense of increased CPU usage. Higher (larger) settings are more stable but you won’t get low monitoring latency with them. If you CPU harder, which can sometimes result in interface, it’s wise to use this to monitor your are looking to achieve low latency monitoring, xruns (pops and clicks). recordings instead. a setting between 64 – 256 should certainly Periods/buffer: If you are making use of a give you usable results. USB device, you may achieve more stable low Setting up JACK Sample Rate: Higher sample rates result in latency by setting this to 3. Otherwise, use a This guide assumes that you have a properly less latency, for the same buffer setting. This setting of 2. If you wish to achieve low latency configured realtime set up. KXStudio (http:// setting is dependent on the optimal settings settings, it can be a balancing act to find out kxstudio.sourceforge.net) and AVLinux for your audio interface and your own personal what works best without pushing your CPU (http://www.bandshed.net/AVLinux.html) preference. Some people prefer to record at beyond the brink. If you don’t need to monitor are two Linux distros that provide such an higher sample rates, others are happy with your audio through your computer with low environment out of the box. We’ll see how to 44,100 (44.1kHz), which is CD quality. Another latency, there is probably no need to push your set up JACK settings with both Qjackctl and common setting is 48,000, which some computer any more than it really needs. You Cadence. The following steps are relevant to interfaces work better at. The higher you go are better off staying with a higher setting and both, with any exceptions noted... with this setting, the lower your latency will be, keeping reliability a high priority. If you have the Step 1: Click on the Setup button in Qjackctl, but you will also probably end up pushing your option of hardware monitoring from your or the configure button in Cadence. Step 2: Make sure that the realtime option is enabled (engine tab in Cadence) Step 3: Select your audio driver (make sure driver tab is selected for this in Cadence). If you are using a firewire device, select Firewire. In any other cases, leave it at ALSA. Step 4: Select your interface from the interface drop down menu. Step 5: Choose the settings for your interface. Step 6: Click OK to apply settings. Step 7: Press start! In Qjackctl, do not touch the name field. To sync programs, you need to make sure that one is master, and the other/others are slave. Some new users like to give their JACK server

50 LXF191 December 2014 www.linuxformat.com JACK

which means that JACK will now follow Ardour as timemaster. Modular Steps for Hydrogen Modular set ups are where more than one Step 1: Navigate to tools > preferences. In the program is used in a set up. JACK allows you to connect and sync various audio programs Audio System tab, make sure JACK is chosen together so you can benefit from the as the audio driver and restart Hydrogen. strengths of individual applications. Session Step 2: Now you will see two timemaster management can be used to manage and buttons showing up in the toolbar. Make sure recall complex set ups. One suite of modular that J.trans (Jack transport) is enabled. This applications is the Non Suite, which includes means that it will follow JACK transport, which Non Timeline, Non Mixer and Non Sequencer, is now being controlled by Ardour. although any JACK aware application can be Step 3: Now both programs will be in sync incorporated into a modular set up. The Non when you roll their transports. Additionally, as Suite also includes a very intuitive session Ardour is timemaster, you can change the manager called Non Session Manager. The connection matrix within Ardour is an tempo in Ardour and this will be reflected in easy way of managing many connections. Hydrogen, or any other slaved program. Repeat the same steps for each other track The fact that JACK manages audio and until all the connections are set up how you a name but this can cause JACK not to work as MIDI ports, as well as allowing any programs want them. expected. Unless you know what you are doing, using them to sync up makes it a very powerful Something to note here is that all these leave this alone as it will cause more hassle tool. This enables very modular set ups to be connections made will show up in any other than it’s worth. created using JACK. For anyone interested in JACK aware programs, for example, if you look Once you have these settings set up, you modular set ups, we recommend you look into at the connections window in Guitarix, you will can then use any JACK aware programs and session management, particularly Non Session also see the connections there that are made they will run with those settings. Some Manager, to explore the possibilities of from within Ardour. This is because it’s not the programs will allow you to change your buffer managing modular set ups with these tools. programs that make the connections. They size, so that you can adjust audio latency use JACK to manage the connections and tell it without having to restart JACK. Making connections what to do. Remember, JACK is your routing So, even though JACK is very powerful, you Let’s create a recording scenario to system and these programs are only using it. needn’t be intimidated. At its most basic, it is demonstrate how to make connections using The following is a complete overview of all very easy to set up your interface and get JACK. Here is the scenario we’ll be using connections broken down so they are easy to started. Like with any decent program, you can Ardour to record the following instruments: understand. learn more about the power of JACK as you go Patchage is the best to illustrate something along but don’t get too bogged down starting INSTRUMENTS AND INPUTS like this, open it up and check it out – note the off when all you really want to do is learn to use Male vocals Input 1 colour code, audio ports are in blue and MIDI some new software. ports are in red. All connection managers have Female vocals Input 2 If you are having any trouble at all getting their positives and negatives. While it is very JACK to run, or to recognise your interface, just Acoustic Guitar Input 3 straight forward for a smaller amount of inputs make sure your interface is both connected up and outputs, Patchage can get messy and hard Acoustic Bass Input 4 and turned on before opening up your JACK to decipher with large amounts of connections. manager. If you are still having any issues, as Lead Guitar Running through Ardour’s built in matrix connection manager is virtual guitar amp, ever, try rebooting your system while your very good for very large numbers of connects Guitarix interface is hooked up. as you can deal with them across categorised Percussion Hydrogen drum tabs. This makes it much neater. JACK Sync machine synced up This is a basic session but it demonstrates Another aspect of JACK that can be useful is Piano MIDI keyboard how audio and MIDI connections work in JACK. JACK sync. Not only can you interconnect plugged into MIDI It also incorporates JACK applications external programs, you can also make sure that their input with virtual to DAW, one of which is in sync with JACK. Try piano plugin on track transports run in perfect synchronicity. out all JACK managers/connection managers We take a quick overview of how to do this The built in connection manager in Ardour is and see what you find you’re most comfortable by means of a demonstration that you can used to make these connections, but the logic with and what best suits your workflow. They follow here... is the same whichever connection manager all do the same thing, they just do them in Step 1: First of all, start running JACK via your you use. In the top left you will see a mixer slightly different ways. In the end, you are using preferred JACK manager. window set up in Ardour. Out of shot we also the same logic to make the same connections. Step 2: Next start up the programs you wish have Guitarix and Hydrogen both running. The best thing about JACK is that it doesn’t to sync up, in this case Ardour and Hydrogen. Note the highlighted row. All connections are lock you into any single workflow. We’ve seen You’ll need to make sure the setting within already made, including connections with how to sync programs and make connections these programs are correct first. Guitarix and Hydrogen. between them but if you want to do all your Step 3: By default, Ardour is set to be JACK To make these connections in Ardour, left work in one DAW and never leave it, you can do timemaster, which is what we want. This click on the input buttons shown in the that too. JACK makes no assumptions. It setting can be found by navigating to session > highlighted row. This will show a window from leaves all options open to you, to take properties and going to the timecode tab. We which you can select your input. In this case we advantage of at any time, and makes various will leave this enabled for now though. wanted to route the second input from the workflows possible, monolithic or modular. If Step 4: Next, we click on the ‘Internal’ button audio interface into the second track (female you find the tools you like, JACK will make on Ardour’s toolbar. This will change to JACK, vocals), so select capture 2 by ticking its box. whatever set up you have in mind possible. LXF

www.linuxformat.com December 2014 LXF191 51 PHP primer Build a PHP virtual dev box Kent Elchuk tellsusaboutvirtualmachinesandPHP scriptstocreatetheperfectdevelopmentenvironment.

HP might not be pretty, but it Start. Like a regular PC, you’ll proceed with the sure is useful and anything that installation and in the case of Ubuntu, you need can make developing and learning to select Install Ubuntu. Although the PPHP can only be a good thing. installation will appear like it’s installing to a We’re going to discover how using a hard drive, it’ll just be a virtual machine residing complete VM from scratch, will be able to in a .vdi file. Once you’ve installed Ubuntu, you’ll deliver web pages, run PHP scripts and be able to start the VM and login with the deliver email. On top of that, we’ll show you username and password you’ve created. how to clone a virtual machine and transfer The View setting gives you various options. it to another machine, regardless of On a new Virtualbox install, you may find the whether or not the host or guest is 32-bit screen doesn’t look the way you want it to. or 64-bit. The entire assembly will be The good news is that you can change that discussed from the download of the Creating a new virtual machine select iso. easily enough. To have more View options, such latest Ubuntu, installing Virtualbox as Seamless Mode, install vbox guest additions on Ubuntu, installing packages and apt-get update on the guest operating system. This can be modifying packages. apt-get install virtualbox-4.3 downloaded from http://download. Although this lesson focuses on Virtualbox, You’ll need to select Y when necessary. virtualbox.org/virtualbox. Note: You will need there are virtualisation alternatives, such as If you have any problems, you can refer to the run this as admin. KVM, VMware and Xen. Virtual machines can official wiki at http://bit.ly/VirtualBoxDLs. Now, set up your desired view and prepare be quite convenient and versatile. For example, With older installations, sources.list can be to be patient. The screen may look small at you can use packages like Rsync and other a problem. Alternatively, you can always make first, but this is fixable. Once you have Vbox methods to synchronise files and databases to a backup and just add the source for Virtualbox Guest additions installed you can access other virtual machines or directly to another for now, or you can bring your sources.list file Seamless Mode, Full Screen and Scaled Mode, machine entirely. up to date. You can always generate a list: but you may need to do a boot or two to get http://repogen.simplylinux.ch. everything looking as you want it to. Installing Virtualbox To open Virtualbox, look for it from the Dash The method to install Virtualbox on Debian- or run virtualbox from the command line and Clones and server setups based machines is to add a line into your /etc/ to create a new machine, select New, supply a To clone a virtual machine, select the machine apt/sources.list file for the appropriate Name, select a Type, a Version and click Next. > Snapshots > Click the Clone icon (which will package. Although Virtualbox is flexible, you After that, you need to supply a memory size either look like pages or a sheep). At this point may have to enable virtualisation in your or simply accept the default. These values can you’ll give the clone a name and follow some computer BIOS to make it work properly with be changed after install. Select Next > Create. obvious steps. You have options to move a VM 64-bit guests. When you’re prompted for the file type, VDI to a new PC. One method is to move the entire An example installation is shown below. For is a good option and is also the default setting. virtual machine folder from the Virtualbox VMS starters, open your sources.list file in an editor. Finish the obvious installation and create the folder. Then, you just need to fire up Virtualbox All commands will be run by the root user: virtual machine. By default, the disk size is and select Machine > Add. Another method is vi /etc/apt/sources.list often 8GB and to make a virtual Ubuntu server, to make a new machine and add an existing Copy the line into the sources.list file with you may want to add a little more disk space. VDI file. Now that Virtualbox is set up, let’s get deb http://download.virtualbox.org/virtualbox/ After installation, select your virtual a functional server up and running with debian quantal contrib machine from the list. After that, click Settings Apache, MySQL, PHP and Postfix. These Then run the following commands: > Storage > Empty (Under Controller IDE) > installations will only take a few minutes. wget -q https://www.virtualbox.org/download/ Select your ISO > OK. Now you can start your To install Apache, run the command oracle_vbox.asc -O- | sudo apt-key add - machine by, rather conveniently, selecting apt-get install apache2

52 LXF191 December 2014 www.linuxformat.com PHP primer

as root. After you’ve installed Apache, you should open a browser and type localhost. That should give you the Apache2 Ubuntu default page. For MySQL, run the command apt-get install mysql-server mysql-client as root. You’ll be prompted for a password on several occasions during the install. You can use one, or just press Enter, which will continue on with the installation without creating a password. If you choose not to use a password and decide to do so at a later date, it’s very easy to change the MySQL password. It’s a one-liner command. We now need to install PHP with the command apt-get install php5 libapache2-mod-php5 again as root. At time of writing, the folder which displays the website is /var/www/. In previous installations, the default folder was /var/www. Also note that Apache sets AllowOverride to None and you may want to change it to All if Choose the ISO that you want to use for your virtual box. you want to use .htaccess files. Let’s go ahead and create a test PHP file to to do this. Technically, you create an A record Ethernet and have its own IP.If you run see how it’s working. You can open any editor that points to your IP provided from your ifconfig on the host and guest you should see you want. By default, Nano and editors internet service provider (ISP). the two different IP addresses. The router will work right out of the box. If you want to use Once the DNS is setup, we need to should pick them up too. Although you could vi, you will need to run the command: configure your router, and to display your add USB wireless adaptors and use Virtualbox apt-get install website, we need to enable the port forwarding with wireless, this tutorial will focus on You’ll want to make a file called test.php. for port 80. By default, Apache and other Ethernet which doesn’t have wireless issues. Of course, it resides in the /var/www/html servers will use this port upon installation. Now that you have a working server that folder that was mentioned above. A simple line But, keep in mind that you can and may want can display public web pages, you may want to of code is . This to add more port forwarding. For example, to continue on and add email features. Like a function shows you many details about the enable email to forward on port 25, SSH on rented VPS or dedicated box from a hosting configuration. Now, you can open the page in port 22 and, optionally, FTP on port 21. All provider, you’ll have the basic tools that every your browser and see the details about your these port forwarding rules will use the same website owner would have. Now, we can move PHP configuration. This configuration can be local network IP address of your VM. onto the PHP primer. altered by editing the default located at /etc/ Okay so what’s your local IP address? When php5/apache2/php.ini. You can easily login you build a virtual machine with Virtualbox, PHP primer as root and edit this file. your networking will use NAT and take on the Now that you have all your ducks in a row, you default IP of your hosts connection. However, can open that favourite editor of yours and DNS and port forwarding you can set up Virtualbox so that the virtual start coding some PHP.Although PHP has its Although PHP must be installed, other machine takes on its own IP address. You can detractors its popularity is something of a scripting languages, such as Python and change this any time before you boot your phenomenon as a server side scripting are already there by default. A simple whereis Virtual Machine. To change the configuration, language and most of its users run PHP on python and whereis perl will tell you that. right-click on your VM and click Settings > some type of Linux server. It’s also very At this point, the server works and only a Network > Attached to. common for web designers and web few small tweaks are needed in order to make Connecting with Ethernet and NAT is a developers to use a hosting platform with a it viewable at an address like example.com. reliable and quick connection or using a LAMP (Linux, Apache, MySQL & PHP) stack or If you want to use a domain name, you will Bridged connection with Ethernet (eth0) and a LEMP stack. (Nginx, the HTTP server and have to point the DNS to your IP. You can use a changing promiscuous mode to Allow VMs. reverse proxy replaces Apache. Nginx is free DNS service or your web hosting service This latter method enables your VM to use pronounced ‘Engine-X’,hence E instead of N.) PHP security

With your new PHP installation, there is no safe functions to be disabled. By default, functions custom PHP.ini files can be added to your web mode and there are security issues. But, for a like exec, shell_exec and base64 functions can directories. These PHP.ini files can override the home server you can eliminate most problems cause headaches if files are on your system. main file. There is protection from this with the by disabling file_uploads, disabling functions, Functions like shell_exec and exec enable you suhosin patch. controlling all other access to the system and to write Linux commands which can overwrite All in all, your home PHP server should be fine monitoring file changes with Bash scripting. files, show the raw code using cat command and if you disable uploads and don’t allow access to All changes to your PHP configuration can be even take control of databases. The web is full of your system. And of course, never trust the done in the file /etc/php5/apache2/php.ini. kiddie scripts that can show and alter your data. user's input into any forms. There are many For example, you can change file_uploads Those are not the only security issues when functions like htmlentities() and mysql_real_ setting from On to Off and you can add more using PHP. Bad coding can be exploited and escape_string() that sanitise user input.

www.linuxformat.com December 2014 LXF191 53 PHP primer

What this has done is create an abundance you can print variables within double quotes. of scripts and libraries that be can easily echo ‘Hi there!’; //outputs: Hi there! accommodate many needs. Some well-known echo ‘Hi there $variable’; //outputs: Hi there applications are Wordpress, Joomla, Drupal, $variable Magento, Prestashop, and many more scripts. ... And with double quotes: In addition to many scripts, there are many $variable = “John”; frameworks that enable you to use libraries to echo “Hi there!”; //outputs: Hi there! write code, such as Symphony, Codeigniter echo “Hi there $variable”; //outputs: Hi there and Zend. John Although PHP is convenient, it’s so loose There can be times when you may see that it becomes very easy to write bad code. double quotes within double quotes; like the On the other hand, you can write solid objects usage of HTML. If that is the case, it can be Install your virtual machine just as you and solid code. On top of that, there are many backslashed to avoid interpretation. An would on your hard drive. libraries you can add to separate logic from example of this is design; like the Smarty template engine. If you with cron jobs or whenever you want to echo “My Link” the grounding for writing solid code, minus Let’s cover some of the basic features, such An alternative to the above is to change the having to declare variable types. as how to create comments, variables, arrays, double quotes to single quotes or use another Although there are many popular scripts loops, functions, classes and objects, CRUD, way to write it: out there, many do have a dark side. Some are mySQL queries and include files. very big and become so popular that they are All PHP files end with the .php extension. My Link also popular targets for crackers. On the other Any code between tags will be hand, if you code lean PHP websites with an interpreted. Any code outside these tags will emphasis on security, the code is much more be interpreted as HTML in a browser. Feature examples manageable and the performance often excels. tags work too, but, only if you configure For those who come from a background with C It can take a while, but with desire and PHP(php.ini) to allow the usage of short tags. or Python, you’ll be familiar with printing and patience, you can get to the level of hand- PHP has three main methods for the sprintf() function. An example of it’s use is coding PHP, MySQL, HTML and CSS which will commenting (that’s adding notes that aren’t shown below. allow you to build whatever you can imagine interpreted so you can easily follow what the $variable1 = 10; (given the time, of course). code is doing): $variable2 = 5; // comments after two forward slashes $variable3 = $variable1 + $variable2; PHP scripting # Command after hash tag $variable4 = ‘football team’; In this section we’ll cover PHP scripting which /* Comments between these can run as many $format = ‘There are %d men and %d women can be done via the command line or with files lines as you want */ for a total of %d on the %s.’; in the browser. PHP is interpreted on the server A common variable is either a string echo sprintf($format, $variable1, $variable2, and displays the output in a user’s browser. (characters) or integer (numbers). Variables $variable3, $variable4); Essentially, this is what you see everyday from can be declared via the $ symbol. The example Arrays are a group of items. The syntax of websites using PHP applications, such as we’re using below shows how to declare both indexed and associative array are show below: Wordpress and Magento. types of variable: $indexed = array(‘apple’, ‘peach’,’pear’, When you make scripts in a secure $my_string = “My string”; ‘plum’); directory, nested in your Linux box outside the $my_number = 3; $associative = array(‘name’ => ‘John’, ‘age’ => home directory, you can go ahead and run You can print to the page by enclosing text 24, ‘height’ = > ‘2 metres’); those files via the command line. Sometimes, within single or double quotes. Single will be ‘as Two commands that will always be useful you only want utility scripts that you will run is’ while double will be interpreted. This means are print_r() and var_dump(). They will show you the keys and values of arrays if you need to take a deeper look. Try print_r($indexed) and PHPscriptingandcommandline print_r($associative) to compare the keys and values of both arrays. When you run PHP scripts from the command */10 * * * * username /usr/bin/php -f /var/ PHP also has many array functions that can line there are subtle differences than www/html/filename.php be used to sort them, add the integer values interpreting it in the browser. One major Files that will run with cron jobs can require and much more. Variables and blocks of text difference is that '\n' makes space for a new different coding from those files running from line with the command line while '
' does the browser. Files in the browser are relative to are separated by a period, which is called the same thing when HTML is interpreted in the the public_html or www folder. Meanwhile, files concatenation. You’ll get to see concatenation browser. Furthermore, when PHP scripting via that are run with cron jobs need all included and in use in the section on loops (below). the command line you add the following code to required files to take on a path relative to the The most common loops you will use and the top of file: root folder. encounter are foreach, for and while loops. #!/usr/bin/php Therefore, although include ("my_included_ Usually, the foreach loop parses an array. And to execute the file within the current file.php") will work in the browser if the file You can separate any array into values or into directory: resides in the same folder, the cron file needs keys and values. Examples of various loops and the path to be something like include ("/var/ php ./update-status2.php functions are shown below. Here is a typical cron job that runs the file www/html/my_included_file.php") in order filename.php every ten minutes. The cron file to be able to reference its location. Foreach Loop This type of loop will parse can be accessed for the root or other users at An alternative to changing path names is to /var/spool/cron/username or by the simple remove include or require functions and add all the array in order. command crontab -e. of the code into a single file. foreach($indexed as $item){ echo $item . “
”; //concatenation between

54 LXF191 December 2014 www.linuxformat.com PHP primer

a variable and the HTML
tag. public $name = ‘John’; } function get_name(){ foreach($associative as $key => $item){ return $this->name; echo $key. “ - “ . $item . “
”; // } concatenation between variables and printed } text. $my_test = new Test(); } echo $my_test->get_name();

For Loop This For loop prints the number MySQL queries One feature that’s very one and adds 1 each time it loops. It continues useful is to write MySQL queries which return as long as the value of $i is less than 5. the data you desire. Queries can be executed for($i=1; $i < 5; $i++) { using PDO or the mysql_query() function. echo $i; //output: 1234 To make a query, you connect to a database } through authentication.

While Loop This while loop prints the CRUD This stands for Create, Read, Update number one and adds 1 each time it loops. and Delete. Practically most web applications It also continues as long as the value of $i is use CRUD, coded in one way or another, to less than 5. allow the user to make modifications to the $i = 1; web application. All CRUD events will take while($i < 5) { place using the MySQL SELECT, INSERT, echo $i; //output: 1234 UPDATE and DELETE commands. php.info.php shows your PHP config and $i++; can be altered by editing the php.ini file or } Running PHP within Bash Since there’s a can be overridden by adding a php.ini file into the html folder. good chance that you have a background with Include Files If you want to add another file Bash scripting, you can apply this skill by to the current file, it can be done with the the parent class. To use OOP,you create a class adding PHP coding into bash scripts using the include(), include_once(), require() and which includes properties and methods. Here Document(‘EOF’) tags. require_once() functions. An example of this is A property is similar to a regular variable while #!/bin/sh shown below. a method is like a function. To instantiate a php_cwd=`/usr/bin/php << ‘EOF’ include(“myfile.inc”); class, you use the ‘new’ keyword. Properties and methods can be public, private and EOF Functions These are a set of procedures protected. Public means they are accessible echo “$php_cwd” that you can call to take place. You call a everywhere, private are only available to the Now you have the basics to write PHP function by using its name. Normally, functions class and protected are available to child and programs on your new virtual machine. You are located in their own file(s) and are included parent classes from where they are declared. can back it up and restore it anywhere you into a file where you want to use them. A One more aspect of OOP is the use of the want. In addition to Virtualbox backups, you simple, custom function is shown below and it $this keyword (this being interchangeable can use ssh, rsync, mysqldump, scp and cron can be executed by using writing name_it(): which is used to reference a property. In so that you can always have a handy backup function name_it (){ addition to that, you will use -> to access on another machine, at your convenience. echo “Here is my text”; methods after you instantiate an object. Most PHP websites and web apps use files } A simple example shown below should make and databases. Having a plan to clone or sync name_it(); this clear. these data sources from your VM can be very On top of that, PHP installs with thousands Class Test { convenient and fast to implement. Enjoy. LXF of functions. Some of these functions are object-oriented, for example new DOMDocument(). http://PHP.net is the The email server go-to website for all your PHP needs. For example, the page http://php.net/manual/ To get started with email, you will need to install However, you can test outgoing email with an email server. There are several available such simple commands shown below. To test an en/filter.filters.php shows many validating as Postfix and Exim. This tutorial will use Postfix. outgoing email message, write out each line and filters that you could use with a function such To install Postfix, run the command just as hit Enter. as filter_var() that are used within frameworks shown below. When you come to the period after the email such as Codeigniter. root# apt-get install postfix postfix-mysql body, you will type it and press Enter as you’ve When you use PHP functions, you should dovecot-core dovecot-imapd dovecot-lmtpd done for the other commands. This isn’t a typo, keep in mind that they use memory, and some dovecot-mysql dovecot-pop3d it is a requirement to send the email. can use up quite a lot. If you code for efficiency During installation you may want to select telnet localhost 25 you can minimise resource consumption and the tab key > Internet Site > hit tab key and HELO mail.example.com obtain higher performance. select OK > Hit Enter > Give system mail name MAIL FROM: [email protected] or use the default > Select tab > Enter RCPT TO: [email protected] Classes and Objects With PHP, you can Once the server is successfully set up, you DATA code procedurally from the top down. But, may want to edit the /etc/postfix/main.cf file Subject: Add it here OOP (Object Oriented Programming) gives you and add a script such as Squirrelmail to handle Add the body text now incoming and outgoing email. Note: setting up a much more manageable way to write code. . email can be time consuming and is beyond the The main class is a parent and it can have child QUIT scope of this tutorial. classes that are able to inherit some or all of

www.linuxformat.com December 2014 LXF191 55 Dr Brown’s Administeria Dr Brown’s Administeria Dr Chris Brown The Doctor provides Linux training, authoring Esoteric system administration goodness from and consultancy. He finds his PhD in particle physics to be of no help in this work at all. the impenetrable bowels of the server room.

Eggs and baskets

he President was annoyed to say the least. For one thing he had just Trealised that the keynote he'd agreed to give at the International Symposium on Digital Biodiversity clashed with his son's baseball match. Secretly he thought they were a bunch of loons, but the party advisers assured him there were easy votes in doing it. And for another thing, he Cracking passwords was concerned about the 46 messages he'd just received all containing level 2 What have squirrel noises got to do with the second launch authorisations, and all, apparently, from himself. law of thermodynamics? It's a question of entropy. He decided to prioritise and picked up the phone. "Alice, email Bob and get him to ntropy is a measure of randomness or passwords a second. The real figure will pull me off that biodiversity keynote thing disorder. The second law of depend on the algorithm used and how much tonight". "Sorry chief", said Alice, but my Ethermodynamics states that the water you’ve available to cool your PC's on the blink. Bob and Eve have just entropy of a closed system never decreases. . But the message is clear: called to say that they've got problems too". (Think of a teenager's bedroom). My favourite longer passwords and a larger character set A quick walk down the corridor revealed Dilbert cartoon is the one where the boss says make a huge difference. that in office after office, people were "Starting today, all passwords must contain However, Mark Burnett, who seems to have cursing at their computers with more letters, numbers, doodles, sign language and spent half a lifetime harvesting username/ vehemence that was usual. squirrel noises". Like all Dilbert cartoons the password pairs (from what he assures us are He telephoned the chairman of the insanity contains more than a hint of truth. "sources that have already been made public") National Security Council. "Get Nadella on The point is that the bigger the character presents data at Xato.net (http://bit. the phone", he demanded. There was no set from which passwords are drawn, the ly/10KTopPasswords) that will convince you point in being the most powerful man on greater their entropy, and the longer it takes to that the whole thing about combinatorial the planet, he thought, if you couldn't go to guess them by brute force. A little play on Open maths and squirrel noises is largely irrelevant. the top. But no-one at Microsoft was Security Research’s Brute Force Mark's data suggests that 40% of available for comment. Indeed, no-one at (http://bit.ly/BruteForceCalc) resulted in passwords fall into the top 100 list, 91% fall into Microsoft seemed to be available for any the table (below). This is pure combinatorial the top 1,000, and a whopping 98.8% into the reason whatsoever. maths, and assumes you can test 1,000,000 top 10,000. Of course, your results will depend And as more and more people called in on your data sample. As Mark to say their computers were down, the Length Character Set Brute Force time admits, the passwords are mostly president began to feel less and less from sites that don't enforce strong 8 111 seconds powerful. Finally a junior aide arrived in his passwords. So forget the squirrel office, out of breath, having run up four 10 Digits 0-9 185 minutes noises. And there's a nice example flights of stairs. "Mr. President, sir, I thought 12 308 hours at XKCD (https://xkcd.com/936) you ought to know that there's a guy in the which compares the entropy of a sub-basement who says his computer is typical password derived from the 8 60 hours still working. He says it's running Linux". ritual disembowelling of a real word 10 Upper-case letters A-Z 5 years [email protected]. (Tr0ub4dor&3), with that of using 12 3000 years four unrelated words (correct horse battery staple). The latter has 16 8 60 hours bits more entropy, meaning it's 65,000 times as hard to guess, 10 A-Z a-z 0-9 !@#$%^&()-_+= 206,000 years but much easier to remember, and 12 1 billion years much easier to type..

56 LXF191 December 2014 www.linuxformat.com Dr Brown’s Administeria

Wine RunWindowsapplicationsonLinuxusingWine.TheGoodDoctorhelpsyou take the cork out of the bottle and helpfully takes a sip or two…

ou're a system administrator, and your company has just announced that it's transferring its operation Wine vs Virtualisation Ylock, stock, and barrel from Windows to Linux. Since you've been advocating this for nearly a decade, it feels like a Virtualisation (running a Windows Most importantly, though, Wine dream come true. But that initial euphoria begins to wear off virtual machine as a guest on top of a doesn't require you to have a licensed when your users start coming to you with worried Linux host) will likely give you an easier copy of Windows. The Microsoft expressions, explaining that they can't possibly do their job way to get those windows apps running document that describes your rights to without application A or B, and that they only run on Windows. on Linux. Since you get a ‘true’ windows run Windows inside VMs runs to six environment, most apps should run. pages and is largely incomprehensible Now you need to take these statements with a pinch of By contrast, support for Windows apps unless you have a degree in infinitely salt. In truth, there are very few tasks for which there isn't an under Wine is patchy. On the other differentiable licence terms, but one open-source solution that’s at least as good as its proprietary hand, the Wine approach has a much thing is clear – it's not free. Don't forget cousins. It may simply be that those users are reluctant to smaller memory footprint, because you that even under Wine, you need a legal come out of their comfort zone, or learn new technology. don't have a full Windows OS installed. copy of the software you want to run. Or they may be concerned that they will need to trade documents with other companies who are still wedded to proprietary formats. Or maybe young Rosie in accounts is large database where each application is rated Platinum, seriously addicted to World of Wacraft and has threatened to Gold, Sliver, Bronze, or Garbage. The list is heavily games- stop your paychecks if she can't play it at work any more. dominated. In the platinum, gold and silver top 10 lists (30 If you need to run a mix of Windows and Linux applications apps in all) 24 are games. Often, the rating depends on which you have three choices – you can set up a dual-boot version of the app and which version of the wine library you're environment, run Windows in a virtual machine on top of using. For example, Microsoft Money has ratings from Linux (or the other way round, it doesn't really much matter), Platinum down to Garbage, depending on the version. As I or you can use Wine. write this there are 21,626 applications listed but many of Essentially, Wine is a compatibility layer supporting an API them are old and many of the links to vendor or developer that mimics the standard Windows system DLLs USER32, sites are broken. GDI32 and KERNEL32. This compatibility layer sits atop a POSIX-compliant kernel (it can run on Linux, BSD, Solaris and First sip of wine Mac OSX). From the point of view of windows applications, Anyway, let's get the cork out of the bottle and take a gulp (or wine provides an emulation of the windows system, and some two) of Wine. I chose to do this on Ubuntu 14.04 and it turns folks say the name stands for ‘Windows Emulator’. The folks out that Wine is in the Ubuntu repositories, so I can install it at WineHQ don't like that, and would prefer it to be an very easily like this: acronym for ‘Wine is Not an Emulator’. Their concern is that $ sudo apt-get install wine many people associate emulation with poor performance. You'll have a bit of a wait because the installation brings in It would be misleading to suggest that every Windows a total of 174 packages. Along the way, you'll be asked to application will run flawlessly using Wine. The emulation is not accept the licence agreement for the MS truetype fonts. perfect, and some applications run better than others, and Installing onto a Red Hat derivative distro, such as CentOS some don't run at all. The www.winehq.org website carries a needs slightly more work because you'll need to enable the EPEL repositories. (See the EPEL box, p58 for instructions on how to do this.) Once Wine is installed, the wine command can be used to launch a windows executable. There are a number of sample programs bundled with Wine, including Notepad, Wordpad, Regedit, a command interpreter (cmd), and Wine's version of Internet Explorer. So you can try it out immediately with a command such as: $ wine wordpad In fact, some of these programs have wrapper scripts in /usr/bin, so you can simply launch them by name as you would any other command: $ notepad Text-based console applications should be launched with wineconsole, which gives them their own console window. So $ wineconsole cmd will give you your very own windows command interpreter. Lucky you. Wine creates a small Windows-like environment Incontrovertible proof that 2 plus 2 is 4. Microsoft Excel under the directory ~/.wine (by default). For example, in the and LibreOffice Calc side by side, both running on CentOS. directory ~/.wine/drive_c/users/chris I have a miniature

www.tuxradar.com December 2014 LXF191 57 Dr Brown’s Administeria

Windows-style home directory, where symbolic links with the know for sure if your application will run. The licence is per- traditional Windows names (such as ‘My Pictures’) point to person, enabling you to install Wine onto several machines so their Linux equivalents (such as /home/chris/Pictures). long as you only use one at a time. As the CodeWeavers Under ~/.wine/drive_c/windows/system32 you'll find a website points out, whether you choose to go down the free goodly collection of DLLs and Windows executable files. route of using Wine alone, or to use Crossover, depends on Also in ~/.wine there are files containing Windows Registry your budget, technical competence, and pain threshold. settings (see Windows Registry box, p59). Taken together, Crossover's website also carries a large database of these files define a virtual windows environment. The Wine applications and they have a similar classification scheme, runtime uses an environment variable called WINEPREFIX to with gold, silver, bronze and ‘known not to work’ medals specify the location of this directory, enabling you to set up awarded, plus an ‘untested’ medal. It feels better organised entirely separate windows environments for different than the one at WineHQ. Altogether I counted 12,700 apps applications. Behind the scenes, there's also a server process listed here, of which about 4,500 are games. However, the called wineserver, which offers some kernel-like services to overall amount of working applications is much lower, as I Wine, including message routing, access to the Registry, found a rather high proportion of the applications labelled debugging, and some window management. This server is as ‘untested’. started on demand by the Wine runtime, you shouldn’t need Crossover provides you with a graphical screen to manage to worry about it. your Windows applications from, and – importantly – To install additional windows applications is in principal a an installer that makes the process much easier. I decided to matter of finding the application's installation program and use Centos 6.5 as my host system to give Crossover a trial. running it under Wine, probably something like: The process goes like this: $ wine setup.exe Enable the EPEL repositories on CentOS. (See the EPEL box I've emphasized "in principal" because in practice you may below for how to do this.) encounter an entire zoo of error messages. Browse to www.codeweavers.com and click on the Download Free Trial button. Codeweavers to the Rescue Select what flavour of Linux you're running from the If you're struggling to get applications working under Wine, dropdown. (This will then determine what kind of package consider using Crossover from Codeweavers. This is a that you get.) supported version of Wine, and the Codeweavers team have Enter your email address and click on Download. This will put a lot of effort into making it easier to use. It's not a free get you a file called something like crossover-13.2.0-1.rpm application, however – a 12-month subscription will cost you Install the rpm using yum: £38, and phone support is extra, but in a commercial setting # yum install crossover that's a lot cheaper than a day of your time struggling to get This will drag in quite a few dependencies (62 in my case) Wine to work, plus you have the pleasure of knowing that but it should proceed without problems. you're contributing to the development of Wine. Educational Crossover installs into /opt/cxoffice. (and It's one of the pricing is slightly cheaper, and there's a 14-day free trial few applications in my experience that actually follows the period, so you don't need to part with any money until you filesystem hierarchy guidelines by installing into /opt). It will also add Crossover to your Applications menu, and you'll want to begin by launching it from here. From the main Crossover screen you can go ahead and install new Windows applications, launch the ones already installed, and manage your bottles (which are discussed below). Don't lose your bottle Earlier I mentioned that wine maintains a virtual windows environment under ~/.wine. Crossover calls this environment a ‘bottle’ and takes the concept further, enabling you to easily maintain multiple bottles. These bottles can act like a sandbox, which will prevent any applications in separate bottles from interacting with each other. You can also use bottles to emulate multiple versions of the Windows OS, or to move the environment to a different host machine. Crossover keeps its bottles in subdirectories under ~/.cxoffice rather The main screen of Crossover. From here you can launch your Windows than under ~/.wine (Crossover Office was the original name applications and install new ones, or manage your bottles. of the product).

EPEL

EPEL (Extra Packages for Enterprise Linux) is a These packages come from the Fedora project CentOS there's a tiny package called epel- repository of additional packages for Red Hat and are chosen so they will "never conflict with release in the official repo that will do these Enterprise Linux (or CentOS or Scientific Linux) or replace packages in the base Enterprise Linux things for you, so you should be able to just do: maintained by a Fedora Special Interest Group distributions". To use EPEL you’ll need to enable # yum install epel-release (http://fedoraproject.org/wiki/EPEL). the repository and grab the GPG key. On to enable EPEL.

58 LXF191 December 2014 www.linuxformat.com Dr Brown’s Administeria

Wine provides a compatibility Wine Architecture layer enabling Windows apps to run on Linux. It's especially popular Application Windows Executable for gaming.

Windows Windows Application DLLs DLL DLL

DLL Emulation Wine layer WINE server

Kernel Linux Kernel

Crossover's bottle management tool lets you view your From there on you'll go through the InstallShield screens bottles, create new ones, explore the file systems within them, just as you would if you were installing it on Windows. The list the programs installed in them, edit menus and file installer defaults to installing into C:\Program associations, and even package a bottle as a .deb or RPM file, Files\e-Sword, which, of course, is inside the bottle we so that you could easily install it on another machine. And all just created. from the comfort of a graphical ! Once the installation is completed you'll see a launch button on the main Crossover screen. Just click it and – Like falling off a log hey presto! – the application will be up and running. The easiest way of installing a Windows application using Crossover is through a feature called crosstie. Basically a Installing from media crosstie is a recipe (in the form of an XML file) that tells the Here's another example. This time we'll install Microsoft installer exactly how to install a specific application. If the Office, using the official product DVD. Just to be clear – application you want to install has a cross-tie file, you should you don't need a licensed copy of the Windows operating get a really easy ride. system itself to do this, but you will need to own a legal copy As an example, we'll install a free program called e-Sword of the software you're installing. Installation turns out to be (a bible-study aid) which is only available for Windows. Here just as easy as installing via a crosstie file. Just put the are the steps: installation media into your DVD drive, run Crossover and Browse to www.codeweaver.com and enter e-Sword in the click on the big button labelled Install Windows Software... search box. The list of search results tells us that e-Sword The installer automatically detected the installation DVD, has a silver medal. found the setup program on it, and auto-populated the Click on the link to the program's page. From there you can installation options so all I had to do was click on Install. browse screenshots of the application. Again, the installer will go ahead and create a new bottle, Click the big green button labelled Install e-Sword via and again, the installation screens you'll see from here on CrossTie. This will download the crosstie file (called e-Sword. (including the ritual ‘accept this scary licence and don’t worry tie) which, by default, will open in the Crossover installer. about it’ check boxes) will be the same as you would see if The installer gets all the information it needs from the you installed the product onto a Windows operating system. crosstie file so once it's running just click on the Install button. Once the installation is complete, new launch buttons will The installer will create a new bottle to install the be added to the main Crossover screen for your newly application into then run the installation installed components. In my case, Crossover decided that I needed the Microsoft So there you have it. And don't forget: a day without Wine XML Parser as well, and ran the appropriate setup wizard. is a day without sunshine. Salute! LXF

Windows Registry

One of the things that Wine has to in the form of keys and values. It largely (notably) .NET doesn’t. Wine includes a emulate is the Windows Registry. This replaced the many INI files that were Registry editor which looks a lot like its is a hierarchical database that stores used in early versions of Windows. Many Windows cousin. Registry settings are configuration settings for Windows apps applications rely on the Registry, though stored in ~/.wine,orinCrossover bottles.

www.tuxradar.com December 2014 LXF191 59 The best new open source software on the planet

Alexander Tolstoy dons his deerstalker hat and hunts down the hottest and greatest open source software and puts them on a pedestal for all to see. QMplay2 Rosa PDFSaM Rodent Core KXStitch KEncFS I-Nex Blobby Volley 2 Caesaria Otter Browser ModemManager

Media Player QMplay2 Version: 14.07.27 Web: http://zaps166.sourceforge.net

his is another media player that's a playlist, but you can’t drag and drop capable of handling almost all items there. Among mainstream Linux Tsorts of audio and video files. media players only To te m combined all However, there are a number of these features together, but recently outstanding features that make newer versions of To te m (starting from QMplay2 different and it'll also feel 3.12) got rid of the extra playlist pane, better to use. It may sound like an perhaps because it felt too cluttered. obvious feature, but this is one of few So, QMplay2 could well be the players that enables you to easily sort media player you've been missing. The your playlist without closing the main player offers simultaneous display of The number of controls and tabs are plentiful in QMplay2, video view. For instance, VLC has a video pane, playlist visualisation and making it a good fit for a professional desktop. great playlist editor and a neat playback controls, but although you can switch lets your customise the whole view the between them you won’t be able to “Unlike its name, way you like it. Unlike its name, display both elements at the same time. QMplay2 is not an QMplay2 isn't an MPlayer front-end. On the other hand, apps like Gnome Actually, it uses FFMpeg for media MPlayer let you enable a side pane with MPlayer front-end.” format support, wrapping it into a Qt4 (and possible Qt5 if you're brave enough to build QMplay2 from source) Exploring the QMplay2 interface GUI with a wide variety of settings. The stand-out feature is the intuitive method of setting audio and video output methods, available in player's Audio properties window (press Ctrl+O to visualiser open it). It's very easy to set to Whether you accelerated video output for VAAPI- watch a movie or listen to your enabled Intel Graphics system, while favourite track, Nvidia and Radeon users will quite this two-option probably use VDPAU. visualiser can be The playlist pane accepts not only very helpful… local files, but also easily handles YouTube videos and many other sorts of URLs of remote streams. The player Persistent always restores your previous playlist playlist upon start up, so you can always come QMplay2 keeps back to your previously played items your previously without having to use the Recent or played items as Live metadata feed YouTube tool Set priority Favourite menus. Playing and searching Most useful for remote The YouTube search This is possibly the most long as you want inside the YouTube sample video them to be streams: you can watch results pane enables friendly way to set the worked like a charm, so if your available, so you current buffered data size you to instantly select output method priority can always enjoy and its equivalent in the desired playback that you want to use – connection is fast enough you may not them again. seconds, as well as live audio. quality you want. just drag the items! notice the difference between local video and stream playback.

60 LXF191 December 2014 www.linuxformat.com LXFHotPicks

Live USB flash tool Rosa ImageWriter Version: 2.4 Web: http://bit.ly/ZgurWL

ptical laser discs are rapidly Mandriva S.A. Linux distribution. A few leaving our world, being years ago, the Rosa team forked SUSE Osuperseded with USB flash Studio Imagewriter – a modest and drives and cloud storage. Though you very easy to use tool for writing ISO can decide to move your precious files images to USB devices. The fork was to an online service, you still have to heavily optimised and enhanced; they deal with physical media for installing got rid of C# and .NET code from Linux Another small Qt5 utility with finely crafted features an OS (for now, at least). Preparing a and Windows versions respectively and making it worth a decent perusal. USB mass storage drive (a stick, a rewrite the tool using entirely C++. The memory card etc), then writing your interface was also ported to the Qt5 favourite Linux distro ISO onto it and framework, while retaining the original Rosa ImageWriter is distributed as a finally getting a bootable Linux at your visual simplicity. source tarball and a set of binary fingertips all sounds easy, especially for The end result is a tool that packges for 32- and 64-bit Linux, geeks with years of dd-fu. For normal constantly updates the list of currently Windows 7/8 and Mac OS X. Along with earthlings, however, doing this is still an available USB media, displays its labels distro specific packages some static expert-level task. Though many have and sizes and supports ISO selecting builds are available for all platforms, so heard, and are used to, UNetbootin in either by classic file open dialog or by you can prepare your USB stick with an Ubuntu world, not every ISO can be dragging the file on the tool's window. ISO from any kind of contemporary successfully written on a USB. Some Linux system, even from proprietary are designed only for CDs/DVDs, some aliens. According to our tests, Rosa need extra tweaks for EFI support and “Flash your USB stick ImageWriter correctly handled all some offer non-standard partitioning. with an ISO from any Ubuntu and Debian derivatives, all sorts Rosa ImageWriter is part of Rosa of RPM-based distros, FreeBSD images Linux, which in turn is a continuation of kind of modern system.” and plenty more.

PDF split and merge tool PDFSaM Version: 2.2.4 Web: www.pdfsam.org

erhaps the most common platform and OS independent software interchange file format is PDF. written in Swing which requires Unlike .docx or even .odt it's still Java or OpenJDK runtime (which we P Not very handsome, but a clean and feature-rich tool. the most accessible because almost admit makes the interface look just a every OS provides some kind of tiny bit old-fashioned). standard tool for reading the format. Unpack the PDFSaM tarball and run Extract, Rotate, Split, Visual document Linux compares favourably in that java -jar pdfsam-2.2.4.jar in its composer and Visual reorder. The two regard: its and directory. The interface is quite unusual, latter plugins enable previewing PDF applications are both excellent pieces of at least initially. You'd expect to be able pages and their live modification, while software and at least one of them is to browse for PDF files and apply the others produce modified PDF files always bundled with any major distro desired actions to them but the logic is in the directory you point the plugin to. you might choose. Although PDF was reversed. PDFSaM is actually a browser You can control some options, like designed by Adobe as a target format of PDF modification plugins – you overwriting the source file or specifying and thus it's meant for modification, in choose what you're going to do and the internal version of PDF. real life some altering is often required, apply your PDF to that plugin. Currently PDFSaM will be a good companion like rotating, cropping, merging and six plugins are available: Alternate mix for those who frequently work with PDF extracting pages and so on. (move pages between ), Merge/ files or need a cross-platform tool for PDF Split and Merge tool (known to batch-file processing. According to our its friends as PDFSaM) has grown from tests it was quite stable even under the a simple app designed for splitting and “It's confusing at first 1heavy load of a bunch of ponderous rotating PDF files into a Swiss Army – PDFSaM is a browser files. Reordering and moving pages knife of PDF manipulation, capable of from one file to another also worked doing many tricks with PDFs. It is a of PDF mod plugins.” flawlessly for us.

www.linuxformat.com December 2014 LXF191 61 LXFHotPicks

File manager Rodent Core Version: 5.2.9 Web: http://xffm.org

side from heavyweight desktop The main Rodent window, by default, environments like KDE SC or is set to display square tiles of files and ACinnamon, there's a bunch of directories. Most graphic, PDF and even compact and speedy desktops that text filetypes are supported by the built- always find their devoted users. Mostly in thumbnailer, so you're unlikely to get those are the owners of old PCs but lost even though the paradigm of A tailored file manager which takes a little more control sometimes even the users of top-level Rodent is really different. In order to over your desktop. power beasts prefer not to waste open files and perform other basic system resources on bells and whistles actions, Rodent relies on numerous shredding for higher security, easy file and stick to simple and fast software, so external utilities, many of which are encrypting with Bcrypt and lots of other the Rodent Applications stack is a standard in Linux. Browsing with admin handy tools, such as front-ends for diff typical collection of small and handy permissions utilises sudo, text field and ssh. The lower part of the Rodent utilities. One of its key applications, the autocompletion data stored in Bash window carries the shell where most of Rodent Core file manager (aka xffm) and filesystem automounter is a the manipulations with files are doubled has seen a new release recently. combination of /etc/fstab watcher with respective shell commands. It's a lightweight GTK2 application and FUSE front-end. While trying to get If you decide to try the Rodent Core based on a plugin design with a decent familiar with Rodent, you'll surely notice file manager out, take care of the set of features for daily use. Rodent unique features, like advanced file system you’re using. Binary packages Core looks and feels very unusual, exist for OpenSUSE, Gentoo, Ubuntu especially if you've been used to classic “Replaces your desktop and FreeBSD and while the source is file managers such as or . available like any GPL software, it can be It replaces your current desktop with its with its own, like a painful to build Rodent yourself, but if own, so the whole thing looks like a you're brave enough, you'll get this mini-graphic shell. mini-graphic shell.” blazing fast low fat file manager.

Cross stitch patterns editor KXStitch Version: 1.2.0 Web: http://bit.ly/1s9wyXz

ant to employ your a real cloth. So you'll need to simplify grandma's ninja-knitting the scheme and edit certain stitches by Wskills but not sure how to hand. KXStitch offers a wide range of Have a rest from your Linux box, go stitch.... control the design? Here's the perfect dedicated tools for this, including an solution. KXStitch is a fun piece of excellent colour palette editor, drawing software which lets you transform any and erasing pens, polygonal filling and either. In fact, there's a comprehensive bitmap graphic file into a cross stitch plenty much more. guide for both drawing the scheme pattern, apply manual editing, print it The app is a long-term veteran in the from scratch and for handling bitmap and use it a guide for real stitching. FOSS world. KXStitch was initially graphics, all packed in a serviceable KXStitch uses its own internal file started in 2005 as a Qt3 software. It's docbook format. format for storing stitch schemes since grown through dozens of Note that the KXStitch download (KXS), so in order to use a photo or a enhancements, including the transition link is found on the -apps drawing with the app, it's supposed to to Qt4 and now we can enjoy the 1.2.0 homepage. This is important, because be imported through File > Import version which brought more the KXStitch website at Sourceforge image dialog (the same logic can be translations and a few improvements. hasn't been updated for a long time found in Gimp). Once you do this, The entry level for first time KXStitch and offers an outdated old version, another dialog will ask you to choose users isn't as high as you may think, while the kde-apps page is current. the floss type, number of cloth count Compiling KXStitch isn't tricky at all, per inch and general pattern scale. The thanks to the excellent cmake wrapper. imported image in most cases needs “KXStitch offers a wide You'll need KDE runtime headers, extra editing: it's unlikely that a human range of dedicated tools cmake plus standard build environment, would use forty spinning rolls of and after that the only job left is to run different colours to stitch tiny pixels on for editing stitches.” the ./build.sh script.

62 LXF191 December 2014 www.linuxformat.com LXFHotPicks

Encrypted filesystem manager KEncFS Version: 1.4.0 Web: http://bit.ly/1pMtHOb

inux users are generally seen as which is the only key to mounting the security conscious people, encrypted destination. It's hard to say L though a large proportion of that whether the ciphertext decryption stems from clichéd attitudes to attack has any merit, but EncFS has a alternative culture and hackers. good rep with IT security professionals. However, the demand for high-quality KEncFS is perhaps the most A very straightforward GUI for a powerful directory encryption technology now stretches intuitive and high-quality EncFS front- encryption solution. far beyond the enterprise users in this end, with a focus on KDE SC integration. post-Snowden world. Even the less It has a clean and neat Qt4 interface experienced user is interested in and some lovely details. The main addition, KEncFS can auto-mount your keeping some files safe and hidden. window stores the list of filesystems encrypted filesystems on startup and This is where EncFS comes in – a FUSE- which a KEncFS uses to represent the use KWallet for password storage (don't based cryptographic solution which encrypted directories. The user can add, forget to protect the KWallet itself with transparently encrypts everything in a delete and manage entries as well as a strong password) and the while thing specified directory. Unlike disk mount or unmount them. When an has a very small impact on system encryption software such as TrueCrypt, entry is mounted, a corresponding performance. KEncFS does offer some EncFS works on a directory level, so the directory automatically opens in the precompiled binaries, but chances are ciphertext directory structure mirrors default file manager (say Dolphin). In that you'll have to build it yourself. As the plaintext's directory structure. In it's a rather contemporary , other words you have to set two “KEncFS can automount installation is as simple as running directories for EnFS: a mount point for qmake, make and make install, your protected files and an encrypted your encrypted although it takes some time to install all directory for ciphered files. Each set necessary build prerequisites, which gets protected with master password, filesystems on startup.” are mainly KDE runtime libs.

Free system profiler I-Nex Version: 7.4.0 Web: http://bit.ly/1vMr4mp

ometimes you need to know not good use of this space, but it does your screen resolution numbers make a perfect companion for PC Sor the exact chipset model of hardware enthusiasts and system your motherboard. If so I-Nex is the tool builders. For other users, it can be you've been looking for. For those fresh helpful in determining what's inside from Windows world, this plays nearly your notebooks or computer. the same role as CPU-Z. It's a profiler In order to install I-Nex first check (or a monitor) that detects the CPU, your Linux system repositories, as the RAM, motherboard chipset, and other tool is often available. If not then you'll hardware features of your computer, need to download the tarball from the and presents the info in one window. project's website. You won't need to The I-Nex window consists of several compile anything because I-Nex is tabs, and each dedicated to a different distributed as a set of already prepared aspect of the system. The CPU tab files. We don't say 'binary' files because displays the full name of your I-Nex is made in an unusual way: it processing unit, the L1 and L2 cache requires the Gambas project runtime (a The full specs of your system perfectly replicated. sizes, current temperature readings and dialect of the honourable BASIC load meter etc. On the GPU tab it's easy language). I-Nex gathers information to find your graphic chip specs, learn its from dozens of sources, so it would be OpenGL capabilities and also observe “For Windows users, sane to launch it from the command your screen details (data is retrieved this plays nearly the line, so you'll be able to keep crucial through EDID). The full list of what I-Nex track any missing things, such as covers in all its tabs are extensive and same as CPU-Z.” temperature sensors.

www.linuxformat.com December 2014 LXF191 63 LXFHotPicks

HotGames Entertainment apps

Volleyball game Blobby Volley 2 Version: 1.0rc1 Web: http://bit.ly/1nYrntA

mong all the many sport thick gel. However, the gameplay of simulators, Blobby Volley 2 Blobby is extremely addictive. Each A holds a special place for us. player can use custom keys or a mouse, At first glance you may have mixed which means that it's possible to feelings and think about giving it a comfortably share a keyboard or have miss for being too simple. But don't. one player use the keyboard and the Appearances can be deceptive, and other the mouse. Blobby Volley 2 also after a couple of minutes of play lets you play against a bot (a LUA script, you'll realise that Blobby Volley 2 by the way). The real challenge is Try playing for both parties at a time and find out which of your hands will win. deserves much more attention. playing against a friend, of course. The Basically, this is a classic side- LUA bots are pretty dumb, but they are scrolling arcade game for two players, good for first time training. Blobby Volley League public and to just confuse things a little, the But there's even more to this game. servers. And yes, there is a strong recent version of the game is actually The real magic starts with the network community around this game, with 1.0rc1, although it's actually an open game where you connect to one of the real tournaments and source remake of the old proprietary championships, all hosted at ver1 that’s been given the moniker “In the network game blobby-volley.net. You can play Blobby Volley 2. against a random user or, better Each player is a coloured bumpy you connect to one of still, try to arrange a duel with blob with a simple moving animation someone from the official league – which makes it feel like some kind of the public servers.” in both cases it's great fun.

Open Source Caesar III remake Caesaria Version: 0.4 Web: http://bit.ly/1ux8nmB

ometimes classics come on a set of SDL libraries, so if any of back with greater glory and them are missing, you instantly find out Sshine, and now it's the turn of which from the command line output. Caesar III – a very popular economic The game asks you to put some city builder released by Sierra original Caesar III resource files in Perhaps we'll build more potteries to make use of that Entertainment back in 1998. certain directories for audio support extra loam. We’re crazy like that. In 2013, a Linux hacker called and extra maps, but even if you don't Dalerank started making an open own a game, the vanilla Caesaria build ancient Romans, including housing, source remake of the venerable already contains all graphics which are goods manufacturing and trading, game, writing most code from perfectly enough to enjoy building a fighting with barbarians, setting scratch. The game has become a Roman town. entertainment events and satisfying very close clone of the original, with The aim of the game is to build rank the gods. Dalerank wrote in his blog most of its logic carefully restored by achieving objectives set by the that the most difficult part was but constantly being enhanced. The Emperor for construction and the writing complex mathematical project website regularly publishes development of the city. The game conditions for calculating citizens' new builds of Caesaria (aka pretty accurately reflects the life of routes and behaviour. Though, we OpenCaesar3) for Windows, Linux admit right now there's really a lot to and OS X, providing both 32- and be done to make Caesaria stable 64-bit versions. To run the game, “Build rank by (currently it crashes sometimes simply unpack the downloaded ZIP achieving objectives set when you try to rotate the map), the archive and run ./caesaria.linux game is still playable and quite an from there. The game only depends by the Emperor...” achievement in its own right.

64 LXF191 December 2014 www.linuxformat.com LXFHotPicks

Web browser Otter Browser Version: 0.9.03 Web: http://otter-browser.org

he Otter Browser (not to be content blocker, Javascript switcher, confused with the Otter theorem images display switcher, delayed tab T prover) is a challenging and loading, mouse gestures, smart text rather brave Qt5 project with a goal of selection and much, much more. recreating the Opera 12.x user Folks behind the Otter Browser are experience. As you might know, in 2012 intent on recreating all those prominent Opera Software discontinued its core features without losing the identity of technology, the Presto HTML rendering the classic Opera. The project is in beta The browser shows off decent figures in a standard engine which was the heart of the stage and boasts initial support for the HTML5 test. Not bad for beta. desktop and mobile Opera browser, as Adblock Plus extension, support for well as some other products. The Opera HTML bookmarks import, keyboard Software team also shrank at that time shortcut customisation, a download desktop, say Lumina for example, the and the company decided to move its manager, a cookies manager, a handy Otter Browser will fit there perfectly. efforts to the Chromium project and sidebar and lots of minor UI To install the app, the Otter Browser help Google to develop the code for its improvements. The Otter Browser also has been packaged for various Linux open source browser. Since then the seems to be the only complete (or soon flavours, including OpenSUSE, Ubuntu, 'new' Opera has been based on the Blink to be) website based on Qt5 widgets, so Arch and their derivatives. However, as engine from Google and really if you plan to build yourself a pure Qt5 the project is developing rather quickly resembles Chromium visually. In fact, (developers publish weekly reports on the most beloved Opera features of their website), it would be a good idea Presto were discarded to “It’s designed to to build the most recent Git version accommodate a redesigned Chromium recreate the classic yourself. You'll need recent versions of clone. Those features form a long list cmake and Qt5 development stack, and include bookmark manager, built-in Opera features.” with QtWebkit 5.x dev headers.

Mobile devices and connections manager ModemManager Version: 1.4 Web: http://bit.ly/1pLSpzy

espite the march of mobile computer using a smartphone as a technology, sometimes we still modem (assuming you have D use modems, especially on the appropriate data plan on your phone) go or in areas without terrestrial and a Bluetooth or USB connection, internet. Modems hide inside almost ModemManager is a smarter and more every phone and any smartphone, as up-to-date way than the likes of well as USB dongles. Gone are the days Bluedevil+KPPP or wvdial. of studying the ifup command and ModemManager provides a GUI playing with ppp arguments in Linux, which can be launched just like any The ModemManager GUI is a bench board for your and ModemManager reflects that standalone application and is modem in Linux. change – it's a NetworkManager-like automatically called when you pair your tool for handling modems, dongles, phone using Bluetooth and choose to Most of Linux vendors consider Bluetooth-paired telephones, or even add a DUN (dial up networking) option. ModemManager a must-have more professional equipment with This way the connection is added to the mainstream software, so you're likely to external power supply. NetworkManager configuration and see the fresh release will be sooner ModemManager is a DBus- displays among other available rather than later bundled with regular activated daemon which controls connections there. updates. The new 1.4 version can mobile broadband (2G/3G/4G) devices manage a device's power state, has and connections and provides you with “A NetworkManager- better handling of IPs (for instance, you some features for managing calls and can now set static IPv6 address SMS, as well as contacts and some like tool for handling together with DHCP mode) and GSM-specific features. If you want to supports recent ZTE, and have an internet connection on your built-in modems etc.” Sequans Communcation modems. LXF

www.linuxformat.com December 2014 LXF191 65 #1 for Free Software

Issue 190 Issue 189 Issue 188 November 2014 October 2014 September 2014 Product code: Product code: Product code: LXFDB0190 LXFDB0189 LXFDB0188 In the magazinee In the magazine In the magazine Origin of the distro – Discover how to solve Streamline your LXF tracks the source of your Linux problems desktop, cut boot times your favourite distro andd with a huge trouble and get more from your picks the best of each shooting guide. Plus: system with our guide to genus. Plus: we chart Chromebook Roundup, speeding up Linux. Plus: Ubuntu’s bumpy historyy run Linux on almost voice recognition app as it celebrates 10 years. LXFDVD highlights any Android device, LXFDVD highlights roundup, how good is 4K LXFDVD highlights Also, Pi alternatives and Linux Mint DE, Mageia 4.1, cryptography explained Tails 1.1 Live DVD, 2014 support in Linux, and CentOS 7, Arch Linux, the best web browsers. 6, CentOS 7 and more. and Minecraft hacking. and 3 essential rescue distros the state of education. Peppermint Five, Rescatux 0.32

Issue 187 Issue 186 Issue 185 Summer 2014 August 2014 July 2014 Product code: Product code: Product code: LXFDB0187 LXFDB0186 LXFDB0185 In the magazine In the magazine In the magazine Use our foolproof guide Get Ubuntu 14.04 Building your own PC to switch from Windows, running the way you want doesn’t just save you including backup and it with our tweaks and money, it means you get dual-booting. Plus turn hacks. Plus learn to build exactly what you need. a Raspberry Pi into a a Pi cannon in Minecraft, We show you how! Plus, wiki server, choose an control a sky of clouds find out how to install HD media player, run LXFDVD highlights using OpenStack and get LXFDVD highlights Linux on a Chromebook, LXFDVD highlights Windows apps in Linux Ubuntu 14.04 LTS, Mint 17, Samba dancing perfectly CrunchBang 11, Elive 2.2.2 beta, choose the best wiki Ubuntu 14.04 LTS (64-bit) LXF with Wine, and more. SystemRescueCD and more. with Linux, and more. Puppy Slacko 5.7 and others. platform, and more. remix, MX-14, and much 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. Turn on, log in and let our experts help make you a smarter Linux user

CHRIS THORNETT has been learning how to Bootstrap. He can also tie his This month learn how to... own shoelaces.

Unbricking

an fix, man good. I’d forgotten that feeling Myou get when you resurrect a broken piece of hardware. It’s great. For a few moments you feel like a mini- Prometheus returning with gift of ...... fire – or in my case the gift of Journald 68 Wireshark 70 Awk 74 Sean Conway enters the brave new Mihalis Tsoukalos gets out his Get to the useful data among your Facebook. A world of Journald for all your logging spyglass for a lesson on analysing realms of text result.Neil Bothwick had been bricked, and although I needs and shows you how to get the your network traffic using the cries “Awk” and dives headlong into was looking forward to a few most out of the Journalctl tool. visually appealingWireshark. the fray with this trusty tool. evenings without baby pictures being shoved under my nose, it was apparently my duty to fix it. The internet is great for useful information and particularly so for Linux queries, but opinions, I Code in tutorials discovered, on something as mundane as a broken Samsung Source code is presented in beige phone are like nipples: everyone boxes. When lines of code are too long has them, but a lot of them are for our columns, the remaining text utterly useless. appears on the next line in a solid box: procedure TfrmTextEditor. MySQL: ...... 76 Docker ...... 80 mniWordWrapClick Magic & Gods Andrew Mallett finishes off this We have a ‘whale’ of a time with Otherwise, there is a gap, like this: After reversing out of a few rabbit series covering the creation of Docker, as Jolyon Brown shows us holes, including one on fixing dynamic websites on the Raspberry how to adopt the open platform for a begin mniWordWrap.Checked := false defective power buttons, I called Pi by slotting in MySQL. development environment. on the power of Odin (the phone flashing software, not the Norse deity). Thanks to the incredibly well-informed users on the XDA Whether you’re a beginner or Developer’s forum, I was able to a guru, learn new skills in our find the right firmware (for the boot, pda etc) and a pit file, which programming section meant that all I had to do was run Odin and we were back in business. Auto- magic! This month, we’ve got some (pert) In this issue... tutorials that feel a bit like magic too, like the piece on Cython, the Cython: Compiling Git: Get started Python to C compiler (p84) and Docker (p80), but whatever your Philip Herron straps a nitro to Jonni Bidwell gets some odd level we’ve got something to Python. Say hello to a Python to looks yelling “Fork!”, “Git!” and tickle your tutorial itch. Enjoy! C compiler called Cython, p84 “3-way!” in the office, p88 [email protected]

www.tuxradar.com December 2014 LXF191 67 Journald Understanding the new logging process and journaling tool Journald: Log for Systemd Sean Conway shows the weary sysadmin how to work with Journald, and how to tap into all that logging data with the journal tool, Journaldctl.

Our expert Some service status details and ten lines of logs rolled Sean Conway into one screen. You got to like it! is a former aviation electronic technologist simple change creates an immediate learning curve for in métier whose is order to start examining the system’s problem. enjoying life now that he’s found If you are stroking along merrily in the Fedora Linux swim the consequences lane, you will no doubt discover that Fedora 19 has made the of his actions journald process the default logger. This replaces legacy no longer include raining aluminium. logging delivered via the rsyslog process. When Fedora 19 was first released Journald was having some teething issues and was not out front in logging. Those issues appear to be solved now thankfully, with journald the default logger in a recent software upgrade. Why change logging, anyway? The new logging process provides long overdue improvements that’s why. Journald helps improve logging to the same degree that Systemd improves system boot response. However, for most system t is two o'clock in the AM when you receive a call from the administrators these changes will force many to update their helpless desk (not a typo) reporting that a computer knowledge and step outside of their comfort zones. Iservice is not available. You access the business system We're not going to try and sell readers on the change. from home to do some remote troubleshooting. A quick URL The replacement brings some standards to logging that was check with a browser and you discover there’s no web page alluded to in the legacy logging system but rarely followed. being displayed. Logging into the server you follow the normal The new logging search is faster because of indexing. The troubleshooting procedure of looking at the log files. new system produces binary output that’s unreadable Examining the log directory you discover all existing process without a tool. The new logs are accessed via a journal tool log files have a zero size. In this scenario, an OS software and not a simple, cat, more or tail command. upgrade replaced the legacy logging system with another One method for easing the discomfort in learning a new one. The new logging system stored files in a different development is to demonstrate how simple tasks done using location and needed different tools to access them. This the old methods can be completed using the new methods. The key to looking at what journald is doing requires using the journal tool, Journalctl. The new logs are in a binary format. Journalctl is a command line interface (CLI) tool that’s used to probe the logs. From a terminal CLI the reader can type the code for a help listing of the tool. The output is a list of the flags and The Systemd command list-unit-files is a sweet Systemd command options available. feature that furnishes you with the status of services. journalctl -h

68 LXF191 December 2014 www.linuxformat.com Journald Tutorial

Foundational knowledge

User administration commands, system files generated by applications or indeed access, service delivery, system boot by the system itself are a critical Logs similar to the /var/log/secure legacy logging file. and file system commands are resource for troubleshooting. examples of foundational knowledge – Foundational knowledge for any Examining the man pages for journalctl using this knowledge is what other knowledge computer system is knowing how a man journalctlt is built on. When foundational system logs information. The logs provides an extensive description of options and query knowledge is replaced, the job of a provide snippets of details that can support. Scroll to the bottom of the man pages, you will find systems administrator becomes assist an administrator in identifying difficult, to say the least. Access to log and possibly resolving an issue. links to resources. The link at www.freedesktop.org/wiki/ Software/systemd is a premium place for finding information on Systemd and Journald. Note: The URL is even referenced at the end of the man pages, saving you from journalctl _COMM=sshd having to store the link. Examining the entries, it looks like the logs are reporting One more knowledge source that will prove useful if you some nefarious action on the port supporting the ssh service. are planning a deep dive into Systemd and Journald is the How can we tell what logs journald is handling? blog by Red Hat developer Lennart Poettering journalctl -F _SYSTEMD_UNIT (http://0pointer.net/blog/archives.html). It’s a good idea Examining the command output (picture, below), the to take conceptual scuba tanks, because this resource pool is sshd.service is one of the services using Journald for logging. deep and expansive. Many thanks to Lennart for sharing this In the past, the sysadmin’s mainstay command for examining with the community. logs and viewing entries being made in real time was tail -f / The developers have enhanced the tool with tab assist to var/log/messages. Fear not, the tool for Journald log display options list to complete the command. This saves the provides for this need. administrator from having to remember command syntax. journalctl -f journalctl While this command is running in one terminal window, poke When an option is appended to the command, tab assist will the ntpd time daemon with ntpq -p from another terminal continue to provide attributes to support the request. window. The logs display the error in real time and the ntp journalctl _COMM= query tool cannot be accessed as a non-root user. We had sshd success throwing -f at the end of some of the other Journalctl From the tabbing look up example, journalctl command is commands, to follow the logs as they were created. accessing logs that would have existed in /var/log/secure We wonder if the decision to use the -f attribute was on the legacy logging system. something the Journalctl developers decided to use to tap To exit the Journald and Systemd tools press c. If you have into knowledge that sysadmins have of the tail command. executed a command similar to tail, you will need to press With the display of logs from different services all Ctrl and the c key to exit the commands. Some screens glommed together, it helps that the journaling tool provides provide this tidbit of direction to help the user, others don't. some flexibility for filtering data. Before exploring more Journald features we need to stop Recall, though, that the logging is indexed which provides by Systemd for a quick look at a command that partners with some query capabilities. Try these examples out: logging. We suspect some of you are still frustrated by the journalctl --since=yesterday decision to implement Systemd in favour of SysV. journalctl --since=2014-09-15 --until="2014-09-16 23:59:59" systemctl list-unit-files Being conditioned to use log files as the starting point for The screenshot of the CLI (pictured bottom, p68) shows investigating computer issues, it's necessary to develop some how the sshd service looks when enabled. The question is: understanding of Journald logging because the old system were there any logs generated for this service? You can was deprecated leaving zero information. You'll find that answer this with: uncovering the basic commands is pretty straightforward, systemctl status sshd.service though it's not going to resolve the frustration that many You now have the status of the service along with ten lines of system administrators are going to be experiencing. the logs (pictured top, p69). Now try this Systemd command At this point though it's past 2am, the problem has been on for size: repaired and we're off to the Linux Format Tower boudoir for a systemd-analyze blame well-deserved mug of Horlicks and some sleepy time. LXF This is an aside, but we're like magpies attracted to shiny objects. When we bumped into this Systemd command that displays boot times during our research, we stopped writing to investigate why the ntpdate service was taking so long to start. But let's return to Systemd logging discussions... The next command displays the logs for the sshd service. In a former logger this would have been contained in the secure files in /var/log/: Note: sshd is listed using logging.

If you missed last issue See www.myfavouritemagazines.co.uk/lin

www.linuxformat.com December 2014 LXF191 69 Wireshark Set up the network analyser DQGFDSWXUHDQGµOWHU\RXUWUDIµF Wireshark: Analyse traffic Mihalis Tsoukalos explains the necessary things that you need to know to start using Wireshark, and analyses three kinds of network traffic.

distribution will have a ready to install package for analyser too, so go ahead and install it. You may ask what makes Wireshark different to other network analysers – apart from the fact that it's free – and why we're not simply advocating using tcpdump for packet capturing? The main advantage of Wireshark is that it's a graphical application. Capturing and inspecting network Our traffic using a is a very helpful thing expert because it cuts through the complexity of network data. To help the beginner understand Wireshark they will need Mihalis to understand network traffic. The aim of this article then is to Tsoukalos enjoys protocol supply a comprehensive introduction to TCP/IP to enable you analysis and to come to useful conclusions about the network traffic data packet inspection you're analysing. using Wireshark. He's a UNIX If you run Wireshark as a normal user, you won't be able to administrator, a use any network interfaces for capturing, because of the , a default Unix file permission that network interfaces have. DBA and a mathematician. It's more convenient to run Wireshark as root (sudo wireshark) when capturing data and as a normal user when analysing network data. Alternatively, you can capture network data using the tcpdump command line utility as root and analyse it using Wireshark afterwards. Please keep in mind that on a truly busy network, capturing using Wireshark ireshark is a very popular and extremely capable might slow down a machine or, even worse, might not enable network protocol analyser that was developed by you to capture everything because Wireshark needs more WGerald Combs. Wireshark was born in June 2006 system resources than a command line program. In such when Combs renamed the network tool Ethereal, which he cases using tcpdump for capturing network traffic is the also created, as he was changing jobs and couldn't use the wisest solution. old name anymore. Nowadays, most people use Wireshark and Ethereal has been consigned to history. Your Linux Capturing network data The easiest way to start capturing network packets is by selecting your preferred interface after starting Wireshark and then pressing Start. Wireshark will show network data on your screen depending on the traffic of your network. Note that you can select more than one interface. If you know nothing about TCP, IP or the other TCP/IP protocols, you may find the output complicated and difficult to read or understand. In order to stop the capturing process you just select Capture > Stop from the menu. Alternatively, you can press the fourth icon from the left, the one with a red square (which is shorthand for 'Stop the running live capture') on the Main toolbar (Note: its exact location depends on your Wireshark version). This button can only be pressed while you are capturing network data. When using the described method for capturing, you can't The TCP packet and the IP packet format. change any of the default Wireshark Capture Options. You can

70 LXF191 December 2014 www.linuxformat.com Wireshark Tutorial

see and change the Capture Options by selecting Capture > Options from the menu. There you can select the network Interface(s), see your IP address, apply capture filters, put your network card in promiscuous mode, and save your capture data in one or multiple files. You can even choose to stop packet capturing after a given number of network packets or a given amount of time or indeed a given size of data (in bytes). Wireshark doesn't save the captured data by default but you can always save your data afterwards. It's considered good practice to first save and then examine the network packets unless there's a specific reason for not doing so. Wireshark enables you to read and analyse already captured network data from a large amount of file formats including tcpdump, libpcap, Sun’s snoop, HP’s nettl, K12 text file etc. This means that you can read almost any format of The three captured network data with Wireshark. Similarly, Wireshark ARP traffic from the output. The eth.addr == packets (SYN, enables you to save your captured network data in a variety 01:23:45:67:89:ab && tcp.port == 25 filter displays the SYN+ACK and of formats. You can even use Wireshark to convert a file from traffic from or to network device with the 01:23:45:67:89:ab ACK) of a TCP a given format to another. MAC address that uses TCP port number 25 in its incoming 3-way handshake. You can also export an existing file as a plain text file from or outgoing connections. the File menu. This option is mainly for manually processing Keep in mind that display filters don't magically solve network data or using it as input to another program. problems. They are extremely useful tools when used There is an option that allows you to print your packets. correctly but you still have to interpret the results, find the I have never used this option in real life but it may be useful to problem and think about the possible solutions yourself. print packets and their full contents for educational purposes. When defining rules please remember that the (ip.addr != 192.168.1.5) expression doesn't mean that none of the ip. Display filters addr fields can contain the 192.168.1.5 IP address. It actually Quick While capture filters are applied during network data capture means that one of the ip.addr fields should not contain the tip and make Wireshark discard network traffic that doesn't 192.168.1.5 IP address. Therefore, the other ip.addr field value match the filter, display filters are applied after capture and can be equal to 192.168.1.5. You can think of it as 'there exists The fact that the FTP protocol 'hide' network traffic without deleting it. You can always one ip.addr field that is not 192.168.1.5'. The correct way of usually uses disable a Display filter and get your hidden data back. expressing it is by typing !(ip.addr == 192.168.1.5). This is a port number 21 Generally, display filters are considered more useful and common misconception. doesn’t mean versatile than capture filters because it's unlikely you'll know Also remember that MAC addresses are truly useful when it’s not allowed to use a different in advance what you'll capture or want to examine. you want to track a given machine on your LAN because the port number. In Nevertheless, applying filters at capture time can save you IP of a machine can change if it uses DHCP but its MAC other words, don't time and disk space and that's the main reason you might address is more difficult to change. blindly rely on the want to use them. It is advisable that you visit the display filters reference site port number to Wireshark will highlight when a display filter is syntactically for TCP related traffic at http://bit.ly/WireSharkTCP. For characterise TCP/ IP traffic. correct with a light green background. When the syntax is the list of all the available field names related to UDP traffic, erroneous, the background becomes pink. it's advisable to look at http://bit.ly/WireSharkUDP. Display filters support comparison and logical operators. The http.response.code == 404 && ip.addr == 192.168.1.1 About TCP/IP, TCP and IP display filter shows the traffic that either comes from the TCP/IP is the most widely used protocol for interconnecting 192.168.1.1 IP address or goes to the 192.168.1.1 IP address computers and it is so closely related to the internet that it's that also has the 404 (Not Found) HTTP response code in it. extremely difficult to discuss TCP/IP without talking about The !bootp && !ip && !arp filter excludes BOOTP, IP and the Internet and vice versa. Every device that uses it has:

The TCP protocol

TCP stands for Transmission Control Protocol. TCP stack. If the ACK is not received within a combined to uniquely identify each TCP The main characteristic of TCP is that it's reliable timeout interval, the data is retransmitted as the connection. Ports help TCP/IP stacks in network and makes sure that a packet was delivered. If original packet is considered undelivered. The connected devices (PCs and routers etc) to there's no proof of packet delivery, it resends the receiving TCP stack uses the sequence numbers distribute traffic among multiple programs packet. TCP software transmits data between to rearrange the segments when they arrive out executing on a single device. If a service wants to machines using segments (also called a TCP of order, and to eliminate duplicate segments. be seen as reliable it's usually based on TCP, packet). TCP assigns a sequence number to The TCP header includes both the Source Port otherwise it's based on IP. But as you can each byte transmitted, and expects a positive and Destination Port fields. These two fields, plus imagine, reliability comes at a cost and therefore acknowledgment (or ACK) from the receiving the source and destination IP addresses are isn't always desirable.

Save money, subscribe now! See www.myfavouritemagazines.co.uk/lin

www.linuxformat.com December 2014 LXF191 71 Tutorial Wireshark

in the SYN packet. The server sends back a TCP (SYN, ACK) packet which includes the sequence number of the opposite direction and an acknowledgement of the previous sequence number. Finally, in order to truly establish the TCP connection, the client sends a TCP ACK packet to acknowledge the sequence number of the server. After the TCP three-way handshake, the connection is established and is ready to send and receive data. The traffic for this case was produced by running the following command: ZJHWKWWSZZZOLQX[IRUPDWFRP After some necessary DNS, ARP and ICMP network traffic, the TCP three-way handshake begins (pictured top, p71). The client IP address is 10.0.2.15 and the destination IP address is 80.244.178.150. A pretty simple display filter (tcp && !http) makes Wireshark display 63 out of 82 packets. The three packet numbers used in the handshake are sequential Part of an Nmap ping scan on a LAN as captured by Wireshark. because the host wasn’t performing any other network activity at the time of capturing, but this is rarely the case.

An IP address This address must be unique at least to its Ping scans local network. This part will examine the network traffic that's produced by A network mask Used for dividing big IP networks into Nmap when it performs a ping scan. smaller networks that's related to the current network, LAN ping scans are executed using the ARP protocol. One or more DNS servers Used for translating an IP Hosts outside a LAN are scanned using the ICMP protocol, so address to a human-memorable format and vice versa if you execute a Nmap ping scan outside of a LAN, the traffic A Default Gateway This is optional if you want to will be different from one presented. In the example below, communicate with devices beyond your local network. A the Nmap command scans 255 IP addresses, from 10.67.93.1 Default Gateway is the network device that TCP/IP sends a to 10.67.93.255. The results show that at execution time only network packet to when it doesn't 'know' where else to 10 hosts were up or, to be precise, only ten hosts answered actually send it. the Nmap scan: Every TCP service listens to a port that is unique to each VXGRQPDSV3 machine. A machine that supports the HTTP protocol, the 6WDUWLQJ1PDS KWWSQPDSRUJ DW protocol that serves WWW, is also called an HTTP server. EEST Similarly there exist FTP servers, DNS servers, etc. It's the two 1PDSVFDQUHSRUWIRU[[[[[\\\\\]]]]]JU  pairs of the IP addresses and port numbers on both ends of a +RVWLVXS VODWHQF\  TCP/IP interaction that uniquely identify a connection 0$&$GGUHVV$'( 7SOLQN7HFKQRORJLHV between two machines that use TCP/IP. &2 A TCP packet (see the format of a TCP and an IP packet 1PDSVFDQUHSRUWIRUVUYJ\PDJDQDUJDWWVFKJU segment, pictured on p70) can be used to establish  connections; transfer data; send acknowledgements, +RVWLVXS VODWHQF\  advertise the buffer that holds incoming data, which is called 0$&$GGUHVV&)('( ,QWHO Window Size, and close connections. As you can see in the 1PDSVFDQUHSRUWIRU packet screenshot (see p70), each TCP segment has a +RVWLVXS VODWHQF\  header part and a data part. 0$&$GGUHVV'' +RQ+DL3UHFLVLRQ,QG &R/WG Quick The TCP 3-way handshake 1PDSVFDQUHSRUWIRU tip TCP provides a connection-oriented, reliable byte stream +RVWLVXS VODWHQF\  service. It's a full duplex protocol, which means that each TCP 0$&$GGUHVV''')% +RQ+DL3UHFLVLRQ,QG When you put connection supports a pair of byte streams; one flowing in &R/WG your network card each direction. The term 'connection-oriented' means the two 1PDSVFDQUHSRUWIRU in promiscuous applications using TCP must first establish a TCP connection +RVWLVXS VODWHQF\  mode, you allow the network device with each other before exchanging any data. 0$&$GGUHVV$' $VXVWHN&RPSXWHU to catch and read The TCP header includes a 6-bit flags field that's used to 1PDSVFDQUHSRUWIRU every network relay control information between TCP peers. The possible +RVWLVXS VODWHQF\  packet that arrives flags include SYN, FIN, RESET, PUSH, URG, and ACK. SYN 0$&$GGUHVV(( 8QNQRZQ to it even if the receiver is another and ACK flags are used for the initial TCP 3-way handshake as 1PDSVFDQUHSRUWIRU device on the you will see in a while. The RESET flag signifies that the +RVWLVXS VODWHQF\  network. Network receiver wants to abort the connection. 0$&$GGUHVV$&& &RPSH[,QFRUSRUDWHG packets still go The TCP three-way handshake goes like this: the client 1PDSVFDQUHSRUWIRU to their original sends a TCP SYN packet to the server, and its TCP header +RVWLVXS VODWHQF\  destination. includes a sequence number field that has an arbitrary value 0$&$GGUHVV' +HZOHWW3DFNDUG

Never miss another issue Subscribe to the #1 source for Linux on page 32.

72 LXF191 December 2014 www.linuxformat.com Wireshark Tutorial

1PDSVFDQUHSRUWIRU there will be two answers for the DNS query. In time, you will +RVWLVXS VODWHQF\  be able to take all this in with one glance. Quick 0$&$GGUHVV() *HQLFRP UDP uses the underlying IP protocol to transport a tip 1PDSVFDQUHSRUWIRUZZZZ\\\\\]]]]]JU  message from one machine to another, and provides the There is also a Host is up. same unreliable, connectionless packet delivery as IP. It console version of 1PDSGRQH,3DGGUHVVHV KRVWVXS VFDQQHGLQ doesn't use acknowledgements to make sure messages Wireshark called seconds arrive, it doesn't order incoming messages, and it doesn't tshark. The two The purpose of the ping test is simply to find out if an IP is provide feedback to control the rate at which information main advantages of tshark are that up or not – see the grab on the opposite page. What's flows between the machines. Thus, UDP messages can be it can be used in important for Nmap in a ping scan is not the actual data of lost, duplicated, or arrive out of order. Furthermore, packets scripts and that the received packets but, put relatively simply, the existence can arrive faster than the recipient can process them. it can be used of a reply packet. As all traffic is in a LAN, each network device The destination port of the first packet is 53 which is the through an SSH uses its MAC address in the reply so you only see MAC usual port number of the DNS service. The UDP part of the connection. Its main disadvantage addresses in both Source and Destination fields. The second packet shows the port numbers used for the reply: is that it does not presence of a reply makes Nmap understand that a host is up 8VHU'DWDJUDP3URWRFRO6UF3RUW  'VW3RUW have a GUI. Tshark and running. As a MAC address includes information about  can also entirely the manufacturer of the network device, Nmap also reports 6RXUFH3RUW  replace tcpdump. that information for you. 'HVWLQDWLRQ3RUW  Nmap also calculates the round trip time delay (or /HQJWK latency). This gives a pretty accurate estimate of the time &KHFNVXP[EE>YDOLGDWLRQGLVDEOHG@ needed for the initial packet (sent by Nmap) to go to a target >6WUHDPLQGH[@ device, plus the time that the response packet took to return As it happens with most tools, the more you use to Nmap. A big latency time is not a good thing and should Wireshark, the more efficient you will become with it, so keep certainly be examined. on practicing and learning! LXF

Analysing DNS traffic DNS queries are very common in TCP/IP networks. A DNS query creates little traffic and therefore it is an appropriate example for learning purposes. The following command will be used for generating the necessary DNS network traffic that will be examined: KRVWWQVOLQX[IRUPDWFRP OLQX[IRUPDWFRPQDPHVHUYHUQVIXWXUHQHWXN OLQX[IRUPDWFRPQDPHVHUYHUQVIXWXUHQHWXN Two packets are needed in total: one for sending and one for answering the DNS query (see grab, right). The first packet is number 3 and the second is number 4. A Display filter (DNS) is used to minimise the displayed data and reveal the useful information. The UDP (User Datagram Protocol) protocol was used and the desired information was sent back without any errors as shown by the Flags information. You can also tell by noting the time difference between the DNS query (1.246055000) and its answer (1.255059000) that the DNS services work fine because of the reasonable response time. The DNS server asked has the 10.67.93.1 IP address – as you can see from the destination IP address of the first packet. The same DNS server answered the DNS query as you can see from the source IP address of Here is how Wireshark shows the traffic of a DNS query after applying a the second packet. The 'Answer RRs: 2' line informs us that Display filter. Notice the green colour around DNS that shows the validity of it.

The IP protocol

IP stands for Internet Protocol. The main When the information doesn't need many routers mainly perform IP routing but every characteristic of IP is that it's not a reliable network packets, using a protocol that's based TCP/IP device has to do basic routing. protocol by design. Unreliable means that on IP is more efficient than using TCP, even if you Each IP address is a sequence of four 8-bit packets may not reach its destination for various have to re-transmit a network packet, because numbers, separated by dots. Each number has a reasons, including transmission errors, network there’s no three-way handshake traffic overhead. value between 0 (=2^0-1) and 255 (=2^8-1). hardware failures and network congestion. IP encapsulates the data that travels in a Example IP addresses are 10.25.128.254, Networks may also deliver packets out of order, TCP/IP network, because it's responsible for 213.201.43.23 and 192.168.1.200. deliver them after a substantial delay or deliver delivering packets from the source host to the IPv6 was developed by IETF and its purpose is duplicates. Nevertheless, a programmer can destination host according to the IP addresses. to solve the problem of running out of IPv4 program reliable applications that use IP by IP has to find an addressing method to addresses. IP uses 32-bit addresses whereas implementing their own error-checking code but effectively send the packet to its destination. IPv6 uses 128-bit addresses, offering more than this is a non-trivial task. Dedicated devices that you'd recognise as 7.9×1,028 times as many as IPv4.

www.linuxformat.com December 2014 LXF191 73 Awk Use the command line tool for data extraction and reporting from lots of text Awk: Extract data from text If you want to useful data from a whole lot of text results, try using awk, Neil Bothwick thinks it may be the tool that you’re missing.

ext handling has a long tradition in Unix and Linux. Part of 'The Unix Way' is to use text-based Tconfiguration and data files wherever possible, and be able to feed data from one program to another by using pipes. Most Linux users will have encountered with grep, (Globally search a Regular Expression and Print) the text search tool, and many will also use sed (Stream EDitor) to Our edit text streams or files. There's another tool that expert complements these two, and it's used by fewer people but Neil Bothwick those that do use awk tend to use it quite a lot. Their reason Neil Bothwick has for both of these is the same, awk is a powerful tool that can a computer in every room, but be quite scary at first sight – so much so that you’ll try to won’t disclose the avoid using it. When you do bite the bullet, you’ll understand location of his the power of awk and find yourself using it more and more. central server for security reasons. There's a lot to awk and whole books have been written on Extracting information. Here we’ve printed the names and it. All we can do here is help you overcome the first hurdle, versions of packages installed on a remote server. take away the mystery of awk and help you get started. To start with an example, let's say you want a list of logged in The string passed to awk tells it what to do with the users on your system, such as provided by w or who, but you information it receives, in this case that’s to print some fields. only want the usernames and the time they logged in. There are two main parts, the part enclosed in braces is The standard output from who is like this: actually the second part and determines the action to be nelz :0 2014-09-10 14:42 taken. The first part is a pattern to match; only records nelz pts/0 2014-09-10 14:43 (:0) matching that pattern are processed. No pattern was given root pts/10 2014-09-14 12:32 (:0:S.0) before, so all records were processed. What if we wanted to root pts/9 2014-09-16 19:14 (shooty:S.1) limit the output to users whose names start with n? The output from w is even more verbose (ironically). With who | awk '{/^n/ print $1,$3,$4}' awk, we can pick out just the information we need: Any records that don't match are simply discarded. who | awk '{print $1,$3,$4}' The part in braces is optional too, it defaults to {print $0} The input, either from a file or a pipe as shown here, is where $0 is the whole record, so a pattern without a processed line by line. In awk terms, a line is a record and command makes awk more like grep, and omitting both turns each record is split into fields. By default, these fields are it into cat. The quotes around the whole awk command string separated by white space. So what this simple use of the awk are required. command does is print the first, third and fourth fields from each of the lines, which happen to be the name, login date Patterns and actions and time. This is fine when records are separated by white space (this includes tabs), but what if the input uses a different field separator? It may be a CSV file from a database or Awk or Gawk? spreadsheet. You can tell awk to use the different field separator in one of two ways. The -F or --field-separator You may see references to gawk at we talk about the general program awk, option sets it on the command line, for example: times. Awk has been around for you are almost certainly using gawk. awk -F, '{print $3}' data.csv decades, and there have been various Gawk complies with the POSIX The other way to do it is to set the FS variable in an awk implementations. Linux distributions definition of awk so – except in some statement, but you would normally only do that in more generally use GNU awk, gawk, and awk unusual cases that you are unlikely to complex cases. You can also set RS to change the record is then a symbolic link to gawk. So while encounter – the two are identical. separator from a new line, but that’s also an uncommon need. If the separator is set to a single character, as above,

74 LXF191 December 2014 www.linuxformat.com Awk Tutorial

Awk is a scripting language

We have looked at awk mainly as a control loops, functions and everything information, read the awk info pages. command line tool here, which is how it else you would expect. Clearly, we are If you need more detail, there are several is used much of the time. However, there not going to fit all that into two pages online tutorials and books to choose is far more to awk – it's an interpreted when there are complete books written from, such as O'Reilly's sed & awk or with variables, on the subject. If you want further Effective Awk Programming.

it is treated as such. If it’s any longer this would be considered There are a regular expression. This can be useful method if you don’t plenty of have full control over the input and need to cover various resources if you alternative separators. want to learn So far, we've used a regular expression as the pattern. more about awk, this one is on the We can match more precisely than this: for example, to IBM developer match a regular expression in a particular field, you could use works website $1 ~ /John/. So to make our user list more useful, we could (http://bit.ly/ list all non-root users with: IBMAwk). who | awk '$1 !~ /^root$/ {print $1,$3,$4}' There's no guarantee that each line will have the same number of fields. If you specify a field that doesn't exist, awk simply uses the empty string, it doesn’t return an error. This is important as you may be working with input that contains blank lines. What if you want the last field of each record but you can’t be sure that all lines have a set number of fields? Try using awk '{print NF}' sometext which will show the number of fields on each line, while awk '{print $NF}' sometext will output the content of the last field on each line. You can awk '{out = ""; for ( i = 2; i <= NF; i +=2 ) out = out $i " "; combine this with the above to exclude lines with less than print out }' the required number of fields: This illustrates a couple of features of awk actions. awk 'NF >=5 {print $0}' The first is that you can have multiple statements, separated The print command outputs the contents of the field, or by semi-colons. The second statement shows one of the loop whatever else you tell it to print, as a plain string. There’s also constructs available in awk. Here were are selecting only the a printf function that works the same as in other languages, even numbered fields, building them into a string and then taking a format specifier to set the output format. For printing it. There is also a sneaky trick for removing one or example, to print a numeric field as a currency, you could do: more fields from the output: awk '{printf("£%0.2f\n" $1)}' awk '{$1 = $2 = ""; print $0 }' Here we are assigning the empty string to the first and Compound actions second fields and then printing out the whole, modified, While awk can work with individual single fields, like $3 for record. These examples help to illustrate another important instance, it has no feature to directly deal with a range of point. Don't get hung up on trying to do everything with one fields, such as $3 to $6. As this is commonly needed, here is program. Awk isn’t a universal solution to all text processing one way (there are others) to do it: needs and this is a good example. If you want a specific range of fields, sometimes it's far simpler to forget awk and use cut: cat somefile | cut -d, -f 3-5,7 The delimiter is set with -d and -f specifies the ranges of fields to print. Cut is a simple program, so you may still want to use awk to format or select from the input data before sending it to cut for slicing into fields. Awk, as a programming language is well-suited to one- liners, with patterns and actions on a single command line. There comes a point when a one liner becomes too cumbersome or unreadable (Perl programmers, take note). When you have more complex needs, or simply want to be able to re-use the same invocation, you can save it into a file and pass that to awk with the -f argument. You can even call an awk script directly if you make it executable like this A full programming language, awk can be used to write #!/usr/bin/awk -f (and run) scripts like this one. if you include this shebang as the first line. LXF

If you missed last issue See www.myfavouritemagazines.co.uk/lin

www.tuxradar.com December 2014 LXF191 75 Nginx Use LEMP setup on Raspberry Pi to run queries via an MySQL server MySQL: Link to your database Andrew Mallett finishes off this series covering the creation of dynamic websites on the Raspberry Pi by slotting in MySQL.

The resulting output gives a really useful display summarising the activity of the database service. We also need to ensure that the database server can be connected only from the localhost. In other words the web server, which is also running on the same host, should be able to connect to the database server but not remote clients. We can display Our this using the Linux command ss or show sockets: expert ss -lt | grep mysql The output from ss should show that the MySQL service Andrew is listening on just 127.0.0.1, the localhost and not the external Mallett is a Linux trainer interface of the Pi. The actual port or socket being used by with over 700 the service is 3306. The port merely represents the address videos on YouTube of the service. You may know that the Nginx web service (http://bit.ly/ UrbPeng). You’ll listens on port 80, well MySQL listens on port 3306. To see also find his the mappings of common ports to service names take a look courses on www. in the file /etc/services. This has over 600 lines on the Pi, pluralsight.com. however, we can quickly look for the required information using the command grep from the Linux shell: grep mysql /etc/services We can remain logged into the Raspberry Pi as a standard user and from the LXTerminal we can authenticate to the MySQL service using the mysql command line client. As we log in independently to MySQL there's no need for root privileges within Linux. However, don't be confused, we'll be logging into MySQL as the MySQL root account. Currently, this is the only user account on the database server and has Quick his is the fourth and final instalment of our Nginx/ full rights to the MySQL resources in the same way as the tip LEMP series. We've been crafting together a LEMP Linux root account has full rights to the Linux system. Using Tsolution and our final step will be working with the the client mysql we can logon using the following command: MySQL statements MySQL database server to create a simple contact database. mysql -u root -p can be broken Once the database is running and having mastered some You will be prompted for the password and, with into three main types: DML Data basic SQL query techniques, we'll glue this final piece of the successful authentication, we will be presented with the Manipulation puzzle into our PHP-enabled website and we'll then be able to MySQL prompt and we’re in. We can now concentrate on the Language which execute remote searches within the database using HTML important task of creating a database. The database is a makes up most of forms on the Nginx web server. place holder for tables (content). In many respects a our regular inserts and selects; DDL database is much like a folder if we were to compare it to the Data Definition Creating a database file system. Don't forget, that when issuing SQL statements, Language where If you've not already installed your MySQL database server, each line of code is terminated with a semi-colon. We will we create and refer back to part one of the series (Tutorials, p72 LXF188). begin by listing the current databases, then create the new drop objects like The database server will hold the backend storage element of database and list all databases again, are you ready? tables and DCL the Dat Control the solution. The database that we'll create will act as a SHOW DATABASES; Language where we context to house and locate tables, which ultimately define CREATE DATABASE contact; GRANT or REVOKE and store our data. Before proceeding we can run some SHOW DATABASES; permissions. simple pre-flight checks that will verify that the database USE contact; server is running. The simplest way to do this is to use the We can see that we start with just the standard system service command line tool: databases in existence and our new database is then created sudo service mysql status and listed in the output – we name the database contact. To

76 LXF191 December 2014 www.linuxformat.com MySQL Tutorial

Web Services in a Pi

We have created something quite service that can easily be attached to interest you do not want to stop here; extraordinary and powerful on the trusty anything. Imagine this at a trade show this is just the first station on an exciting little Raspberry Pi. The industry often where you can carry your product journey. Oracle maintain great talks about embedded devices as if they database and interface with people. The documentation on MySQL: http://dev. are something really special and technological knowhow learned, mysql.com/doc/ and there are great expensive. Using the simplicity of the however, is not restricted to the Pi and resources on PHP, CSS and HTML, Raspberry Pi we have demonstrated can be transferred to any Linux w3schools being one of many sites to how we can create an embedded web distribution. If this has taken your check out: www.w3schools.com.

move into that database we can make use of the command: doing so we enforce the uniqueness of the uid for each user in use in the same way as we do the cd command within the file the table and provide an easy way to locate each entry in the Quick system. In this way we can refer to tables that we create with table. This first column has got a lot going on so I hope this tip just the table name and remove the need for including the has not put you off. We can see from the supplied code that PHP files, such as database name when referencing tables. As we now have a the fname and lname columns are much simpler in their the config.php database we can go ahead and create a table. The table will definitions. The data type for both columns being are included from hold the data that we'll add for this simple contact varchar(50); this will allow for up to 50 characters to be the include_path, by default this will application. The table will consist of columns that will store stored but will adjust to a lower amount if the names entered include the current the user id, first name and last name. To create the table we are shorter. Just by example we show that we can allow the directory; additional define these columns and enforce the data-type for each fname column to be nullable. paths can be column plus any additional properties for the table. We will added by using the make use of the CREATE TABLE statement in the SQL Inserting data into the table PHP function set_ include_path. If you language to achieve this first step. From experience I can reliably inform you that having a table manage the server USE contact; without data is a little like having bread without butter; the you may also set CREATE TABLE users ( two inextricably go together. Let’s add some users to our this permanently uid INT UNSIGNED NOT NULL AUTO_INCREMENT table, and this is achieved using the MySQL INSERT in the PHP.ini and the include_path PRIMARY KEY, statement. First we will add a single row and query the table directive... fname varchar(50) NULL, after and then we can add multiple rows: lname varchar(50) NOT NULL); USE contact; SHOW TABLES; INSERT INTO users ( fname, lname) values(‘Bob’,’Jones’); Once the table is created we'll be able to verify its success SELECT * from users; from the display outputted from the command SHOW We start by ensuring that the database context is correct TABLES. Moving forward we can make use of the command by issuing the USE statement. This will be okay to do even if DESCRIBE to detail the columns created as well as more we are in the contact database and won't error, but is a great detailed information with SHOW CREATE TABLE: double-check before issuing any code. The INSERT statement DESCRIBE users; adds the row to the table. We further describe which SHOW CREATE TABLE users; elements we are adding and the order they are provided in Let’s now turn to the detail behind the creation of the the first parentheses; the values then follow in the second set. table. We called the table users. The definition, though, is We deliberately haven't included the uid column as we can encompassed within the parentheses and consists of a single leave this to AUTO_INCREMENT to complete. When we line of MySQL code until we close the parenthesis, and end retrieve the data with the SELECT statement, INSERT is the code line with a single semi-colon. Each column in the similar to a write and SELECT similar to a read. From the table is delimited by the comma. To aid readability we spread resultant information we will be able to see Bob with the uid these column definitions over multiple lines, so each column of 1. The use of the asterisk within the statement instructs all is represented by its own line. First, we create the uid column matching columns to be displayed in the output. and we accept a data type if INT or an integer, (whole Now we’re competent in inserting a single row of data, we number). Setting this to unsigned means that we accept only can see how to insert multiple rows using INSERT. The syntax positive values disallow negative values. The storage used for is similar but we now have a comma delimited list of values this is 4 bytes and allows values from 0 through to a massive grouped with parenthesis as in the previous example: 4,294,967,295. Maybe a little overkill for our needs, (will we ever have 4 billion users?) but it certainly allows for enough user IDs in the long term. NOT NULL does exactly as it announces on the tin and ensures that a value must be added to this column. We can, however, make the process a little easier by allowing the option auto_increment, making sure the value will be added automatically if we don't supply one. The output from ss can show the ports that are in use on your Raspberry Pi. We additionally set this column as the 'primary key', and in This is similar to the output from netstat but ss is more dedicated to this task.

Catch up with the series See www.myfavouritemagazines.co.uk/lin

www.linuxformat.com December 2014 LXF191 77 Tutorial MySQL