[HOWTO] Enable Ubuntu-like “sudo” in Debian Squeeze

In Ubuntu, when you need to run a command as root, you just have to run the command with a preceding “sudo” i.e.

sudo command-to-run

. However, in Debian (and many other Linux) it is may not be set as such by default. To set it as default and to allow the normal user to execute the command as root, just follow the following instructions:

Install Sudo
To install sudo, just run the following commands:

su
apt-get install sudo gksu

Add yourself to Sudoers list
First to open /etc/sudoers as root in terminal, run the follwing commands:

su
visudo

Now, scroll to the bottom of the file and add the following line:

username ALL=(ALL) ALL

where “username” is the username you use to login to your computer.
Press Ctrl+O followed by ENTER to save /etc/sudoers and you are done.

Hope this helps.

[HOWTO] Install Chromium v9 in Debian Squeeze Testing using Ubuntu PPA

As I mentioned in my previous post, you can install software from Ubuntu Lucid Lynx PPA to Debian Squeeze Testing. Using the same method, Chromium v9 can be installed in Debian Squeeze using the Ubuntu Chromium Daily PPA.

In Synaptic Package Manager, navigate to Settings>Repositories>Third Party Sources and then add the following:

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu lucid main 

Open up the terminal and type in the following as root (type in “su”, press ENTER and enter root password to change to root first or enable sudo in Debian and use sudo instead):

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E5E17B5

[HOWTO] Add Launchpad Ubuntu PPA in Debian Squeeze Testing

I have installed Debian Squeeze Testing replacing Ubuntu 10.10 Maverick Meerkat and miss some applications only available via Launchpad PPAs. Not that they can’t be compiled from their sources or installed by downloading debs, but it would be great if updates were available from update manager like in Ubuntu. So I decided to add some Ubuntu PPAs and they are working fine. So, I decided to share here with the hope that it would be helpful to my readers.

