Friday, July 3, 2009

Quick Firefox 3.5 Installation Guide

10 simple steps to install Firefox 3.5 on your Linux PC

1. Download the Firefox 3.5 from here

For example, on my Linux PC, I have downloaded Firefox 3.5 (firefox-3.5.tar.bz2) in my Download folder:

[rakesh@debian Download]$ ls
firefox-3.5.tar.bz2

2. Make a folder (e.g. for me, install) in your home

[rakesh@debian ~]$ mkdir install

3. Move firefox-3.5.tar.bz2 from your gnome Desktop or Download folder to install folder (the folder where you have downloaded firefox-3.5.tar.bz2 file)

[rakesh@debian ~]$ mv /home/rakesh/Download/firefox-3.5.tar.bz2 install/

4. Goto the install folder

[rakesh@debian ~]$ cd install/
[rakesh@debian install]$ ls
firefox-3.5.tar.bz2

5. Extract firefox-3.5.tar.bz2 file

[rakesh@debian install]$ tar -xvf firefox-3.5.tar.bz2
firefox/
firefox/update.locale
firefox/plugins/
firefox/plugins/libnullplugin.so
firefox/Throbber-small.gif
firefox/components/
firefox/components/nsSessionStore.js
firefox/components/nsFilePicker.js
..........
.....

6. Goto firefox folder

[rakesh@debian ]$ cd firefox
[rakesh@debian firefox]$ pwd
/home/rakesh/install/firefox

7. Make a symbolic link to launch Firefox 3.5

[rakesh@debian firefox]$ ln -s /home/rakesh/install/firefox/firefox ~/Desktop/Firefox3.5

8. Make it (Firefox 3.5) executable

[rakesh@debian firefox]$ chmod +x ~/Desktop/Firefox3.5

To open Firefox, from the command line you would type: firefox &

[rakesh@debian firefox]$ firefox &

If steps 7 and 8 do not work for you then follow an alternative option at step 9

9. Goto your gnome Desktop and

a) Right click on the gnome Desktop and
b) select the Create Launcher... option
c) click the button labeled Basic
d) type in "Name:" field : Firefox 3.5
e) type in "Command:" field: /home/rakesh/install/firefox/firefox
f) type in "Comment:" field: Firefox 3.5
g) now click Close button

10. You will see a Firfox 3.5 logo on your Desktop and just click the logo to launch Firefox 3.5 and browser the web.

Enjoy Firefox 3.5 ... :)

Wednesday, July 1, 2009

Todo.txt CLI Manages Your Tasks from the Command Line

Dozens of fancy point-and-click task managers promise to organize your to-do list, but so often power users find that nothing outdoes that trusty old classic: the todo.txt file.

If you're a command line lover who skips checkboxes and drop-downs to dash off notes and tasks in a regular old text file, or you're intrigued by the idea and wish your todo.txt chops were stronger, read on.



Gina has been a heavy todo.txt user for years. Back in 2006, he started developing a command line interface (CLI) to my todo.txt which lets him add to and check off items without launching a full-on text editor. Three years of daily (or at least weekly) use later, version 2.0 of the script is now available. It offers basic to advanced commands for managing your todo.txt and other text files you might use to capture information, like ideas.txt or maybelater.txt. Let's take a look.

Who This Is Meant For: If you're comfortable working in the terminal, changing permissions on a file, and working with Unix-style text commands, then the todo.txt CLI is for you. If you don't spend a good amount of time at the command line—either in the Terminal on your Mac, or using a Unix command line or emulator on Windows—you're going to think this whole thing is arcane and confusing. (In that case, we highly recommend getting organized with Remember the Milk. If you want to boost your command line chops on Windows, check out our introduction to Cygwin.)

You've already got CLI religion? Good. Let's get started on some hot todo.txt command line action.

Quick Start Guide:

  1. Download the Todo.txt CLI 2.0 zip file and extract it. You'll get two files. Place both todo.cfg (the configuration file) and todo.sh in your home directory.
  2. Open the todo.cfg file with your text editor of choice. Set the TODO_DIR variable to the right path for your setup. For example, on my Linux PC, this line reads:
    TODO_DIR="/home/[your home directory name]/todo"
  3. On Windows PC, this line reads:
    TODO_DIR="C:/Documents and Settings/gina/My Documents"
  4. On my Mac, this line reads:
    TODO_DIR="/Users/gina/Documents/todo"
  5. Make the todo.sh file executable by using the command: chmod +x todo.sh
  6. (OPTIONAL) Alias the letter t to todo.sh to save keystrokes while you use it. In your ~/.bash_profile file, add the line:
    alias t='~/todo.sh'

Now you're ready to put this script to work!

Basic Usage

Before we start, keep in mind that this CLI isn't trying to reinvent the text editor. If you want to do big bulk edits to a lot of items in your todo.txt, just open it up in your favorite text editor to do so. But for quick, one-hit access to add items, mark items as complete, or slice and dice your list by project or priority, todo.sh is for you.

For example, to add a line to your todo.txt file, at the command line, type:

$ t add "Pick up milk"

Add a few more items for good measure:

$ t add "Pick up the dry cleaning"
$ t add "Clean out the inbox"

Now, to see all the items on your list, use:

$ t ls

The output will look like this:

$ t ls
03 Clean out the inbox
01 Pick up milk
02 Pick up the dry cleaning
--
TODO: 3 tasks in C:/Documents and Settings/gina/My Documents/todo.txt.

Now, you can reference each item by its ID—which is actually the line number it lives at in the todo.txt file. For instance, to prioritize task 1 to the highest level—priority A—use this command:

$ t pri 1 A

To mark task 2 as complete, use todo.sh's do action:

$ t do 2

