Sie sind auf Seite 1von 132

L

X
F
D
e
c
e
m
b
e
r
2
0
1
1
L
X
F
1
5
1
I
s
s
u
e
1
5
1
P
r
i
n
t
e
d
i
n
t
h
e
U
K
The
#
1 sourcefor Linux
LXF151 DECEMBER2011 6.49
P
r
i
n
t
e
d
i
n
t
h
e
U
K www.TuxRadar.com
C
o
n
q
u
e
r
t
h
e
c
o
m
m
a
n
d
l
i
n
e
M
a
n
d
r
i
v
a
2
0
1
1
X
B
M
C
R
e
c
y
c
l
e
o
l
d
h
a
r
d
w
a
r
e
L
i
b
r
e
O
f
f
i
c
e
v
s
W
o
r
d
R
i
g
a
L
i
n
u
x
r
o
u
t
e
r
D
o
N
o
t
T
r
a
c
k
P
r
o
t
e
c
t
y
o
u
r
s
e
l
f
a
t
a
l
l
t
i
m
e
s
The UKs biggest* and best Linux mag
O
N
Y
O
U
R
S
H
I
N
Y
D
V
D
M
a
n
d
r
i
v
a
2
0
1
1
,
F
l
i
g
h
t
G
e
a
r
,
C
A
I
N
E
,
t
u
t
o
r
i
a
l
c
o
d
e
+
m
o
r
e
!
ISYOUR
FREE DVD
MISSING?
Speaktoyour
newsagent
now!
Mandriva2011
Thedistrothat starteda
thousandusers is back p22
*132 fact-packedpages. Fact!
$conquer the\
>commandline
PLUS!
16-PAGE
Evenmoreprojects
inourCoding
Academy
CO
D
IN
G
SECTIO
N
LibreOffice vs Word
Get themto play nicely together p80
Riga Linux router
Turn any machine into an internet gateway
and say farewell to fiddly firmware p96
MakingMandriva
The Russians have saved it for the users so
whats the story behind the newrelease? p56
Parse perfect Perl
Where were going, we dont need SQL p102
Also inside
Core skills
Encrypt your les
Keepthemsecret,
keepthemsafe
ArchLinux
Packageapps
Compilepackages
likethecool kids
Android
BuildanMP3player
Hackphonestheethical
waycodeonAndroid
X: thetechthatwontdiep48
Chase Douglas
We have to deal
with backwards
compatibility issues
XBMCfromscratch
Buildamediacentrethat plays
everythingthanks, Microsoft! p92
Be the boss of your computer
Diagnose and fix problems
Expand your Linux skillset
Get real work done fast
www.tuxradar.com
This month we help you to conquer your fears of
the command line. We asked our team: what part of
Linux are you most afraid of?
Who we are
The
#
1 sourcefor Linux
GrahamMorrisonEditor
graham.morrison@futurenet.com
Shell shock
NickVeitch
Imnot scared of
Linux. Truth be told,
Linux is scared of me.
Mwahaha!
What we do
We support the open source community
by providing a resource of information, and a
forumfor debate.
We help all readers get more fromLinux with our
tutorial section weve something for everyone!
We license all the source code we print in our
tutorials section under the GNUGPLv3.
We give you the most accurate, unbiased and
up-to-date information on all things Linux.
ShashankSharma
Spheniscidaeaphobia.
If I get that, Ill just
have to move over to
BSD. Or MikeOS.
AndrewGregory
My neophobia means
that Imstill running
Turbolinux 8. Whats
this KDE 3 thing people
are talking about?
BobMoss
Imgenuinely scared
that Gnome 4 will just
have a single button
that says Log Out. You
know, as part of the
drive for simplicity.
David Cartwright
I fear the day my VAX
11/780 stops running,
and I have to pay
12,000 for a 256k
stick of RAM.
Susan Linton
Imscared that RMS
will condemn my
favourite distro as
non-free. Nooooooooo!
Efrain Hernandez-
Mendoza
Who is Colonel Panic,
and why does he want
to fsck my drive?
December 2011 LXF151 3
If you ask someone who knows very little about Linux
why they havent tried it, in my experience, theyll often
say something like: Oh, it seems far too complicated.
Id never be able to remember all those commands.Theyre
referring to the command line, and Imalways surprised they
think of this when talking about Linux, and not rotating cubes,
community development and penguins.
The command line has become synonymous with Linux, and
many people still seemto think you need to master it to get a
working system. We all knowthis isnt true. You can use Linux
just as you would OSXor Windows, and theres absolutely no
need to resort to typing fdisk unless you want to. Ive forgotten
howmany people Ive needed to say this to, and they all seem
to leave looking unconvinced, as if taking the command line
fromLinux removes some of its mythical allure.
But maybe I shouldnt be so apologetic, and maybe the
shell deserves to be lauded as our operating systems best
feature rather than a relic from a bygone era. You can still do
things quicker, more efciently and more effectively with just
a couple of commands than you ever could from the desktop.
And with consumers losing more control over their hardware
with every new shiny product they buy, the CLI represents the
true nature of Linux an operating system to play with, to
experiment on, to tear apart and put back again. All thanks to
a couple of commands.
Andy Channelle
Someone telling me
that my choice of
distro is wrong. Dont
you knowthat digs into
my soul? Boo hoo...
Neil Bothwick
As a leet Gentoo user,
Imafraid of installing
binary packages,
rather than using my
3,927-character long
CFLAGS settings.
Mayank Sharma
Starting LibreOffice. I
always knowIll regret
it, 15 minutes into
staring at that splash
screen.
Jonathan
Roberts
Seeing a BSOD. No
wait, a rowof bombs.
No wait, a guru
meditation error...
Mike Saunders
The letter X. Theres
too much of it. Linux,
Firefox, The XWindow
System, Xfce, Latex...
Welcome
Subscribe today
and get ve issues FREE!
4 LXF151 December 2011 www.linuxformat.com
Talking heads
Chase Douglas onbringingmulti-touchtoUbuntup48
The biggest challenge
with X is that it defined
a protocol and said we
all must conformto this.
Roundup: Email clients p30
What OnEarthis...
DoNot Track? p60
Reviews
Contents
Theworldis at your fingertips. Commandandconquer.
Mandriva 2011 .................. 22
Can a newdirection turn the distros
fortunes around?
FlightGear 2.4................... 25
Chocks away for the latest instalment of
the classic indie flight sim.
Qt Creator 2.3....................27
Nokia delivers a major update to its
development environment.
RawTherapee 3.0............. 29
Transformyour RAWimages with this
scarily feature-packed photo converter.
Books................................. 36
Awesome algorithms and free tool tips for
messing with your images.
Seen this somewhere before?
Creators clever application window.
Take charge of
your computer p40
$conquer the\
>commandline
December 2011 LXF151 5 www.tuxradar.com
News............................. 6
Release cycle madness and Microsoft
moves to lock out Linux.
User groups................14
Barcamp MediaCity report and find
a friendly LUGnear you.
Mailserver...................16
Vent your spleen and if its not too
rude well put it in print.
Roundup....................30
Five of the best email clients go
head-to-head.
Distrowatch...............38
AnewMandriva, the latest Arch and
a look at howFedora 16s shaping up.
Tutorials
Answers....................118
YOUR PROBLEMS SOLVED
Grappling with Grub? Need
softphone solutions? Helps at hand.
Next month............. 124
Like a Roman haruspex, we study the
entrails and tell you whats in store.
What on Earth is? ....60
Do Not Track: keep those pesky
advertisers off your tail.
Sysadmin...................62
Server setup made simple and all you
need to knowabout virtualisation.
Subscriptions ...........66
Five free issues and theyre all
delivered to your door.
HotPicks....................68
Hotter than DeathValley on a very
sunny day.
Back issues.............. 117
Missed a tutorial? Its not too late to
get your hands on an old mag.
Our subscriptions team is
waiting for your call.
Recycle old kit..................... 50
Breathe newlife into old computers.
Beginners
Encryption..........................76
The secret world of file security.
Compatibility
LibreOffice & MSWord... 80
Word processors working in harmony.
Package management
Arch Linux......................... 86
Get to grips with the user repository.
Electronics
Arduino.............................. 88
Custombuild your own.
Media centre
XBMC................................. 92
Turn a spare PCinto a media centre.
Hardcore
Build a firewall .................. 96
Protect your systemwith a Linux-based
installation that does what you want it to.
Create an encrypted virtual disk.
Dont miss...
Regulars at a glance
Coding Academy
Perl...........................................................102
Keep track of your books with a simple database.
Coding Concepts ..................................106
Conditionals the ifs and buts of coding.
Python.....................................................108
Make customtooltips for a newmusic player.
Android....................................................112
Build your own MP3 player.
p126
Inside Mandriva.................. 56
Ayear in the life of a troubled distro.
18 data security tips.......... 54
Hang on to your valuables.
Subscribe today
and get five
issues FREE! p66
On your free DVD
Mandriva 2011
CAINE 2.5
FlightGear 2.4
Puppy 5.2.8
PLUS: Games, tools &guides...
9
0
0
0
THIS ISSUE: Ubuntu Google KDE Red Hat Patents MS Lockdown
A
member of the Ubuntu
Technical Board, the body
responsible for deciding the
direction that Canonicals distro should
take when it comes to technical matters,
has proposed that the distro abandon its
current six-monthly development cycle
and switch to a monthly release instead,
as used by Firefox.
ReLeAseCYCLes
Ubuntu to go monthly?
Canonical dev suggests revitalisingdistros releasecycle.
At the moment, Ubuntu releases
come twice a year, inApril and October,
and this predictability along with an
up-to-date implementation of the
Gnome desktop is one of the key
features that made it such a success
when it launched as a Debian spin-off in
October 2004. These releases are
supported for 18 months, except for the
Monthly distro
updates could be too
much hassle for some.
Etch
Laugh Constantine Goddard Leonidas Cambridge
OpenSUSE11.1 OpenSUSE11.2 OpenSUSE11.3
IntrepidIbex Jaunty Jackalope Karmic Koala LucidLynx (LTS) Maverick Meerkat
Arch
2011 2010 2009
Debian
OpenSUSE
Fedora
Ubuntu
(proposed)
Arch
business-oriented long-termsupport
(LTS) releases, which Canonical
continues to support for three years on
www.linuxformat.com 6 LXF151 December 2011
The problemthat Remnant has
identified seems to us to be
more closely related to the
Ubuntu developers pay
structure rather than any
probleminherent in the release
cycle. But if Canonical was to
adopt a structure that enabled it
to release more often, the logical
way would be a rolling release
cycle, as used to brilliant effect
by Arch. Even OpenSUSE is
getting on the bandwagon now
with Tumbleweed.
the third way
Lenny Squeeze
Lovelock Laughlin Verne
OpenSUSE11.4 OpenSUSE12.1
ck Meerkat Natty Narwhal
2012 2013
the desktop, and on the server for five years. The
systemseems to work well as it is, so why change it?
Scott James Remnant, the author of the proposal,
said: There is an incredible emphasis on the Ubuntu
planning process of targeting features for particular
releases. This is the exact thing youre not supposed to
do with a time-based release schedule.
A better way
He then went on to criticise the motivations of the
Ubuntu developers: Unfortunately Canonicals own
performance reviewand management is also based
around this schedule. The Ubuntu developers so
employed (the vast majority) have such fundamentals
as their pay, bonuses, etc, dictated by howmany of
their assigned features and work items are into the
release by feature freeze. Its not the only requirement,
but its the biggest one.
Summing up, he gave three reasons for Ubuntu to
switch to the monthly release cycle: The original
reason for the six-month cycle has already been
forgotten: features are targeted towards releases,
rather than released when ready; because the original
base for the release schedule (Gnome) is no longer a
key component of the distribution; because no other
key component has adopted this schedule.
Weve plotted what a monthly release cycle would
look like for Ubuntu compared with a fewother big
hitters on the distro landscape. Updating a distro is a
time-consuming process, and while it is satisfying to
have the latest and greatest software, monthly distro
updates could be too much hassle for some.
Compiler
upgrade
Michael Meeks
What most
excitedme
at the recent
OpenSUSE
conference was the work by Jan Hubicka on
GCCs Link Time Optimisation (LTO). This has
huge potential to speedupapps such
as LibreOffice.
Traditionally, complex software has been
fragmentedinto lots of small, manageable
pieces. Compilers buildandoptimise each
piece in isolation to the rest, then stitch them
together at the end. That gives a substantial
down side the compilers optimiser can only
see the code in this one piece. This is not ideal,
as poorly performing patterns of code can
appear at the interface betweenthe fragments.
With LTO, available in the latest GCCs, it
is finally possible to see the big picture. This
allows the compiler lots of ah-hah moments,
finding andremoving code thats not used, or
noticing complex code usedto make much
simpler patterns.
Code in the real world
Another big win combines this global viewwith
tracing howapps are really used. This makes it
possible to put frequently usedpieces together
in a hot section, andless frequently used
bits elsewhere, along with pieces only used
at startup. This extra information makes new
things possible, such as accurate removal of
unusedcode, global in-lining, de-virtualisation
andvariable optimisation levels inside a
function. In some cases weve suddenly
noticedcomplex-looking functions that are
only usedin simple ways, andbeen able to
evaporate several thousandof these, from
Firefox for example.
Traditionally optimisation has been a trade-
off between code size andspeed. Nowadays,
with LTO, we can have our cake andeat it big
applications that are both faster
andsmaller.
Comment
Michael is a pseudo-engineer, semi-colon lover,
SUSE LibreOffice hacker and amateur pundit.
deVeLopMent
MoRedeVeLopMent
Canonical must be hoping that, by
streamlining the process that
developers need to followin order to get
work included in Ubuntu, it can tap into
a wider pool of programming talent and
get the edge on its rivals. However, if it
works, it will be good for everyone. Win!
with KDE and help us create the future.
But even if some of themdont, Imsure
this Summer of Code made a difference
in their lives.
Not being evil
When the Summer of Code launched, it
was seen as a way for Google to give
something back to the free software
community, as well as a way for the
company to identify talent.
It still retains those attributes, but
with growing disquiet over Androids
relative non-freeness, the Summer of
Code has arguably become more
important to Google for the positive PR
it brings. The work on KDE is also a
vindication of the structural changes it
underwent with the release of KDE 4.0.
At the time it was criticised for focusing
on abstraction layers and newways for
programmers to work, rather than
providing features for the end user, but
that work is paying off now.
C
anonical has finished work on a
development portal to make it
easier for programmers to
contribute code and ultimately get it
featured in Ubuntu.
The site includes a counter so
that developers of existing
applications can see howmany
downloads theyre getting, and for the
absolute beginner theres a guide to
getting started, including a video
tutorial and a detailed step-by-step
guide for creating a newproject.
Simplified process
Each distro seems to have a slightly
different process for contributing
software, with the guidelines for
inclusion in Debian, on which Ubuntu is
based, being particularly strict.
G
oogles Summer of Code
project, which sponsors
students to write software in
the summer break fromuniversity, has
benefitted Linux once again, with
contributions to, among others, the
KDE desktop environment.
The project has produced some
intriguing results, with work on
integration between KDE and Gnomes
Zeitgeist activity journal as well as lots
of work on Nepomuk and other
semantic technologies.
Lydia Pintscher, a KDE contributor
and Summer of Code monitor based at
the University of Karlsruhe, said: At
KDE, were thrilled to have been given
the opportunity again to work with so
many bright and enthusiastic students.
Weve given thema good introduction
to the world of free software and helped
themsee just howmuch they are
capable of when they put their minds to
it. I obviously want all of themto stay
Ubuntu reaches out
KDE gains from
Summer of Code
Developer portal tobringcodersintothefold.
Google-sponsoredprogramhelpskool desktop.
Canonical aims to simplify
meta-tasks for potential contributors.
newsdesk
www.linuxformat.com 8 LXF151 December 2011
Need more space?
World Class Web Hosting
H
O
S
T
I
N
G
F
O
R
1
2
M
O
N
T
H
S
*
Microsoft Global Hosting Partner of theYear 2011
Bigger packages at smaller prices
Get the space youneedwithone of our scaled-upweb-hostingpackages.
Take advantage of more webspace anddatabases plus a whole host of
features, includingMicrosoft Exchange2010email. Youll fndit easier
torundynamic database-drivenwebsites.
Youll alsoget the peace of mindthat comes fromUKdatacentres and
24/7customer support over thephoneor online. Whats more, our
packages are half pricefor 12months.
Our promise: UK hosting Nosetupfee Nonasty surprises
Followus on:
Seehowyoucouldget morefor less at:
fasthosts.co.uk/scaledup
08081686777
2011 All rights reserved. Fasthosts and the Fasthosts logo are trademarks of Fasthosts Internet Ltd.
*Ofer subject to a minimum 12 month contract. Ofer, prices & product specifcations valid from 8th August 2011.
All prices exclude VAT unless otherwise stated. Terms & Conditions apply, see website for details.
No fsh were harmed in the making of these adverts.
100GBwebspace
FREETrafcDriver SEOTool
ASP.NET3.5withAJAXextensions
FREE.uk domainname
OneClick Installer (Linux)
5MySQL databases
...andmuchmore
BUSINESSSTANDARD
4.49pm(5.39 incVAT)
Normal price 10.79 incVAT
Packages include:
Checkout our other packages fromjust 2.49at Fasthosts.co.uk/hosting
Comment
Freetrafc
solutions
DavidCartwright
As a global
network
manager, a
fair chunk
of my budget finds its way each year into the
pockets of Cisco Systems. I was thinking about
this yesterday as I was stuffing a newIDS/IPS
module into one of my ASA5510firewalls, and
it made me reminisce.
Back in the early 1990s I workedon a
campus whose network was one big, flat,
scary Class Bnetwork with thousands of
connecteddevices; given that 10Mbit/s
Ethernet was as fast as it got in those days
(at least on the desktop), this was a problem.
As the ITteaching department we generated
a fair amount of traffic, with the broadcast
rubbish that implies.
One of my colleagues brought us a
solution, though. He wanderedin andtold
me: If you can findme an oldPCanda pair of
3Com3C509LANcards, Ill make us a router.
Andthats what he didandit didnt cost a
bean because the router software hedfound
was freely available. So we ran upour no-
pounds-and-no-pence router andthe
worldwas a happy place.
Open source router
By nowyoure shouting Vyatta at me.
Andquite rightly so its a darnedgood
consideration. But the problemI have is this.
If I were in London, I wouldbe hard-pressedto
get the level of response I needon a Vyatta-
basednetwork. With Cisco I knowI can get a
replacement for a blown-uprouter within four
hours, andthat if I wantedan engineer I could
have one of those as well; the same isnt true
with the open source alternative.
But Imon a small rock in the middle of the
Channel Islands, which as far as I knowhas an
open source router skill base of approximately
zero. Lets hope this changes soon, because
the commercial router worldis
ripe for some competition.
David is an IT consultant with a penchant for
cross-platformintegration, CTI and proper beer.
The latest version of Ubuntu
should be available froman
internet near you on 13 October.
Ubuntu 11.10 (codename: Oneiric
Ocelot) was released in beta form
in late September, and new
features include improvements to
multiarch, a systemthat enables
users running a 64-bit systemto
install 32-bit binaries. OneConf, the
configuration tool, has also been
brought into the Ubuntu Software
Centre to help uses sync their
LinUXdistRo
oFFiCesUite
Gnome 3.2 had a user interface
freeze at the beginning of September,
which means that it should be
available by the time you read this.
Thanks to Googles Summer of Code,
the desktop environment has an
onscreen keyboard (as accessibility
is such an important aspect of free
software, this really should have been
included from3.0) and an integrated
contact search facility. Of course, no
desktop these days is complete
without web apps, and the teamhas
included plenty of those.
By the time you read this, the
latest version of Germanys
number one distro should be
available for testing. OpenSUSE
12.1 promises the usual
smattering of cutting-edge
technology, including support for
Btrfs snapshots. Perhaps the
biggest change though is that
Tumbleweed, the Arch-style rolling
package manager that was trialled
desKtopenViRonMent
LinUXdistRo
Hitting the mirrors
Whats behindthefreesoftwaresofa?
Ocelots: now in purple.
in OpenSUSE 11.4, will nowwork
across the whole system.
applications between several Ubuntu
installations, and we can no doubt
expect lots more Unity fun too.
Calligra, the successor to the KOffice
productivity suite for KDE, has moved
into beta 1, the stage at which all new
features should have been added and
the developers focus instead on
polishing whats there.
Krita, the suites star app, nowhas
an improved systemfor managing
paintbrushes. They can be
semantically tagged, and theres a
new, easier-to-use pop-up palette.
Images can nowbe dragged and
dropped into the whole suite from
many more sources, making it easier
to work with, and Calligra now
supports the SVGgraphics format.
Gnome 3.2 will also include a new
version of Gnome Shell.
OpenSUSE 12.1 should be with us
on 11 November.
newsdesk
www.linuxformat.com 10 LXF151 December 2011
M
icrosoft has
announced plans for a
security feature in
Windows 8 that has the potential
to prevent users frominstalling
their own operating systems
including Linux.
Early versions of Windows 8
do away with the established
BIOS > bootloader > OS booting
paradigmin favour of something
called the Unified Extensible
Firmware Interface (UEFI). This
booting systemhas enabled
Microsoft to demonstrate
machines bootingWindows 8 in a
respectable-even-for-Linux eight
seconds, but its the security
options built into UEFI that are
the real difference.
UEFI includes a secure boot
protocol designed to stop
bootloader attacks, where rootkits
or other malware are loaded into
the operating systemat boot
time. Any code loaded at boot
time has to be identified with a
secure key, enabling UEFI to lock
out unauthorised code. Original
Equipment Manufacturers
(OEMs) will have to implement
this feature in order to get their
products Windows 8-certified.
The implications of this for
Linux users are obvious. As there
is no central registry of keys, it will
be up to the PCvendor to
determine which code is and isnt
Your
bootloader
will need to be
rewritten with
a new licence
if its to work
with UEFI.
Windows 8 looks like an improvement on Windows 7 so MS
shouldnt need to use its near-monopoly to lock competitors out.
signed, giving the manufacturers
unprecedented control over what
is installed on your machine.
Predictably, thats not how
Microsoft programmanager Tony
Mangefeste sees it. In a blog post
he said: At the end of the day, the
customer is in control of their PC.
The security that UEFI has to offer
with secure boot means that most
customers will have their systems
protected against bootloader
attacks. For the enthusiast who
wants to run older operating
systems, the option is there to
allowyou to make that decision.
Quite apart from
disingenuously branding Linux an
older operating system,
Mangefeste contradicts histhe
customer is in control sentiment
later in the same blog: Microsoft
supports OEMs having the
flexibility to decide who manages
security certificates and howto
allowcustomers to import and
manage those certificates, and
manage secure boot.
MatthewGarrett, a mobile
Linux developer at Red Hat, hit
the nail on the head with his
response: Theres no indication
that Microsoft will prevent
vendors fromproviding firmware
support for disabling this feature
and running unsigned code.
However, experience indicates
that many firmware vendors and
OEMs are interested in providing only the
minimumof firmware functionality required for
their market. Its almost certainly the case that
some systems will ship with the option of
disabling this. Equally, its almost certainly the
case that some systems wont.
Its probably not worth panicking yet. But its
worth being concerned.
Adoption
MS moves to lock out Linux
Adoptionof securebootingprotocol couldkeepLinuxoff newhardware.
newsdesk
M
icrosoft has agreed a deal with Casio
Computer Co that will give Casios
customers the right to use Linux on
their devices. This seemingly nonsensical piece of
news gives credence to Microsofts assertion that
Linux violates some of its patents.
Financial details were not released, but
Microsoft described the deal in a statement as a
broad, multiyear patent cross-licensing
agreement and said that Microsoft is being
compensated by Casio.
Were pleased to reach an agreement and to
see continued recognition of the value of our
patent portfolio, particularly as it relates to
operating systems, said Microsofts corporate
vice president and deputy general counsel
Horacio Gutierrez.
According to Microsoft, the agreement is
another example of the important role
intellectual property (IP) plays in ensuring a
healthy and vibrant ITecosystem.
We couldnt agree more.
newsbytes
Banshee, our favourite
Mono-based music player,
has reached version number 2.2.
Aside fromthe usual round of
bugfixes it nowsupports a greater
range of devices, including the
Samsung Galaxy Ace, Aperia X2
and Motorola Atrix.
Linux Mint 201109 Debian
edition is available for lovers of
Mint who appreciate rolling updates
and the huge package repositories
that come fromits Debian
parentage. It comes in Gnome and
Xfce flavours and gives Ubuntu-
haters something to feel even more
smug about.
Richard Stallman has been
warning us about non-free
software again, this time in the
pages of The Guardian. He said that
even though the Android phones of
today are considerably less bad
thanApple or Windows
smartphones, they cannot be said
to respect your freedom.
Coders who want to be better
at coding should take a look at
www.playterm.org, a site that
hosts video recordings of terminal
sessions. If you enjoyed the PyGTK
video tutorial we put up on
TuxRadar last year, youll probably
like this too.
Following an attack upon
kernel.orgs servers, Linus
Torvalds has temporarily moved
the kernel source code repository
to Github.
The Linux Counter, a project
that aims to record a realistic
estimate of the number of Linux
users out there, has been
relaunched. It started in 1993, but
not a lot of activity has been going
on for the past four years. Nowa
newmaintainer, Alexander Mieland,
has taken over fromthe project
founder, HaraldTveit Alvestrand, we
expect it to flourish.
Casio pays Microsoft
for right to use Linux
Latest sideshowinbizarrepatent web.
pAtentnonsense
BUsiness
R
ed Hat has announced its financial results
for the second quarter of 2011, revealing a
staggering amount of growth for the
company and, by extension, for Linux.
Profits at the Raleigh, Virginia-based company
were up fromlast quarters $36.8 million to
$56.5 million, with revenue up from$264.8 to
$281.3 million.
JimWhitehurst, president and CEOof Red Hat,
said: We continued to win and strengthen
relationships with enterprise customers who
partner with Red Hat to reduce costs while
modernising their lTinfrastructure to enable
applications to run on bare metal, virtualisation
and in the cloud.
Chief financial officer, Charlie Peters, had a
much simpler analysis of the figures: Were
helping customers save money because they use
our software to replace much more expensive
proprietary software.
The mathematically astute among you will
already have realised that Red Hats revenues for
the first half of the year add up to 546.1 million,
putting it well on course to achieve its target of
making $1 billion in a year fromselling free
software services.
The company is also growing in terms of brains.
Peters said that Red Hat expects to add 600-700
workers, taking its number of employees to about
4,700 worldwide.
Making a bundle
Market for Linuxsupport ishugeandgrowing.
Red Hat has more than quadrupled its value in the past three years. Thats about as successful as
Apple, but without the number of advertorials from the mainstream media.
newsdesk
www.linuxformat.com 12 LXF151 December 2011
Linux user groups
14 LXF151 December 2011 www.linuxformat.com
TheintrepidLes Pounder brings youthelatest communityandLUGnews.
United Linux!
Find and join a LUG
A few groups that have regular meetings:
Bassetlaw(BassetLUG) 19:30, every
Wednesday at Ischus Ltd, Worksop.
http://basset.lug.org.uk
Sheffield (ShefLUG) 14:00, usually on the
first Saturday of the month, location varies.
http://sheflug.org.uk
Birmingham(Birmingham LUG) 19:30,
thirdThursday of the month at Aston Science
Park, Faraday Wharf, Holt Street.
http://sb.lug.org.uk
Tyneside (Tyneside LUG) 12:00, first
Saturday of the month at the Discovery
Museum, Blandford Square, Newcastle
upon Tyne. www.tyneside.lug.org.uk
Hereford (Herefordshire LUG) 19:30,
fourth Wednesday of the month at the Cafe
bar @The Point 4, RNC, Venns Lane, Hereford.
www.herefordshire.lug.org.uk
Surrey (Surrey LUG), 11:00, second
Saturday of the month, location varies.
http://surrey.lug.org.uk
York (YLUG), 19:00, fortnightly, location
varies. http://york.lug.org.uk
Liverpool (LivLUG) 19:00, first Wednesday of
the month. Liverpool Social Centre, Basement,
96 Bold Street. http://liv.lug.org.uk
Find more LUGs online at www.lug.org.uk
A
new, and potentially one-off
Barcamp, hosted in a fantastic
newvenue? Where do I sign
up? Barcamp MediaCity, five years in
the planning, was a fantastic experience
organised by the senior producer at
BBCR&D, Ian Forrester (@cubicgarden
onTwitter).
The Salford Quays venue, kindly
provided by the BBC, was fantastic,
offering space for groups to work, share
ideas, and enjoy a fewconsole games.
The attendees, and the talks
themselves, lenat heavily on software
development and general project
methodologies. Fromstarting up a
business using lean/agile practices, to
Android and iPhone app development,
the technical talks were excellent.
There were some more interactive
talks, a great session where you were
encouraged to pick up an instrument
and make some noise, and an
interesting debate about country music.
While there were some Linux-
powered laptops, it was generally a
Mac-heavy event. We did see Ubuntus
Unity interface dotted around the
screens of a fewlaptops, but it seems
that the Mac still dominates for this
Barcamp MediaCity
Somethingfor everyoneat SalfordQuays.
The BBCs new MediaCity office was
the perfect venue for the Barcamp.
Community news
Lincoln LUG
Becky@bobobex Newborough,
wife of CrunchBang Linux
creator Phil @Corenominal
Newborough, is the newLUG
master for Lincoln LUG.
The first meeting was held on
27 September and the group
welcomes newand old
members to come along and
enjoy a social evening of Linux
and tech-related talk.
So, if youre a local, pop along,
and while youre there you can
file a CrunchBang bug report
direct to the man himself.
http://lincoln.lug.org.
ukMozilla Festival
Mozilla, the firmbehind the
popular Firefox web browser, is
hosting a three-day conference
in London on 46 November.
The website describes it as a
three-day gathering of
passionate, creative people using
the web to reinvent media.
Confirmed attendees include
Jonathan Grey of the Open
Knowledge Foundation;
Ian Forrester of BBCR&D
and Mark Surman of Mozilla.
https://mozillafestival.org
Software FreedomDay 2011
This years annual celebration of
software freedom a global
event thats supported by more
than 100 countries has come
and gone but wed love to hear
what you all got up to and howit
all went lets share our
experiences, so that we can
make next years celebrations
even better.
Drop us a line at lespounder@
gmail.comwith the subject
What our LUGdid for Software
FreedomDay 2011. Thanks.
particular group. Awelcome addition
were the Manchester Girl Geeks in
Residence, offering advice, and hosting
talks in a bid to attract more women to
the male-dominated tech industry.
This event was great, the venue and
hospitality were fantastic, and the range
of talks provided a real wealth of free
information for attendees to tap into.
We only hope its not a one-off, as it
provides a lot, but asks for very little.
Id recommend people try a
barcamp near them. While not a true
Linux event, you can always host a talk
about Linux, and give away a fewCDs to
interested parties. Barcamps give you
the opportunity to debate any subject,
so go on... find one now.
LXF
Join Lincoln LUG for an
evening of tech-related chatter.
P
h
o
t
o
c
r
e
d
i
t
:
w
w
w
.
f
l
i
c
k
r
.
c
o
m
/
p
h
o
t
o
s
/
4
5
7
0
3
6
8
8
@
N
0
7
/
6
1
5
8
1
9
7
5
5
0
/
DISCOUNT FOR
RESELLERS
50%
Mailserver
16 LXF151 December 2011 www.linuxformat.com
Letter of the month!
When Im64-bit
at getting Fedora up and running
I decided to ignore the
PackageKit GUI imploring me to
update immediately, and use the
terminal with a simple yum
update command. That did the
trick, updating PackageKit from
the start, and it was much faster
anyway. I also discovered a
fantastic little graphical program
called Easy Life, which installs a
Write to Grahamat Linux Format, Future Publishing, 30 Monmouth Street, Bath BA1 2BWor lxf.letters@futurenet.co.uk
Right to choose
You are right to insist that the
correct personal choice of Linux
distro depends very much on the
user. As for myself (now, sadly, a
silver surfer), if I were to
recommend to a friend thebest
with which to start it would just
have to be Ubuntu (as long as it
holds on to the Classic Desktop
option!). I cannot remember an
occasion when Ubuntu has
broken completely on me. Its
easy to use and thoroughly
reliable. In contrast, its many
derivatives all seemto me to be
simply poorer versions of the
real thing, and that includes
Linux Mint, which I find to be
terribly cluttered.
In the last year or two Ive
had some very bad experiences
with Fedora failing to load etc
but Ive always been impressed
with the slickness of this OS
when its running as it should.
Recently, I thought Id give
Fedora 15 x64 a try and the first
two attempts were an absolute
disaster. I later discovered that
the main problemis the
PackageKit programand that
itself requires immediate
updating. On my third attempt
Let the looting begin! Er, no, thats not quite right...
host of common non-free
codecs Sun Java, Flash etc in
one go. We all knowthat the
serious computer user needs
such stuff to have a versatile
desktop computer in operation,
however lofty his/her open
source ideals!
The result is that Fedora 15 is
nowmy favourite OS. It really
has that cutting edge software
which Ive read so much about,
but previously proved so elusive.
The lesson, I think, with Linux
is to keep experimenting and
learning. Dont be afraid of the
command line/terminal, its
really only a question of the
amateur user copying and
pasting correct code, and it can
solve a host of problems quickly
and efficiently. Ultimately, such
fearless experimentation can
turn out to be a most rewarding
experience, and sometimes even
make you feel like the most
accomplished geek around!
Oh, and your magazine is
simply wonderful as well
Gerry Robello, Wilmslow
Andrew says: Readers, Gerry is
right. Once youve copied and
I
ll start by saying great
mag I love it and Im
still glad I made the
choice to subscribe. Now,
Imone of those Linux users
who likes to jump between
distros. I did use Ubuntu all the
time but lately I love getting
the coverdisc and seeing
whats new, and I usually make
a total changeover every
couple of months. Imtrying
Fedora 15 right now, (I knowits
a fewmonths old, but I didnt
get round to trying it at the
time) which brings me to my
point: 64-bit. Almost all PCs
made within the past five years
can run it, and I expect the vast
majority of readers either use
it, or should use it to make use
of all of their RAM. Its a pain
that when Ive tried a new
distro and decided that its the
one for me (for now) I have to
go online and download the
x64 version so I can make use
of my PCs capabilities. Now,
Imnot saying you should drop
32-bit coverdiscs in favour of
64-bit; its just a point that Id
like to open to discussion.
Mark Skinner
Grahamsays: Its about
compatibility: a 32-bit distro on
our coverdisc is useful for 100%
of our readers, but if, say, only
10%have machines that dont
support 64-bit, wed be wasting
a lot of discs by going 64-bit
only. Because we care, well stick
with 32-bit for now.
pasted a fewcommands and
realised that the sky isnt going to
fall in, the command line is a fast,
powerful, flexible way to work.
Thats why we orderedJon to
compile all the best tricks and
tips for successful command-line
living known to man, then added
a fewthat have yet to be
discovered by mere mortals. The
results are there for all to see on
page 40 anybody who wants to
make the most of their Linux
machine should read it now.
Whats different?
I picked up your magazine for
the first time at LXF149 and it
impressed me so much that I
decided to subscribe right away.
I like the mix of news,
technical articles and reviews
and it really did keep me busy
for days trying out the bits and
pieces in the tutorial section and
the Coding Academy.
Ive been using Linux for
about a year, in the formof Linux
Mint, but a couple of months
ago I started trying out different
distributions in an attempt to
find the right one for me. Along
Mailserver
Brought to you by
instead of Gnome, or AbiWord
instead of LibreOffice. And, for a
newuser, the mental pain of
installing Gentoo is something
youre better off avoiding.
As you say, the big difference
between distros lies with the
package manager. Its possible to
tinker and customise to your
hearts content, but if theres
already a distro out there that
does what you want, you might as
well save yourself a lot of
compiling software and config file
fiddling and just take advantage of
the work that somebody else has
already done for you.
the way Ive come to a bit of a
realisation, but Im not sure
whether Im missing something?
I think that it doesnt really
matter which distribution you
choose, because it looks to me
like you can basically do
anything you might want to do
with any of them; all Linux
software will run with any
distribution, you seem to be able
to run any window manager you
like with any distribution, you
can customise any distribution
to look and behave any way you
like. The only differences Ive
really been able to find between
any of the distributions are the
package managers and
repositories and the release and
support cycles.
Are there any real
differences between the
different flavours of Linux? If
not, then why do people choose
one distribution over another?
The one distribution that
does pique my interest is Gentoo
is the pain of installing it really
worth the performance
enhancement I might get from
having software compiled
specifically for my system?
Im keen to find the right
distribution for me, but the more
I research, and the more
distributions I try out, the less
important I think it is. If Im
really missing something and
there are good reasons to
choose one distribution over
another, then can I suggest that
we have an article explaining the
differences, and maybe a handy
distribution chooser flowchart or
something for those of us who
are not sure where to start?
Chris Robinson
(or Confused, Durham)
Andrew says: For your own safety,
put down the Gentoo disc and
back away slowly with your hands
in the air. Its true that having a
distro thats compiled against your
own specific hardware (as is the
case with a Gentoo installation)
does offer some speed
advantages, but these are
negligible compared with the
benefits of, for example, usingXfce
Password entropy
Regarding Bob Mosss password
choice advice in LXF150; please
see xkcd.com/936/. (BTW
great mag.)
Paul Rees
Andrew says: Along with Frontier:
Elite II, XKCDis responsible for
70%of all wasted time at LXF
Towers. Thanks to you, we can
pretend were learning something.
Plea for help
I used to be a deskside engineer
for the BG group, but two years
ago I suffered a couple of
strokes and have been
struggling to recover ever since.
In the course of my recovery, I
joined a nearby stroke group in
Wokingham. These folks have
helped a great deal, now it
behoves me to pay something
back. One of the symptoms I
suffered was aphasia; in my case
it was mild but there is a woman
in our group who can only say
yes for everything. Ive
accepted the challenge of
creating an electronic Gentoo: its not for newbies.
Mailserver
18 LXF151 December 2011 www.linuxformat.com
communication book for her to
use to communicate. This is
doubly challenging as she has
also lost the ability to read and
write. What she needs is a book
with pictures for her to select
and gather as a sentence, that
will be read out loud when she
submits it. This would be a great
tool that would be of much use
to others in the same situation.
The problemis that I havent
retained much of my knowledge
of programming and HTML work.
Although I will relearn most of it
in time, it will not be of any help
at the moment, so if there is a
hacker out there who would be
willing to help on this project
would you please get in touch.
John Morton
Andrew says: Theres plenty of
text-to-speech software on Linux,
but this idea sounds completely
newto me. Readers, get in touch
with us if you can help and well
pass your details on toJohn.
shane_collinge@yahoo.com
Sometimes we get things wrong
Somefinn wrong
I have to ask if the usually high standards of
Linux Format are starting to slip.
The itemin LXF150 headedFinnish city
moves to Linux relates to the town of
Kankaanp.
The photograph used to illustrate the
article is very clearly a picture of Helsinki. The
location is the harbour area at Kauppatori and
the large white building dominating the
skyline in the image is the Lutheran Cathedral
(Helsingin TuomioKirkko) on
Aleksanterinkatu. Kankaanp is
approximately 270 miles NNWof Helsinki.
Brett Wing
Andrew says: Ah, er, cough, ahem, nice weather
isnt it? Of course, as citizens of the world were
intimately familiar with the Satakunta province,
lying as it does between Helsinki and
Ostrobothnia, which is one of two regions of
Finland in which a majority of the population speak
Swedish, like what Linus Torvalds does.
Disc error
Firstly, thanks for making such a great
magazine! I eagerly await each newissue of
Linux Format. Also, congratulations for your
150th issue!
The only problemI found, was that I
couldnt locate the commands required to
update the various files for the Ubuntu
customisation tutorial. The article said they
would be on the coverdisc, however I cannot
find them!
Ave, a friend.
Mike says: Ah, er, cough, ahem, nice weather
isnt it? But sorry about that: youll find the full
commands here: www.linuxformat.com/
forums/viewtopic.php?t=14130. Theyre also
in the Magazine/Ubuntu section of this issues
disc, for when you fancy trying it out in an
internet-deprived environment.
Eye of newt
The latest edition of Linux
Format (LXF150) has a little
enquiry on the letters page as to
howmany people tried Caldera.
It was my introduction to Linux,
and if I may say so, quite an
introduction!
I have attached a scan of the
opening page of the instruction
manual, subsequent pages
reveal the difficulty of the
installation, including the need
to produce two floppies using
Rawrite. The installation taxed
my brains, which were further
taxed trying, successfully, to
install Corels Word Perfect.
Happy days; I learned a lot
about Linux, which has stood me
in good stead with our modern
distroswelcome to the
command line!
James Baldwin
Andrew says: The more we break
things today, the more we train
ourselves to fix things in the
Our design monkeys colleagues sometimes
struggle to find relevant imagery.
future. If you were messing about
with Caldera in the days of
floppies, you must be able to fix
just about anything by nowsir, and
we tip our collective hat.
and wing of bat
Every time I see the instructions
for installing a distro alongside
Windows, I have a little chuckle
to myself as there is a much
easier way which is much more
versatile too.
I use BootIt Bare Metal from
Terabyte Unlimited. This amazing
piece of software allows for the
creation of more than 200
primary partitions on a hard disk.
I currently have Windows 7 32-bit,
Windows 7 64-bit, Vista 64-bit,
Windows XP, SUSE 11.4, Linux
Mint 10 KDE, Linux Mint 10 and
Linux Mint 11 installed. All installs
are into primary partitions. I did
hear somewhere that there was a
bug relating to installing a
particular distros boot manager
into the root of a partition within
an extended partition.
Basically, one creates the
partitions for a particular OS
and one can make all other
existing partitions invisible for
The Complete Idiots Guide to
Linux sounds like something we
should get hold of.
Mailserver
www.tuxradar.com December 2011 LXF151 19
Linux Format Mailserver
is sponsored by
Fasthosts Internet,
www.fasthosts.co.uk, a leading UKweb hosting
provider. Since 1999, Fasthosts has been at the
forefront of server technology. It recently launched
the brand newDS910 dedicated server offering an
impressive 2 x 2000GBhard disk space and 12GB
RAM. With 2.8GHz Intel Quad Core CPU, and RAID1
protection, the server is ideal for storage and
managing large-scale databases and web apps
securely. With advanced monitoring, unlimited
bandwidth and UKsupport 24/7, Fasthosts offers a
power-user unrivalled performance, quality and
great value. More details at www.fasthosts.co.uk.
the install (VERYimportant with
Windows installs*, more a
convenience with a Linux one).
One can make other partitions
(to a max of four per disk) visible
to the OS at will. Give it a
mention, its brilliant.
*They will spray their files
everywhere if they can see a
larger NTFS partition somewhere
or another Windows partition.
Guy
Andrew says: The limit of four
primary partitions on a hard drive
hasnt bothered us much since
LVMgot easy to use, and before
then we got our distro-hopping
kicks by using virtualisation
VirtualBox is a favourite here
because its so easy to use. More
than 200 primary partitions
sounds fantastic though, and as
hard drives get bigger theres
bound to be more of a call for this
sort of technology, but I cant
shake the feeling that there
should be a way to do it without
spending $39.95.
Set in stone
Sorry this is a bit childishbut
heres a hideous replica
glimpsed in the stonemasons
yard at York Minster.
Paul Holman
Andrew says: This reminds me of
the competition Blue Peter ran to
design a ceiling boss for York
Minster after it was damaged in
the fire of 1984. Thank heavens
Linux hadnt taken off by then, or
northern Europes largest Gothic
construction might have been
adorned with a fat little penguin.
Subsonic boon
Was it just a coincidence that
you had two articles covering
the same topic fromdifferent
angles in the recent edition? Im
talking about the article about
MPDand the cloud computing
feature, which had a section
about music streaming.
I tried MPDfirst, and though
it appears to be a powerful and
well-supported tool I found it
frustrating. None of the clients I
could find could do
simultaneous streaming as well
as controlling the server. So I
had to use Mplayer or VLC to
play the streamseparately. But
the server was not listening on
the HTTP port until the stream
was actually playing, so to listen
to a track you have to tell the
client to play it, then switch over
to your media player, start it
going and miss the first few
seconds of playback.
The HTTP port dies when you
hit Pause, which is annoying. In
the same edition, in the cloud
computing feature you
mentioned Subsonic, so I gave it
a go. I LOVE Subsonic. It does
everything I would want froma
music streamer and more, and
without the frustrations that
MPDgave me.
Software freedomis all about
choice. Ive made mine. MPD has
been apt-get purged.
Philip Ward, Stirling
Jon says: Like you say, software
freedomis all (well, at least in
part) about choice. Ive noticed
the same annoyance when
streaming over HTTP, but never
really gave it any thought maybe
its time I took a look at Subsonic
as well? Before giving up on MPD
completely, however, Imgoing to
look in to some of PulseAudios
more advanced configurations,
since it can streamover a network,
and theres also the Icecast
support to consider so much
choice. Whatever I end up doing,
Imglad youve found a solution
that works for you.
Store flaws
Let me relate a story where it
becomes apparent that
community support is better
than the type you get in a shop. I
bought a Samsung Galaxy S
last year and it developed a
fault. The phone was sent away
for repair and they said it was
water damaged.
This turned out to be a
fabrication when I found out
later that the bootloader had
become corrupt. The phone
couldnt get past the bootloader
and I was told the phonewill
never work again.
Not willing to give up, I asked
on various forums if anyone else
had these issues. Someone
directed me towards Heimdall
and heimdall-frontend and gave
me a link to the Android 2.3.4
ROM(Stock) which I flashed on
to my phone my phone worked
again, and it still does.
I also recently bought an
Asus Transformer, which I have
to say is a magnificent piece of
kit, and while its Wi-Fi only, with
my Galaxy S working as a Wi-Fi
hotspot through a program
called Barnacle Wifi Tether, the
point becomes moot.
Keep up the great work.
John Dwyer
Mike says: The people in the shop
were trying to make you spend
more money. The people in the
community were trying to help.
Thats why we love Linux.
LXF
Weve seen Ubuntu Chardonnay and Ubuntu cola, now weve got
Actually, what is this supposed to be?
*20% of Simplifydigital customers received an average saving of 408. Data based on 1,538 records between 1st of Jan 2010 to 8th Nov 2010. ** Out of 445 consultations between 01/01/2010 and 03/05/2010, 368 Simplifydigital customers saved
money by signing up to our recommended deal. Lowest Price Guarantee Terms and Conditions apply see www.simplifydigital.co.uk/lowest-price-guarantee for full details. Standard SMS network charges apply.
1
2
3
Call free and speak to our London based
impartial experts.
We reviewover 6,000 deals fromthe top UK
providers to fnd the right one for you - with
our Lowest Price Guarantee.
Our experts do the hard work, answer your
questions and even arrange your installation!
One quick call.
Thousands of deals.
0800 466 1053
Or text DEAL to 81400 and well call you
www.techradarstores.co.uk/digitalsave
Call us free andwell dothe hardwork!
Monday-Friday 8am-8pm, Saturday 9am-5.30pm, Sunday 10am-5.30pm
S
a
v
e
u
p
to

4
0
8
*
p
e
r
y
e
a
r
8
3
%
of our
custom
ers
s
a
v
e
**
Slashyour TV,
internet &
phone bills!
Let us do the hard work!
Were proud to be the only service to be
accredited by Ofcomfor TV, broadband
and home phone comparison
www.tuxradar.com December 2011 LXF151 21
Work smarter
Gameplay 10/10
Graphics 10/10
Longevity 9/10
Value for money 10/10
Braid
Even if you dont think you like
platformers or puzzlers, Braids charm
and intricacy will drag you in.
Rating 10/10
Verdict
Developer: Number None
Web: www.braid-game.com
Price: $9.99 (approx 6.15)
P
ublic transport may not be
perfect, but you dont expect
to see a typo on a bus ticket.
Thats the unusual situation I found
myself in recently. What made it
odder was that my travelling
companion had a ticket to the same
place; but the destination on her
ticket was spelled correctly.
There was only one explanation:
the chap in the bus station was
writing out the information via the
keyboard in front of him, for me and
for the rest of the queue snaking out
of the bus station.
Tech fail
What a waste. Awaste of time for
me and my fellowtravellers, and a
waste of technology. The computer
attached to the printer wasnt
special, but a little bit of code could
create a piece of software to
automate the ticketing process, so
rather than manually typing (for
example) Agios Nikolaos, the cashier
could click on a button on the
screen. Thats what technology is
supposed to be for: its supposed to
make work quicker and easier for us,
so we can spend more time playing
with our jetpacks and flying cars.
Minoan Lines, jaccuse you
wasted your money and my time.
But the Greek bus company is not
alone. Organisations buy technology
without even thinking about what
they need it to do all the time,
blindly, because theyve been told
that computers are essential.
Programmers solve problems;
middle managers create them. But
at least with Linux, we dont have to
pay an armand leg for them.
andrew.gregory@futurenet.com
ANDREWGREGORY
wants the IMF to bail
out his student loan,
or he may have to pay
it back in buttons.
Our pickof this months releases:
Get inside your PC and take her to heaven and
back. Or crash before youve taken off
Mandriva is now under new ownership but
is this Russian revolution more 1917 or 1991?
Our verdict explained
All the products that
we revieware rated
from0 to 10, with 10
being highest. The
categories we use to
rate products are
usually features,
performance, ease of
use and value for
money, but software available
without a charge might be rated
on documentation instead of
value for money. Regardless of
the four criteria used, we always
give an overall score out of ten.
Products that stand out fromthe
crowd may receive
our prestigious Top
Stuff award. Only
the best is
considered for this
award scoring
highly isnt enough
by itself.
When reviewing
free software, we will usually use
the recommended distribution
of the software. In some cases
this will be hand compilation
using GCC, but if the developers
recommendAutopackages these
will be used instead.
All the latest software and hardware reviewed and rated by our experts
Book reviews p36 Mandriva 2011....... 22
Every distro under the sun wants to
claimprettiness as one of its
features these days, but there was a
time when only Mandrake Linux
gave a stuff about ease of use. So
howdoes the spiritual father of
Ubuntu look nowthat its just one
among many newbie-friendly Linux
distributions?
FlightGear 2.4........ 25
Pip pip, tally-ho and chocks away
with the premier flight simulator
for Linux you can meet high-speed
crashes with a cheery smile and
spend more time in the air than a
member of the womens auxiliary
balloon corps. Strap in and enjoy
the view.
Qt Creator 2.3 .........27
Free software projects that get a
10/10 for documentation are like
hens teeth made out of gold dust.
Thats why, if you like to mess about
with KDE and you need a newIDE,
you need to try Qt Creator.
RawTherapee 3...... 29
Photography is complicated, and if
youre going to bolster your geek
credentials by fiddling with obscure
settings, youll need a suitably
complex tool for the job. Hello,
RawTherapee!
Books..................... 36
This month weve learned about
Python algorithms and free software
image processing.
Mandriva 2011 p22 FlightGear 2.4 p25
Reviews Distribution
22 LXF151 December 2011 www.linuxformat.com
In brief...
AKDE-based
Linux distro aimed
at beginners. See
also: PCLinuxOS
and Kubuntu.
unveil any swanky newfeatures to
take on rivals such as Ubuntu, Fedora
and OpenSUSE.
So, whats changed and can
Mandriva nowstart to make some
headway? The good news is that 2011.0
introduces some cool newfeatures that
indicate the distribution is still in active
development, and that future releases
will be very promising indeed.
The bad news, though, is that a lot of
features that attract newusers to
distributions, such as app store-style
I
ts been a tough couple of years for
Mandriva, with a lot of uncertainty
about its future. The rising
popularity of other mainstreamdistros
and flagging sales of Mandriva
Powerpack (thepremium version that
used to bundle commercial software)
brought it close to bankruptcy.
Many prominent members of the
sizeable and active Mandriva
community decided to fork their own
reactionary version of the distribution,
after becoming disgruntled with the
companys decisions with recent
releases, and growing concern from
the Linux world that the distribution
could disappear if the company
collapsed. (For an insight in to how
Mandriva is doing now, turn to page 56.)
Thankfully, Mandriva was saved
fromimminent failure after a corporate
buyout, though the development was
bittersweet as the company went on to
shed a large number of talented staff.
Frankly, it came as no surprise that it
missed a release or two in 2009, and
when we reviewed Mandriva 2010
Spring in LXF136, it was equally
unsurprising that Mandriva didnt
package managers, are still under
heavy development and simply arent
ready for prime-time. As you wade
through the documentation and the
company website youll also see the
wordexperimental used a lot more
liberally than normal, and a newbug-
reporting app running by default on
desktop systems.
This isnt necessarily a bad thing,
though. We said a year ago that the
one thing missing fromMandriva
releases was clever newideas and
Has achangeof ownershipsavedMandrivaor shouldwerelyonthe
communityfork?Bob Mossfinds out what adifferenceayear makes.
Mandriva 2011.0
The good news is that
2011.0 introduces some
cool new features.
Look familiar? Mandrivas superb control centre is still very much with us.
Simple Start
If your grandmother cant make use of the
first pane of the Simple Start menu, well eat
our own feet.
Dolphin le manager
The simplified Dolphin file manager will no
doubt upset power users, but could be a boon
for newbies.
Get organised
Quickly and easily snap up your files and
downloads from the taskbar.
Features at a glance
Distribution Reviews
www.tuxradar.com December 2011 LXF151 23
Features 8/10
Performance 9/10
Ease of use 8/10
Documentation 8/10
Mandriva 2011.0
This newbie-focused distro still
needs work but its great to see it
moving in the right direction.
Rating 8/10
Verdict
Developer: Mandriva
Web: www.mandriva.com
Price: Various free and non-free
Mandriva vs Mageia
Mandriva lets you set everything up
just the way you like it.
It lacks the polish
weve grown to expect
from rival systems.
better cater for Mandrivas traditionally
newbie audience.
However, 2011.0 isnt simply about
user interface improvements. As with
other major distributions Mandriva has
made the switch fromOpenOffice.org
(no longer in active development by
Oracle) to LibreOffice and nowuses
Shotwell as its default photo manager.
The Linux kernel, Firefox and X.org
versions were a little behind
mainstreamrivals at the time of writing.
Something that every user may be
able to benefit fromhowever is
MandrivaSync, a cloud service that
provides users with free cloud storage
space to sync files between Mandriva
machines (in a not dissimilar fashion to
Ubuntu One).
Beyond the technical improvements,
Mandriva is also adopting a new
business strategy. As mentioned, sales
of Mandriva PowerPack and Mandriva
InstantOn were struggling because end
users simply didnt purchase either
product in any great quantity.
The focus nowis on the more
lucrative enterprise market with the
promotion of a server distribution and
bespoke network management tools.
This initially seems like a very
shrewd move when you consider
Linuxs relative success in this arena,
but its also important to bear in mind
that this market is already heavily
dominated by Novell, Red Hat and
Debian. All have much better
integration with Microsoft-centric
services such as ActiveDirectory and
Exchange, in both their server and
desktop editions, which are also
innovations, and its great to see that
the project is trying newthings and
being every bit as ambitious as it was
before its recent turmoil.
Despite this, we do still want a new
Mandriva package manager thats
stable enough to be bundled with the
distribution; 2011.0 feels distinctly
unfinished without it, and its inclusion
would go a long way towards
increasing support fromboth
developers and end users.
Radical change
The most immediate change youll
notice when you first try to install
Mandriva is that it comes with a brand
newgraphical installer. Its still not
quite as polished as installers fromthe
likes of Ubuntu and OpenSUSE but its
a vast improvement on previous
efforts, which tended to be a little
clunky and complicated.
Once your Mandriva systemis
installed, youll notice a large number of
changes that have been made to KDE 4
to make Mandriva more friendly. The
newSimple Start menu clearly takes
more than a little inspiration from
Gnome Shell and Ubuntus Unity
interface and is an improvement on the
KDE 4 launcher tweaks weve seen in
previous releases.
One thing you shouldnt miss is the
Timeline option on this same menu.
This is actually Nepomuk cunningly
hidden behind an attractive interface.
The timeline also groups documents
and media together in a visual way so
documents youve created are just a
fewclicks away.
Further enhancements to the
taskbar include a general reshuffling of
icons, and newfolding drawers for your
documents and downloads folder
towards the bottom-right of the
screen. The developers have also
simplified the Dolphin interface to
important elements in the minds of
network administrators. Mandrivas
enterprise software, then, could be a
tough sell, but we wait with bated
breath to see howit turns out. Of
course, if all else fails, they could just
resort to selling USBpen drives and
commercial Linux software...
Future promise
Theres a lot to like about Mandriva
2011.0. The user interface has been
tweaked and simplified, documentation
and supporting services have continued
to improve and clever ideas such as
Timeline make it well worth
experimenting with at the very least
by enthusiasts with virtual machines.
If youre a dedicated Mandriva fan
who has stuck with the distro through
thick and thin, this is certainly worth the
upgrade (if youre not too attached to
older tools). Newusers will also feel at
home with the systemdespite some of
its odder quirks.
However, there are still important
elements under development, which
means that it lacks the polish weve
grown to expect fromrival systems.
This, then, is perhaps best viewed as an
interimproduct. We eagerly await the
release that pulls all these newideas
and features into one neat solution that
finally starts to deliver.
LXF
Youll typically hear Mandriva and
Mageia mentioned in the same
breath because while the turmoil
weve already mentioned
engulfed the Mandriva project,
the key contributors were far
fromidle.
When the very existence of
Mandriva (a well-supported and
beloved distro) was threatened,
they opted to fork it into a new
project free fromcompany
control and therefore unlikely to
experience the same issues or
take a sudden change in
direction. This is called Mageia,
which, by the time you read this,
may well have already produced
its second release.
So, howdo the two compare?
Well, if you place themside-by-
side, the most noticeable
difference is that Mageia (at the
time of writing) seems to stick a
little closer to the core KDE 4
desktop, while Mandriva has
heavily customised it. For the
time being, Mandriva also better
supports the latest software
packages and kernel, although
this may change if the Mageia
project increases the frequency
of its releases.
For all intents and purposes
they both use the same
codebase and the differences are
mostly cosmetic, so if you find
that one supports all of your
hardware but you dislike the
interface, it may be worth giving
the other a go to see if it better
suits your needs.
Games Reviews
www.tuxradar.com December 2011 LXF151 25
In brief...
Adetailed flight
simulator with
virtual cockpits
and multiple
aircraft. See also:
X-Plane.
Buildings and cities have been
somewhat improved, but you shouldnt
expect much in the way of scenery.
Elevation and formation are pretty
accurate if Terrainsync is working
properly; we found ourselves in some
particularly flat, featureless locations
when attempting to start somewhere
more out of the way. Even in properly
rendered locations the land is sparsely
embellished and your interaction with it
still rudimentary at best. Go nose first
into the ground next to one of the
newly-metallic objects and youll still
end up jabbed into the blurry grass like
a well-aimed lawn dart. But the ground
is where youll spend the least of your
time if youre lucky or skilled. Water
texturing and reflection is nowmuch
more realistic, and the 3Dcloud model
is as brilliant as ever, so its clear that
FlightGear is detailed where it matters.
Plenty more has been done besides.
The community has contributed new
planes, including SecondWorldWar
fighters and popular light aircraft,
adding to the 200 or so available at
www.flightgear.org/download/
aircraft-v2-4. The AI pilots are now
much more clever, following more
realistic flight paths and communicating
with each other and air traffic control.
F
lightGear isnt a game. Its a way
of life. Its a hobby, an education,
a job. Want to take off in a Cessna
jet? Set your throttle rendered in the
full 3Dcockpit to idle. Then flick the
switch on the batteries, generators,
avionics, and both left and right
ignitions. Hit the starter on each engine
and watch themspool up to speed, then
switch on anti-collision, your navigation
lights, and your taxi light. If you want,
you can switch the seatbelt light on, or
radio the tower. And you probably
should have checked the weather, too: if
its foggy or raining you could be in
trouble. Only once youve done all these
things can you set your flaps, release the
parking brake, and trundle along the
runway bouncing fruitlessly until you
inadvertently bash into a building and
have to do it all again.
Chocks away!
This latest update, 2.4.0, includes some
rather cool additions if you can get your
head around them. The weather model,
in particular, is much improved. It still
pulls in current weather data, or
supports detailed customconditions,
but nowprocesses the data according
to real world physics, meaning youll
experience all the transitionary effects
between weather boundaries. This
means cold fronts, thermals, and even
the unusual cloud formations often
found around mountains and other
terrain. Essentially, even more excuses
as to why youve sent your virtual
passengers screaming to their doom.
Support has even been added for
external devices such as real Garmin
GPS modules and separate screens,
which ties in with the new2Dpanel-
rendering options to make it easier to
use FlightGear in a more complex flight
simconfiguration. And thats where it
really belongs: FlightGear is a
complicated, exhaustively detailed sim
which is about as good as youll ever get
froma free community generated
project. Yes, there are graphical bugs.
Yes, its quirky. But somehowit feels just
right. By which we mean impossibly
difficult. Pull up! Pull up!
LXF
Alex Coxclips onhis epaulettes, downs aquickwhiskey, andstraps himself
intothecockpit for thelatest instalment of this classicindieflight sim.
FlightGear 2.4.0
FlightGears cockpits are detailed, well modelled, and interactive youll be
looking at your instruments more than the scenery.
Features 7/10
Performance 6/10
Ease of use 9/10
Documentation 9/10
FlightGear 2.4.0
Not a massive leap forward, but the
intricate little details make this update
worth checking out.
Rating 8/10
Verdict
Developer: FlightGear Team
Web: www.flightgear.org
Price: Free under GPL
Make the world
In the UFO, you can scatter
objects over the ground,
creating your own scenic
locations...
Features at a glance
See the world
...or check out the games
second skybox, which
takes you all the way to
the edge of space.
Theworldsgreatestgadgetmagazine,
whereverandwheneveryouwant.
The latest issue of T3 magazine is available nowat iTunes, Zinio or at all good newsagents.
www.t3.com
Availableinprint, online,
onmobileandiPad
Development environment Reviews
www.tuxradar.com December 2011 LXF151 27
In brief...
An integrated
development
environment built
specifically for
working with the
Qt toolkit.
KDevelop is its
closest competitor.
Alter thex andy coordinates in the
edit view, for instance, and when you
switch back to the designer, the widget
will already have moved. This makes the
designer feel like a first-class part of the
development environment, and gives
developers a very good reason to create
prototypes in Quick rather than work
with the now-clunky C++ interface.
Version 2.3 might even make rewriting a
prototype unnecessary, as theres
added support for views, models and
delegates. The idea of adding mockup
data to populate your applications while
building themis another winner.
But if you havent yet jumped on the
Quick bandwagon, you havent been
neglected either. There are plenty of
refinements to both the project
management and the editing windows
to make the upgrade worthwhile.
For pedantic coders, indentation
styles can be defined per-project and
globally for classes, methods, blocks
and namespaces, as well as indent
braces. This should help you generate
code that looks identical to code from
your Emacs-loving friends.
Profiling has moved froma main-
windowpanel to having its own icon in
the quick launch bar on the left, adding
support for QMLprofiler for Quick
applications at the same time, and you
N
okias Qt teamhave defied
expectation over the past six
months, and delivered one
update after another to the all-powerful
Qt toolkit, despite its relegation from
the first division of Nokias smartphone
strategy after it announced a move to
Windows Phone.
Qt Creator, Qts own graphical
development environment is at the
head of that progress, and version 2.3
is a major update. After installation, its
easy to see where all this renewed effort
is being made its in the JavaScript-
like application generation platformthe
Qt teamcalls Quick. Quick projects are
the first to appear in the application
wizard, and since version 2.2, the UI
creation element in the IDE has been
overhauled to include support for Quick
applications. but this isnt the same old
Qt Designer application that was bolted
into the old Creator. This is a newGUI
designer built specifically for Quick
projects, complete with a WYSIWYG
graphical editing panel, and it feels
much better integrated as a result.
Get what you see
Create an image element, assign a
picture and press Play. Afewmoments
later youll see your newapplication, and
what you see in the main windowis
exactly what you see in the designer. You
can edit the QMLcode in-place in the
same way, and any changes you make
to the background code are
immediately reflected in the UI designer.
can nowincorporate your own remote
Linux device into the toolchain with the
addition of an SFTP-based transport
function. These are all refinements that
give you fewer reasons to leave the
main application.
Our only real criticismis that while
we do like the design of the application
window, its very difficult to create a
minimal layout that works on a netbook
or within a small resolution. But we
wouldnt want to sacrifice the clear
layout if it meant Creator becoming
more like Eclipse. Because its this ease,
integration and design that makes
Creator such a joy to use.
LXF
Amajor IDEupdatetothedevelopment environment gives
GrahamMorrisononeless excusefor resurrectingKAlbum.
Qt Creator 2.3
Context-sensitive help, Valgrind optimisation, utility output and design
elements have all been rolled into the single application window.
Features 9/10
Performance 8/10
Ease of use 7/10
Documentation 10/10
Qt Creator 2.3
Still the best integrated development
environment for Qt apps, because its
the only one that feels integrated.
Rating 9/10
Verdict
Developer: Qt Development Frameworks
Web: http://qt.nokia.com
License: LGPL
Tab Style
Theres super-
comprehensive control over
how indentation is handled
within your code.
Features at a glance
QML designer
The graphical designer
is the best reason to
ditch C++ and try out
writing apps with Quick.
RAW converter Reviews
www.tuxradar.com December 2011 LXF151 29
In brief...
Anon-destructive
image editor for
processing
camera RAWfiles.
See also Bibble,
Digikamand
Darktable.
have been removed since the first few
alphas. And they want you to learn: the
handbook should be required reading
for all photographers, and most of the
controls are self-explanatory, too. But
as you move to the right of the tool tabs
and away fromthe relative safety of
Exposure and Colour settings, it quickly
gets daunting.
In Detail, for example, there are
three ways to apply noise reduction. By
the time you get to the RAWtab theres
an option for Green Equilibration, for
heavens sake. Set Linear Correction
Factor to five and prepare to enter the
Dark Frame Panel. What?
Rise to the challenge
This is not a criticismper se. Its like
kernel hacking for photos: if you want
all this stuff, RT3 has it, and thats good.
But what its missing is easy
automation of things such as lens
distortion or green equilibration (which
is to do with adjusting for certain
brands of sensor filter) if you want it.
Other tools including open source
ones have introduced themrecently
and its essential if you own one of the
newbreed of mirrorless SLRs.
And its a shame that Rawtherapee
will scare some people off, because its
capable of great results. Its just as good
as proprietary software when it comes
to results, and the highlight recovery
tool is one of the best fromany
software house.
D
igital photography is about
convenience. Anyone can shoot
a decent photo and have it up
on Flickr in seconds. But for a certain
class of photographer, the underlying
complexities of digital capture and
processing are an obsession. Having
the power to infinitely tweak the look of
an image can be wonderfully liberating:
but it can also make us a little neurotic.
If youre the kind of photographer
wholl stare at a portrait and spot just a
fraction too much sharpening, a trace
of demosaicing or a lack of contrast in a
three-pixel-wide crows foot, you should
probably stay away fromRawTherapee.
Itll make your head explode.
Commercial camera RAWtools such
as Adobe Lightroomand Bibble have
spent the past three or fours years
learning to hide their complexity, get
great results fast and thus speed up
professional workflows. RawTherapee
has spent the same amount of time
finding new, arcane features it can open
up for abuse.
Superficially, RT3 shares a similar
layout with all RAWtools. Its weaker on
asset management as theres no
library support, but you could do 90%
of your photo sorting and developing
fromwithin RT3 if you wanted.
All edits and effects are applied as
anXMLlist during processing, so the
original picture itself is never touched,
and it boasts full colour management
among its huge list of pro features.
On top of all of this, RT3 is fast, too.
Its not quite as quick as Bibble, but its
speedier and more responsive than
Digikams RAWeditor.
But that complexity. Its
overwhelming. Every possible variable
and setting involved in turning RAW
data into a photo is exposed, including
many you probably shouldnt touch
without supervision. To be fair to the
team, certain features notably the
multiple levels of contrast sharpening
The problem, though, is that if a shot
isnt easy to tune, it gives you a hundred
ways to make it worse. While the noise
reduction tools are incredible, in the
wrong hands they end up fighting each
other and then taking on the various
sharpening methods at the same time.
If youre going to use RT3 a lot, in
other words, youll have to spend a lot
of time working out which tools youre
most comfortable with, and then stick
with them. What it really needs is plugin
support, so that those who want to
delve deep can do so, then simplify their
access with everyone else.
Those who have the time and
patience to do that will love it: if you see
it as time you could be spending taking
more shots, you wont.
LXF
Thecameramaynot lie, but it canbeobstinatewiththetruth. AdamOxford
discovers themost terrifyingwaytotortureimages intoconfession.
RawTherapee 3.0
In the wrong hands,
the tools just end up
fighting each other.
New skins are a big feature, although the classic dark grey is best if you want
to edit accurately its boring, so its less distracting to the eye.
Features 10/10
Performance 8/10
Ease of use 6/10
Documentation 9/10
RawTherapee 3.0.1.3
Complex, infuriating and capable of
doing as much harm as good but
RT3 will eventually win you over.
Rating 8/10
Verdict
Developer: Gbor Horvth/
The RawTherapee project
Web: rawtherapee.com
Price: Free under GPL
Roundup Email clients
30 LXF151 December 2011 www.linuxformat.com
T
he email client, along with
the word processor, is
probably one of the most
recognisable pieces of
software on the desktop. They come in
all shapes and sizes, fromstandalone
lightweight command-line clients, to
massive personal information
managers (PIMs), that do a lot more
than just check email.
Email clients are especially
important for the business user but are
useful even for those not dependant on
a corporate email server. Virtually all
email clients can nowhook up with
Every month we compare tons
of stuff so you dont have to!
Roundup
Howwe tested...
online webmail services such as Gmail
andYahoo Mail. Even if you dont use
themto check your email on a daily
basis, theyre handy to keep an offline
backup of all your email in case of
problems with the service.
There are various factors you need
to consider when selecting a client.
What type of user you are and howyou
want to use it are the most critical. If
youre an enterprise user fetching email
fromthe corporate email server, youll
probably have the client running all the
time, so it needs to be well-integrated
into the desktop. If youre a home user,
though, who only wants to back up
email froman online service, your
demands are very different.
Email clients
We ran all the email clients on a
2.1GHz dual-core laptop with 2GBof
RAM. While they all work across
distributions, for best results we ran
themon their recommended
platforms. That is, KMail atop KDE
and Evolution under Gnome.
For a fair comparison, we used the
latest offerings of each of the clients.
KMail 4.7, released as part of KDE
SC4.7 was installed on OpenSUSE
11.4. The latest version of Evolution
3.0.2 requires libraries shipped with
Gnome 3, and so we installed it on
top of Fedora 15, which also hosts
our Thunderbird and Claws Mail
installation. Zimbra Desktop creates
desktop icons, which have no place
in Gnome 3, so we installed it on
Ubuntu 11.04.
An email client should, at the very
least, be able to handle thousands of
emails without a drop in
performance, compose messages
offline, and be secure just some of
the features were scoring on.
They come in all shapes and
sizes, from small command-line
clients to massive PIMs.
Our
selection
Evolution
KMail
Thunderbird
Claws Mail
Zimbra Desktop
Shashank Sharmagathers fivecontenders anddelivers his verdict.
Thunderbird 6.0
Evolution 3.0
Email clients Roundup
www.tuxradar.com December 2011 LXF151 31
Evolution
KMail
Thunderbird
Claws Mail
Zimbra
A photo-finish
between
Thunderbird
and Evolution.
Verdict
Evolution
KMail
Thunderbird
Claws Mail
Zimbra
Thunderbird
needs to provide
better importing
support.
Verdict
A
lmost all the clients covered
here are cross-platformand
can run on any distribution.
While its good to have a choice, all
distributions and desktops ship with a
default email client, so Gnome has
Evolution and KDE has KMail.
Traditionally, this also meant that
Evolution was the default on Fedora and
Ubuntu and KMail on OpenSUSE and
Mandriva, among others. But the latest
releases of these distributions,
desktops and email clients has changed
the situation somewhat.
Since Evolution nowrequires Gnome
3 libraries, Ubuntu will switch to
Thunderbird as its default email client
with the 11.10 release. KMail is one of
the weakest clients in our selection, and
we arent the only ones who think so; in
the latest Mandriva release its also
been replaced by Thunderbird.
Using the default client does have
obvious advantages. For example, in
Gnome, you can right-click on a file in
the Nautilus file manager, select Send
To and specify email, to email the file as
an attachment to a message. This
M
ost home users will want to
hook up their email client with
one of the popular webmail
services. When configuring your
account, you need the SMTPand IMAP
settings, port numbers to connect to
and whether or not to use SSLetc.
Of the five clients in our list,
Evolution, Zimbra Desktop and
Thunderbird can fetch settings fromthe
IMAPserver. This means you dont have
Desktop integration
IMAP support
Shouldyoustickwithyour desktops default?
Howdoes it behavewithwebmail?
launches a compose message window
with the selected file listed as an
attachment, so you dont have to
explicitly launch Evolution in order to
compose a message.
You can do the same with KMail on
KDE in the Dolphin file manager by
right-clicking a file and selecting
Actions > SendTo.
Default clients by definition, though,
dont suit everyone. They have to cater
for a large section of the user base,
which is why KMail and Evolution arent
just email clients but PIMs, which can
create to-do lists and schedule
reminders. This is too much
functionality for someone who only
wants a client to back up email.
Almost all of the clients support the
MBOxmailbox file format. Claws Mail
offers it via a plugin. The MBOxformat
stores messages concatenated into a
simple text file. MAILDIrand MHare
alternate formats.
The format in which mail is stored is
important when you have to shuttle
between clients. The format you export
your mails in fromone client, should be
to specify the port number or the SMTP
settings to configure your account.
KMail can determine what
authentication options are supported,
but only after you point it to the IMAP
server. Claws Mail has to be manually
fed all of the server settings.
Good email clients should help you
configure the account with minimum
effort, but thats only half the picture.
Howwell the clients interact with the
webmail service is also
important.
You can compose
messages offline with
Zimbra, Evolution and
Thunderbird, which will be
supported by the client you import
mails into, or you will have to convert
the mail into a supported format before
importing it.
If you have to use multiple machines,
running different operating systems,
you might want to choose a popular
format such as MBOx, which is
supported by email clients on all
distributions and operating systems.
While KMail and Evolution are only
available for Linux distributions, Claws
Mail, Thunderbird and Zimbra Desktop
can be installed on any Windows, Mac
or Linux machine.
sent automatically when you go online.
Claws Mail however doesnt
automatically send queued messages.
When importing messages, all
clients connect to the webmail service
to create a folder tree. You can then
import messages into the folders.
Claws Mail randomly sends old
messages to the Inbox, creating
duplicates when you import froman
MBOxfile. Evolution is best at creating
folders and importing messages. KMail
provides the most import options, and
imports messages without errors, but it
doesnt display the message body.
Messages downloaded fromthe
internet are displayed without fault.
Clients should fetch settings automatically.
Evolution is much more than just an email client.
Good clients should help
you configure the account
with minimum effort.
Roundup Email clients
32 LXF151 December 2011 www.linuxformat.com
User experience
But theyall lookthesame! Or, dothey?
T
he purpose of an email client is rather simple: it
fetches your emails, displays themin a neat
interface, lets you easily compose and send
messages and offers additional features such as search,
labels etc.
The first email client, although nothing like what we have
today, showed up almost a half century ago. Modern email
clients, too, have existed for a fewdecades nowand yet,
despite the advancing years and changing email norms,
most look almost exactly the same as their ancestors did.
Comparing email client interfaces is almost like
comparing keyboard layouts on different laptops. The
layout is pretty much the same, and yet some are better
than others. Email clients, which are very similar in terms
of feature sets and usefulness, are no different. Some,
however, steal the showby offering a little bit extra.
Evolution
Avery typical three-panel view, which is standard for most clients. Since
its a PIM, you get to choose between Mail, Calendar or Tasks using
buttons on the bottom-left. You get the threaded message viewby
default. Theres no visible difference between a threaded message and
standalone messages, except for the + and - signs in the subject line to
denote collapsed and expanded threads. Press Ctrl+Tto turn off
threaded view. You can search for messages in the current folder, current
account, or all configured accounts and create customsearches. It even
lets you save searches, and create folders for them. Attachments arent
displayed inline by default. Depending on the type, however, you can
choose to viewtheminline or with the default associated application.
Thunderbird
Thunderbird is rather bare, especially compared with Evolution or
Zimbra Desktop. This is primarily because various options are either
clubbed together into one button, or not located on the Mail toolbar at
the top. For example, the Delete, Forward and reply buttons showup in
the bottompanel when reading a message. Searching is one of the best
features of Thunderbird and puts it miles ahead of the competition.
results showup in a newtab, with a year/month timeline and various
additional filters to help you zero in on the message you want. The
threaded viewis not the default, but can be enabled if you click View>
Sort By >Threaded. You can also archive messages, but archived
messages cant be searched and you must specify an archives folder
when setting up your email account.
M
ailboxes can growto several
GBs in size and so its very
important for email clients to
handle a large number of messages
with ease. Performing searches on
thousands of messages may seemlike
a daunting job, but its an everyday task
for mail clients. We tested the search
and general performance of the clients
using a 450MBMBOxfile.
Evolution took about 15 minutes to
import the file. When searching, it
provides near instantaneous results.
Performance
BeammeupScotty. Yes, now!
Most clients let you compose messages
while importing, but not Claws Mail,
which is unusable. It took 30 minutes to
import the same MBOxfile.
Were confident Thunderbird is
untouchable where Search is
considered. It displays the results in a
separate tab with many additional
filters such as Starred, FromMe, and
List of Contacts.
KMail fares so poorly because very
little actually works as advertised. For
one, it doesnt display the message
body when importing messages froma
file. This mostly defeats the point in
importing messages or migrating to
KMail fromany other client.
Of all the clients in our list, Zimbra
Desktop was the slowest in performing
regular tasks such as switching mail
folders, but only marginally. While it
can import messages, it needs them
inTGZformat. This isnt a problemper
se, but the additional step of
converting exported messages into
TGZis a nuisance.
Evolution
KMail
Thunderbird
Claws Mail
Zimbra
Thunderbird
and Evolution
lead the pack
here.
Verdict
Email clients Roundup
www.tuxradar.com December 2011 LXF151 33
Claws Mail
Although not too shabby, the interface could use some work. The left
panel appears crowded when it displays read, unread, and total number
of messages in each folder. Change this setting under View> Set
Displayed Columns > In Folder List. There are various built-in layouts to
choose from. Click View> Layout and cycle through the five options to
find one that suits you the Wide Message andThree Columns layouts
are ideal if you have a wide screen. Theres no search bar in any of the
layouts, and the toggle search button is so buried in the message list
panel, it might as well be invisible. You can right-click a message to
create filter and process rules. Process rules mean defining actions such
as move, copy, delete, forward etc.
KMail
When you first launch KMail, it will terminate with aFailed to fetch the
resource collection error. KMail doesnt have a default incoming mail
directory configured, which causes this error. The workaround
involves using Akonadi to specify a maildir location for KMail. To do
this, launch the Akonadi Configuration tool and point the Local Folders
to ~/.kde4/share/apps/kmail2/. The three-panel interface presents
messages grouped by day/month/year, depending on the number of
messages in the folder. KMail does the threaded viewbetter than the
other tools, using line spacing to denote replies to messages in a
thread. The search bar at the top can be used to search for messages,
and you can use the drop-down list on its right to refine your search.
For example, choose Has Attachment to limit your search to messages
with attachments.
Zimbra Desktop
Although Zimbra Desktop also provides a three-panel interface, it does
things differently enough to impress us. It does a lot more than just
email but despite its many features, the interface is neat and clean.
There are plenty of tabs at the top that let you move between
Preferences, Mail, Calendar, Tasks and so on. The search bar produces
near immediate results, searching in the subject, header, and message
body. The Advanced button to the right of the search bar coughs up
even more useful options to help you narrowdown the results and lets
you search SpamandTrash. Zimbra lets you save searches as well, a
feature it shares with Evolution. Zimbra also supports threaded view, but
its even worse at identifying threads than Evolution. To mark a message
as spam, select it and click Spam no configuration required.
T
he all-in-one nature of some of
the clients in our collection
deserves special mention. Not all
users would want their email client to
set up reminders and double up as a
calendar, but if these are things that
you use daily, its probably best to use
just the one tool, rather than several.
Still, you dont have to necessarily
go with one of the advertised over-
achievers. Most other tools offer the
same functionality as PIMs via
extensions and plugins.
Besides email
PIMpmyemail.
Evolution, Gnomes official PIM,
provides a calendar, address book and
task list, which is different fromyour
calendar appointments. On KDE, KMail
is part of Kontact, KDEs PIMsoftware
suite. The other applications that make
up the collection are KaddressBook,
Akregator and KOrganizer.
Thunderbird is primarily for email
but there are plugins for everything else.
The vanilla Thunderbird installation is
not a PIMbut the Mozilla Lightning
extension will add the functionality. Its
built-in rSS/Atomreader means it can
also be used as a simple news
aggregator. Additional features are
available via other extensions.
Claws is similarly a news and mail
email. It has an address book and
plugins for a calendar, rSS aggregator
and more. Apart fromemail, Zimbra
does contact management and
document handling, and has a calendar
and task list. You can edit documents
such as spreadsheets on the fly and
include themin your emails.
Evolution
KMail
Thunderbird
Claws Mail
Zimbra
Theres no
catching up
with Zimbra
Desktop.
Verdict
Roundup Email clients
34 LXF151 December 2011 www.linuxformat.com
KMail fares better than Claws Mail in
terms of security, at least at first
glance. Click Anti-Spamto launch a
wizard that will automatically detect if
theres a tool, such as SpamAssassin,
available and enable it.
You only need to mark messages as
Spamor Hamto train SpamAssassin,
but when you flag a message, a popup
dialog appears telling you to wait while
the message is transferred. Nothing
happens and KMail is then unusable. An
Anti-Virus wizard is also on offer, but
good luck trying to get that to work
we didnt have that much joy with it.
You can encrypt messages when
sending emails but only if you already
have encryption keys on your system.
None of the tools let you create keys
fromthe interface itself, except for
KMail, which can create keys when
defining your identity.
With the other clients, you must use
the distributions key management
program, whether its Kgpg or Seahorse,
to create keys which you can then use
to encrypt messages.
E
volution lets you choose
between SpamAssassin and
Bogofilter as the spamfiltering
tool of choice. Of course, you need to
make sure theyre installed on your
systembefore using them. If not,
Evolution wont complain about
missing packages, which is very odd.
Youll also need to install the relevant
Evolution plugin. Finally, you need to
configure your junk mail settings. These
are under Edit > Preferences > Mail
Accounts > Edit > receiving Options.
You should also look at Edit >
Preferences > Mail Preferences >Junk.
Thunderbird has a very advanced
junk mail filter, which learns and
improves its filtering depending on
A
s useful as the default feature
set is, its always good to know
that additional features, even if
you dont need themnow, are available
should the need ever arise. All clients
release plugins officially, and these are
a nice way to enhance functionality.
Thunderbird has the most extensive
list. The add-ons page provides a
categorised list of available extensions
such as Contacts, Message reading,
Privacy and Security. You can also
scroll through the Most Popular list on
the left. Also available are dozens of
themes that you can use to change the
clients appearance.
Evolutions default installation
already has several plugins installed
Security
Add-ons and plugins
what you mark as spam. All incoming
messages pass through the filter, and
you can get Thunderbird to warn you
about potential phishing emails, and
also when a link in a message is leading
you to a website other than the one
indicated in the UrL.
Claws Mail, if you compile it yourself,
provides several useful plugins in the
core package. But, if you install it via
your distributions software repositories,
you must install the plugins as well.
Load themunder Configuration >
Plugins > Load. Next head to
Configuration > Preferences > Plugins >
SpamAssassin. read the Claws Mail
Plugins FAQon the projects website,
which covers the additional steps.
and enabled. In fact, many of its basic
email features, such as Mark All
Messages As read, are also a plugin.
Instead of Thunderbirds extensive
add-ons database, KMail has Tools.
Most arent written by the KMail team,
and some are too old to be of any use
on recent releases.
Claws Mail is built on the premise
that you will extend it with plugins as
and when you need them. There are
two categories Standard are
shipped with the package and will be
installed if you manually compile
Claws; Extra plugins can be
downloaded fromthe website. If you
install Claws via the software
repositories of your distribution, you will
Is your client internet-proof?
Accessories for your client.
Viruses, spamand phishing scams Thunderbird can protect you fromthemall.
When installing plugins on Claws
Mail, match version numbers carefully.
Thunderbird can warn
you about potential
phishing emails.
have to separately install the plugins.
Zimbra Desktops plugins are called
Zimlets. The website offers a
categorised list such as Contacts and
Mail. Note that not all Zimlets work on
all platforms.
Evolution
KMail
Thunderbird
Claws Mail
Zimbra
Only Zimbra
and Thunderbird
dont need spam
plugins.
Verdict
Evolution
KMail
Thunderbird
Claws Mail
Zimbra
Why do all
Mozilla products
have so many
plugins?
Verdict
Email clients Roundup
www.tuxradar.com December 2011 LXF151 35
The amazing
search, which can
find a needle in a
haystack thanks
to the extra
filters, really
sold Thunderbird
to us.
After putting the clients through
their paces, Mozillas Thunderbird
came out on top. You can run it on any
desktop environment and, of all the
clients in this roundup, it officially
supports the highest number of
operating systems.
Mozilla moans
We arent overly impressed with
Mozillasrelease often strategy but we
really cant find any faults with the
client itself. It must be noted, though,
that although Thunderbird 5 was
pretty zippy on our dual-core laptop,
Grahamwasnt impressed by its
performance on anAtom-based
netbook in his reviewin LXF149.
If youre running a Gnome-based
distribution, you
could stick with
Evolution, mostly
because of its
integration within
the desktop. The
T
here are hordes of email clients
out there but we limited
ourselves to the ones that
would be useful for the most users. This
is also why clients that work on the
most number of platforms score higher
that those that dont. Cross-platform
clients provide a consistent interface
across operating systems, and make it
easier for you to import/export email
when switching platforms.
Another important feature is the
extensibility of the client and having a
diverse range of plugins is useful when
it comes to customisation.
Acouple of years ago, a lightweight
client would have made sense but with
hardware prices on a constant
downward spiral, we wouldnt trade
features for a minor bump up in
performance.
We see no reason for recommending
proprietary email clients either in our
experience theyre dwarfed by their
open source cousins.
newer versions need for Gnome 3s
libraries means its getting trickier to
run it on Ubuntu, though.
Despite KMails integration with
KDE, we werent impressed. Neither are
some developers of KDE-based
distributions, such as Mandriva, which
has replaced it with Thunderbird in the
latest version of its distribution.
Claws, the lightweight and zippy
email client, is best paired with slimline
desktops such as xfce.
Email clients
The verdict
First up, there are many more email clients than the ones
weve included here. We included tools that offered a
complete email solution, which meant having to exclude our
all-time favourite, Mutt. Its a wonderful lightweight client, but
as its text-based many users would just skip over it. Plus, it
requires additional tools such as Procmail to filter messages.
We also had to pass up on popular browser-based clients
such as roundCube and SquirrelMail. These are shipped with
Also consider...
popular web-hosting control panels such as cPanel, and look
and feel like their desktop brethren, except for the fact that
they run atop a web browser.
There are also those that leverage code fromother clients,
for example SpiceBird and Seamonkey, which are both based
on Thunderbird. Another popular option weve omitted is
Opera Email, an extension to the Opera web browser. If you
use Opera, you should definitely take this for a spin.
LXF
Do you agree with our winner? Or would you rather use your distros
email client? Email your opinions to lxf.letters@futurenet.co.uk
Over to you...
Thunderbird
1st
Evolution
2nd
Web http://projects.gnome.org Licence GPL and others Version 3.0.2
Its not cross-platform, or itd be the winner.
Claws Mail
4th
Web www.claws-mail.org Licence GPL v3 Version 3.7.9
Lightweight and fast but it needs to pull its socks up.
Web www.mozilla.org Licence GPL and others Version 5.0
An improved import process will make other clients shut up shop.
Zimbra
3rd
Web www.zimbra.com Licence Proprietary Version 7.1.1
Its good, but why use a proprietary client when you have alternatives?
KMail
5th
Web http://userbase.kde.org/KMail Licence GPL v3 Version 4.7.0
Avoid at all costs. What a nightmare.
Evolutions need for Gnome 3s
libraries means its getting
trickier to run it on Ubuntu.
Reviews Books
36 LXF151 December 2011 www.linuxformat.com
subject are huge treatises; what you
really need is a gentle introduction to
the subject, something that targets a
familiar, readable language such as
Python. Something like Python
Algorithms, for instance.
It does a laudable job of introducing
you to the idea of measuring efficiency
withBig Oh notation and, as youd
expect, theres a fantastic array of
algorithms that are dissected and
explained. Unfortunately, the actual
explanations are often terse and
difficult to follow: brackets are used too
freely, and references are often made to
other parts of the book, so youre
skipping backwards and forwards.
We were, however, pleased to note
that the book doesnt just emphasise
teaching the classic algorithms, but also
the problem-solving techniques that are
necessary if youre going to begin
designing and implementing your own.
The sections on algorithmdesign were
often insightful, and will definitely
improve any newprogrammers ability
even a chapter at the end explaining
howto install the programs (although it
just covers Ubuntu).
Much of the book focuses on Gimp,
explaining howto do geometric
transforms, colour transforms, use
filters and retouch photos. Other open
source programs are thrown in to the
mix, such as Hugin for stitching
together photos to make panoramas,
and Qtfpsgui (what a horrendous
name) for generating HDRimages.
All of this is accompanied by
copious screenshots and photos, but
with it being printed in black and white,
it doesnt give you a great impression of
what you can achieve. Fair enough,
printing the entire book in glossy colour
couldve made it prohibitively expensive,
but in a book on image processing wed
like to have seen a mini section of
colour pages in the middle, inspiring us
to do awesome things.
Still, the writing is clear and helpful,
and the author comes across as an
A
fter diving in to lots of different
programming tutorials,
skimming text books and
hacking on silly little bouncing ball
demos, anyone whos serious about
learning to programwill quickly realise
that they need a good selection of
algorithms up their sleeve. The problem
is, most of the classic texts on the
A
s a Linux user, youd be forgiven
for ignoring this book. Flick
through it inWaterstones, for
instance, and youd probably give up
pretty quickly after seeing page after
page of Windows screenshots. But wait!
Everything in this book is free software
and also available for Linux theres
to tackle complex problems. We were
also fans of theblack box sections
which explained howinternal Python
algorithms worked; since so many
fundamental techniques are
implemented in the language itself,
without these youd have missed a lot.
As an introduction to the
fundamental algorithms, then, this book
could have been clearer; as an
introduction to designing algorithms,
however, it does a pretty good job.
expert in his field, explaining each topic
in detail and providing plenty of reasons
why youd want to performthe
operations covered.
In all, its a decent read, and a great
entry point if you want to switch your
photo processing workflowto Linux but
dont knowwhere to start. And, of
course, you can give the book to your
Windows-using friends when youve
finished with it.
LXF
Jonathan Robertslearns howtoimplement anddesignhis ownalgorithms.
Mike SaundersGimps uphis Bavarianbeer hall snaps.
Python Algorithms
Beginning Digital Image Processing
Rating7/10
A detailed look at free software
image tools. Shame about the colour.
Author: Sebastian Montabone
Publisher: Apress
ISBN: 978-1-4302-2841-7
Price: 23.99
Pages: 292
Verdict
Digital Image Processing
Rating6/10
A decent introduction to designing
your own algorithms.
Author: Magnus Lie Hetland
Publisher: Apress
ISBN: 978-1-4302-3237-7
Price: 39.49
Pages: 450
Verdict
Python Algorithms
Arm yourself
with some handy
algorithms.
A glossy colour
mini section
would have
improved this
book no end.
Maximiseperformanceanduptime
BuildIT better witha
Rundemandingemail, webanddatabaseapplications withavirtual server from
Fasthosts. Youll get acost-efective, dedicatedresourcethat youcaneasilyexpand,
whichmeans youandyour clients get abetter service. Avirtual server is ideal for
developers anddesigners that want tocustomisethememory, storageand
processingpower of their machines.
Youll get better performanceand99.99%networkuptime

fromour
award-winningplatform, whichprovides server-loadbalancingandautomatic
failover. Tofndout moreabout this technologyandwhyour virtual servers ofer
thebest spec intheUK, visit www.fasthosts.co.uk/why-we-are-better.
Call usnowon:
08081686777
fasthosts.co.uk/virtualservers
2011 All rights reserved. Fasthosts and the Fasthosts logo are trademarks of Fasthosts Internet Ltd. Prices valid at time of print.

Service level agreement applies, see website for details.*Unlimited Bandwidth is subject to acceptable use policy.
Terms and conditions apply, see website for details.
Followus on:
24/7UKphone&onlinesupport UKdatacentres Unlimitedbandwidth
*
FREEsetup
per m
onth
ex VAT
From
just:

2
9
.9
9
World Class Virtual Servers
I N D U S T R Y L E A D I N G T E C H N O L O G Y
F O R O V E R 1 0 Y E A R S
SUSAN LINTON
is owner/
operator of
tuxmachines.org.
I
t feels as though us lowly
Linux desktop users are
being abandoned; the
world has gone gadget and
cloud crazy. Everybody is
pushing the cloud its a
constant revenue streamfor
providers and it also provides
an easy way for government
spies and police to keep an eye
on the chattels activities.
Even as Linux celebrated
its 20th birthday, coverage
quickly veered to
extensive discussions on the
importance of Android. Why do
you suppose mainstream
media pundits would want to
push citizens into using a
platformand OS that offers
very little freedomor
customisation? Plug-and-go
clones, whose data comes and
goes over the airwaves, are
perfect avenues to confine and
monitor thesheeple.
Linux software developers
are jumping on board. You only
have to look at our desktops to
see the trend. Is it a
coincidence that theyre all
starting to look like gadget
interfaces? Gnome 3, Unity
and Plasma Active are leading
the way. In fact, KDE makes no
bones about Plasma Active
being for the tiny form-factor.
As freedomshrinks around
the world, our computing
freedomis being slowly
contracted as well.
Its not at critical mass just
yet, but one has to wonder how
our desktops will look and
operate in a fewyears time.
lxf.distrowatch@futurenet.com
This months roundup of news fromthe
vaults of Linux distro development.
Distrowatch
Mandriva 2011 Anoldkernel, anewRPMandastrange
desktopcharacterisethenew-lookdistribution.
Changing face
Abandoned?
Its apparent that pretty is not one of Mandrivas new goals.
T
his is the first major
release of Mandriva since
the big shake-up last
autumn, when the distros future
really did hang in the balance.
Much of the key talent moved to
Mageia and even as Mandriva
emerged on the other side, new
partnerships and directions
resulted in further staff issues and
more people walked out the door.
Those who remained have had
quite a fewissues getting this
release completed. One of the
first was the move to RPM5.
Migrating to this fork of the
package manager was risky
enough in itself, but then the main
developer effectively shut the
project down.
Although that turned out to be
just a temporary problem, a long
and protracted discussion of RPM
5 ensued. Even though it didnt
disappear, many questioned the
sanity of relying on a project that
seemed so unstable.
That issue was soon forgotten,
though, as other more obvious
changes in Mandriva-land came to
the fore.
To lessen the workload for the
remaining and newly-hired
developers, a newrelease cycle
has been implemented. Now
Mandriva will get only one release
a year, and it will be supported for
18 months (LTS for three years).
Version availability has been
restructured to a single 1.7GB
download. Even the install process
has been streamlined into a one-
size-fits-all solution.
Even more disturbing is the
desktop situation; Mandriva is
nowofficially a KDE-only distro.
And this one desktop has been
customised by ROSALab to
produce a hybrid KDE.
Reviews are just starting to
trickle in and at first glance most
seemto like it, but that soon
changes when users click Menu
and find KDE transformed into a
Gnome 3 or Unity clone. Even
after an alternative desktop is
installed, starting and logging in
proves a challenge.
The abundance of software
that once characterised Mandriva
is gone its jumped aboard the
one-app-per-task train. For
example, Thunderbird 5.0is now
the email client for this
customised KDE set-up. In fact,
the whole systemis a mish-mash
of Qt and GTKapplications.
Fortunately, a lot of software is still
available in the Mandriva
repositories, including some
proprietary drivers.
Mandriva Control Centre is one
element that seems to have
remained the same. You can still
customise its hardware
configuration, manage software,
and set-up backups and restore.
Users may encounter a glitch or
two here and there, though.
Mandriva has certainly
changed. Its changed personnel,
goals, direction, its product line,
its operating system, and its
very essence. Time will tell if
users like what its become.
Mageia is waiting in the wings for
the refugees.
www.mandriva.com
Even more disturbing is the
desktop situation; Mandriva
is now a KDE-only distro.
38 LXF151 December 2011 www.linuxformat.com
Build your own Coming soon...
F
or DIYtypes, Arch Linux
continues to provide an
outlet for user creativity:
its known for releasing bare-
bones install media and letting
users build their own systems.
Arch enjoys a loyal, but friendly,
group of users who are less
combative than other distro fans
and rarely utter a word of
rudeness. This alone is reason
enough to give Arch a spin.
If you need any further
encouragement, Arch Linux also
has experimental support for Btrfs
and NILFS2; support for the
Syslinux bootloader; and changes
T
he next release of the
ber-popular distribution
is well on its way to
completion. The Feature List has
been filled out and percentages
are already heading towards 100.
Some features are deep in the
inner workings of the OS, but
many are sure to tantalise even
the most casual user.
The default desktop will be
Gnome 3.2 and the latest KDE 4.7
will also be available. The
bootloader will get updated to
Grub 2, and the newest alpha
uses GPT, the GUIDPartition
Table, by default.
to configuration formats to
support newrc.conf and Linux 3.0.
It also makes selecting source
more flexible and shows package
descriptions when installing.
This release the first in 15
months was necessary because
the many changes broke
NetInstall. Nowthe config files and
init scripts have been updated for
Linux 3.0. Arch also features KDE
4.7.0, Firefox 6, X.orgXServer
1.10.3, GCC4.6.1 and Gimp 2.6.11.
Some other characteristics of this
big overhaul are added support
for booting frommemdisk, and
usingXZcompression for
SquashFS and
initramfs.
Arch may not be
the easiest distro to
get up and running,
but its one of the most
popular. It currently
sits at number four in
Distrowatchs Page Hit
Ranking a position
earned after a slowbut
steady ascension over
the years.
www.archlinux.org
One interesting itemis the
effort to expand the ext4 driver to
register ext3 and ext2 filesystems.
They will still be recognised and
identified as ext3 and ext2, but will
bring the benefits of a slightly
smaller kernel and less
maintenance for developers. Its
also been confirmed that Btrfs will
not be used by default.
Other features in the alphas
include Linux kernel 3.0, X.orgX
Server 1.11 snapshot, Perl 5.14,
GCC4.6.1, Firefox 6, Evolution
3.1.4, and LibreOffice 3.4.3.2. It
seems it takes great effort to
update Blender to the 2.5 series
enough to warrant its
own wiki page.
Apparently, the
difficulty comes from
the Python 3.2
dependency, so thatll
have to come to
Fedora 16 as well. Its
still early in the
development cycle, so
well knowa lot more
in the coming months.
http://
fedoraproject.org
Arch Linux offers popular desktops
installation instructions are on the wiki.
Plasma Active (and Sugar) are among the
alternative desktops in Fedora 16.
Hit list
1 Ubuntu 2,078
2 Linux Mint 1,936
3 Fedora 1,614
4 Arch 1,309
5 OpenSUSE 1,274
6 Debian 1,196
7 CentOS 971
8 Mandriva 927
9 Bodhi 808
10
Puppy Linux 756
DistroWatch.commonitors the popularity of
distributions based on the number of visits to each of its
distro-specific pages. While these figures dont represent
the actual install base, its an indicator of which distros
were hot during each specific time period.
LXF
The ten most visited distro pages on DistroWatch.com,
25August 23 September 2011 (average hits per day)
Distro
Arch Linux 2011.08.19Linux3.0,
Btrfs, andNILFS2for DIYfans.
Fedora 16Official development
releases hint at whats instore.
Number of hits
Distrowatch
www.tuxradar.com December 2011 LXF151 39
KDE 5
O
n
th
e
R
a
d
a
r
Depending on howyou look at it,
KDE 5 shouldnt be the big
disruptive mess that KDE 4 was (thats
according to KDE developer and Plasma
teamleader Aaron Seigo). For the end-user
maybe, but for the developer, it could still all
turn into a horrible nightmare.
Since KDE 5s emphasis will be on the
mobile platform, libraries and packages will
be split up even more than they are now. For
the desktop user, that means rolling your
own will be a big pain in the console.
In an interviewwith the Austrian news
website derStandard.at, Seigo said KDE 5
will begin to blur the line between the
desktop and mobile platforms.
We dont see everything segmented
quite so clearly between tablet,
smartphone, set-top boxes we see it
as a continuum.
He went on to downplay theories about
the demise of the desktop.
Its losing importance in the sense that
newspapers have lost importance.
Technologies dont replace they displace,
we knowthis as a fact fromhistory.
The numbers just dont support the
mobile is killing the desktop story. The
number of laptops and desktop PCs is
actually growing as the current IDC
studies show.
The intention is to use tools designed
for Plasma Active on the desktop.
40 LXF151 December 2011 www.linuxformat.com
Conquer the command line
T
he command line is an
incredibly powerful way to
interact with your computer.
As well as giving you access
to many low-level administrative tools,
its also an efficient and flexible way to
go about your day-to-day business.
Unfortunately, its more than a little
intimidating to the uninitiated.
That blinking cursor, and the
cryptic text that sits before it,
hints at a world of possibilities
but gives no indication of how
you might begin to use it.
knowledge, you can safely harness this
power to work more efficiently and get a
whole lot more out of your machine.
In this article, were going to teach you
everything you need to know. Well start by
explaining what the command line is, how
to issue commands and howto interpret
the results. Well move on to look at two
mini projects. The first will
introduce you to the commands
that youll need in day-to-day
computing, as well as showyou
some of the tricks that will make
you more productive; the
For all you know, pressing the wrong key
might put the computer into a super-secret
overdrive mode, melt your processor and
destroy all your data.
But you dont have anything to worry
about. Sure, the command line is powerful,
and with great power comes great
responsibility, but with just the tiniest bit of
That blinking cursor, and
the cryptic text before it, hints
at a world of possibilities...
$conquer the\
>commandline
Example CLI files.
Immensepower is at your
fingertips youjust need
toknowhowtouseit.
Jonathan Roberts gets
togrips withtheCLI
www.tuxradar.com December 2011 LXF151 41
Conquer the command line
Terminology and the terminal
If youve ever read about the command line on
the internet, youll have seen theres a lot of
terminology floating around, all of which seems
to refer to very similar concepts.
Two common terms, the shell and the
command line, are quite interchangeable and
refer to the text-based interface; one other
common term, the terminal, has a slightly
different meaning.
The terminal is a programthat you access
the command line through. Its quite simple
really it receives the input you type on the
keyboard and displays it on the screen; it
also receives the output of the various
commands that you might run, and displays
this on your screen.
In this article, when we saylaunch a
terminal, we mean launch this programto get
access to the command line. On Gnome or
Xfce, youll most likely be looking for a program
named Terminal, while on KDE the program
youll want to launch will be called Konsole.
To access the command line, sometimes known as the shell, launch the Terminal
application in Gnome or Konsole in KDE.
Your first command: ls
second will look at the tools and tricks
necessary to use the command line when
diagnosing and fixing problems.
Keep an eye out for the example boxes,
as putting theory into practice is by far the
best way to get familiar with this material.
Also, as an added bonus, each of the LXF
staff has revealed their top command-line
trick. Lots to see, lots to learn and lots of fun
to be had, so what are you waiting for?
First things first
Just to make sure were all on the same
page, lets start at the very beginning (as
Julie Andrews once said), before diving in
to some actual work. The command line is
just another interface to your computer,
like Gnome or KDE. What makes it
different is that, instead of clicking nicely
labelled buttons with your mouse, you
control your computer by typing
commands on your keyboard.
Theres nothing magical about these
commands, theyre just combinations of
letters that the computer interprets
according to a well-defined set of rules.
Each command starts with its name, so the
computer knows which one youre invoking,
and can be followed by options and
arguments that modify the way it works.
Many of these options and arguments
specify which folder or file you want the
command to operate on, and in the
absence of a graphical file manager, theres
a special syntax for referencing these on
the command line.
On a Linux system, files and folders are
organised in a hierarchy, descending from
the root folder. On the command line, this
root folder is represented by a single
forward-slash, /. All the folders and files
that come belowthis are then represented
by their names, which are case-sensitive,
with the different folders being separated
by another forward-slash.
For example, my home folder, which is a
sub-folder of the systemhome folder, which
is a sub-folder of root, looks like this:
/home/jon/. This is a representation well
be using a lot, and it will soon become
second-nature.
N
owthat you knowthe absolute
basics, its time to issue your first
command. The command were
going to begin with is called ls, and all it
does is list the contents of a directory. A
good way to remember this programand
what it does is that ls looks likelist. The first
thing to do is launch a terminal (see the
boxout below), after which youll see a new
windowappear on your desktop. As well as
having a plain white or black background,
there will also be some obscure-looking text
in the window. This text, with the flashing
cursor that follows it, is called the prompt,
and indicates that your computer is ready
to accept commands.
With your computer at the ready, type ls,
the name of the command, into the
terminal windowand press Return. Youll
immediately see several lines of text appear
in the terminal, followed by a newprompt
indicating that your computer is again
ready to accept commands.
If you look closely at the text that
appears in the terminal, youll notice that it
looks familiar... its a list of all the files in
your home folder.
Your first argument
Pretty cool, and pretty simple, right? But
why did it list the contents of your home
folder and not your Music folder or some
other altogether?
Well, while working at the command line,
youre always working within one directory
or another no command is ever run
outside of this kind of context. Obviously,
every command-line session has to start
somewhere, and by default its the current
users home directory.
Thats all well and good, but it still
doesnt really explain why ls returned the
contents of your home directory. What
happened is that, since we didnt tell ls
42 LXF151 December 2011 www.linuxformat.com
Conquer the command line
The ls command with my Music folder passed to it as an argument.
Examples 1
In this section, weve mostly been looking at
the ls command to demonstrate the basics of
the command line.
Of course, ls is capable of far more than
just listing the contents of a directory; heres a
fewexamples of ways you can manipulate its
output, although you might want to come
back to this after reading about options later
in the article:
[jon@adam ~]$ ls -a
Lists all files in a directory, including those that
arehidden by placing a dot at the front of their
name.
[jon@adam ~]$ ls --color
Colourises the output to make it easier to read.
[jon@adam ~]$ ls --sort=X
Sorts the output by something other than
filename. Xsorts by extension, Ssize, t time
and v version.
[jon@adam ~]$ ls -l <filename>
Lists details, including permissions, owner and
last modification time, about <filename>.
MINI PROJECT 1 Manage files and folders
otherwise, it simply assumed that we
wanted to see the contents of the current
directory, which at the time was your
home folder.
We can, however, tell ls that we want to
look elsewhere bypassing an argument to
it. All this really means is that, as well as
typing the name of the command, youll
also type the location of the folder that you
want to look in. So, if you wanted to inspect
the contents of your music folder, the
command would be ls Music.
Notice that we just put Music, rather
than the full path to the folder, which would
have been /home/jon/Music. This is
known as arelative path: since were
already in our home folder, if you dont
specify the full path, the command line will
simply look for a folder with the same name
in the current directory.
Y
ou nowknowhowto use one
command, and howto modify the
way it works with a single
argument. For your new-found command
line knowledge and skills to be useful,
however, youre going to need to knowa few
more commands and begin to get a sense
of howyou might use themtogether.
In this section were going to walk you
through a simple mini project that will
introduce you to the programs that will help
you manage files and folders, move about
the filesystemand edit text files.
So that were all working fromthe
same page here, weve included a mock
home folder on this months coverdisc.
Copy it to your own home folder and then
extract it using whatever tool suits you best,
being careful to take note of the folder
name (jons-home).
If you take a look inside, youll quickly
get a sense for this mini projects premise.
My LXF files have gotten scattered all over
my home folder, and youve got to help me
track themdown and finish the work. Its
more than a little contrived, but it should
get the job done.
Our first job on the command line will be
to get inside the mock home folder. Launch
a newterminal window, and run the ls
command to check what you have in your
home folder. If you extracted the mock
folder here, amongst this list you should
also see jons-home. To get inside it, youre
going to need to use the cd command.
cd stands for, at least in our minds,
change directory, and thats exactly what it
does. If you run cd without any arguments,
it will return you to your own home folder
not that helpful. If you run it with a single
argument, specifying which folder you
want to change to, it will send you there
instead much more helpful. The
command to get inside jons-home, then,
is cd jons-home.
As soon as you issue that command...
nothing seems to happen. Well, nothing
quite so striking as when you run the ls
command. If you look closely, however,
youll see that the text inside the prompt
has changed. The ~ has disappeared, and in
its place is jons-home, the name of the
current folder.
This part of the prompt will always
display the name of the current folder,
saving you fromgetting lost. That ~, which
looked strange before, is actually just an
abbreviation for the current users home
directory. You can test this if you want, by
typing cd ~ and then running ls to see if
www.tuxradar.com December 2011 LXF151 43
Conquer the command line
A close-up of the prompt. Notice how the prompt changes after the cd command, so that it
always shows the current directory.
White space and special characters
You might wonder why our mock folder was
called jons-home; surely a much more natural
name would be Jons Home?
The problemwith this second name is that it
contains a space and a single quote (although
acting as an apostrophe), both of which have a
special meaning on the command line.
The space, for instance, is used to separate
the command name fromits arguments, and
arguments fromone another. If you were to use
a space in the folder name, howwould cd or ls
knowto interpret the entire name as one,
rather than as separate arguments?
To avoid this kind of confusion, its best to
restrict your file and folder names to letters,
numbers, and the hyphen, underscore and full-
stop symbols. If you come across a command
that doesnt seemto work, and the folder or file
youre trying to operate on has a strange-
looking name, this might be the problem.
You can get around this by adding the
escape character (a \) before the special
character, but this can get messy.
For reference, to make a directory called
Jons Home, youd have to run the command
mkdir Jon\s\ Home.
youre back in your home folder. Hooray!
Now, take a look inside jons-home with ls.
Youll see that there are several files for each
of the articles Ive written in this issue. How
silly, and howmessy. Wouldnt it be much
neater if there were a folder for each article?
I think so, and youre going to do it for me.
The first step will be to create a folder for
each article using the mkdir command.
Youll probably find this easy to remember
because it looks a lot likemake directory.
For mkdir towork, youmust pass it one
argument whichspecifies the name of the
directory youwant tocreate. So, tocreate a
directory for this command-line features
files, youdrunmkdir command-feature.
Brace yourself
You could just run this command three
times, replacing command-feature with
first-steps andWoE to create folders for all
the articles, but this is slowand the
command line provides a much faster way
of doing this kind of operation. Its called
brace expansion.
The name sounds a bit silly, but it makes
perfect sense. Take a look at this command:
[jon@adam jons-home]$ mkdir {command-
feature,WoE,first-steps}
By wrapping the braces around the
three folder names, we tell the command
line to run the mkdir command once for
each of the arguments contained within.
Instead of having to write mkdir three
times, we only write it once and the
command line does all the hard work for us
howefficient.
This little trick doesnt just work for the
mkdir command, but any. For instance, now
that we have all the folders, we can move
the files into them(using mv) with a single
command for each group of files:
[jon@adam jons-home]$ mv {command-
notes,command-feature-1,command-
feature-2} command-feature/
Notice howthe mv command takes two
arguments, whereas before weve only ever
used one. The first argument specifies the
file thats being moved, and the second the
destination. With commands that take
multiple arguments, its important to get
the order right, as theres no other
indication of each arguments purpose.
Editing text files
Nowthat weve got the files organised, I
also need some help finishing the articles.
Fortunately, I work in plain text files, so we
dont need to use a big, bulky programsuch
as LibreOffice; instead, we can use one of
the many command-line text editors.
The text editors are different to the
commands weve seen so far, in that theyre
interactive rather than set-and-run. This is
tricky to imagine, but if you followour step-
by-step, it will quickly make sense. Well be
using the nano text editor, since its by far
and away the most intuitive available. There
are many other choices available, and wed
encourage you to investigate themat your
leisure, since nano wont always be available
(whereas Vi will almost certainly be on
every Linux system).
Keep it tidy
Nowthat weve organised all the files and
finished the articles, there are just two more
things we should do before finishing. The
first is to create a copy of the files weve
edited, in case we accidentally delete
anything, and the second is to tidy up and
remove old, unwanted sets of notes.
Both are easily achieved and make use
of vital everyday commands. The first,
making a copy of a file, uses the cp
command, which works in the same way as
move specify the file to be copied as the
first argument, and the name and location
of the copy as the second argument (this
Instead of writing mkdir three times,
we only write it once and the command
line does all the hard work for us.
44 LXF151 December 2011 www.linuxformat.com
Conquer the command line
Notice how the -l option modified the way
ls works.
Jons top tip
When performing actions on multiple files,
all of which share some common
characteristic in their filename, you can use
a wildcard to act on all of them. For instance,
cp *.txt will copy every text file in the
current directory.
means that the copy doesnt have to be
stored in the same directory as the
original file).
The second, using the rmcommand, is a
simple job of passing the filename to be
removed as an argument. Be careful with
this command, however, as theres no
recycle bin for it once a files deleted, its
gone forever.
Neither of these methods will work if you
want to apply cp or rmto an entire
directory, however theyll only work on
individual files. To showyou howto apply
themto a directory, we need to introduce
you to the idea of options.
An option is much like an argument it
modifies the way a command runs only
its a lot more specific and allows for far
more possibilities.
Knowyour options
Each option is associated with a single
letter or a string of text, and is specified on
the command line by stating this letter or
text, with a single dash or two dashes,
respectively, preceding it. To see what we
mean, take a look at this example:
[jon@adam ~]$ ls -l jons-home
The -l option of the ls command stands
for long, and instructs it to provide further
details about the contents of the folder
being inspected. Whats really cool is that
options can be combined with arguments,
so even while we told ls to provide extra
detail, we were still able to specify which
folder we wanted to inspect.
Applying this to the cp and rm
commands, theres an -r option to both that
instructs it to workrecursively. This means
they will copy or delete everything
contained within a folder, including sub-
folders, and the folder itself.
1
Open a le
To open a text file in nano, change to the
directory where the file is stored, type
nano and pass the filename as an
argument, eg nano command-notes.txt
4
Keyboard shortcuts
At the bottomare commonly used
keyboard shortcuts. The ^ indicates that
you need to press Ctrl at the same time as
the letter. Note that WriteOut means save.
2
Start typing
The entire terminal screen will be taken over
by the nano interface. You can start typing
immediately and see your text appear in the
main part of the window.
5
Status messages
Some shortcuts will result in a status
message and a question being asked of
you. Read the message, and respond
according to the options presented below.
3
Write as normal
Everything will work as expected, including
the Return key for a newline, and the
Arrowkeys to scroll when the file gets
large enough.
6
Help screen
Be sure to investigate the Ctrl+Goption,
which will provide a help screen with all the
options available. Happy text-editing!
Step-by-step: Nano text editor
www.tuxradar.com December 2011 LXF151 45
Conquer the command line
Examples 2
In this section, weve looked at a range of
commands and a fewadvanced command-line
features. To help you solidify your
understanding, here are a fewmore examples:
[jon@adam ~]$ cp -r /home/jon/Documents /
home/jon/Documents-bk
Copies the entire Documents folder and its
contents to Documents-bk for safekeeping.
[jon@adam ~]$ mv {demo.txt,demo-1.
txt,demo-3.txt} Documents/Examples
Moves the three demo files to the Examples
folder, which is inside /home/jon/
Documents.
[jon@adam ~]$ mkdir LXF\ \(Version\ 1\)
Makes a directory called LXF (Version 1) using
the escape character (\) to ensure the
command line properly interprets the special
characters (, ) and .
Grahams top tip
My most used command-line couplet is
sudo bash. Its only of use with Ubuntu-like
distributions (and OSX!), but it lets you
easily create a newsession with super-user
credentials very handy if youre playing
with config files or services, as you no longer
need to precede every command with sudo.
The first time you do it, youll be prompted
for your password, but subsequent times
you wont be (unless youre idle for five
minutes or more).
Total control
These simple steps have given you
complete control and power over your
computer. Bear this in mind going forward
because, while youre running as root, the
potential damage a mis-typed command
can do is far greater (theres actually not
too much you can do wrong, just be careful
the most part, only modify files in your
home directory.
There are many other files on your
system, however, that are important to the
way your computer works, and these are
not accessible to your normal user. Instead,
they areowned by the root user. So, to
modify the way your computer runs, or
investigate many problems, youre going to
need to become the root user, since thats
the only one with permission to do so.
On the command line, the way to do this
is with the su command (which stands for
switch user). If you type su - youll
immediately be prompted for the root
users password. Entering this, a new
prompt will appear and, if you look closely,
you should notice some differences.
The part of the prompt that looks like an
email address no longer has your username
in it, but instead says root@. This part of the
prompt will always display the name of the
user youre currently working as. As long as
you knowthe users password, you can use
su to switch to any user on the systemby
replacing the - with their username.
On Ubuntu and similar systems, its
more common to use a command called
sudo (super-user do) to execute individual
commands, rather than run a full session as
root. So, on Ubuntu, youll need to prepend
sudo to all of the commands in this section.
MINI PROJECT 2 Diagnose and fix problems
W
ell, at this point my work is all
done and we can safely move on
to our next, less contrived, mini
project. The plan here is to look at the
command-line programs and tricks that are
useful for diagnosing and fixing problems
on your machine one of the command
lines greatest strengths.
Well begin by introducing you to
permissions and the su - command, two
concepts that are vital if youre going to be
able to collect information about the
systemand modify the way it works.
Well then look at the commands
needed to collect information about
hardware and showyou the important log
files that store information about howthe
systemis running.
We wont showyou configuration files to
edit or howto edit them, since there are far
too many possibilities, and the task of
editing themboils down to running a text
editor in combination with the su -
command all things well cover anyway.
Permissions, su and sudo
The first thing you need to knowregarding
permissions is that Linux is designed with
multiple users in mind.
Every file on the systemis thenowned
by particular users, who can specify which
other users are allowed to read or modify
their own files that is, they can set the
files permissions.
This is most apparent in day-to-day
computing if you try to look inside the home
directory of another user. The systemjust
wont let you do it. Obviously this is a great
feature since it brings a lot of added privacy
and security to the system.
Where its even more important,
however, is in the separation of user and
systemfiles. Most of the time, when
youre logged in as jon or fred, you have
limited access to the systemand can, for
Notice how jon has been replaced by root, to indicate that after su - all our commands will
now be run by the root user, rather than our usual one.
46 LXF151 December 2011 www.linuxformat.com
Conquer the command line
The long and intimidating output of lspci is best captured by redirecting the output to a file.
Mikes top tip
Tired of typing logout or exit every time
youre at the command line? Theres a
handy shortcut. Hit Ctrl+Dat the same time
and youll be logged out of the current shell
session. If you logged in as a normal user
and switched to root, youll be returned
back to the normal user account.
Examples 3
Our final set of examples for this article.
[jon@adam ~]$ su -
Become the root user. Replace - with any
username to switch to that user, although youll
need to knowtheir password.
[root@adam ~]$ cat /var/log/errors.log
As the root user, output the contents of errors.
log to the terminal window.
[root@adam ~]$ cat /var/log/errors.log >> /
home/jon/error-file
Output the contents of the errors.log to the file
/home/jon/error-file, appending the new
data to any existing information in error-file.
[root@adam ~]$ dmesg | grep error
Reroute the output of dmesg to the grep
command, which will then search through the
output and display only lines that contain the
word error. Note that we use > for redirecting
output to a file, and | for redirecting output to
become the input for another command.
happened and then look for its
corresponding entry in this file.
Take careful note of the error message,
and then put it into Google or share it in any
cries for help you make in forums, IRCor
mailing lists. As well as giving more
information to make it easier for others to
solve your problem, youll demonstrate that
youve already done as much of the leg-
work as you can and people will be far
friendlier when helping.
Hardware information
As well as the log files, there are also times
when its useful to provide detailed
information about your systems hardware.
Rather than looking inside a particular
file, there are specific commands that will
output information about all of the
hardware connected to your system. Two of
the most frequently used are lspci and
lsusb, which, respectively, print out a list of
all the connected PCI and USBdevices.
While lsusb might not always be quite
so useful, lspci is incredibly handy as much
of your systems vital hardware is
connected via this technology, including
most graphics and network cards.
If you try running lspci, youll see that
the output it prints out is long and, for the
novice, difficult to decipher. Because of this,
if you wanted to include information about
hardware on a forumor mailing list post,
their awkward-looking names; if you were
brave enough to look inside one with cat or
nano, youre probably feeling even more
overwhelmed as their contents are often
completely indecipherable unless you know
exactly what youre looking for.
While we cant offer you a full rundown
of what every log file does, we can at least
offer some pointers on interpreting
errors.log, perhaps the most useful of the
log files, to ease your worries.
As its name suggests, every error on the
systemis recorded here, along with the
time at which it occurred. So, when facing a
particular problem, note the time at which it
when using the rmcommand, and never
direct it at the / folder).
Nowthat you knowabout permissions,
and howto become the root user, we can
begin to look at howto gather information
about your systemand get help when you
have a problem. Well look at log files first.
While your computer is running, its
constantly recording information about how
its working and problems it encounters. All
of this information is stored in log files,
which are just plain text and kept in the
/var/log directory.
Log files
As your normal user, you can use ls on this
directory and take a look at the files inside.
If you try to open any of these files with a
text editor or print their output with the cat
command, youll get a message telling you
that permission was denied.
This is because the /var/log files are
owned by the root user, as discussed
above. To look inside any of the files, youll
have to use the su - or sudo command to
get root permissions, and then run nano or
cat afterwards.
After using ls, you might have felt a little
overwhelmed by the number of log files and
We can begin to look at howto gather
information about your systemand get
help when you have a problem.
www.tuxradar.com December 2011 LXF151 47
Conquer the command line
The most useful command ever made man. Be sure to run man man to find out how to use
it effectively, and remember that the keyboard arrows scroll through the display.
Andrews top tip
Converting large numbers of audio files
(fromMP3 to Ogg for example) would take
forever using a GUI, so use pacpl instead.
pacpl --to ogg -r -p /home/music/mp3s
--outdir /home/music/oggs will convert all
your non-free music to Ogg files in a matter
of minutes.
help fromother users is dmesg. This
outputs all of the information the kernel
generates, including information about the
boot process and whether or not it
recognises certain pieces of hardware as
you plug it in.
into practice. Theyre an indispensable tool.
Whats really cool is that if you want to learn
howto use man pages efficiently, you can
run the command man man and get the
manual page for the man command.
LXF
redirect it to. Look at this example with lspci:
[jon@adam ~]$ lspci > lspci.txt
The result is that the long list that lspci
usually prints is no longer displayed on the
terminal, but instead stored in the file lspci.
txt. You can check this with nano, or you
can use the cat command which will print
out the contents of any text file in the
terminal window.
Note that a single > will overwrite the
contents of any existing files, whereas
>> will append the newdata to the end
of an existing file an important and
useful distinction.
Another very useful command that
often gets coupled with redirection to get
you meant to remember which programs
take which arguments, in which order, and
have which options available?
Well, thanks to a command called man,
theres no need to remember the ins-and-
outs of every command. Run man, and
pass to it the name of almost any program
on your systemand it will display the
manual page for that command.
These manual pages list all of the
available options, specify in which order
arguments should appear, and many even
provide examples of howyou can put them
Man-to-man advice
you might be better off quoting the entire
output and allowing those more
experienced than you to find the relevant
information.
The question is, after running lspci, how
are you meant to get this text to the forum?
Youre really not going to want to copy it by
hand, and if youre stuck at a text-only
terminal, rather than a graphical emulator,
theres no copy and paste support.
Redirection
Instead, the secret is to use a command-
line trick called redirection. The basic idea is
that you can capture the output of any
command, and redirect it away fromthe
terminal, either to a file or to another
programfor further processing. You can
then forward this file to someone via email,
save it to a USBstick or anything else you
can do with a normal file.
To make this happen, you use either the
>or | symbols, placing thembetween the
command whose output you want to
capture and the file or programyou want to
W
eve covered a lot of information
but, having taken your first
steps, hopefully you nowfeel
more comfortable at the command line. At
least, we hope that if you read articles on
the internet that refer to it, youll have
enough knowledge to sensibly and safely
put their advice into practice.
Before we finish completely, however,
and in the finest traditions of TuxRadar,
theres one more thing. Many of the
commands weve looked at take different
arguments or options, but howon earth are
Chase Douglas is working on bringing
multi-touch and gestures to the Ubuntu
desktop. We caught up with himafter his
OSCONspeech and grilled himabout the
difficulties of working with the XWindow
Systemand the challenges his teamface in taming the plethora
of multi-touch devices.
Linux Format: When youre doing all this work with multi-touch,
do you not feel youre going to be treading all over Apples toes?
In the original iPhone announcement, Steve Jobs talked about the
multi-touch interface and said: Boy, have we patented it.
Chase Douglas: Ima developer and so its best for me to stay away
frompatents, so I dont knowabout them. I just do my work as best I
can its a question for the lawyers!
LXF: You talked a lot in your OSCONspeech about squeezing
and shoehorning all these multi-touch technologies into the
XWindowSystemwhich, as you say, is 24 years old. Has it been a
big problemthat X has been deliberately separated into the
server, the windowmanager and the toolkit?
CD: You know, its not
necessarily a problem. It
presents some challenges,
but it also resolves others.
The biggest challenge is
more the fact that it
defined a protocol a
suite of protocols and
said that everyone must conformto this. We cannot break this or
change this. So we have to deal with backwards compatibility issues
thats the bigger problem, for me at least. Other people might say
that thats a positive it means that you can still run your 20-year-old
application. One mans trash is another mans treasure... We try to be
a more modern environment. We want Ubuntu to be accessible and
obviously we dont want Ubuntu to look like it came fromthe eighties.
LXF: With Xlib applications...
CD: Yeah. So for us its something of a hindrance at this point. But
theres a lot of great things that they did in abstracting the protocols.
I dont want to make it sound like Imdogging on X, or that X is a bad
project, its just difficult to work with in this day and age, due to
certain choices, and thats howit happened.
LXF: But then is it worth all the investment of time and energy,
squeezing all of this into the X stack, when you could just start
with Wayland?
CD: I havent been involved in Wayland myself yet, but I hope to be
soon. The problem, as far as Imaware, is that Wayland is just not
ready. Were trying to develop solutions for today and solutions
that wouldve hopefully been ready by now, so that developers can
start using them. Slowly creating this stack fromthe very beginning
lets get multi-touch into the kernel, lets define a protocol, lets get
device drivers.
We get it through the
kernel, nowweve got to
get it through our
WindowServer... Nowwe
have to get a gesture
stack, nowwe have to
expose those through a
library... OK, well no one wants to use a low-level Clibrary, obviously
thats what you have to start with, so then we have to create
something like Qt QMLor libgrip which is for GTKapplications. So in
onapple lawsuits
Im a developer, so its best for me
to stay away from patents. I do my
work and leave it to the lawyers.
Chase
Douglas
Canonicals user interface
coder spills the guts on
squeezing multi-touch
support into Ubuntu...
www.linuxformat.com 48 LXF151 December 2011
Interview
www.tuxradar.com December 2011 LXF151 49
effect, you have to start somewhere. And Wayland is not quite ready
enough for us to start on. In maybe a year or so, it would obviously
be the choice. But were starting this too early in the transition to be
able to base everything on Wayland. Were just not ready. Qt is
embracing Wayland, and even then, I dont think theyre going to have
full support until Qt 5, which wont be released until late this year or
early next year its not there yet.
LXF: So what can you do at the moment? You have the gesture
engine and uTouch. Say youre writing an app for Gnome or
GTk 3, and you want to include gesture support what do you
have to do?
CD: Weve tried to abstract everything away as much as possible.
When youre writing your GTKapplication or your QMLapplication or
whatever, the theory is, you just need to knowhowour extensions
work. Weve abstracted away X, weve abstracted away the kernel.
So thats at least the good
part. Beyond that, its a
question of: is
your environment
supported natively by
some project that we
have, and if not, can you
get low-level and do C?
So in GTKweve got something called libgrip which is a very
simplistic gesture abstraction library. Its not perfect, but it allows for
simple tasks that you might want, such as two-finger dragging for
scrolling or rotate for an image. What it wont do is multiple gestures
in different areas of the window. You cant easily get at the raw
multi-touch events.
LXF: Can you get co-ordinates for points pressed?
CD: I dont think you can yet through libgrip. You can through X its
like, if youre comfortable going low-level, we have stuff now. Were
taking this next step: OK, weve got our low-level stuff, and we need to
expose this so that its easier.
LXF: Presumably its quite tough writing gesture recognition
engines, because theyve got to be fast you dont want them
suddenly spiking the CPU as theyre working. Presumably theres
a lot of maths involved?
CD: Its actually not that much. Two major things go into the
recogniser itself. The first is simple maths, to calculate things like
distance traversed on a drag, rotation, pinch. Those really arent that
technically challenging and its not too difficult. The second part is
thresholds. When we started out, our target was Unity. You needed to
do deliberate actions, like a three-finger pinch. If you do this [places
two fingers on the table] and move thema bit, its not really a pinch,
so you need some thresholds. Thats the second part of what a
recogniser really is.
The third part were adding nowis the combinatorial logic, but
thats just a bunch of for loops and everything. So it seems more
complicated, looking at it fromthe outside, than it really is... its a lot
of plumbing, hooking things up.
The biggest challenge we have nowis taming some of the devices.
Apples is the best multi-touch hardware that we can get our hands
on. The trackpads in their laptops their Bluetooth trackpad, their
Bluetooth mouse it feels like the best precision, and theyre
extremely verbose. Theyre so verbose, so precise, that in the kernel
we have to filter out some of the messages they send.
Even after that, if you want to print out all of the events that youre
getting fromthe device to a terminal, you start doing stuff and your
terminal is overflowing, and you have to wait 10 minutes for it to stop.
So that ends up being one of our challenges: howdo we get the data
we need, without being too verbose.
I think were pretty safe as far as CPUusage goes. It ends up not
being that much of a hit. When you think of all the calculations that
go into graphics and games, a bunch of that is nowgoing onto a GPU,
but as youre playing a game, theres so much that still occurs every
frame. When you compare that to gestures, I cant imagine that its
using up tons of processor.
LXF: I guess another problemis, youre talking about
super-accurate hardware, but Linux has to work with such a
broad variety of hardware, so youre going to have input devices
that arent so accurate.
CD: Exactly, we face that a lot. Apple hardware is awesome, and I
shouldnt disparage any companies, but... there are some companies
where weve tried to enable their touchscreen support and they have
things like ghosted
touches youre not
touching anything, and it
saysoh, theres a touch
there. Its momentary...
static electricity or weird
things like that. I dont
knowif its calibration
that needs to be improved, but when youre trying to recognise a
two-finger event, and you get a ghost event, the meaning and
semantics of whats being recognised changes and the whole thing
breaks down. The opposite effect, when youre touching the screen
and it momentarily saysthis finger lifted up we have issues there.
We have issues with some trackpads. Some Synaptics trackpads,
the way they work is they give you a bounding box of your touch, so
if you touch with two fingers, you knowwhat the maximumXandY
is, and what the minimumXandYis. But you dont knowexactly
where the touches are.
So when we see those types of devices, we knowwe can do a
couple of things with them: we can do two-finger drag, because you
see the bounding box moving, and you can do pinch, because we see
it collapsing and expanding, but we cant do rotate. You can
heuristically maybe do rotate but its tough.
LXF: With things like less reliable touchpads, there must be a bit
of AI in the code, to say that someone dragging isnt going to lift
up their finger for a tiny fraction of a second...
CD: Thats something that were looking to improve upon. We havent
really been able to spend much time on that yet, but its on our radar.
Were hoping that well be able to solve some of these issues.
LXF
Chase Douglas
onapple hardware
Apple trackpads are so verbose,
so precise, that we have to filter out
some of the messages they send.
50 LXF151 December 2011 www.linuxformat.com
RECYCLE
OLD KIT
Neil Bothwick dusts off some ancient PCs and
discovers theres plenty of life left in themyet.
www.tuxradar.com December 2011 LXF151 51
recycle old kit
The light and fast lXDe desktop can put a
spring in the step of an older computer.
w
hen you buy a newcomputer,
what do you do with the old one?
Do you donate it to a worthy
cause? Decide its no good for anything and
chuck it out? Or squirrel it away in the loft
just in case it ever comes in handy?
While we might struggle to resurrect the
dusty old Spectrumor C64 in your attic,
theres plenty you can do to breathe newlife
into other older machines. Whether its an
outdated laptop that used to runWindows XP,
or a shabby desktop computer from(late) last
century, theres still plenty it can be used for.
The hardware itself probably works fine,
but software moves on and then the hardware
struggles to keep up. Theres a flavour of Linux,
though, that can work on almost anything
even if it seems limited by todays
expectations. And its not just old hardware
that can be recycled; theres quite a bit of
relatively low-powered newhardware ie Intel
Atom-powered netbooks and other compact
devices and some of what we say here could
be applied to themas well.
Acomputer fromabout seven or eight years
ago would typically have come withWindows
XP, maybe 512MBof RAM, possibly only
256MBfor a laptop, and a relatively slow
processor, even a sub-1GHz Celeron.
Nowadays that seems a very limited spec,
but we managed to do a lot with computers in
2004. The key factor is the desktop: Gnome
and KDE are just too demanding. However,
there are plenty of other desktops and window
managers that use less resources, such as
LXDE (http://lubuntu.lafibre.info).
Most distros have LXDE available, although
that may involve installing with the default
desktop and then replacing it with LXDE. This
would be demanding of both memory and
hard drive space.
Lubuntu is an unofficial Ubuntu respin which
uses LXDE by default. There are two versions:
the standard 32-bit release and the Minimal
Disk Space version. They both give the same
installation, but the standard Ubuntu installer
uses a lot more disk space during installation.
The space is freed up afterwards, but thats no
help if youre very lowon space to start with.
Installing fromthe min-disk-space ISOhelps.
LXDE is much faster than Gnome or KDE
and, more importantly for older hardware, uses
less memory. However, its almost as flexible as
Gnome, although configuration can be a little
more involved. For example, theres no editor
for keyboard shortcuts instead you
have to edit the configuration file at
~/.config/openbox/lxde-
rc.xml to add or alter
keybind sections. The default file contents
make it clear what to do. Theres also plenty of
useful help on the LXDE wiki at http://wiki.
lxde.org. The location of this gives away LXDEs
heart, that it uses the Openbox window
manager, so if you find an attractive Openbox
theme, you can use it with LXDE.
See alSo
There are plenty of lightweight window
managers and desktops available. Afewof the
more popular ones, which will be available in
the package managers of most distros, are:
Xfce, IceWM, fvwm2 and Enlightenment (e17).
Do it yourself
You dont have to use Lubuntu to get a
lightweight LXDE desktop. If you already have a
distro installed but find its desktop too slow,
you can simply install LXDE, log out and back in
to your newdesktop and then uninstall the
heavyweight you were using before. It doesnt
actually do any harmto leave thebig desktop
installed, although it will use up a good sized
chunk of your, probably quite small, hard drive.
If you really want a slimmed down distro,
and are prepared to spend a little time on it, you
can build the desktop fromscratch. Something
like the Debian network install CDcontains only
the basics to get the installation started, it then
downloads whatever you want to install.
The what you want part is important this
defaults to installing only the basics for a text
interface, everything else is optional. Pick a
lightweight desktop and only the programs you
knowyou will use, as any dependencies will be
installed for you, and you can create a very
slimline system.
You dont have to use Debian for this,
although its a good choice (think Ubuntu
without all the bells and whistles). You could
also use Slackware, Arch or even Gentoo to
build a customised lightweight system.
One limitation of older computers is storage
space. Hard disks were small, slowand
expensive. Thats not a problemthese days if
you have a decent internet connection, as there
are plenty of cloud-based solutions that let you
store your emails, music, photos and
documentsout there, reducing the demands
on your hard drive.
Incidentally, the hard drive is probably the
most likely component on an old computer to
die with little or no warning, so storing your data
on an online, and hopefully more modern,
systemis also good insurance.
LiGhtEn thE LOAd
52 LXF151 December 2011 www.linuxformat.com
NetworkedAttached Storage (NAS) can be
quite inexpensive but essentially its just a low-
powered computer. Cheaper NAS servers also
have no built-in storage, relying on external USB
hard drives, which means you have yet another
power adaptor and more trailing cables more
if you want to use multiple drives. Even the
smallest mini-tower case can hold three hard
drives, all you need is some suitable software.
Openfiler is a specialist distro that turns a PC
into a NASserver. As were working with an old
computer that probably has a small hard drive,
we can install Openfiler to that and add one or
more larger drives for storage. If the computer is
more than 10years old check the maximum
drive size your BIOScan handle and whether
theres an update, before splashing out on a
couple of 2TBdrives for a super RAIDarray.
Openfiler uses Red Hats Anaconda installer,
which is straightforward even if you havent
used it before. If youre using a single hard drive
for both the systemand storage, manually
partition the drive create a root partition of
about 300MB, a swap of twice the RAMand
leave the rest of the drive unallocated for now.
During installation youll be asked to set a
root password. When you reboot it boots to a
login prompt, dont login here. Just above the
prompt is the URLof the web interface, which
you can access fromany browser on your
network. This doesnt use the root login you
created during installation, the web interface
has its own login of openfiler with the
password of password you should change
this! Go toAccounts >Admin Password.
Go toVolumes >CreateANewPhysical
Volume and add a partition. If youve added a
second drive for storage, or are using
unallocated space on the systemdrive, youll
need to create the partition here first. Then go to
AddVolume, type in a name for your volume
group (Openfiler uses LVMto make adding
further storage easy) andaddyour newpartition.
ClickAddVolume again and create a volume on
your newvolume group. This may take a minute
or two as the filesystemhas to be formatted.
To share this you first have to add a
set of network addresses that are
allowed access. Do this under
Network Access Configuration on the
Systemtab. This would be something
like a network address of 192.168.1.0
(if your home network uses
192.168.1.* addresses) and a
netmask of 255.255.255.0.
Go to the Services tab and enable the
sharing methods, usually NFS for Linux and
SMB/CIFS for mixed networks. Then go to the
Shares tab, click on your newly-created volume
and create a sub-folder (root folders cant be
shared), click on that and set Share Access
Control mode to Public and Host Access
Configuration to match. Press update and you
should be able to access your shared directory
fromother computers on the network, using
whatever network browser they come with. If
using SMB, youll need to set the workgroup in
Openfiler to match your Windows computers.
See alSo
FreeNaS www.freenas.org
Its based on BSDrather than Linux, but one of
the advantages of FreeNAS is that its small
enough to install to a USBstick. This makes it
a good choice for a laptop where you can put
FreeNAS on the stick and use
the internal drive for the
storage.
openfiler turns an old computer into a NaS
device, letting your network share files.
Puppy linux will have your old hardware
bounding around like a, well, puppy...
GO EvEn LiGhtEr
If even LXDE is too heavyweight for your old
hardware, there are some really lightweight
distros out there. The 130MBsize of the Puppy
Linux live/installation CDgives an idea of how
slimthis distro is, but its also very fast and
responsive (http://puppylinux.org). It uses
the unpopular JWMwindowmanager but its
set up to work well in Puppy.
Puppy can be run direct froma CDor USB
stick, using a hard drive or the USBto store
data and settings, or you can install it to your
hard drive. The first step is to run GParted from
Menu > Systemand set up two partitions: a
standard Linux ext3 or ext4 partition for most of
the disk; and a swap, which should be between
one and two times the size of your RAM.
Run the installer fromMenu > Setup >
Puppy Universal Installer and select the
partition you just created. If youll only be using
Linux, choose the full install. The frugal install is
basically still a live CDbut booted fromthe hard
drive. The installation does not set up the
bootloader, you must followthe instructions for
running Grubconfig at the end. If youre using
only Linux on this computer, the defaults are
fine, apart fromGrub destination, which is best
set to MBR.
If the desktop fails to load, run xorgwizard
fromthe command prompt, followed by xwin. If
you had to do this with the CD, youll almost
certainly need to do it the first time you boot
fromthe hard disk. Despite being so light, Puppy
contains a full set of graphical config tools; the
only caveat is that it runs as the root user.
Linux likes memory, and the more you have,
the more it uses. Any that is spare is used to
cache data, improving performance. There are
two consequences of this: if you can add more,
do so it will make it faster and smoother.
Secondly, dont waste it on unnecessary frills.
Whatever distro you use, check its startup
services manager and make sure anything you
dont need is not running. If you dont connect
to multiple wireless networks, get rid of
NetworkManager and use the standard config
tools for the one network you do use. If you
dont use a printer, dont have CUPS running
(you can print to a printer on another computer
without the CUPS server). Most importantly, if
the services you run all work in the background,
turn off the X desktop in the services manager.
If you want to stick with the distro you
already have, and its been installed for some
time, a reformat and reinstall may improve
performance. At the very least, uninstall any
software you dont need and use Bleachbit
(http://bleachbit.sourceforge.net) to clean
up your hard drive.
nAS SErvEr
recycle old kit
www.tuxradar.com December 2011 LXF151 53
Turn a computer into a jukebox with MPD and control it from
another computer, a mobile phone, or even a Cron job, to switch
playlists to set the mood for the time of day.
diGitAL jukEbOX
dOwnLOAd cEntrAL
Weve looked at MythTV in a recent
issue, and an old computer could
make a reasonable MythTV front-end,
provided it had a decent graphics card
and was not too ugly or noisy to put by the
TV. Unfortunately, the former rules out most
old laptops while the latter rules out the
desktops. However, theres another
entertainment use that even the least powerful
of computers can handle: playing music.
Music Player Daemon, or MPDto its friends,
is just what it says, a daemon that plays music.
Were back into classic server/client territory
here. MPDis a server that plays music, along
with the associated management of collections
and playlists. Its a server back-end so it will run
on very basic hardware, as it doesnt need a
desktop, and the hardest thing youll ask of it is
to decode MP3 tracks, something even the
most basic of mobile phones can do.
Looks dont matter
It also means it doesnt need to be an attractive
box, as long as its within speaker-lead reach of
where you want to listen to the music. All
control is done by a front-end, of which there
are many, covering a full range of platforms.
You could control it with one of several MPD
clients, such as gmpc, qtmpc or ncmpc,
running on your Linux desktop, complete with
albumart, lyric display and biographical
information about the artist. Or you could use
one of the clients for
smartphones, my
favourite being MPDroid.
After installing MPD
fromyour distros
repositories, theres very
little configuration to do.
Edit /etc/mpd.conf and
set music_directory to
the top-level directory
that holds all your music
files. Also make sure that
db_file has been set.
The default location is
fine, just make sure the
setting is not
commented out. Start
the mpd service, or
restart if its already
running, then install a
client on your usual computer. Any of the
previously mentioned clients, using GTK, Qt or
an Ncurses display respectively, will be fine. Set
the server address to the hostname or IP
address of the server you just set up, the port
should stay at the default of 6600, and press
Connect. The client should connect to the
server but may report that no music is
available. If so use the clients option to update
the database, which will cause the server to
scan the music directory you gave it and build
an index of all the tracks it finds in any formats
your systemsupports. You will need to do this
any time you add songs to the server, or you
can set auto_update to yes in mpd.conf.
Nowselect a song and it should start
playing fromthe server. If you have anAndroid
phone, install MPDroid to provide a portable
controller for your newjukebox.
See alSo
ampache (http://ampache.org)
is a web-based music player, running on top of
the Apache web server.
While older computers are less efficient than
their descendants, they still use less power
overall. If you have any tasks that need to run
24/7, using your old hardware could save you
money. Old hardware is more than capable of
running a BitTorrent server, using something
like Transmission, and you dont even need a
GUI as it can be controlled froma web browser.
Transmission
After installing Transmission, the settings in
/var/transmission/config/settings.json
need a little tweaking. The key settings include
download-dir, which needs to be set to
somewhere with plenty of space (not an issue if
you have everything on the root filesystem).
To avoid Transmission saturating your
internet connection and making anything else
unusable, reduce the settings for peer-limit-
global and peer-limit-per-torrent 100 and
10 are reasonable starting points for a decent
broadband connection. You should also
change speed-limit-down and speed-limit-up
to leave enough bandwidth for your other
activities. Ideally, these should not exceed 75%
of your actual available bandwidth (not
necessarily the figure your ISPclaims). Finally,
set watch-dir to a directory accessible from
your other computers, such as an NFS export,
and set watch-dir-enabled and start-added-
torrents to true.
These last settings mean that you can save
a torrent file into the watched directory from
any computer on your network and
Transmission will immediately start
downloading it.
Some of these settings can be configured
fromthe web interface point your browser at
http://hostname:9091 or you can run the
Qt or GTKTransmission client on your desktop
and tell it to use the remote
server. Other settings you may want
to experiment with include the scheduler,
which means you can use all your bandwidth
when you are asleep and leave more for general
use when you are awake, assuming you have a
regular sleep pattern.
See alSo
Another BitTorrent server with a web interface is
Deluge (http://deluge-torrent.org) or you
could run a curses client such as RTorrent
(http://libtorrent.rakshasa.no) over SSH.
LXF
what else?
There are lots more tasks that an older
computer can easily handle, especially the sort
of things that require no GUI, or even monitor,
so the computer can just sit in the background
and get on with its newjob.
Examples include an Asterisk PBX
server (as we covered recently);
a centralised print server for your
network; a firewall/router; or any
sort of service that is used by
other computers on your desktop but that
doesnt rely on keeping your main desktop
computer turned on to provide it.
Unless the computer is really old and
limited, theres no reason why you couldnt
use it to performseveral of the tasks
covered here.
Whatever project you decide
to try, your old hardware can do
far more than collect dust.
Use an online
service like
Prey to track
or disable your
computer or
phone, after
its been lost or
stolen.
are services such as Prey (http://preyproject.com) that
can be used to track, shutdown, lock, or even wipe your
device should it goAWOL. Prey can even use a laptops
webcamto take a photo of the thief and send it to you
when they go online.
04
Sync your
computers
Use Unison to keep your
laptop/netbook and desktop
in sync, or even your work
and home computers. Not
only does it provide you with
a backup of everything, it also means you never suffer the
file I need is on my other computer headache. Get into
the habit of running Unison before you leave or shutdown
a computer.
05
Beware the cloud
Cloud storage can protect your data fromlocal
hardware failure, but what about prying eyes? Its not
enough for the company to encrypt your data, if it can
decrypt it to send to you, an employee can read it. Use
local encryption for important data.
06
Experimental filesystems
It can be fun to experiment with newfilesystems
such as Btrfs, but dont use themfor anything important
until you trust themcompletely. Use a separate partition
for data that is either disposable or can be recreated, such
as your collection of CDand DVDrips or for your
experiments, and stick to the reliable standards for the
likes of /home.
07
Cloud backup
There are many options for storing your data in
the cloud: Gmail or Flickr, for example, for mail and
photographs respectively, or Dropbox for just about
anything. Some services are free and that means you
get the guarantees of service that you pay for. Its also
important to remember that your data is on someone
elses computer if it contains anything private, encrypt
it. And use decent passwords, both for the service and for
the encryption.
01
We still use tar
Back up with tar. The old ones are the best, and a
full backup of your home directory with tar is easy to do
and easy to restore from. Put it on a USBstick, external
drive, cloud server, or just another computer and youll
always have a safe copy of your precious data collection.
02
RAID your drives
ARAIDarray wont
be of any use if you
accidentally delete some of
your files, but it will offer you
some protection if your hard
drive fails. Most distros can set up RAIDwhen you install,
and a second hard drive is a cheap investment, at least
on a desktop. And, as a bonus, it can improve your
machines performance.
03
Security after the event
With increasingly sensitive data being stored on
portable devices, especially smartphones, there are more
reasons to protect themand lots of different ways to do it.
Apart fromthe obvious use of passwords and PINs, there
18
Prey can even use a
laptops webcam to take
a photo of the thief.
Data
Security
steps to better
Data security
54 LXF151 December 2011 www.linuxformat.com
Thejewel inyour computerscrownisnt theOS, or thehardware, itsyour data,
someof whichmight beirreplacable. Neil Bothwickhassomesafetytips...
08
Encryption
If you have a laptop or netbook, you really should
use encryption. Ubuntu can use eCryptfs to encrypt the
contents of your home directory, while other distros have
options to encrypt the entire hard drive. The effort it takes
to decrypt it all, even on a modest netbook, is far
outweighed by the reassurance that no one else can log in
to your bank account.
09
Beware the actual crash
Protecting your laptop fromtheft is important,
but dont forget the risk of accidental damage. Adecent
protective case or sleeve for your machine could mean the
difference, if you drop it, between a computer and an
expensive paperweight.
10
Schedule backups
Backing up is one of those things you were just
about to do when everything went wrong. Dont rely on
your self-motivation, use a scheduled backup program(or
even a Cron task) to do the job for you. It wont forget (as
long as the computer is switched on), wont decide to
watch one moreYouTube clip or have another cup of
coffee before getting round to it. In short, software is more
reliable than you are.
11
Should you trust Gmail?
Not that theres anything wrong with Gmail, but you
are giving Google permission to read all of your emails,
and thats what Google does best reads other peoples
stuff and makes it available in another formto its
customers. Other webmail services carry similar risks, but
Google is best at it, so if privacy is a concern, keep your
mail local.
12
Off-site storage
Keeping backups of your data on a DVDor an
external drive at home will help if your hardware fails or in
the case of an ID-Ten-Terror,
but theyll be no use if your
home or office is physically
damaged. Offsite backups,
even if not as frequent, are
good insurance. Cloud
storage is one option, or you
could leave backups with your family anywhere far
enough away to be safe, but near enough to be useful.
13
Create extra users
Do your family or friends ever ask to use your
computer? If you let someone else loose on your machine
create an extra user and make sure they use that identity
when they log in. It avoids the risk of themdeleting, or
reading, something they shouldnt. It also avoids them
accessing your Facebook or Twitter account via your
browsers automatic login.
14
Image backups
When you intend to do something major, such as
install a newdistro, use a disk imaging tool, such as
Partimage or Clonezilla, to make a complete disk backup.
That way, if you dont get on with your newdistro, or it
doesnt get on with you, you can go back to the way things
were. After all, some people like Gnome 2!
15
Encrypt and sign email
You wouldnt send private information on a
postcard, yet email is sent as plain text, via whatever
servers are deemed necessary to get it to its destination. It
can be read at any point on its journey, unless you use
encryption to make it unreadable and digital signing to
ensure it has not been touched. This may be OTTfor your
subscription to your local LUGmailing list, but not for
financial or business correspondence.
16
Viruses are real
Are there any serious viruses for Linux? No. Does
that mean we can be complacent? Of course not. Apart
fromthe threat posed by Windows viruses on dual-boot
systems, there have been
enoughharmless Linux
malware examples to
illustrate that its important
to be aware of the risk.
Dont fall into the trap of
thinking that permissions
will protect you froma virus that runs as a user
userspace is where all your really important data lives.
17
Use an external drive
Hard drives are cheap, memories are not. An
external hard drive is a wise investment to preserve your
photos, videos and music as long as you remember to
copy everything to it and keep it somewhere safe.
18
Dont leave it on a train
UKgovernment departments seemto make a
habit of leaving laptops and hard drives full of sensitive
data on trains or in coffee shops. Amazingly, they seemto
manage to walk away with their wallets and their keys,
though, so the solution is simple: be more careful. Or use
one of those Bluetooth gadgets that beeps when you walk
out of range.
LXF
Hard drives are cheap.
Memories are not. Its
a wise investment.
A full image
backup with
Clonezilla lets
you change
your mind after
installing a new
or updated
distro.
Data security
www.tuxradar.com December 2011 LXF150 55
56 LXF151 December 2011 www.linuxformat.com
Inside Mandriva
T
he distro now known as Mandriva has been
making headlines since its inception
unfortunately not all of the press has been
flattering. Its the distro the community first loved,
and now just loves to hate.
Way before Ubuntu and the current slewof desktop-
friendly distros when running Linux on your desktop
was a measure of your geek cred the technologically
challenged turned to Mandriva. Over the years it grewin
popularity, one man went on to forma firm a company
that would later showhimthe door.
But theres more to Mandriva than what goes on in
the boardroom. Its still one of the easiest distros for
Linux newbies. Sure, Mandrivas fortunes have been on a
downward spiral for quite some time, but the newteam
has managed to shrug off cash-flowproblems and
technological traumas, and its latest release is filled to
the brimwith features.
Sacked developers, financial headaches and technology trials its
been a tough year for Mandriva. Mayank Sharma investigates...
Areversal of fortunes
www.tuxradar.com December 2011 LXF151 57
Inside Mandriva
M
andriva started life as Linux-
Mandrake way back in 1998. The
first version was based on Red
Hat 5.1 and it was the first distro to bundle
KDEs 1.0 release. Features such as the
ability to auto-mount CDs without messing
around with configuration files brought
convenience to Linux distros.
The project was a success and later
that year lead developer Gal Duval,
along with a bunch of other developers,
created MandrakeSoft.
In 2001 the company decided to go
public, announced an IPO(Initial Public
Offering), and began trading on the March
Libre exchange in Paris. It faced its first
major cash issue in late 2002 and asked its
users to bail it out by subscribing to a paid
service offering extra benefits, such as early
access to releases and special editions.
It wasnt enough and inJanuary 2003
MandrakeSoft filed for dclaration de
cessation des paiements the French
equivalent of bankruptcy protection.
At the end of 2003, MandrakeSoft
announced its first quarterly profit and, in
March 2004, a French court approved its
plan to emerge frombankruptcy and return
to normal operations.
By nowMandrake had grown popular
enough to attract the attention of the US
publisher Hearst Corporation, which owned
the trademark of the comic-book character
Mandrake the Magician. Hearst sued
MandrakeSoft for trademark infringement in
Into the cloud
MandrivaSync is to Mandriva what Ubuntu One
is to Ubuntu andApple iCloud is to Mac OSX.
The service allows users to mark data and keep
it offsite on Mandriva servers, and to
automatically sync it to other devices that have
the MandrivaSync client. Although
implemented in Mandriva 2011, the service is
currently in beta, and the developers dont
recommend it for everyday work.
Explaining the theory behind the
service, Dmitry Komissarov, Mandriva
board member, says that the idea is
to have the MandrivaSync client
on the desktop, and mobile
devices such as smartphones
and tablets, to enable the user to
sync files between them.
Synchronisation will either be
automatic or manual. If the shared file
in one of the devices has changed, it
will automatically replace the older
version on the server. If, however,
there are conflicting versions, the user will be
offered a choice. Currently the service is limited
to sharing files such as documents and photos,
but the plan includes the ability to sync meta
objects such as app settings and bookmarks.
The service currently offers 2GBof free
space to every Mandriva user. Shared data can
currently only be synced with other
installations of Mandriva 2011 but an Android
client is expected in January 2012. Unlike
Ubuntu One though, there will be
MandrivaSync clients for other
operating systems such as Mac
OS andWindows.
Komissarov says that in the
future restrictions will be on the
channel bandwidth between the
client and the server rather than
on the volume of data stored and shared.
This is to discourage filmsharing, while
making it more convenient to share smaller
documents, photos and videos.
Mandriva 2011 can be used both as a live
DVD and an installable DVD.
the distros name, as well as for its hardware
configuration tool Lothar, another of
Hearsts characters. MandrakeSoft lost and
was forced to concatenate Mandrake and
Linux to Mandrakelinux and change its logo.
Over the years, MandrakeSoft acquired a
host of companies. Of note, were Edge-IT, a
French corporate support company that
was to have a much larger impact on the
distribution later on, and the Brazilian Linux
distribution Conectiva, after which it
changed the name of the company to
Mandriva and its distributions name to
Mandriva Linux.
In 2006, after several more acquisitions,
including the Lycoris distro and the
enterprise software infrastructure company
Linbox, Mandriva laid off several employees
including Duval, the companys lead
developer and co-founder.
Amidst all the booing, the company
continued spitting out distro releases and
created a niche for itself in the so-called
BRICcountries (Brazil, Russia, India and
China), as well as France and Italy. It
continued hovering among the top 10
distros on Distrowatch.combut struggled to
keep its balance sheet in the black, even
after a round of funding in 2007.
In May 2010, Mandriva announced it was
up for sale, claiming that selling the
enterprise was the only alternative to closing
it down completely.
The following month, the company
announced it had been saved, yet again, by
newinvestors and in September Mandriva
sold a controlling stake to a Russian
company called NGI, and announced that
while it intended to continue working on its
server products in Europe, development of
its desktop distro would be moved to one of
the BRICcountries.
Following the deal, Mandriva liquidated
its subsidiary Edge-ITand laid off its
employees. It later emerged that many of
the core Mandriva developers were
technically employees of Edge-IT.
Soon afterwards, those former
employees forked Mandriva and created the
non-commercial Mageia project. The
Mandriva community had in the past
suggested that the distribution should be
split in two, much like Red Hat Enterprise
Linux and Fedora, but the plans never
materialised. (You can read about the
workings of the Mageia fork in LXF149.)
In a blog post, Mandrivas then CEO
Arnaud Laprvote assured users that
Mandriva is alive and briefly mentioned
newproducts, including Mandriva 2011,
which was released onAugust 28 this year.
Newteam
After the sale to NGI, Mandrivas structure
changed: the CEOwas replaced by a board
andArnaud Laprvote took over as
president. InJuly 2011 he was replaced by
Dominique Loucougain. Alongside him,
Dmitry Komissarov andValentina Gorina
make up the Mandriva board.
Komissarov is also CEOof the
Russian firmPingWin Software, an
active member of the Russian
Association of Free Software.
He explains that, as of
now, there are three
groups of developers
working on Mandriva, in
France, Brazil and Russia.
The Russian team,
headed by ROSALaboratories,
focuses on the design elements
of the distro and its interface.
58 LXF151 December 2011 www.linuxformat.com
Inside Mandriva
It employs UI designers and a large
number of testers.
The Brazilian teamat Conectiva
concentrates on the development of the
platform, while the French teammaintains
infrastructure and provides support to
installed systems in the enterprise and
government. Ateamof developers from
Russia and Brazil are also working on a new
build-systemfor Mandriva.
Eugeni Dodonov fromthe Brazilian
teamwas the release manager of Mandriva
2011, until he left for Intel in July 2011, and
passed the baton on to Denis Koryavov of
ROSALabs.
Komissarov insists that having a team
of developers spread across three
countries doesnt hinder development. He
adds that although the Russian teamwas
the last to join, having a clearly defined
scope for all the teams not only helped
themget started on Mandriva 2011 without
any delay, but also helps themcollaborate
with each other.
This is evident fromDodonovs reply to a
comment on the Mandriva blog, where he
wrote that the Digikamphoto manager,
which was included in the early beta
versions, was replaced by Shotwell on the
request of ROSALabs for design and
usability concerns.
New release cycle
Talking about Mandrivas newrelease
cycle, Komissarov says that preliminary
testing of versions (alpha, beta, release
candidates) involves hundreds of people
and takes about six months. For Mandriva
2011 there were eight releases before the
final version, and the entire process involved
more than 200 testers spread over 28
towns in 10 countries, who solved more
than 2,000 issues.
Major releases such as Mandriva 2011
require a huge amount of infrastructure.
According to Koryavov, the developers
produced more than 1,500 ISOimages for
testing, although not all of themwere
available publicly. Testing the images
involved downloading more than 10TBof
data. Once testing was finished the official
release was announced and every official
version of Mandriva Linux will nowbe
supported for 18 months.
Mandriva 2011 was aimed at home
desktop users and the developers are now
working on a November LongTermRelease
(LTS) version for the enterprise that will be
supported for three years.
Komissarov explains that the LTS release
probably wont have bleeding edge software
but will most definitely be a lot more stable,
which works well for businesses.
New features
Mandriva 2011 has a host of notable new
features. It uses the KDE desktop, but has
revamped the UI of most of its
components and also added some new
tools. Based on experience, Komissarov
says that while KDE is a great desktop
environment, its broad range of settings
may confuse inexperienced users. He cites
the example of an experiment wherein a
KDE-based distribution was used to teach in
Russian schools. The project had to be
abandoned because students and teachers
were confused by its various settings.
Mandrivas main challenge while designing
the newinterface was to keep things simple
for newusers, and expose just the right
amount of settings.
Komissarov says the
teamspent a
considerable amount of
time investigating the
behaviour of an average
desktop user in a bid to
create a distro with
virtually no learning curve. It found that
users are more productive and prefer
running applications in full-screen mode.
SimpleWelcome is the main element,
which will be developed further its not
only a programlauncher but also a universal
container for other original
components that are in
the pipeline.
Whats RPM 5?
RPMis one of the two most popular package
management systems for Linux. Although
originally designed for Red Hat Linux, it is now
used by many distributions. Currently there
are two versions under active development
rpm.org (or RPM4) and RPM5.
RPM4 is used by many distributions
including Fedora, Red Hat Enterprise Linux,
OpenSUSE and CentOS. Former RPM
maintainer, Jeff Johnson forked the original
systemand works on RPM5, and Mandriva is
the first major distro to adopt the newformat.
Komissarov believes RPM5 offers significant
advantages over RPM4 and the switch seemed
to be motivated by a number of considerations.
Besides an active community, many viewed
RPM4 as relatively closed and dominated by
Red Hat. Mandriva was already patching RPM4
for its own needs, and its RPMmaintainer Per
yvind Karlsen was very vocal on
Mandrivas Cooker mailing list in
his support for RPM5.
Furthermore, argues
Komissarov, some of the
features in RPM5 were
attractive to Mandriva, such
as support for soft
dependencies to resolve
package issues. This would
allowdevelopers to create a tool
to update a distros full installation
with a single click.
RPM5 also gave Mandriva a very flexible
packaging system, letting it disable packages
depending on a countrys software licence. It
uses this flexibility to enable proprietary
plugins and drivers in a Russian version of its
distro, known as ROSADesktop.
The new Kickoff menu looks similar to the
new Gnome 3 Activities and Ubuntus Unity.
The new package manager is still in heavy
development and not in the default install.
The entire process
involved more than 200
testers in 10 countries.
www.tuxradar.com December 2011 LXF151 59
Inside Mandriva
Mageia or Mandriva?
TimeFrame a newutility added to
Nepomuk visualises files in your home
directory based on the time they were
created or modified. This saves you the
trouble of having to look for files buried deep
within multiple folders.
RocketBar implements a software-
oriented interface that is more convenient
and easier for users to understand.
Research by Mandriva suggests that a
typical user works with an average of about
12 apps. The most used are on the panel and
those used less often are stored in the
history of Last Used apps, which lets users
access the apps in one or two mouse clicks.
StackFolders resembles the stacks
feature in Mac OSXand Komissarov
believes that users who work with a large
number of documents will find this
particularly useful. Mandriva 2011s new
installer has simplified the installation
process by implementing the concept of
pure choice. While it wont please some
advanced users, Komissarov believes that
most people are only confused by the many
installation options in
Linux distro installers.
There have been
changes to various other
parts of the desktop as
well, and many are still
under active
development. The absence of the option to
switch between multiple desktops is just one
of the changes to the systemtray, which will
be further tweaked in upcoming releases.
Newcommunity
Mandriva has always had a strong
community of users and developers.
Community manager AdamWilliamson
really invigorated the scene until he was
asked to leave in December 2008.
The regular rounds of lay-offs obviously
took their toll, but it was the liquidation of
Edge-ITand the subsequent fork into
Mageia that really made the community lose
confidence in Mandriva. Komissarov points
out that by the time he got the opportunity
to influence Mandrivas future, a core team
of developers had already gone, and with
themwent the community.
Having a community is important, but
first Mandriva needed a product worth
rooting for. Explaining the newteams
priorities, Komissarov says it was important
to find a newvector of development, and
create a distro which focused on usability
and design.
He thinks Mandrivas focus on usability
will attract a community like the Italian
Mandriva International Backports
(http://mib.pianetalinux.org/mib).
The MIBis actively involved in Mandrivas
Assembly, and provides a repository of
packages for many Mandriva releases.
During the entire development process,
Mandriva always looked to the community
for feedback in addition to testing the
various pre-releases, it also asked for
suggestions for its newbuild system.
Viacheslav Kaloshin, CTOof PingWin, has
kept the community abreast with the
development of Mandriva 2011 via the
official blog.
Mandriva is at the beginning of a new
journey. The distro is built. Komissarov
knows that whats important nowis building
a newcommunity.
LXF
Mandriva review: page 22
Distrowatch: page 38
KDE components such as KDM and Dolphin are visibly different. Even in beta MandrivaSync works as advertised.
Up until the release of
Mandriva 2011, there were hardly
any differences between the parent distro
and its progeny. Now, the two are quite
different, both inside and out, and these
differences will only grow in subsequent
releases. So which should you use?
While both appear to cater to the desktop
user, they approach the target user in different
ways. For example, Mageia leaves the choice of
desktop to the user, while Mandriva nowonly
supports KDE.
Mandriva 2011 has switched to RPM5,
whereas Mageia 1 uses RPM4 and will probably
stick with it in Mageia 2. One thing that might
change in the next Mageia release is its init
system. Like most distros, including Mandriva
2011, it could move to SystemD.
And thats the key. You can have a say in the
future of Mageia. Its founders have been very
clear that its a community-controlled,
community-governed project. Mageia will
definitely not automatically adopt changes that
Mandriva makes.
Mandrivas strategy in this regard has to be
seen. While it has expressed its desire to
listen to its community of users and
developers, being headed by a for-profit
company or a board thats answerable to
shareholders, we dont expect it to open up all
its component choices to users. And this is
not always a bad thing.
Mandriva has always
had a strong community
of users and developers.
What on Earth Do Not Track
60 LXF151 December 2011 www.linuxformat.com
Q
Whats this Do Not Track business all
about, then? Stalking people?
A
Its not about tracking in real life. Its about
tracking on the internet, and while its not
quite the equivalent of stalking, almost
everything you do online is tracked by
someone, somewhere.
Q
Really?
A
Yes. When you visit a web page, theres a
good chance that it contains tiny images
or invisible code that exist for the sole purpose
of recording your browsing habits. Do Not
Track is meant to protect you fromthis.
Q
Howexactly do the advertisers do that?
A
There are several different methods they
can use. In the past, the most common
was to place a cookie on your computer which
contained a unique ID. Now, advertisers are
using less visible and harder-to-manage
techniques, such as browser fingerprinting and
LSOs (otherwise known as Flash cookies).
Q
And then when you visit another site?
A
If the same advertisers are present on
another site that you visit, then theyll look
for that same unique IDor fingerprint. If they
Q
Were not just talking about what I put in
my shopping basket, are we?
A
No, thats right. The kind of tracking were
talking about is where third-party
companies, advertising groups rather than
website owners, record your visits and habits
across many different websites.
Q
Hmm, that does sound a bit more
disturbing. Howdoes it work?
A
When you visit a site thats given
permission for advertisers to put their
special images or code on it, they record and
uniquely, althoughanonymously, identify
your computer.
What on Earth is
DoNot Track?
Jonathan Robertsexplains howto
keepadvertisers off your trail with
thelatest browsingprivacyfeature.
What on Earth Do Not Track
www.tuxradar.com December 2011 LXF151 61
find it, then theyll add a record of your visit to
that site to your unique IDs record.
Q
I guess the big question is: why?
A
To make money, really. By being able to
build up a picture of what youre interested
in, they can offer targeted adverts when you
visit sites that they operate on.
So if you were checking out the
specifications for a laptop in the morning, you
might see an advert for that laptop in the
afternoon. The advertisers think that targeted
adverts are more useful to users, and that
youre more likely to click on them.
Q
Oh, is that all they use it for then? I dont
really mind that.
A
Alot of the time its a useful feature but
not always. What if you were visiting a job
site, looking for information about an
embarrassing medical condition, or even just
shopping for a surprise birthday present? In all
these situations, those convenient targeted ads
can be quite inconvenient.
Q
I didnt think of it like that!
A
No, and theres more too. The advertising
company has managed to amass a lot of
data about you that you wouldnt share with
anyone else, except for your doctor or close
friends and family. What if it gets hacked, or if
youre just not comfortable with that idea?
Q
Then Id want a way to insist these
companies dont track me, and dont
store any information about me.
A
Me too, as do many others, and this is
exactly what Do Not Track is meant to do.
Q
So howdoes it work?
A
Its very simple. When you visit a website,
along with the request for content, your
browser includes a HTTPheader. This contains
all kinds of useful information, such as the
website you were on previously, information
about your computer and its configuration, and
much more.
Q
Ah, and this Do Not Track thing, it gets
included in the header?
A
Exactly. All the browsers that have
included the feature also send a line that
says DNT:, followed by a 1 if youve got it
enabled, and a 0 if not. This is then really
simple for the website, and for the advertisers
to detect, and they should change the way they
act accordingly.
Q
Should change the way they act?
A
Yes, theres a bit of a problemwith this
plan. Do Not Track is technologically
thats visible to every single website. This
means it doesnt rely on each advertiser
developing its own system, which users then
have to discover.
Q
Anything else?
A
It also means that theres one way to
opt out for every kind of tracking. If the
company can see it, they should disable all the
different kinds of tracking, not disable one and
leave others on.
Q
But this all still depends on advertisers
doing the right thing?
A
Youre right, but theres one other
advantage that Do Not Track has. Its been
implemented by almost every web browser
and, because its got momentum, its got the
support of the European Commission and the
Federal Trade Commission in the United States
of America.
These regulatory bodies are pushing
advertisers to support the standard, and have
threatened to introduce legislation if they dont
act voluntarily.
Q
Excellent. So Do Not Track is one prong
of a two-pronged attack?
A
Yes, between technical and legislative
measures, the internet should become a
much more secure environment for users to
operate in.
Q
Great! Howdo I enable it?
A
In Firefox, which was the first browser to
implement it, you just need to go to the
Preferences menu, then the Privacy tab, and
just tick the appropriate box.
Unfortunately, the other major browsers on
Linux dont yet support it, including Chrome
and Opera. In fact, Google, the creator of
Chrome, has recently signed a letter opposing
Do Not Track legislation in California since it
feels it will unnecessarily impact on its
advertising business. Since not all advertisers
support DNTyet, if youre concerned, its still
worth pursuing other measures. Enable
AdBlock, NoScript and set your browser to
delete all cookies after every session.
Q
Where can I find out more?
A
Try the Mozilla blog at http://blog.mozilla.
com/blog/2011/09/08/mozilla-
publishes-do-not-track-field-guide.
LXF
passive that is to say, it does nothing to
enforce your wishes, just tells the advertisers
what your preference is.
Many people are worried this gives users a
false sense of security. If theyve set the
preference, theyll think theyre definitely not
being tracked, but this is far fromthe case at
the moment.
Some advertisers will ignore it completely,
some will respect your wishes, and some will
keep tracking you, they just wont showyou
any targeted adverts so you dont realise it.
Q
That doesnt sound very useful! So DNT
is a whole lot of talk without any real
teeth there must be something more we
can do?
A
There have been lots of other attempts at
facing up to this tracking problembut all of
themhave their own flaws.
Q
Tell me more...
A
Well, you can install various extensions,
such as AdBlock Plus and NoScript, which
stop any material fromthe advertisers
reaching your systemor running on your
machine without your knowledge. Microsoft
offers a similar systemto this, with its
Tracking Protection Lists.
Q
That all sounds good, so whats wrong
with them?
A
The problemwith those is that advertisers
are always finding newways to identify
and track you. This means that if you want to
maintain your privacy online, youll find yourself
engaged in a kind of arms race with the
advertising industry, always searching for
another counter-measure.
Q
Actually, nowI think of it, Ive tried
NoScript before I kept having to click
on things to make it work.
A
Thats right, theyre quite technical
solutions and interfere with the browsing
experience. Unfortunately, this makes them
inaccessible to many users.
Q
So, it sounds to me like Do Not Track
isnt really any better than these
previous solutions. Whys everyone talking
about it so much, then?
A
For one thing, its simple. To activate it,
users just have to tick a box. Its also
simple because theres one universal setting
What if you were searching
for information about an
embarrassing illness?
Dr Browns Administeria
62 LXF151 December 2011 www.linuxformat.com
A
ugust was a good month for
anniversaries. For one, the original
IBMPCwas announced on
12August 1981 (30 years ago), and for
another, the birthdate of Linux is generally
considered to be 25August 1991, when
Linus Torvalds posted his now-famous
message to the comp.os.minix
newsgroup: Imdoing a (free) operating
system(just a hobby, wont be big and
professional like GNU) ...
Well, his crystal ball gazing wasnt that
great (wont be big ...) but his coding and
leadership skills turned out to be a great
deal better!
Anyway, the 20th anniversary seems
like as good a time as any to plug his book
Just For Fun, co-authored with David
Diamond. It was published in 2001, so
only tells the first half of the story, but what
I really like about it is that its a very
personal statement fromTorvalds and
makes you feel its OKto get excited
about this stuff.
Code words
Glyn Moodys book Rebel Code also dates
from2001 but lacks the personal punch
that Torvaldss book packs. For a broader
and more recent (2008) perspective, try
Peter Saluss The Daemon, the Gnu and
the Penguin.
Salus, generally regarded asThe
Historian of UNIX is perhaps best known
for his early book AQuarter Century of
UNIXpublished in 1994.
It seems to me the field is currently wide
open for someone to start working on A
Quarter Century of Linux ready for 2016.
Any volunteers?
And if youd like a quicker dose of
historical perspective, the Linux
Foundation (http://linuxfoundation.
org/20th) has some interesting
infographics and a cute animated video to
help sayhappy birthday!
Esoteric systemadministration goodness from
the impenetrable bowels of the server room.
Dr Browns
Administeria
A good month
for anniversaries
Ubuntu Orchestra
Server rolloutsstrikingabadchord?Let
Orchestrabringsomeharmonybackintoyour life.
Dr Chris Brown
The Doctor provides Linux training, authoring
and consultancy. He finds his PhDin particle
physics to be of no help in this work at all.
I
magine you have 50 newLinux servers to
install. You probably dont want to hawk
your installation CDaround each one,
working through the installer steps over and
over again. Your preferred scenario might go
something like this: (1) unpack the servers
fromtheir boxes, (2) plug theminto the
network, (3) switch themon, and (4) walk
away, knowing you could return later to find 50
fully-installed systems.
In fact, if your servers can do a PXE boot
its possible to do this, but potentially it
requires a lot of set up you probably need a
DHCPserver, a TFTPserver to supply the
boot image, and a repository mirror (or proxy)
to provide access to the packages.
Ive set this up in the past (as have
countless sysadmins, no doubt) and I even
designed a training lab for an Ubuntu Server
course but Ive never had the courage to run it
in class because frankly it feels more like a
small research project than a training lab.
Fancy virtual footwork
To ease the pain, a project fromthe Fedora
community called Cobbler (https://
fedorahosted.org/cobbler) automates the
set-up of an installation server, supporting
PXE-based installations onto bare metal, and
installations into virtual machines.
Cobbler is also installable on Ubuntu, and
can be used to deploy Debian, Ubuntu,
CentOS, Fedora, Red Hat and SUSE systems.
NowDustin Kirklands server teamat
Canonical is taking things a stage further
with a project called Orchestra, which is slated
for release in Ubuntu 11.10. Orchestra
co-ordinates several pieces of open source
software including:
Cobbler (ported onto Ubuntu);
squid-deb-proxy (a package that makes it
easy to create a proxy for the Ubuntu
repositories);
puppetmaster (a configuration
management tool thats used to automate the
deployment of specific server workloads);
cloud-init (a mechanismfor running a
customisation script on first boot of a virtual
machine instance).
In part, the development of Orchestra has
been sparked by the decision to switch from
Eucalyptus to OpenStack in 11.10, with the
resulting need to modify (yet again) the
installation technologies.
Well take a more in-depth look at
Orchestra, possibly next month, when weve
had a chance to play around with it.
Cobbler documentation is at https://
fedorahosted.org/cobbler. There is a fairly
extensive man page, too, and a (rather old)
write-up in Red Hat Magazine (http://
magazine.redhat.com/2007/08/10/).
Dustin Kirkland seems to be the main
source of information about Orchestra right
now; GoogleUDS-ODustin Kirkland
Orchestra to see the interviewhe gave at
the Ubuntu Developer Summit in Budapest.
Learn more...
Dr Browns Administeria
www.tuxradar.com December 2011 LXF151 63
RightScale cloud management
Whether yourelookingfor aquicklow-cost experienceof cloud
management or acorporate-level deployment, RightScaledelivers.
Server arrays (a feature thats only available in paid-for
editions of RightScale) are collections of EC2 instances
where the number of instances is automatically adjusted
over time based on a defined set of alerts and escalations.
For example, arrays can be grown if the current instances in
the array are reporting CPUusage above a specified
threshold. Array growth can also be queue-based, so that
the number of worker instances in an array is controlled by
the number of jobs in an input queue.
Arrays and elasticity
R
ightScale is one of a slewof offerings that provide a
web-based dashboard for the creation and
management of servers in the Amazon EC2 cloud.
Since AmazonWeb Services already provides a perfectly
good management console, it is reasonable to ask what
additional benefits RightScale offers. Well, for one thing
RightScale can manage instances across multiple clouds
for example a hybrid public/private cloud. It also offers
templates that build preconfigured servers by starting froma
base machine image and then adding scripts that run during
the boot, operating and shutdown phases.
Each template launches a specific type of server,
installing the software required and configuring it.
RightScale provides a large library of server templates
we counted about 150 but about half are only available to
paid-up RightScale accounts. Most of the templates target
AmazonWeb Services, although a feware available for
Rackspace, including NFS Server Master, PHPFrontEnd
and LAMPall-in one. You can also create your own
templates or edit those provided.
As well individual servers, RightScale also allows you to
manage deployments clusters of servers that work together
to performa common function. For example, a deployment
might have four servers two load-balanced front-end nodes,
backed by master and slave database servers.
Deployments allowyou to manage the entire cluster as a
single entity, rather than managing each server individually.
For example, you can clone an entire deployment with the
proverbial single mouse click.
You might, for instance, create a copy of your production
deployment to use as a staging server for load performance
tests, and another copy to use for in-house development.
RightScale will also monitor the cost (ie your payments to
AWS) of running the entire cluster.
Monitoring and alerts
RightScales server templates include a daemon called
collectd that collects performance statistics periodically and
sends themto a RightScaleSketchy server, which is
automatically allocated to each machine instance you create.
The sketchy server generates graphs that you can display
through the RightScale dashboard. For example, on a LAMP
server you can graph things like the number of Apache
requests or the number of database queries per second, as
well as more generic load measures such as CPUidle time or
memory usage. Metrics can be charted over a daily, weekly,
monthly or yearly period. You can also add thumbnails of
these graphs to the Quick Monitoring section of the
dashboard, making thempermanently visible.
Aserver template also defines alerts that monitor various
metrics of your servers and raise warnings (ie send an email) if
they exceed a specified threshold. As an example, the rs cpu
overloadedalert fires when the CPUidle time is too low. Other
examples of alerts include unexpectedly high input or output
network activity, lowmemory, lowswap space, or lowfree
space on a mounted volume. Each alert condition has an
associatedalert escalation that defines the action to be taken
when an alert is triggered. For example, awarning escalation
sends an email every day; acritical escalation sends an email
every 10minutes, and (more interesting) ascale-up
escalation will raise a vote to automatically add more server
instances into an array.
Give it a try
You can evaluate RightScale by browsing to www.rightScale.
comand signing up for a free single-user account. To do
anything useful, of course, youll also need an account with
AWS (AmazonWeb Services).
Again, the actual account is free, but you will start to pay
hourly rates if you actually create machine instances or
storage volumes. If you want to scale up to support a serious
level of revenue-generating activity in RightScale, though, it
will cost money.
The Standard edition costs $500 a month; fromthere, the
features, support levels and prices progressively increase
through Premium, Corporate and Enterprise levels.
You can find details at: www.rightScale.com/products/
plans-pricing. If you want to actually deploy some servers,
youll pay hourly charges toAWS, but for aproof of
concept experiment over a couple of days, expect to
pay just a fewdollars.
The dashboard provides easy access to all your AWS machine instances. You
can also see one of the many monitoring graphs that RightScale maintains.
Dr Browns Administeria
64 LXF151 December 2011 www.linuxformat.com
The concept of virtualisation is not new the first
production computer supporting full virtualisation was the
IBMSystem/360-67 mainframe, which came into service
in about 1967. Unix vendors such as Sun and HP were
selling virtualised systems in the late 1990s but only on
high-end (ie very expensive) servers. PCs have supported
virtual memory (providing each process the illusion of
having the address space all to itself) since the Intel 80386
processor was introduced in 1986. Indeed, it was precisely
this development that inspired Linus Torvalds to start
writing Linux in the first place.
VMware, a major player in the PCvirtualisation market,
first released VMware Workstation in 1999. But it is perhaps
only since 2006 or so that PC-class machines have
become powerful enough to really make virtualisation fly. In
particular, Intel andAMDboth announced extensions to the
x86 processor architecture around that time that made full
virtualisation possible and efficient.
Abrief history
Getting started with virtualisation
Virtualisationmust bethehottest technologyof thedecade. Get togrips
withthetheory(andmakeastart onthepractice) right now.
L
ets begin with a simple definition: virtualisation creates
the illusion of multiple separate computers (known as
virtual machines or VMs) running concurrently on a
single physical computer. Each of these VMs appears to have
its own CPU, memory, disks, network cards, USBports, and
so on. It can be powered up, booted, shut down and powered
off independently. Newvirtual machines can be created as
required, and destroyed (or terminated) when theyre no
longer needed. EachVMcan have an operating system
installed in it, and the various VMs within a single physical
computer dont all have to be running the same OS: one
might be running Ubuntu Linux, one Red Hat, one Windows 7
and one Windows XP.
In architectural terms, the layer of software that performs
this magic can either run directly on the physical hardware, or
on top of a host OS. These two arrangements are sometimes
known as Type 1 andType 2 hypervisors respectively a
classification that comes fromRobert Goldbergs 1973
doctoral thesis at Harvard.
In the Linux world, Xen is probably the best known type 1
implementation, whereas the popular VMwareWorkstation
and VMware Player products are type 2. The OSes on the
virtual machines are known as guest OSes.
The idea of virtualising hardware is hard to get your head
around until you actually see it in action. The lightbulb
moment for me was the first time I powered up aVMand
found myself in amongst its BIOSsetup screens. After
installing Linux (fromstandard installation media) and
watching the installer discover what it thought was real
hardware it became apparent howcomplete an illusion of PC
hardware virtualisation actually provides.
The virtualised hardware may be quite different fromthe
underlying physical devices for example it can provide
multiple CDdrives (virtualised as ISOfile images within the
host OSs filesystem) and the virtualised network interface is
almost certainly not the same brand as the one providing the
actual physical connection. The storage space for virtual disk
drives is taken fromthe filesystemof the host OS. Within the
host system, it will appear as one or more large files.
Its worth taking a moment to compare the degree of
isolation offered by aVMwith that offered by a single process
within an operating system. All of the processes within a single
OS are separate to some extent. They all have a separate
memory address space, and they all operate under the
illusion of having the CPUall to themselves. But they share
the filesystem, an IPaddress, and the TCPport space so that,
for example, if one of those processes is a web server
listening on port 80, no other process will be allowed to bind
to that port. And of course they share the operating system.
Contain yourself
Virtual machines offer a far higher level of containment. For
example eachVMhas a separate filesystem, a separate IP
address, and a separate TCPport space (so its fine to have
web servers listening on port 80 within different VMs). Each
VMcan be started and stopped without affecting the others.
It can have (virtual) hardware added or removed, and have its
own operating systeminstalled.
For Linux desktop users (including myself) virtualisation is
a useful way to install, test and play with the latest and
greatest Linux distros without impacting your main machine.
Also, for users who have migrated to Linux but have a couple
of legacy Windows applications, runningWindows inside a VM
offers a far more convenient solution than dual-booting.
The training company LearningTree International uses
virtualisation extensively to support lab work. The machine
the students see during hands-on exercises is usually a VM
(Red Hat, Windows 7, Solaris) running on a Windows XPhost.
This provides a high degree of standardisation in the way
that course loads are built and imaged onto the classroom
machines. The VMs are run in full-screen mode and in most
cases attendees reach the end of the week without ever
realising there was a host operating systemunder the covers,
AType 2
hypervisor runs
on top of a host
OS, providing
virtual hardware
on which guest
OSes may be
installed.
Host operating system
Virtualisationlayer
Virtual
hardware
Thereal
hardware
Virtual
hardware
Services&applications
Guest operatingsystem
Services&applications
Guest operatingsystem
Dr Browns Administeria
www.tuxradar.com December 2011 LXF151 65
All modern servers should have processors that support
virtualisation, but some low-end laptops may not. A
simple way to find out if your processor supports it is with
the command:
$ egrep vmx|svm /proc/cpuinfo
If you see either vmx or svmlisted in the CPUflags, then
you have Intel or AMDvirtualisation respectively. Be aware
though, that even if the processor supports it, it must be
enabled in the BIOS to be active. (Ubuntu has a little script
called kvm-ok that checks for this.)
If youre choosing a newlaptop, verify the processor type
number and (for Intel) look it up in the list at ark.intel.com/
vtlist.aspx. Were not aware of an equivalent list for AMD.
Will it work for me?
unless by chance they hit the deliberately obscure hot-key
combination needed to drop the input focus out of the VM.
Canonicals training course, Deploying Ubuntu Server
Edition, uses KVM/Qemu virtualisation to provide each
student with three servers for lab exercises. These are used,
for example, to demonstrate the deployment of proxies and
mirrors for the Ubuntu repositories. The students are very
aware that virtualisation is in use as theyre required to switch
between the VMs and even get to build their own.
But it is perhaps in the server roomthat the value of
virtualisation is greatest. Traditionally, many servers run way
belowcapacity figures of 10%to 20%utilisation are
common, and a company recently estimated that 150 of its
400 servers were using just 3%of their capacity.
Reducing rack space
Using virtualisation to consolidate the workload of these
machines can reduce the rack space, power and cooling
requirements of the server roomor data centre.
Two attendees on a recent course, who managed the
computing infrastructure of a major UKuniversity, reported a
25-to-1 consolidation ratio, replacing 100 old servers with just
four (presumably newer and more powerful) machines. This
is good ecologically, given that the carbon footprint of the IT
industry is roughly the same as that of the airline industry
(about 2%). And of course, virtualisation technology is at the
heart of that seemingly infinite pool of rapidly-provisioned,
self-service resources that we call thecloud.
Red Hats Enterprise Virtualisation for Desktops uses
server-roomvirtualisation (KVMand Qemu) to host virtual
desktops (essentially instances of Red Hat Linux or Windows).
Users sit at thin client machines (perhaps repurposed PCs)
and access these desktops using SPICE (http://spice-
space.org), a modern remote-desktop access technology
that (unlike older remote desktop protocols such as RDP) can
offer a user experience close to that of actually sitting at the
machine where the desktop is running.
Virtualisation has given rise to a useful little sub-industry
of so-called virtual appliances a pre-built VMimage
configured for some specific purpose. Suppose you want to
try Magento to build an e-commerce shop front you can
either manually install it (along with, presumably, Apache,
MySQL, PHP, phpMyAdmin and other dependencies) and
configure it up, or you can download and run a virtual
appliance in which its all installed, configured, and ready to
go. The VMware site (www.vmware.com/appliances) lists
more than 1,800 such appliances including open source
software stacks such as SugarCRM, Drupal, Alfresco, Joomla!
and many others. These can all be downloaded for free, as
can the VMware player, which is all you need to run them.
Bitnami is a major contributor to the VMware virtual
appliance library. Its website (bitnami.org) carries almost 30
application stacks and 11infrastructure stacks to install into
your existing Linux system, as VMimages, or as Amazon
Machine Images (AMIs) that can be launched in the EC2 cloud.
Turnkey Linux (www.turnkeylinux.org) carries about 45
appliances all based on Ubuntu 10.04 (the current LTS
version). Each is provided as a downloadable VMimage, or as
an ISOimage that you could install into anempty VM(or
indeed, onto bare metal). They also offer the option to launch
the appliances directly into the Amazon EC2 cloud.
Jumpbox (www.jumpbox.com) also offers a portfolio of
about 60 appliances, packaged ready for a variety of
virtualisation products including VMware, Xen, Parallels,
Microsofts Hyper-Vand Suns VirtualBox. Again, many of its
appliances are also packaged for immediate deployment
within the Amazon EC2 cloud. Its a subscription-based
service with a flat monthly fee, but there is a 15-day free trial.
If you would like a more DIY(and more strongly Linux-
flavoured) virtualisation experience, consider installing KVM
which is a full virtualisation solution for Linux on x86
hardware. It requires CPUvirtualisation extensions (Intel VT
or AMD-V see boxout) and consists of a loadable kernel
module, kvm.ko, and a processor-specific module, kvm-intel.
ko or kvm-amd.ko. KVMis used in conjunction with Qemu
(pronounced kee-mew) to emulate other hardware such as
network cards, disks and graphics adaptors. Youll also need
to install libvirt and some userspace management tools such
as virsh (for a command-line experience) or virt-manager (a
graphical tool.) For those of you who hoard back issues of
Linux Format, I wrote a detailed tutorial on this in LXF125.
LXF
Part of my collection of VM images in VMware Workstation.
You can also see the screen for editing the VMs hardware.
A sample of the
preconfigured
virtual appliances
available from
Turnkey Linux.
There are similar
offerings from
Bitnami and
Jumpbox.
66 LXF151 December 2011
First look at every issue plus UK
subscribers get their print copy up
to a week before it hits the shops.
A free digital edition of every issue
available to download on your PC,
smartphone or tablet from the
day it goes on sale in the UK.
Access to tutorials and
coverdisc downloads.
Complete back issues. 5
F
R
E
E
issues a
year for
subscribers!
www.linuxformat.com
Subscribe today and
youll also get:
UK subscriptions
* All savings based on cover price of 6.49. Minimum subscription term is 12 months. You will receive 13 issues of Linux Format a year. If you
wish to cancel please notify us in writing within the rst 60 days and we will refund all unmailed items. Access to the subscriptions only archive
area is strictly for personal use only. Offer ends November 10, 2011.
www.tuxradar.com December 2011 LXF151 67
Subscribe to LXF and get

1
2
.
9
8
Subscribe to Linux Format and
youll only have to pay for eight
issues, getting the remaining five
free thats a saving of 32.45!*
Pay 51.92 for all 13 issues or
break it up into more manageable
instalments of 12.98every three
months by direct debit.
5 FREE ISSUES
Subscribe easily and securely at
www.myfavouritemagazines.co.uk/LINP1P
Or call us on 0844 848 2852 and quote LINP1P
UK subscriptions
Massaging little numbers around
boxes is no job for the sane, but
someone has to do it.
M
oney, so they say, is the root
of all evil today. But if you ask
for pay rises no surprises
theyre giving none away... So, if youre
seriously saving up for a Learjet or a
newfootball team, youd better get a
grip on your finances.
There are plenty of applications for
this sort of work, but thats the problem
they often look like a bit too much
work, and all your best intentions come
to naught when you just cant be
bothered to update themenough.
Skrooge, the wily amongst you may
have guessed, is part of the kdE camp
and currently resides in the kdE
Extragear grouping, so although it
Skrooge
hasnt been around for too long, it does
have a lot of interest and an active
developer base.
More importantly, it looks swish and
zingy, and draws nice graphs, so you
can have a pictorial display of how
much you spend on phone calls to
people who owe you money, which is
always very gratifying.
Importantly, Skrooge also supports
the QIFand OFXfile formats often used
by online banking systems, as well as a
catch-all CSVimport routine.
With automatic categories and
smart imports, it should take even less
of your valuable time to work out
where all your money is going, and
perhaps will make it easy enough for
you to use regularly. You dont even
have to worry about making mistakes,
because the application preserves a
complete history of actions for infinite
regression if required.
Even if you cant import all your
data to make life simple, there are
plenty of automated functions such as
creating a schedule for entries or even
just duplicating them. The benefit of
entering all this data is the
comprehensive reports which can tell
you exactly where all your outgoings
are going out to.
The killer feature, though, is really
the graphing capability. While it may
not give you as much detail as looking
at the lists of information, a big pie
chart showing howmuch you spend on
pies is very immediate and, well, just
cool looking.
Version 0.8.0 Web http://skrooge.org
LXFHotPicks
Skrooge Potrace Pstoedit Miro Sigil SlowmoVideo
GnuPG TripleA Triplane Nethogs ZoneMinder
The best newopen source
software on the planet
Personal finance
Tabbed panels
Switch between different views
of your finances.
Bookmarks
Add bookmarks to easily
switch between different parts
of your account.
History
Acomprehensive history is
taken, so you can scroll back
if your cat has walked across
the keyboard.
Exploring the Skrooge interface
Search
The side panel includes a
handy search feature for
finding entries.
Charting mode
In this mode, a control
panel appears in the
bottom of the window.
Results
Your financial inadequacies
can be plotted in a number of
different ways.
68 LXF151 December 2011 www.linuxformat.com
Nick Veitch
Nick was bitten by a radioactive
download manager and has since had
a compulsion to install experimental
software. And bad indigestion.
More importantly, it
looks swish and zingy,
and draws nice graphs.
LXFHotPicks
www.tuxradar.com December 2011 LXF151 69
T
he world is a bit too full of jaggy
things. We dont mean those
little bits of gravel you find in
your shoe, or an unexplained fingernail
that turns up in your porridge, though
those are doubtless annoying and
somewhat disturbing too, but rather
the sad amount of bitmap graphics that
wave their shameful fixed-resolution
pixelyness in our faces every day.
But there is a way to wean these
graphics off their fixed-sized
dependency. It might not always have a
successful outcome, but trials have
proved that undergoing some treatment
with Potrace can help graphics files lead
a happy and productive life away from
strict dPI settings.
If youve ever used the most
excellent Inkscape, the amazing abilities
of Potrace should not be unfamiliar to
you, as that is what lies behind the Path
>Trace Bitmap menu item. In Inkscape
you get a simple GUI front-end that lets
T
he world is a bit too full of
smooth things... oh... wait a
minute. Anyhow, the only thing
more annoying than a graphic you cant
scale is a graphic that is in some
scalable format you cant edit.
To be fair, PostScript was never
intended as a file format per se, its very
specifically designed as an output
format. In fact, its really a language
(and if you knowhow, you can program
it to do cool things, such as change text
based on the time of day and stuff).
But we digress... PostScript, and its
morewith it cousins, EPS and PdF, are
very common output formats, but they
prove rather intractable when you want
to do something with them. You can
easily place such graphics inside other
documents using Scribus or whatever,
but its tricky to actually edit or change
them(yes, except on platforms where
you can buy Acrobat Professional).
Potrace
Pstoedit
you select what sort of elements you
are trying to trace and howyou want
the output structured. The preview
gives you a pretty good idea of whats
going to happen, and at the end of it all
you have a pretty good vector
representation of what was once a
fixed-size graphic. Invaluable for
importingnatural line art into your
graphics, its also handy for all sorts of
other things.
But Potrace isnt just limited to
working with Inkscape, or even to
outputting SVGfiles. Run fromthe
command line, youll have more options
than a flea at Crufts output to PdF,
PS, EPS, SVG, Gimp paths and nowthe
eminently useful dXFformat too (if you
Pstoedit is a neat tool that
deconstructs these mysterious objects
and rebuilds themin a format you
might have a little more joy with.
As well as PostScript-alike files,
there are a range of exotic output
formats, includingAdobe Illustrator,
Sk1 Sketch files, XFIG, HPGL, dXFand
various types of code dump, as well as
a plain text dump of the document.
Text can also be converted to path-
based objects, but beware that
depending on the original file, you may
need to have the correct fonts to see
anything of word-based documents.
The giant bluebottle in this particular
ointment is support for SVG. This exists,
Graphics utility
Graphics utility
havent come across it, youve never
done any serious CAdwork).
To be honest, for getting colourful
images into SVGformat, youre still
better off using it fromwithin Inkscape.
Thats because Potrace will only do one
outline trace at a time (ie monochrome),
something which is cunningly
overcome in Inkscape by running
Potrace multiple times.
For every other use, including being
able to use different file formats, the
command line is king.
but is only available as a closed-source
binary fromthe website, which is
particularly useless if youve compiled
the software for a 64-bit system,
because it just wont work. The authors
motive for this seems to be that, for the
PCversion of the software, this library
is a paid-for option, so it seems unlikely
that well see the source any time soon.
Aside fromthat, its a welcome addition
to the trusty toolbox of translation.
Version 1.10Web http://potrace.sourceforge.net
Version 3.6.0 Web www.pstoedit.net
Any colour as long as its black. Or white. Potrace can
save your illustrations from resolution dependency.
Translating PDFs to vector objects means they become
editable (as shown in Inkscape, above), but fonts can still
be problematic.
Fromthe command line,
youll have more options
than a flea at Crufts.
Pstoedit rebuilds files
in a format you might
have more joy with.
LXFHotPicks
70 LXF151 December 2011 www.linuxformat.com
W
ith kindles, tablets, iPads and
such, the world is
experiencing the biggest shift
in howthe written word is presented
since some bright Egyptian spark
decided to fold up sheets of papyrus
and cut the edges to make pages
instead of scrolls.
Personally, Ive never tried to prop a
door open with a kindle, or rid myself of
an annoying wasp by dropping an iPad
on it, but it certainly seems as if theres
plenty of interest in portable electronic
reading devices.
But if you dont want to fork out lots
of cash buying eBooks fromAmazon,
what are the alternatives? Project
Gutenberg does a good line in free
books, most of which are available in
eBook format, and an internet search
will reveal other sources. Creating your
own eBooks, or converting the rawtext
of your unpublished novel to the format
Sigil
is a different matter. You can create
such works using a normal text or
HTMLeditor most of the eBook
formats are just in a particular type of
XHTML but Sigil offers a customised
book editing app that will take some of
the strain out of creating such works.
Simply start up a newdocument
and a multi-paned windowwill open
with different areas for the structure of
the book and the text itself.
If you need to get messy with the
actual code for some reason such as
adding an eBook feature not currently
covered in Sigil, you can split the
document viewto showthe actual code
in the lower half.
eBook editor
Its not without flaws. Cutting and
pasting text fromone windowto
another often introduces acres of extra
linebreaks, and it doesnt handle long
documents very well. What it does do,
though, is turn ordinary text into lavish
eBook files (with a bit of effort) that are
all verified and checked, and will load
happily on any of the many readers
supporting the EPUBformat.
Version 0.4 Web http://code.google.com/p/sigil
Create your own masterwork or format shift some classic
cock and bull story.
Turns ordinary text
into lavish eBook files
(with a bit of effort).
T
he idea of teaming up a torrent
engine and a media player into
one friendly app is not a foolish
one, nor is it unique. Miros raison dtre
is not to help you download Linux
distros and such, its to be a trouble-
free front-end for viewing web content.
It has to be said, it doesnt just rely
on torrents, but also supports media
fromother outlets such as YouTube.
Instead of going through web portals or
downloading content manually through
a torrent client, Miro takes care of as
much of that as possible.
It comes preconfigured to suck
content froma variety of sources,
including several free Hdchannels, so
theres a good chance of finding
something to watch.
Adding your own sources is simply a
matter of pasting in a URLor link to an
RSS feed that Miro will magically
transforminto a list of available files.
Theres no need to worry about fiddling
Miro
with settings and such, because it all
just works.
Select the clips you want from
YouTube or TedTalks, or any of the
preconfigured sources, and they will
begin downloading in the background.
The software even keeps track of what
youve watched already and what you
havent, so it really couldnt be easier.
Amore primitive version of this
software appeared back in LXF101, but
so much utility and polish has been
added since then, its well worth
reminding you of its existence.
There are fewLinux apps that
could be consideredready for non-
computer people, but this is certainly
one of them.
If you want to snag the latest version,
its available on Launchpad for Ubuntu
users (https://launchpad.
net/~pcf/+archive/miro-releases)
but will most likely filter through to your
favourite repository soon.
Net-enabled media player
Building it fromsource is certainly
an option, but although weve included
the latest available version at time of
publication on the LXFDVD, you should
probably visit the site to download the
very latest code.
Version 4.05 Web www.getmiro.com
Youll be
surprised at the
amount of great
free content of
all types that is
already plumbed
into Miro.
Theres no fiddling
with settings and such
because it all just works.
LXFHotPicks
www.tuxradar.com December 2011 LXF151 71
Hottest
Pick
T
here are fewthings in life as
pleasurable as happening upon a
great piece of software for
HotPicks that cant possibly be
illustrated in a meaningful way.
SlowmoVideo is just such a tool,
given as its job is to take ordinary
footage and turn it into beautifully
smooth slow-motion.
Aside fromprinting images at the
bottomof each page and having you
flick through themto see the effect,
youre really going to have to try it for
yourself or viewone of the demo files
on the homepage.
Some stop-frame animations look
great. Some slowed down movie
captures do also. But not all of them.
Perhaps not even half of them, because
it depends so much on the equipment
used and howcarefully they were shot.
SlowmoVideo can make a fair
percentage of these files a lot better. It
works by extracting all the frame
F
ewtools have a more interesting
history than GnuPGand the
encryption tools that preceded it.
You may not knowit, but there was a
time when there was no way of
encrypting a message (or
authenticating it) that wasnt trivial to
break with even a modest computer
setup. The idea of asymmetric key-pairs
provided the answer to encryption
algorithms, which manage to keep
everything fromyour private mail to
your bank transactions safe.
The OpenPGP software became a
standard for secure communication
(RFC4880) and way back before LXF
was even born, a compatible Unix
version was born (in 1997!).
And yet, in spite of the awesome
things its responsible for, GnuPGis
quite a humble little command-line app
that just does its job simply and
efficiently and generally stays in the
SlowmoVideo
GnuPG
information it can, and then building
in-between frames (rather than just
slowing everything down) with an
amount of motion blur.
The slowmotion effect is controlled
in the application by modifying a curve
that runs along the bottomof the
window. Moving the cursor to any point
will also showyou the current frame.
SlowmoVideo does require an
appreciable amount of memory and
processing power to chewits way
through even a short video file, but the
results are often well worth it.
It isnt a sophisticated application
(not yet, anyway) you simply start a
project and assign a video clip to it,
then fiddle around with the nodes on
background, keeping you safe and
secure with barely a murmur.
The software doesnt have anAPI as
such, so most of the tools that require
some sort of GPGfunctionality just
write a wrapper around the command-
line tools. Simple, but effective you
probably use it every time you use your
computer, for one thing or another.
This newversion, which has been a
while in coming, probably isnt going to
rock your world that much. The
headline is that it nowsupports keys up
to 4,096 bits in length, which is more
than secure enough to make sure
youre downloading the correct
package and your grocery list is safe
Video tool
Security tool
the timeline to adjust the playback
speed of your clip.
To get started with SlowmoVideo,
youll need to build the application with
cmake (remember to make a build
directory first and run cmake from
there) it may be better to check the
website for the latest release, and
acquire it by cloning the Git repository
before building (also remember to set
the install location properly). The
results are surprisingly good.
fromprying eyes. Of course, fewpeople
need that level of security, but isnt it
nice to knowthat GnuPGis there,
quietly watching out for you?
The sources are on the dVd, but, as
ever with critical systemtools, we urge
you to update fromyour normal distro
repository if at all possible this is
something you definitely dont want to
get broken.
Version 0.2.2 Web http://slowmovideo.granjow.net
Version 2.0.18 Web www.gnupg.org
Imagine this, but in about 10 minutes time, when its split
out all the frames and rendered the new ones.
It takes less than a second to decrypt if you have the
key... or about 10 trillion years otherwise.
Turns ordinary video
footage into beautifully
smooth slow-motion.
Isnt it nice to know
GnuPG is there, quietly
watching out for you?
HotGames Entertainment apps
O
f all the wars so far, the
SecondWorldWar has
probably had more great
games based around it than any
other. One of these was the excellent
Axis andAllies, which started life back
in 1981, but was relatively unknown
before it was acquired by Milton
Bradley and marketed worldwide in
the late eighties.
Combat is resolved by throwing
dice whenever different sides try to
occupy the same location, but the
different combinations of units
present can change the outcome
somewhat. Locations on the board
contribute production points which
can be used for reinforcements, and
each side has set objectives to win
the game. Its turn-based in a number
of phases. First comes a round of
TripleA
combat, then a round of non-combat
moves. Thats where the strategy
comes in, as you have to think ahead so
you have units ready to take advantage
of any gains you might make.
TripleAisnt just a great version of
this game though its more like a
game engine, as there are variations
that can be played, with different maps
and units. Instead of a SecondWorld
War scenario, you might fancy your
chances in the Napoleonic era, or
maybe even Middle Earth? There are
all sorts of third-party maps and games
to play too.
In war, the
first casualty is
good manners.
Germany, may we
counter invade
Alsace-Lorraine
please...
War game
Graphically gorgeous, its a bit of a
surprise to discover the whole thing
is built inJava. In addition to this
making it cross platform, it also
means its pretty easy to install and
play. You dont even need to
remember howto invoke a JARfile,
because theres a handy startup
script included. It can take a while to
play though, so make sure you clear
plenty of time in your diary if you
want to see the SecondWorldWar
through to the end.
Version 1.3.2.2Web http://triplea.sourceforge.net
It can take a while to
play so clear plenty of
time in your diary.
G
ravity sucks. This is
particularly unfortunate if
you happen to be aloft in
some triple-winged aircraft loaded
with bombs, being shot at. Which
happens a lot in this game. If you
think of classic 2dplane-fare such as
Sopwith crossed with a slightly more
mission-based game such as Wings
of Fury (look it up), you pretty much
have the measure of this chap.
Its a faithful reproduction of a
classic dOS game called Triplane
Turmoil, which was rather excellent if
not as widely known as it should
have been. Across a number of
missions, you must bravely take to
the skies and do it to the enemy
before they do it to you. Tiny groups
of pixels stomp about the map
representing troops to be shot at,
whilst other targets usually make
Triplane
themselves known by shooting at you
as soon as you hove into view.
In spite of all the bullets whizzing
skywards, its often the gravity that
gets you rather than enemy fire, at
least until you get the hang of the
simple but confusing controls (oh, and
the settings for choosing your own
keys dont always work, just to help
you out there). After a fewhours you
might be able to stay aloft long enough
to make it to enemy territory. Afew
more hours and you will be able to
successfully drop a bomb without
crashing. Some time after that, you
might even manage to hit something.
Shoot those
chunky pixels
with your pixel-
planes pixel gun.
Watch out for the
pixels though.
Aircraft game
So, you may deduce that it will
take you quite a while to play through
all the levels, which get progressively
more difficult, both in terms of
terrain and enemy forces.
In spite of its simplicity, and the
lo-res graphics, its quite good, and if
you can convince three other people
to play it with you, all the better
having four people on the keyboard
trying to remember howto fly and
shoot at the same time is great fun.
Version 1.0.7 Web http://triplane.sourceforge.net
If you can convince
three people to play it
with you, all the better.
LXFHotPicks
72 LXF151 December 2011 www.linuxformat.com
Also released
Newand updated software that
also deserves a look...
Veusz 1.13
Excellent plotting tool makes useful
images out of any data you send it.
http://home.gna.org/veusz
Sleepworker 0.9.05
Do stuff in your sleep or rather,
when your Linux box is.
http://sleepworker.sourceforge.net
XXXTerm 1.518
The web browser for people who just
cant be bothered with a mouse.
https://opensource.conformal.
com/wiki/XXXTerm
evince 3.1.90
The most capable document viewer
ever to grace a desktop...
http://projects.gnome.org/evince
Gnome Gmail 1.8.1
Add Googles cloud-based mail service
as the default on your Gnome desktop.
http://gnome-gmail.sourceforge.net
Akanthophis 1.1
Batch downloading made easy with
this interesting KDE app.
http://kde-apps.org/content/show.
php/Akanthophis?content=144952
Tor 0.2.2.32
The ultimate paranoia tool gets a
significant update.
www.torproject.org
Gnome Commander 1.2.8.13
One of the better twin-panel file
manager options.
www.nongnu.org/gcmd
Veusz can create publication-
ready PDF or PostScript files.
LXFHotPicks
www.tuxradar.com December 2011 LXF151 73
Go old-skool with a minimalist
but functional file manager.
R
egular readers of HotPicks
(arent you all) will knowthat we
often have a battle of the tops
to see which top-like tool (eg iotop,
nettop, powertop) is our top of the tops.
Obviously Arnout Engelen, author of
this app, has nowspoilt all our fun by
choosing a non-top-based name for
this rather excellent tool. Howselfish.
Nethogs is another bandwidth
monitoring tool, which rather like
nettop or iftop, shows the current
bandwidth usage on your Linux box.
Unlike the aforementioned, though, it
concentrates on the processes rather
than the interface, service, address or
protocols being used.
So instead of seeing a partially
useful list of traffic to and from
particular addresses, you can nowsee a
list of processes/applications that are
actually generating that traffic. Not only
is it great for debugging, but its also
useful for spotting things gone rogue or
W
hen we first featured
ZoneMinder in LXF it was a
very interesting and useful
application that could help make
security recordings of only the things
you wanted saving time, effort and
disk space. Perhaps disk space isnt so
much of an issue all these years later,
but ZoneMinder has also changed quite
a bit in the intervening period.
The software monitors video
cameras (USBor network cameras),
but you can select zones within the
viewable area that will trigger a
recording. The area itself is easy to edit,
and there are all sorts of parameters
you can fiddle with to set it up just right.
After a brief rest, 2011 has proved to
be a busy year for ZoneMinder
development, with all sorts of
improvements and newfeatures,
including significant rewrites of a lot of
the guts of the system.
Nethogs
ZoneMinder
apps which are real, erm, net hogs.
There are some limitations it can only
run on one interface, but you can just
run multiple instances. It doesnt
require any special kernel functionality,
as it derives all the info from/proc files,
but you do need to run it as root.
Nethogs relies on libethercap, so
you may find you already have it
installed (although youll obviously
need the development version to build
fromsource). Nethogs doesnt seemto
be widely available in distros yet, but its
simplicity itself to install fromthe
source included on your LXFDVD.
One of the best things about it is
that, although you can just use the
defaults and set up a systemin a
relatively short amount of time, there
are a huge number of things to fiddle
with if you want to, and all elements are
very susceptible to scripting.
Theres a fair amount of
configuration to do if you want to build
it fromsource. However, as well as
versions turning up in the usual distro
repositories, you might want to check
out a live version, or at least read the
very handy distro-specific notes on the
ZoneMinder wiki.
LXF
Network monitoring
Video security
Version 0.8.0 Web http://nethogs.sourceforge.net
Version 1.2 Web www.zoneminder.com
No hogs were
harmed in the
making of this
screenshot. Or
nets.
Drag out the
right areas of
interest and you
wont just end
up with hours
of video of your
neighbours cats.

4
.
9
9
from
a month
www.

2
.
9
9
from
a year
only
a month
F
R
E
E
I want to create
my website without
learning web code
I want a website
for my business
I want to design
I want to register
domains wherever
I am
I want a blog
Everything you need to
build a site including our
new unlimited package
Give your website
a cool address, choose
from loads of options
Design your website in
professional software
without any coding
The web belongs to everybody
What do you want to use it for?
Find out more at: www.123-reg.co.uk
Get domains on the go,
download our free app for
iPhone or Android now!
www.tuxradar.com
December 2011 LXF151 75
Tip of the month: Roll your own
I
remember being told at school
that everyone is a different kind
of learner. Some are apparently
left brain learners, while others are
right brain.
Depending on which category
you fall into, you supposedly process
information in different ways: some
like a task to be broken down into
small bits, while others like to have
the full picture before they begin;
some like to be organised and
methodical, while others tend to skip
over details and careful planning.
No matter where you fall,
however, theres one approach I
think everyone needs to try if they
want to successfully learn a new
skill: just do it. You can spend loads
of time attending lectures and
reading books, but when you
actually have a go at using your new
skills, find yourself completely lost.
The only way to overcome this
paralysis is by accumulating lots and
lots of experience.
So, dont just read this months
tutorials; actually have a go at them,
and then try to go beyond that and
take things a bit further. Youll get far
more out of it.
jonathan.roberts@futurenet.com
Learnbydoing
Turn on, log in and let our experts help make you a smarter Linux user
Installing packages through your distros
package manager is generally best, but there are
times when the program, or the version of it that
you really want, is not in the repositories.
This normally means installing fromsource,
but then you have the problemof files on your
systemunknown to the package manager,
and not all source packages come with an
uninstall option.
The solution is checkinstall, which is
designed for use with the standard autotools
source build method of running ./configure then
make and finally make install. Checkinstall
replaces the final step, but instead of installing
the files to your filesystemit builds theminto a
package, optionally installing themtoo, so the
files are under the control of your package
manager. All you do is run configure and make
as you would before, then run checkinstall
instead of make install. If the code uses
something other than make install to do the
installation, give that command after
checkinstall, for example:
checkinstall ./install.sh
Checkinstall will ask you for the type of
package to create, plus some other options, or
you can specify this on the command line with
--type. For example, on Ubuntu you would run:
sudo checkinstall --type=debian --install=yes
You can also set defaults in the checkinstallrc
file. Nowyou can use all the source-only
goodness Mike puts on the DVDs with ease.
Code in tutorials
Source code is presented in beige
boxes. When lines of code are too long
for our columns, the remaining text
appears on the next line in a solid box:
procedure TfrmTextEditor.
mniWordWrapClick
Otherwise, there is a gap, like this:
begin
mniWordWrap.Checked := false
JONATHANROBERTS
has spent the past
month messing
about with
JavaScript puzzles.
This month learn howto...
Use Arch packages.. 86
Never make install a package
again, as GrahamMorrison
explains howto tame the Arch
User Repository.
Build a firewall........... 96
Why trust the proprietary,
undocumented firewall in your
router when you can build your own?
James Litton shows you how.
Encrypt your files....... 76
Want to keep your Lolcats
obsession hiddden fromyour boss?
Jonathan Roberts shows you how
to keep your files secret.
Customise Arduino...88
Stock Arduino not good enough
EEPROMfor you? Want to add
features? Nick Veitch talks you
through building your own.
Work with Office........80
Compatibility between Microsofts
office suite and its free alternatives
isnt perfect, but with Ben Everards
know-howyou can close the gap.
Impress with XBMC.92
Wowyour friends by following
Simon Quains comprehensive
guide to setting up a beautiful XBMC
home entertainment centre.
Tutorial Core Skills
76 LXF151 December 2011 www.linuxformat.com
Super-secretive
Jonathan
Roberts
has been
tinkering with
Linux since he
was a teenager.
Which actually
wasnt that
long ago...
Our
expert
Cryptography certainly plays a part in these situations, but
its far more commonly used in less exciting scenarios for
example its a feature of online banking and its how
companies protect their customers personal information.
Its also, thanks to some great pieces of free and open
source software, commonly used by private individuals who
want to store bank details, account passwords and any other
kind of digital data securely.
In this tutorial, were going to showyou three different
ways to secure your data, each dealing with a set of
circumstances that requires the application of novel
techniques. The first will demonstrate howto secure the data
kept on your PC, in case it ever gets lost or stolen.
The second will demonstrate howto secure data, for
personal use, in a portable format. This is ideal if you need to
carry sensitive data on a USBstick, or perhaps want to back
it up using Dropbox but dont trust its security.
The third will showyou howto encrypt data that you want
to share with other people. Using the same tools, youll also
be able tosign digital information so that a recipient can
confirmthat its fromyou, and not just someone pretending
to be you.
Encrypt your PC
When it comes to protecting the information held on your PC,
youll be surprised to learn just howthorough you need to be.
You could, for instance, just keep an encrypted file that
contains all your passwords and think that you are secure.
But howmany of your passwords have secret reset
questions, the answers to which are things likewhere were
you born or your wifes maiden name?
And howmany of you, whether intentionally or not, have
the answers to questions like these stored on your computer,
or in your browsing histories, in some unknown temporary
folder in a dark corner of your system?
The point is, our computers contain such vast amounts of
data, much of it were not even aware of, that the only way to
be certain anything is safe, is to make it all safe. That is, to
encrypt your entire hard drive.
Fedora has by far and away the best support for this kind
of encryption, so well be using it to demonstrate. To follow
along, youll need to download the Fedora live CDfromthe
website, and either write it to a CDor put it on a USBstick.
To implement this kind of encryption youll need to
securely wipe everything off the existing hard drives and then
reinstall the system.
If you dont do this, a thief or cracker might be able to
recover unencrypted data fromyour previous installation,
bypassing your newsecurity measures.
File encryption:
Core Skills Beginner-level tutorials
for users dipping their toes into Linux
Got asuper newbusiness ideayoudont want your competitors findingout
about?Jonathan Robertsshows youhowtolockdownyour computer.
C
ryptography is the art of protecting information from
interference by unauthorised third parties. This can
mean keeping data confidential, or ensuring its
integrity or authenticity.
Thanks toJames Bond movies andTVprograms such as
Spooks, the word quickly conjures up images of spies
meeting in darkened rooms, secret societies and clandestine
government agencies with giant banks of computers.
Last monthWe learnedhowtostave off disaster witha security masterclass.
Fedoras installer makes it easy to encrypt your entire
system just put a tick in the box.
Core Skills Tutorial
www.tuxradar.com December 2011 LXF151 77
If you missed last issue Call 08448482852or +441604251045.
So, the first thing to do is back everything up. You can do
this however you like, but attaching an external hard drive and
using the file manager to copy the home folder is as good a
way as any.
Make sure you inspect this backup carefully, as youre
about to delete everything and your family will be very upset if
you lose all the Christmas photos.
Once youve done that, you can securely erase all traces
of the old data fromthe current hard drive. Boot the Fedora
live CDand then launch a terminal. Into this terminal, were
going to enter the command below. It will delete everything
theres no undo, no second chances so be sure youre
confident of your backup and what youre doing before you
even begin to type:
su -c dd if=/dev/random of=/dev/sda
dd stands for disk dump, and all it does is copy the input file
(if), byte by byte, into the output file (of). By specifying the
input as /dev/random, a special file that contains an infinite
amount of randomdata, and the output as /dev/sda, the first
hard drive, we overwrite everything on it with randomdata.
This not only deletes it, but makes it much harder for forensic
data analysts to recover what was there before.
Nowthat all your old data has been securely erased, you
can begin the work of
rebuilding your systemwith
encryption fromthe get-go.
While still running the
Fedora live CD, launch the
installation application. As
you progress through the
installation screens, youll eventually come to one that asks
What type of installation would you like? At the bottomof
this screen, youll see an option for Encrypt System. Select
this, then on the next screen enter a secure password, and
proceed with the rest of the installation as normal.
Thats all there is to it. The Fedora installer will handle all
the details, and when you reboot youll be asked for the
Keeping secrets
After installing
Fedora with
encryption
enabled, youll be
prompted for a
password before
it boots.
Public key vs symmetric
There are two major types of encryption
systems: public key and symmetric, each of
which is better suited to different scenarios.
Symmetric simply means that theres only
one encryption key only one password
thats used to both encrypt and decrypt the
data. Its the type of encryption that we used to
encrypt our entire computer, and that
TrueCrypt uses too.
If youre only encrypting the data for yourself,
it works excellently. But if you want to share
data with others, symmetric encryption faces a
major problem: you have to be able to exchange
the key or password securely. If someone else
gets hold of it, then encrypting the data in the
first place was pointless.
Public key encryption uses two keys one
for encrypting the data and the other for
decrypting it. The idea is that if you want to
send some sensitive data to me, you use my
public key to encrypt it. This public key is then
useless for decrypting the data again the
only way to do that is with my private key, which
only I have.
This way, you can send information to me
and we never have to find a secure way to share
a key. This makes it ideal for sharing encrypted
data and for authenticating who sent
something, as they cansign it with their private
key, and this can be confirmed using the public
key. We cover this type of encryption in the final
section of this article, where we look at GPG
and Seahorse.
password before Fedora even begins its boot sequence.
All thats left for you to do is restore your files fromthe
backup and youll be computing just as before, only much
more securely.
Portable encryption
For all the safety that encrypting your entire computer brings,
there are times when youll want to keep something sensitive
on a USBstick, or perhaps back it up to your Dropbox folder
for safekeeping. In these scenarios, having an encrypted hard
drive is of little help.
Instead, youll want to be able to create something a bit
like an encrypted folder something that can be copied from
one computer to another, or attached to emails. There are
lots of ways you can do this
on Linux, many of which are
built right into the OS. In
this article, however, were
going to focus on
TrueCrypt, which is
available onWindows, Mac
and Linux, making it the most portable and flexible option.
TrueCrypt is a free, open source application, so just install it
on all the systems that youre likely to use it with. It doesnt
create an encrypted folder; instead, it creates a virtual disk
within a file and encrypts this. Whenever you use TrueCrypt to
decrypt the virtual disk, it will be presented in your file
manager as an ordinary USBor hard disk.
Overwriting the drive
makes it much harder to
recover what was there.
Tutorial Core Skills
78 LXF151 December 2011 www.linuxformat.com
Other screens that deserve extra comment are:
Encryption Options Unless you have very specific
requirements, you can leave these as they are and rest
assured your data will be safe.
Volume SizeAs TrueCrypt impersonates a physical disk,
you need to give it a fixed size. Make sure you allow
enough space for all the files you might want to store.
Volume Password Choose a secure password. See our
box on Encryption and Passwords for further guidance.
Format Options Choose FATif you want to use it on
Windows and Mac as well as Linux.
After working your way through the wizard, the new
encrypted volume will have been created; the question now
is, howdo you use it?
Accessing encrypted files
Starting fromthe main screen again, press the Select File
button and select the encrypted volume you created in the
Volume CreationWizard. After that, youll be returned to the
main screen, where you can press the Mount button in the
bottom-left of the window. TrueCrypt will then ask for the
password you set in the wizard, and it will also ask for your
administrator password.
Once youve given it all of this information, the encrypted
volume will then appear in the list at the centre of TrueCrypts
main screen. If you nowopen your file manager, you should
also see it listed alongside your other USBand hard disks. At
this point, you can use it just like you would any other disk.
Never miss another issue Subscribe tothe #1 source for Linux onpage 66.
TrueCrypts wizard is a simple way to create an encrypted virtual disk but
you might want to see our extra comments for further advice.
Encryption and passwords
This means that you can work in all your favourite
applications, save your work to thisdisk as you normally
would, and enjoy the benefits of encryption without having to
think about it.
While its encrypted, it appears on your filesystemas an
ordinary file. You can do anything with it that you would a
normal file: delete it, copy it to a USBstick, attach it to an
email whatever you like; the only difference is, to read its
contents youll need to use another copy of TrueCrypt and
knowthe password.
Creating one of theseencrypted virtual disks with
TrueCrypt is simple, really. Launch the application and, on
the first screen that appears, press the Create Volume
button. Immediately, a Volume CreationWizard will appear
which will walk you through the necessary steps. Most are
fairly self-explanatory, but there are a fewthat merit some
further explanation.
The first is the option to select a HiddenTrueCrypt Volume
on the first screen of the wizard. This hides an encrypted
volume within another encrypted volume.
This might sound strange, but it can protect you from
blackmail: if someone tries to force you to reveal your
password, you can tell themthe password for the visible one,
but they wont be able to see (or access) the hidden one
very helpful.
Once created, TrueCrypts encrypted volumes are an ideal
place to keep stuff that you might want to carry with you.
Working through this tutorial, you may have
noticed that everything weve encrypted has
relied on passwords to lock and unlock the
contents. This means that, even using strong
encryption, without a strong password its
completely useless. To help you overcome this
shortcoming, here are some tips on creating
strong passwords.
1
Dont use a password thats based on a
dictionary word. Even if you think youve been
extra fiendish by replacing some of the letters
with punctuation marks and numbers, its still
easy for crackers to guess.
2
Make the password as long as possible, and
use as many different types of characters as
you can. Every extra character in length
massively increases the amount of time it will
take for a cracker to guess it.
3
Make it easy to remember. If you write it down
or store it in an insecure location, its a
worthless password.
Numbers 2 and 3 may seemlike they contradict
each other, but since the attacker only ever
knows if theyve got an exact match to your
password, you can use a simple, easy-to-
remember password, and then pad it with some
individual, but easy to remember string.
For instance, J!n is easy to remember and
uses a good selection of characters but is much
too short it would take less than a second to
crack. ((((((J!n)))))), on the other hand, would
take a fewhundred thousand centuries to crack
using todays technology.
Its important that you come up with your
own scheme for padding the password, and
you shouldnt use the same password more
than once.
See www.grc.com/haystack.htm
(or xkcd.com/936) for more information.
Core Skills Tutorial
www.tuxradar.com December 2011 LXF151 79
Next monthImagejapesandpicture tomfoolery using the power of Gimp.
1
Creating keys
Both you and the person you want to share
encrypted files with need to create your key
pairs. In Seahorse, go to File > New and then
select PGP Key. Follow the wizard.
4
Encrypt a le
Open the file manager, and right-click on
the file or folder you want to encrypt. Select
Encrypt fromthe menu that appears, and then
select your friends key.
2
Export public keys
You and your friend then need to export your
public keys to share with one another. Select
the key you want to export, and then go to File
> Export in Seahorse. Make a note of where the
key is exported to.
5
Send the le
A new file will appear, with the extension .pgp.
This is the encrypted file, which you can now
safely send to your friend using whatever
means you choose.
3
Exchange public keys
The next step is to exchange public keys with
your friends. Its best to do this in person, so
copy your exported key to a USB stick and take
it to a meeting. Then, in Seahorse, go to File >
Import and select your friends key.
6
Decrypt the le
When your friend receives it, they can look at
it in the file manager, right-click it and choose
Open With Decrypt File. As soon as theyve
entered their password, the file will be available
for themto look at.
Step-by-step: Encryption for sharing
When youve finished with the volume, youll need to return to
TrueCrypt and select Dismount, or turn off your computer.
Once its dismounted, the volume will appear as a plain file,
which can be manipulated in the usual ways. To read its
contents again, just open it with another copy of TrueCrypt.
Encrypting files for sharing
The final encryption technique is howto encrypt a file you can
securely share with friends or colleagues, using public key
encryption. Well be using GPGand Seahorse, so make sure
you have these tools installed. Youll also want the Seahorse
plugins package for integration with your file manager.
That brings us to the end of this tutorial, and with your
newfound skills you should be able to keep your data much
more securely. There is, however, much more to
cryptography and file security than weve discussed here. If
youre serious about keeping your communications safe,
then youll need to go on and do more reading. Agood
starting point is the GNUPrivacy Handbook. While it focuses
on GPGand public key encryption, it also introduces many of
the topics that are important for applying symmetric
encryption systems, such as key length.
LXF
TrueCrypts main screen lists all of your mounted
volumes, making it easy for you to manage everything.
Tutorial LibreOffice
80 LXF151 December 2011 www.linuxformat.com
Ben Everard
left his job as an IT
consultant to
spend two years in
Tanzania installing
Ubuntu-based
systems in
schools. He now
writes about
open source
software and
adventure travel.
Our
expert
W
hatever you feel about proprietary software, the
fact is that almost every Linux user will, sooner or
later, have to work with someone who uses
Microsoft Office. Fear not; while the compatibility between
LibreOffice and its commercial equivalent isnt perfect, its
good and getting better. Using Writer, you can simply open
Compatibility Howto get your open
source software working with MS
Makeincomprehensiblefonts andbizarrelayoutsaforgottenfootnotewith
wordsmithBen Everardstips andadviceondocument harmony.
Online
versions of
Microsoft Office
applications
have reduced
functionality,
particularly
when it comes
to security and
collaboration.
Most Linux distributions come with a range of open fonts
that are roughly equivalent to the fonts onWindows. In
most situations, you can change between the two font sets
without a problem, but if page layout is critical, small
differences between the characters can combine to make
a significant difference.
In 1996 Microsoft released a set of free fonts to allowweb
users to get the same experience regardless of which
platformthey were using. These includedArial, Times New
Roman, and several of the other most common fonts around
collectively known as Core Fonts for the Web.
Under the terms of the licence, they can only be
distributed in their original files (EXE for Windows or HQXfor
Apple machines), but the licence places no conditions on
what systems can use them, so you can install themon a
Linux system, but you have to do it fromthe Windows files.
On some distributions there are packages that do this for you
(ttf-mscorefonts-installer on Debian and derivatives, and
fetchmsttfonts on SUSE), while on others you will have to
do it manually following the process on http://corefonts.
sourceforge.net.
If page layout is critical, you should use these fonts rather
than the open ones. Recent versions of Microsoft Office and
Windows default to a different set of font families, and these
have not been released under the same terms as the core
fonts. Switching fromthese newer fonts to the older ones will
allowa consistent layout between operating systems.
LibreOffice: the
Even with the same fonts, formatting remains one of the
biggest sticking points for interoperability between the two
applications. The differences between the layout of a
document in Writer and Word should be small, but if page
design is important, lots of small errors can make a big
difference. There are a fewthings you can do to help ensure
you get the desired layout on both systems:
Save as a PDF file If youre creating a document and you
want a Windows user to be able to viewit in a certain way
for example, for it to fit on one page but you dont need
themto make any changes to it, you could save it as a PDF
file. This ensures consistent layout across all operating
systems, but it does make it difficult for the recipients to edit.
To export your document as a PDFin Writer go to File >
Export as PDF.
Microsoft document viewers If you receive a document in
DOCor DOCXformat that you need to viewor print exactly as
its author intended, you can use the document viewers
available fromMicrosoft. The viewers are available for Word,
Excel and PowerPoint fromwww.microsoft.com/download/
en/compatibility.aspx?q=compatibility (select Office in
Product Category). These will run under an up-to-date
version of Wine. After installing the viewers, you will need to
install the Microsoft Office Compatibility Pack For Word, Excel
And PowerPoint File Formats to allowyou to viewthe most
up-to-date file formats (available on the same website, select
Tool in DownloadType). You can also use these to check that
documents you have created with LibreOffice will appear
correctly under Microsoft Office.
Microsoft Office Web Apps To make minor changes to a
document without changing the formatting as it will appear in
Word you can use Microsofts Office WebApps. These are
online versions of Word, Excel, PowerPoint and OneNote
available at http://office.microsoft.com/en-gb/web-apps.
Accessing themis free, although you will need to sign up for a
Microsoft Live IDif you dont already have one. While they
dont have all the features of either LibreOffice or their offline
counterparts, they do allowyou to upload a file you have
created in LibreOffice and correct any formatting errors so
that it will appear correctly toWindows users. We found that
Office WebApps worked under Chrome and Firefox, but not
Konqueror or Epiphany. If you have the Moonlight extension
Formatting
Word files (both DOCand DOCX) and make your edits.
However, there are a fewareas where compatibility between
the two applications isnt seamless, and we will investigate
these here. Its important to use the most up-to-date
LibreOffice when working with Microsoft file formats because
compatibility is increasing with each version.
LibreOffice Tutorial
www.tuxradar.com December 2011 LXF151 81
If you missed last issue Call 08448482852or +441604251045.
Microsoft
Office file
viewers, which
run under Wine,
are available
from MSs
website.
installed, you may have to disable it before accessing Office
WebApps.
To keep formatting consistent across a range of
documents, many organisations use templates. While both
Word and Writer use these, they use themdifferently. In Word,
templates are a set of styles and a page layout, but in Writer
they are just a set of styles. This means that if you use Word
templates in Writer, you wont get the full functionality.
Style council
To create a newdocument in Writer froma Word template,
you need to go to File > New>Templates And Documents
and navigate to the Template file. This will bring in the styles
fromthe template, and they will appear in the Styles and
Formatting box (press F11 to open it). If you have access to a
copy of Word, you can convert the template to a regular file.
This will allowyou to edit the file in LibreOffice and keep the
layout fromthe template. Open the file in Word, and in every
place it says Click To Enter Text, enter some text, then save
the file. When you open the file in LibreOffice you will now
have the styles and layout fromthe template. Users without
access to Word can use Office WebApps to open the
template and viewthe layout (it wont let you add content).
Youll then have to manually create the layout in Writer.
way with Word
Macros
Macros are one of the biggest problems for organisations
thinking of abandoning Microsoft Office in favour of
LibreOffice. Put simply, Word macros will not run under
Writer. However, the languages used by the two systems are
similar and anyone who can write macros inVBAshould find
the switch to LibreOffice Basic fairly painless.
If youre using a Word document containing macros that
you are not running, you can set Writer to save documents
with macros intact: go toTools > Options under Load/Save >
VBAProperties and check Save Original Basic Code. This
wont help you run the macros in Writer, but it will mean they
will still work when the document is opened in Word.
If you have to runVBAmacros, then you have to run Word,
and there are a fewoptions for doing this. You can run
Windows either through VirtualBox or dual boot, or you can
get Word to run on Linux using Wine or CrossOver Office (not
all versions of Word work equally well, check http://appdb.
winehq.org or www.codeweavers.comfor details).
If you only need to run Word occasionally, you can do it
without the expense of purchasing the software outright. No,
were not talking about pirating software, were talking about
using a hosted desktop. Acompany runs a Windows server
and, for a fee, allows you to remotely access Windows
software. Currently, most hosted desktop offerings are aimed
at businesses, with packages for a large number of units and
long subscription periods. Secure Online Desktop (http://
secure-od.com), however, lets individual users use the
systemon a month-by-month basis.
To access it, you will need to buy a subscription, then
install the 2XClient (available in Deb, RPMand BZIP2 files
fromthe website). Once installed, you can run the client by
typing /opt/2X/Client/bin/2XClient at the command line.
This doesnt give you a full desktop, but the ability to run the
various office applications remotely. This also lets you access
your documents fromyour smartphone. Unfortunately, this
setup doesnt allowyou to open documents with Information
Rights Management restrictions on them(see page 83).
Secure Online Desktop provides access to Microsoft applications for a
monthly fee and its half price for teachers and students.
Tutorial LibreOffice
82 LXF151 December 2011 www.linuxformat.com
Never miss another issue Subscribe tothe #1 source for Linux onpage 66.
Working with users of other systems isnt just about making
the document look the same, its also about helping multiple
authors work more efficiently. One of the most basic
collaboration tools is the ability to add comments, which are
useful when lots of people are working on one document, or
when someone reviews a document created by someone else.
The only important difference between the way the two
systems handle comments is that Word adds themto a
section of text while Writer adds themto a point of text. Block
comments created in Word are displayed by Writer at the final
point. To insert comments in Writer, place the cursor where
you want it to appear and go to Insert > Comment. Its the
same in Word, except that you can highlight a section of text
before creating the comment.
Both applications also let you highlight sections of text but
while Writer can remove highlighting added in Word,
highlighting created in Writer isnt treated as such by Word,
and so the highlighting tool cant remove it instead, you have
to clear the formatting. In versions of Word earlier than 2007
go to Format >Styles And Formatting, then select Clear
Formatting in the Pick Format ToApply list. In Word 2007 and
Rather than tracking changes, you can make themin a new
document and use the Compare Document feature. This
brings the changes into the original with the option to accept
or reject each one. In our tests, LibreOffice crashed when we
did this with DOCXfiles, so before you start, you may need to
convert all the files into another format (DOC, ODTand RTF
formats all worked fine). If necessary, you can convert the
final file back into DOCXafter the merge.
Open the amended document and go to Edit > Compare
Document; this will open a windowwhere you can select the
original that you wish to merge. LibreOffice will then attempt
to isolate any changes and bring themin so you can accept or
reject themin the same way as before. Note that you start
with the amended document rather than the original doing
it this way round means youAccept changes to add them. If
you start with the original, you have to select Reject to add
them, which is a little unintuitive. We also found that we got
fewer formatting errors starting with the amended document.
Edit > Changes > Merge Documents should do this
automatically, but failed every time we tried it.
To performthe same operation in Word, start with the
original document (that is, the opposite document to Writer)
and go toTools > Compare And Merge.
Writer allows you to save several versions of a document
in a single file. You can create and save versions by going to
File >Versions. However, it only supports this feature in ODT
files, and not in RTF, DOCor DOCXfiles. If you receive a DOC
file with different versions in it, and make changes to it, Writer
will erase the previous versions when you save it. Word
supports this feature in DOCfiles, but not DOCX. The only
workaround for this is to use different files for each version.
Microsoft has released a Version ExtractionTool as part of its
Office Migration Planning Manager, which converts a single
file containing many versions into many files, each containing
a single version. However, this tool only runs onWindows and
not through either Wine or CrossOver Office.
Be aware that
Writer places
comments on a
point rather than
a block of text.
Collaboration
Comparing and merging documents
2010, select the highlighted text, right-click in it, then go to
Styles >Clear Formatting. If youre using Linux and want to
add highlighting that will work in Word, use OfficeWebApps.
Both word processors also allowyou to track any changes
made to a document. This is best used when the document is
almost finished and only small edits are left, otherwise it can
get unwieldy. In Writer, its a little unstable when working with
DOCXfiles, so save early and often. To turn this on in Writer,
go to Edit > Changes > Record. In Word 2003 and earlier this
is found at Tools >Track Changes, and in later versions its in
the Reviewtab. With this enabled, your changes will appear
coloured and underlined. When you send the file to other
users, they will be able to decide which to incorporate into the
document by right-clicking on the coloured text and selecting
Accept Change or Reject Change fromthe Context menu.
Sometimes we found that these options didnt appear in the
Context menu. If this happens, place the cursor inside the
highlighted text before right-clicking. Some users report that
saving documents with changes tracked in DOCXcauses
LibreOffice to crash. If this happens to you, save the
document in RTFformat.
When running
Windows
applications on
Linux, always make
sure that you use
the latest version
of Wine, because
its under constant
development.
Quick
tip
LibreOffice Tutorial
www.tuxradar.com December 2011 LXF151 83
Passworded DOC files let you share information with some
security but you should encrypt it for extra protection.
Security
Helping many users work on a document is great, but
sometimes you need to restrict which users can do what.
Word has a more advanced set of security features than
Writer, and compatibility between the two systems is good,
but not perfect. In general, security in DOCfiles is better
supported in LibreOffice than DOCX. The most basic method
of protecting a file is adding a password to open it. This works
seamlessly with DOCfiles, but not with the newer format.
LibreOffice will open password-protected DOCXfiles but it
cannot save them. If you save a DOCXfile that was password
protected in Writer, it will save it without password protection.
Both Writer and Word treat read-only DOCfiles in the
same manner, that is, they allowyou to open the file to read it,
and if you save it to a different file name you can edit it. Writer,
however, doesnt recognise the read-only flag on DOCXfiles
and allows you to edit themand save the changes to the
original file. This file will still be treated as read-only by Word.
Its also possible to save a file in Word with a PasswordTo
Modify. This means that any user can read the file, but only
users who knowthe password can edit it. The behaviour of
LibreOffice with these files varies. DOCfiles saved in this way
will open as read-only, and you can edit themby saving them
as a separate file. DOCXfiles, however, will open editable with
no restrictions. Writer can set a PasswordTo Modify (when
saving tick Save With Password, then click Save and in the
password box click Advanced), but we found that this didnt
work it caused both Writer and Word to open the file as
read-only. In Writer this isnt a problembecause you can use
the Save As workaround. However Word opens these files in a
locked down manner that wont even let you copy and paste
the text into a newfile.
Word also lets you limit the range of styles users can apply.
Files saved like this work differently in Writer depending on
the file format. DOCfiles open as read-only and you have to
save themto a different file name before editing them, while
DOCXfiles open normally without restrictions. Writer does
not have the facilities to save files with this type of security.
The one aspect of document security that we found no
way of working with on Linux was Information Rights
Management. Word allows an author to set the document so
that only specific people (set by Windows Live username)
can open or edit a document. With this set, we found that
the file failed to open in LibreOffice, AbiWord, Office Web
Apps, or Microsoft products running on Wine or CrossOver
Office. This is the one area where the only option is to use
Windows or ask the person sending you the file to remove
these restrictions.
LXF
File formats
Other Microsoft Office apps
Since the first open source word processors
were released, their developers have been
engaged in a game of cat and mouse with
Microsoft over file formats. Once open source
developers figured out howto read and write to
DOCfiles, Microsoft abandoned the format.
Cynical readers could be forgiven for thinking
that the same thing will happen with DOCX.
However, DOCXis based on Office OpenXML,
which is a published standard. The problemfor
LibreOffice is that its current implementation
deviates fromthe standard. Microsoft has
announced its intention to fully support the
standard in the next version of Office which
isnt a boon for freedomsince its covered by
Microsofts patents but it has agreed not to
sue firms that use it, so it should lead to greater
interoperability between the two office suites.
The lesser-used office applications are
more difficult to work with fromLinux.
Using MDBTools, it is possible to get
Base to open older (pre 2007) Access
files as read-only, but support is patchy.
As part of the 2011 summer of code,
Eilidh McAdamis working on an import
filter to allowLibreOffice Drawusers to
open Visio files. By the time you read
this, the feature may be in the latest
release of LibreOffice. If not, you can
access it by compiling the code fromGit.
There are a fewopen source
alternatives to Project that are capable
of reading MPP and MPXfiles such as
Openproj and Planner.
Publishers PUBfiles are the hardest
of Microsofts proprietary file formats to
open in Linux. To our knowledge, there
are no Linux applications that open
these files and Publisher doesnt run well
under Wine and only earns a Bronze
medal for compatibility in CrossOver
Office. There are some online conversion
tools that claimto convert these files
into more Linux-friendly PDF files. You
can access Publisher through Secure
Online Desktop.
Calc and Impress
Along with Writer, Calc and Impress
formthe basis of the LibreOffice Suite.
As with Writer, both are able to read and
write to the latest file types (XLSXand
PPTX) but work better with the earlier
versions (XLS and PPT).
In LibreOffice version 3.4, the DataPlot
function has been improved and
renamed PivotTable to bring it into line
with Excel. The two stumbling blocks in
Writer also appear in Calc: macros and
Information Rights Management. Layout
is another source of problems,
particularly when using charts or graphs,
so its a good idea to check your files
using Excel Viewer or Office WebApps
before sending themto an Excel user.
Formatting and layout are often more
important when using PowerPoint files.
PowerPoint Viewer running under Wine
is only able to viewPPT, while Office
WebApps is able to open both these
and PPTXfiles. If your web browser
supports full screen mode, you can use
Office WebApps to give presentations
fromPPTXfiles if the layout under
Impress is not perfect.
When moving
fromWriter to
Word, documents
sometimes become
corrupted, so its a
good idea to keep
backups.
Quick
tip
If possible, use
DOCfiles rather
than DOCXwhen
working with Writer
and Word.
Quick
tip
www.linuxformat.com 84 LXF151 December 2011
Advertorial
Secure your server
Virtualisation can boost your bottom
line if you protect it
V
irtualisation is big news for small and medium-
sized businesses it enables themtodomuch
more work with much less kit by running
multiple operating systems on a single server.
Thats good news for a range of reasons reducing
carbon footprint, improving IT efciency and saving
piles of cash. But it seems that many businesses arent
protecting their virtualised systems. Sohowcan you
keep yours safe?
Simple steps
Security rmSymantec surveyed nearly 700
companies in 28diferent countries, discovering rms
investing in virtualisation werent taking simple steps
toprotect their data. Just 15%were backing up data
used in their virtual environments, and an incredible
80%werent protecting their virtual environments with
anti-virus software.
Thats an incredibly risky approach, especially when
securing your server is sosimple. Fromthe smallest
start-up tothe biggest agency, Dell has the security
solutions tokeep your stufsafe.
Multiple lines of defence
Dell has created four kinds of security solutions:
security services, which provide a comprehensive
range of monitoring, management and security
consulting services; network security, which protects
your business not just frommalware such as viruses
and worms but alsofromintruders and even spam;
endpoint security, which protects the data on PCs,
notebooks, servers and mobile devices; and data
security, which enables you toprotect sensitive data
fromprying eyes, digital disasters and good old-
fashioned human error.
Secure the perimeter
Protecting your network fromintrusion is easier
than you might think. Appliances such as the Dell
PowerConnect J-SRX series provide world-class
rewall protection and IPSecurity (IPsec) virtual
private networking technologies. Easy, quick and
secure todeploy, the J-SRX series ofers superb
intrusion protection, anti-virus protection, anti-spam
screening and even web content ltering.
Better than a bouncer
Dell also provides tools to protect individual devices
systems with IntelvProprocessor technology
can automatically stop viruses fromspreading,
ensure secure data storage and receive security
updates even when PCs are of. Remote diagnostics
and repairs, asset inventory and zero-touch
conguration enable you to deploy, manage and
update vPro systems fromyour desk.
Trend Micro Worry-Free Business Security Services
can be preinstalled on Dell systems to protect against
malicious software and mail, restrict users access
to sites, and provide continuous protection for your
mobile workforce without requiring dedicated
hardware or IT staf.
For larger networks, the Dell KACE K1000
Management Appliance ofers even more powerful
security, including quarantining compromised
devices, automatic software patch management
for Windows and Mac OS X operating systems and
applications, vulnerability scanning and secure web
browsing.
Security saves money
Dell also provides networked storage to ensure
every digital asset is archived. Solutions such as Dell
PowerVault RD1000 removable disk storage ofer
low-cost, rock-solid, super-speedy backup, while
larger organisations can benet fromthe server-
connected PowerVault MD3220 storage arrays
incredible scalability, supporting up to 96 additional
drives between up to four servers.
By protecting your data and systems, by ensuring
things run 24/7, by patching software vulnerabilities,
enforcing policies and helping you comply with data
protection legislation, Dells solutions can save you
time, efort and money.
The Dell diference
Dell servers work as hard as you do. We work with
leading Independent Software Vendors (ISVs) to
deliver unrivalled performance and reliability, and
our PowerEdge tower servers and rack servers are
built for demanding jobs in creative, engineering and
architectural design; web design and development;
photo editing, nance and product design. With the
latest technology in our scalable servers and storage
solutions, Dell is the one-source partner to match
your IT ambitions.
Tofindout more, please
visit us at www.dell.co.uk/poweredge
or call us on08444443359
www.tuxradar.com December 2011 LXF151 85
Brought to you by
To find out more,
please visit us at
www.dell.co.uk/server
or call us on
0844 444 3359
Dell PowerEdge Server T410
Next generation Intel Xeon processors, stunning
performance and exceptional scalability
www.dellcreativestudio.com/servers/
Powering your IT needs
Intel, the Intel logo, Xeon, and Xeon Inside are trademarks or registered trademarks of Intel Corporation in the U.S. and/or other countries.
UPGRADE YOUR HARD
DRIVE TO2TB FOR FREE!
THE POWER YOU NEED
The PowerEdge T410 Tower
Server is no ordinary server: its
your server, built to your precise
specication. With a choice of
quad-core and six-core 5500
and 5600 series Intel Xeon
processors, it delivers incredible
performance and with support
for up to 128GB of DDR3 RAM
and 18TB of internal storage it
has the memory and capacity for
businesses that think big.
THEBEST, MADEBETTER
The PowerEdge T410 delivers even more
processing performance, memory and
storage than its predecessor, ofering
increased capacity for virtualisation
performance and scalability. New DDR3
memory ofers higher bandwidth and
lower power consumption than previous
FBD or DDR2 technologies, with more
memory slots so that you can use smaller,
less expensive DIMMs to meet your
computing needs while controlling costs.
And the PowerEdge T410 features quiet
acoustics, a cutting-edge chassis and
simplied systems management tools.
EXCEPTIONALSECURITY&SUPPORT
From desktop to data centre, Dell
ProSupport provides a range of options
including same-day, next-business-day and
mission critical response services, asset
and data protection, specialised onsite
services, proactive maintenance and parts
management, and remote advisory services
backed by global command centres
and expert centres around the world. By
integrating our hardware, software and
services, we can minimise your transition
time and costs, help you improve your
business productivity, and more quickly
realise the return on your investment.
Tutorial Arch Linux
86 LXF151 December 2011 www.linuxformat.com
If hes not thinking
of stuff to put in
Linux Format or
playing with old
synthesizers,
Graham
Morrison is
probably finding
newways to be
more productive
with KDE 4.
Our
expert
for testing their popularity and stability, before potentially
making their way to a community repository. That means
they can cause problems, and for that reason, we wouldnt
recommend installing themon a mission critical system.
However, weve yet to encounter a problemthat cant be
resolved by uninstalling the package.
Build your own packages
The main issue is that, without installing a graphical or
command-line helper, there is no easy one-click way of
installingAURpackages. Thats because they come in several
different shapes and sizes. Some, such as Spotify, Dropbox
and Crossover Office, use the install script to download
proprietary blobs of data fromeach services internet portal
before building these into an installable package.
Others, such as the excellent game TripleAfromthis
issues HotPicks, will download the latest source code from
SourceForce and automatically build this into an end package.
The result of both methods is the same: the pacman -U
package.tar.tz command thats used to upgrade an official
package can be used to install the results, giving you a
working installation with all the remove/update advantages of
a genuine release.
The key to this operation is a file called PKGBUILD. This
file is really a script that describes exactly what needs to be
done for anAURpackage to be created, whether thats
downloading binary blobs fromthe Dropbox website or
compiling the source code froma Git repository. Providing
access to these files is the main purpose of the AURlanding
site (http://aur.archlinux.org), as it enables you to search
these files froma library uploaded by the community. Search
for Dropbox, for instance, and youll be presented with a list
of community-supported
packages, and clicking on
any of these will take you
to the packages home
page. This is a place where
the community can
discuss the popularity of a
project as well as report any problems with the current
package and offer solutions. The page will also list
dependencies and provide two download links one that
links to the PKGBUILDfile directly and another that embeds
this file, along with any other files required by the installer,
within a tar.gz archive.
To install anAURpackage, you need to download either of
these. Wed recommend the archive, which will then need to
be unpacked (tar xvf *.tar.gz). Within that folder, youll find
PKGBUILD, and whether you downloaded this directly or
through the archive, the next step is identical. Type makepkg
within the folder, and the script will be magically interpreted
and things will start to happen. Heres the output you get if
you install one of the Chrome browser packages, for instance:
Arch: Master the
Arch Linux Delve into the AUR
and fnd a host of handy packages
GrahamMorrisontackles oneof thebest aspects of theever popular Arch
distributionandshows youhowtoinstall thelatest cutting-edgesoftware.
A
rch breaks the mould for a modern Linux distribution.
Unlike the almost-automatic installers you find on
Ubuntu and OpenSUSE, gettingArch onto your
machine can be tricky, requiring some manual effort to
coerce it into perfection.
But this hands-on approach is also what makes it so much
fun. You get maximumcontrol over your installation, and learn
a great deal about howthe whole systemworks in the
process. These elements
are no better realised than
inArchs packaging
scheme using the superb
pacman. It isnt as complex
to use and maintain as
schemes found in other
distributions, but its still flexible enough to be the backbone
behindArchs rolling release philosophy and much of its
power. Upgrades can be made in-place, packages ignored
and even rolled back to a snapshot if you need to.
Its best feature, though, is that its not that difficult to build
your own packages, and many community members have
done just that, creating something called the Arch User
Repository (AUR). Its probably the best source for disparate,
cutting edge and difficult-to-find software for any distribution,
and one of the best reasons for usingArch in the first place.
Unlike the official pacman repositories, a little extra work is
required when you want to install anAURpackage yourself,
and its this problemwere going to tackle here. But first, the
usual caveat: AURpackages arent bullet-proof. Theyre built
Its probably the best
source for cutting edge and
difficult-to-find software.
Arch Linux Tutorial
www.tuxradar.com December 2011 LXF151 87
TTP request sent, awaiting response... 200 OK
Length: 40869182 (39M) [application/zip]
Saving to: `chrome-linux.zip
40,869,182 662K/s in 55s
2011-09-13 16:20:57 (730 KB/s) -chrome-linux.zip saved
[40869182/40869182]
-> Extracting Binaries...
-> Creating missing symlinks...
-> Patching script chrome-wrapper...
-> Making it nice...
==> Tidying install...
-> Purging other files...
-> Compressing man and info pages...
==> Creating package...
-> Generating .PKGINFO file...
-> Adding install file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: chromium-browser-bin 100441-1
Fromthis log, you can see that data is downloaded and
rolled into a package that combines local files and
configuration data with the binary blob, all of which go into a
newpackage. This can be found within the same directory as
the package name, named with an added release version
number, CPUarchitecture and the .tar.gz extension. Install it
with the sudo pacman -U package.tar.gz command.
The previous step was comparatively easy, especially if
youve used Gentoo to do build packages source, but its still
not as convenient as pacman. Fortunately, theres a better
solution in the shape of a tool called packer. This does for the
AURwhat pacman does for the official package repository
(and it can really do both), by enabling you to install and
upgrade AURpackages with a single command, without
User Repository
WithAURpackages,
the onus is on
you to check
packages before
theyre installed.
Thats why you get
the opportunity
to examine the
installation scripts
before theyre run.
Quick
tip
If you missed last issue Call 08448482852or +441604251045.
Even when MD5 checksums are embedded within the
install script, AUR packages still pose a security risk.
Pacman quick reference
pacman -S package
Install the package and its
dependencies.
pacman -U URL
Install a local or remote standalone
package.
pacman -U /var/cache/pacman/pkg/
old_version
Revert to an older package version.
pacman -R package
Remove a package and its
dependencies.
pacman -Ss string
Search the repository for the term
string.
pacman -Syu
Upgrade all installed packages to the
latest versions.
worrying about searching the wiki or downloading any files
manually. The best way to get the latest version of packer is
with the AURusing the method weve just described, and
hopefully, that will be the last time you need to use it. After its
installed, search by typing packer -Ss package, and install
with the packer -Scommand, exactly as you would with
pacman. Everything else should be handled automatically.
Even more impressively, packer keeps track of whichAUR
packages are installed and lets you upgrade themall with a
single command packer -U. This will grab all updates,
download, compile (if necessary) and install them, which is
brilliant. If you no longer need a package, and because AUR
packages are eventually installed by pacman, you need to use
this to remove themrather than packer.
LXF
Package GUIs
Inevitably, with a distribution thats
installed using plenty of command-line
tinkering, its difficult to get away from
the console when everything is up and
running. But there are a fewexcellent
GUI alternatives to both pacman and
packer on the command line if youd
rather manage your packages fromthe
desktop. For KDE and Gnome, there are
PackageKit-based GUIs, but the best
weve found for both desktops is called
AppSet-Qt. Its stable enough for day-
to-day use, and provides the best
search and results user-interface of the
GUIs available.
AppSet-Qt will need to be installed
fromthe AUR, either using the packer
or manual method, and after being
launched fromyour desktop, it should
enable itself to run automatically when
you log in. Using the application is easy.
Fromthe main window, you can use the
category icons to discover new
packages, or the search field to fine-
tune your requirements. AUR packages
can be found by switching to the AUR
tab at the bottomof the main view, and
both repositories and packages can be
updated automatically fromwithin the
application. Weve only experienced
problems with AUR packages that fail
to build, but thats not AppSets fault.
AppSet-QT is the best GUI weve
found for accessing both the official
and user package repositories.
Tutorial Arduino
88 LXF151 December 2011 www.linuxformat.com
When launching
LXF, only a set of
Nick Veitchs
Bash scripts kept
the magazine
going. Then they
were replaced with
people, a
retrograde step in
his opinion...
Our
expert
breadboard. All sorts of issues can be thrown up by the
components you choose and the way you connect them, so
this is an important first step in any custombuild.
If all you want to do is build a spare Arduino, then you
might be happy enough just having a barebones device on a
breadboard anyway it certainly makes it easier to
experiment with.
The first thing we need to contemplate is the power
supply. Running off USBis fine if you arent going to be
powering too many things fromit (depending on what youre
connecting too, the available current may only be a few100s
of milliamps not enough for that amazing robotic lighting
systemyoure planning) plus, we may not even bother with
the USBconnection at all.
Its certainly possible to run directly frombatteries. The
ATmega168/328 chips have a good tolerance for the input
voltage, fromaround 2.7Vup to 6V. If you use four AAbatteries
in series, you should be getting somewhere between 4.8 and
6V(rechargable types are typically 1.2V, not 1.5V) which is fine
for many applications, but there are some things to beware of:
Applications that depend on the analogue inputs may be
inconsistent. If youre comparing to a 5Vsignal, thats fine
as long as its actually 5V. As the batteries discharge you
could be getting a lot less than that.
Underpowering the chip can have unexpected
consequences. It may still nominally run at 3V, but not at the
same speed, which can mess up all sorts of things.
An inconsistent supply leads to inconsistent behaviour
ideally you want the voltage to be there, or not be there.
Batteries will gradually lose voltage as they discharge, and
Arduino: Build
Electronics Fancy a built-in clock?
Then custombuild your own Arduino
Tiredof inadvertentlyblowinguphardware?Nick Veitchdecides tohavea
goat puttingtogether oneof his ownandfinds its easier thanhethought.
I
n this tutorial, in a bit of a break fromour usual
component-centred articles, well be looking at building a
customArduino. This really came about because I
messed up the bootloader on a fewchips, so I needed to
reprogramthem by turning anArduino into a programmer.
Actually, building the hardware turned out to be easier than
reprogramming the microcontrollers, but you should learn
some good practical skills by doing it yourself.
Why build it yourself?
Usually the answer is because its cheaper. That may still be
the case if you happen to have a lot of spare components and
time on your hands, but realistically, pre-built Arduinos are
not that expensive. So why bother?
Remember, the important freedomof free software is not
that it doesnt cost anything, but that you are free to change
it. There are many reasons you might want to build a custom
version of the Arduino maybe youd like to have a built-in
clock, or extra eepRom, or something with a fewswitching
transistors or relays on board.
Basically, anything that you could do with anArduino
shield, you could build into anArduino board. If you were
cunning, you could still make it Arduino-compatible to the
extent of being compatible with other shields.
Before you even think about making a pCBfor your
project though, you really need to iron out the design on a
An L7805-based power supply will be more than adequate
for your own design, and doesnt take up much space.
Last monthWe showedyouhowtowire upservos andstepper motors.
Arduino Tutorial
www.tuxradar.com December 2011 LXF151 89
AnArduino OR
an ISPprogrammer
such as the
USBTiny.
Aspare
ATmega168 or 328p
processor.
A16MHz crystal
A7805 power
regulator.
Assorted
capacitors and
optional LEDs.
You will
need...
If you missed last issue Call 08448482852or +441604251045.
you may not knowyour device is not working properly until
something goes very wrong.
While the ATmega/Arduino may tolerate such voltages,
other components may not. many devices, particularly ICs,
rely on having a consistent, known voltage.
For all these reasons and more, its worthwhile to include
some sort of power regulation onboard. You can of course
buy a regulated 5Vpower supply, but having an onboard
regulator means you can get away with cheaper unregulated
supplies or other sources.
Fortunately this is pretty simple to do. The 78xx series of
ICs has been around a long time and has proven to be
reliable and popular, resulting in a reasonable price point too.
As with almost all regulator ICs for these purposes, they are
a three-terminal device one for input, one for ground and
one for output.
They will require external capacitors to help smooth and
buffer the power signal too these will be specified in the
manufacturers datasheet, but dont get too hung up on the
values the L7805 works fine with 100uFcapacitors for our
purposes, and anything from22 to 470uFis going to be oK.
Awarning about this dont be tempted to use ceramic
capacitors for this purpose. They are fine for many other
parts of your circuits, and are small and cheap. However, their
terrible disadvantage is that they exhibit poor tolerances and
wildly non-linear variations in capacitance when they get
warm, as they are quite likely to in this case.
The regulator will knock a couple of volts off your
incoming supply, so ideally you will use a 7.5Vwall-wart
mains transformer, though anything up to 12Vshould be fine.
The extra volts are converted into heat though, so beware
dropping 12Vdown to 5Vmay require a heatsink.
Chips with everything
Nowthe supply is sorted, we can start thinking about the
ATmega chip. obviously we can plonk it down on our
breadboard, but it does need some extra components to
work. Although its possible to run it froman internal
oscillator, it can run much faster when you hook it up to a
proper crystal.
Sometimes you will see designs that use a self-contained
oscillator unit, which doesnt require extra capacitors. The
main reason given for this is that they are cheaper and work
just as well. They do work just as well, but fromchecking a
variety of sources, it probably isnt significantly cheaper, even
if you buy hundreds at a time. It does take up less space
though, if that is important to you. In any case, the oscillator
or crystal and caps need to connect between pins 9 and 10
on the ATmega168/328.
The microcontroller also has a dedicated reset line, which
is always handy when things dont quite work as expected, so
we can wire this up to a tactile pushbutton switch, just as it is
on a real Arduino.
The reset line causes the microcontroller to reset when
the line goes low ie is connected to ground. even if we cant
be bothered connecting a switch here, we will need to add a
pull-up resistor to stop the pin fromfloating and possibly
triggering a reset we didnt want.
Simply connecting a 10k resistor between it and the +ve
supply should be enough, and will not interfere with the
operation of our switch if we decide to add one.
Believe it or not, thats all that is required to actually make
the ATmega chip work, and pretty much, you have anArduino
right there. To add a little more familiarity, and importantly, to
be able to test things, well probably want to add some lights.
The standardArduino has an LeDon digital pin 13, which
is made use of quite a lot in the example sketches, including
the most basic one, Blink, which is also good for discovering
whether anArduino is working or not.
Digital pin 13 on the Arduino headers translates to pin 19
of the actual chip itself, so ordinarily we would stick an LeD
and a current-limiting resistor of about 270in there.
However, fewpins on the actual ATmega chips have only one
purpose. pin 19 also doubles up as the serial clock line for
the In Systemprogramming (ISp) feature. This is something
we are likely to use, so we need to make sure our LeD
doesnt interfere. Upping the current-limiting resistor to
something between 1kand 47kshould still light most
LeDs, but wont drawoff enough current to interfere with
the programming signals.
Programming the ATmega168/328
Nowwe have anArduino of sorts, the only thing left to do is
work out howwe are going to programit. There are really
three options here. Aproper Arduino has a USB-serial
your own board
Fitting out
the breadboard
with an ATmega
MCU and the
few support
components it
needs to turn it
into an Arduino.
Tutorial Arduino
90 LXF151 December 2011 www.linuxformat.com
interface of some kind. This is very nice, but a bit tricky to
implement on a breadboard or indeed on a pCByou might
want to build yourself, as the interface chips are usually of a
type rather tricky to solder by hand. You can get abreakout
board fromcompanies such as Adafruit (www.adafruit.com)
which will include the serial interface chip and USBconnector
on a small board with breadboard/socket-friendly pins.
The second option is to use a programmer specifically
designed to use the ISpinterface. There are a number of
different models, but the USBTiny is probably the best (again,
designed and available fromAdafruit, and elsewhere) as its
simple, cheap, easy to connect to your pCand handles a
number of Atmel devices, not just the Arduino specific chips.
The third option is to use anArduino to programthe
Arduino. This may seema bit weird until you realise that all of
thecustom programming devices are pretty much just that,
except they tend to use simpler microcontrollers. (See the
Arduino ISpboxout.)
If you use option 1, you can just proceed as normal to use
the Arduino software. For options 2 and 3, you will need to
enter the world of the command line, and AVRdude.
AVRdude is actually used by the Arduino IDe itself.
Whenever you press the Upload button in the Arduino editor,
the following things happen:
Thesketch file is turned into standard Ccode by including
theWiring library and any required function headers.
This file is then compiled with avr-gcc, the Gnu compiler for
the AVRmicroprocessor.
The compiled file is linked and a standard eLFfile is created.
The eLFfile is converted intoIntel Hex format.
The hex file is sent to the hardware using AVRdude.
Using AVRdude directly, we can bypass that part of the
IDe code and therefore not need to rely on its hardwired
dependency on our board having a USB serial connection. If
you wanted to, you could do all the steps manually, but to be
honest, the first one is a bit tricky (or at least, its easy to
make mistakes which you might not even notice until later),
so one time-saving solution is to have the IDe still do the
hard work for you.
Verbose mode
If you hold down Shift whilst pressing the Verify button on the
IDe, it switches to verbose mode, and the lower panel will spit
out reams of info about whats going on.
In amongst this, it will tell you where it has written the
temporary hex file compiled fromyour program thats
because the verify process actually goes through all the steps
of building your software except for the very last one
uploading it to the board. The file will be stored in wherever
temp files are kept on your system, usually somewhere in
/tmp see the walkthrough for more instructions.
once you have your hex file you can use AVRdude to
upload it. If you have the USBbreakout hardware, or you want
the finished chip to be Arduino compatible, youll also want to
install the bootloader. It doesnt hurt to do this anyhow it
takes up a bit of room, but it does mean you can easily swap
the chip with one on a real Arduino.
The first thing is to check that AVRdude is working and
can see the programmer and chip. You will need to give it two
parameters for this. The first is the part number youre trying
to program. The software supports a wide range of
microcontrollers, but the Arduino ones youre likely to use are
m168 and m328p for modern devices. The programmer is
whatever youre using to write to the chip with eg usbtiny
or arduino or whatever other programmer you have (see the
Its impossible
to make an
ISP header on a
breadboard, but
its much easier
if you route
the required
connections to
a row, then you
can just use
wires directly to
the 6-pin header
cable.
A dedicated
programmer
such as the
USBTiny is a
sage investment
if youre going
to be doing a lot
of this.
Arduino ISP
Using an Arduino to programanother Arduino is pretty easy
if you load it up with the right software as a standard
Arduino has an ISP header, it is even quite simple to wire
up. There are excellent step-by-step instructions on howto
set up a breadboard or a spare Arduino board to be
programmed in this way on the Arduino website
(http://arduino.cc/en/Tutorial/ArduinoISP).
The Arduino
website has
an excellent
tutorial on
setting up an
Arduino as a
programming
board, and links
to the relevant
sketch.
Arduino Tutorial
www.tuxradar.com December 2011 LXF151 91
AVRdude website for details on supported devices
http://savannah.nongnu.org/projects/avrdude).
$ avrdude -p m168 -c usbtiny
You should get a brief fewlines of output telling you the
device is ready. If you get an error about the device not being
found, its possibly a permissions error (try running the
command again as root). If you get an error that says
initialization failed it means that the programmer is working
oK, but it cannot find the chip its supposed to program
check the connections and orientation of any cables.
The bootloaders for the various Arduino chips are stored
with your Arduino software. Depending on your distro, this will
be somewhere like /usr/share/arduino/hardware/
arduino/bootloaders. The names are explanatory, but too
long for my tastes, so you may want to make copies with
more sensible names.
Non-volatile registers
once its working, you can use it to upload our bootloader and
application. First we set the fuses (dont worry too much
about these theyre a set of non-volatile registers that
control special features of the ATmega chips, including things
like protecting the bootloader):
$ avrdude -p m168 -c usbtiny -e -u -U lock:w:0x3f:m -U
efuse:w:0x00:m -U hfuse:w:0xDD:m -U lfuse:w:0xFF:m
The -e option erases the chip and the -u option allows us
to set the fuses. The parts following the -Uswitch are the area
of memory to upload to, a read write or verify indicator, a file
or value to upload and the format of the file. Its a bit easier to
understand when we upload a single file, like our application:
$ avrdude -p m168 -c usbtiny -v -U flash:w:Blink.cpp.hex:i
We should also upload the bootloader and set the lock to
prevent it frombeing overwritten if we update the application
in future:
$ avrdude -p m168 -c usbtiny -Vv -U flash:w:at168.hex -U
lock:w:0x0f:m
Nowyou have a working board that you can program, you
can continue to add components to flesh out your design
before committing it to a pCB. or you can just continue to
experiment you can use twoArduinos for our experiments
in communication next time.
LXF
The AVRdude software is exactly what the Arduino IDE uses behind the scenes
to program your hardware.
Next monthCommunicate! Let multiple Arduinos talk to each other.
1
Load software
Load up the Arduino software as usual, and
load up the sketch file you want to compile.
Hold down the Shift key to enable the verbose
mode and press the button to verify the code.
2
Find output les
Note the location of the output in the lower
panel of the display. This is usually somewhere
in the /tmp directory. If you explore there with
a file manager, you will find all the output files.
3
Upload with AVRdude
The file labelled <name>.cpp.hex is your sketch
file, compiled for the ATmega microcontroller
and saved in Intel Hex format, which you can
upload directly with AVRdude.
Step-by-step: Compile your files with the Arduino IDE
Going further
Once youve sorted out a design for
your own Arduino, you have a few
options. Obviously, if you want more
than one, building it on a breadboard
isnt ideal. Using stripboard is better,
and creating a PCBbetter still. Theres
lots of great electronics software
available for Linux, and its pretty easy
to come up with a layout you can either
etch yourself (www.instructables.
com/id/Sponge-Ferric-Chloride-
Method-Etch-Circuit-Bo) or send off to
a board service.
The Arduino boards themselves are
available in Eagle format. The Eagle
CADsoftware is very popular amongst
DIYelectronics fans, but its not free
software. Thefree version will allow
you to make boards up to a certain size,
which will probably be OKfor your own
Arduino designs. Using Eagle may be
the easiest because you can always
edit the Arduino files to remove the bits
you dont want and add in the things
you do. Plenty of other Arduino clones
are available in this format too.
The Arduino PCB files are available
in the Eagle CAD format.
Tutorial XBMC
92 LXF151 December 2011 www.linuxformat.com
Simon Quain
has been using
XBMCfor as long
as he can
remember. Now,
where did he put
his keys again...?
Our
expert
stable OS with stable PPAs for XBMC. APPAis a way for
software developers to distribute software directly to users.
version 10.04 is supported for security updates until early
2013, by which time the current version, 11.04, will be looking
less natty and rather more dishevelled. As the aimis to have a
box connected to the internet downloading metadata that
sits under the Tv, the less time you have to worry about
whether its secure, means the more time you can spend
actually using it.
The Ubuntu installation is pretty straightforward apart
froma couple of key areas. Firstly find or download the 10.04
version, burn it to a CD(or use UNetbootin http://
unetbootin.sourceforge.net to put it on a USBstick) and
boot it up.
Partitioning
You can breeze through the first three steps of the
installation to select your location and keyboard settings.
Create a newpartition table on the hard drive with at least
three partitions. Here, one partition will be for the root
filesystem, the majority of your hard drive space remaining
is for the second partition containing your media and the
last partition of around 1GBis for swap space. On a 500GB
hard drive, you could have a 6GBroot system, a 493GB
partition to house your home folder containing your media
and a 1GBswap for example. With larger or smaller drives,
adjust as appropriate.
Separating the underlying OS fromyour data at this point
means that if there is any corruption of data to the root
filesystem, or if you want to upgrade or change the OS later
on, you can do this without losing gigabytes of your precious
media in the process.
Nowwe can customise
our Ubuntu installation. As
the aimis for this to be a
set-and-forget installation,
we can tell Ubuntu to
download and install all the
updates by itself. Go back
into Update Manager, click Settings and enter your password
when prompted. If you then go to the Updates tab, you can
select Important Security Updates and Recommended
Updates in the Ubuntu Updates section.
Under Automatic Updates, select Check For Updates
Daily and also Install Security Updates Without Confirmation.
This will keep your centre secure in the future with minimum
effort fromyourself.
Nowlets install XBMC. To do this, open a terminal (via
Applications >Accessories >Terminal) and enter the following:
sudo add-apt-repository ppa:team-xbmc
sudo apt-get update
sudo apt-get install xbmc
XBMC: Set up a
Home entertainment Turn a spare
PCinto a shiny newmedia hub
Wecant supplythegiant HDTVor thetop-of-the-rangesurround-soundbut
Simon Quaincanhelpyoubuildthedigital mediahubtoplugit all into.
T
he Xbox Media Centre Project (XBMC), which started
in 2003, was set up so gamers could run a fully-
fledged media centre on their Xbox consoles. The
project grewin popularity, has a vibrant community behind it,
and is nowavailable for many operating systems including
Linux, Mac OSXand evenWindows.
XBMCtransforms your PCinto a one-stop shop for
playing your media, displaying your pictures on your HDTv,
and downloading albumart and information on your movies
and music. In this article
well explain exactly howto
make all that happen.
Well cover setting up
an Ubuntu 10.04
installation to
automatically boot into
XBMCand if you have a spare PCbuilt in the past five years,
you should be able to followalong. You can of course use
any version of an Ubuntu-related distro, or another distro of
your choice. XBMChas its own windowmanager so with a bit
more effort you could install one without a GUI to save on
wasted CPUcycles.
Well also showhowbest to prepare your media and some
other things XBMCis capable of. If you get really serious, you
could always buy or build your own top-of-the-range setup,
with the fastest graphics card, wall-mounted projector screen
and terabytes of storage.
First you need to install your version of Ubuntu onto the
computer. Were using 10.04 LTS Lucid Lynx because its a
Pressing \ takes
you to windowed
mode where you
can make changes
to Ubuntu whilst
XBMCruns.
Quick
tip
Putting in effort now will
help it display your content
beautifully later on.
XBMC Tutorial
www.tuxradar.com December 2011 LXF151 93
sudo apt-get update
sudo apt-get upgrade
This will add the XBMCrepository to the list of your
repositories and install XBMCfromit. Doing it this way means
it will be kept automatically up-to-date in the future. You can
then find XBMCinApplications > SoundAndvideo >XBMC
Media Center.
Automatic startup
If the sole purpose of the box is to be a media centre, you
can also tell XBMCto start up automatically at boot by going
to System> Preferences > StartupApplications. Click on
Add, and enter XBMCin the name field, xbmc (in lowercase)
in the command field, and a short description such as Xbox
Media Centre in the comment field. If you wish you can also
turn off certain services that dont apply to a media centre
here, such as the EvolutionAlarmNotifier amongst others.
media centre
If you missed last issue Call 08448482852or +441604251045.
Enable XBMC to start up automatically to enhance the
appliance feeling.
Navigation
There are a couple of ways to navigate
around XBMC: you can use a wireless
mouse or a keyboard and there are a
number of useful keyboard shortcuts:
P Play
F Fast forward
C Context menu
R Rewind
X Stop
M Player controls
S Shutdown menu
I Info
Q Queue media
Z Change aspect ratio
\ Enter windowed mode
Esc Go back/cancel
Enter Select
Space Pause
We should single out I for particular
praise. It can be used almost anywhere
in XBMCto provide extra menus and
information on almost any media item
or extension. On a movie it will show
you the options to get the cast details
or watch a trailer streamed from
YouTube. On an album, it will give you a
description of the artist and other
related information.
If youre using the mouse, left-
clicking selects options as expected.
Right-clicking on certain entries, such
as an albumor video, will bring up the
Context menu where you can edit the
item, queue it or update the entire
library. If you right-click anywhere else,
youll go back to the previous screen.
If you dont want to use a keyboard
or mouse, you can set up XBMCto use
a remote control, which makes the
interaction more user-friendly. If you
have an Android phone theres an
official XBMCRemote app available in
the Market Place. Theres no space to
cover every remote setup here but read
the remote section in the XBMCwiki at
http://wiki.xbmc.org/index.
1
Prepare disk space
Select Specify Partitions Manually and click
on Forward. Click on New Partition Table and
press Continue. Then by double-clicking on the
Free Space entry, you can determine the size of
each partition.
2
Create partitions
Change the first partition size to about 6GB and
the mount point to /. Press OK and repeat the
processes for your home directory. For swap,
double-click on Free Space again but select Use
As and change it to Swap Area. Press OK.
3
Install updates
Set up your account and wait. If youre using an
original 10.04 CD there will be a lot of updates.
Go to System> Administration > Update
Manager. Click Install Updates and enter your
password. When its finished, restart Ubuntu.
Step-by-step: Partition your drive
Make sure that youve let Ubuntu log yourself in
automatically otherwise the previous paragraph will be nigh-
on useless. If it isnt set, you can go to System> Preferences
> Login Screen. Then, after clicking Unlock and entering your
password, tick the checkbox next to Log InAs [YOUR
USERNAME] Automatically.
An important point to make is that you can change how
XBMCdisplays your media, and certain actions are easier
Tutorial XBMC
94 LXF151 December 2011 www.linuxformat.com
to performin certain views. If you press Left on the remote or
keyboard or move your mouse to the far left, a menu appears
in which you can change the view. Depending on what youre
looking at and where you are, you can choose between
displaying your media files in, among others, a big list,
thumbnails, or an excellent media info view. You get the most
information if you select Library Mode. With music, Library
Mode is often greyed out at the start but well fix this.
First go to Music Settings via the Settings option on the
main screen. Select DownloadAdditional Info During Updates
and Update Library On Startup. As a side note its worth
selecting this for your other media types as well.
To start indexing your files, go to Music >Add Source >
Browse. Then navigate to the folder where the music is and
press OK. This folder can be on the local HDDor even on a
NAS (Network Attached Storage).
To enable Library Mode for your music, right-click or press
Cwhilst hovering over the root Music folder we just linked to.
This will enter the Context menu. Then choose Scan ItemTo
Library. This fantastic (and well-hidden) option downloads fan
art, discography lists and a biography for each artist. Be
prepared if you have a large library, this will take a long time
and can be an overnight operation. However, youll end up
with a large amount of useful information linked to your files.
Add newmovies
To add newmovies or other media files to XBMCfurther
down the line, its a simple case of moving the media file(s)
into one of the relevant source folders in Ubuntu itself. This is
Getting your media ready
All the database
settings are in
the hidden .xbmc
directory in your
home folder. Back
this up to avoid
having to download
things like cover
art again.
Quick
tip
Before we index the media, XBMCis very
particular about the way you structure it.
Putting in some effort nowwill help it display
your content beautifully later on.
videos
Its worth having a root Videos folder containing
a separate Movies and TVShows directory.
Videos
Movies
TV Shows
Movies should be inside the Movies folder. Each
movie file (or ripped DVD) should itself be inside
a folder titled with the name of the movie. It also
helps the inbuilt scrapers that download the
cover art and media information if the year of the
movie is also in the folder name in square
brackets. They can get confused if there are two
films with the same name, such as The Italian
Job, which has an original and a remake.
Movies
Movie 1 [1998]
Movie 1 media files
Movie 2 media files
Movie 2 [1976]
TVshows should be inside the TVShows
folder. Each separate TVshow(ie The Tux Files,
Tux Men etc) should have its own folder
containing a nested folder for each episode or
season of episodes, as below:
TV Shows
TV Show 1
Season 1
Season 2
TV Show 1 media files
TV Show 1 media files
TV Show 2 media files
TV Show 2
Music
For music, the structure of the files isnt as
important. Like most modern-day music
players, XBMCgets the metadata fromthe ID
tags. The scrapers use these to query the online
services. You can use a standard media player
bundled with your distro, such as Banshee or
Rhythmbox, to check and edit these tags.
Pictures
There is no compulsory file structure for photos.
However if youre anything like me you have
thousands of mediocre shots eating up space
on your drive.
Scattered randomly amongst themare the
stray flukes that youd actually like to showoff. If
youve rated your photos in a programsuch as
F-Spot, you can filter themto showjust your
favourites and export those to a specialised
folder for XBMC.
When setting up the Photos source in XBMC,
point it to this folder instead of the main
Pictures folder so that only your best photos are
included. When it comes to showing themoff
through XBMCyour audience will think youre
the next Ansel Adams.
Never miss another issue Subscribe tothe #1 source for Linux onpage 66.
another case where entering windowed mode with \ is useful.
If youve selected Update Library On Startup in the
preferences as above, the newmedia will be automatically
added to the library and all accompanying metadata will be
downloaded the next time you open the program.
All of this metadata is stored in the hidden .xbmc folder
situated in your home folder. To see it using Gnome, you can
press Ctrl+Hto display the hidden files. As this can get rather
large and have so much important information such as album
and DvDart in it, its worth backing this folder up. In a worst-
case scenario, you then wont need to download all the
metadata for your entire media library again.
correct scanning mistakes
Ascraper is software that goes online and gets metadata and
artwork for your media fromwebsites. XBMCwill then display
the data alongside the file. Most of the time these scrapers
work well but sometimes they arent able to get everything
right and you may find you have incorrect movie artwork or
information attached to your films.
To fix this, right-click or press Con the movie to bring up
the Context menu, click on Movie Information and then
Refresh. The scraper will then query the relevant service for a
list of alternatives.
If you then choose the correct version fromthe list, it will
download the correct cover art and data for your choice of
film. Rinse and repeat as necessary. If the scraper continually
selects the wrong information, look to see if the structure and
naming conventions of your files are as suggested in the
This isnt the Pinocchio youre looking for...
XBMC Tutorial
www.tuxradar.com December 2011 LXF151 95
boxout. You should also check that you chose the correct
scraper for the media type when you originally added the
source folder.
extensions
There are a world of extensions provided by the community
and if you have the skills you can write your own and submit
themfor inclusion.
You can click on either videos or Movies on the main
screen and thenvideoAdd-Ons. As before, this is most
visible if Library Mode is turned off. Otherwise find the icon
with the blue arrowpointing up until you get to the root
directory. Clicking on Get More... takes you to a large list of
extensions written for XBMCthat you can install.
Highlights include TEDTalks, which streams informative
presentations free of charge fromnotable people, Al Jazeera
for live news streams, and TwiT, which streams podcasts
with video fromthe popular TwiTnetwork all fromthe
comfort of your sofa. These are all accessible fromthe
video menu after installation.
For the full list of add-ons available for XBMCgo to System
>Addons >XBMC.orgAdd-ons > Get Add-Ons and a list of
categories should appear. As with your other media, you can
press Left or hover the mouse to the left of the screen and
change howthe information is displayed.
There are plugins which let you display Flickr photos or
download subtitles for your films. In the Music section you
can get add-ons to organise podcasts with your own opml.
xml file or use the HvSIDadd-on to access the Highvoltage
SIDCollection. This has an archive of music fromclassic C64
videogames. All of the add-ons can be configured by right-
clicking or pressing Con their menu item.
There are lots of extensions that arent included within
XBMCthat can be downloaded fromother websites. Some of
these can be experimental or buggy, though, so beware.
The makemkvblueray extension allows you to watch
Blu-ray DvDs if you have a Blu-ray drive in your box. Theyre
normally provided as ZIPfiles. Download themfromthe
website where theyre hosted, then if you go to the add-ons
menu as before you can select Install FromZip File and
browse through your hard drive to install them.
As well as add-ons, you can also customise your
installation by choosing a different theme. The default theme
is Confluence. To change it go to System>Appearance > Skin
and click on Confluence. Selecting Get More... takes you to a
list of provided themes. Avery popular one, albeit demanding
a feisty PC, is Aeon Nox, which has stunning native 1080p
backgrounds. You can also find others online and install via
ZIPas above.
Further help
For XBMCsupport beyond this article there is an informative
wiki available at http://wiki.xbmc.org containing everything
you need to knowfromthe vital to the obscure. There are also
vibrant forums with a friendly community behind them.
Hopefully Ive shown you the power lying within XBMC. If
this were a commercially-created piece of software, it would
probably cost hundreds of pounds, yet its more powerful,
user-friendly and aesthetically pleasing than most, if not all, of
the paid-for alternatives out there. Its the community effort
behind it that lets us make good use of a spare or custom-
built PC, and long may it continue.
LXF
If you cant see
certain views, try
turning Library
Mode on or off.
Quick
tip
1
Add source
To add a TV show or movie folder click on
Videos and Add Source. If this isnt visible, its
easiest to turn off Library Mode (press Left or
move the mouse to the far left of the screen).
2
Browse
Click on Browse and navigate to the required
folder. Then enter a name for the source and
press OK.
3
Set content
Select whether the folder contains movies or TV
shows. This is important for the scrapers. Click
Run Automated Scan and Scan Recursively. You
can also click Settings > Get Rating FromIMDb.
Step-by-step: Adding TV shows or movies
Handbrake
mentioned in last
months issue is
an excellent DVD
ripper http://
handbrake.fr.
Quick
tip
The Aeon
theme looks
fantastic but
requires a
powerful PC.
The default theme Confluence is elegant and striking.
Tutorial Firewall
96 LXF151 December 2011 www.linuxformat.com
James Litton
has held
executive-level
positions at
numerous
organisations and
is a partner and
CEOof Identity
Automation LP.
Our
expert
There isnt much to installing Ubuntu Server, however,
there are a fewitems that need calling out:
The automatic installation of updates can be helpful, but
not everyone is a fan of this approach. Well assume that you
would much rather preside over all installations on your
server, so lets opt for no automatic updates.
The Ubuntu installation process provides numerous options
for installing many useful services. The only itemwe want to
install fromhere is the OpenSSHserver, which will allow
access to our server even though the box will run headless.
The installation process should have configured eth0 for
DHCP, which is what we want, since most ISPs do not provide
their users with a static address. The second interface needs
to be configured by editing /etc/network/interfaces:
auto eth1
iface eth1 inet static
address 192.168.3.254
netmask 255.255.255.0
broadcast 192.168.3.255
network 192.168.3.0
DNS is probably the most used service on the internet.
Virtually nothing happens without first converting a user-
friendly name, such as www.linuxformat.com, into a
routable IPaddress (80.244.178.150) that our computers use
to communicate with one another.
Rather than pass all of our internal clients to our ISPs DNS
servers, we can achieve a small performance gain by setting
up our own caching DNSserver on our router. In practice, all of
our clients will point to our router for DNS. When a client
needs to resolve a name our server will look in its cache. If the
Build your own
Hardcore Linux Challenge yourself
with advanced projects for power users
Youcouldprotect your systemwithanyoldfirewall but its muchmorefunto
construct abespokeLinux-basedinstallation. James Littonshows youhow.
M
ost home networks use the firewall provided by
their Internet Service Provider (ISP) or small
consumer-level firewalls that can be bought froma
local electronics shop, such as those fromLinksys or Belkin.
Those wanting more control often turn to distributions
such as Smoothwall or pfSense that take care of the
operating systeminstall as well as the installation of all the
packages necessary to run a firewall. These systems also
have nice, web-based interfaces for configuration and the
installation of additional modules.
pfSense is actually an excellent choice for a firewall as its
not only easy to install, but a cinch to maintain. What we want
here, however, is a Linux-based firewall rather than a BSD-
based system. We could opt for a specialised distribution but
well learn a lot more and its a lot more fun if we build our
own server to give us ultimate control. The baseline
requirements that the router must be able to handle are:
1 Stateful and stateless packet filtering.
2 NATand masquerading for sharing internet access.
3 NATfor transparent proxy.
4 Shaping of network traffic (not covered here).
Laying down the OS
Before we can start installing packages, we need a server and
an operating system. For the server itself, we want something
with a small footprint such as an enclosure made by Shuttle.
For components, we need a motherboard with an integrated
Ethernet adapter and well need to add a second Ethernet
card to one of the motherboards PCI slots. For the operating
system, lets go with Ubuntu 10.04 LTS.
jsvnstat is an interactive and impressive-looking
JavaScript-driven front-end to vnstat.
Firewall Tutorial
www.tuxradar.com December 2011 LXF151 97
If you missed last issue Call 08448482852or +441604251045.
address is found then it is immediately returned to the users
machine; if its not found then our router will forward the
request to our ISPfor resolution and the result is stored in our
servers cache where it will reside until its next needed. Well
use the lightweight dnsmasq. To install type:
sudo apt-get install dnsmasq
When a request comes into our DNS server, dnsmasq will
forward requests for unknown names to the namerserver
listed in the /etc/resolv.conf that are provided by our ISP
during the DHCPprocess.
Dynamic client configuration
Unless you plan to configure all of your client devices by hand,
you will need a DHCPserver. The beauty of using dnsmasq
for our caching DNS server is that it also serves as our DHCP
server. To configure DHCP, edit /etc/dnsmasq.conf:
interface=eth1
domain=yourdomain.com
dhcp-range=192.168.3.80,192.168.3.90,12h
dhcp-authoritative
With this configuration dnsmasq will answer all DHCP
requests on our local subnet and will provide an address
between 192.168.3.80 and 192.168.3.90, the domain for our
network, as well as the DNS and gateway address which will
be set to the routers address.
As you start to build your firewall rules you will most likely
want to make a distinction between devices so you can
provide varying classes of service. To accomplish this goal we
reserve IPaddresses via dnsmasq by adding the following to
/etc/dnsmasq.conf:
no-hosts
dhcp-host=xx:xx:xx:xx:xx:xx,tablet,192.168.3.80
dhcp-host=xx:xx:xx:xx:xx:xx,netbook,192.168.3.81
dhcp-host=xx:xx:xx:xx:xx:xx,laptop,192.168.3.82
There are other ways to handle name lookups for these
clients, but since we have such a small network lets also add
themto /etc/hosts:
192.168.3.80 tablet
192.168.3.81 netbook
192.168.3.82 laptop
If you want your server itself to use the local dnsmasq
instance for DNS resolution then youll need to modify the
servers DHCPclient by editing /etc/dhcp3/clinet.conf and
uncommenting the line that says:
prepend domain-name-servers 127.0.0.1;
Though we are not covering it in this tutorial, you may
eventually want to build firewall rules that use the time of day
as a parameter. This can be done, for example, to control
what time of day your kids can access the internet. For this to
work effectively, we need to ensure that the clock on our
server stays as accurate as possible. The best way to do this
is to install NTP by typing:
sudo apt-get install ntp
The default settings meet our needs so no further
configuration is necessary.
Before our server will route packets between its interfaces
we need to enable packet forwarding. We can do this by
editing /etc/sysctl.conf and uncommenting:
net.ipv4.ip_forward=1
This instructs our server to forward IPv4 packets, which will
allowour client devices to communicate with devices on the
internet. If you want to play around with IPv6 you will need to
make additional changes, which can be found with a simple
Google search.
Nowits time to move on to setting up some firewall rules.
Before we do that, lets restart our server with:
sudo shutdown -r now
and make sure that it comes up with no errors.
Rules, rules, rules
Firewalls are all about rules and are only as effective as your
rule set! In Linux we use Iptables to feed our rules into the
netfilter modules, which are a part of the Linux kernel, which
makes decisions, based on our rules, about howit will handle
each and every packet that passes through our server.
We couldnt possibly cover the details of howIptables
works here but its important to at least understand that by
default, Iptables uses three built-in chains to which we can
attach rules:
INPUT CHAINmanages packets that are destined for
services running on the router itself (eg webserver, SSHetc).
OUTPUT CHAINmanages packets that originate fromthe
server itself.
FORWARD CHAINmanages packets that route through
the server.
There is a lot more to Iptables than these three chains and
wed recommend reading Linux Firewalls by Michael Rash to
learn more, but this is enough to get us going.
For the purposes of this tutorial, lets start by creating a
very unrestrictive set of rules so we can validate that things
are working as they should. Start by creating a shell script
called iptables.sh and making it executable:
cd ~
touch iptables.sh
firewall
Default DENY
this tutorials focus is to walk you
through the process of building a
simple Linux firewall that you can use in
a typical SOhOscenario. to make the
process as easy as possible we
defaulted our rules to ACCEpttraffic
on all three of our Iptables chains. Afar
better best-practice is to DENYtraffic
by default and deliberately poke holes
through the firewall to allowspecific
types of traffic to/fromspecific boxes
and services. this approach will give
you greater control and can mitigate
security risks that are inherently
introduced by defaulting your router to
ACCEptall types of traffic.
Tutorial code.
Tutorial Firewall
98 LXF151 December 2011 www.linuxformat.com
chmod +x iptables.sh
Nowopen iptables.sh in your favourite editor and add:
#!/bin/sh
IPTABLES=/sbin/iptables
MODPROBE=/sbin/modprobe
IPSET=/usr/sbin/ipset
INT_NET=192.168.3.0/24
### flush existing rules and set chain policy settings to
ACCEPT
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -X
$IPSET --destroy
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
### load connection-tracking modules
$MODPROBE ip_conntrack
$MODPROBE iptable_nat
### Set up forwarding
$IPTABLES -P FORWARD ACCEPT
$IPTABLES --table nat -A POSTROUTING -o eth0 -s $INT_
NET -j MASQUERADE
Nowrun your script. Assuming that our Ethernet
interfaces are set up correctly with eth0 connected to our ISP
and eth1 connected to a switch or a test computer, you
should nowbe able to boot up, receive your network
configuration via DHCPand access the internet.
Fromthis point forward you can add rules to further
restrict access. Lets say, for example, that you want to block
all connections to our server originating fromTogo andTonga.
To do that we will use a userland tool called ipset to build a
table of addresses that each packet will be compared against.
Before we can use ipset, however, we need to run some
commands to install it:
sudo apt-get install ipset ipset-source
sudo apt-get install module-assistant
sudo m-a a-i ipset
Nowlets build a simple script to create our list table:
#!/bin/sh
IPSET=/usr/sbin/ipset
IPSETSAVE1=/home/yourname/ipset-countries1.save
$IPSET -N countries nethash
for IP in $(wget -O - http://www.ipdeny.com/ipblocks/data/
countries/{tg,to}.zone)
do
$IPSET -A countries $IP
done
$IPSET --save countries >$IPSETSAVE1
Nowwe have a file that contains all of the subnets that we
want to block, which we can easily load with our firewall script.
Our countries script only needs to be run when we want to
add additional countries or otherwise update our table of
subnets. The file that it produces however needs to be
loaded by our firewall script, so lets make some
modifications to iptables.sh.
To start lets add a couple of variables:
OUTSIDE=eth0
IPSETDB1=/home/yourname/ipset-countries1.save
Nowadd the following above our forwarding rules:
$IPSET --restore <$IPSETDB1
$IPTABLES -A INPUT -m state --state
ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -i $OUTSIDE -m set --match-set
countries src -j DROP
Nowour router will not respond to access attempts from
computers inTogo or Tonga but will function normally if we
originate a request to a website in one of those countries
froma machine on our network.
Use your imagination
This is just a starting point and, as you can see, leveraging
Iptables to build a Linux-based firewall affords us with
incredible flexibility. Let your imagination run wild and the
chances are that you can build the rules necessary to meet
your requirements.
When youre finished building your rules we need to
configure our server to load our firewall rules at boot time. To
accomplish this edit /etc/rc.local and add:
/home/yourname/iptables.sh
just above the line that reads
exit
Remote access to our internal network can be very helpful. A
Never miss another issue Subscribe tothe #1 source for Linux onpage 66.
iftop is a powerful command-line tool that shows how
your bandwidth is being used by a client.
An order of calamari, please
Squid is a proxy server that supports
http, httpS, ftp and various other
services. Its an excellent tool for
reducing bandwidth usage while
improving performance for frequently-
visited websites. for those with kids in
the house, its also a great way for
forcing SafeSearch usage on sites
such as Google, Yahoo, Bing and
Youtube, which can help prevent your
small children inadvertently stumbling
across inappropriate material.
Setting Squid up as a transparent
proxy is a great way of directing all
standard http traffic through your
server, without needing to make
changes to your client devices. If
you decide that you want to use the
server for secure http traffic as well,
then using a transparent proxy is no
longer an option and you will need to
look at manually configuring your
clients (not a good idea for mobile
phones etc) or setting up a WpAD
solution, which is used to automatically
configure client browsers.
Running all web traffic through Squid
is also a great way to collect data on the
sites being visited, which is useful if you
want to run analytics to better
understand howyour bandwidth is
being used. Some very helpful logfile
analysis information can be found at
www.squid-cache.org/Scripts.
Firewall Tutorial
www.tuxradar.com December 2011 LXF151 99
Unique platforms
If you are up for the challenge, its also
possible to run a Linux router on
platforms such as the Linksys WRt54G,
Buffalo WhR-G54S or a Soekris
Net4801, to name a few. these devices
are very small which makes themideal
for installation on a wall or in a closet.
they also have the benefit of requiring
very little electricity.
Abigger challenge with these
platforms is the installation of the OS
itself and ensuring that read/write
activity is kept to a minimum.
for the Linksys and Buffalo
platforms, there are Linux-based
firmware options available such as
dd-wrt, OpenWrt and tomato that
make the installation and management
fairly easy.
Building a router fromone of these
devices can be very rewarding and is an
excellent weekend project.
common use is to access file storage and/or a home
automation systemfromyour office and mobile device. Since
we dont knowwhat our IPaddress will be when were out and
about, on our mobile phone, for instance, its not feasible to
write firewall rules to limit remote access by address.
Another approach we could take would be to install a
service that requires some type of authentication before we
can access internal resources fromoutside the network. One
of the easiest options for this type of service is PPTP. Volumes
have been written on the subject of PPTPand some insist
that it isnt a safe option. For our purposes, however, its
perfect. Not only is it easy to set up but its more than secure
enough for the typical home network.
To install type:
sudo apt-get install pptpd
To configure lets edit /etc/pptpd.conf and find the
localip and remoteip entries, uncomment themand modify:
localip 192.168.3.254
remoteip 192.168.3.234-238
Nowwe need to edit our options in /etc/ppp/options
and find the ms-dns entry, uncomment and modify:
ms-dns 192.168.3.254
Last but not least, we need to set up a user account. Lets
add a disclaimer here to say that a long password for your
user account is your best defence when using PPTPso select
something good. To set up our account we need to edit /etc/
ppp/chap-secrets and add an entry like this:
James159 pptpd ThisIsMyReallyReallyLongPassword *
Nowaccessing your internal network while on the road is as
simple as configuringVPNaccess on your favourite device.
Many of you will have already pointed out that we have a
dynamic external IPaddress and thus need to use a
dynamic DNS service such as DynDNS to keep up with our
routers IPaddress.
Many of you use OpenDNS to help filter internet access
for your kids and since OpenDNS needs to knowyour IP
address to apply your preferences settings, you may want to
look at the DNS-O-Matic service. The great thing about DNS-
O-Matic is that it will also pass your address updates to
DynDNS for you so you only need to update one service
instead of two.
There are many ways to get your current IPaddress, but
weve put a script on the LXFDVDthat should work for just
about anyone. To use it, move the script to your home
directory as dns.sh and set up a Cron job to run it every hour.
If our address hasnt changed fromthe previous hour then
DynDNS isnt updated. If the address has changed then
DynDNS will be updated with our newaddress. To ensure that
your account doesnt go stale, lets force an update at 11pm
every day, even if the address hasnt changed.
Hunting bandwidth hogs
If your house is anything like ours, then theres a lot going on.
At home there are six computers, three smartphones, two
tablets and a couple of servers. With that many devices and
people coming and going, its inevitable that the internet
connection will slowdown because someone is downloading
a large file or streaming a movie.
If you want to find out who is hogging your bandwidth then
you need a tool, and an excellent choice for this job is iftop.
Lets install it by typing:
sudo apt-get install iftop
Iftop does for network usage what top does for CPUusage. It
listens to network traffic on an interface and displays
information about current bandwidth usage by host pairs. To
use the tool simply type:
sudo iftop i eth1
to instantly see who is using your precious bandwidth. Since
we added hostnames to our hosts file you should see a
friendly list of names instead of IPaddresses, which makes it
even easier to go directly to the source and interrupt their
hogging activities.
While not a necessity, its really nice to knowwhat your
bandwidth usage looks like over time. Agreat tool for this is
called vnstat, which will give us statistics per interface. To
install it, type the following:
sudo apt-get install vnstat
sudo vnstat -u -i eth0
sudo vnstat -u -i eth1
After you complete the install you will need to allowsome
time for vnstat to collect data before you can report on it. The
most basic feedback comes fromsimply typing:
vnstat
which will report on both eth0 and eth1. This viewshows us
total data received, total data transmitted, total data
throughput and its best guess for total usage for the current
day and month.
One of my favourite views is the previous 24-hour view
which you can access by typing:
vnstat h
This viewprovides a basic bar chart representing usage by
hour, along with detailed data about the previous eight hours.
Another useful viewis the top 10 list accessed with:
vnstat t
This is helpful in gauging your high-end bandwidth usage.
If you want a very nice graphical front-end for your vnstat
data you may want to install jsvnstat. This tool is based on
JavaScript and makes it easy to switch views without
reloading the entire page. The graph is also interactive and
provides feedback just by hovering the mouse over a
datapoint. To install type the following:
apt-get install apache2 php5 unzip
cd /var/www
wget http://www.rakudave.ch/userfiles/javascript/jsvnstat/
jsvnstat.zip
unzip jsvnstat.zip
To viewthe page go to http://192.168.3.254/jsvnstat/
index.php.
Weve just scratched the surface with our simple tutorial
but as you can see, Linux is an excellent platformfor building
simple, powerful and easy-to-manage firewalls.
We encourage you to do some more research on Iptables
and add to your rule set to make it more robust and more
personalised. We also encourage you to explore traffic
shaping with Linux so you can prioritise traffic and manage
your internet bandwidth more effectively.
LXF
Subscriptions
All savings based on newsstand prices. Europe and Rest of World readers will be charged in GBP. US and Canadian readers will be charged in USD.
You will receive six issues of Linux Format a year. If you have any queries in the rst 60 days, please notify us in writing and we will refund all
unmailed items. Access to the subscriptions only archive area is strictly for personal use only.
Offer ends January 30, 2012.
Europe 49.99 for six issues
approx 9.40 an issue
Rest of World 54 for six
issues just 9 an issue
Subscribe easily and securely at:
www.myfavouritemagazines.co.uk/LINP1Q
Or call and quote LINP1Q
International +44 1604 251 045
International six-month
subscriptionoffer
Wherever you live in the world, try a six-month
subscription to Linux Format so you never miss an issue
What youll pay for six issues
Live in US/Canada?
Subscribe for six months and pay just $11.66 an issue
thats just $69.99 for six issues instead of $101.94
Visit: www.imsnews.com/lxf-A033
or call toll-free on 1-800-428-3003 and quote A033
SAVE up to 40%
FREE airmail delivery direct
to your door
EXCLUSIVE access to our
online subscriber-only area
which offers access to over
50 previous issues, with
searchable PDFs and tutorials
www.tuxradar.com
December 2011 LXF151 101
Canny commenting
G
rahamhas decided to
spawn a child process this
month, so Ive popped by to
say hello instead. And also say thank
you for the feedback youve provided
us for this section its really
valuable. Were continuing our series
of Coding Concepts for those of you
newto the world of programming,
explaining howconditionals work.
But please tell us: what else would
you like to see in Coding Concepts?
Which aspects of programming
have you found difficult, or would like
a concise explanation for? Perhaps
youd like to understand recursion,
or even (shudder) pointers!
mike.saunders@futurenet.com
Learningtofork
MIKE SAUNDERS
has finally returned
to his Z80 roots by
finding the ZEUS ZX
Spectrum assembler.
Welcome toyour
Whether youre a beginner or a guru, learn new skills in our programming section
Many programmers would argue that comments
are just as important as code. You could have the
most amazing data-sorting routine in the world,
but if it just looks like gobbledygook to everyone
else, its not much use if you want outside
participation in your project. Good comments
are also vital if youre going to focus on another
part of your application for a while, and come
back to that code later you dont want to be
left thinking: What was I doing there?
This is why good comments explain howa
chunk of code achieves its objectives, not what it
does on a line-by-line basis. SayingThis bit
opens a file above an obvious file_open() call is
pointless, for instance. But a small paragraph of
text at the beginning of a routine, saying what
the input data is, howthe process works and
what comes out, is much more valuable. Dont
be afraid to be verbose in your comments, or to
say that youre not happy about a particular
implementation of a feature. If its free software
in the GNUsense, someone else might read that
comment and decide to implement the routine
in a better way. Your comments tell a story of
your code the more you focus on them, the
more youll focus on good code in the first place.
Android
...andthenone
for your phone! p112
Python
Buildacool
musicplayer... p108
Concepts
IFs andTHENs
explained p106
Inthis issue...
Perl
Writeadatabase
without SQL p102
Modern Perl
1 in its author column. Splitting the author out into a
separate table means that we can store information about
several Douglas Adams books in the book table without
duplicating the information about the author. Avoiding data
duplication is callednormalisation and is an important topic
in database design.
Having created our database, we nowwant to set up some
Perl code to talk to the database. We could use the DBI
(Database Interface) module and write rawSQL. But no one
likes writing SQLso were
going to use Object
Relational Mapping (or
ORM) to convert Perl code
into SQL. This will make our
code much easier to write at
the cost of a small amount of set-up. The ORMwe are going
to use is called DBIx::Class so well need to ensure we have
that module installed. Well also need a separate module
called DBIx::Class::Schema::Loader which can generate Perl
libraries that are specific to our database. You can probably
install both of these libraries using your distributions
packaging tools, but if they arent available you can get them
both fromCPAN.
DBIx::Class::Schema::Loader comes with a command-
line programcalled dbicdump, which will look at the tables in
your database and create the Perl code needed to manipulate
those tables. You run it like this:
$ dbicdump -o components=[InflateColumn::DateTime] \
Book dbi:mysql:database=books books README
The -o components option loads some extra functionality
that well see later on. Book is the name of the Perl module
Modern Perl:
Track your reading
ModernPerl makes it simpletowriteadatabaseprogramsay, for example,
tokeeptabs onyour books without usingSQL. Dave Crossexplains how.
I
n this article we will build a simple command line program
that accesses a database. The programwe are going to
write will keep track of a reading list. Well tell it about the
books that were reading or about to read and it will display
that information in various lists. Next month well make the
programinto a web application.
Firstly, were going to need a database to store this
information in. Imgoing to use MySQL as its the most widely
available database system, but the same code will work with
minor amendments with
any other relational
database.
Well store the data in
two tables author and
book. In the interests of
keeping things simple well ignore books with multiple
authors.
First well create a newdatabase to contain the tables and
switch to that database:
create database if not exists books;
use books;
Well also create a user for our application. You might want
to change the password. If you do, youll also need to change
it in the get_schema subroutine as well:
create user books@localhost identified by README;
grant all privileges on books.* to books;
The author table is very simple:
create table if not exists author (
id integer primary key auto_increment,
name varchar(100)
) engine innodb;
The engine innodb is important as that means that we
can give these tables constraints that define the relationships
between them. Well see that being used in the book table:
create table if not exists book (
id integer primary key auto_increment,
isbn char(10),
author integer,
title varchar(250),
started datetime,
ended datetime,
image_url varchar(250),
foreign key (author) references author (id)
) engine innodb;
The foreign key line at the end of the definition says that
the author column in the book table contains values that are
equal to the id column in the author table. So if Douglas
Adams has the id 1 in the author table then the record in the
book table for The Hitchhikers Guide to the Galaxy will have a
You can get more information about DBIx::Class from the
website at http://dbix-class.org.
PART 1
Tutorial code.
No one likes writing
SQL so well use ORM to
convert our Perl code.
102 LXF151 December 2011 www.linuxformat.com
Dave Cross has
been involved with
the Perl
community since
the last
millennium. In
1998 he started
the London Perl
Mongers, the first
European Perl
users group.
Our
expert
Modern Perl
The language is
called Perl. The
programthat
compiles Perl
programs is called
perl. Typing either
of these as PERLis
wrong.
Quick
tip
CPAN Perls killer app
If youre programming in Perl then you
need to knowabout the Comprehensive
Perl Archive Network (or CPAN). On the
CPANyoull find almost 100,000extra
Perl modules that you can use in your
programs.
The CPANis at www.cpan.org, but
most people use the search page at
http://search.cpan.org. Anewproject
called MetaCPAN(at http://
metacpan.org) aims to provide a
better interface and an API.
Alarge number of the most useful
CPANmodules have been repackaged
for popular Linux distributions, and
this will be the easiest way to install
most modules.
For example, if you want to install the
DateTime module on a Red Hat or
Fedora systemyou just need to run
sudo yuminstall perl-DateTime. On a
Debian or Ubuntu systemthat
command becomes sudo apt-get
install libdatetime-perl.
you want to create. Then there is a Perl DBI connection string,
which includes information about the type of database we are
talking about (mysql) and the actual database that were
interested in (books). The last two arguments are the
username (books) and the password (README).
When you run that command youll find a newfile in your
current directory called Book.pmand a newdirectory called
Book. Within the Book directory youll find another directory
called Result and within that there are two files called Author.
pmand Book.pm. If you look at the contents of these last two
files, youll see code that closely matches the definitions of
the two tables in your database.
Fishing the Amazon
Theres one more thing that we need to do before starting to
write our program. Well be using the AmazonAPI to get
various details about the books in our database, and we need
to register for anAPI key in order to use the API. You can
register for a key at www.amazon.com/gp/aws/
registration/registration-form.html.
Once youve signed up you can go to the Security
Credentials part of the site to get your Access Key IDand
Secret Access Key. We recommend setting environment
variables to these values like this:
export AMAZON_KEY=[Your key here]
export AMAZON_SECRET=[Your secret key here]
It then becomes easy to access these fromwithin a program.
Finally, were ready to start looking at the program. Were
going to create a programcalled book that has four sub-
commands. Typing book add <ISBN> will allowus to add a
book to our reading list. Typing book start <ISBN> will flag
that weve started to read a book and book end <ISBN> will
flag that weve finished it.
At any time, typing book list (or just book without a sub-
command) will display the list of books in our database,
indicating which ones we are currently reading and which we
have finished. The start of the programlooks like this:
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Book;
use Net::Amazon;
use DateTime;
Alot of this will be common to every Perl programthat you
write. The first is like theshebang line. This tells the Linux
shell to run this programusing the Perl compiler.
The next two lines load two standard Perl libraries called
strict and warnings. Think of these as programming safety
nets. The most important thing that the strict library does is
to force you into declaring your variables. The warnings
library looks for a number of potentially unsafe programming
practices and displays a (non-fatal) warning if it finds any. No
serious Perl programmer writes programs without loading
these two libraries.
The third use statement is slightly different. It doesnt load
a module, but tells Perl that this programneeds to be run on
a particular minimumversion of Perl. Were forcing the use of
Perl 5.10 as were going to use the say function that was
added in this version.
The following three lines are back to loading libraries.
Book is the library that we created to talk to the database.
Net::Amazon is the library that well use to talk to the
AmazonAPI. And finally, DateTime is a powerful Perl library
for the manipulation of dates and times.
Next we need to work out which of the sub-commands
has been invoked and run the appropriate code:
my %command = (
add => \&add,
list => \&list,
start => \&start,
end => \&end,
);
The next statement defines the valid sub-commands that
our programwill implement. It does this by setting up a hash
(or dictionary) called %command. The %at the start of a
variable name indicates that its a hash. Ahash is like a look-
up table. It has keys which are associated with values. In our
case, the keys are the names of the sub-commands and the
values are references to the subroutines which implement
those commands.
Putting an ampersand on the front of a subroutine gives
us a way to refer to the subroutine without executing it and a
backslash is the standard Perl syntax to get a reference to
something:
my $what = shift || list;
if (exists $command{$what}) {
$command{$what}->(@ARGV);
} else {
die Invalid command: $what\n;
}
The next fewlines deal with the command-line options
and calling the appropriate subroutine to do the work.
Command-line arguments to a Perl programare stored in an
array called @ARGV(the @indicates an array in the same
way that a %indicates a hash). The shift function removes
the first element froman array and returns it. Youll notice
that we dont give shift an argument. Thats because of its
special behaviour. If you call shift without an argument
outside of a subroutine then it will work on @ARGVby default.
For arguments sake
If we havent been given a command-line argument then
@ARGVwill be empty and shift will return a false value. In
this case we want to act as if the user gave us the sub-
command list. The || operator lets us do this. This is the
Boolean or operator. It returns its left operand if that value is
true, otherwise it returns the right operand. So if theres a
value in @ARGVwe get that, otherwise we get list. The value
calculated fromthat expression is stored in $what (Perl
scalar variables begin with a $).
Having got the sub-command, we nowneed to knowif its
a valid value. We do this by looking in the %command hash.
We use the exists function to see if $what matches one of
www.tuxradar.com December 2011 LXF151 103
Modern Perl
the keys in the hash. If it does, we call the appropriate
function, if not we die with an appropriate error message.
Notice that as the hash contains subroutine references, we
need to call the subroutine using a dereferencing arrow. Also
notice that we pass what is left of @ARGVon to the function
that we are calling. In some cases it will be empty, but in
others it will contain the ISBNfor a book.
Thats the main structure of the programcomplete. All we
need to do nowis to implement the various subroutines that
do the actual work for the various sub-commands. Before
we start those, well write a useful utility subroutine that they
will all use:
sub get_schema {
return Books->connect(dbi:mysql:database=books,
books, README)
or die Cannot connect to database\n;
}
All of the commands will need to communicate with the
database. When using DBIx::Class all communication with a
database is carried out through an object called a schema.
Our get_schema object just connects to our books database
(using the Book module we created earlier). If it cant connect
for any reason, it just kills the programwith an error message.
One for the books
The first sub-command we will look at is the one to add books
to the database:
sub add {
my $isbn = shift || die No ISBN to add\n;
my $schema = get_schema();
my $books_rs = $schema->resultset(Book);
if ($books_rs->search({ isbn => $isbn })->count) {
warn ISBN $isbn already exists in db\n;
return;
}
my $amz = Net::Amazon->new(
token => $ENV{AMAZON_KEY},
secret_key => $ENV{AMAZON_SECRET},
locale => uk,
) or die Cannot connect to Amazon\n;
my $resp = $amz->search(asin => $isbn);
unless ($resp->is_success) {
say Error: , $resp->message;
return;
}
my $book = $resp->properties;
my $title = $book->ProductName;
my $author_name = ($book->authors)[0];
my $imgurl = $book->ImageUrlMedium;
my $author = $schema->resultset(Author)->find_or_
create({
name => $author_name,
});
$author->add_to_books({
isbn => $isbn,
title => $title,
image_url => $imgurl,
});
say Added $title ($author_name);
return;
}
We need the ISBNnumber of the book to add. This is
passed as a parameter into the subroutine. Perl passes
parameters into subroutines in an array called @_. In the
same way that shift works on @ARGVwhen called without
an argument outside of a subroutine, it works on @_ when
called without an argument inside a subroutine. If no value is
found, then the programdies.
Having got an ISBN, we first need to check that the book
isnt already in the database. We get a schema object and use
that to give us a resultset object for the book table. In
DBIx::Class, all manipulation of a specific table is done using
a resultset object. We can use the resultsets search method
to look for books with the same ISBN.
The search returns another resultset object and we can
use the count method on that to see howmany books
already exist in the database with this given ISBN. Hopefully
there arent any. But if there are, we can display an
appropriate message and return fromthe subroutine without
doing any more work.
If the book isnt already in the database, then we can add
it. But first we need to get more details fromAmazon. We
create a Net::Amazon object giving it the key and secret that
we got fromAmazon. We also set the locale to uk to indicate
that we want to use Amazons UKdata. We can then use the
search method on the Amazon object to look for products
with our ISBN. If the search is successful, we can get details
of the matching book fromthe returned object.
Having got the details of the book, we can extract various
interesting things fromthe object and store themin our
database. Notice that the authors method returns a list of
authors and were only taking the first one.
To insert the book, we first look for the author in the
database by getting an author resultset and using the find_
or_create method to either find an existing author record or
create a newone.
Find the author
Once we have the author object we can use its add_to_books
method to add a newbook related to that author. The add_
to_books method is one that was created automatically by
DBIx::Class::Schema::Loader when it created our classes. It
knewthat this relationship between the tables existed
because of the foreign key constraint that we created on the
book table.
We can nowtry adding a book to our database. Get the
ISBNof a book fromAmazon and try running the command:
Perl comes
with a lot of
documentation
which you can
read using the
perldoc program.
Alternatively, its all
online at http://
perldoc.perl.org.
Quick
tip
Object Relational Mapping
Many programs are going to need a
persistent data store and in many
cases that will be a relational database
such as MySQL or SQLite. In order to
talk to these youll need some kind of
database interface (such as Perls DBI
module) and a lot of SQLscattered
throughout your code.
Object Relational Mapping (ORM)
allows you to write code that interacts
with a database at a higher level. You no
longer write SQL, you just manipulate
objects in your programand ORM
takes care of converting that into SQL.
Three concepts in Object Oriented
Programming (OOP) map rather well
onto matching concepts in relational
databases. In OOP, a class defines a
type of object (such as books), and
thats very similar to table in a
database. Aparticular instance of a
class is an object (a particular book)
and thats like a rowin a database table.
Finally, classes and objects have
attributes which are the individual
properties of the object (for example
title and author) and this is similar to
columns in a database.
ORMuses these similarities to map
data fromrelational databases into
OOP objects within your program. A
good ORM, such as DBIx::Class, will be
able to automatically generate the
classes fromthe metadata stored in
the database which describes the
various tables.
104 LXF151 December 2011 www.linuxformat.com
Modern Perl
Next time
In the next instalment well take our command-line
programand turn it into a web application.
$ ./book add 0330258648
$ ./book list
The next sub-command well implement will be list; so
that we can see what is in our database. This looks complex,
but actually, its rather repetitive as we print the list in three
sections (Reading, To Read and Read).
The only difference between the sections is the selection
criteria we use. Books being read have a value in the started
column but a null ended column. Books that have been read
have a value in ended. Abook with a null started is still in the
to be read pile. To run these queries we use the search
method on a book resultset object. Anull value in the
database is represented by the undef value in Perl. The
reading query looks like this:
foreach ($books_rs->search({
started => { !=, undef },
ended => undef,
})) {
say * , $_->title, (, $_->author->name, );
}
The search arguments say that started is not null and
ended is null. For each book found by the query we print the
title and the authors name. Again, these methods are
created for use by DBIx::Class::Schema::Loader using
information it finds about the columns in the tables and the
relationships between tables. For the list of books read, the
query looks like this:
foreach ($books_rs->search({
ended => { !=, undef },
})) {
say * , $_->title, (, $_->author->name, );
}
And for the list of books still to read, it looks like this:
foreach ($books_rs->search({
started => undef,
})) {
say * , $_->title, (, $_->author->name, );
}
The full version of the list subroutine is on the CD.
The beginning and the end
The last two sub-commands we need to implement are start
and end to indicate when we start and finish reading a book.
They are very similar, so Ill just showthe start one here:
sub start {
my $schema = get_schema();
my $books_rs = $schema->resultset(Book);
my $isbn = shift || die No ISBN to start\n;
my ($book) = $books_rs->search({ isbn => $isbn });
unless ($book) {
die ISBN $isbn not found in db\n;
}
$book->started(DateTime->now);
$book->update;
say Started to read , $book->title;
}
Alot of this looks very standard by now. We check weve
been given an ISBNnumber and then we get a schema
object and a book resultset object. We use the search
method to get the book object fromthe database (and die if
it cant be found). Then we use the started method to update
that column and call the update method to save the changes
back to the database.
When we set up our database classes using dbicdump
we asked for an extra component called
InflateColumn::DateTime to be included. This is where we
see the advantage of that. It identifies any date and time
columns in the database and converts those values into Perl
DateTime objects in our program. So we can create a Perl
DateTime object using the classs nowmethod and
DBIX::Class will automatically convert that into the
appropriate string to be stored in the database. The end
sub-command looks very similar to this, with only the
column name changed fromstarted to ended.
Write your own
We nowhave a working system. We can add books, start
reading books, finish reading books and see what the current
state of our reading list is. Having already added a book to the
systemabove, try running the following commands:
$ ./book list
$ ./book start 0330258648
$ ./book list
$ ./book end 0330258648
$ ./book list
Youll see the book moving between the different sections of
the report.
LXF
Theres a useful
programcalled
perltidy, which
will tidy up Perl
code. Its almost
certainly available
prepackaged for
your distribution.
Quick
tip
Once youve read a couple of books, your reading list
should look a bit like this.
Taking it further
Theres a lot to learn about Perl. Here
are some suggestions for places to go
for more information.
The Perl home page is at http://
perl.org. Fromthere you can find links
to many other resources about Perl.
One of the best ways to read about
what is going on in the Perl world is to
followthe Perl Iron Man blog
aggregator at http://ironman.
enlightenedperl.org.
The definitive book about Perl is
called Programming Perl. The third
edition has been out for rather a long
time now, but a fourth edition is due to
be published later this year.
The best book for learning Perl is
called, unimaginatively, Learning Perl
and the sixth edition was published this
summer. There are two more books in
this series called Intermediate Perl and
Mastering Perl.
Perl user groups are known as Perl
Mongers. You can get in touch with
your nearest Perl Monger group by
visiting the website at http://pm.org.
www.tuxradar.com December 2011 LXF151 105
Coding Concepts
if x == 10:
print X is ten
somefunction()
else:
anotherfunction()
In this case, if Xcontains 10we print the message as
before, but then call the somefunction routine elsewhere in
the code. That could be a big function that calls other
functions and so forth, thereby turning this into a long branch
in the code.
There are alternatives to the double-equals weve used:
if x > 10 If Xis greater than 10
if x < 10 If Xis less than 10
if x >= 10 If Xis greater than or equal to 10
if x <= 10 If Xis less than or equal to 10
if x != 10 If Xis NOTequal to 10
These comparison operators are standard across most
programming languages. You can often performarithmetic
inside the conditional statement too:
if x + 7 == 10:
print Well, X must be 3
Comparing function results
While many if statements contain mathematical tests such
as above, you can call a function inside an if statement and
performan action depending on the number it sends back.
Look at the following Python code:
def truefunc():
return 1
def falsefunc():
return 0
print Execution begins here...
if truefunc():
Back to basics:
Using conditionals
Anynon-trivial programneeds tomakedecisions basedon
circumstances. Mike Saundersexplains codings ifs andbuts.
M
urray Walker, the great Formula 1 commentator,
used to sayIFis F1 spelled backwards. Ifs, buts
and maybes play a vital role in motor racing, as
they do in computer programming. If youre writing a
programthat simply processes and churns out a bunch of
numbers, without any user interaction, then you might be
able to get away without any kind of conditional statements.
But most of the time, youll be asking questions in your code:
if the user has pressed theYkey, then continue. If not, stop.
Or if the variable PRICE is bigger than 500, halt the
transaction. And so forth.
Acondition is just a question, like in everyday life: if the
kettle has boiled, turn off the gas. (We dont use new-fangled
electric at LXFTowers.) Or if the magazine has been sent to
the printers, go to the pub. Heres an example in Python code:
x = 5
if x == 10:
print X is ten
else:
print X is NOT ten
print Program finished
Here, we create a newvariable (storage place for a
number) called X, and store the number 5 in it. We then use
an if statement a conditional to make a decision. If X
contains 10, we print an affirmative message, and if not (the
else statement), we print a different message. Note the
double-equals in the if line: its very important, and well come
onto that in a moment.
Here were just executing single print commands for the if
and else sections, but you can put more lines of code in there,
providing they have the indents, Python style:
At its core, a conditional statement is something like this.
Python doesnt
have switch/
case. Why? Read
the explanation
at www.python.
org/dev/peps/
pep-3103/.
PART 3
IFcondition...
Consequent
action
Alternative
action
THEN ELSE
106 LXF151 December 2011 www.linuxformat.com
Mike Saunders
uses conditionals
to decide whether
to watch Sturm
der Liebe or write
code for his
operating system,
http://mikeos.
berlios.de.
Our
expert
Coding Concepts
Assignment vs comparison
Big ifs and small ifs
In some languages, especially C, you
have to be VERYcareful with
comparisons. For instance, look at this
bit of Ccode try to guess what it
does, and if you like, type it into a file
called foo.c, run gcc foo.c to compile it
and then ./a.out to execute it.
#include <stdio.h>
int main()
{
int x = 1;
if (x = 5)
puts(X is five!);
}
If you run this program, you might be
surprised to see the Xis five message
appear in your terminal window.
Shurley shome mishtake? We clearly
set the value of Xto be 1! Well actually,
we did, but in the if line we then
performed an assignment, not a
comparison. Thats what the single
equals sign does.
Were not sayingif Xequals 5, but
rather, put 5 in X, and if that succeeds,
execute the code in the curly brackets.
Ouch. If you recompile this code with
gcc -Wall foo.c (to showall warnings),
youll see that GCCmentions
assignment used as truth value. This
is an indication that you might be doing
something wrong.
The solution is to change the if line
to if (x == 5) instead. Nowthe program
runs properly. Its a small consideration,
but if youve just written a fewhundred
lines of code and your programisnt
behaving, this could be the root cause.
In Cand other languages that share its syntax, you
dont need to use curly brackets when using an if
statement followed by a single instruction:
if (a == 1)
puts(Hello);
But only one instruction will be executed. If you
do something like this:
int x = 1;
if (x == 5)
puts(X is 5);
puts(Have a nice day);
When you execute this, it wont print the first
message, but itll print the second. Thats because
only the first is tied to the if statement. To attach
both instructions to the if, put themin curly braces
like this:
if (x == 5) {
puts(X is 5);
puts(Have a nice day);
}
Contrast this with Python, where the
indentation automatically shows which code
belongs to which statement. Cdoesnt care about
indentation you have to explicitly showwhat you
want with curly brackets.
Here we see how indentation isnt
good enough for C we need to use
curly braces to bundle code.
print Yay
if falsefunc():
print Nay
The first four lines of code define functions (subroutines)
that arent executed immediately, but are reserved for later
use. Theyre really simple functions: the first sends back the
number 1, the second zero. Programexecution begins at the
print line, and then we have our first if statement. Instead of
doing a comparison, we call a function here, and act on the
result. If the if statement sees the number 1, it goes ahead
with executing the indented code, if not, it skips past it. So
when you run this, youll see Yay but not Nay, because if here
only does its work if it receives the number 1 back fromthe
function it calls. In Python and many other languages, you can
replace 1 and 0 withTrue and False for code clarity, so you
could replace the functions at the start with:
def truefunc():
return True
def falsefunc():
return False
and the programwill operate in the same way.
Clearing up code
In more complicated programs, a long streamof ifs and elses
can get rather ugly. For instance, consider this Cprogram:
#include <stdio.h>
int main()
{
int x = 2;
if (x == 1)
puts(One);
else if (x == 2)
puts(Two);
else if (x == 3)
puts(Three);
}
C, and some other languages, includes a switch
statement which simplifies all these checks. The lines
beginning with if here can be replaced with:
switch(x) {
case 1: puts(One); break;
case 2: puts(Two); break;
case 3: puts(Three); break;
}
This is neater and easier to read. Note that the break
instructions are essential here they tell the compiler to end
the switch operation after the instruction(s) following case
have been executed. Otherwise it will execute everything
following the first matching case.
Another way that some programmers in C-like languages
shorten if statements is by using ternary statements.
Consider the following code:
if (x > y)
result = 1;
else
result = 2;
This can be shortened to:
result = x > y ? 1 : 2;
Here, if Xis bigger than Y, result becomes 1; otherwise its
2. Note that this doesnt make the resulting code magically
smaller, as powerful optimising compilers do all sorts of
tricks, but it can make your code more compact.
So, thats conditionals covered. Although weve focused on
Python and Cin this guide, the principles are applicable to
nigh-on every language. And it all boils down to machine code
at the end of the day: the CPUcan compare one of its number
storage places (registers) with another number, and jump to a
different place in the code depending on the result. Remember
to thank your CPUfor all the hard work it does.
LXF
www.tuxradar.com December 2011 LXF151 107
Python
108 LXF151 December 2011 www.linuxformat.com
Now, if you hover over the image of the lightbulb, you
should see a tooltip, albeit a dull one.
That was astounding wasnt it? Well, it was probably a lot
easier than you expected. Anyhow, there are more tricks you
can play with tooltips. The next, most obvious stage is to style
up the text. PyGTKsupports the Pango markup system,
which is a fairly simple-to-understand method of applying
styles to text, rather similar to HTML.
As a general rule, simple things such as bold and italic are
controlled by normalish tags in the text: <b> bold <i> bold
italic </b> italic</i>. Other things such as colour and font
stuff need to be attributes for a span item: <span
foreground=red font=Monospace 14> Madam, I am
Adam</span>:
>>> ptext=<span font=Sans 15 font_style=italic> This is
<b>not</b> a lightbulb</span>
>>> i.set_tooltip_markup(ptext)
Even more groovy, isnt it? Nowyou can add useful
explanatory text to all the widgets in your applications. I
knowwhat youre thinking, if its that easy, what amI going to
witter on about for the next three pages? Well, dont worry,
there is a plan...
Playing music
Nowthat we have the basics, our plan is to go for a tricky case
study in a real application. We dont have a real application
yet, so building one should be fairly high up on our list of
priorities. We want one with a TreeView(we covered the tricky
TreeViewwidget back in LXF149 when we built an RSS
reader) and we want to create something custom.
Make
custom tooltips
Buildasimpleworkingmusicplayer andaddcustomtooltips
tothefilelist. Nick Veitch is themanwhoknows how.
L
ast time we used the power of Cairo to create
customised drawing areas within our application, and
took a trip into the wonderful world of mathematics.
This time we are once again looking at customising elements
of the GTKtoolkit, in this case, tooltips.
Tooltips are the little bits of informative info that pop up on
the screen when you hover the mouse over something.
Theyre quite often overlooked, and many people feel they
should not be necessary at all if an application is designed
well. Its true enough that there is little point in labelling a
button that saysSTOP on it with a tooltip that saysStop
button. However, there are times when a tooltip can give an
object an extra layer of information.
Before we get ahead of ourselves though, lets fire up a
shell and dive into some Python to have a look at the basics:
>>> import gtk
>>> w=gtk.Window()
>>> w.set_size_request(200,200)
>>> i=gtk.Image()
>>> i.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_
SIZE_DIALOG)
>>> w.add(i)
>>> w.show_all()
Here we create a windowand an image object. Because we
are too lazy to actually drawanything, we can make use of an
image object fromthe set of stock objects used in GTK. Then
we simply add it as the only object on the window, and call
the show_all() method to make the windowdisplay itself.
Nowfor the tooltip itself:
>>> i.set_tooltip_text(this is not a lightbulb)
Our first tooltip in action! This is not a lightbulb either,
just so you are sure.
Now with added Pango styling, you must be doubly sure
that this is not a lightbulb.
The code is well
commented and
on the DVD. Apart
fromPython 2.7+,
you will need the
following modules:
gtk (PyGTKfor
the interface);
mutagen (for
unscrambling ID3
tags); gst (python-
gstreamer for
playback). You
will also need
some sort of MP3
codec installed for
GStreamer.
You will
need...
PART 7
Tutorial code
When launching
LXF, only a set of
Nick Veitchs
Bash scripts kept
the magazine
going. Then they
were replaced
withpeople, a
retrograde step
in his opinion
Our
expert
Python
www.tuxradar.com December 2011 LXF151 109
It would be just too dull to wheel out our RSS reader again,
so lets build something else. Bored with Amarok? Weighed
down by the banality of Banshee? Lets build our own music
player application! (NBAmarok and Banshee are great,
please dont send your hate bombs to me, I was just trying to
whip up some enthusiasm).
The great thing about a music player is that you can
build it in about four lines of Python with the help of the
gstreamer module:
>>> import gst>>> p=gst.element_factory_
make(playbin,trackplay)
>>> uri=file:///home/evilnick/Music/01_ground_control.mp3
>>> p.set_property(uri,uri)
>>> p.set_state(gst.STATE_PLAYING)
<enum GST_STATE_CHANGE_ASYNC of type
GstStateChangeReturn>
>>> p.set_state(gst.STATE_NULL)
<enum GST_STATE_CHANGE_SUCCESS of type
GstStateChangeReturn>
>>>
Okay, so this is not a great music player, but rather like
those people who wander around derelict bungalows on
Homes Under the Hammer, you have to imagine the potential.
The element_factory method just makes a generic object
that can play any GStreamer compatible media source (it
works with video too by the way). To point it at something, we
create a string to a known music file (obviously, yours will be
somewhat different) and then just make a call to set_state()
to make it play. The last call there stops the playback for you
(you can also use gst.STATE_PAUSEDto pause the track at
the current point).
Thats really all there is to playing the music. All we have to
do is provide an application that will manage to feed the path
to MP3 files to our player. Although, it would also help if it
could organise thema bit too.
Mutagen
Fortunately for us, the world of music realised long ago that it
was a good idea to embed information in audio files, rather
like the EXIFdata you find in an image file. Sadly, its not
nearly as well implemented.
The most popular method by far is to use ID3 tags
frames of data bundled together in the header of the file. Even
narrowing down on this one scheme though, there are all
sorts of variations between different versions, and there isnt
even any guarantee that any particular frame of data will be
present. In short, its a mess.
For trying to make sense of this mess, well be using the
Mutagen library. This is actually really robust and helpful,
packed full of features, and should you decide to extend this
application, it also supports other types of formats such as
those used for Ogg and FLACfiles.
Heres howit works:
>>> from mutagen.mp3 import MP3
>>> mdata=MP3(/home/evilnick/Music/02_rollerblades.
mp3)
>>> mdata.keys()
[TPOS, TDRC, TIT2, uAPIC:Cover (front), TRCK,
TPE1, TALB, TCON, TCOM]
>>> mdata[TIT2]
TIT2(encoding=0, text=[uRollerblades])
>>> mdata[TIT2].text
[uRollerblades]
>>> mdata[TIT2].text[0]
uRollerblades
Weve used the mp3 subset of the module here, so weve
just imported that bit. All we need to do is create an MP3
object froma filename. This object stores the ID3 information
in a dictionary, so using the .keys() method tells us what
tags are actually present in the file.
If none of these make any sense to you, its because they
seemto have intentionally been designed to confuse and
frustrate. See the boxout for more details on the ID3
standard, but for nowIll tell you that TIT2 is the track name,
TALBis the albumname andTPE1 is the recording artists
name. Makes sense, no?
In the previous example weve ended up with a text string
by working our way through the object hierarchy. The text is
stored in a list, but you can also get to it by using the objects
.pprint() method:
>>> mdata[TCOM].pprint()
uTCOM=Craigie Dodds
So, all we really need to do is load up a list of filenames
and then scan the MP3 files to harvest their data. We can
bung the relevant info into a TreeView.
Return to the trees
We wont belabour the boring parts of the application were
going to build the finished source code on the DVDhas
plenty of notes explaining whats going on. So, well skip the
basics of a GTKapplication (LXF147), howwe made the
menus (LXF148), and some of the basics of creating a
TreeView(LXF149). However, it doesnt hurt to recap on the
TreeViewa little bit, because were using it differently this
time, and well be connecting up some different bits.
There are really two parts to a TreeView. There is the
widget itself, and the object that stores the data to be
displayed. In our case, this is a gtk.ListStore object, and we
will fill it with the values we harvest fromour files. Not all of
this data needs to be displayed, which is handy, because it
means we can link useful data to rows of data without
Quick
tip
I want my ID3
The original ID3 specification was
rubbish its amazing it caught on.
Nowtheres quite a usefully
documented spec (the original
documents have a special APIC
designation for a bright colored fish)
the only trouble is, you still have to
cater for people using the umpty-ump
previous versions. Badly. Thats why
dealing with ID3 tags is a touch
unpleasant, and why a rock-solid library
such as Mutagen is so useful.
You should also be aware of Stagger,
another module that is most excellent,
but only works with Python 3 (http://
code.google.com/p/stagger).
The Id3.org website can provide some illumination on what the different
tags are for, but not for where it all went wrong.
You can give your
code a thorough
going over with
PyChecker
http://pychecker.
sourceforge.net
to avoid common
errors.
Python
110 LXF151 December 2011 www.linuxformat.com
managing a separate data structure. The full path of our
music files, for example, can go in the ListStore, along with
the info we want to display, such as track names, the artist
and other details.
The following code is part of our main application class __
init__ method:
self.liststore=gtk.ListStore(str, str, str,str, str, str, str)
self.treeview=gtk.TreeView(self.liststore)
self.txtrenderer=gtk.CellRendererText()
column = gtk.TreeViewColumn(Track name, self.
txtrenderer,text=1)
self.treeview.append_column(column)
column = gtk.TreeViewColumn(Artist, self.
txtrenderer,text=0)
...
Here we create the ListStore and TreeViewobjects, and then
generate the columns that will be displayed by the widget.
The cells are rendered by a different GTKobject, the
CellRenderer. If you are just using text, you can create one
that can be used for all the entries.
When we create the column, the text= parameter points
to the column of data that holds the value to be displayed.
Once weve added all the columns, we can set some of the
behaviours for the TreeView:
self.treeview.columns_autosize()
self.treeview.set_reorderable(True)
self.treeview.connect(row-activated, self.tree_
doubleclick)
Autosize just means the columns are adjusted to fit the
width of the data they hold, and setting the reorderable
property means that users can drag and drop rows in the
viewto reorder them it doesnt really have much effect in
the application as it stands, but you could use it as part of a
playlist systemperhaps.
The last line connects the relevant signal fromthe widget
to a method that we will use to start the music playing. More
of that in a moment, but nowwe also need to sort out our
tooltip. If were just going to use normal text tooltips, we could
store the tip in a newcolumn of data and activate it like this:
self.treeview.set_tooltip_column(6)
That would be pretty straightforward, but it prevents you
frombeing able to do neat things such as include images.
Instead well manually set the tooltip property to True, and
then provide a callback method to deal with it:
self.treeview.props.has_tooltip = True
self.treeview.connect(query-tooltip, self.custom_
tooltip)
Nowwhen the mouse hovers over the table, this signal will
create a call to our custom_tooltip method, passing along
the specifics of the event that caused the signal.
We want to make a customtooltip. We can do that with
some of the information weve already garnered fromthe file,
but it would be nice to have an image as part of our tooltip.
Where can we get an image from?
Getting an image fromAPIC data
One of the magic fields in ID3 is APIC, which stores, er, a pic. It
is a container for image data usually a JPGimage of the
albumcover, although other types exist. It would be very cool
to showthis image as part of our tooltip, but there are a few
problems to overcome:
1 The APIC tag is inconsistent it often has a poorly-
formed name.
2 The data is actually a file well need to find a way to
decode it.
3 Some files will not have APIC data so well need to
handle that.
For a really robust answer to problem1, you might want to
develop a whole algorithmfor searching the data within keys,
but for our purposes, well just check for some of the
common variants. We can do this simply by checking the
keys for particular terms and then assigning a variable to
that key to retrieve later. If were cunning, we can solve
problem3 at the same time if no valid key is found, theres
no image, so we can generate a dummy image (or use one of
the GTKstock images). The first part of our function would
then look like this:
def image_from_APIC(self, filename):
image=gtk.Image()
tags=MP3(filename)
if APIC: in tags.keys():
k=APIC:
elif APIC:Cover in tags.keys():
k=APIC:Cover
elif APIC:Cover (front) in tags.keys():
k=APIC:Cover (front)
else:
image.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.
ICON_SIZE_DND)
return image
data=tags[k].data
Nowthat we have (hopefully) extracted the right data,
howdo we get it into an image? The data is organised as a file,
not some rawimage data. It needs to be read in and decoded
as though it were a file fromdisk. There are methods for
loading a GTK.Image froma file, but they are expecting a
filename, not the data itself.
One solution might be to dump this data out to a
temporary file and then use the file loading method to read it
in again. It would work, but gosh, it seems rather inelegant
and wasteful doesnt it? There is a better way.
The Gdk part of the GTKmodule has a lot of tools
specifically for dealing with images and pixel buffers. One of
Although you
dont need an IDE
to write Python,
it can be handy
for debugging
strange
behaviour.
What on earth is GTK?
GTK+, to give it its full name, is simply a
graphical toolkit that defines a whole
set of graphical elements windows,
menus, buttons etc, for you to make
applications with. Its one of the
foundations of the Gnome desktop and
used heavily in real applications, but
also is very easy to use with Python.
Python
www.tuxradar.com December 2011 LXF151 111
these is a loader object, which was designed for streams of
data that might take a while to load. It accepts the data in
chunks and tries to make sense of it. We will only have one
chunk to send, but we can use this functionality to get the
image into a gtk.pixbuf object.
The steps are to create the loader object, set the size of
the resulting pxbuf (it takes width and height and will scale
proportionally to fit). Then we write the data to the loader,
close it and ask it for our pixbuf. We can then use the pixbuf
data to set a normal gtk.Image().
loader= gdk.pixbuf_loader_new()
loader.set_size(120, 120)
try:
loader.write(data)
loader.close()
except:
print no image
image.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.
ICON_SIZE_DND)
return image
pb=loader.get_pixbuf()
image.set_from_pixbuf(pb)
return image
The actual file loading bits are enclosed in a try... except
clause. Thats because, although we knowthere is data there,
we dont knowif its corrupted or in a format that we can
read, so rather than have the whole application crash if it fails,
we can just default to a stock image. At the end of the
function we return a gtkImage object, of one sort or another.
Building a customtooltip
Weve seen howto extract an image froma compatible MP3
file, but howcan we combine that and the other information
into a tooltip of our own? We need to start with the basics of
our method to handle the generation of tooltips.
Lets start like this:
def custom_tooltip(self, widget, x, y, keyboard, tooltip):
This is the information that gets passed to us when the
application receives adisplay a tooltip-type event:
widget the widget that initiated the event, in our case,
this is the TreeViewobject;
x,y the x and y coordinates of the mouse position relative
to the widgets parent window;
keyboard this is true if the keyboard triggered the tooltip;
tooltip this is a gtk.ToolTip object to display.
We dont need to generate a tooltip one has been made
for us and passed in as an argument. All we need to do is set
that tooltip using the information we have.
The first thing we need to do is find out where on the
TreeViewthe mouse was hovering. Ive seen horrifically
complicated bits of code that calculate the rowfromthe x,y
values, but it really isnt necessary. Theres a handy shortcut
in the formof a method fromthe original widget, which takes
the x,y and keyboard values as an input, and returns
amongst other things, the rownumber of the TreeViewwhere
the mouse is:
result=widget.get_tooltip_context(x, y, keyboard)
if (result == None):
return
row=result[1][0]
Nowwe knowthe row, we can generate data to put in the
tooltip. We can start by fetching the filename and then
passing it to our APICmethod:
filename = self.liststore[row][5]
image=self.image_from_APIC(filename)
The final step is to create a widget we can set as our
tooltip. For this purpose you can use practically any widget
class, but usually a container of some sort packed with
different elements is best:
hbox = gtk.HBox()
hbox.pack_start(image, False, False, 0)
vbox=gtk.VBox()
Here weve created an Hbox container and put the image in
one side, and a VBox in the other. On this side we can pack
labels representing the rest of the data:
label1=gtk.Label()
Name=xml.sax.saxutils.escape(self.liststore[row][1])
label1.set_markup( <span font=Sans 15 color=red >
<b><i>+Name+</i></b></span>)
vbox.pack_start(label1, False, False, 0)
and so on. You will notice that weve used markup to display
the labels, which means you can play around with different
fonts and styles to make the display nice.
The only thing you need to be aware of with this is that
it will break badly if you use any unsafe text, such as& or <.
As theres a high probability that some of these characters
may appear in the ID3 tag info, its best to sanitise them
first. The xml.sax module that ships with Python has some
utility methods that can help with this, and weve used
those here.
Finally we need to pack everything into the other side of
the HBox container and then use the tooltips set_custom()
method to make these elements the displayable for our
tooltip. Its also vital that we return True fromthis callback
method, otherwise your tooltip will not display at all!
hbox.pack_start(vbox, False, False, 0)
hbox.show_all()
tooltip.set_custom(hbox)
return True
Try it out the full, working code is pretty easy to
understand as there are loads of comments throughout.
Weve configured the application to pop up a file requestor
(LXF147) for the directory where your music files are, and
once youve selected that, it should be pretty easy to work out
whats going on. Double-click to play a music file, and make
sure to hover! LXF
The PyGTK
documentation
is good (www.
pygtk.org/docs/
pygtk) but the GTK
documentation
(http://developer.
gnome.org/gtk/
stable) often has
more illuminatory
examples, so if you
get stuck, check
there as well.
Quick
tip
You too can
make awesome-
looking tooltip
things. Or, if you
get bored, you
can just use our
app to play your
music.
Next time
The mechanics of drag-and-drop with PyGTKexplained.
Android
The next two tutorials will tackle the audio/media API
which allows you to play MP3s and other music files. This
month well look at the SDcard as a source, and next month
well investigate streaming. We assume at least some
familiarity withAndroid coding and the development setup,
and well use the command line rather than Eclipse
although Eclipse is fine if you prefer it.
Android: Music
on the move
Inthefirst of this two-part tutorial, Juliet Kemp
looksat MediaPlayer andgetsabasicMP3player upandrunning.
I
f youre a coder, one of the best features of Android is the
highly usable, well-documented and wide-rangingAPI
theres a huge range of classes and interfaces that you can
hook into with minimal effort. Unless you have a good reason
not to, its best to use these rather than rolling your own, partly
because it saves time and effort, and partly because theyre
already tuned to work well withAndroid hardware.
Initial setup: getting started
Tutorial code.
Ive compiled against version 10, and at least one class used
here requires that, but the basics should all be available for
earlier versions:
android create project --target android-10 --name mp3 \\
--path ~/android/mp3 --activity AndroidMP3 --package com.
example.androidmp3
For the first version of the project, well just use a list to
showany MP3s available on the SDcard. Create this list.xml
file in res/layout first, to set up the Viewthat the app will use:
<?xml version=1.0 encoding=UTF-8?>
<LinearLayout xmlns:android=http://schemas.android.com/
apk/res/android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent>
<ListView android:id=@id/android:list
android:layout_width=fill_parent
android:layout_height=fill_parent
android:layout_weight=1
android:drawSelectorOnTop=false/>
<TextView android:id=@id/android:empty
android:layout_width=fill_parent
android:layout_height=fill_parent
android:text=@string/emptylist/>
</LinearLayout>
Note the automatic android:empty item, which sets the
text to display if the list is empty (set this text in res/values/
strings.xml). Youll also need an item.xml file to set up how
each individual itemwithin the list is displayed:
<?xml version=1.0 encoding=utf-8?>
<TextView android:id=@+id/title xmlns:android=http://
schemas.android.com/apk/res/android
android:layout_width=wrap_content
android:layout_height=wrap_content/>
Back to the AndroidMP3.java file. As were currently
using just a basic list of MP3s, it should extend ListActivity. On
creation, the activity needs to set its view, and update the list
of available MP3s:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list);
updateMP3List();
}
Weve already set up R.layout.list; nowwe need to write
updateMP3List():
private static final String MEDIA_PATH = new String(/
sdcard/);
private List<String> mp3list = new ArrayList<String>();
[ ... ]
public void updateMP3List() {
File home = new File(MEDIA_PATH);
if ( home.listFiles( new Mp3Filter() ).length > 0 ) {
for ( File file : home.listFiles( new Mp3Filter() ) ) {
mp3list.add(file.getName());
}
ArrayAdapter<String> mp3ListAdapter =
new ArrayAdapter<String>(this, R.layout.item, mp3list);
setListAdapter(mp3ListAdapter);
}
else {
// No files here; empty string will be seen
}
}
The MEDIA_PATHString is set up for the whole class,
then used to create a newFile object. The listFiles() method
returns an array of files in the given directory which match
the filter. This means that we also need to create an
Mp3Filter, which we can do quickly as a contained helper
class within this main class:
class Mp3Filter implements FilenameFilter {
public boolean accept(File dir, String name) {
return (name.endsWith(.mp3));
}
}
Note that the
sample code on
the DVDdoesnt
compile as-is; you
need to create it
either as weve
explained or via
Eclipse for the
compiler to know
where to find
your local SDK
installation.
Quick
tip
112 LXF151 December 2011 www.linuxformat.com
Juliet Kemp
has a lot more
MP3s than she
has bothered to
load onto the
Android emulator
to play with.
Our
expert
PART 1
Android
Set up an ArrayAdapter
Back to updateMP3List(). The if clause checks that there are
some MP3 files in the SDCard directory. If not, theempty
string will be used. Although theres no body to the else
clause, its good practice to document that this is deliberate,
for ease of future code maintenance.
If there are any files, we go through themone by one,
adding themto the list. After that, the next thing to do is to
set up anArrayAdapter, in order to be able to treat mp3List
as an array that Android can display, using the item.xml
TextViewto display each item. This is another part of the
standardAndroidAPI and youll use it in a great many places.
It acts as an interface between a TextViewand an array of
objects of any type. (You can also use it as an interface for
more complicated types of Views by overriding its getView()
method; here all we need is a TextView.)
Once we have our MP3 list, we need something to happen
when the user clicks on a list item. Specifically, we want to
play the relevant MP3. This uses the standard
onListItemClick method:
private int currentPosition = 0;
[ ... ]
protected void onListItemClick(ListView list, View view, int
position, long id) {
currentPosition = position;
playMp3(MEDIA_PATH + mp3List.get(position));
}
We set the currentPosition so we knowwhere we are in
the list for future reference, then call the playMp3() method
to play the MP3 thats been clicked on:
private MediaPlayer mp = new MediaPlayer();
[ ... ]
private void playMp3(String mp3Path) {
try {
mp.reset();
mp.setDataSource(mp3Path);
mp.prepare();
mp.start();
} catch (IOException e) {
Log.v(TAG, e.getMessage());
}
}
The MediaPlayer is set up at the top of the class, and then
pretty much all the work here is done by the Android-provided
MediaPlayer API, making this method very straightfoward.
The code resets the MediaPlayer in case theres something
else currently playing, or theres been an error; sets the data
source (the path to the currently-clicked MP3); prepares the
player, and starts the MP3 playing. Thats it, apart fromthe
error catch block (here, we just log the error). The boxout
discusses the MediaPlayer lifecycle and possible states in
more detail.
What, though, should the player do at the end of the song?
Howabout moving straight onto the next song? Add this at
the end of the try block:
mp.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mplayer) {
nextMp3();
}
});
Again, the API does much of the work, by providing the
setOnCompletionListener method and the
OnCompletionListener class. All we have to do is to write
the nextMp3() method:
private void nextMp3() {
if (++currentPosition >= mp3List.size()) {
// No more songs! Reset currentPosition
currentPosition = 0;
} else {
playMp3(MEDIA_PATH + mp3List.get(currentPosition));
}
}
Check the size of the list, and reset the currentPosition
(and do nothing else; you could instead play this first MP3, if
you preferred to be able to loop over the list) if were out of
MP3s. Otherwise, back to the playMP3 method, with the
path for the next MP3.
Types of sound file
Android natively supports several
different music formats besides MP3,
including AAC(.3gp, .mp4, and .m4a;
.aac itself is only supported in Android
3.1+), FLAC(.flac), and Ogg Vorbis (.
ogg). This app only finds MP3s, which
may well not meet your requirements.
To get all media files without going
through a long list of acceptable file
endings, we could instead look at the
MediaStore.Audio class, and
specifically the MediaStore.Audio.
Media.EXTERNAL_CONTENT_URI
content provider. Android
automatically scans external SD cards
for media files, and you can use this
content provider to access themand
information about them.
Well take this approach when
improving this player in the next
tutorial. For now, the variables and
methods in this class are named to
make it clear that all were getting from
the SDcard is MP3 files.
No SDcard?
If theres no SDcard on the system(ie
not just no MP3s to be listed, but not
possible to list the directory), youll get
a NullPointerException. Unfortunately,
its not possible to avoid this by testing
home.exists() or home.isDirectory();
since the SDcard directory exists, and
shows up as a directory, even if its not
actually there. Only when you try to list
the files in it do you get an error.
Instead, you need to put the if/else
clauses in a try/catch block:
try {
if (home.listFiles [ ... ] ) { [ ... ] }
else { [ /// ] }
} catch (NullPointerException e) {
return;
}
This way, the code will return quietly,
and use theempty string set up in the
TextViewwith theempty ID. You could
perhaps improve it a little for the user
by altering that TextViewto say that
theres no SDcard found.
App running with the light theme, which some people
may find easier to read.
www.tuxradar.com December 2011 LXF151 113
Android
Creating some buttons
Now with added buttons, track info, and track length!
Note that were using a pre-increment operator in the if
clause; this means that currentPosition is incremented
before the expression is evaluated. (currentPosition++ >=
mp3List.size() would increment it after evaluation, which is
not what we want; were checking for the existence of the
next song in the list).
It also means that by the time we get to the else clause,
currentPosition has already been incremented. Its
important to be clear on the difference between the pre- and
post-incrementor operators inJava.
Astraightforward way to test this, if you already have
MP3s on your own SDcard, is to set up your device for USB
testing and then install straight onto it. Alternatively, you can
run it on the emulator, but first of all, youll need to set up an
SDcard for the emulator. Navigate to whichever directory you
want to keep the card in, then type:
mksdcard -l 512MCard 512M mysdcard.img
The -l is optional and sets a label for the card; the size and
file (which must end .img) are required. Once the SDcard is
created, fire up the Android SDK/AVDManager (android),
pick your preferredAVD, and edit it to give the path to your
newSDcard. Then start up the AVD.
Of course, right nowthere are no MP3s on the SDcard, so
youll get theNo MP3s on SDcard message if you try the
application out. To get an MP3 onto the card, use adb push:
adb push getready.mp3 /sdcard/
(Note that the emulator needs to be running for this to
work.) You can also use the DDMSfile explorer to add files,
but I find the command-line option quicker and more reliable.
Afurther testing note: choose MP3s which start quickly
and clearly, to make it easier to tell whether everythings
working as planned.
For a quick style
change of your
app, try using the
android:theme
attribute in the
application
element in
AndroidManifest.
xml. For a full list of
the available default
styles, check out
the R.style.html
documentation
page.
Quick
tip
Currently, theres no way of telling which song is currently
playing, nor any buttons to pause songs or move between
them. Lets set up three buttons (play/pause, next, and
previous), and a text box to showthe currently-playing MP3.
At this point it makes the layout job easier to switch froma
LinearLayout to a RelativeLayout in list.xml, but the rest of
the elements can remain as they are. Just add three buttons
and a TextView:
<Button android:id=@+id/playpause
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_alignParentBottom=true
android:text=@string/playpause_button />
<Button android:id=@+id/next
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_alignParentBottom=true
android:layout_toRightOf=@id/playpause
android:text=@string/next_button />
<Button android:id=@+id/prev
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_alignParentBottom=true
android:layout_toRightOf=@id/next
android:text=@string/prev_button />
<TextView android:id=@+id/currentmp3
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_above=@id/playpause
android:text= />
All the buttons are aligned with the bottomof the screen (the
layout_alignParentBottomattribute), and placed next
to one another (the layout_toRightOf attribute). The
TextViewis above the buttons, but we have to declare it last,
otherwise well get an error fromthe reference to @id/
playpause which must have already been declared to be
successfully referred to.
Onto the code. onCreate() calls a setupButtons()
method, to keep the code cleaner. All three buttons are set up
fairly similarly in setupButtons() method, so Ill just show
one of themhere (check the code on the DVDfor the others):
playpauseButton = (Button)this.findViewById(R.id.playpause);
playpauseButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mp.isPlaying()) {
pauseMp3();
} else {
playMp3(MEDIA_PATH + mp3List.get(currentPosition));
}
}
});
Again, much of the work with the buttons is done by the
interface. We pause or play the MP3 depending on whether
the MediaPlayer is currently playing or not. You could also
move this bit of the logic into a single playpause method, but
MediaPlayer states and lifecycle
Its important to be aware of what state
the MediaPlayer is in at any point,
because its current state has an effect
on what its next state can be.
It starts off in the Idle state (either
after creation, or after reset() is called),
and it finishes, after release() is called,
in the End state. Note that while there
are a bunch of methods you cant call
in the Idle state (these include
prepare() and start()), youll get a
slightly different sort of error message
if the MediaPlayer has just had reset()
called fromif its just been created.
Its important to call release() once
youre done, to let go of any resources.
114 LXF151 December 2011 www.linuxformat.com
Android
Android and audio metadata
Once again, theres a class to retrieve file
metadata for you, MediaMetadataRetriever.
However, note that its only available since API
level 10, ie 2.3.3/2.3.4, which is what were using
for this project. If you were releasing this into
the wild, youd want to make sure that there was
an alternative for earlier Android versions.
Replace the currentmp3.setText() line in
playMp3() with:
setTrackInfo(mp3Path);
and create this setTrackInfo() method:
private void setTrackInfo(String mp3Path) {
TextView currentmp3 = (TextView)this.
findViewById(R.id.currentmp3);
MediaMetadataRetriever metadata = new
MediaMetadataRetriever();
metadata.setDataSource(mp3Path);
String artist =
metadata.extractMetadata(MediaMetadataR
triever.METADATA_KEY_ARTIST);
String title =
metadata.extractMetadata(MediaMetadataRe
triever.METADATA_KEY_TITLE);
currentmp3.setText(title + - + artist);
metadata.release();
}
Again, this is largely pretty self-explanatory.
We set up our MediaMetadataRetriever, pass in
the path to the file (MediaMetadataRetriever
can also take various other sorts of data source,
such as a FileDescriptor or Uri), and fetch the
artist and title fromthe file metadata to set the
TextView. Once were done, we release the
retriever to avoid tying up resources
unnecessarily (bearing in mind that were
creating a newretriever for each newtrack; you
could instead keep the same one for the whole
lifetime of the app, and release it in the
onStop() method instead, but thats not really
necessary as its fairly lightweight and we only
use it in this one method).
This will of course fail if the file doesnt have
valid metadata (it will return null), so you could
consider including a fallback option if both track
and artist return null (the track title would be
the obvious option).
You could also use the getDuration() method
of MediaPlayer to get the duration of the file.
Note that it returns the duration in milliseconds,
so youll need to convert that into minutes and
seconds. java.util.concurrent.TimeUnit will do
this for you, but unfortunately it wont convert to
min:sec form instead it rounds down to the
nearest minute. Try this instead:
long durationMillis = mp.getDuration();
long durationSecs = TimeUnit.SECONDS.
convert(durationMillis,
TimeUnit.MILLISECONDS);
long durationMins = TimeUnit.MINUTES.
convert(durationMillis,
TimeUnit.MILLISECONDS);
String duration = durationMins + : +
(durationSecs - durationMins*60);
currentmp3.setText(title + - + artist + ( +
duration + ));
Note that its possible to use
mp.getDuration() because were calling
setTrackInfo() after the MediaPlayer has already
been prepared otherwise youd get an error.
it makes better sense to separate the methods, especially as
you may want to be able to call pause or play fromother
parts of the code.
We already have playMp3, but lets add a line to it before
the mp.start() line, to showthe name of the current song:
currentmp3.setText(mp3List.get(currentPosition));
Note that this shows the filename, not the MP3 tag, of the
song. See the boxout for information on getting metadata
froma media input file.
pauseMp3 is ridiculously straightforward:
private void pauseMp3() {
mp.pause();
}
The nextMp3() and prevMp3() methods are also pretty
straightforward, calling playMp3() with the newcurrent
position. Recompile and check it out; you should nowhave a
text field showing the current song (which will be empty
before youve started playing anything), and three buttons to
move backwards and forwards in the list (as well as being
able to select a song with the touchscreen).
One problemis that if you hit pause then play, the MP3 will
restart fromthe beginning rather than restarting fromwhere
you left off. This is straightforward to fix by adding a private
boolean variable pause. Rewrite the start of the try block in
playMp3() to look like this:
if (pause == false) {
mp.reset();
mp.setDataSource(mp3Path);
mp.prepare();
currentmp3.setText(mp3List.get(currentPosition));
}
mp.start();
pause = false;
and add a pause = true line to pauseMp3(). Youll also need
to add a pause = false line to prevMp3() and nextMp3(), or
hitting the previous/next buttons when the device is paused
will unpause the current song rather than starting the next
song. Thats it. (You could also consider adding astop button
if you want, using the mp.stop() method.)
Another issue is that when you exit the application, the
song carries on playing. If this were intentional, we should be
handling it properly, using a service and setting things up for
background process management. Next months tutorial will
cover this; for now, we need to implement onStop() to deal
properly with the resources. Its particularly important to do
this when using a resource-heavy class such as MediaPlayer,
otherwise you could find yourself running out of memory
and/or CPUand crashing the device. Happily, once again the
API makes it easy to clear up after yourself:
protected void onStop() {
mp.release();
mp = null;
super.onStop();
}
Note that if you dont call the superclass method youll get
a runtime error. This method releases the MediaPlayer; which
means that if you restart the app, youll need to create a new
one in the onResume() method:
protected void onResume() {
mp = new MediaPlayer();
updateMP3List();
super.onResume();
}
Updating the MP3 list isnt strictly necessary, but it means
that any newfiles added since the app last started will be
added to the list. However, if you try this out now, youll find
that the list doubles itself every time you restart the app,
since its not being cleared before updating. So add a single
line to the start of updateMP3List():
mp3List.clear();
Your app nowplays, pauses, and moves between songs;
and it deals properly with its resources when you quit it. In the
next tutorial, well look at howto run the player as a service,
meaning that it can continue in the background even if youre
no longer looking at the application; at using the built-in
MediaStore to fetch media files and information about them;
at registering a listener to deal with MediaPlayer errors; and
at streaming audio.
LXF
www.tuxradar.com December 2011 LXF151 115
Save35%
37.99 13 issues
Save50%
25.99 13 issues
Save35%
46.49 13 issues
Save40%
46.69 13 issues
Save33%
51.99 13 issues
Save25%
48.69 13 issues
Save35%
41.99 13 issues
Save50%
27.49 13 issues
54.99 13 issues
Save35%.
Z901
QuoteZ901
Back issues
The
#
1 sourcefor Linux
Missed one?
Quotetheissuecodeshownaboveand
haveyour credit or debit carddetailsready
In the magazine
Reach for the skies with
our hands-on guide to
building your own cloud,
plus the best Linux tools
for stargazing. We also
get a backstage pass
for Ubuntu and find all
the coolest free software
for smartphones.
Issue 149
October 2011
Product code:
LXFDB0149
LXFDVDhighlights
Two great desktop OSes:
Sabayon and PCLinuxOS.
The Electronic Frontier Foundation (EFF) is dedicated to the protection of citizens'
civil liberties in the digital world, and the creation of balanced laws that enable access to knowledge,
empower consumers, and foster technology innovation. EFF is an international civil society non-
governmental organization with more than 13,000 members in 67 countries.
EFF is a member-supported organization. Join Now! www.eff.org/donate
Defend Your
Digital Rights!
Issue 150
November 2011
Product code:
LXFDB0150
In the magazine
Discover howUbuntu
11.04s newUnity
desktop is going to
change the way you
work, plus Firefox 4s
best features, Googles
newgadget, and a
Roundup of the best
light windowmanagers.
Issue 146
July 2011
Product code:
LXFDB0146
LXFDVDhighlights
Ubuntu 11.04 megapack plus
Tiny Core and AtomicTanks.
In the magazine
Everything you need to
knowabout the first
major Gnome release
for eight years, plus four
of the best music
players put to the test
and the godfather of
GNURichard Stallman
talks free software.
Issue 145
June 2011
Product code:
LXFDB0145
LXFDVDhighlights
Gnome 3.0 plus Jolicloud 1.2,
Arch Linux and Red Eclipse.
In the magazine
The most popular
distros of the day go
head-to-head in a cage
fight for your affections,
plus we go behind the
scenes at Fedora, pick
the perfect geek
podcast and round-up
the top 25 Android apps.
Issue 147
August 2011
Product code:
LXFDB0147
LXFDVDhighlights
Fedora 15 and eight other distros,
plus games, tools and guides.
In the magazine
The 50 best apps for
your Linux system
chosen by you! Plus
we delve into the
wonderful world of Mint
and round up the very
best online backup
solutions. Oh, and Mike
says goodbye to LPI.
Issue 148
September 2011
Product code:
LXFDB0148
LXFDVDhighlights
All 50 apps squeezed onto one
CD, plus Linux Mint 11 and Mageia.
In the magazine
Build your own unique
version of Ubuntu,
SUSE and Fedora with
our DIYdistro guide,
plus the lowdown on
kernel 3.0, Mageia
unmasked and a brilliant
newgravity-controlling
puzzle game.
LXFDVDhighlights
CentOS 6 and Chakra Linux, plus
a sample alpha of Ubuntu 11.10.
This month we
answer questions on:
WHERE TO SEND YOUR QUESTIONS:
Write to Linux Format, Future Publishing, 30 Monmouth Street, Bath BA1 2BW
or send an email to lxf.answers@futurenet.co.uk.
Neil Bothwick
Having run a small ISP and
produced coverdiscs for Linux
Format, Neil describes himself
as a Linux Jack-of-all-trades.
Jonathan Roberts
Jonathans spent so much time
procrastinating fromstudy by
installing, configuring and
breaking servers that hes now
an expert.
Whatever your question, we can find an expert to answer it. Frominstallation and modemwoes to network
administrations, we will get the answer for you just fire off a letter or email and itll all be taken care of.
Our experts
Mike Saunders
Mike was one of the original
contributors to LXF prototype
Linux Answers. His specialisms are
programming, window managers,
init scripts and the SNES.
GrahamMorrison
When not reviewing mountains
of software and tinkering with
MythTV, Graham is on call to
answer any hardware and
virtualisation issues!
118 LXF151 December 2011 www.linuxformat.com
Got a question about open source? Whatever your level, email it to lxf.answers@futurenet.co.uk for a solution.
1
Getting to grips
with Grub
2
Making VoIP
calls with Ekiga
3
Hybrid RAID
setup
4
Newlife for old
floppies
5
Driver
dilemmas
6
MythTV

Network traffic
1
Grubby GUI
Q
Two of my four computers are dual
boot Linux/Windows machines.
Dual boot Linux installation on the
two newer machines is on hold. The reason
is Grub 2, the most well defended
improvement whose real usability by the
masses is hardly well discussed. Advice on
changing boot order is fine for the really tech
savvy, but not nearly as simple to followor
achieve success with as Grub 1 script editing
procedure. Im reluctant to revert to Grub 1
in case I screwup and lose dual booting
altogether where I have it.
The two older dual boot machines still
have Grub 2. I have failed to amend the
boot order following instructions from
various sources applicable to Ubuntu
installations. What it most needs is a simple
GUI to give me consistent direct working
control of boot order, and in
one fell swoop get rid of all
the redundant kernels which
are added by updates.
Keith Kimber
A
Neither Grub 1 or 2 is
really intended for
use by the masses. It
is supposed to be something
that is set up by the system
and left to get on with its job.
In this respect, Grub 2 is an
improvement because of the
way it lends itself to easy
scripting, plus the simplicity
of update-grub to
automatically add newkernels
with the same default options
as used by the existing ones.
When we mere users try to get involved in
its configuration, things can look a little more
complex, but that is mainly because the
location of just about everything has changed,
and not always in the most obvious of ways.
For example, to get rid of all the old kernels
fromthe menu, you just go into Synaptic and
uninstall them(after all, theres no point in
removing themfromthe boot menu but
leaving themon your disk). Uninstalling (or
installing) a kernel package causes update-
grub to be run, which rebuilds the menu with
only the available kernels included. In this
respect, Grub 2 does exactly what it should:
takes care of the boot menu without the need
for any user intervention.
When it comes to changing the boot order,
that is also relatively simple, but different. The
menu is built by update-grub, which runs the
scripts in /etc/grub.d. These are run in order,
so 30_os-prober, which adds non-Linux
(mainly Windows) installations to the menu, is
run after 10_linux. You can change the overall
menu order by renumbering these files, or
add extra entries at any point in between
these entries. You can also disable individual
scripts by unsetting the executable bit on
them, for example:
sudo chmod -x /etc/grub.d/30_os-prober
An important script in here is 40_custom,
which is where you can add your own entries
that will be copied straight to the Grub menu
with no processing. The default name puts
themat the end of the menu but you could
rename the file to 08_customto place your
entries at the top.
You can also alter the kernel options used
for each kernel found by the 10_linux script by
editing /etc/default/grub and changing the
options in GRUB_CMDLINE_LINUX_
DEFAULT. There are various other settings you
can change in this file. After making any of
these changes you need to run:
sudo update-grub
I knowyou asked for a GUI for doing this,
but it helps to understand the mechanism
behind the system. There is a GUI for
controlling some of the settings in Grub 2,
called StartUp-Manager. Install
startupmanager fromSynaptic in the
usual way, it is in the standard Ubuntu
Grub 2 is not so much difficult as different, but StartUp-
Manager gives it a friendly face.
www.tuxradar.com December 2011 LXF151 119
W
in!
AKodak
digital camera
Format reader who writes what they judge to
be the best letter related to system
administration. This month, the prize is the
Kodak Easyshare M320 digital camera.
The 9.2-megapixel Easyshare M320 has
a 3x optical zoomlens, enabling you to get
up close for tight portraits or pan out for
wide outdoor shots. It has a 2.7-inch LCD
screen and 21 different scene modes, with
settings to suit a variety of compositions.
There are three flash modes, 16MBof
internal memory, USBandAVconnectivity
and the camera includes Kodaks Easyshare
photo editing software. So, what are you
waiting for? If youd like a chance to win,
email your sysadmin question to Rackspace
at sysadminqa@rackspace.co.uk.
See page 120 for Rackspaces star letter.
Linux Format
Sysadmin Answers
with Rackspace
Hosting. Rackspace Hosting is the worlds
leader in hosting. Since 2001, Rackspace
has been hosting and supporting mission
critical websites, internet applications,
email servers, security and storage services
for 6,000 customers. Rackspace is totally
focused and experienced in managing
hosting solutions and helping customers
forget about their online infrastructure
through providing Fanatical Support for
their hosted applications. For more
information, visit www.rackspace.co.uk and
ask any questions.
Because Rackspace are such nice fellows,
every month they award a prize to the Linux
Enter our competition
withRackspaceManagedHostingwww.rackspace.co.uk
Answers
that you need a VoIPgateway service. These
route calls between the SIPnetwork and the
standard telephone service, and you pay for
this service. However, the cost can be
significantly lower than your standard
telephone provider, particularly for
international calls. This is because the call is
routed over the internet to a gateway close to
the number you are calling, so only the last
part of the call uses the more expensive POTS
(Plain OldTelephone System) service.
Ekiga.net is one of many organisations
that provides this service use your favourite
search engine to find a suitable VoIPprovider in
your area. You dont say where you are,
although the headers of your email indicate
North Carolina, USA, where you should be able
to find plenty of providers.
Incidentally, there are not as many VoIP
providers as a web search may suggest; some
companies operate under several different
names for different markets.
There is a however (isnt there always?).
While the SIPproviders do not charge for
routing calls over the internet, you mention
that you pay data charges. This would mean
you incurring data costs, which may be more
than the cost of a standard phone call.
You would certainly need to set your
softphone to use a lowbandwidth codec.
Codecs are enabled in the Audio > Codecs
section of the Preferences window. Pick only
the 8kHz codecs, and put the more efficient
ones, such as Speex, at the top of the list.
Video is possible over SIP, and both Ekiga
and Ekiga.net support this, but this will use
even more bandwidth. That affects cost, but if
your bandwidth is limited, it may also make
video calling unusable.
To use our forums, point your browser at
www.linuxformat.com, click on the Forums
link and start reading. You can read as a guest,
but you will have to register an account to post
click the Register link near the top of the
Forums home page. This is unfortunately
necessary to help keep the level of spamon the
forums at its extremely lowlevels. GM
3
Lopsided RAID
Q
Imin the process of building a new
desktop PC. The disks are 2 x 55GB
SSDs and a 128GB SSD. Ill be using
both 55GB disks as a RAID 0 device but then
want this combined into a RAID 1 setup with
the 128GB disk.
My problemis, Ive already installed the
systemto the largest drive, which prevents
me fromadding it to the RAID 1 setup.
Theoretically I could start again, but as I
needed a newkernel (3.0.1 actually) for the
network to be recognised, Id rather not start
again as it was a royal PITAto set up without
network connectivity.
The thing Immost worried about is
booting. Ideally Id like to boot fromthe RAID
0 device, as these are the fastest (the 128GB
drive is an SATASSD, the RAID 0 device
comprises of 2 PCIe SSDs) but Imforced to
use Grub 2 (which I dislike greatly) so
manually changing stuff by editing the
appropriate file is a no-no.
Dutch_Master
A
What you are proposing is unusual, a
hybrid of RAID1 and RAID0+1, but
possible. If you try to do this at disk
level, you will lose some space. You will have
one 110GBdevice (the RAID0 array) and one
128GBdevice, so the resulting RAID1 will be
the size of the smallest device, 110GB. You can
get around this by creating the RAIDat the
partition level and using the leftover 18GB
outside of the RAID, say for swap (which would
repositories. One of the options in StartUp-
Manager is to create a rescue disk, which is a
useful safeguard against the possibility of a
screwup, which, incidentally, is easier to
achieve with Grub 1 as you are editing the
menu files directly. NB
2
Ekiga VoIP services
Q
Ive just discovered that Ekiga has a
website that provides free SIP
addresses that can be used with the
free softphone software. Can you tell me if I
need anything else to make VoIP calls, other
than an internet service provider? Will this
provide free national and international calls?
Does it handle video?
I have limited internet access and would
appreciate not having to trawl through
megabytes of data at rather high charges.
Also, would you mind explaining howto use
your LXF forums?
Daryl
A
An Ekiga.net account and address, in
common with most other SIP
providers, gives you free calls to and
fromother SIPaddresses (that is, internet
phone numbers/addresses such as those
provided by Ekiga.net). This is regardless of
location, so in that respect international calls
are free.
What it does not do is provide the means to
call standard landline or cellular numbers. For
Using a softphone over a slow connection?
Make sure it uses lower-bandwidth codecs.
120 LXF151 December 2011 www.linuxformat.com
then mean you can use tmpfs for /tmp,
speeding things up further). Grub 2 does allow
booting fromRAIDdevices, just ensure that
your grub.cfg contains insmod raid and you
can address devices like this:
set root=(md0)
However, as you already have extra space
on the larger device, it may be simpler to put
your boot partition on here. 50MBshould be
plenty of space and it wont eat far into your
18GBof swap space.
Copy the contents of /boot fromthe root
partition on here and modify /etc/fstab to
include a line for /boot youll probably want
to add noauto or ro to the options as there is
no reason to mount /boot read/write in
normal usage. Nowyou just need to set up the
arrays, using mdadm. Well assume that the
128GBdrive is /dev/sda, with all your
systemon /dev/sda1 (no separate home
partition, if you have one, repeat the process
for that). The two 55GBdrives are used as
sdb1 and sdc1. Needless to say, all of this has
to be done as root, whether you use su or sudo
is up to you and your distro. First create the
RAID0 array with:
mdadm --create /dev/md0 --raid-devices=2
--level=0 /dev/sdb1 /dev/sdc1
Nowcreate the RAID1 array based on your
existing installation, but do not add the smaller
devices yet:
mdadm --create /dev/md1 --raid-devices=2
--level=1 /dev/sda1 missing
This creates a degraded RAID1 array with
two devices, one of which is missing. Doing it
this way makes sure the data on /dev/sda1 is
used for the array contents. Nowadd the RAID
0 array to this with:
mdadm /dev/md1 --add /dev/md0
The data on sda1 will be synced across to
md0, which can take some time. The system
can be used as normal while this happens,
though you may see a slight reduction in
performance. You can monitor the progress of
the operation with:
cat /proc/mdstat
Thisshows howfar it has progressed and gives
an estimate of howlong is remaining.
Even if this process is interrupted by a
reboot, the rebuild should resume after, but it is
probably best to not test this if you can avoid it.
All that remains is to edit /etc/fstab to use
/dev/md1 in place of /dev/sda1, run update-
grub and you can reboot. You can also
manually set up menu entries for Grub 2 by
adding themto /etc/grub.d/40_custom. NB
4
Stone tablets, not quite
Q
Time has caught up with me. Years
ago I carefully backed up my source
code for every programI wrote on
the most modern equipment at the time.
And nowmy PC does not even support
floppy and stiffy drives in its BIOS! You know,
those plastic foil disks covered with
magnetite that spin around and around?
Is there any way that I can recover those
backups froma modern PC using Linux?
Can one bypass BIOS, or substitute the BIOS
functions with a program? I knowwhere to
find an ancient computer with an ancient
BIOS and ancient floppy readers at the local
university, but it is inconvenient for me to
get to it. The equipment may get out of date,
but the algorithms do not!
Stephen van der Walt
A
Storage formats going out of date has
been an ongoing problemsince
papyrus scrolls, although one that is
less significant in these days of cloud storage.
If the ancient computer you have access to
is not so ancient as to be unable to connect to
the internet, you could read the files on this
and upload themto a file sharing service (or
even email themto yourself).
Dropbox (www.dropbox.com) may be
closed source, but it is a free service if you want
to store less than 2GB(I cant imagine the size
of a pile of floppies containing that much data).
Files can be shared using a dedicated client, or
Star
Question
Prioritising network traffic
Q
Ive set up my own home network
for my family and the usage is quite
basic, but as I like to tinker, I
sometimes try newthings. I like to keep my
wireless network open for political and other
reasons. I can encrypt the traffic between
my laptop and my home router using IPsec.
Ive been thinking about the best way to
prioritise network traffic. I can recognise
high priority devices (my home computers)
by giving themknown IP addresses with
DHCP. Ive read about qdisc but it sounds
very complicated. What is your preferred
way for giving some of my network users (ie
my neighbour) and certain traffic low
priority? Imrunning Arch on my router.
Juho Rutila
A
First of all, running an open wireless
network is generally a really bad idea.
Its not just about people using your
bandwidth, but in most countries you are
responsible for securing your network and if
This months winner is Juho Rutila. Get in touch with us to claimyour new camera! Winner!
you do not take reasonable steps, you could be
held liable for any laws that are broken by
someone using your network.
Secondly, while you have secured your
laptops traffic, anyone else using your network
could be transferring all sorts of sensitive
information in the open. It would be far safer to
set your router to useWPAencryption and let
anyone you want to use it knowthe passphrase.
Of course, you still want to be able to
prioritise traffic, using traffic shaping and qdisc.
As you point out, this is a fairly complex topic,
but there are programs that simplify it. You
dont mention what software you are currently
using on the router, but Shorewall is a popular
choice for firewalls and routing, and it also
supports traffic shaping in a reasonably simple
manner. To turn it on, edit /etc/shorewall.conf
and set TC_ENABLED=Simple, the default
setting is Internal. Add a line for your external
interface to /etc/shorewall/tcinterfaces:
eth0 external 5mbit
This example sets up eth0as the external
interface with a bandwidth limit of 5Mbps this
should be lower than your total upstream
bandwidth. The man page lists the options
for specifying speed, but make sure there is
no space between the number and unit.
Nowyou can add shaping rules to
/etc/shorewall/tcpri. There are three
bands; 1, 2 and 3, that roughly correspond to
high, mediumand lowpriority. You can add
rules for IPaddresses, ports or programs.
For example:
#BAND PROTO PORT ADDRESS
1 - - 192.168.1.2
2 udp 53
3 ipp2p:all bit
gives high priority to all traffic fromone IP
address, a good priority to UDPtraffic on
port 53 (DNS requests) and the lowest
priority to BitTorrent traffic.
This is a complex topic, far more than
there is space for here, but Shorewall makes
using qdisc that much more accessible.
However, you will still need to spend some
time reading the documentation and
tweaking your settings. NB
Answers
Dropbox, and similar services, provides an
easy way to transfer files between computers
with incompatible storage hardware.
www.tuxradar.com December 2011 LXF151 121
for use by technical Linux developers, and
recommended instead obtaining a pre-
compiled package fromones Linux
distributor which Id already discovered
was not available.
I then found www.driversdown.com/
drivers/11010.shtml had what appeared
to be the appropriate Intel Extreme
Graphics Driver 20040607 Linux, but when I
tried to download it, the first itemto be
downloaded was its installer, and as this was
a DOS/Windows executable file it,
unsurprisingly, gave rise to an error message
and refused to download.
Edward Reading
A
The date of the driver from
driversdown.comshould be enough
to put you off. The XWindowSystem
has gone through several major updates in the
5
Intel downside
Q
My second computer
is a Compaq EVO
D510 SFF, which has
a 2.0GHz Pentium4
processor, Intel 845G chipset,
1GB of PC2100 memory and a
CTX19-inch CRT monitor. I
have been very happy with
Fedora 12 on this machine.
When I updated my main
machine to Ubuntu 11.04, I
found that I did not get on
with the Unity user interface
though I amnowcoming to
terms with that and thought
I would update my second
machine to Fedora 15 and see
howI got on with its Gnome 3
user interface.
The Fedora installer flatly refused to
install, with a message saying, in effect, that
the machine was not up to running Fedora
15. I found this very surprising, but decided
to try something less demanding and so
installed Xubuntu.
This set my monitors resolution to an
unacceptable 1600x1200, with no means of
changing it. I realised that the trouble was
probably with the graphics driver, but by this
time LXF148 had arrived with Linux Mint 11
on its DVD, so I gave up on Xubuntu and
installed Mint 11 instead. The same trouble
with the display resolution recurred.
I found a Linux driver for the 845G
chipset at www.intellinuxgaphics.org, but
the site warns that its drivers are intended
simply uploaded via the web. Once stored in
your Dropbox, the easiest way to get them
back on your computer is with their own client,
which uses Gnome and is probably available in
your distros repositories.
If you use KDE, there is Kfilebox (http://
kdropbox.deuteros.es) which gives an applet
in the KDE systemtray and syncs a local folder
with the Dropbox service (as does the
equivalent applet for Gnome).
The alternative is to add a floppy drive to
your computer. Yes, I knowyou said your BIOS
no longer supports floppy drives, but that
applies to the traditional 34-pin motherboard
interface. You will be able to use an external
floppy drive that connects via USB. These are
not expensive they are available for less
than 10 here in the UK. Being external they
can be used with more than one computer.
Plug the drive into your computer, put a disk in
the drive and your desktops automounter
should recognise and mount it for you. Then
you can copy the files off and unmount the
disk before ejecting it.
The latter option means that you will be
able to access floppy disks whenever you want,
but please get your source code off themand
somewhere safe as soon as possible. Floppy
disks were notoriously unreliable when new,
the ones you have noware the computing
equivalent of stone tablets but not as
durable. Put your data somewhere safe,
preferably in more than one location. There are
plenty of free or reasonably priced online
storage services, or you could mail the files as
attachments to a webmail account. JR
Why do we have to have so
many different partitions and
filesystems on a Linux system?
Ahard disk is divided into
partitions separate sections
that each act as though they
were a disk. Each partition then
uses a filesystemto store data on
that partition.
Why does Linux use more than
one? Windows doesnt!
Keeping different types of data
separate can improve
performance and security.
Keeping swap data on a dedicated
filesystemis more efficient than
keeping it inside a file inside a
directory on the filesystemof your
root partition. Arogue process can
mess up swap, but it wont touch
anything else.
So swap and a root partition,
like Ubuntu uses, is sufficient?
Sufficient, yes, but not optimal. At
the very least, a desktop system
(and that includes laptops) should
use a separate partition for the
home directory. That keeps your
personal settings and data
separate fromthe operating
systemfiles.
Why would I want to do that?
At some time, you will want to try
a different distro, or install a later
version of your existing distro. If
everything is in the root partition,
it will all be wiped by the
installation and you would have to
back up all your settings and files
to an external drive before you
could install. With a separate
home partition, a well-behaved
installer will leave your data intact.
After the installation, you can boot
the machine and start using it just
as you did with the old setup.
Are there any other partitions I
should have?
For a server, a separate
filesystemfor /var is definitely a
good idea. It is also useful for
desktops as a runway process
filling up the systemlogfiles, kept
in /var/log, wont use up all the
disk space used by the operating
systemfiles.
There are so many types of
filesystem why do we need
ext2, ext3, reiserfs, XFS, jfs and
the rest?
Each filesystemhas its own
strengths and weaknesses. Ext2 is
the original Linux filesystemand is
very fast but doesnt handle
sudden shutdowns very well.
Ext3 is a journalled filesystem,
as are the others, which means
that recovery in the event of a
crash or power failure is faster
and more reliable, at the expense
of a small performance hit.
Reiserfs is particularly good with
small files, both in efficient use of
space and speed. XFS is
particularly fast with large files but
it handles power failures poorly so
is best on something with battery
backup. Ext4 combines many of
the advantages of other
filesystems, and Btrfs is newbut
promises much more.
Which is best?
Thats like asking whether Vi is
better than Emacs or KDE better
than Gnome, so Ill pass on that
one, thank you.
Answers
When running a channel scan in MythTV, make sure the
scan frequencies are set to the correct range.
Frequently asked questions
Partitionsandlesystems
122 LXF151 December 2011 www.linuxformat.com
ran a terminal scan using:
scan -x0 /usr/share/dvb/dvb-s/Astra-28.2E |
tee.channels.conf
which appears to scan my card, but when I
tried to set up MythTV I could not get my
card to scan for channels. Could you tell me
what the settings should be on the video
source and the scan configuration, and
should I be using the DiSEqC button?
Greg Sabin
A
The dmesg dumps you provided
indicate that the card works, as does
your ability to use the scan utility to
get a channel listing (assuming channels.conf
does contain a list of channels after running it).
When you used scan, you explicitly told it
which satellite you were using, so it knows
which set of frequencies to scan. If you did not
set this in mythtv-setup, that programwill
have scanned the wrong frequency band, which
would explain its failure to find any channels.
In the General Settings section of mythtv-
setup, make sure you set bothTVformat and
Channel frequency table to the correct values.
When you set up your input connections,
check that the frequency settings in here
match your satellite.
The screenshot you supplied of this
showed a different frequency than any of
those listed in the data file you used for the
manual scan. If you read this data file its
plain text you can see a line for each
transponder on each satellite. The first
number on that line is the frequency, followed
by the polarity (Hor V) and the symbol rate.
Tweak your settings in the Scan Configuration
windowto match, and a scan should find all
available channels.
You do not need DiSEqC, unless you have
multiple or movable satellite dishes. Digital
Satellite Equipment Control is used to control
multi-dish switches and dish rotors, two
methods used to receive frommultiple
satellites. GM
However, the list of supported drivers includes
the Intel driver. Not only that, but the installer
should fall back to a compatible alternative if a
suitable 3Dcard is not detected. This is what
happens when installing into a virtual machine
that certainly does not have 3D. So this may
not be the true cause of the failure to install
Fedora 15. If the lack of 3Dis the problem,
there is an option when booting fromthe
DVDto use a basic video driver. This will
disable 3D, and the full Gnome 3 experience,
but will get you a working desktop. Fromthere
you can set up the Intel driver, as above, and
then try switching to the full Gnome 3 at the
login screen. JR
6
Missing channels
Q
I amtrying to set up MythTV on
Mint 11.04. My TBS 6920 card is
recognised after loading the
firmware, and, after looking at an article on
the net, I installed dvb-apps and mplayer and
past seven years and a driver from2004 is
unlikely to be trouble free. Those updates
include a graphics driver for the 845Gchipset,
calledi810 in some X.org releases and plain
intel in more recent ones.
The installers, or X.org itself, should detect
the hardware and load the correct driver. As it
does not, you can force X.org to write a
configuration file by running:
sudo X -configure
at a command prompt. This will write a
configuration file at /root/xorg.conf.new. You
can test that this works by running:
sudo X -config /root/xorg.conf.new
Note that on some installations, the
command may be Xorg rather than X. If it
works and opens a screen, dont expect much
more. You can make the change permanent by
moving the file to /etc/X11/xorg.conf:
sudo mv /root/xorg.conf.new /etc/X11/xorg.conf
Fedora uses Gnome 3, which requires a
graphics card and driver with 3Dacceleration.
I
ts quite simple to modify an existing
kernel setup but configuring it from
scratch is a little more complex. First,
make sure you have the right kernel source
package installed the one that matches your
existing kernel is the place to start. You also
need the GCCcompiler and friends, many
distros have a package like build-essentials
that installs all you need. Open a root terminal
(or run sudo bash on Ubuntu) and run:
cd /usr/src/linux
make menuconfig
Youll want to enlarge your terminal
window, as this opens the kernel config
programwith gazillions of options. The kernel
source package should include a config file
containing the same options used to build
your current kernel, so you only need to find
what to change. If not, it will be saved in
/boot. Copy it to /usr/src/linux/.config.
Press / to bring up the search box and type in
the name of the itemyou need. This shows
you the route to it, so exit and use the cursor
keys and Enter to find it, then press Space to
select it. Repeat for any other options then
followthe exit signs, saving when asked.
Nowcompile and install the kernel with:
make all modules_install install
This builds everything, installs the kernel
modules then copies the kernel itself to
/boot. It also sets up symlinks for the current
kernel fromvmlinuz and the previous one
fromvmlinuz.old. So if your Grub menu
contains options to boot these two kernels,
there is nothing to change and you always
have a fallback option. Nowreboot and award
yourself 100 Geek points for compiling your
first kernel, 200 if it boots first time. In case of
problems, boot the old kernel and revisit the
options you changed.
Help us to help you
We receive several questions each month that we are
unable to answer, because they give insufficient detail
about the problem. In order to give the best answers to
your questions, we need to knowas much as possible.
If you get an error message, please tell us the exact
message and precisely what you did to invoke it. If
you have a hardware problem, let us knowabout the
hardware. If Linux is already running, you can use the
excellent Hardinfo program(http://hardinfo.berlios.
de/) that gives a full report on your hardware and system.
The report is an HTMLfile which you can attach to your
mail. Alternatively, the output fromlshw(http://ezix.
org/project/wiki/HardwareLiSter) is just as useful. One
or both of these should be in your distros repositories.
If you are unwilling, or unable, to install these, run the
following commands in a root terminal and attach the
system.txt file to your email. This will still be a great help
in diagnosing your problem.
uname -a >system.txt
lspci >>system.txt
lspci -vv >>system.txt
We often give a solution as commands to type
in a terminal. While it is usually possible to do
the same with a distros graphical tools, the
differences between these mean that such
solutions are very specific. The terminal
commands are more flexible and, most
importantly, can be used with all distributions.
Systemconfiguration commands often
have to be run as the superuser, often called
root. There are two main ways of doing this,
depending on your distro. Many, especially
Ubuntu and its derivatives, prefix the command
with sudo, which asks for the user password
and sets up root privileges for the duration of
the command only.
Other distros use su, which requires the
root password and gives full root access until
you type logout. If your distro uses su, run this
once and then run any given commands
without the preceding sudo.
Terminals and superusers
Answers
A quick reference to...
Recompiling your kernel
www.tuxradar.com December 2011 LXF151 123
Q
Ive just bought an Android tablet,
and already have an Android
phone. I used to copy music and
video files manually from my computer to
the phone, but with two devices (three if
you count the computer) its getting a bit
cumbersome. Is there an easier way to
keep the three devices in sync?
Simon Harris
A
You could use a cloud service and
sync each of your devices with that,
but this can be both slowand
expensive if you have several gigabytes of
data. It is also rather inefficient sending
everything via a server on another continent
when the devices are in the same room.
BotSync is one possibility; it is free and
uses SFTP, the file transfer protocol of SSH.
As you already have SSHinstalled, there is no
setup to be done on your computer beyond
making sure the SSHservice is set to start
when you boot. On eachAndroid device,
install BotSync, press Config and give it the
hostname, port (default is 22), username and
password of your computer. Tell it the paths
to use on the device and your computer,
select Upload (Android to computer) or
Download (computer toAndroid) and tell it
howoften to sync. Exit the config screen and
press Start. BotSync should connect to your
computer and transfer the files (obviously,
both computers should be connected to your
network for this to work). Repeat the process
for the other computer.
BotSync works, is free, and is simple to set
up but quite limited. Syncing is one-way only
and while newfiles are copied, files deleted on
the other computer are not removed. Amore
sophisticated alternative is FolderSync, which
works with various cloud services as well as
SFTP. This is not free, except for the Lite
version, but it does much more. Go into
Accounts and create a newaccount of type
SFTP, using the same information as above. In
FolderPairs, set up Remote (computer) and
Local Folders to Sync but leave Scheduled
Sync off until you have tested this. The Sync
Type sets the direction of the syncing you
probably want To Local for the first sync to get
everything fromyour computer to the device.
Save the settings then click the arrowto
the right of the name to start a manual sync.
ClickViewLog to see its progress. Once it all
works as you want, you can set up scheduled
syncing. If you want to sync on a local wireless
connection and over 3Gwhen out, youll need
to set up two separate accounts and folder
pairs, because the server name will be
different when accessing it fromoutside of
your LAN. If your ISPgives you a dynamic IP
address, youll also need a hostname with a
service such as dyndns.orgto be able to
contact your computer.
Once youve set up one of your Android
devices, replicate the setup on the other and
you effectively have your own personal cloud
in the comfort of your home.
If you dont like the idea of storing your
login details on a portable device, use
ConnectBot to create an SSHkey pair and put
the public key in the .ssh/authorized_keys
file on your computer. JR
LXF
The Big Question Droid syncing
1
Set up BotSync
BotSync is simplicity itself. Tell it what path
to backup, where to and howoften (in secs).
Tell it your login details and off it goes.
4
Account setup
An account contains details of howto
connect to a particular server or service,
were using a local SFTP (SSH) server here.
2
Press Start to start
A Start button that does what it says!
BotSync will upload newand changed files
then wait until it is time to run again.
5
Create a Folderpair
This is a sync job, consisting of source and
destination folders, an account to use and
options for when the sync will be performed.
3
Starting FolderSync
Plenty of choices here, but the first two
buttons cover all the main options of setting
up one or more sync jobs.
6
Avoid passwords
Instead of storing your password, use
ConnectBot to create an SSHpair and use
themfor login, just as with normal SSH.
Answers
Step-by-step: Setting up BotSync and FolderSync
124 LXF151 December 2011 www.linuxformat.com
L
X
F
1
5
2
w
ill
b
e
o
n
s
a
le
T
h
u
r
s
d
a
y
1
0
N
o
v
e
m
b
e
r
2
0
1
1
Next month
The
#
1 sourcefor Linux
Contents of future issues subject to change we might be discovering newsubatomic particles.
Women in FOSS
WithdoubletheXs intheir chromosomes, women
shouldloveLinuxtwiceas muchas men. Right?
PHPreturns
After agapof several years wereturntothelanguage
that put thePinLAMP. Well, oneof themanyway.
Forget talkof newparadigms andsynergised
workowswejust want tondout whichoneisbest.
Desktop
showdown
FuturePublishingLtd, 30MonmouthStreet,
BathBA1 2BWTel 01225442244
Email linuxformat@futurenet.com
24,487 JanuaryDecember 2010
Amember of theAuditedBureauof Circulations.
EDITORIAL
Editor GrahamMorrison
graham.morrison@futurenet.com
Deputy editor AndrewGregory
andrew.gregory@futurenet.com
Promotions andcommunities editor MikeSaunders
mike.saunders@futurenet.com
Staff writer JonathanRoberts
jonathan.roberts@futurenet.com
Art editor EfrainHernandez-Mendoza
efrain.hernandez-mendoza@futurenet.com
Production editor AndreaBall
Editorial contributorsNeil Bothwick, ChrisBrown,
DavidCartwright, AlexCox, DaveCross, BenEverard,
Juliet Kemp, SusanLinton, JamesLitton, Michael Meeks,
BobMoss, AdamOxford, LesPounder, SimonQuain,
MayankSharma, ShashankSharma, NickVeitch.
Art assistance Carlton Hibbert, Stacey Black.
IllustrationsShaneCollinge, EllyWaltonIllustrations,
iStockphoto, SimonMiddleweek, Aka
ADVERTISINGSALES
Advertising sales director Nick Weatherall
0207042 4155 nick.weatherall@futurenet.com
Account sales manager RicardoSidoli
02070424124rsidoli@futurenet.co.uk
MANAGERIAL &MARKETING
Brandmanager Daniel Bruce
Campaign manager SharonCopeland
Promotions executive RosieDedman
Publishing director Stuart Anderton
UKchief operating officer MarkWood
PRODUCTIONANDDISTRIBUTION
Production coordinator CraigBroadbridge
Trade marketing manager Stuart Brown
DistributedbySeymour DistributionLtd, 2East Poultry
Avenue, LondonEC1A9PTTel 02074294000
Overseas distribution by FuturePublishingLtd
Tel +44(0)1225442244
LICENSING
Headof international licensingTimHudson
thudson@futurenet.co.ukTel +44(0)1225788253
CIRCULATION
International account manager JohnLawton
john.lawton@futurenet.com
SUBSCRIPTIONS &BACKISSUES
UKreaders order line08448482852
General UKenquiries08448481602
Overseas readers+44(0)1604251045
Online enquirieswww.myfavouritemagazines.co.uk
Email linuxformatdvd1@subscription.co.uk
LINUXisatrademarkof LinusTorvalds, GNU/Linuxisabbreviatedto
Linuxthroughout for brevity. All other trademarksarethepropertyof
their respectiveowners. All thecodeprintedinthismagazineislicensed
under theGNUGPLv2or later. Seewww.gnu.org/copyleft/gpl.html.
Copyright Nopart of thispublicationmaybereproducedwithout writtenpermissionfrom
our publisher. Weassumeall letterssent byemail, faxor post arefor publicationunless
otherwisestated, andreservetheright toedit contributions. All contributionstoLinux
Format aresubmittedandacceptedonthebasisof non-exclusiveworldwidelicenceto
publishor licenseotherstodosounlessotherwiseagreedinadvanceinwriting. Linux
Format recognisesall copyrightsinthisissue. Wherepossible, wehaveacknowledgedthe
copyright holder. Contact usif wehavent creditedyour copyright andwewill always
correct anyoversight. Wecannot beheldresponsiblefor mistakesor misprints.
All DVDdemosandreader submissionsaresuppliedtousontheassumptiontheycan
beincorporatedintoafuturecovermountedDVD, unlessstatedtothecontrary.
Disclaimer All tipsinthismagazineareusedat your ownrisk. Weaccept noliabilityfor
anylossof dataor damagetoyour computer, peripheralsor softwarethroughtheuse
of anytipsor advice.
PrintedintheUKbyWilliamGibbons.
FuturePublishingLtd2011
Future Publishing Ltdis part of Future plc.
Futureproducescarefullytargetedmagazines, websitesand
eventsfor peoplewithapassion. Wepublishmorethan180
magazines, websitesandeventsandweexport or license
our publicationsto90countriesacrosstheworld. Futureplc
isapubliccompanyquotedontheLondonStockExchange
(symbol: FUTR),
www.futureplc.com
Non-executive chairmanPeter AllenChief executiveStevieSpring
Groupfinance director JohnBowmanTel +44(0)1225442244www.futureplc.com
ATLANTA BATH LONDON NEWYORK PARIS SANDIEGO SANFRANCISCO
audible co uk
An Amazon company
Audible 14 Day Free Trial Details
Get your rst 14 days of our one book a month plan for free, and well give you a free audiobook of your choice. You will not be charged during your free trial period and even if you decide to cancel you can still
keep your free download. After your 14 day trial, your membership will renew each month for just 7.99 per month so you can continue to receive one audiobook credit per month plus members-only discounts on
all audio purchases. No commitment, you can cancel your membership at anytime. Any unused audiobook credits will be lost at cancellation. *One free trial per person - sorry, if youve had a free trial from Audible
before, you are not eligible for this offer. However, follow the link here to nd out about special discounted membership offers on-site.
Experience Audible yourself by starting your 14-Day FREEtrial today!
Go to audible.co.uk/tech to sign up for a 14-Day free trial
and get a FREE digital audiobook from a selection of over 50,000 titles.
www.audible.co.uk/tech
Your free trial is no-commitment, and your free audiobook is yours to keep,
whether you decide to stay on to become an Audible member or not.
FREE Audiobook
for every reader
*
126 LXF151 December 2011 www.linuxformat.com
Important
NOTICE!
digital forensics that is, examining
the contents of a Windows machine
after it has suffered a major security
failure. (Of course, many of its tools will
work on Linux machines as well, but we
all knowthat Linux boxes very rarely get
hacked/cracked in comparison!)
To use it, burn the ISOimage in the
Distros/CAINE section of the LXFDVD
to a CD-Rand boot it up. Note that you
need to burn it as a direct ISOimage;
you cant just copy the .iso onto a CD-R
like its a normal file. If youre unsure
howto do this, consult your disc
T
hanks to live distros, Linux is
without doubt the greatest
systemrecovery platformever
made. Over the years, weve read
countless stories of Linux users whove
been contacted by friends or relatives
in despair, because their Windows
machine has stopped working properly.
The Linux fan pops over, live CDin
hand, retrieves important data fromthe
errant machine and fixes problems.
Linux 1, Windows 0.
CAINE (the Computer Aided
INvestigative Environment) takes this to
the next level, and focuses entirely on
burning softwares documentation.
After it has booted up, if you end up at
a plain text prompt, just enter startx
to load the graphical interface. There
you can explore the provided software
by clicking the menu button in the
bottom-left and going to the Forensic
Tools submenu.
You can see that there are programs
for mounting drives, recovering data,
testing disk partitions and so forth. But
theres another app that bundles the
functionality of many of these together,
and thats accessible via the Caine
Interface icon on the desktop. Theres
also a manual on the desktop double-
click to open it, and take note of the List
Of Tools link on the right-hand side to
see what you can use. For more
information on the distro, see its
homepage at www.caine-live.net.
Before you put the DVD in your drive, please
make sure you read, understand and agree to
the following:
The Linux Format DVDs are thoroughly tested for all
known viruses, and are independently certified virus-
free before duplication. We recommend that you always
run a reliable and up-to-date virus checking programon
any newsoftware.
While every care is taken in the selection, testing
and installation of DVDsoftware, Future Publishing can
accept no responsibility for disruption and/or loss to
your data or your computer systemthat may occur
while using this disc, the programs or the data on it.
You are strongly advised to have up-to-date, verified
backups of all your important files.
Please read individual licences for terms of use.
Defective discs
In the unlikely event of your Linux Format coverdisc being
in any way defective, please visit our support site at
www.linuxformat.com/dvdsupport for further
assistance. If you would prefer to talk to a member of our
reader support team, telephone +44 (0) 1225 822743.
CAINE 2.5
Linux distribution
Distros, apps, games, podcasts and more...
On the disc
R
ead on for all the info you need to use the
LXFDVD! If youre newto Linux, open up
index.html on the disc and go to the Help
section for the guides listed on the right.
Mike Saunders, NewMedia Editor
mike.saunders@futurenet.com
What is Linux?
What is a distribution?
Booting your PCfromthe DVD
Partitioning your hard drive
Navigating the filesystem
Using the command line
Installing software
Need to find out what happened to a hacked Windows box? Linux saves the
day once again with CAINE.
CAINE examines a
Windows machine after
a major security failure.
www.tuxradar.com December 2011 LXF151 127
More software DVD
Four gorgeous games
And theres more!
We always value gameplay more than purdy
pictures in the LXFDVDGames section, but
it just so happens that this months
selections are real lookers too. First up we
have FlightGear as reviewed on page 25
this is a big beast of a sim, so weve
provided the full 410MBdata set for
those on slowconnections (or who have
no internet). See INSTALL.TXT and
getstart.pdf for instructions.
Then we have Pioneer, a game which
were tremendously excited about at LXF
Towers. You see, we all love Frontier: Elite II,
but David Braben hasnt obeyed our
commands and released the old source
code yet. So Pioneer is a new, open source
space adventure game based heavily on
Frontier, but with much better graphics. Its
only at version alpha 14 now, so its not
complete by any means, but worth trying
out. Extract the tarball and run pioneer in
the resulting directory to play.
And then theres Pax Britannica, an
awesome real-time strategy game that only
requires one button to play (really!), along
with Zaz, a puzzler in which you fire balls
moving around a spiral to make triplets of
the same colour.
Psychedelic spirally antics in Zaz.
gSharkdown Guides & podcasts
GParted Live 0.9.1
More software Disc extras
Linux distribution
I
f you havent been to www.grooveshark.comyet, its well
worth visiting its a music playing site where you can
find a vast number of tracks and listen to them
immediately. Unfortunately, though, it depends on that most
sluggish, crash-prone and proprietary of browser plug-ins:
Flash. We have a solution though in the formof gSharkDown.
As the name suggests, gSharkDown lets you download
and play audio files fromthe Grooveshark service. You can
also retrieve information about songs and even find lyrics if
you fancy a bit of a sing-along. The source code, along with
Deb and RPMpackages, are in the Desktop section.
Lastly, for the sysadmins among you, we have CCFE, the
Curses Command Front-end. This is a handy tool which lets
you set up semi-GUI-like front-ends to commands and
scripts. If you have a script which takes lots of arguments,
with CCFE you can give it a more user-friendly interface with
buttons, dialog boxes and other widgets thanks to Ncurses.
B
ut its not just software on the
disc: we have some help guides
too. If youre completely newto
the world of Linux, weve assembled a
collection of mini tutorials and tips.
Open index.html and click the green
NewTo Linux box. There youll find
explanations of what distributions are,
howthe Linux filesystemlayout works,
which Linux apps are great equivalents
of Windows programs, and howto
install software fromthe disc. If youre
feeling particularly adventurous, you
can also dabble on the command line.
For intermediate users, we have
more than 700 Linux problems and
solutions in the Answers Archive (Help
W
hile CAINE is great for
detective work after
hacking incidents, Parted is
a highly valuable tool for sorting out
disk partition problems. Or indeed, just
repartitioning your hard drive in
preparation for a newOS. Its a
standalone program, but also available
in a bootable live CD, the ISOimage of
which weve included in the System/
GParted section of the LXFDVD. Burn
it to a CD-Rand boot it up to run it.
With GParted, you can create,
remove, edit and check partitions in
various formats. For some filesystems,
you can even shrink and grow
partitions. Many distros have installers
which include some of this functionality,
but if youre looking for a non-distro-
specific solution, a useful mini distro for
your rescue kit that has support for a
wide range of filesystems, GParted Live
is your best bet.
Once booted up, GParted offers a
very sparse Fluxbox desktop, but that
doesnt matter because the main focus
is the programitself. You can see a
visual representation of your hard drive
in the panel towards the top right-
click on partitions inside it to bring up
an operations menu. There are
shortcuts if you need to open a terminal
or change the screen resolution. See
http://gparted.sourceforge.net.
No matter whats on your hard drive, GParted will make a
strong effort to let you reorganise it.
The TuxRadar podcast guaranteed
to entertain you, or your money back!
section). Also in Help we have RUTE, a
useful administration guide.
Then theres the TuxRadar podcast.
Get the most recent episodes in the
Magazine/TuxRadar section of the
DVD, and then followus online at
www.tuxradar.com/podcast.
128 LXF151 December 2011 www.linuxformat.com
Newbie-friendly Linux is back with a bang...
On the disc
F
or years, Mandriva was known as
the user-friendly face of Linux.
The distro was highly regarded
for its installer, Control Centre and
welcoming support community, and
things looked rosy. However, the
finances of Mandriva SA(the company)
didnt fare so well, and most recently, in
September 2010, a Russian firmbought
up a controlling interest in the company.
Things looked rough, and the Mageia
spin-off was announced.
But arguably, all this hubbub and
streamlining has produced some
positive results too. Mandriva has cut
down its number of offerings to one
distro, ditching Gnome, Xfce and other
desktops and windowmanagers in
order to focus on a single user
experience. The results are promising,
as you can see in the reviewon page 22
while theres still more work to be
done, were hopeful that Mandriva has a
solid future.
Anyway, if youre looking for a
modern, attractive and easy-to-use
Linux distribution, this is a great place to
start. Mandriva 2011 is bootable directly
fromthis months LXFDVD, so just pop
it in your drive, restart your machine and
it should load up. If not, you might need
to change the boot order in your PCs
BIOS so that the DVDdrive comes
before the hard drive.
Recommended minimumsystem
requirements for smooth running are:
A1.6GHz x86-compatible CPU
512MBRAM
20GBhard drive space
Although the version of Mandriva on
the LXFDVDis 32-bit for maximum
compatibility, it will happily run on 64-bit
machines too, and for most day-to-day
uses theres not much difference in
performance.
If this is the first time youve ever
considered installing Linux, there are a
fewthings to note. The installer is really
easy to follow, as you can see in the
steps below, and a smattering of PC
knowledge should suffice to get you
through the questions. However, the
most important step is partitioning.
Chances are that your hard drive just
has one big partition (chunk of data) on
it, dedicated toWindows. Because Linux
is a standalone OS, it needs its own
space, so you will need to shrink down
the Windows bit. You can do this in the
Mandriva installer, and its usually a very
reliable process, but as with any major
hard drive operation, we highly
recommend backing up beforehand!
Once the Mandriva installation is
complete, your hard drive will contain
both Linux andWindows. When you
start up the machine, youll see a new
boot menu asking you which operating
systemyoud like to start. So, you can
gradually ease yourself into Linux whilst
keepingWindows around, just in case.
Linux distribution
Mandriva 2011
1
Boot
Boot your PCfromthe LXFDVDand hit Enter
at the menu. As Mandriva loads, youll be
asked a fewquestions about your location
and keyboard layout.
2
Desktop
At the desktop, click the bottom-left star icon,
go toApplications and scroll down to the
Tools section to nd the Live Installer.
3
Partition
Youll be asked what you want to do with your
hard drive: you can erase the whole disk,
resize an existingWindows partition, or go for
a customdisk partitioning.
Step-by-step: Installing Mandriva 2011
The Control Centre (Tools > Configure Your Computer) is
an excellent, versatile tool for changing settings.
The first time you boot Mandriva,
youll be asked to create a user
account and set a root password.
www.tuxradar.com December 2011 LXF151 129
Mandriva 2011 DVD
Mandriva has
gone for a simple,
elegant design in
this 2011 release,
with elements of
Windows 7 and
Mac OSXrolled in.
If youre totally newto Linux, after installing Mandriva you
may be unsure howto do certain tasks. Heres a list of the
most common jobs and howto get themdone...
Browse the web Click on the orange and blue globe icon in
the bottompanel to launch Firefox, the worlds most popular
open source web browser thats fast and secure.
Manipulate your files Click the folder icon, second from
the left on the bottompanel.
Play music and videos Click the star icon (bottomleft),
then go toApplications > Sound &Video for a variety of media
playing tools.
Work with documents In Star Menu >Applications >
Office youll find LibreOffice, a powerful suite thats
compatible with MSOffice files.
Manage photos Go toApplications > Graphics and try
Shotwell, a user-friendly photo management tool.
Configure the systemUnder Applications >Tools
youll see ConfigureYour Computer. This starts up the
Mandriva Control Centre, which lets you change a vast range
of settings.
Get updates and new software Followthe step above to
launch the Control Centre, and go to the Software
Management tab.
Shut down Click the star button, and then the big red
power icon in the top-right.
You can find out more about Mandriva via its website at
www.mandriva.com, and support the project via its online
shop at http://store.mandriva.com(although note that
the Powerpack version of the distro up there is fromthe last
release, at the time of writing). Still, you can always get
goodies such as t-shirts and mugs to keep the distro funded
and in active development.
How do I?
SimpleWelcome
Mandrivas new start
menu is a big beast, with
an at-a-glance view of all
of your apps.
Dont miss...
MandrivaSync
Cloud file storage a bit
like Ubuntu One comes
to the distro, with 2GB of
free space for all users.
If you have any problems running the distro, or just want to
chat to other users, pop by the forums at http://forum.
mandriva.com. Its a busy place with hundreds of active
users, so if youve got stuck with anything, post a message
describing your problemin detail and someone will be on
hand to point you in the right direction.
LXF
4
Custom
If you opt for custompartitioning (for
advanced users), create a minimum10GB
root (/) partition in ext4format, and a 2GB
swap partition.
5
Copying
Nowthe Mandriva les will be copied to your
hard drive, which should take between ve
and 30minutes, depending on the speed of
your PC.
6
Selection
Finally youll be given the bootloader options
you can safely accept the defaults. Then
youll reboot into your brand newMandriva
system. Enjoy!
www.linuxformat.com 130 LXF151 December 2011
The graveyard rack
you can see a
genuine prototype
Panasonic DVCPRO
deck up there.
My netbook runs CrunchBang. I bought it as a little toy to
mess about with different Linux distros, but Ive failed to
build LFSon it twice so far. And Imgoing to give it to my
four-year-old, as Ive just replaced it with a Toshiba R830
runningArch. You can tell Jonathan, its because of his
endorsement of the Toshiba R630 on the podcast. Make sure
Toshiba knows where to send the cheque. But I digress
Apile of crusty old video
gear I use to send out to
all the digital displays
around the venue (its a
Roller Disco).
My HTCDesire, running
CyanogenMod.
Atotally over-the-top,
Mac Workstation which
runs Gimp, Blender,
Inkscape andApples
Final Cut Pro.
Here is a photo of my
desktop at work its a
small company where I
manage the web server,
e-commerce stuff and
make videos and graphics.
My trusty 10.04 Ubuntu
desktop. I just told themgo
and buy the cheapest desktop
you can find on the High
Street, with absolute faith it
would run Ubuntu nicely. It
also acts as the synergy server
for the Mac.
The
#
1 sourcefor Linux
December 2011
TuxRadar
Back page
Fromthe podcast...
Merriment and off-topicness fromthe Linux Format team(and you)
This snippet taken from Season 3 Episode 18 of the TuxRadar podcast get the latest episodes on your DVD in
the Magazine/Podcast section, or go to www.tuxradar.com/podcast
This monthwediveinto
JakePearses den...
Anatomy of a
geek desktop
Graham: It was just Paul
and Nick and a central desk,
surrounded by accounts people.
There were no windows. I didnt
even have a computer!
Graham: No when I first came, I
thought: All these people are working
for Linux Format! A room with 100 people
in. Theres the newsdesk, theres the
reviews centre...
Graham: Well done,
well done Mike. Youve
been here from the
beginning.
Mike: Linux Format
magazine is 150 issues
old! Congratulations
everybody.
Mike: Yep, since issue 1, albeit as
a freelancer. Can you remember
what happened when you joined
Linux Format, Graham?
Mike: Is that how
you expected Linux
Format would be?
Join the cloud computing uprising
The Servolution means weve sparked cloud-based computing right
here in the UK. The Servolution will free you at last from the burden
of expensive in-house servers.
It means an end to worries over obsolete technology and the
tyranny of IT stress. It also means a fairer system of only paying for
what you use. In fact, you can be a part of the Servolution from as
little as 1p per hour for Cloud Servers and 11p per GB for Cloud Files
all backed up by our legendary Fanatical Support

.
Join the Servolution at www.rackspace.co.uk/cloud-hosting

Das könnte Ihnen auch gefallen