Monday, January 5, 2009

How to install the most mac-like dock in Ubuntu.

Introduction

Cairo-Dock is an animated application launch bar for the desktop, comparable to the dock in Mac OS X or Rocket Dock (for Windows).

It is compatible with Compiz-Fusion, Beryl, Compiz and Xcompmgr, but it can also run without a composite manager (using fake transparency). Cairo-Dock can run under GNOME, KDE and XFCE.

This page only describes how to install Cairo-Dock and some basic usage instructions. If you want to know more about configuration and themes you should go to the Cairo-Dock website and read this tutorial. The site is mostly in French, but the wiki has a complete English section and don't be afraid to ask questions or report bugs in the forum.

Installation

The project is split in to two parts: the dock itself and the plug-ins. Only the installation of the dock is explained, but installing the plug-ins is the same, just make sure you install the plug-ins after the dock.

The config file will not be overwritten during updates as Cairo-Dock is capable of inserting the missing fields if any without losing your previous settings.

Please note that, although Cairo-Dock is listed in the Universe repository since Ubuntu 8.10 (Intrepid Ibex) and can be installed using Synaptic Package Manager, it is recommended to install Cairo-Dock using one of the methods described below to get the most up-to-date and stable version of Cairo-Dock.

From the Repository (Stable)

This is only for Ubuntu 7.10 (Gutsy Gibbon) 32 bit, Ubuntu 8.04 (Hardy Heron) 32/64bit and Ubuntu 8.10 (Intrepid Ibex) 32/64bit.

To add the Cairo-Dock repository to your sources open the sources.list file:

sudo gedit /etc/apt/sources.list

and add the appropriate repository to the end of the file:

deb http://repository.cairo-dock.org/ubuntu intrepid cairo-dock

deb http://repository.cairo-dock.org/ubuntu hardy cairo-dock

deb http://repository.cairo-dock.org/ubuntu gutsy cairo-dock

The signed GPG key for identification of the repository is:

wget -q http://repository.cairo-dock.org/ubuntu/cairo-dock.gpg -O- | sudo apt-key add -

Then, to install Cairo-Dock, issue these two commands in the terminal:

sudo apt-get update
sudo apt-get install cairo-dock cairo-dock-plug-ins

There are no repositories available for releases older than Ubuntu 7.10 (Gutsy Gibbon). So, if you want Cairo-Dock for an older release, you must compile it or download the package.

From a .deb Package (Stable)

If you can't install Cairo-Dock from the repository, you can download the .deb package from BerliOS. But you first need to install the following packages:

sudo apt-get install libcairo2 librsvg2-2 libglitz1 libglitz-glx1

Then, download the package here.

Open the terminal, navigate to the directory which you downloaded the .deb package to (e.g. cd ~/Desktop) and issue the following commands (NB: Ensure that you have typed in the correct version number):

sudo dpkg -i cairo-dock_v1.6.3.1_i686.deb

and then:

sudo apt-get -f install

Done. You can type cairo-dock in terminal to launch and configure the dock.

By Compiling it (Stable)

First you must install the following packages:

sudo apt-get install build-essential libcairo2-dev libgtk2.0-dev librsvg2-dev libglitz1-dev libcairo2 librsvg2-2 libglitz1 libglitz-glx1 libglitz-glx1-dev m4 autotools-dev pkg-config libtool

Then, download the tar.bz2 package from BerliOS. Open the terminal and navigate to the download directory and type:

autoreconf -isvf
./configure –prefix=/usr
make
sudo make install

By Compiling it With a Script Using the Subversion (Unstable)

" src="https://help.ubuntu.com/htdocs/ubuntunew/img/attention.png" title="" height="15" width="15"> PLEASE DON'T USE THIS VERSION OF CAIRO-DOCK IF YOU DON'T KNOW WHAT YOU'RE DOING " src="https://help.ubuntu.com/htdocs/ubuntunew/img/attention.png" title="" height="15" width="15">