Since a video is worth a million words, see this in action in this screencast demonstration of a to-do list you might find for a crew member on Battlestar Galactica. (Go full-screen to see what's being typed more clearly.)

If this video clip isn't clear enough for you, try this alternate high-res location.


Advanced Usage

Once you've got the basics of working with your todo.txt down, it's time to dive into more advanced tricks. Here are a few more things this CLI can do.

  • Replace or delete a task; append or prepend text to a line. When you want to re-word a task or add a context, project, or additional info to it, use the replace, append, and prepend actions to do so. For example, add "ready at 3PM" to your "Pick up the dry cleaning task" with this command:
    $ t append 2 "ready at 3PM"
  • See all the contexts and projects in your list. If you're using the + and @ sign format to signify projects and contexts, use the listcon and listproj (or lsc and lsprj for short) commands to see a short list of all your contexts or projects in your todo.txt.
  • Move items from your todo.txt to another text file. Say you've decided that the "Learn how to speak French" task is actually something you're not quite committed to doing—yet. Use todo.sh's mv command to zip that task from todo.txt to another text file in your todo directory. For example, this command will move it into a maybelater.txt file:
    $ t move 10 maybelater.txt
  • List the contents of another text file. Since I got so used to working with todo.txt this way, there's now support for working with other text files. For example, you can list the contents of your maybelater.txt file using the command:
    $ t listfile maybelater.txt

    Likewise, you can add a line to another file using:

    $ t addto ideas.txt "My bright idea"

    You can also search the contents of another text file by adding a keyword after the list command, ala:

    $ t lf ideas.txt apple

See all the options available to you using the todo.sh -h command. The full usage manual is available here.

Sunday, May 24, 2009

Five Game-Changing Features in Firefox 3.5


The latest Firefox may still be in beta but it boasts a number of behind-the-scenes features that will make developing for the web easier as well as end-user changes that add new functionality, like private browsing and support for drag and drop.




Firefox 3.5 is coming very soon, and this release includes a number of features that up the ante for Web browsers and the Web as an application platform. Some of the game-changing features in Firefox 3.5 won’t be immediately visible to end-users, but they’ll allow Web developers to build Web applications that make the Web even more fun and useful than it already is. Let’s take a look at five of the prominent features you can test drive today in Firefox 3.5.


You can grab tarballs from Mozilla the Mozilla beta announcement page, though many Linux distros also have testing packages available as add-on repositories. For instance, openSUSE users can add the mozilla:beta repository to track the latest Firefox development packages. This gives the added advantage of allowing you to track updates via your distro’s update process, but does mean that updates will usually lag a few days behind the official Moz builds.

Because it’s beta software, the standard disclaimers apply: While Firefox betas are pretty stable, you can expect that it will have some bugs and might even do unexpected things like eating your data. I’ve never had this happen, but take reasonable precautions before running the beta — like backing up your profile directory.

Audio and Video Support in Firefox

Ever get sick of worrying about plugins and helper applications to enjoy multimedia content online? Firefox 3.5 may be the beginning of the end for that particular hassle with support for HTML 5 audio and video elements, and support for the Ogg and WAV formats in the browser itself.

The audio and video elements make it easier to add video and audio to Web pages, with a few lines of HTML Take this example from the Firefox developer site:

If you’re using a supported browser like Firefox 3.5, you’ll see test bars just like we used to enjoy at the end of the broadcast day on television. (Remember when the broadcast day actually ended?) If not, you should just see: “Your browser does not support the video element.”

As a side note, Firefox’s inclusion of Ogg might just help make the free but not yet mainstream format break through. This would be a big win for Linux users who have excellent tools for encoding and decoding Ogg but not a lot of mainstream content in Ogg to view or listen to. Labels like Magnatune that support Ogg out of the box are few and far between.

If you’re running Firefox 3.5, you can catch a number of sample videos on TinyVid.

Private Browsing

Over the years, Firefox has added a number of features that make it easier to erase your browsing tracks — so if you’re sharing a computer with others, you can erase history, cookies, cache and other bits that would let snoopers see how you spend your browsing time. Unfortunately, it’s a bit of a shotgun approach — meaning you lose history and so forth from all the sites you visit, and not just the ones you want to keep private.

The 3.5 release will take care of this problem by introducing Private Browsing, or what’s more often referred to as “Porn Mode” for Mozilla. Of course, it has much more work safe applications as well. If you’re doing gift shopping, for example, it’s sort of a dead giveaway if your significant other stumbles on your shopping history. For the paranoid security conscious, it’s also a good feature for logging into banking sites or any other type of Web site that displays a lot of private data. Whatever the reason, Firefox’s Private Browsing mode is much more convenient for users than just deleting history at random intervals.

Using Private Browsing, you can start up a Firefox session that doesn’t record cookies, history, etc., so that there’s no trace of your session. When you finish, all of your previous settings and history are untouched, so you lose nothing — unlike the “Clear History” tool in older versions, which clobbers all cookies, etc.

Firefox 3.5 also has added more finely grained options to the Clear History tool. Instead of an “all or nothing” approach, you can get rid of the last hour, two hours, four hours, day, or entire history.

Offline Application Support

Being dependent on a Web application is a bit of a problem when you’re offline. Firefox 3.5 tries to remedy this a bit by adding support for the HTML 5 specs for caching resources for Web apps.

Offline application support isn’t entirely new, Firefox shipped bits of this with Firefox 3.0 and add-ons like Google Gears have provided offline support for Gears-enabled Web apps. However, Firefox 3.5 fully supports the HTML 5 specification for offline application support — which ought to give a boost to offline Web apps, beyond Google Gears.

Drag and Drop

Typically, Web applications lack the same feature functionality that desktop applications do. Case in point: Drag and drop between applications. Sure, you can copy and paste some things between browser windows and different Web sites, but drag and drop capabilities are seriously limited compared to desktop applications.

Firefox 3.5 beefs up the abilities to drag and drop data types between applications and even multiple items. It may seem like a minor feature, but it gives Web apps the ability to work more like desktop applications, which is another hurdle for those who’d like to see Web applications replace fat apps.

Geolocation

Geolocation seems to be all the rage these days — services like Google Latitude allow users to report their location via the computer or mobile phone so your friends and stalkers can track your location more conveniently. Ecommerce sites can pick up your location to suggest nearby stores, and so forth.

I’m not entirely sure this is a desirable feature, but a lot of users seem to want it — and Firefox 3.5 gives developers and users the tools to make it possible beyond services like Latitude. If you’re totally freaked out by the prospect of Web sites knowing your location, it can be turned off.

Basically, service providers can report your location based on wireless access points and IP address. Depending where you are in the world, this can be very accurate (within a few meters, which is pretty darn specific) or wildly inaccurate. With your permission, Firefox can then report the location to Web sites that request it.

My experience with the technology so far is that it’s good at getting within the general city/county, but beyond that not so much. But the technology is only going to get better (especially with mobile devices that have GPS) and more widely used.

All in all, Firefox 3.5 has a lot of new functionality that’s going to be really useful regardless whether you’re a Web developer or an end-users.

Wednesday, May 13, 2009

Free Linux Ebooks Collection For Newbie

I'm listing here a free book collection and sure it will very useful among Linux users and rightfully so, who doesn’t like free books? No matter how experienced you are with Linux systems, there is always something new you can learn from a good book that focuses on specific aspects of a Linux system. I tried to make a list of free books by categories. “Beginners”, “Advanced” and “Administrators”.

Here I have listed e-Books for "Linux Ebooks For Newbie", "Intermediate and Advanced Linux Users" and "Linux System Administrators".

Here's listed a comprehensive list of Free Linux related e-books. I didn't arrange the ebooks in proper categories.

E-books:

  1. Linux Client Migration Cookbook, Version 2: A Practical Planning and Implementation Guide for Migrating to Desktop Linux by Chris Almond
  2. Linux Compute Clusters by Chander Kant
  3. Linux Device Drivers by Alessandro Rubini and Jonathan Corbet
  4. Linux Installation and Getting Started by Matt Welsh
  5. Linux Kernel Module Programming Guide by Ori Pomerantz
  6. Linux Network Administrator’s Guide by Olaf Kirch and Terry Dawson
  7. Securing and Optimizing Linux by Gerhard Mourani
  8. Self-Service Linux: Mastering the Art of Problem Determination by Dan Behman and Mark Wilding
  9. Slackware Linux Essentials by Alan Hicks, Chris Lumens, David Cantrell, and Logan Johnson
  10. The Linux Cookbook: Tips and Techniques for Everyday Use by Michael Stutz
  11. Advanced Linux Programming by CodeSourcery LLC
  12. Comprehensive Linux Textbook by Muayyad Saleh Al-Sadi
  13. Java Application Development on Linux by Carl Albing and Michael Schwarz (PDF)
  14. Linux Admins Security Guide
  15. Linux Security Howto
  16. Linux Firewall Configuration, Packet Filtering & netfilter/iptables
  17. Linux Device Drivers, Third Edition
  18. GNU Bash Reference Manual
  19. Knowing Knoppix
  20. Linux Client Migration Cookbook
  21. Vi iMproved (VIM)
  22. Linux: Rute User’s Tutorial and Exposition
  23. The Book of Webmin
  24. Linux From Scratch
  25. GNU Emacs manual
  26. Writing GNOME Applications
  27. KDE 2.0 Development
  28. GTK+/Gnome Application Development
  29. GNU Autoconf, Automake and Libtool
  30. Advanced Linux Programming
  31. Secure Programming for Linux and Unix
  32. The Art of Unix Programming
  33. The Linux Development Platform
  34. C++ GUI Programming With Qt 3
  35. Unofficial Ubuntu Guide
  36. The Easiest Linux Guide You’ll Ever Read - An Introduction to Linux for Windows users
  37. SUSE Linux Administration Guide
  38. Red Hat Enterprise Linux Installation Guide
  39. Red Hat Enterprise Linux Reference Guide
  40. Red Hat Enterprise Linux Step By Step Guide
  41. Fedora Linux EssentialsVisual Basic Essentials
  42. Fedora Core 7 Desktop Guide
  43. LDAP Operations HOWTOLearning Debian GNU/Linux
  44. Learning the Unix Operating System
  45. Linux Administration Made Easy
  46. Linux Dictionary
  47. The Linux kernel
  48. Linux Kernel 2.4 Internals
  49. The Linux Kernel Module Programming Guide
  50. LINUX: Rute User’s Tutorial and Exposition
  51. Maximum RPM, Taking the Red Hat Package Manager to the Limit
  52. Pocket Linux Guide
  53. Secure Programming for Linux and Unix HOWTO
  54. Linux+ Study Guide
  55. Ubuntu Linux Essentials
  56. PHP Essentials
  57. Javascript Essentials
  58. Red Hat Fedora Core 7 Installation Guide
  59. The Art of Unix Programming
  60. Bash Guide for Beginners
  61. Beyond Linux from Scratch
  62. The Book of Webmin Or: How I Learned to Stop Worrying and Love UNIX
  63. Brian and Tom’s Linux Book
  64. Debian GNU/Linux Desktop Survival Guide
  65. Debian GNU/Linux System Administrator’s Manual
  66. Everyday Linux
  67. FreeBSD HandbookGNU Manuals OnlineIn The Beginning Was The Command Line
  68. Introduction to Linux - A Hands on Guide

Free Linux Ebooks For Newbie:


1. Ubuntu Pocket Guide and Reference

Author: Keir Thomas
Format: PDF




2. Linux Newbie Administrator Guide

Author: Peter and Stan Klimas
Format: HTML


3. Introduction to Linux - A Hands on Guide

Author: Machtelt Garrels
Format: HTML



4. Bash Guide for Beginners

Author: Machtelt Garrels
Format: HTML



5. Rute User’s Tutorial and Exposition

Author: Paul Sheer
Format: HTML



6. The Linux Starter Pack

Author: Paul Hudson
Format: PDF



7. FLOSS Manuals

Author: FSF
Format: HTML & PDF



8. The Easiest Linux Guide You’ll Ever Read

Author: Scott Morris
Format: PDF



9. Linux Knowledge Base and Tutorial

Author: James Mohr
Format: PDF



10. Slackware Linux Basics

Author: Daniël de Kok
Format: HTML


Sunday, May 10, 2009

How to make OpenOffice load faster








Here we will discuss the procedure to be followed for making OpenOffice run faster in Ubuntu.

Some simple steps make OpenOffice snappier.

  • Go to Applications > Office > OpenOffice.org Word Processor



  • The OpenOffice.org Word Processor is launched. Go to the Tools menu and select Options.

  • The Options window is opened.

  • Highlight Memory on the left panel, change the setting as shown below.


    • Reduce the number of Undo steps to a figure lower than 100. Adelstein suggests 20 or 30 steps.

    • Under Graphics cache, set Use for OpenOffice.org to 128 MB (up from the original 6MB).

    • Set Memory per object to 20MB (up from the default .5MB).

    • Set the number of objects under Cache for inserted objects at 20.

    • Check OpenOffice.org Quickstarter.

  • Now highlight Java on the left panel, uncheck Use a Java runtime environment

  • Click the OK button and close OpenOffice.org. Start it up again to experience the change in speed!

Create a mirror of a website with Wget

GNU's wget command line program for downloading is very popular, and not without reason. While you can use it simply to retrieve a single file from a server, it is much more powerful than that and offers many more features.

One of the more advanced features in wget is the mirror feature. This allows you to create a complete local copy of a website, including any stylesheets, supporting images and other support files. All the (internal) links will be followed and downloaded as well (and their resources), until you have a complete copy of the site on your local machine.

In its most basic form, you use the mirror functionality like so:

$ wget -m http://www.example.com/

There are several issues you might have with this approach, however.

First of all, it's not very useful for local browsing, as the links in the pages themselves still point to the real URLs and not your local downloads. What that means is that, if, say, you downloaded http://www.example.com/, the link on that page to http://www.example.com/page2.html would still point to example.com's server and so would be a right pain if you're trying to browse your local copy of the site while being offline for some reason.

To fix this, you can use the -k option in conjunction with the mirror option:

$ wget -mk http://www.example.com/

Now, that link I talked about earlier will point to the relative page2.html. The same happens with all images, stylesheets and resources, so you should be able to now get an authentic offline browsing experience.

There's one other major issue I haven't covered here yet - bandwidth. Disregarding the bandwidth you'll be using on your connection to pull down a whole site, you're going to be putting some strain on the remote server. You should think about being kind and reduce the load on them (and you) especially if the site is small and bandwidth comes at a premium. Play nice.

One of the ways in which you can do this is to deliberately slow down the download by placing a delay between requests to the server.

$ wget -mk -w 20 http://www.example.com/

This places a delay of 20 seconds between requests. Replace that number, and optionally you can add a suffix of m for minutes, h for hours, and d for ... yes, days, if you want to slow down the mirror even further.

Now if you want to make a backup of something, or download your favourite website for viewing when you're offline, you can do so with wget's mirror feature. To delve even further into this, check out wget's man page (man wget) where there are further options, such as random delays, setting a custom user agent, sending cookies to the site and lots more.

More advanced wget usage:

No parent option

If you are doing a mirror, but you only want to mirror a subdirectory of the main site (for example, just /news/), you might run into a problem. Because many of the pages at /news/ link back to /, you'll inadvertently end up downloading the whole site.

The solution to this, pointed out by Todd in the comments, is to use the no parent option, -np.

In our example, we'd do:

$ wget -mk -w 20 -np http://example.com/news/

Update only changed files

Continuing in our mirroring scenario, another extremely useful option for preserving bandwidth on both sides is to update only the files that the server reports as changed.

This option is -N.

$ wget -mk -w 20 -N http://example.com/

Thanks to Paul William Tenny in the comments for that tip.

Random delay on mirror

And finally for our mirror-specific tips, you can also randomise the delay between downloads. There are several reasons you might want to do this, including sites that don't take kindly to being mirrored, even considerately, and block clients that they suspect of doing it (some bots can be pretty nasty, and you might be categorised as one of 'them').

Randomising the wait time - and combining with the user agent option below - can be steps to circumvent this automatic protection.

If you do find yourself using this feature for that reason, please continue to be considerate and follow any rules regarding the content you've been given. Mirror responsibly.

$ wget -w 20 --random-wait -mk http://example.com/

The wait value - 20 in this case - is used as a base value to calculate what the random wait times will be. They will alternate between 0 and 2 times that value (in this case, 0-40 seconds).

Custom user agent

Some sites might have some strange restrictions on what browsers can access it, or perhaps have different versions of a site depending on the browser used. I can't say I agree with sites that do this, unless there's a really good reason, but it shouldn't stop you from using wget for access.

Using wget, you can set a fake user agent string so that the program reports itself as a different browser.

$ wget -U "user agent" http://example.com/

Combine the -U option with any others you want, obviously. Here are a few user agents you can use to get you started:


IE6 on Windows XP: Mozilla/4.0 (compatible; MSIE 6.0; Microsoft Windows NT 5.1)
Firefox on Windows XP: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Firefox on Ubuntu Gutsy: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.14) Gecko/20080418 Ubuntu/7.10 (gutsy) Firefox/2.0.0.14
Safari on Mac OS X Leopard: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/523.12.2 (KHTML, like Gecko) Version/3.0.4 Safari/523.12.2