If you want to install a PPA in Squeeze Testing, make sure that the PPA has an entry for Ubuntu 10.04 Lucid Lynx. Not that it will never work with Maverick PPAs, but Lucid is a better choice as Debian Squeeze has package versions more similar to Lucid than Maverick or Natty. Thus, it is a better choice to use Lucid PPAs. Instead of using just the PPA name (for example ppa:tiheum/equinox for Equinox theme PPA) use the deb line for Lucid (eg. deb http://ppa.launchpad.net/tiheum/equinox/ubuntu lucid main ) and add it to /etc/apt/sources.list or Software Sources (or Synaptic>Settings>Repositories>Third Party Source). After adding that, copy the PPA signature (available in “Signing Key” section in PPA page), eg. 1024R/4631BBEA for Equinox Theme PPA. Just use the part after “/” (i.e. 4631BBEA for this example) and use the following command in the terminal to get GPG keys for the PPA:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4631BBEA

Note: If you are not able to sudo, you may either enable it or use su followed by commands instead.
After that, reload the package list and install the package.

This may not work for every program that there is but it works for many. Hope this helps.

[HOWTO] Install pastie in Debian Squeeze/Testing

Pastie is a clipboard manager for gnome with best feature set. It is available in Launchpad PPA for Ubuntu Lucid Lynx and Maverick Meerkat. However, it can be installed in Debian Squeeze/Testing from the same PPA.

To install, just open up Synaptic>Settings>Repositories>Third Party Software and click Add. Add the following line (yes Lucid, not Maverick):

deb http://ppa.launchpad.net/hel-sheep/pastie/ubuntu lucid main

When added, close the Repositories dialog and close Synaptic. Now, open up the terminal and execute the following commands:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE4CA452
sudo apt-get update
sudo apt-get install pastie python-gnome2

Note: If you are not able to sudo, use su followed by commands without “sudo” and it will work.

This should install pastie in your Debian. Have fun.

[HOWTO] Install all the packages installed in one Ubuntu Installation to another

A recent Web Upd8 article featured a tool called Meta Backup, which unfortunately fails to work as expected unless all the repositories are already configured and there are no orphan packages (not sure of the term, but I’m referring to those that are listed in Synaptic>Origin>Local) .

I created a simple script which can help achieve what Meta Backup wishes to achieve, which is to install the same set of packages in another computer running same version of Ubuntu. Please keep backup of your /etc/apt in both computers. I am not responsible for any harm done to you or your PC by using this script. Having said that, here it is:

pkgbkp-0.04.tar.gz

Extract it and run “packagebkp” from the terminal as root.

[HOWTO] Install the latest version of Shutter screenshot tool in Ubuntu

I am using Shutter screenshot tool as default screenshot tool. I installed it in my Ubuntu 10.10 Maverick Meerkat from the Shutter Team official PPA. The latest available version in that PPA is 0.86~ppa4. The PPA has not been updated for quite some time now. I wanted some bugs to be fixed and when I saw bug pages, they had already been fixed in latest revision. So, I decided to install it.

To do so, I went through the following process.
Install Dependencies

sudo apt-get install bzr libgtk2-unique-perl libimage-info-perl libimage-exiftool-perl

Get latest Shutter

bzr branch lp:shutter

Install

cd shutter
sudo cp bin/* /usr/bin/
sudo cp -R share/* /usr/share/

Now quit Shutter if you have it opened and launch it again.

[HOWTO] Change Ubuntu Pink/Purple Plymouth Boot screen to any color you like

I am using Ubuntu 10.10 Maverick Meerkat and have been using the default theme for quite some time. I was bored with the default boot screen and decided to change it. If you don’t like the purple color of Ubuntu, you can easily change the Desktop theme and wallpaper, but the Pink/Purple Ubuntu Plymouth boot splash is a little difficult to get rid of. You can install other available boot splash by installing other packages, but I like the default boot screen, and just wanted to change its color. To do that, I just cloned the boot screen and made some changes so that it looks like the following.

Here is how I did it. Fire up the terminal and get ready.

Make a copy of the plymouth theme:

sudo cp -R /lib/plymouth/themes/ubuntu-logo /lib/plymouth/themes/ubuntu-logo-nonpink

Edit the name and location information:

sudo gedit /lib/plymouth/themes/ubuntu-logo-nonpink/ubuntu-logo.plymouth

I changed the name to “Ubuntu Logo NonPink” and changed the location of ImageDir and ScriptFile so that it looks like the following:

[Plymouth Theme]
Name=Ubuntu Logo NonPink
Description=A theme that features a blank background with a logo.
ModuleName=script

[script]

ImageDir=/lib/plymouth/themes/ubuntu-logo-nonpink ScriptFile=/lib/plymouth/themes/ubuntu-logo-nonpink/ubuntu-logo.script

Save the file and exit.

Edit the color in script:

sudo gedit /lib/plymouth/themes/ubuntu-logo-nonpink/ubuntu-logo.script

Search for “Window.SetBackgroundTopColor” (without quotes) and change the 2 lines so that they look like the following:

Window.SetBackgroundTopColor (0.85, 0.85, 0.85);     # Nice colour on top of the screen fading to
Window.SetBackgroundBottomColor (0.75, 0.75, 0.75);  # an equally nice colour on the bottom

I have chosen these colors: #DADADA RGB: 217, 217, 217 and #C0C0C0 RGB: 192,192,192
You can choose any color you like. Find the RGB using gcolor2 (install this if you don’t have it installed) of the desired color and divide the RGB values with 256 to get the values to use.
Save the file and exit.

Edit the Ubuntu Logo and other images:
Install Gimp if you haven’t already done so and run the following:

 sudo gimp /lib/plymouth/themes/ubuntu-logo-nonpink/ubuntu_logo.png

The white logo may not look good with the background above. You may change the color however you like. For my selection of background color, black would look great, so I just inverted colors (Colors>Invert).
Once done editing the image, save the file and quit Gimp.
Now, change the progress dots:

sudo gimp /lib/plymouth/themes/ubuntu-logo-nonpink/progress_dot_on.png
sudo gimp /lib/plymouth/themes/ubuntu-logo-nonpink/progress_dot_off.png

I just changed the mode to RGB (Image>Mode>RGB) and desaturated the image (Colors>Desaturate) and got nice gray dot for progress_dot_on. I made no changes to progress_dot_off.

Install the theme:
The theme is ready and can be installed using the following command:

sudo update-alternatives --install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/ubuntu-logo-nonpink/ubuntu-logo.plymouth 100

Set the theme as default:
Once installed, it can be set as default using the command:

sudo update-alternatives --config default.plymouth

The above command lists all the installed themes as shown:

There are 2 choices for the alternative default.plymouth (providing /lib/plymouth/themes/default.plymouth).

  Selection    Path                                                            Priority   Status
------------------------------------------------------------
  0            /lib/plymouth/themes/ubuntu-logo-nonpink/ubuntu-logo.plymouth    100       manual mode
* 1            /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth            100       manual mode

Press enter to keep the current choice[*], or type selection number:

Enter the number corresponding to the theme you want to use. In my case, it is “0”. So I entered 0 and pressed ENTER. In your case, it may be different.

Update Initial Boot Image
Now, you will need to run one more command to update the boot images and you are done.

sudo update-initramfs -u

Reboot and see the changed boot screen.

[HOWTO] Display daily/weekly/monthly Internet Traffic totals on the Desktop using Conky

To be able to display weekly/monthly traffic totals, you will need to install and configure vnstat first. After that, you will be able to monitor traffic totals from command line using the following command in the terminal:

vnstat

To view daily traffic totals, you can use the command:

vnstat -d

To view weekly traffic totals, use the command:

vnstat -w

Similarly, to view monthly totals, use the command:

vnstat -m

If you have an interface other than eth0, you will need to specify it via command line option “-i”, so if your interface is called ppp0, the above commands will respectively be as follows:

vnstat -d -i ppp0
vnstat -w -i ppp0
vnstat -m -i ppp0

If you already use conky, you can add the following lines to your ~/.conkyrc file:

${color slate grey}Internet 
${color slate grey}Up:${color}${upspeed eth0}k/s
${upspeedgraph eth0 20,140 000000 ffffff}
${color slate grey}Today: ${color} ${exec vnstat -d|grep `date +%m/%d/%y`|awk '{print $5 $6}'}
${color slate grey}Week:  ${color} ${exec vnstat -w|grep 'current week'|awk '{print $6 $7}'}
${color slate grey}Month: ${color} ${exec vnstat -m -i eth0|grep `date | cut -d' ' -f2`|awk '{print $6 $7}'}

${color slate grey}Down:${color}${downspeed eth0}k/s${color slate grey} 
${downspeedgraph eth0 20,140 000000 ffffff}
${color slate grey}Today: ${color} ${exec vnstat -d|grep `date +%m/%d/%y`|awk '{print $2 $3}'}
${color slate grey}Week:  ${color} ${exec vnstat -w|grep 'current week'|awk '{print $3 $4}'}
${color slate grey}Month: ${color} ${exec vnstat -m -i eth0|grep `date | cut -d' ' -f2`|awk '{print $3 $4}'}

You should change the colors and position to match with the rest of the conky configuration.

If you are interested in my .conkyrc, here it is:

# Conkyrc X.v0.5.3 
# exudus @ http://www.localh0st.net
#
# A comprehensive conky script, configured for use on
# Ubuntu / Debian Gnome
# 
# Modified by _khAttAm_ @ http://www.khattam.info
# Uses an external applications : sensors, vnstat. So make sure they are installed 
# and configured
# Assumes the internet connection is on eth0, change it to match your system
# 

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
background no

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# fiddle with window
use_spacer right
use_xft yes

# Update interval in seconds
update_interval 2.0

# Minimum size of text area
minimum_size 150 5
maximum_width 300

# Draw shades?
draw_shades yes

# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
draw_graph_borders yes

uppercase no # set to yes if you want all text to be in uppercase

# Stippled borders?
stippled_borders 1

# border margins
# border_margin 1

# border width
border_width 1

# Default colors and also border colors, grey90 == #e5e5e5
default_color 4D4D4D
default_shade_color black
default_outline_color grey90

own_window_colour brown
own_window_transparent yes

# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
#alignment bottom_left
alignment bottom_right

# Gap between borders of screen and text
gap_x 10
gap_y 50


# stuff after 'TEXT' will be formatted on screen

override_utf8_locale yes
xftfont Ubuntu:size=8
xftalpha 0.8



TEXT
${color slate grey}${alignc}$sysname $kernel$color
${color slate grey}UpTime: ${color}${alignr}$uptime

${color slate grey}CPU1${color}${alignr}${exec sensors | grep -i Core\ 0|cut -d' ' -f8}   ${cpu cpu0}%
${color light grey}${cpubar 4 cpu0}
${color slate grey}CPU2${color}${alignr}${exec sensors | grep -i Core\ 1|cut -d' ' -f8}   ${cpu cpu1}%
${color light grey}${cpubar 4 cpu1}
${color slate grey}FAN${color}${alignr}${exec sensors | grep -i fan1|cut -d' ' -f8} RPM

${color slate grey}Load: ${color}$loadavg
${color slate grey}Processes: ${color}$processes  
${color slate grey}Running: ${color}$running_processes

${color}${font}${color slate grey}Highest CPU:
${color #ddaa00} ${top name 1}${alignr}${top cpu 1}
${color lightgrey} ${top name 2}${alignr}${top cpu 2}
${color lightgrey} ${top name 3}${alignr}${top cpu 3}
${color lightgrey} ${top name 4}${alignr}${top cpu 4}

${color}${font}${color slate grey}Highest MEM:
${color #ddaa00} ${top_mem name 1}${alignr}${top_mem mem 1}
${color lightgrey} ${top_mem name 2}${alignr}${top_mem mem 2}
${color lightgrey} ${top_mem name 3}${alignr}${top_mem mem 3}
${color lightgrey} ${top_mem name 4}${alignr}${top_mem mem 4}

${color slate grey}I/O disque :${color lightgrey} $diskio $color
${diskiograph 20,140 000000 ffffff}

${color slate grey}HOME ${color }
${fs_free /home}/${fs_size /home}
${fs_bar 3,140 /home}

${color slate grey}MEM:
${color } $memperc% $mem/$memmax
${membar 3,140}
${color slate grey}SWAP:
${color } $swapperc% $swap/$swapmax
${swapbar 3,140}
${color slate grey}Internet 
${color slate grey}Up:${color}${upspeed eth0}k/s
${upspeedgraph eth0 20,140 000000 ffffff}
${color slate grey}Today: ${color} ${exec vnstat -d|grep `date +%m/%d/%y`|awk '{print $5 $6}'}
${color slate grey}Week:  ${color} ${exec vnstat -w|grep 'current week'|awk '{print $6 $7}'}
${color slate grey}Month: ${color} ${exec vnstat -m -i eth0|grep `date | cut -d' ' -f2`|awk '{print $6 $7}'}

${color slate grey}Down:${color}${downspeed eth0}k/s${color slate grey} 
${downspeedgraph eth0 20,140 000000 ffffff}
${color slate grey}Today: ${color} ${exec vnstat -d|grep `date +%m/%d/%y`|awk '{print $2 $3}'}
${color slate grey}Week:  ${color} ${exec vnstat -w|grep 'current week'|awk '{print $3 $4}'}
${color slate grey}Month: ${color} ${exec vnstat -m -i eth0|grep `date | cut -d' ' -f2`|awk '{print $3 $4}'}
 
${color slate grey}IP (eth0):${color} ${addr eth0}

[SOLVED] vnstat: “Zero database found, exiting”

I am using Ubuntu 10.10 Maverick Meerkat and I installed vnstat v1.10-1 from the terminal using apt-get:

sudo apt-get install vnstat

The installation ended with an error:

* Starting vnStat daemon vnstatd Zero database found, exiting.
[fail]

When I tried to monitor my traffic using the following command:

vnstat -m -i eth0

I got the following error:

Error: Unable to read database “/var/lib/vnstat/eth0”.

Then I ran vnstat from the command line and got the following:

No database found, nothing to do. Use –help for help.
A new database can be created with the following command:

vnstat -u -i eth0
Replace ‘eth0’ with the interface that should be monitored.
The following interfaces are currently available:

lo eth0 vboxnet0

Since my computer is using eth0, I created a database for eth0 using the following command:

sudo vnstat -u -i eth0

I got the following output:

Error: Unable to read database “/var/lib/vnstat/eth0”.

Info: -> A new database has been created.

Now, I am able to monitor my Internet traffic using vnstat.

[HOWTO] Install Game Of Life Wallpaper in Ubuntu

Game of Life Wallpaper is an ever changing wallpaper which is supposed to simulate Conways Game of Life. It was featured in OMG Ubuntu, recently.

Here is how it can be installed in Ubuntu.

Install dependencies
Open up the terminal and run the following to install python-numpy and python-scipy:

sudo apt-get install python-numpy python-scipy

Run the following to install git:

sudo apt-get install git

Download Source Code
Run the following to get the latest source codes:

git clone http://github.com/azizmb/Game-of-Life-Wallpaper.git

Configure and Generate Wallpapers
Now, cd to Game-of-Life-Wallpaper

cd Game-of-Life-Wallpaper

Then, open the configuration files with gedit:

gedit config.py

Find the section “screen resolution” and make necessary changes based on your Desktop resolution. Save and Close gedit and come back to terminal. Now, run gol.py to generate the wallpapers:

python gol.py

Once done, you will see message like this one:

Done! You can now set the wallpaper by selecting ‘/home/username/path/Game-of-Life-Wallpaper/demos/achimsp144_106/achimsp144_106.xml’ as the wallpaper.

Note the part that looks like “/home/username/path/Game-of-Life-Wallpaper/demos/achimsp144_106/achimsp144_106.xml”, and go to Appearance Preferences > Background (Right click on desktop > Change Desktop Background) and then click Add, then navigate to that XML file and set it as Desktop.

Hope this helps.