If you want to try the newest version of Cairo-Dock (not in the repository because it's not completely stable), you can use the SVN. But be aware that this version is potentially unstable and there are updates everyday. Use this version only if you know what you're doing, it is also preferable to know how Cairo-Dock works to be able to use the SVN.

A script has been written to compile the SVN version of Cairo-Dock easily. So, you just have to create a directory where the script will be installed in, download the script and launch it:

Open a terminal, and create a new directory:

mkdir /cairo-dock_svn
cd /cairo-dock_svn

Then get the script, make it executable and launch it:

wget http://cairo-dock.vef.fr/cairo-dock_svn.sh
chmod u+x cairo-dock_svn.sh
./cairo-dock_svn.sh

It will ask for the SVN password: JUST PRESS ENTER.

To finish, enter your own password when prompted by the script in order to proceed with to the installation.

A line will appear after the installation of each module and a final message will appear indicating that everything went well. If not, consult the log.txt file in the directory you have created at the beginning. Look at the end to locate the problem, then post it in the forum.

What is installed?

Cairo-Dock stores your launchers and your parameters in a hidden directory, ~/.config/cairo-dock

Also, binaries are in /usr/bin and data (including the default themes) in /usr/share

First Launch

If you installed Cairo-Dock from the packages, there should be a launcher in the applications menu, under the System Tools sub-menu. If there isn't a launcher there, just press Alt+F2 and type in cairo-dock. To enable backtraces on launch (sometimes useful if a problem occurs), open a terminal and type cairo-dock & disown and press enter.

On first launch, Cairo-Dock will configure itself and will offer you a list of themes to choose from. This allows you to have a fully functional dock immediately. You will have to move the mouse cursor to the bottom of the screen to see the dock if auto-hide has been enabled. This depends on the theme you chose at launch.

If you want to use another theme, right click on the dock and select Cairo-Dock > Manage Themes. To configure the dock's settings, right click the dock and select Cairo-Dock > Configure.

External Links


Saturday, December 27, 2008

Backing Up in Ubuntu

One of the most frequent questions on the forums is "How do I back up in Ubuntu?"

Before I started using Ubuntu, I thought the best method was just to copy and paste files using the file manager (that's one way, of course, but it has its limitations). I'm going to recommend a few popular methods. This list isn't comprehensive--it just gives you some places to start. You can always investigate further once you're more comfortable with Ubuntu.

Backing Up Personal Files
rsync is what I use for backing up personal files. I used to copy and paste files using the file manager, but that would involve taking about an hour to back up all my music and erase all the old copies. rsync gives me the ability to copy over only the files that have been modified or added since the last time I backed up. Now, backups take me only about fifteen seconds a week.

The most basic way to use rsync is like this (command goes into the terminal):

rsync -av /path/to/source/directory /path/to/target/directory
For example, let's say your username is alice and you wanted to back up your home directory to your external hard drive that mounts at /media/usbdrive, you would use the command
rsync -av /home/alice /media/usbdrive

If rsync doesn't seem sophisticated enough for you, you can type

man rsync
to find more options than just -av. You can also explore rdiff-backup, which allows you to store (and restore) different date-stamped versions of the same file without taking up too much extra space. And, if you hate the command-line, try installing grsync, which is the graphical frontend to rsync. Here are some screenshots of grsync in action.

Backing Up Whole Installations
Not that System Restore is foolproof in Windows, but it's still a nice feature... at least in theory. Right now, Ubuntu doesn't have anything like System Restore. So if you're going to do any kind of experimental stuff with Ubuntu (for example, installing Beryl or Compiz), it's best to back up your system first.

PartImage is a nice little program that creates an image of your entire partition. You'll need a live CD for this, and you can find more details here about how to use it.

tar is an archiving command, but it can also be used to archive your entire system into one little zipped up bundle. Someone on the Ubuntu Forums wrote a nice little HowTo on backing up and restoring your entire installation using tar.

ddrescue allows you to copy a partition byte for byte to another partition or to a .img file. It's mainly designed for recovery of a crashed drive, but you can also use it as a way to back up (a non-graphical PartImage of sorts). The trick is that the name of the package is ddrescue in the repositories, but the command to use it is dd_rescue. So if you wanted to copy /dev/hda1 to /dev/sda1, you would type in the terminal:

dd_rescue /dev/hda1 /dev/sda1
Keep in mind that /dev/hda1 cannot be in use or mounted. If that requires you using a live CD, then so be it. You can also, if you don't want to erase /dev/sda1 completely, ddrescue to an image file and then mount the image to get the files off it:
dd_rescue /dev/hda1 /dev/sda1/hda1backup.img
sudo mkdir /recovery sudo mount /dev/sda1/hda1backup.img /recovery

How to install MP3 playback in Ubuntu

Assuming you're using Ubuntu 7.04 or later, the easiest way to install MP3 playback in Ubuntu is to just try to play an MP3 file. So start off by finding an MP3 file and then double-click it.

If you're using Ubuntu 6.10 or earlier, the community documentation will show you other methods for installing MP3 playback.

 
Once you do that, Totem will try to play the MP3 file and then realize you do not have the necessary codecs to play MP3 files. It'll ask if you want to search for the appropriate codec. Click onYes to continue.

 
You'll then see a list of possible codecs to install. As you can see, the first one shown enables MP3 playback. So check (or tick) the box next to Gstreamer extra plugins.

 
If you haven't already enabled extra repositories, you'll be asked if you want to install community-maintained software. This will be necessary in order to install the codecs. If you don't know what a repository is, read this overview of software installation in Ubuntu.

 
Wait for the package information to download. Ubuntu is checking to see what software packages and versions are currently available in the community-maintained software repositories.

Once that finishes, try once again to check (or tick) the box next to Gstreamer extra plugins.

 
You'll be warned that this is restricted software and asked if you want to continue. I think this is a generic warning for all non-free software (by the way, non-free refers to freedom, not money). As far as I know, MP3 codecs are legal for users to install in all countries. If you have qualms about installing the necessary codecs, read more about MP3 at Wikipedia. Otherwise, click OK to proceed.

 
Click Apply to install the codecs. Then, just wait for them to install.

 
First, Ubuntu will download the installer files for the codecs.

 
Then, Ubuntu will actually install the codecs.

 
Once the changes have been applied, click Close, and your MP3 should start playing in Totem.


Mounting Windows Partitions in Ubuntu

Ubuntu will automatically mount external drives, but for some reason it will not automatically mount internal drives. So this will show you how to mount (or make available for use) internal NTFS-formatted (i.e., Windows) drives in Ubuntu.

Mount Windows through the file browser

 
If you have your file browser window open, you should be able to double-click on the drive in the sidebar to mount it (or make it available for use). Unfortunately, at least as of Ubuntu 8.04, the drive is identified by its size (in this case, 2.0 GB), so that's how you'll have to figure out which one is the drive you're looking for.

You may have to authenticate the first time, but if you check (or tick) the Remember authorization box, you shouldn't be bothered for it again.

Mount Windows through the menu

If you don't already have your file browser open, you can also mount Windows drives through the menu.

 
Go to Places and find your drive (again, by its size).

 
Whether you mount the drive through the file browser sidebar or through the menu, you can unmount the drive by right-clicking it and selecting Unmount Volume.

Install NTFS Config

But let's say you don't want to manually mount the Windows drive every time you boot up Ubuntu. If you want it permanently mounted, a little utility called NTFS Config can help you.

 
To install it, go to Applications and select Add/Remove

 
Make sure All available applications is showing.

 
Search for ntfs, check (or tick) the box next to NTFS Configuration Tool. Then click Apply Changes in the bottom right of the window and confirm by clicking Apply in the resulting dialogue box.

 
Enter your password when asked.

 
Wait for NTFS Config to install.

Mount an NTFS drive permanently

Now that NTFS Config is installed, let's use it.

 
Go to Applications > System Tools > NTFS Configuration Tool

 
Check (or tick) the box next to the drive (here called /dev/sdb1—what Windows would probably called D:\)

 
Click in the mount point box to name a folder you use to access the Windows drive once it's mounted.

 
If you want it to be mounted at /media/windows, type

windows
Do not type /media/windows or you'll get an error message.

 
When you're done, click Apply

 
Check (or tick) the appropriate boxes, and then click OK

How to install Nvidia drivers in Ubuntu

Ubuntu doesn't include Nvidia drivers in a default installation for a number of reasons. You can read more about Ubuntu's philosophical approach to free and non-free (think freedom, not cost) software and firmware in Mark Shuttleworth's blog. Mark Shuttleworth is Ubuntu's founder and currently its primary funder. New users tend to favor immediate functionality over long-term ideological gains, so if you have an Nvidia graphics card, you may want to install the Nvidia drivers for it.

 
First, go to System > Administration > Hardware Drivers

 
You'll then see that Nvidia drivers are not in use. Check (or tick) the box underneath Enabled to enable the drivers.

 
You'll then be asked (after a brief explanation about desktop effects) if you want to enable the driver. Click Enable Driver.

 
Wait for the installer file to download.

 
Wait for the drivers to be installed.

 
Then, click Close once the changes have been applied.

 
You'll then see that the drivers are enabled and will be available for use upon a reboot.

Editing Files that Belong to Root

If you have experience with Linux but are new to Ubuntu

If you're already familiar with Linux and just wonder why Ubuntu/Kubuntu uses sudo instead of root, this page isn't for you. You're really looking forhttps://help.ubuntu.com/community/RootSudo. It has a full explanation of why Ubuntu uses sudo instead of root and what the advantages and disadvantages of that choice are.

If you are new to Linux and Ubuntu

This page is for people who are new to Linux and Ubuntu/Kubuntu and want to know what the deal is with file permissions.

What you may be used to

My guess is you're probably a typical ex-Windows user (as I was), used to running as Administrator and being able to edit pretty much any file you want—even system files, even the registry—at will, very little stopping you... maybe the occasional "read-only" file that you can just make read/write by checking a little box in the Properties dialogue.

You may also never have installed and configured an operating system before (especially if you bought a computer with Windows preinstalled for you).

The need to edit system files

Some in the Linux camp will say "you shouldn't have to edit such-and-such a file." That's simply not true. Most Linux users aren't just users—they have to install and configure stuff themselves (as Dell or HP won't do it for them), usually configuration files and system files that normal users don't have to touch (say, in order to adjust the possible screen resolutions or install new software). You do have to edit these files from time to time. It's in your best security interests to have to go out of your way to edit them, but you should still be able to occasionally edit, move, copy, and rename files that only an Administrator (or Root) can modify.

Frequently edited system files

In Linux, the only files a user can modify are the ones in her home directory. For example, if the user's name is Bronte, the files she can modify live in the /home/bronte/ folder. Anything outside the /home/bronte folder she will not be able to modify. Some of the top files new installers need to modify are:

/etc/fstab (making hard drives and partitions viewable as folders)
/boot/grub/menu.lst (controlling the boot menu that lets you choose which operating system to boot to)
/etc/apt/sources.list (the list of sources from which you can easily install software)
/etc/X11/xorg.conf (screen resolution options, among other things)

and all of these files need Root privileges to modify.

Why do people recommend the command-line?

If you're like a lot of new Linux users, you probably have not yet embraced the command-line. Some people may have told you to "just"
sudo rm -r /usr/share/icons/themename
as if "rm" really means anything to you yet. The fact of the matter is that people recommend command lines because they're easier instructions to give than "Click on that button that looks like a purple arrow. A new dialogue will pop up with three choices. Pick the left-most choice."

Making system-wide changes graphically

Most new Linux users just want to be able to click and drag and drop. So one of these commands should be your new best friends...

If you're using Ubuntu (Gnome), press Alt-F2 and type

gksudo nautilus

If you're using Kubuntu (KDE), press Alt-F2 and type

kdesu konqueror

If you're using Xubuntu (XFCE), press Alt-F2 and type

gksudo thunar

What does sudo do?

What do these commands do? They allow you to generally operate as a regular user but have a temporary window within your user account to operate as Root (just within the Nautilus or Konqueror window you've opened). Once you close the Root window, it's just as if you're a user again. You don't have to log out of user, log in as Root, make changes, log out of Root, and log back in as user again. You can be Root and user simultaneously.

Mac OS X users may be familiar with this security model (Mac uses sudo, believe it or not!). As a Mac user, you operate as a user. When you want to install something, a dialogue box comes up asking for your administrator (sudo/root) password. Once it's installed, you're a user again.

So how does this work? Let's say you want to edit the /etc/apt/sources.list file. If you want to do it command-line style, you'd

sudo nano /etc/apt/sources.list
and then use Nano to edit it. If you do it the graphical way we've been talking about, you'd run the gksudo nautilus or kdesu konqueror command and a file browser window will pop up (with Root/administrator privileges just in that window). You'd browse to /etc/apt and find the file called sources.list. You'd click to open it, edit it, close it, and close the browser window, and it would be done.

Final recommendations

If you find that (especially right after the initial Ubuntu/Kubuntu install) that you're making a lot of changes as Root, create a launcher with the command gksudo nautilus or kdesu konqueror. Then, when you click on that launcher, you can type in your password, make root changes, and then close the window and be a user again.

Warning: Always make backup copies of any configuration files you modify before modifying them.

Enabling Extra Repositories

Why enable extra repositories?

Repositories contain software. Extra repositories give you extra software. Some people like that. If you need help installing software, check out this page.

Enabling extra repositories the point-and-click way

Many new users are intimidated by the terminal and do not even want to copy and paste commands. If you do not want libdvdcss2 (commercial DVD playback—legality questionable, depending on your country of residence) or w32codecs (Windows codecs—legality extremely questionable, regardless of where you live), the vast majority of your software needs can be met in a very simple point-and-click way—by enabling extra software sources using the GUI (graphical user interface).

 
First, go to System > Administration > Software Sources. In 6.06, it may be called Software Properties. In 6.10 and higher, the name changed to Software Sources.

 
A dialogue will appear that shows you which repositories are currently enabled. The ones with the checked (or ticked) boxes are enabled. The others are not enabled.

 
Check (or tick) the unchecked (or unticked) boxes. You may also want to choose to use a local server instead of the main server. I chose Server for United States, since I live in the United States. You may also want to uncheck (or untick) the CD-ROM/DVD source. Otherwise, every time you try to install software, you may be prompted to insert the Ubuntu installer disc. If you have a working internet connection, you will want to use the online servers for software installation.

 
Once you do this, you'll be asked to reload the repository information. This allows Ubuntu to see what software is newly available to you. Click Reload to continue.

 
Then, wait for the information to be reloaded. Once that's done, the window will disappear, and you'll be able to use apt-get, Synaptic, or Add/Remove to install new programs. More information about software installation can be found here.

Adding a key for Medibuntu

Paste this command into the terminal so you don't get a key error when you see what new software is available:

wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add -

Backing up and opening the repositories list file

Open up a terminal and type in

If you're using Ubuntu (Gnome):

sudo mv /etc/apt/sources.list /etc/apt/sources.list_backup
gksudo gedit /etc/apt/sources.list

If you're using Kubuntu (KDE):

sudo mv /etc/apt/sources.list /etc/apt/sources.list_backup
kdesu kwrite /etc/apt/sources.list

If you're using Xubuntu (XFCE):

sudo mv /etc/apt/sources.list /etc/apt/sources.list_backup
gksudo mousepad /etc/apt/sources.list

Updating the list for Intrepid

Then copy and paste the following into the (currently empty) text file if you're using Intrepid (8.10):

deb http://archive.canonical.com/ubuntu intrepid partner

deb http://archive.ubuntu.com/ubuntu/ intrepid main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu/ intrepid-security universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu/ intrepid-updates universe main multiverse restricted

deb http://packages.medibuntu.org/ intrepid free non-free

Updating the list for Hardy

Then copy and paste the following into the (currently empty) text file if you're using Hardy (8.04):

deb http://archive.canonical.com/ubuntu hardy partner

deb http://archive.ubuntu.com/ubuntu/ hardy main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu/ hardy-security universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe main multiverse restricted

deb http://packages.medibuntu.org/ hardy free non-free

Updating the list for 7.10 (Gutsy)

Then copy and paste the following into the (currently empty) text file if you're using 7.10 (Gutsy):

## Uncomment the following two lines to fetch updated software from the network
deb http://archive.ubuntu.com/ubuntu gutsy main restricted
deb-src http://archive.ubuntu.com/ubuntu gutsy main restricted

## Uncomment the following two lines to fetch major bug fix updates produced 
## after the final release of the distribution.
deb http://archive.ubuntu.com/ubuntu gutsy-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu gutsy-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://archive.ubuntu.com/ubuntu gutsy universe
deb-src http://archive.ubuntu.com/ubuntu gutsy universe

deb http://security.ubuntu.com/ubuntu gutsy-security main restricted
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted

deb http://security.ubuntu.com/ubuntu gutsy-security universe
deb-src http://security.ubuntu.com/ubuntu gutsy-security universe

deb http://archive.ubuntu.com/ubuntu gutsy multiverse
deb-src http://archive.ubuntu.com/ubuntu gutsy multiverse

deb http://archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu gutsy partner

deb http://packages.medibuntu.org/ gutsy free non-free

Updating the list for 6.06 (Dapper)

Then copy and paste the following into the (currently empty) text file if you're using Dapper (6.06):

## Uncomment the following two lines to fetch updated software from the network
deb http://archive.ubuntu.com/ubuntu dapper main restricted
deb-src http://archive.ubuntu.com/ubuntu dapper main restricted

## Uncomment the following two lines to fetch major bug fix updates produced
## after the final release of the distribution.
deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu dapper-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://archive.ubuntu.com/ubuntu dapper universe
deb-src http://archive.ubuntu.com/ubuntu dapper universe

deb http://security.ubuntu.com/ubuntu dapper-security main restricted
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted

deb http://security.ubuntu.com/ubuntu dapper-security universe
deb-src http://security.ubuntu.com/ubuntu dapper-security universe

deb http://archive.ubuntu.com/ubuntu dapper multiverse
deb-src http://archive.ubuntu.com/ubuntu dapper multiverse

deb http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu dapper-commercial main

deb http://packages.medibuntu.org/ dapper free non-free

Making the changes take effect

Save your file and close kwrite, mousepad, or gedit. Lastly, and most importantly, paste this into the terminal
sudo apt-get update