That's it for now, if you have any more useful wget tips and tricks, share them in comments.

Installing Gentoo 2008.0 Live CD












Traditionally, Gentoo Linux has been a distribution designed more towards the more experienced Linux user, perhaps the 'power user', if you will.

Its source-based package management and offering the user complete control over the system installation and configuration have meant that traditionally, it can be difficult to approach.

Having myself tried and failed to install Gentoo in the past, I thought I would take the recently released 2008.0 Live CD for a spin, and see what the installation process is like, and how easy it is to use and understand. So here goes.

You get started like any other Live CD - throw it in the drive, reboot and press Enter to boot in. Before the GUI even arrives, you'll be asked to pick a keyboard layout to use for the live CD, then eventually you will be greeted with this GDM login screen.

GDM in Gentoo 2008.0

There's an autologin set here, so you just have to wait a few seconds for the live user to be logged in. Gentoo now uses Xfce as the default GUI environment, so it will load up (fast, as it always seems to be).

Xfce in Gentoo 2008.0

As expected, this is a fully usable Gentoo system at this point, albeit running Live, so of limited utility. A fair selection of packages are installed, included Firefox 2.0.0.14, in a 'Bon Echo' branded guise.







Still, we're interested in the installation procedure. Conveniently on the desktop is an installer shortcut. Actually there are two - a command-line based installer, and the graphical GTK+ version. I'll be using the latter.

There's no introduction or anything. As soon as you double-click the installer, you're thrown straight in at a partitioning screen. Provided you have a clean disk and don't mind Gentoo monopolising your hard drive, it's simple to click the Recommend Layout button for a one-click solution to this screen.

Partitioning in Gentoo Installer

It does, however, give its power user base the ability to fully control how Gentoo will inhabit their hard drives.

Partition layout

Click Next at this point and you are right away doing mount points for those partitions you just set up (and any others you want too). This is usually saved for the tail end of distro installations, but the way that the Gentoo installer works means that it will mount all of these partitions for you in the live distro too for the install, so it is done at this point.

You don't get an awful lot of confirmation, so pretty much as soon as you hit Next, those partitions will be written to disk and a few files get copied over.

Initial 'stage' File Copy

Once that initial set of files gets copied, you then go back into answering questions. Personally, I don't like this sort of do some work, then ask more questions, then do more work thing.

It reminds me of the Windows XP installation procedure - when you can never just answer questions and set it off doing its own thing, it requires constant supervision. The Gentoo install isn't nearly as bad, but the way it works doesn't feel very 'standard' in comparison to more mainstream Linux distros.

From this point on, you are asked about configuring network interfaces, your root password and setting up the different users for your newly installed system.

Adding Users

The users module could potentially be a little confusing without a fair bit of Linux experience, as you are asked to manually fill in details such as the user's shell, home directory and user ID. You can leave things blank for defaults, however.

The final step before the proper copying of packages happens is to choose any additional packages you need. If you want a graphical system at the end of the install, you'll need to make sure you check at least the xfce and xorg-x11 packages.

Finally, the proper copy operation gets started. This will probably take considerable time (it did in my VM installation, at least).

Main installation copying

Once the copy is finished, just as abruptly as it begun, you are notified that the installation is complete and you can reboot into the installed system.

Conclusion

So, how easy is this to install?

It certainly doesn't require much specific knowledge of Gentoo or how it works, but neither is it for the faint hearted.

A significant body of previous Linux experience is expected, as you'll be on your own with respect to key concepts, such as partitioning, packages and users.

I imagine that in a 'safe' environment - i.e. a machine that didn't particularly matter, someone with only intermediate Linux skills could probably get through relatively easily and progress to using the distro.

Gentoo is still very oriented towards the more experienced user and the person who likes to endlessly fiddle with and tweak their system so it works exactly how they like it and has the maximum possible performance.

I don't remember how I fell down on installing in the past, but it certainly seems like an achievable feat for someone with some Linux experience now, and that in itself has lowered the bar to learning and using Gentoo.

They could try to make it even easier to install, but then I guess there might be complaints from those who do not want their installer to be 'simplified' any more.

People like control over their machines.

Cygwin - a Unix Environment and Shell on Windows

If your daily routine means that you spend much of your time behind a Windows system, yet you love the power and flexibility of a Unix-based environment, it might be frustrating not to have access to the tools and environment that you want.

Alternatively, you might want to compile some Linux/Unix software, so that it can run natively under Windows.

Cygwin is a Linux-style environment for Windows, that gives you a set of libraries, a full Linux-style command line and a package manager so you can install many of the Unix programs you might be familiar with.

I thought I would take a look at Cygwin's latest release and show you how to install it and get up and running.

First of all, head on over to the site and download setup.exe. This is the main installer/package manager for Cygwin and by default you use it to do an internet-based install, i.e. the setup program itself will download the packages.

Downloaded setup.exe file

Cygwin Installer

Once the installer is up and running, click Next to bypass the initial welcome screen. You will be given several options on how you want to obtain packages. In most cases, Install from Internet is fine here.

Next, choose the directory to install Cygwin to on your Windows machine. This directory will become your root (/) from within the Cygwin shell.

Choose Cygwin directory

On the next screen, choose the temporary folder where packages will be downloaded before they are installed into Cygwin. If you want, you can use a Windows temporary folder, but if you want to keep the source packages files around so you don't have to redownload later, make it somewhere permanent.

Again, click the old Next button and choose whether you need to use a proxy. In most home computer situations, leave the defaults intact and move on.

The Installer will at this point go off and retrieve a list of the different download sites, or mirrors, available to you. Choose one geographically close to you in preference, but any of them should be fine.

Cygwin Select Packages

Here, you need to choose the packages that you want to install. You can just leave this all as it is and move on, but if you want to install additional packages into Cygwin, follow these steps.

The categories can be either left at the Default setting, or you can choose to Install or Uninstall whole categories by clicking on the 'recycling' icon next to them (and the word 'Default').

For individual packages, expand a category and find the package you want. To install or uninstall it, add a check under the 'Binary' and/or 'Source' columns to grab what you want.

Once you're done choosing packages, click Next yet again to move on. You can always come back to this stage later by re-running the installer to add or remove packages.

Cygwin Download and Installation

Download and installation now takes place. Depending on the speed of your machine and how much you've asked to download, this could take a while.

Once the installation is finished, pick your Desktop and Start menu shortcut options and Finish.

Finally - that's the installation done! You can access Cygwin through the shortcuts you just made, or by browsing to the directory you installed it in and launching cygwin.bat.

You will be presented with a bash shell, just as on Linux, and all of the Cygwin packages you installed should now be available for use.

Cygwin shell

You can also access Windows programs and files through /cygdrive/[Windows drive letter].

And there you have it - a Linux compatible environment for your Windows machine. Cygwin isn't really for the faint hearted, or those without Linux/Unix CLI experience, but it is a very powerful platform to bringing many features of the Unix platform to a Windows machine in a native way.

You can even run X on it.

Install Ubuntu on your USB Drive


Did you know that is ridiculously simple to install Ubuntu onto an external USB flash drive?

If you have a copy of the latest version of Ubuntu (at the time of writing that is 8.10), there is a very simple program that does it all for you.

You will need:

  • An Ubuntu 8.10 CD (or ISO image if already installed)
  • A USB drive with at least 700-800 MB free space

While you are booted into Ubuntu, go to System > Administration > Create a USB startup disk.

Make Bootable Ubuntu USB Drive

You'll need to choose the source disc image for Ubuntu. If you have your Ubuntu CD in the drive, this should appear in the list, so make sure it is selected. Alternatively, you can click 'Other' and specify where the .iso image of the Ubuntu CD is.

Next, plug in your drive and choose it as your destination drive (and double-check it's the right drive before going ahead).

You can also choose how much space will be reserved for saving data on the new drive, or turn data storage off (it will act just like the Ubuntu live CD).

That's it! Simply press Make Startup Disk and wait while the files are copied over.

Installing Ubuntu on USB Disk

On many modern PCs that are configured to allow USB boot, you should be able to just restart the machine with the USB drive plugged in and Ubuntu should boot straight from it!

It's a nice simple way to have a copy of Ubuntu in your pocket, wherever you go.

Installing Ubuntu 8.10 on a White MacBook

Ubuntu logo

Installing Ubuntu (or any other Linux) on a Macintosh is a slightly different process than installing Ubuntu on a more traditional PC. Various differences in the hardware, particularly the use of the EFI firmware system, mean that some extra effort is required to get your favourite distro up and running on your favourite hardware.

This tutorial is inspired and somewhat derived from the Ubuntu Mactel Community Documentation, as well as my own experience of this process.

So let’s take a look at the steps involved, before we dive in.

Overview

We can divide the installation process into these major steps:

  1. Make free space
  2. Install rEFIt boot loader
  3. Run Ubuntu installer (setting GRUB boot loader location)
  4. Sync MBR with rEFIt
  5. Boot the system and uninstall rEFIt

I will be installing Ubuntu 8.10 on a late 2006 white MacBook, so this guide may be somewhat specific to the white MacBook, but should be fairly similar on most Intel Macs.

Why?

Because the MacBook is a really nice piece of hardware. Many bits and pieces of the MacBook hardware work out of the box, including:

  • Graphics
    • Intel GMA 950 and Intel GMA X1300 integrated graphics have open source drivers, so everything ‘just works’ out of the box, including desktop effects.
    • The newer NVIDIA 9400M-based MacBooks will require the installation of the NVIDIA proprietary driver for full graphics support.
  • WiFi
    • Support for the WiFi chip used in the MacBook is built right into recent revisions of the Linux kernel. The result? WiFi ‘just works’. Seriously.
  • Bluetooth
  • Audio
    • After a little fiddle with the audio volume levels.

Backup, Backup, Backup

Before you do anything, make a full backup of your system. Anything you care about must be kept somewhere else as well, just in case this process goes wrong. A Time Machine backup should be fine, as long as you don’t forget to also backup the exceptions to your Time Machine backup separately if you don’t want to lose them.

Once you are completely confident that you could restore the entire system in a snap, or are convinced that you don’t care about anything on the machine, go ahead and continue with this tutorial.

Make Free Space

The first step is to make enough free space on your disk for Ubuntu to exist within. There are essentially two ways to achieve this. Unless you’re reinstalling Mac OS X from scratch anyway, it is probably a better idea to use the Boot Camp method, as you don’t have to delete everything to do so.

Using Boot Camp Assistant

Screenshot of Boot Camp Assistant

Despite being designed for dual booting Windows and Mac OS X, Boot Camp Assistant is very useful to us as it automatically repartitions the hard drive on the fly, without deleting any of your data.

The space that you allocate to ‘Windows’ in this screen will, obviously, be the space that Ubuntu will occupy, so give yourself as much space as you think you will need.

Once you’ve clicked Partition, simply choose Quit and Install Later, as we won’t actually be installing Windows.

Now Boot Camp Assistant very helpfully formatted the partition as FAT32. Um, great, but we actually want free space. We’ll fix this from the Ubuntu side later.

By Reinstalling

If you happen to be reinstalling OS X anyway, you can use Disk Utility from within the Mac OS X Installer (in the Utilities menu) to partition the disk, manually creating a Mac OS Extended partition for OS X and deliberately leaving some space as unformatted.

Install rEFIt Boot Loader

In order to fix the system’s Master Boot Record (MBR) after the Ubuntu install is complete, we need to briefly install rEFIt, a custom bootloader for EFI-based computers, including Intel Macs.

Go ahead and download the Mac disk image and run the installer package.

rEFIt Installer

Once it is complete, reboot the Mac and verify that you get a screen that looks something like the following (it won’t have a Tux icon yet and shouldn’t have a Windows icon either).

rEFIt boot screen

OK, we’re finally ready to kick off the Ubuntu install.

Run Ubuntu Installer

For the most part, this process is exactly the same as you would do on a PC. There are, however, two crucial steps you must get right.

Before getting started on the install, however, we need to get rid of the FAT32 formatting of the Boot Camp partition. Pop the Ubuntu CD into your computer and reboot. At the rEFIt boot menu, you can choose to boot Linux from CD. I recommend you plug in a USB mouse at this point so you can right-click.

Select Try Ubuntu without any change to your computer to get into the full Ubuntu interface. Once the system boots, go to Applications > Accessories > Terminal.

$ sudo gparted

This opens the partition editor, so we can go ahead and wipe that partition.

Partition editor screenshot

You’ll want to find the FAT32 partition labelled ‘Boot Camp’ (NOT the one labelled ‘EFI’ at the start), right-click it and choose Delete. Apply the changes.

Once the changes are applied, you can continue with the installation, as normal, except the following two things which must be set correctly:

Choose ‘Largest Continuous Free Space’

When you are asked by the installer how you want to partition the disk, choose Guided – use largest continuous free space. Since you just made sure you have a large chunk of free space earlier, by deleting the Boot Camp FAT32 partition, it will recognise that and use the space for Ubuntu.

If you are desperate to partition it yourself and know what you are doing, just make sure the bootable partition is the first one. Don't put your swap before your data on the disk, or the Mac will try to boot from the swap partition.

Install GRUB on sda

At the final page of the installer, ‘Ready to install’, where you are shown all the settings for the install, make sure you click the Advanced button and choose to install GRUB onto /dev/sda3.

Sync MBR with rEFIt

So, the installation should finish and you will be told to reboot. When the system comes back up, do not jump straight away into the new Linux option on your rEFIt boot menu.

rEFIt boot screen

Instead, select the Partition Tool icon. It should tell you that the Master Boot Record need to be synced and offer to do so. Press the Y key to accept this and you will return to the boot screen.

I recommend at this point you select the option to shut down your Mac, give it a few seconds to clear everything out and then turn it back on. This avoids a lockup I experienced right after you perform the MBR sync.

Boot the System and Uninstall rEFIt

At this point, you should be ready to go. At the rEFIt boot menu, choose the Linux option and Ubuntu should boot. At this point, everything should be just the same as it would be on a PC.

You can now uninstall rEFIt if you desire, or you can leave it intact and use it each time the system boots to choose your operating system. The choice is entirely up to you.

If you remove it, you can boot into Ubuntu with the Mac’s native boot loader by holding down the Option key at startup and choosing the disk entitled ‘Windows’.

Conclusion

And that’s it. After you’ve done this little bit of fiddling to get it installed, and perhaps once you have configured some components that don’t work out of the box, you have a very nice little Ubuntu machine.

Saturday, May 9, 2009

Restoring an Overwritten GRUB Boot Loader

I like to have lots of choice about which operating system I can boot to. Between my desktop PC’s two hard drives, I have at least three distributions of Linux and several versions of Windows, so I have complete OS flexibility.

Unfortunately, maintaining a multi-boot configuration like this can be a pain, especially if you later install an operating system which overwrites the GRUB boot loader you had in place (such as a version of Windows). If your boot loader is overwritten, you could be left with no choice but to boot the most recently installed OS.

In this tutorial, I will show you how to restore an overwritten copy of the GRUB boot loader by using a Linux live CD. In this example, my master GRUB installation is on a Kubuntu 8.10 installation, and I’m using an older Kubuntu 8.04 Live CD I have lying around.

This tutorial does require you to have some understanding of how your multi-boot system operates, disk partitions and using the command line. If you are not confident, perhaps find a friend who knows Linux more intimately to do this process.

Before Starting

It’s worth mentioning that you may need to use a live CD somewhat similar to that of your ‘master’ OS, where your boot loader configuration is stored. This is due to the technique we use to re-run the GRUB installer.

Also, you need to actually know which system holds the configuration file for your GRUB boot loader and on which partition it is located. If you have a more complicated multi-boot setup, like myself, you probably know this. If you have a more simple Windows-Linux dual boot, there should only be one Linux data partition where it could be.

Boot the Live CD

Start the Live CD up as normal. Don’t choose to install the OS if prompted, you want to come to a full live desktop to run the specific commands we need.

Identify your Partitions

You need to know on which partition the GRUB config file and associated programs are stored. You may wish to use a graphical program such as Gparted (if available). You’ll want to find out the device string (such as sda5) of the relevant partition.

GParted screenshot

(The screenshot above is actually from my triple-boot MacBook, but still shows you how you can identify the (ext3) partition of Ubuntu on that system.)

If you can’t use a graphical program to work this out, open a Terminal program and use the following command:

$ sudo fdisk -l

This will list all of the partitions on all the devices on your system. Under the ‘System’ column, you can see all of the partitions labelled as ‘Linux’. This won’t show you the difference between data and OS partitions, so is less useful in a more complex partition layout.

Fdisk -l screenshot

If you can work out where your Linux is from this, note down the information under ‘Device’.

Mount the Partition

We now must mount your partition, so that we can access it. Some Live CDs may do this for you, or offer to do so, but here we will perform the process manually.

We will first make a folder in which the partition is mounted and then do the mounting. Replace the device string /dev/sda5 with the device string that you identified earlier.

$ sudo mkdir /mnt/system
$ sudo mount /dev/sda5 /mnt/system

You should now be able to browse your hard drive by navigating to that folder. The next process we are going to perform is to temporarily change the root directory of our terminal (chroot), so that we can run the GRUB installer directly from the hard drive. It won’t even realise it’s not running from the real system

On Ubuntu and other sudo-based distros, we must first do this:

$ sudo -i

to become root fully (sudo is not enough here).

Doing the chroot

The GRUB installer requires to read the devices on disk directly in order to write the GRUB boot record back onto the system properly. It therefore needs a working copy of /dev, inside the mounted directory.

# mount -o bind /dev /mnt/system/dev

Next, we can run chroot:

# chroot /mnt/system

From this point forward, be very careful. You have root privileges and full write access to your hard drive. The usual caveats apply.

Run the GRUB Installer

All we need to do now is to simply run the GRUB installer, which plonks the GRUB boot record back on the hard disk and gives us back all of our choices.

# grub-install /dev/sda

If you need to install GRUB elsewhere (such as a different disk or a specific partition), change /dev/sda. In most cases, just leave this as-is.


GRUB should be re-instated on disk. You can now simply close your terminal, reboot the machine safely and everything should be back to normal.

Speed up your system by avoiding the swap file

Most modern operating systems are capable of using a file or partition known as a swap or paging file. Most Linux distributions will also install one for you by default. This file is used to extend the amount of available RAM by writing some of it to your hard drive.

There's just one problem: hard drives are slow. We can't fix that problem yet, but we can avoid it. The Linux kernel provides a tweakable setting that controls how often the swap file is used, called swappiness. A swappiness setting of zero means that the disk will be avoided unless absolutely necessary (you run out of memory), while a swappiness setting of 100 means that programs will be swapped to disk almost instantly.

My Ubuntu system comes with a default of 60, meaning that the swap file will be used fairly often if the memory usage is around half of my RAM. You can check your own system's swappiness value by running:

cat /proc/sys/vm/swappiness

My HDD is insanely slow and I have 2 GB of RAM, so I'd like to turn that down to 10 or 15. The swap file will then only be used when my RAM usage is around 80 or 90 percent. To change the system swappiness value, open /etc/sysctl.conf as root. Then, change or add this line to the file:

vm.swappiness = 15

Reboot for the change to take effect. You can also change the value while your system is still running:

sysctl vm.swappiness=15

However, you won't get the full effect of rebooting because there is probably already memory stored in swap that won't instantly be moved out.

Update: Readers have noted that you can clear your swap by running swapoff -a and then swapon -a as root instead of rebooting to achieve the same effect.

Generating Website Statistics With Piwik, An Open-Source, Google Analytics-Like Web Analytics Tool - Page 2

Now fill in a user name for the Piwik administrator (e.g. admin), a password for that user, and the email address of that user. This is the username and password that you'll need later on to log into Piwik:














You can configure Piwik to generate reports for multiple web sites later on, but during the installation, we configure Piwik for our first (and maybe only?) web site. Fill in a name for that web site and its URL:














Afterwards, Piwik will display a Javascript code for that web site. Copy it and paste it right above the tag of all pages belonging to the web site that you've configured in the last screen (www.example.com):














Click on Next afterwards:

The installation is now finished. Click on Continue to Piwik:





3 Using Piwik

Now log in with the account you've created during the installation:



This is the Piwik Dashboard (in my example it's quite empty, but on a real-life system, you should see quite a lot statistics after some time):

You can manage Piwik by clicking on the Settings link in the upper right corner. Here you can enable or disable Piwik plugins,...

..., manage users and access permissions,...


... and add further web sites (you will get a unique Javascript code for each web site):


4 High-Traffic Web Sites

The Piwik reports are generated in real-time which can make the Piwik web interface a little bit slow on high-traffic web sites. Therefore you should set up a cron job (as described on http://piwik.org/docs/setup-auto-archiving/) that generates the reports once a day - the Piwik interface should then react faster again:

crontab -e

MAILTO="falko@example.com"
5 0 * * * www-data /var/www/example.com/web/piwik/misc/cron/archive.sh

(This generates the reports each day at 00:05h. Make sure you use the correct user name for the web server. On Debian/Ubuntu, it's www-data, on Fedora/CentOS, it's apache.)

Make the /var/www/example.com/web/piwik/misc/cron/archive.sh file executable:

chmod 755 /var/www/example.com/web/piwik/misc/cron/archive.sh

Then run it manually to see if it throws any errors:

/var/www/example.com/web/piwik/misc/cron/archive.sh

If you see something like this...

[root@server1 cron]# /var/www/example.com/web/piwik/misc/cron/archive.sh
/var/www/example.com/web/piwik/misc/cron/archive.sh: line 20: /usr/bin/php5: No such file or directory
[root@server1 cron]#

... run...

which php

... to find out where PHP is located...

[root@server1 cron]# which php
/usr/bin/php
[root@server1 cron]#

... and edit /var/www/example.com/web/piwik/misc/cron/archive.sh:

vi /var/www/example.com/web/piwik/misc/cron/archive.sh

Change PHP_BIN; also adjust the PIWIK_PATH variable:

[...]
PHP_BIN=/usr/bin/php
PIWIK_PATH=/var/www/example.com/web/piwik/index.php
[...]

Then run

/var/www/example.com/web/piwik/misc/cron/archive.sh

again. It shouldn't throw any errors anymore.