Install Spotify on Crunchbang 11

Installing Spotify
Next up was to install Spotify, and as I thought, there would be a hiccup due to a missing dependency. When this happens, a simple “apt-get -f install”” usually fixes it, but it turns out I needed an extra file from squeeze as Crunchbang 11 is based on Wheezy the new Debian Stable and Spotify Linux is old.

First I needed to download libssl0.9.8 from HERE and install it:

cd downloads
sudo dpkg -i libssl0.9.8_0.9.8o-4squeeze14_i386.deb

Then I had to add the Spotify Linux repo to my sources list:

sudo vim /etc/apt/sources.list

And add these lines:

## SPOTIFY
deb http://repository.spotify.com stable non-free

Next I imported the gpg key:

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 94558F59

Now I just needed to update and install Spotify

sudo apt-get update
sudo apt-get install spotify-client

Wireless-Only installs with Debian, Crunchbang and Kali Linux – Missing Non-Free Firmware

Wireless Network
I changed my entire network over to wireless and my router is now fixed to the wall, 25 meters away from my office, in my lounge. The wireless from my office reaches ok, and means we have a stronger signal from the lounge where we have our XBMC media center and everybody connects with their smart phones.

Wireless PCI/USB cards and Non-Free Drivers
Due to the fact that some manufacturers won’t release the source code for their drivers (Thank you Broadcom and Ralink!!) we still have a bit of a hard time, even though Linux geniuses have reverse engineered and hacked practically all of them for us so we can load wireless modules from the kernel.

Politics and Freedom
Some distros willingly provide non-free drivers right from the get-go, others are more conservative and stick to Stallmanesque non-free restrictions. Debian does this…. still…. in 2013.


Debian Live Builder
I’ve built my own Debian based distros, and like other distros which are built with this system, mainly Crunchbang and just recently Kali Linux (The New “Debian-Based” Backtrack).

Live Yes – Install No
I recently got a bit of a surprise with some Live installs, as I found that when running both Crunchbang and Kali live, my Ralink wireless USB firmware was loaded and allowed me to connect to the internet, but when I went for the install, at the network configuration step, I was told that the firmware was missing!!

Solution
When this stage happens:
1. Take a picture of the screen on the Debian Installer which tells you which files you need from /lib/firmware. In my case “rt2870.bin” and “rtl8168e-3.fw”.

2. Insert a blank USB Pendrive
3. Reboot the Live CD to get to the Live Session
4. Copy the two needed files from /lib/firmware on the Live CD to the Pendrive
5. Reboot and run the installer

The Debian Live installer will detect the firmware on the Pendrive, load it, and allow you to choose your wireless ESSID and WPA key, and continue the install.

There’s no time like now for the old adage “You learn something new every day”.

May all you fellow wireless-only users, now be able to install any Debian-based distro without being put off by this minor freenoyance.

How to fix Plymouth on Ubuntu 12.10 with Ati and Nvidia proprietary drivers

I was going to do this manually, but after a bit of Googling I came across a script which does the job nicely. I downloaded it, had a look at the code, and once satisfied, ran it. I now have plymouth at boot.

The code courtesy of d0rkye and kyleabaker:

wget http://launchpadlibrarian.net/121675171/fixplymouth
chmod +x fixplymouth
./fixplymouth

Original article found here:
http://www.webupd8.org/2010/10/script-to-fix-ubuntu-plymouth-for.html

Thanks webupdate, d0rkeye and kyleabaker.

Ubuntu 12.10 on AMD64 missing microcode boot error

No Plymouth and Module Load Error:

I don’t get the fancy Plymouth screen at boot, and I get this annoying message;
“failed to load file amd-ucode/microcode_amd.bin”

AMD 64bit Quadcore CPU Microcode Module:

So, first to get this error fixed, then Plymouth later. As i’m using a 64bit AMD Quadcore CPU, I guessed it was a module either failing to load or a non-existent module, and a bit of Googling proved me right.

**Note
In the comments Mathias pointed out that you can install the needed module from the Ubuntu repos, whereas below I provide a step by step manual install. To install it automatically:

sudo apt-get update && sudo apt-get install amd64-microcode

I downloaded and installed the microcode manually from AMD:

http://www.amd64.org/support/microcode.html

First download and add the AMD public key to your keyring and verify the signature:

To import the key (when downloaded from amd64.org) use
gpg –import ucode.sign.pgp.pub

To download the public key from keyserver use
gpg –keyserver keys.gnupg.net –recv-keys 9F94BC90

The key fingerprint is
0719 2E77 C9C5 79D6 D122 6AC3 6257 68B9 9F94 BC90

To verify the integrity of the GPG key fingerprint use
gpg –fingerprint ucode@amd64.org

To verify the integrity of the container file package use
gpg –verify amd-ucode-latest.tar.asc amd-ucode-latest.tar

Now let’s download this module and get it installed, locked and loaded:
1. Create a directory for the module:

sudo mkdir /lib/firmware/amd-ucode

2. Go here and accept the conditions to download the tar file: 

http://www.amd64.org/index.php?id=50&file=amd-ucode-latest.tar

3. Extract it.

cd Downloads
tar xf amd-ucode-latest.tar
cd amd-ucode-2012-09-10

4. Copy the microcode over to the firmware directory:

cp microcode_amd.bin   /lib/firmware/amd-ucode
cp microcode_amd_fam15h.bin    /lib/firmware/amd-ucode

5. Now remove any old modules, and reload your new microcode module:
sudo modprobe -r microcode
sudo modprobe microcode
That’s it, now reboot and you should be blessed with an error-free boot

Ubuntu 12.10 – Install Nvidia GeForce 8400 GS Driver

Ubuntu Nvidia borkage
I see a load of people over on the Ubuntu forums getting their daily borkage fix trying to install the “nvidia-current” driver so they can get that much desired full 3D acceleration out of their cards.

Debian and Nvidia over the years
As a Debian user who suffered for years with Nvidia, enough to change to Ati, I know all about Nvidia borkage.

Ati to Nvidia
Anyway, long story short, needed the 1Gb Ati card for my Debian media center, so ended up having to use a 256Mb Nvidia GeForce 8400 GS on the office box, which due to boredom just got Ubuntu 12.10 installed on it.


Necessities for installing anything
Couple of things here that are regulars for us Debian users, which the Ubuntu crowd rarely post about. Mesa-Utils, and (the essential) Module-Assistant, as it gets your headers, build-essential and all manner of “compile-ready” bits n bobs.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install module-assistant mesa-utils

Module Assistant
Module assistant will run off and fetch everything you need to compile and load any kernel module, from graphics card drivers to wireless firmware. This usually includes build-essential and your kernel-headers amongst other things. So just tell it to prepare your system with a simple:

sudo m-a prepare

Installing the proprietary Nvidia kernel module/driver

sudo apt-get install nvidia-current

Now just reboot and fire up glxgears (from the mesa-utils package) in the terminal and watch those pretty cogs show you how fast your 3D accelerated Nvidia card is.

 

Enable Spell Check in Vim text editor

I use Vim for all system file editing,and also for writing scripts. Sometimes i’m logged into my server and as there is no desktop there are no gui apps, I use Vim to send out a quick tweet to twitter via Twitvim. I also compose Mutt emails with Vim, so therefore having a spell check is pretty handy.

To enable Spellcheck in Vim, you need to edit your Vim config file:
vim .vimrc

And add these lines with your language to it:

syn spell toplevel
set spell spelllang=en_us

Using multiple Languages:
As I use both English and Spanish, I created two copies of my .vimrc file and called them vispellen and vispelles (ENglish and ESpanish) and then wrote two little Bash script so I can type “ven” or “ves” in the Terminal to interchange the different config files.
ven script:

#!/bin/bash
# This copies vispellen with English spell check to .vimrc
cp vispellen .vimrc

ves script:

#!/bin/bash
# This copies vispelles with Spanish spell check to .vimrc
cp vispelles .vimrc

Very basic I know, but it works.

Vim Spellcheck command basics:

]s  move to the next mispelled word
[s   move to the previous mispelled word
zg   add a word to the dictionary
zug   undo the addition of a word to the dictionary
z=   view spelling suggestions for a mispelled word

More information:
Just type :help spell in Vim.

How to install the Ati proprietary driver on Debian, Ubuntu, Kubuntu, Mint

I usually install my Ati drivers like this on Debian 64bit, and have just found out today that it’s the same for Kubuntu 64bit as well

1. Download Ati driver:

http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx

2. Get all needed files and headers

sudo apt-get install module-assistant

sudo m-a prepare

3. Remove (completely) fglrx drivers (If you have them installed):
sudo apt-get remove –purge fglrx

4. Reboot

5. Go to console

Ctrl + Alt + F1

6. Login as Root and kill X

/etc/init.d/kdm stop

7. Unzip and run the Ati driver installer

unzip amd-driver-installer-12-8-x86.x86_64.zip
sh amd-driver-installer-8.982-x86.x86_64.run

*NOTE* You can also run the installer from desktop terminal as well, but I always do graphic driver installs from the console with no X.

 8. Configure X as root

X -configure
cp xorg.conf.new /etc/X11/xorg.conf

9. Reboot

Thar she blows !!!!!

How to install Picasa 3.9 on Debian Squeeze 64bit

Picasa on Debian Squeeze 64bit
I recently found that Picasa for Linux** no longer exists in the Google/Linux repository, so I had a Google around and  found a few guides on how to install it with Wine. There were a few different guides, but I got errors as my machine is 64bit and didn’t have all the necessary Wine/Windows libs etc..

**Just to be clear, Picasa was always a Windows package, but the Google/Linux download came prepackaged with Wine.


Wine and Winetricks
First you need to install Wine, and then download Winetricks

Wine

sudo apt-get update && sudo apt-get update
sudo apt-get install wine

Winetricks

wget http://winetricks.org/winetricks
sudo mv winetricks /usr/local/bin/
sudo chmod +x /usr/local/bin/winetricks

**NOTE on Debian Wheezy (Testing)
Artur posted in the comments that you may need to install libwine-cms as mscms.dll is needed.

sudo apt-get install libwine-cms

Download Picasa 3.9 for Windows

cd && wget http://dl.google.com/picasa/picasa39-setup.exe

Download Internet Explorer 7 64bit as There is no 64bit IE6
http://www.oldversion.com/windows/download/internet-explorer-7-0-x64

Without it, you won’t be able to login to your Google account.

**Note To Install ie7
You may have to symlink “wineserver” to /usr/local/bin, as suggested by Simon in the comments.

sudo ln -s /usr/lib/wine/wineserver /usr/local/bin/wineserver

Place it in your Winetricks IE7 cache directory:

 mkdir -p /home/YOU/.cache/winetricks/ie7

cp /home/YOU/Downloads/IE7-WindowsServer2003-x64-enu.exe /home/YOU/.cache/winetricks/ie7

Download Cabextract
It is needed to extract Windows Cab files.

sudo apt-get install cabextract

Run the Winetricks script:

winetricks ie7

64bit Dependency

Before running Picasa setup with Wine you need an extra lib:

sudo apt-get install lib32nss-mdns

Finally Run the Picasa setup

wine picasa39-setup.exe

That’s it, now you’re good to go with Picasa!

How to Scrobble to Libre.fm from Rhythmbox

Rhythmbox + Libre.fm
I gave up using Last.fm a long time ago, and prefer to support and use Libre.fm. The one thing I found was that on Debian’s version of Rhythmbox, there is no built-in Libre.fm Scrobbler plugin.

Scrobblefree
A bit of Googling and I came across Scrobblefree. A cool little Python plugin that does what it says on the box.

1. Download Scrobblefree here: http://web.vee.net/projects/scrobblefree/ (Currently version 0.4)

wget http://web.vee.net/projects/scrobblefree/scrobblefree-0.4.tar.bz2

2. Extract it and enter the Scrobblefree directory (There is another Scrobblefree directory inside):

tar xvjf scrobblefree-0.4.tar.bz2
cd scrobblefree-0.4 

3. Place it in your Rhythmbox plugins directory which is in your .local dir (Hidden, see the dot in front)

mv scrobblefree /home/YOU/.local/share/rhythmbox/plugins/

4. Open Rhythmbox and activate the plugin by clicking on “edit” then “plugins” and scroll down to Scrobblefree.

5. Configure it by clicking “configure” and only add your name to the SECOND url: http://turtle.libre.fm (The first url is for Last.fm)

6. Restart Rhythmbox and a popup box will ask for your Libre.fm login password. Type it in and you’re all set.

Happy Scrobbling !!!! 🙂

PS: I’m here: http://libre.fm/user/rich_scadding
PPS: If you ever see Justin Bieber on my recent tracks, a demon has compromised my system, and you must alert me 😀

Howto install Iron Browser and Fix Nacl errors

Google Privacy vs Chrome usefulness
After mulling over some Google privacy issues Vs how good Chrome browser is, I decided to give Iron a go.

Iron Browser
Iron is a Chrome-based browser created by SRWare which claims to eliminate the privacy issues which come part and parcel with Google’s Chrome browser.
Iron vs Chrome: http://www.srware.net/en/software_srware_iron_chrome_vs_iron.php
Linux Download: http://www.srware.net/forum/viewtopic.php?f=18&t=3755

Installing Iron on Debian 64bit
I chose to install the Iron Debian 64bit .deb instead of compiling. It was easy.

1. Go to your downloads directory

cd downloads

2. Download the iron .deb file

wget http://www.srware.net/downloads/iron64.deb

3. Use dpkg to install it

sudo dpkg -i iron64.deb

Dependencies
I’ve got Google Chrome and a whole load of dev files installed and had no dependency problems, but just in case you get any problems just install any dependencies by running:

sudo apt-get -f install

Running Iron
I use Openbox, so I always manually add applications to my menu, but if you have Gnome or some other auto-menu-add desktop, you won’t have to worry about this.
I updated my system database and used locate to find Iron.

sudo updatedb
sudo locate iron

The launcher resides in “/usr/share/iron”, so I cd’d there and ran it.

cd /usr/share/iron
./iron

NACL Error Message
I got an error message in the terminal and Googled (parts of it), only to find that the problem had already been posted on the SRWare.net Iron download page:

LaunchProcess: failed to execvp:
/usr/share/iron/nacl_helper_bootstrap
[5793:5793:846689293:ERROR:nacl_fork_delegate_linux.cc(106)] Bad NaCl helper startup ack (0 bytes)
[5791:5801:846742102:ERROR:nacl_process_host.cc(607)] Failed to open NaCl IRT file “/usr/share/iron/nacl_irt_x86_64.nexe”: -4

Workaround / Temporary Fix
This is just a workaround while I investigate further or if the SRWare guys actually reply to the bug reports on their forum, whichever comes first.
Chrome nacl files not in present with Iron
After searching my system from Nacl related files, I found three in the Google Chrome directory “/opt/google/chrome”, and just copied them over to the Iron directory one by one, launching Iron after each move to see if the error message disappeared. It did.

sudo cp /opt/google/chrome/nacl_irt_x86_64.nexe /usr/share/iron
sudo cp /opt/google/chrome/nacl_helper_bootstrap /usr/share/iron
sudo cp /opt/google/chrome/nacl_helper /usr/share/iron

At the moment Iron launches and runs perfectly, but I will be investigating any issues that may be caused by using the Google Nacl files with iron. I’d also welcome any feedback other iron users may have.

Howto install Mac OSX Snow Leopard in Virtualbox on Linux

Why Mac? You’re a Debian Gnu/Linux user
I did this out of curiosity and just for the challenge more than anything, then deleted this VM shortly afterwards.
One thing I did notice while playing around with Mac, is how similar Ubuntu (Unity) is becoming to the Mac desktop. Everything was polished and nice to look at, but as a Debian (Openbox) user, i’m impressed by speed and reliability, not pretty wallpapers and icons.
What Hardware and Debian do you have?
I use Debian Squeeze with an AMD 64bit Quadcore CPU, Ati 1Gb GPU and 8Gb RAM. This is why I did this out of curiosity, as Apple Macs are Intel-centric.

Part 1 – Virtualbox & Ext4
One thing i noticed is that Virtualbox has an Ext4 bug which means that if you want to install Mac, your VirtualBox VMs directory needs to be on an NTFS partition. Luckily I have one of these, so I created the directory there, and pointed VirtualBox to use that one instead.

Part 2 – Which Mac iso?
I got one created by Hazard that is AMD 64bit compatible. Obviously, the legality of this image and running it virtually is in question, but as I said, both the iso and VM have been deleted now.
http://thepiratebay.se/torrent/5203531/Snow_Leopard_10.6.1-10.6.2_Intel_AMD_made_by_Hazard

Part 3 – Create and Configure the Virtual Harddrive
Create a 30 Gb fixed Virtualbox drive for Mac. Once it is done, open Settings > System > Mother Board, and change:

  1. Remove the Floppy drive.
  2. Chipset selected to ‘ICH9’
  3. Enable IO APIC
  4. Disable EFI (This caused me a couple of failures) 
  5. Only provide up to 2048Mb of RAM, more fails for some reason.



Part 4 – Starting the installation
In the drive settings, choose Hazard’s Snow Leopard iso, attach it the tht virtual CD drive, and start the VM
1. As soon as it starts run, a message will appear for you to hit enter to boot from CD
2. Follow the screens step by step, most of it is common sense.
3. The VBox HD is blank. So you have to format it with ‘Disk Utility’. When you get to the first screen with a menu bar, choose Utilities-> Disk Utility.
4. You’ll see the Disk, but it can’t be used until it formatted.
Choose the Harddrive and click the ‘Erase’ tab. Under Erase, choose Mac OS X Extended (Journaled) and then name it ‘OSX’ and click ‘Erase’ again.
5. Now close the Disk Utility and continue with the installation.

Part 5 – Special Settings for AMD CPUs (Screenshot 1)
At the next screen you’ll see a “Customize” button at the bottom left. Click it, and check the same boxes I have in  the screenshot above, then continue the install. It took about 10 minutes on my machine.
**NOTE** See the Updates marked in RED – Do not install them, you’ll be left with an Unbootable Mac that hangs at the Apple Logo Splash Screen.

Part 6 – First Boot
1. Once the install is finished, remove the CD from the drive, by clicking the Virtualbox window menu Devices > CD/DVD Devices > Remove Disc from virtual drive.
2. Shutdown the VM, close VirtualBox, then reopen VirtualBox and start the VM. If all went well, you will now be greeted with the Mac preparation screen asking for your personal details to setup the desktop.

That’s it, basic install complete.

**NOTE** If you get a Kernel Panic with “vm_page_set_colors” Error
Paul Edwards commented that it can be solved by a simple boot option of “colors=32”.
Link: http://code.google.com/p/xnu-dev/issues/detail?id=390
Thanks for that Paul 🙂

Part 7 – Screen Resolution
I did two hacks to get my Screen Size – 1920×1080


From Linux:
1. Open your terminal, and as a user (not Root, nor Sudo) type this command with your screen resolution and the name of your VM:

VBoxManage setextradata “Snow Leopard” “CustomVideoMode1” “1920x1080x32”

2. Restart the Virtual Machine

From Mac VM:
1. Open the file browser, go to the root directory and open the “Extra” folder. You’ll see a file called “com.apple.Boot.plist
2. Open it with the Text Editor, add the code below, then save it to your Desktop with exactly the same name and suffix (.plist).

Graphics Mode
1920x1080x32

3. Now drag it back to the “Extra” directory, and type in your password (admin permissions) and replace the old one.
4. Restart the Virtual Machine, and you should now have full screen available.

Here it is after the Screen Resolution Hack, which is perfect when you change it to Full Screen:



That’s about it. Have fun.

A heads up to these guys for their isos and guides:

Hazard Mac isos – http://leohazard.com/
Vbox Mac Howto – http://www.sysprobs.com/install-mac-snow-leopard-1063-oracle-virtualbox-32-apple-intel-pc
Vbox Mac Howto – http://randosity.wordpress.com/2010/06/21/running-mac-os-x-in-virtualbox/
VM Guide – http://blog.dmitryleskov.com/tag/vm/
VM Error Help – http://karim-ouda.blogspot.com.es/2011/07/errors-solutions-19.html

Pacpl Music Converter/Ripper/Tagger on Debian

Rhythmbox and Windows Media Audio (wma)
I recently decided to clean up my music collection and found that some files were uneditable from Rhythmbox on Debian as they were old wma (windows media audio) files from back in the day which I had ripped from CD to a Windows computer. I would have ripped the CD again, but it is old and pretty scratched up.

Pacpl on Debian
I love Perl, and when I did an “apt-cache search” in the terminal for Audio Converters, I was over the moon to find Pacpl, a Perl based CLI audio converter/ripper/tagger script in the repos:
http://pacpl.sourceforge.net/

Installation:

1. sudo apt-get update && sudo apt-get upgrade
2. sudo apt-get install pacpl

Usage Information:

man pacpl

Basic example:
I have a storage directory with a Music folder containing all my music. The Album in question was Gangsta Blues by Tanya Stephens, and I wanted to convert the entire album to Mp3 and remove the Wma files after.

pacpl –to mp3 -r -p /storage/Music/Tanya_Stephens/Gangsta_Blues/ –outdir /storage/Music/Tanya_Stephens/Gangsta_Blues/

Which gave this output:

Converting:  [01 Intro.wma] -> [mp3] ..done.
Converting:  [02 Way Back.wma] -> [mp3] ..done.
Converting:  [03 Boom Wuk.wma] -> [mp3] ..done.
Converting:  [04 Damn.wma] -> [mp3] ..done.
Converting:  [05 Good Ride.wma] -> [mp3] ..done.
Converting:  [06 Little White Lie.wma] -> [mp3] ..done.
Converting:  [07 It’s a Pity.wma] -> [mp3] ..done.
Converting:  [08 Tek Him Back.wma] -> [mp3] ..done.
Converting:  [09 I Am Woman.wma] -> [mp3] ..done.
Converting:  [10 This Is Love.wma] -> [mp3] ..done.
Converting:  [11 Gangsta Gal.wma] -> [mp3] ..done.
Converting:  [12 What’s Your Story.wma] -> [mp3] ..done.
Converting:  [13 Can’t Breathe.wma] -> [mp3] ..done.
Converting:  [14 Sound of My Tears.wma] -> [mp3] ..done.
Converting:  [15 The Other Cheek.wma] -> [mp3] ..done.
Converting:  [16 What a Day.wma] -> [mp3] ..done.
Converting:  [17 We a Lead.wma] -> [mp3] ..done. 

Removing old files:

1. cd /storage/Music/Tanya_Stephens/Gangsta_Blues/
2. rm -r *.wma

Pacpl provides superfast conversion, as you’d expect from anything Perl, and has a whole heap of different audio related features. I highly recommend this script if you prefer CLI over GUI.

Convert to and split flash video (flv) files for Youtube

I recently got asked about uploading videos to Youtube by a friend, and decided to look at the best way to first convert them to Flash (.flv) and then split them into chunks to get round the Youtube video size restrictions.

Winff
If you’ve never used Winff before, then you’ll love it. It allows you to choose your video file and convert into various formats, including Flash for Websites (.flv) It’s available in most Linux repos, and you can find more info here: http://winff.org/html_new/

sudo apt-get install winff

Ffmpeg
Ffmpeg is the tool for everything video and audio. It’s available in all Linux repos and you can find more info here: http://ffmpeg.org/

sudo apt-get install ffmpeg

VLC Media Player:
I would also recommend installing vlc which is probably the most complete lightweight Video/Audio player available. It’s also available in all Linux repositories, more info here: http://www.videolan.org/vlc/

Basically you just convert and split.
1. Open Winff, open the file you want to convert, and choose Flash/Website
2. Let it convert then open your terminal ready for some ffmpeg-foo

Ok, so, case scenario: 
You have a video file called “bacon” that is 30 minutes long and you want to create two 15 minute files. To get file number 1 you split from 0min for a duration of 15 minutes, and then for file number 2 you split from 15min for another duration of 15 minutes like this:

ffmpeg  split originalbacon.flv from [startpoint 0] [for duration 15] to newbacon1.flv
ffmpeg  split originalbacon.flv from [startpoint 15] [for duration 15] to newbacon2.flv

Which in the Terminal is like this:

ffmpeg -i input.flv -sameq -ss 00:00:00 -t 00:15:00 file1.flv

then:

ffmpeg -i input.flv -sameq -ss 00:15:00 -t 00:15:00 file2.flv

Happy splitting and uploading 🙂

Broadcom BCM4311 problem on Debian, Mint, Ubuntu

The STA driver does not work properly for the BCM4311 in Mint/Ubuntu/Debian.
The Restricted Driver Manager only gives you the Broadcom STA driver as an option.

Yesterday got asked by a friend to remove Ubuntu from his 5-year-old laptop. It’s a 64bit, 1Gb Ram machine, with an Nvidia graphics card and Broadcom wireless.

I was pretty certain that the 64bit Linux Mint 12 would just work out of the box, even though i’ve had problems with the Broadcom firmware on other machines (wireless cutting out and needing to be restarted)
The install went fine, and I went straight to the “Restricted Drivers manager” for Nvidia and Broadcom. The STA driver was recommended so I installed it. Only to find it would work.

My laptop at home works ok with the older B43 module, so I went the traditional route and installed that instead.

Install:

sudo apt-get install firmware-b43-installer b43-fwcutter

Then unload both modules:

sudo modprobe -r b43 wl

Now reload the B43 module:

sudo modprobe b43

If when you reboot, the B43 module doesn’t get loaded:, just add it to “modules”:

sudo vim /etc/modules

and add b43 at the end of the list. Now it’ll load at boot.

The STA module may also load at boot, so just blacklist it by adding it to the blacklist:

sudo vim /etc/modprobe.d/blacklist.conf

and it like this:

blacklist wl

Now reboot, and you’ll have Broadcom 4311 wireless working.

Howto setup any HP printer on Debian

Other Printers
I’ve written other guides on setting up printers with Cups in the web browser via localhost:631 (which is still an easy way to setup most printers, however, the drivers weren’t listed for my current printer, so I Googled for the Hplip site at Sourceforge and found a neat little script.

Hp Deskjet 3050
In general with any Linux distro with a full desktop environment you would just install the Hplip package with GUI via the package manager. I have a minimal self-built Debian Squeeze with Openbox window manager, and as such, not all installed applications appear on the Obmenu (even the added Debian menu), so I have my own default menu with my frequently used apps. basically, when I installed the Hplip GUI there was no link to be seen on the menu, so I did an Alt+F2 to do arun-search of all the hp* references.

HP-Setup = No USB Printer Detected
I ran hp-setup and it informed me that there was no printer connected via USB, even though lsusb showed it listed. I checked for usual dependencies, unplugged and replugged the printer, nada, so off to Google I went.

Using the Hplip script from Sourceforge: http://sourceforge.jp/projects/sfnet_hplip/releases/
*NOTE* If you don’t already have it, install python-dev, libcups2-dev, libusb-dev, python-qt3, libsane-dev, libtool and libcupsimage2-dev

sudo apt-get update && sudo apt-get install python-dev libcups2-dev libusb-dev python-qt3 libsane-dev libtool libcupsimage2-dev

*NOTE 2* Optional Dependencies
If you think you may need these, install them as well:

INSTALL MISSING OPTIONAL DEPENDENCIES
————————————-
warning: There are 3 missing OPTIONAL dependencies.
note: Installation of dependencies requires an active internet connection.
warning: Missing REQUIRED dependency for option ‘network’: libnetsnmp-devel (libnetsnmp-devel – SNMP networking library development files)
warning: This installer cannot install ‘libnetsnmp-devel’ for your distro/OS and/or version.
warning: Option ‘network’ has been turned off.
warning: Missing REQUIRED dependency for option ‘gui_qt4’: pyqt4-dbus (PyQt 4 DBus – DBus Support for PyQt4)
warning: This installer cannot install ‘pyqt4-dbus’ for your distro/OS and/or version.
warning: Option ‘gui_qt4’ has been turned off.
warning: Missing OPTIONAL dependency for option ‘fax’: reportlab (Reportlab – PDF library for Python)
warning: This installer cannot install ‘reportlab’ for your distro/OS and/or version.

Running the script and installing

1. Find the latest *.run script (Currently hplip-3.12.4.run) and download it.

2. Open a terminal and go to your “Downloads” directory

cd Downloads

3. Create a HP directory (A lot of files will be downloaded when the script runs)

mkdir HP

4. Move the script there

mv hplip-3.12.4.run HP

5. Change to the HP directory

cd HP

6. Run the script as a regular user

sh hplip-3.12.4.run

Now just go through the motions, it’s self explanatory and will guide you step by step. Basically after reading it turns out that I just said YES to all the default options, and now have a fully working HP Deskjet 3050 on Debian Squeeze.

Howto install Perl Volwheel volume controller

Volwheel is a nice little Perl script panel applet which provides a lightweight sound/volume controller on your chosen panel/toolbar. I use Tint2 on my Openbox desktop, and volwheel is always a part of my setup.

First download Volwheel



Untar it

tar zxvf volwheel-0.2.8.tar.gz

Dependencies

sudo apt-get install libgtk2-trayicon-perl

Install

cd volwheel-0.2.8

sudo ./install.pl

Copy Icons to System

sudo mkdir -p /usr/local/share/volwheel/icons

cd icons

sudo cp -a * /usr/local/share/volwheel/icons

Copy Libs to System

cd ..

cd lib

sudo cp -a * /usr/lib/perl5

Launch Volwheel

volwheel &

Change the theme and settings (I use static + speaker-black)
Right click on Volwheel icon, choose Preferences
Autostart for Openbox

vim .config/openbox/autostart.sh

Add this line:

## Start volumeicon after a slight delay
(sleep 5s && volwheel) &

That’s it, now you have a nice Perl volume icon.

Getting Java Console on HP ILO to work with Iceweasel on Debian 64bit

Remote HP Server Administration via ILO
If you ever have to connect to remote servers, especially HP which have ILO (Integrated Lights Out) technology, you’ll probably have come across the problem where you can get to the Administration page, but the Console won’t open.

Using Windows
I used to just fire up Virtual Box with Windows Xp (32bit) installed an do everything from there. ILO allows you to connect with Java install and on windows the .NET framework.

Linux and 64bit Java
One of he main issues with Linux and Java was that you could get the (Sun) 32bit Java to work, but the 64bit Java would fail miserably.

Java Versions
Java can be a real pain if you don’t have the latest version installed, and if you run Debian “Stable” (Currently Squeeze) you will have to install the Sun Java package from their website if you need the latest version as Debian is no longer going to have it in the repos: http://www.debian.org/News/weekly/2011/15/#javarm

Java (64bit) Version/Package Experiments
One of my work colleagues recently called me over and showed me the ILO Java console open and working with Iceweasel on his Debian Squeeze box. I was amazed and asked how he did it.
He’d basically installed a specific version (jdk1.6.0_17) of the sun-java6-jdk package, and symlinked to it.

Howto:

  • 1. Download the sun-jdk1.6.0_17 source (i’ll post a link later)
  • 2. Unpack it to /opt
  • 3. Cd to /usr/lib/mozilla/plugins
  • 4. Symlink these two files
libjavaplugin_jni.so -> /opt/java/jdk1.6.0_17/jre/lib/amd64/libjavaplugin_jni.so
libnpjp2.so -> /opt/java/jdk1.6.0_17/jre/lib/amd64/libnpjp2.so

Howto Crunchbang install proprietary Ati drivers

Installing Manually on Crunchbang Statler (32/64bit)

This method uses the latest Catalyst driver downloaded from AMD/ATI’s site.
This was tested on a virgin install with no other previous attempts at installing Ati drivers. If you have an already edited system, with other drivers installed, remove them “completely” first.
Do everything below as root, in the /root directory

Install the prerequisite packages:

apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 module-assistant

Make sure you are ready to go with Module Assistant:

m-a prepare

Download the latest Catalyst package:
This package contains both the 32-bit and 64-bit driver (if you are on a 64bit machine, install ia32-libs) 

cd ~/; mkdir catalyst11.10; cd catalyst11.10/

wget http://www2.ati.com/drivers/linux/ati-driver-installer-11-10-x86.x86_64.run 

chmod +x ati-driver-installer-11-10-x86.x86_64.run

Launch the Ati installer and go through the motions:

./ati*run

Now reboot, don’t try glxgears or the catalyst control center, in fact don’t touch anything, just reboot.


Howto Flash DarkyROM 10.2 Resurrection from Debian on your Samsung Galaxy S

Why this guide if it’s all on DarkyROM Forums?
I’m posting this as I found the guides on the DarkyROM forums confusing, and they all recommend Odin (Pffft! Windows users). If you already have a Darky’s ROM installed, or are coming from a Stock Froyo, it’s easy, just follow the guides on the forum. In fact, before reading how I did it, go to the forums anyway.

This guide is how I got DarkyROM 10.2.2 Extreme Edition installed after a lot of trial and error trying to get rid of Cyanogenmod 7 with a custom kernel. (See my previous post for CM7) This is by no means as in-depth as the official guides, nor can I guarantee it will work for you. As with all ROM flashing shenanigans, you are responsible for your phone, not me.

6 Step Howto Guide

1. Download and install Heimdall CLI HERE

2. Download DarkyROM 10.2 Resurrection and unzip everything all into one directory. HERE

3. Open your terminal and cd to that directory

4. Copy and paste this line: 

heimdall flash –repartition –pit s1_odin_20100512.pit –factoryfs factoryfs.rfs –cache cache.rfs –dbdata dbdata.rfs –primary-boot boot.bin –secondary-boot Sbl.bin –param param.lfs –kernel zImage –modem modem.bin

5. Put your phone into Download Mode (Volume Down+Power Button+Enter)

6. Plug USN cable into computer, then phone, and go back to the terminal and press Enter.


The Whole Story (For those who are about to brick their phone if they don’t read this 😀 )
A few friends on Google Plus were using Darky ROM and singing it’s praises, but I went for CM7 instead as it was easier to to install. I soon realised that I was losing battery every 8 hours, faster with heavy use. I could have tried different kernels and patches etc, but i’d already decided (as I do with Linux) to say goodbye and move on to a “Distro” (ROM) which was recommended and more suited to my needs. Darky’s ROM.

Clockwork Mod and ROM manager
As I was on a rooted phone, and already had CWM installed via my custom kernel, I decided to go for the traditional Darky install via the ROM manager. I downloaded the latest DarkyROM 10.2.2, opened the ROM manager, told it to wipe my phone and install the .zip which had just been downloaded to the root of my internal SD card. The phone rebooted into CWM, I chose Factory reset, wipe cache etc, and chose the darkyrom-10.2.2.zip. It appeared to work, rebooted, and just got the Cyanogenmod 7 boot screen, and that’s where the phone froze. I tried again with the 3-button-techinique, wiped again, reflashed. Same thing. I now had a phone that wouldn’t boot. So I used the 3-button-technique to reflash Cyanogenmod7 (The zip was also on my internal SD card from the last time). CM7 worked.

Bricked (nearly) Phone, Odin and Heimdall and reverting to Stock Froyo
After a lot of downloading and attempted flashes with the 3BT, and ending up with an unbootable phone, I panicked a bit, and went off to Google. I read through the DarkyROM howto but came away even more confused, then found a link to a site that has all the Stock Samsung Galaxy S firmware. I downloaded the Samsung Galaxy S Froyo Firmware, and set off to find a guide about using Odin via USB cable to get my brick phone back to stock.

Odin vs Hemdall
I soon realised that Odin is a leaked application that Samsung uses to flash phones, and is a Windows app. I’m on Debian Squeeze Linux. Next I got wind of a Linux app called heimdall, which even comes with an Odin like GUI frontend called (funnily enough) heimdall-frontend, and there were .deb files. Cool beans methinks, I can flash via USB from Linux. I downloaded the .deb files and installed them with a quick “dpkg -i” All went well, opened it up to check, seems to work.

DarkyROM and Heimdall
Rather than go back to stock straight away, I thought i’d have one last go with Darky’s ROM so I went back to DarkyROM forums and found somebody had posted a Heimdall guide, with screenshots. However, the gui looked nothing like mine, but I thought i’d muddle through. I unzipped the DarkyROM-10.22 package, and found that none of the files i needed were inside. Great! Went back and read some more forum posts, found I may need a version called Resurrection. Downloaded that and found the firmware files inside. I unzipped everything, tried to load the PDA.tar, and Heimdall-Frontend crashed at 99%. I tried again, crashed. In  fact I went through a whole heap of files i’d previously downloaded, and either got “firmware.xml” missing, or the Gui would crash.

Ubuntu and Heimdall-Frontend
I compare Ubuntu to crack cocaine. It’s ok for a quick fix, but you wouldn’t want to use it every day 😀
Ok, just kidding, I don’t want hate mail form hoards of marauding Ubuntu Fanbois, in any case, it saved my ass this time. My daughter’s laptop dual-boots Crunchbang with Ubuntu, so I decided to use Ubuntu as people said Heimdall worked fine on that. And it did. I flashed DarkyROM to my phone, it rebooted……. to the damned Cyanogenmod splash again!!

Stock Froyo ROM
Bugger it, i’m tired, i’ve got an unbootable phone, i’m going back to stock. I unzipped the firmware i had downloaded earlier, flashed it to my phone with heimdall-frontend, the phone booted into stock Froyo, Hurrah!

But!…….. I-need-Darky’s ROM!
What can I say, i’m an install freak, I HAVE to be able to fix something. I can’t just walk away and leave this. I’m serious, I can’t sleep if there is a challenge like this hanging in the air. Distros, databases, web sites, source apps. If Grant Galbraith can haz teh Darky ROM, I can haz it too 😀

Back to DarkyROM forum’s Heimdall guide
I scrolled down, and found that a forum moderator had posted a comand line for heimdall. YES! CLI! I fired up my Debian laptop. Unzipped all the files i saw in that command line into one single directory. Fired up my terminal, copy and pasted the line. Put my phone into download-mode, connected the USB cable, went back to my terminal, crossed my fingers, said a little prayer to Linus, and hit Enter. Bang! the beautiful commands scrolled past, my phone came to life with a gorgeous glow as it’s new lifeblood started to flow into its circuitry. The phone restarted to an corrupted mutlicolour splash. A jittery robot voice stuttered something and it froze. My heart sank, I tried to restart it, I got the horrible dreaded black-screen-of death. My heart sank further as the words echoed through my head “you bricked your phone”, “you had a stock froyo”, “but you had to push it, and you bricked your phone”, “stupid”.  I recalled something on the forum about “Something only Samsung can fix”.


But all wasn’t lost
I took my battery out, replaced and rebooted. I got a beautiful Matrix style splash screen welcoming me to Darky’s ROM, the robot voice… that beautiful robot voice assured me that everything was fine, and I had in fact, successfully installed Darky’s ROM… 10.2 Extreme Edition. It booted.

I am now the proud user of Darky’s ROM 10.2.2 Extreme Edition, and it’s staying that way!

Howto Debian Live – Build your own Squeeze based distro


How to build your own Debian
Debian live-build was created to help you to build a Debian Live CD or USB. There are other applications and scripts which allow you to respin/remaster, but live-build will help you buil a Debian-based distro “the Debian way”.

Anybody can start with a base Debian and add a desktop environment and within around 30 minutes have their own Debian-based distro. It is that simple to use. A more experienced user could dig-in deep and add scripts, themes, wallpapers, specific applications and scripts.

Installation
You will need an installed Debian system to start. Install the live-build package.

*NOTE* sid-snapshot live-build error with squeeze builds

cp: cannot stat `/usr/share/syslinux/themes/debian-squeeze/isolinux-live’

Squeeze or Wheezy based distro?
If you want to build a Squeeze-based distro, use “squeeze-snapshots” to avoid the above error.
If you want to build Wheezy/sid-based distros, use the sid-snapshots repo. (live-build 3.0 is still under development, and therefore can break)

For Squeeze Pin the Squeeze Live-Build version:

cd /etc/apt/apt/preferences.d

Then create a file called “live_build” and add the Pin:

vim live-build

Package: live-helper
Pin: release a=squeeze
Pin-Priority: 900 

Package: live-build
Pin: release a=squeeze
Pin-Priority: 900 

Now add the Squeeze Live Build to your sources.list:

echo deb http://live.debian.net/debian/ squeeze-snapshots main contrib non-free >> /etc/apt/sources.list

echo deb-src http://live.debian.net/debian/ squeeze-snapshots main contrib non-free >> /etc/apt/sources.list

wget http://live.debian.net/debian/project/keys/archive-key.asc -O – | apt-key add –

apt-get update

apt-get install live-build dosfstools genisoimage memtest86+ mtools parted squashfs-tools genext2fs mtd-tools sudo fakeroot uuid-runtime win32-loader syslinux syslinux-themes-debian syslinux-themes-debian-squeeze

Configuration And Testing
Create a work directory as Root:

su
password

mkdir my-livecd

cd my-livecd

To create a simple test Live system (no X, just shell):

lb config

And you should end up with this directory structure:

|– binary_debian-installer

|– binary_grub

|– binary_local-debs

|– binary_local-hooks

|– binary_local-includes

|– binary_local-packageslists

|– binary_local-udebs

|– binary_rootfs

|– binary_syslinux

|– chroot_apt

|– chroot_local-hooks

|– chroot_local-includes

|– chroot_local-packages

|– chroot_local-packageslists

|– chroot_local-patches

|– chroot_local-preseed

|– chroot_sources

|– includes

`– templates

The Config Directory
lb config will create a CONFIG directory with some very simple default settings in commented files that can be edited by hand. This is where you will be adding your config files, packages (.debs) and the contents of your skel directory. This will probably be the most important directory for live-build distro builders.

Get lb config info from your Debian terminal:

man lb_config

The Build Command
lb build will download the packages from the debian repository, install them in a chroot, apply hooks and other things and then create an ISO file which you can burn or run virtually.

Editing/Adding/Removing and Rebuilding
Each time you want to rebuild the live-cd to include some changes, you’ll have to run:

lb clean

lb build

The process will be repeated, but this time the packages you downloaded before will be reused from a cache directory where they were saved the first time round.

Build an Xfce4 based Debian
Debian Squeeze with Xfce live USB image and some extra stuff: (These are straight commands that will add the information to the live-build scripts. Obviously you can edit the scripts themselves manually, and have all this preconfigured so that you run “lb build”, go and have a coffee and come back to a shiny new Debian iso, alreday to be fired up in VirtualBox to test.

lb clean

lb config –architecture i386 –archive-areas “main contrib non-free” –packages-list xfce

You can find more packages lists for gnome, kde and others in /usr/share/live/build/lists/.

debian-forensics debian-live-pxe-server gnome-core gnustep kde-extra lxde  standard studio-gnome xfce debian-junior debian-science gnome-full kde kde-full    minimal standard-x11 studio-kde xfce-junior debian-live-devel gnome gnome-junior kde-core kde-junior rescue studio studio-xfce [your-personal-list]

The i386 architecture boots on 32 and 64 bit processors.

Add some more packages you’d like:

lb config –packages “irssi screen obmenu obconf iptraf vim”

Rebuild

lb build

Customizations
You can make changes to the system interactively during the build process in a shell, using interactive shell parameter.

lb clean

lb config –interactive shell

lb build

A prompt will appear during the build process. Make the changes you want and then log out with “exit” to finish the build process. To disable interactive shell again for unattended builds run:

lb config –interactive disabled

Create Hooks to automate customizations:
Add the following example script inside config/chroot_local-hooks/, make it executable and then rebuild (more hooks in /usr/share/live-helper/hooks/):

#!/bin/sh

echo “HOOK: ssh server”

# install

apt-get install –yes –force-yes -y openssh-server

# disable root login

echo “I: disabling root login in ssh”

sed -i “s/PermitRootLogin yes/PermitRootLogin no/” /etc/ssh/sshd_config

# don’t start ssh on boot (safer)

update-rc.d -f ssh remove

Now rebuild.

Skel and the /home/user directory
To add some files to the user $HOME directory, copy them to config/chroot_local-includes to the /etc/skel directory:

lb clean

mkdir -p config/chroot_local-includes/etc/skel

cp -ra ~/.config/openbox config/chroot_local-includes/etc/skel/

lb build

Installing to USB pendrive:

lb clean –binary

lb config -b usb-hdd

lb build

Now copy the resulting image file to the USB pen drive

dd if=binary.img of=/dev/sdb

Where /dev/sdb is the usb pendrive.

Persistent Pendrive (Allows you to save files and settings)
To save changes between boots (a.k.a. live persistence), create a new partition with the remaining free space in the pen and change the label of the new partition to “home-rw”. Boot with the “persistent” boot option to use it. Now the changes in $HOME will survive. They can be used again booting with “persistent” again.

Installing To Hard Disk
One of the advantages of live-helper is being closely linked to Debian, Debian Policy and to Debian-Installer. Once you have selected the packages you want and have the system setup/configured the way you want with your hooks and preseeds, you can use the livecd iso to install your distro to hard disk with debian-installer (d-i) as with a normal official Debian CD.

The installer work normally (language selection, partitioning) but when it comes to installing the system, it will extract the live system to disk, then remove the live addons and install a bootloader. It is actually much faster that the normal installation, because it doesn’t have to unpack all the deb packages.

Debian guides:
http://debian-live.alioth.debian.org/,
http://wiki.debian.org/DebianLive/FAQ,
http://live.debian.net/manual/html/index.html,
http://www.debianuserforums.org/viewtopic.php?f=9&t=185.

How to: Shared Directory Permissions for specific Users of a specific Group


This guide is basically aimed at Debian server Administrators who want to control access to specific directories, to specific groups and/or users.

Scenario: 

You want ONLY user1 and user2 to have Read/Write access to the_shared_dir 
Create the new directory: 

sudo mkdir the_shared_dir 

Create new group: 

sudo groupadd thenewgroup 

Add users to the group: 

sudo adduser user1 thenewgroup 

sudo adduser user2 thenewgroup 

Give the directory group permissions: 

sudo chgrp -R thenewgroup the_shared_dir 

Change the directory/file permissions to Recursive Root/Group Read/Write: 

sudo chmod -R 774 the_shared_dir 

sudo chmod g+s the_shared_dir 

sudo setfacl -d -m group:thenewgroup:rwx the_shared_dir/ 

Use getfacl to see directory permissions: 

sudo getfacl the_shared_dir/ 

Which will produce this output: 
# file: the_shared_dir/ 
# owner: root 
# group: thenewgroup 
# flags: -s- 
user::rwx 
group::rwx 
other::r– 
default:user::rwx 
default:group::rwx 
default:group:thenewgroup:rwx 
default:mask::rwx default:other::r-x 
**Now the user has to log-off and on again for permissions to work** 
Links: 
ACL 
Getfacl 
Setfacl 
Permissions 

How to install Libre Office on Debian or Crunchbang with Openbox

Current (October 2012) Final LibreOffice 3.6.3

You can find the .tar.gz packages containing 32 and 64bit .debs on the download page:
32bit Debs (Torrent)

64bit Debs (Torrent)

Download and Unpack
First download the package for your version (mine is 64bit)  to your “/downloads” directory, then unpack it:

cd downloads

ls (then copy and paste the package name after the “tar -xvf” command)

tar -xvf LibO_3.6.3_Linux_x86-64_install-deb_en-US.tar.gz


Install Libre Office 3.6.3
Change to the extracted LibO directory and install all the .deb packages in one go.

Java
**Note** If Libre Office asks for Java (and you want to install it)

sudo apt-get install sun-java6-jre


Libre Office

cd LibO (hit Tab button to complete)

cd DEBS 

sudo dpkg -i *.deb


Where is Libre Office installed?
Libre Office 3.6.3 is now installed in /opt/libreoffice3.6/ and the application launchers are stored in /opt/libreoffice3.6/program

Add Libre Office to your Openbox menu

I use scite text editor to edit my Openbox menu basically as I have the option to save in .xml format (otherwise you get xml, end of line extra character errors etc) . You can also do this with Vim, Nano etc, if you know how to do it. I prefer having Scite already setup for xml editing.

Back-up and Edit

cp .config/openbox/menu.xml .config/openbox/menu.xmlBKP

scite .config/openbox/menu.xml


Add the Office Menu where you like

        

            

                

                    /opt/libreoffice3.6/program/soffice

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/swriter

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/scalc

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/simpress

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/sdraw

                

            

        

        

            

                

                    /opt/libreoffice3.6/program/smath

                

            

        

            

            

                                

                                        /opt/libreoffice3.6/program/sbase                   

                                

                        

                


All done!
That’s it, you now have the latest Stable edition of Libre Office and you can launch everything from your Openbox menu 🙂


Asterisk PBX on Debian Stable Part 2

Part Two Finally Arrived!
It’s been a while since Part 1, but I decided to dig through my unfinished drafts and see what I fancy finishing off. At work we setup a lot of Asterisk servers for clients, so as you imagine a lot of it is preconfigured and installed with scripts.

Last week though, I got a Fujitsu Primergy TX200 S5 server to play with, and set about installing a KVM on Debian virtual system for testing. As we are looking to deploy some custom Asterisk servers for new clients, I decided that this would be my first test VM.

If you haven’t already installed Asterisk, check out Part 1
So, first look at Part 1 for a basic setup, yes, it’s still relevant for Squeeze. Now we are going to install and configure a software phone (VoixPhone) using the IAX protocol. This is a very basic setup, and will get you started.

Configuring Asterisk for Voixphone
There are two main files which need to be edited to achieve this, and they are both (as with all Asterisk .conf files) in /etc/asterisk.

/etc/asterisk/iax.conf
/etc/asterisk/extensions.conf

First add this to your iax.conf (using your name)

[general]
port=4569
bandwidth=low
disallow=all
allow=gsm
jitterbuffer=yes
tos=lowdelay

[richslxh]
type=friend
context=default
secret=4321
host=dynamic
allow=gsm
auth=plaintext,md5,rsa
callerid=richslxh
mailbox=richslxh
requirecalltoken=noTHIS IS IMPORTANT IF YOU CAN’T CONNECT WITH VOIXPHONE

Now we need to add the coinciding information in /etc/extensions.conf

[from-sip]

exten => 9250,1,Dial(SIP/9250,20)
exten => 9250,2,Voicemail(u9250)
exten => 9250,102,Voicemail(b9250)

exten => 9250,103,Hangup

exten => 9251,1,Dial(SIP/9251,20)
exten => 9251,2,Voicemail(u9251)
exten => 9251,102,Voicemail(b9251)
exten => 9251,103,Hangup

exten => 2999,1,Voicemailmain()
exten => 2999,2,Hangup

include => from-iax

[from-iax]

exten => 4321,1,Dial(IAX2/4321,20)
exten => 4321,2,Voicemail(u4321)
exten => 4321,102,Voicemail(b4321)
exten => 43231,103,Hangup

include => demo ; I have added the demo so you can dial 1000 and test your phone

include => from-sip

Now to get/install VoixPhone
Download it from here: http://www.voixphone.com/voix-phone-download
Unpack it in to your /home/you/bin directory, make it executable (chmod +x) and double click the executable. That’s it, just follow the installer.

Configure VoixPhone to use your Asterisk Server
Just click “Alt+F2” to get the run dialogue and run “VoixPhone” (Don’t forget the capitals).

Now click the icon at the bottom that looks like a cog to get to the settings.
They are pretty self explanatory now that you have just configured Asterisk.

Server Address: 192.168.X.X – Your Asterisk server, obviusleh! 😉
Port: 4569
Username: richslxh
Password: 4321
Caller ID Name: richslxh
Caller ID Number: 4321

Next check your Sound Options to make sure your sound card has been detected.
It maybe the case that all 3 fields are empty, or you get a “Sound not working” error. Do not fear, you just need to load the oss module 🙂

sudo modprobe snd-pcm-oss

Just to be sure it loads at boot, you can add it to /etc/modules, but now you should have sound.

Now from the terminal run Asterisk, reload it, and then restart your VoixPhone. Everything should be hunky-dory 🙂

atserisk -r

reload

Now test VoixPhone with the Asterisk Demo by dialing 1000

Howto Quick n Easy Manual Wireless Wpa2 PSK

Manual Commandline Network setup:

So this guide is for those of you who only connect to the same router via Wpa2/Psk encrypted wireless. Although if you want to, you can scan and connect to any wireless connection manually using the wireless-tools suite of scripts.

Wireless setup via a Gui:

If you regularly roam and need to search for and connect to different wireless connections, i’d suggest you install wicd-gtk, it’s in most Linux distro repositories. There’s also network-manager-gnome which provides the nm-applet gui. I prefer the manual method as the gui apps tend to write over system config files. For example, nm-applet removes your dns configs in /etc/resolv.conf.

Wireless Firmware:

Ok, you need to have your wireless drivers installed and working. I’m using a Broadcom BCM4138, whose drivers are supplied via the “firmware-b43-installer” which fetches the firmware from openwrt.

More on B43 herehttp://linuxwireless.org/en/users/Drivers/b43#b43_and_b43legacy

Next up you need to authenticate with Wpa using PSK TKIP, this is accomplished by installing wpasupplicant:

sudo apt-get update

sudo apt-get install wpasupplicant

Now you need to edit a couple of files:

sudo vim /etc/network/interfaces

Supposing your wireless card is called wlan0, and you want a static IP address you add this:

auto wlan0
iface wlan0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1
wpa-ssid youressid
wpa-psk yourpassword

Just to make sure you can surf the net, check your dns config. I put my router IP and the Google Open DNS IP as well.

sudo vim /etc/resolv.conf

And add:

nameserver 192.168.0.1
nameserver 8.8.8.8

Now to connect, you only have to issue one command, then every time you login after that you will automatically be connected:

sudo ifup wlan0

That’s it, no need for Gui applications sucking resources and overwriting important files. Just a quick and easy auto-connected wireless every time you bootup.

Howto install Libre Office on Debian Squeeze / Crunchbang Statler

**UPDATE**

LibreOffice 3.4.2 Final is available at the end of July

You can download the 3.4.2 RC3 tar.gz from here, unpack and install the .debs manually if you prefer. (see comments)  http://www.libreoffice.org/download/

—————————————————————————————————————————————————-

Libre Office is currently only available in the wheezy ,sid and squeeze-backports repositories at the moment so I chose to install it from squeeze-backports.

1. You need to add backports to your sources.list:

sudo vim /etc/apt/sources.list

And add this line:

#SQUEEZE-BACKPORTS
deb http://backports.debian.org/debian-backports squeeze-backports main

2. Update apt with:

sudo apt-get update

3. Then install Libre Office with:

apt-get -t squeeze-backports install libreoffice


E voilá !

How to add a Google Plus One button to your WordPress blog

Now that Google + has finally started to let us all in, more and more peple want the Google + button on their websites, so i thought i’d put up a quick n easy guide.

Basically you need to add this code to the header of your site. In wordpress it’s a separate file called “header.php” in your Theme directory. But most website headers have the same format.
**Add it just before the tag.**


Now once that is done, you can add the following code to anywhere you want the Google Plus button to appear:

On wordpress, I need it to appear at the bottom of each post with the other “share” buttons, so I had to edit the “single.php” file, and place it just after the post content:


That’s it, now you’ll see a Google Plus One button so you can show me some love on Google + 🙂

Howto create a Virtualbox 4 image clone

VirtualBox 4 for multiple OS availability
If you are like me and do a lot of testing with Virtual Machines, then you will know that to keep having to create a new machine and installing a Debian netinstall each time is a complete p.i.t.a

Cloning vdi’s
No need for all that malarkey now. Just create a fresh VM, install a base Debian netinstall, or any other OS for the matter, i’ve got loads installed!

Once you have it all setup, shut down VirtualBox, open your terminal and issue a command like this:

vboxmanage clonevdi /home/rich/VirtualBoxVMs/Squeeze64/Squeeze64.vdi /home/rich/VirtualBoxVMs/Squeeze64b/Squeeze64b.vdi

As you can see, all my vdi’s are stored in /home/rich/VirtualBoxVms so just adapt the command to suite your needs.

The output will be like this (with a new uuid created for the harddisk):
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: cc76ae5a-719a-4833-b481-42f254f5fe2e

So, imagine you want to create a new Debian clone called “MyBigFatCopy”.

cd /directory/where/your/vdis/are/stored/
mkdir MyBigFatCopy

Now run the code from before:

vboxmanage clonevdi /home/you/VirtualBoxVMs/ORIGINAL/original.vdi /home/you/VirtualBoxVMs/MyBigFatCopy/mybigfatcopy.vdi

Adding your new clone to the VirtualBox list
Now open up VirtualBox4, choose “NEW” and create a VM called MyBigFatCopy

(**NOTE** It has to have “exactly” the same name as the directory you just created).

Instead of creating a new harddrive, just choose an “existing” vdi, yup, you’ve guessed, navigate to your newly cloned mybigfatcopy.vdi 🙂

Finish off, restart VirtualBox4, and fire up your new mybigfatclone.

If you are on a network (or want to run several VM’s at the same time), just make sure you change the hostname, and if it has a static IP address, change it to dhcp or a new static ip. Now you can fire up your clone alongside your original without any problems.

Happy Cloning! 😉

Crunchbang Linux Right Mouse Click Gpg Encrypt/Decrypt scripts

Thunar Right-Click Menu Encryption/Decryption
This was a script inspired by machiner on the LxH Forum who showed me a cool Encrypt/Decrypt script a while ago.

Gpg and Password Protection
I decided to add a password dialogue box as well, which is launched in an xterm. I tried a Zenity diaogue box, but it caused a few problems with input and output, so my work colleague Eduardo stepped in and suggested doing it with an xterm pop-up instead. Edu is a far better coder than me.

Pgp/Gpg Key Creation
Obviously you need to have created pgp-keypair, I used Gpg (Gnu Privacy Guard) frontend, and you can find a Howto HERE You will also need “xterm” installed, but should come as default.

The Encrypt/Decrypt Scripts
You need to create two bash scripts in either /usr/local/bin or your home ~/bin, I chose the latter as I always backup my personal scripts. I called them RMCencrypt and RMCdecrypt. “RMC” means Right Mouse Click 🙂

ENCRYPT

#!/bin/bash
# Handy Encryption Action ##

encrypt ()
{
#PASSWD=`zenity –entry –title “Password” –text “Enter password”`
#if [ “z$PASSWD” != “z” ]; then
# gpg -ac –no-options –passphrase $PASSWD “$1” || \
# zenity –error –text “Decryption failed: $?”
#else
# zenity –error –text “No password: Aborted”
#fi
xterm -e “gpg -ac –no-options ${1+\”$@\”}; echo -n \”Press \”; read”
}

## End Handy Encryption Action ##

encrypt ${1+”$@”}

DECRYPT

#!/bin/bash
## Handy Decryption Action ##
decrypt ()
{
#PASSWD=`zenity –entry –title “Password” –text “Enter password”`
#if [ “z$PASSWD” != “z” ]; then
# gpg –no-options –passphrase $PASSWD “$1” || \
# zenity –error –text “Encryption failed: $?”
#else
# zenity –error –text “No password: Aborted”
#fi
xterm -e “gpg –no-options ${1+\”$@\”}; echo -n \”Press \”; read”
}
## End Handy Encryption Action ##

decrypt ${1+”$@”}

Now just place those two scripts in ~/bin and make them executable (chmod +x).

Next up, open Thunar file manager, click the “edit” then “Configure custom file actions..” and add both scripts with a name and icon of your choice. I chose RMCencrypt and RMCdecrypt like the scripts, which Thunar Actions manager adds an %n after to encrypt the selected file.

You will now be able to encrypt and decrypt any file at the click of a (right) mouse button.


Howto Change all instances of a word in a Mysql database

This how to refers to an Smf Forum database but can just as easily be applied to a WordPress, or any other Mysql database.

I recently re-opened my old forum which is 5 years old and has a lot of old posts, people have changed usernames, email addresses. The forum has had three domain names, so it stands to reason that there is a lot to tidy up. So I set about updating a few things today.

The basic mysql syntax (which can be launched from Phpmyadmin Sql Tab) is this:

UPDATE table SET field_name = REPLACE(field_name, ‘tony’, ‘TONY’)

For example, to change an old url link to a new one in the body of forum posts:

UPDATE smf_messages SET body = REPLACE(body, ‘myoldurl.com’, ‘mynewurl.com’)

Obviously, you just change the table, field and text to be replaced.


Fix: gettext_domain not understood below schema

What does node not understood below mean?
A few people have posted on forums an mailing lists regarding this message, so I thought I’d post a quick fix/workaround.
PS: I had to mess around with that message as my blog wouldn’t post it, even with code tags.

You may install a package or do an update/upgrade from the terminal and see this come up:

Processing triggers for desktop-file-utils ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for gconf2 ...
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
WARNING: node not understood below
Processing triggers for man-db ...

This is due to the tag in /usr/share/gconf/schemas/ not being recognized.

You can do a simple grep to find out which schema is causing the problem with this command:

grep gettext /usr/share/gconf/schemas/*

In my case it was caused by the schema for gnome-keyring:

/usr/share/gconf/schemas/gnome-keyring.schemas: <gettext_domain>gnome-keyring</gettext_domain>

Where do all these .schemas come from?

I don’t use gnome-keyring, so I just removed it. But I was curious to see what was there so I cd’d into /usr/share/gconf/schemas to take a look, and in my case I see that practically all the schemas are Gnome related. I’m on Crunchbang Statler Openbox, but did install Gnome a while back to have a play wih a few apps.

This is what I saw:

ls -ln /usr/share/gconf/schemas/
apps_evolution_addressbook.schemas desktop_gnome_interface.schemas gedit.schemas
apps-evolution-attachment-reminder.schemas desktop_gnome_lockdown.schemas gedit-show-tabbar-plugin.schemas
apps_evolution_calendar.schemas desktop_gnome_peripherals_keyboard.schemas gksu.schemas
apps_evolution_email_custom_header.schemas desktop_gnome_peripherals_mouse.schemas gnome-audio-profiles.schemas
apps_evolution_eplugin_face.schemas desktop_gnome_sound.schemas gnome-sound-recorder.schemas
apps-evolution-external-editor.schemas desktop_gnome_thumbnail_cache.schemas gnome-terminal.schemas
apps-evolution-mail-notification.schemas desktop_gnome_thumbnailers.schemas gnome-volume-control.schemas
apps-evolution-mail-prompts-checkdefault.schemas desktop_gnome_typing_break.schemas gnumeric-dialogs.schemas
apps_evolution_shell.schemas desktop_gnome_url_handlers.schemas gnumeric-general.schemas
apps-evolution-template-placeholders.schemas epiphany-lockdown.schemas gnumeric-plugins.schemas
apps_xchat_url_handler.schemas epiphany.schemas gstreamer-0.10.schemas
bogo-junk-plugin.schemas evince.schemas gweather.schemas
desktop_default_applications.schemas evince-thumbnailer-comics.schemas metacity.schemas
desktop_gnome_accessibility_keyboard.schemas evince-thumbnailer-djvu.schemas nm-applet.schemas
desktop_gnome_accessibility_startup.schemas evince-thumbnailer-dvi.schemas notification-daemon.schemas
desktop_gnome_applications_at_mobility.schemas evince-thumbnailer-ps.schemas nst.schemas
desktop_gnome_applications_at_visual.schemas evince-thumbnailer.schemas rhythmbox.schemas
desktop_gnome_applications_browser.schemas evolution-mail.schemas system_dns_sd.schemas
desktop_gnome_applications_office.schemas evolution-webcal.schemas system_http_proxy.schemas
desktop_gnome_applications_terminal.schemas file-roller.schemas system_smb.schemas
desktop_gnome_applications_window_manager.schemas gcalctool.schemas vinagre.schemas
desktop_gnome_background.schemas gedit-drawspaces.schemas yelp.schemas
desktop_gnome_file_views.schemas gedit-file-browser.schemas

Solution Reinstall the offending package
I reinstalled gnome-keyring to take a look at its “.schema” only to find that the offending “gettext” tag no-longer exists. So it appears that it was a bug that has been reported and removed. So if you get this error, just reinstall the offending package and check the .schema, if it is still there, report it as a bug.

Now i’m off to remove all that nasty Gnome baggage 🙂

Complete Debian Linux Guide – On Your Desktop

There are guides that can be installed and accessed from your desktop, so no need for searching the internet to learn about Debian linux.

These multilingual guides can be installed with Synaptic or the command line:

debian-reference - metapackage to install (all) translations of Debian Reference
debian-reference-common - Debian system administration guide, common examples
debian-reference-de - Debian system administration guide, German translation
debian-reference-en - Debian system administration guide, English original
debian-reference-es - Debian system administration guide, Spanish translation
debian-reference-fr - Debian system administration guide, French translation
debian-reference-it - Debian system administration guide, Italian translation
debian-reference-ja - Debian system administration guide, Japanese translation
debian-reference-pl - Debian system administration guide, Polish translation
debian-reference-pt-br - Debian system administration guide, Portuguese translation
debian-reference-zh-cn - Debian system administration guide, Chinese(CN) translation
debian-reference-zh-tw - Debian system administration guide, Chinese(TW) translation

For example, I typed this in the terminal (and hit “enter”):
sudo apt-get install debian-reference-common debian-reference-en

Then once it was installed, I typed this in the terminal (and hit “enter”)
debian-reference

Then the complete Debian Reference Guide opened in my Chrome webbrowser. How cool is that ?!

Bind9 listen on IpV4 only – Disable IpV6

For whatever motive, and until IpV6 is fully adopted, you get speed increases on networks and internet by disabling IpV6 lookups wherever you can. This is how to disable IpV6 in Bind9

Login to your server as root and edit the bind9 file:

vim /etc/default/bind9

IPv4 only:

# run resolvconf?
RESOLVCONF=yes
# startup options for the server
OPTIONS=”-4 -u bind”

IPv6 only:

# run resolvconf?
RESOLVCONF=yes
# startup options for the server
OPTIONS=”-6 -u bind”

Once you have edited the bind9  file and chosen either IpV4 or IpV6, you need to restart the BIND service:

/etc/init.d/bind9 restart

Installing Status.Net (identi.ca) on a Hosted Server

Identi.ca and Status.net

I spend a lot of time chatting on identi.ca and saw a lot of remote instances linking in. Many were from the status.net domain where you can get your own microblog hosted by them. I tried this but kept going back to identi.ca, then realised you can download and install your own status.net instance.

Installaholic

There are many things I like to do, but installing stuff is what I have always liked about both Linux and Servers. Over the years I have installed and hosted practically every type of forum/blog/cms software. So methinks cool!, i’m gonna get me one of those! 🙂

Preparation

I’d already installed and setup a status.net instance on my home and work servers, so decided to install one at my LxH domain for myself and a few buddies. A bit of trial and error lead me to opt for a subDIRECTORY this time over a subDOMAIN. I think the best place for any site is at your host’s root or /var/www unless you are prepared to fiddle with htaccess files and other settings which may need to be redirected.

1. First I logged in to my hosting panel. My host is ICDSoft.com (but more about them later).

2. I decided to call my microblog “lxhica”, yeah, lxh + my favourite microblog site identI.CA 🙂

3. I created a subdirectory and database called lxhix¡ca, then I went to status.net downloads and downloaded the package from here (currently version 0.9.7fix1): http://status.net/download

4. Next I unpacked the tar.gz, connected to my host via ftp and uploaded the contents of the unpacked status.net directory to my newly created /www/www/lxhica directory on my server, and I was ready to go to my browser and navigate to the http://richs-lxh.com/lxhica address and begin the install.

A couple of things

1. Do the installation step-by-step and make sure you have the “fancy-urls” enabled at the beginning. If you don’t, and try to enable them afterwards, you are going to get get grief if you have already created accounts “before” they were enabled. With the fancy urls you get the mystatus.net/you and mystatus.net/group/mygroup links instead of numbers.

http://status.net/wiki/Download

2. Check to make sure your host has everything that status.net needs to run properly. Mainly Php Pear Modules,  Crypt_RSA and bcmath or gmp. If you aren’t sure, ask your host’s support team.

Finally

I Would like to say thanks to the ICDsoft Sure Support team who are second to none in my opinion. And also JordanC at status.net for the amazing assistance they gave me. You can see the support thread here:

http://forum.status.net/discussion/1578/solved-500-error-remote-postinggroups-identica-from-hosted-status.net

Solution Asterisk: manager.c: 127.0.0.1 tried to authenticate with nonexistent user ‘user’

If you get this error message with your Asterisk install, it’s because you have installed some kind of remote gui web manager, such as the op-panel.

manager.c: 127.0.0.1 tried to authenticate with nonexistent user ‘user’

The reason is because ot is trying to login with “user” + “secret” as a password and you haven’t yet added it to /etc/asterisk/manager.conf

So edit like this:

vim /etc/asterisk/manager.conf

Which should only have:

;
; Asterisk Call Management support
;

; By default asterisk will listen on localhost only.
[general]
enabled = yes
port = 5038
bindaddr = 127.0.0.1

; No access is allowed by default.
; To set a password, create a file in /etc/asterisk/manager.d
; use creative permission games to allow other serivces to create their own
; files
include “manager.d/*.conf”

Edit it so it looks like this with “user” added:

;
; Asterisk Call Management support
;

; By default asterisk will listen on localhost only.
[general]
enabled = yes
port = 5038
bindaddr = 127.0.0.1

[user]
secret = secret
deny = 0.0.0.0/0.0.0.0
permit = 127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

; No access is allowed by default.
; To set a password, create a file in /etc/asterisk/manager.d
; use creative permission games to allow other serivces to create their own
; files
include “manager.d/*.conf”

Now reload asterisk:

/etc/init.d/asterisk reload

And connect:

asterisk -r

And it should tell you that “user” has logged in successfully on 127.0.0.1

How to BBC iPlayer outside UK with Chrome

BBC iPlayer Howto-s
The LxH Planet just caught a feed from Kevie on how to download and save TV shows from the BBC iPlayer and I recall an outdated Howto I did a while ago on getting past the BBC’s IP address filter that blocks non UK web surfers before.

On Google Chrome
So I decided to do a Google Chrome version of the older howto as I don’t use Firefox nowadays.

1. Got to the Google Web Store and install the Proxy Switchy plugin
https://chrome.google.com/webstore/detail/caehdcpeofiiigpdhbabniblemipncjj?hl=en-US

2. Once installed, a Tab will open with Proxy Switchy setup. Add a new profile called “iPlayer”, and put the ip of a free UK proxy service and add port 80. ie. 91.198.27.139 _ 80

Getting lucky with Proxy Servers
*NOTE* The BBC isn’t stupid and are well aware fo proxy/vpn services and servers who abuse them by providing non-Uk access to their media. Some proxys are slow, others will have already been blocked, so it’s usually a game of proxy roulette to get a good one. 🙂

Having said that, combined with Kevie’s Howto which only downloads the streamed data, speed is irrelevant, as once it’s finished downloading you can watch it then.

Google “Free+UK+Proxy+Server” and yo’ll gte loads to choose from such as: http://www.freewebproxylist.com/UK_WebProxies.html

Howto install Creepy Social Stalker app on Crunchbang Linux

Get and install Creepy

1. Download the .deb file from here:
https://github.com/ilektrojohn/creepy/downloads

2. Use dpkg for first install run
Creepy needs a few dependencies, so first try and install with dpkg, and then move onto phase 2.

sudo dpkg -i creepy_0.1.92-1ubuntu1_all.deb

3. This will fail due to a lack of dependencies, so go get them:
Update apt first:

sudo apt-get update && sudo apt-get upgrade

Now get your dependencies:

sudo apt-get -f install

4. Now we can install Creepy:

sudo dpkg -i creepy_0.1.92-1ubuntu1_all.deb

Now hit Alt+F2 and run “creepymap”.

You will first have to allow it to connect to your Twitter account, (Settings, Authorize Creepy) where you will be given a special key which you need to copy and paste. Once that’s done, you are ready to start stalking your contacts. Mwahahahaha!

Solution Vncviewer -via ssh tunnel with Vinagre

Vncviewer remote desktop connection
At work if I have to connect to a client’s Windows machine, I used to go in with Vncviewer through a ssh tunnel with the –via option like this:

vncviewer -via clienthostorIP usercomputername:0

No Scaling with Vncviewer
The other day I cam up against a client with Windows 7 and an enormous screen and found I couldn’t scale it small enough to not have to scroll up and down, left and right every 5 minutes to click on the task bar etc.

Vinagre
My boss suggested Vinagre so I had a Google for vinagre+vnc+ssh+scaling and found it has scaling, and has recently added ssh tunneling as an extra option for the Vnc connection.

Well, no matter what I tried I couldn’t get it to connect via vnc with the ssh tunnel option so I came up with a workaround. Just open a ssh tunnel first, and then connect with Vinagre.

Open two tabs or two screens in your Terminal
Tab/Screen 1: open a ssh connection from your clienthostIP to localhost:

ssh -C -L 5901:usercomputername:5900 clienthostorIP

Tab/Screen 2: Open vinagre against localhost:

vinagre localhost:1

Now you can connect to your client with Vinagre via a ssh tunnel and have access to scaling etc.

Perl script to import posts from WordPress to Whird blog

Just as a personal project with Perl and Mysql, I decided to start working on a Perl script to import posts from my WordPress blog to my Whird blog.

Whird
Whird was designed by Corenominal, the Crunchbang Linux head developer, and it looked like a nice platform so I installed it to use as a personal blog and leave the WordPress blog for Linux related posts.
It occurred to me that I may like to import some non-linux posts from WordPress, and that’s where my project began.

Perl vs Php
Although I love Perl, importing data from one site to another is far better suited to Php, something which Corenominal agreed with me on, but I decided to use Perl basically because, to me, Perl is king.

I would highly recommend Whird if you are looking for a new blogging platform which is light, fast, and offers you complete control over the design.

The script below was tested on my localhost installs and imported all the WordPress posts to Whird perfectly. However, it still needs some work to also include attachments, tags and comments. It’s also a vast improvement to my original script which was importing the posts from a wordpress.sql dump instead of the database-to-database connections.

#!/usr/bin/env perl
#########################################################
# SCRIPT TO IMPORT WORDPRESS POSTS TO WHIRD
# BY richs scadding - http://debianandi.blogspot.com
#########################################################
use strict;
use warnings;
use DBI;
use DBD::mysql;
#use Mysql;
#########################################################
# ENTER YOUR DATABASE DETAILS
# Assumes whird and wordpress databases are on same host
#########################################################
my $host = "localhost";
my $dbase = "whird";
my $dbase_orig = "wordpress";
my $login = "rich";
my $pw = "4321";
#########################################################
# GET POSTS FROM WORDPRES AND INSERT THEM INTO WHIRD
#########################################################
my $dbh=DBI->connect("dbi:mysql:$dbase:$host", $login, $pw);
my $dbhorig=DBI->connect("dbi:mysql:$dbase_orig:$host", $login, $pw);
my $sthorig = $dbhorig->prepare("select * from wp_posts");
$sthorig->execute;
while (my $ref = $sthorig->fetchrow_hashref) {
my $sql = "insert into whird_content (_date, _title, _excerpt, _content, _slug, _type) values (".$dbh->quote($ref->{post_date}).", ".$dbh->quote($ref->{post_title}).", ".$dbh->quote($ref->{post_excerpt}).", ".$dbh->quote($ref->{post_content}).", ".$dbh->quote($ref->{post_name}).", ".$dbh->quote($ref->{post_type}).")";
$dbh->do($sql);
}
$sthorig->finish;
$dbh->disconnect();
$dbhorig->disconnect();

Speed up Debian/Crunchbang dns name resolution: Faster Internet

This is just a little tip for those who don’t know about it yet. You may find that your internet connection is a bit slow, or your browser takes a while to connect to certain websites. Well this little bit of editing will provide you with a noticeable difference in speed when browsing the internet.

The problem lies in /etc/nsswitch.conf, so we just edit one line:
Comment out the “hosts:” line, and a new line minus “mdns4_minimal [NOTFOUND=return]” and “mdns4”, so that it only reads “files” and “dns”. [see below]

————————————————————————–
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference’ and `info’ packages installed, try:
# `info libc “Name Service Switch”‘ for information about this file.

passwd: compat
group: compat
shadow: compat

#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: nis
—————————————————————————-

*Note* It’s always good practice to comment out and rewrite any changes you make on any system file, just in case you need to revert back to the default settings for any reason.

How to remove Captcha from Phpmotion v3

Video site for personal videos
I have been looking around for a Youtube style video script for a while, and after trying a few, including Joomla and WordPress with video plugins, I decided to give Phpmotion a go. The main reason is that I want a site that will just play local avi/divx/mpg/mp4 videos from a local /videos directory, NOT from Youtube and other “hosted” video sites.

Problems
Phpmotion has caused me no end of problems so far, but i’m intending to see it through, as it is quite a nice site once you hack it to get it working.

Squeeze and Php 5.3 –> Lenny 5.2 and Php 5.2
1. Doesn’t support Php 5.3 yet, which is a pain as we have just upgraded all our work and home servers to Debian Squeeze, so I had to install a Debian Lenny on our work Kvm machine. Also it doesn’t look like the Phpmotion developer is going to upgrade any time soon: http://phpmotion.com/forum/index.php?topic=19028.0

Captcha is borked
2. The Captcha on phpmotion is borked, and there are a lot of support requests on the forums regarding this problem:
Google: site:phpmotion.com/forum captcha+doesn’t+show
The solution offered by the devs is “Just downgrade to Php 5.2”.
It appears the best way is to just remove it. (Hence the title of this post)

X doesn’t exist on this server
3. As I type, there are still files and directories that are be reported as not found, when clearly they are there, and have the correct permissions.

a) I created a new test account, logged in (account exists), then went to my profile http://domain/phpmotion/members/test only to get a 404 error page:
Not Found
The requested URL /phpmotion/members/test was not found on this server.

b) As administrator, I tried to upload a test video, only to be told that /cgi-bin/uu_upload.pl doesn’t exist, as you can see below it plainly does!.
test@lennyapache:/var/www/phpmotion/cgi-bin$ ls
audio uu_default_config.pm uu_ini_status.pl uu_lib.pm uu_upload.pl

c) There is more, profile directories that don’t exist, upload directories that don’t exist, phpmotion files that don’t exist etc etc. But anyway, i’ll keep hacking until I get some sort of functionality.

PS: If you want to have a Captcha-free Phpmotion, rename this “inner_signup_form.txt” to “inner_signup_form.htm” and upload it to your “phpmotion/themes/default/templates” directory 🙂

Shopt for Bash – Cdspell for cd dir change mistypes

What is shopt? A marvellous BASH builtin command, that’s what it is!

I’ve added the whole shopt list to my .bashrc below, but i’m only going to talk about CDSPELL for cd dir change mistypes. One thing to remember is that if you issue a shopt command manually as a user or root, then close your terminal, it will revert back to OFF. I have added the shopt options to my .bashrc so that I can enable and disable the specific options i need. There are a few that are enabled by default, so if you decide you want them disabled permanently you just add a -u switch before them.
See the syntax below for enabling and disabling shopt options.

Issuing shopt SET or UNSET commands: From http://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html

Syntax
shopt [-pqsu] [-o] [optname …]

Options
-s Enable (set) each optname

-u Disable (unset) each optname.

-p Display a list of all settable options, with an indication of
whether or not each is set. The output is displayed in a form
that may be reused as input. (-p is the default action)

-q Suppresses normal output; the return status indicates whether the optname
is set or unset. If multiple optname arguments are given with `-q’,
the return status is zero if all optnames are enabled; non-zero otherwise.

-o Restricts the values of optname to be those defined for the `-o’ option to
the set builtin.

The cdspell bash builtin:
As you can see below, apart from the autoset options, I have manually set cdspell. If you spend a lot of time navigating directories via the terminal, you will often make spelling mistakes like “/ect”or “/Etc” instead of “/etc”, with cdspell enabled, bash will autocorrect the mistake and allow you to hit enter and still get to your destination. This saves a lot of time having to keep going back back and correcting directory paths.

My .bashrc shopt section:
############################
#
# SHOPT AUTOSTARTS
#
############################
# autocd
# cdable_vars
shopt -s cdspell # on MANUAL
#checkhash off
#checkjobs off
#checkwinsize on AUTO
#cmdhist on AUTO
#compat31 off
#compat32 off
#compat40 off
#dirspell off
#dotglob off
#execfail off
#expand_aliases on AUTO
#extdebug off
#extglob on AUTO
#extquote on AUTO
#failglob off
#force_fignore on AUTO
#globstar off
#gnu_errfmt off
#histappend on AUTO
#histreedit off
#histverify off
#hostcomplete off
#huponexit off
#interactive_comments on AUTO
#lithist off
#login_shell off
#mailwarn off
#no_empty_cmd_completion off
#nocaseglob off
#nocasematch off
#nullglob off
#progcomp on AUTO
#promptvars on AUTO
#restricted_shell off
#shift_verbose off
#sourcepath on AUTO
#xpg_echo off
############################

Script to edit first letters of multiple files

This is a simple one, and there are just loads of ways to replace lines/characters/spaces with Perl one-liners and Bash.

The main point of this script is when I install a new distro and want to shutdown services that startup automatically on each run level, for Ubuntu in the directories rcS.d, rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d

Each item begins with an “S” for START or a “K” for KILL with a number that pertains to the order of priority (ie S25bluetooth). And depending on the run-level, and how many apps you have installed, this could be 10-20 services launched at boot.

#!/bin/bash
############################################
#KILL STARTUP SERVICES
############################################
#By richs-lxh – http://richs-lxh.com
############################################
#CHANGE “ONLY” THE “FIRST” CHARACTERS AT THE
#BEGINNING OF A FILE (EG FILES S20* to K20* )
############################################
for i in S* ;
do mv “$i” “${i//S/K}”;
done

So if you want to kill all the processes that start with S20, it would be:
for i in S20* ;
do mv “$i” “${i//S20/K20}”;
done

The reason I posted this little script is that when you Google search for scripts and one-liners to edit filenames via the CLI, practically every guide offers newbies an example of how to change the “suffixes” (ie replace .html with .htm) but no clue on how to batch-replace the beginning of filenames.

Speedkill – Perl Script to hunt and kill selected PIDs

If you ever run a selection of applications or processes and regularly get lock-ups due to a lack of processing power or RAM. This script allows you to add a selection of non-essential apps to a list which can be knocked-out if resources are running low.

Just copy and paste this script to a file called “speedkill” in /usr/local/bin or your /home/user/bin, make it executable, and then you can run it from the terminal if things start to get a bit “iffy” 🙂 Just edit the line “my $processes = “google-chrome claws-mail conky volwheel”;” and add any apps you can do without.


###########################################
# DESCRIPTION:
#
# This script will kill a bunch of
# expendible processes if your system
# gets frozen.
#
###########################################
# PERL MODULES TO USE
###########################################
# NONE
#use NOTHING
###########################################
# Debugging:
use strict;
use warnings;
###########################################
#Let's tell the user the carnage they are about to inflict
#
print "Hunting down enemy PIDs...\n";
#
#Then we need to find the PIDs of expendable apps

#for my $file (@ARGV) {
my $processes = "google-chrome claws-mail conky volwheel";
my @processes = split (" ", $processes);
for my $process (@processes) {
open (PID, "pidof $process |");
while ($_ = ) {
my @list = split (" ", $_);
for my $pid (@list) {
print "Killing pid $pid ($process)\n";
system ("sudo kill -9 $pid");
}
}
close PID;
}

print "Like lambs to the slaughter!\n";

Simple Perl Ping Script – Local and Remote

A Perl Beginner Template to play with
This is just a little script I slung together to play with LWP::SIMPLE and NET::PING Perl modules. The main idea is to get info from a website (dyndns.org), clean it up and use it for either input or output. I also wanted a few bits of code for user (choice) input as well. It’s another base that a beginner can build on.

Ask and Go Fetch
It asks for input and based on the reply performs one of two different tasks and offers some info. Nothing more, nothing less. However, if you look at the actions it performs, you will see that this basic script can be adapted to acquire any type of information from any website, which in turn can be used for a completely different script.

#!/usr/bin/perl
#
# This script will get a local or remote IP, ping the address and tell you if the ADSL line is up
# By Rich Scadding  @ http://debianandi.blogspot.com
#
#######################
# PERL MODULES TO USE #
#######################
# Ping Module
use Net::Ping;
# Get Html
use LWP::Simple;# Debian apt-get install libwww-perl
# Debugging
#use strict; (commented as it throws up errors)
use warnings;
#######################

# Check if an ip adress is alive
print “Which IP shall I check? Yours [1] Other [2]: “;
my $answer = ;
chomp $answer;
# If the idiot can’t type, tell them!
die “No, only press 1 or 2. Try again!\n” if ($answer ne “1” and $answer ne “2”);
# 2 needs an IP from the user
if ($answer eq “2”) {
print “Type the IP Address: “;
my $IP = ;
chomp $IP;
print “Checking their IP\n”;
my $p = Net::Ping->new(“icmp”);
print “$IP is alive.\n” if $p->ping($IP);
print “$IP is as dead as a Dodo.\n” unless $p->ping($IP);
$p->close();
}
# 1 will get the external IP from dyndns.org
if ($answer eq “1”) {
my $html;
$html = get( ‘http://checkip.dyndns.org&#8217; );
chomp $html;
print “Checking your IP\n”;
# Print the result from the html file
$html =~ s/.*ddress: //;
$html =~ s/<\/body.*//;
print “$html\n”;

# Remove the html tags from the message and set the resulting IP as $address
my $address = $html;
chomp $address;
$address =~ s/.*ddress: //;
$address =~ s/<\/body.*//;

# Print a ping message
print (“Pinging $address\n”);

# Ping the IP address and report if it is up
my $p = Net::Ping->new(“icmp”);
print “$address is alive.\n” if $p->ping($address);
print “$address is as dead as a Dodo.\n” unless $p->ping($address);
$p->close();
}

As I said, quite basic, and you could just manually ping an IP from the terminal, no need for a script. However, as with most scripts and one-liners, it’s about finding out how to perform certain actions which can be applied to other uses.

Simple Bash Backup Script

I often play around with little Bash scripts and Perl One-Liners in my quest to learn more. This particular script backs up specific data that I need when I reinstall an (Debian) OS.

I’ve got various versions and this is just a base (which you can add-to and play with). As always, with any code, especially Bash, there are a whole heap of ways to write backup scripts, both long and short, but this script is only intended to show newer users some basic commands, and to act as a template for further investigation.

#! /bin/bash
#
#SIMPLE BASH BACKUP SCRIPT BY RICHS-LXH
#
#SAVES FILES TO A DATED DIR ON YOUR /STORAGE PARTITION
#
#ON SCREEN MESSAGE AND LOG CREATED
echo Backing up your data…
echo Backup started `date` >> ~/backuplog
#CREATE NECESSARY FILES
cd /storage
mkdir -p backups/`date +%Y%m%d`
mkdir -p backups/tmpdata/important/
#COPY FILES YOU WANT BACKED UP
sudo cp /etc/host* backups/tmpdata/important/
sudo cp /etc/X11/xorg.conf backups/tmpdata/important/
sudo cp /etc/network/interfaces backups/tmpdata/important/
#EMPTY THE TRASH BEFORE HOME BACKUP !!!
sudo rm -rf /home/rich/.local/share/Trash/files/*
#WAIT UNTIL IT HAS FINISHED REMOVING ALL THE TRASH
wait
#COPY ENTIRE HOME DIR RECURSIVELY TO TMPDATA
sudo cp -a /home/rich backups/tmpdata/
#CD TO TMPDATA AND CREATE A COMPRESSED BACKUP TAR.GZ
cd backups/tmpdata
tar -czf /storage/backups/`date +%Y%m%d`/bkp.tar.gz *
cd ..
#REMOVE THE TEMPORARY DATA
wait
sudo rm -rf tmpdata
#WRITE A LOG AND PRINT A MESSAGE
echo Backup Finished `date` >> ~/backuplog
echo All your data successfully backed up!

Tribler decentralized P2P Torrent App on Debian Squeeze

Tribler means no more central servers or tracker downtime. You ARE the Network.

From: TorrentFreak

BitTorrent is a great technology to share files both quickly and efficiently, but like all other P2P-technologies it has an Achilles’ heel. The download process relies in part on central servers that can crash or go offline for a variety of reasons. To address this vulnerability the first truly decentralized BitTorrent/P2P client has been developed, meaning that no central trackers, or even BitTorrent search engines are required to download movies, software and music.

BitTorrent is branded as a peer-to-peer technology, but despite this label the downloading process still relies heavily on central servers. In the first place there are the BitTorrent search engines and indexes such as The Pirate Bay and isoHunt. These are needed to search for content and to grab the .torrent file one needs to download a file.

Tribler install on Debian Squeeze
I decided to give it a go on Debian Squeeze. Even though they say they are still working on the Linux version, there are some Ubuntu related .deb files available for download.

So I downloaded this file from http://tribler.org:
http://www.tribler.org/download/tribler_5.2.1-1ubuntu1_all.deb

A “dpkg -i tribler_5.2.1-1ubuntu1_all.deb” threw up dependency errors, so i issued an “apt-get -f install” to install any dependencies.

Vlc and Python-vlc
Tribler relies on VLC media player to play music and video, and as such also needs the VLC python bindings.
Unfortunately an “apt-cache search” showed me that there is no python-vlc package in the Debian Squeeze repos, so I searched Google and found an Ubuntu version here:
http://code.google.com/p/vlc-python-bindings/downloads/list
I downloaded the latest i386 version (HERE) and installed it via dpkg and then reinstalled Tribler. Everything installed nicely and I now have it up and running on my Debian Squeeze laptop.

Screenie of Trible on Debian Squeeze with OpenBox desktop


virt-manager ERROR:root:Unable to initialize GTK: could not open display

I recently installed Kvm on my Debian server to have a play with Qemu Virtual Machines. We have this set up at work so i’m pretty familiar with the system.

However, after installing kvm, qemu, vnc4server and vnc4viewer to access my server, when I tried to run virt-manager one of two things happened.

1. As a normal user I had no privileges to create or manage VM’s
2. As root or sudo user virt-manager wouldn’t even launch from the terminal, just gave me a whole string of Gtk error messages.

virt-manager ERROR:root:Unable to initialize GTK: could not open display

So, methinks, A: I need root/sudo privileges, BUT! you NEVER, EVER run graphical apps as root, it’s a no-no.

That’s where I found the solution. To run graphical apps as root/sudo you use GKSU not SU

Solution:

sudo apt-get install gksu

sudo vim /usr/bin/virt-manager

Then in between exec and python, just add a gksudo like this:

#!/bin/sh

exec gksudo python “/usr/share/virt-manager/virt-manager.py” “$@”

Now when I run virt-manager as a normal user, everything is fine.

Error ‘unknown group ‘freerad’ in statoverride file’

Dpkg Error after removing Freeradius
I came across this little error with Dpkg recently after installing and then removing Freeradius on my Squeeze box. It appears that even after removing (and purging) Freeradius, the user and group entries remain in the statoverride file. The statoverride file is located in /var/lib/dpkg/ and contains various entires depending on what you have installed.

Dpkg Statoverride details:
http://man-wiki.net/index.php/8:dpkg-statoverride

I had a list of other entries for the user Freeradius and also Freeradius group entries as well.

root freerad 640 /etc/freeradius/experimental.conf
root mlocate 2755 /usr/bin/mlocate
freerad freerad 2751 /etc/freeradius/certs
freerad freerad 755 /var/run/freeradius
freerad freerad 2751 /etc/freeradius
root freerad 640 /etc/freeradius/preproxy_users
root incron 2755 /usr/bin/incrontab
root freerad 640 /etc/freeradius/policy.conf
root freerad 640 /etc/freeradius/huntgroups
root freerad 640 /etc/freeradius/attrs
root incron 1731 /var/spool/incron
root freerad 640 /etc/freeradius/proxy.conf
root incron 640 /etc/incron.deny
root freerad 640 /etc/freeradius/ldap.attrmap
root freerad 640 /etc/freeradius/acct_users
root freerad 640 /etc/freeradius/eap.conf
root freerad 640 /etc/freeradius/attrs.pre-proxy
root incron 640 /etc/incron.allow
freerad freerad 2751 /etc/freeradius/sites-available
root freerad 640 /etc/freeradius/hints
root freerad 640 /etc/freeradius/radiusd.conf
root freerad 640 /etc/freeradius/clients.conf
root freerad 640 /etc/freeradius/attrs.access_challenge
root freerad 644 /etc/freeradius/dictionary
root ssl-cert 710 /etc/ssl/private
root freerad 640 /etc/freeradius/policy.txt
root freerad 640 /etc/freeradius/sql.conf
root Debian-exim 640 /etc/exim4/passwd.client
freerad freerad 750 /var/log/freeradius
root freerad 640 /etc/freeradius/attrs.accounting_response
root crontab 2755 /usr/bin/crontab
root freerad 640 /etc/freeradius/attrs.access_reject

Clean up
I just opened it with Vim and used the “d+d” keystroke to delete each entire line. Did an apt-get update and hey presto! All solved. Now it’s back as it was before Freeradius was installed:

root mlocate 2755 /usr/bin/mlocate
root incron 2755 /usr/bin/incrontab
root incron 1731 /var/spool/incron
root incron 640 /etc/incron.deny
root incron 640 /etc/incron.allow
root ssl-cert 710 /etc/ssl/private
root Debian-exim 640 /etc/exim4/passwd.client
root crontab 2755 /usr/bin/crontab

Count from one to ten in binary

Counting in binary:
Counting in binary is similar to counting in any other number system. Beginning with a single digit, counting proceeds through each symbol, in increasing order. Decimal counting uses the symbols 0 through 9, while binary only uses the symbols 0 and 1.

Decimal and Binary jump to the left:
When the symbols for the first digit are exhausted, the next-higher digit (to the left) is incremented, and counting starts over at 0.

In decimal, counting proceeds like so:
000, 001, 002, … 007, 008, 009, (rightmost digit starts over, and next digit is incremented)
010, 011, 012, … …
090, 091, 092, … 097, 098, 099, (rightmost two digits start over, and next digit is incremented)
100, 101, 102, …

Decimal from 0-9 then left Binary from 0-1 then left:
After a digit reaches 9, an increment resets it to 0 but also causes an increment of the next digit to the left. In binary, counting is the same except that only the two symbols 0 and 1 are used.

After a digit reaches 1 in binary, an increment resets it to 0 but also causes an increment of the next digit to the left:
0000,
0001, (rightmost digit starts over, and next digit is incremented)
0010, 0011, (rightmost two digits start over, and next digit is incremented)
0100, 0101, 0110, 0111, (rightmost three digits start over, and the next digit is incremented)
1000, 1001, …

Count from 1 to 10 in Binary
Dec Bin
0 = 0
1 = 1
2 = 10
3 = 11
4 = 100
5 = 101
6 = 110
7 = 111
8 = 1000
9 = 1001
10 = 1010
11 = 1011
12 = 1100
13 = 1101
14 = 1110
15 = 1111
16 = 10000

Base 2 System:
Since binary is a base-2 system, each digit represents an increasing power of 2, with the rightmost digit representing 20, the next representing 21, then 22, and so on. To determine the decimal representation of a binary number simply take the sum of the products of the binary digits and the powers of 2 which they represent.

For example, the binary number:100101 is converted to decimal form by:
[(1) × 25] + [(0) × 24] + [(0) × 23] + [(1) × 22] + [(0) × 21] + [(1) × 20] =
[1 × 32] + [0 × 16] + [0 × 8] + [1 × 4] + [0 × 2] + [1 × 1] = 37
To create higher numbers, additional digits are simply added to the left side of the binary representation.

Gratuitously stolen from http://en.wikipedia.org/wiki/Binary_numeral_system

The Linux directory structure – What lives where?

Just open up a terminal and have a browse through these directories to get an idea of where everything is.

To Change to a Directory use:
cd
To LiSt what’s in it use:
ls
To LiSt even the hidden files, ask for All:
ls -a

What directories are there and what do they contain?

/ – This is the root directory. Under windows, DOS, OS/2, and cousins, there’s a seperate root directory for each drive or partition. Linux and other Unix variants put everything in one directory tree, and this is at the base. There’s generally not much in here other than directories, although kernel images might be stored here too.

/boot – Some distros store kernel images and other miscellaneous files needed to boot here.

/tmp – Generally only temporary files needed at boot. Things that need temporary storage after boot generally use /var/tmp, but this isn’t universal by any means.

/mnt – This is where directories go for mounting various miscellaneous filesystems. Sometimes, /cdrom and /floppy are used for mounting cdrom and floppy devices, but I’m not sure how many distros other than Debian do this. /mnt is also sometimes called /mount.

/lib – Libraries needed at bootup. Libraries not needed at bootup but needed after the system is running should go in /usr/lib. Kernel modules generally go in /lib/modules/.

/dev – Device files go here. These are special files created by the Linux kernel that can be used by programs to control hardware devices. Note that network interfaces (eth0, ppp0, etc) don’t exist here.

/proc – This filesystem doesn’t actually exist on disk. It contains files that provide information about the state of the computer, including info on running processes, hardware states, and memory usage. Most of the files aren’t easily read by humans, though.

/var – Contains data changed when the system is running normally. /var/tmp, for example, should be used for storing temporary files. Various processes and daemons dump logs here, and some important subdirectores are:

/var/lock – Lock files. These are created by programs when accessing a specific resource. They don’t actually prevent access, so respecting a lock file is more of a politeness thing. Most programs do respect them, and thus you don’t have to worry about them unless you’re writing a program.

/var/log – Log files are generally written here. This directory may grow quite large, and so may require regular cleaning.

/var/run – Contains various bits of runtime information.

/var/lib – Contains various files needed while the system is running. One that will almost definitely be of interest to laptop users is /var/lib/pcmcia/stab, which contains some information about PCMCIA devices.

/var/spool – Mail, news, and printer queues get stored here.

/root – Home directory of the root user. Shouldn’t be much stored here at all, as you should be using normal, unprivilaged users for anything that doesn’t require root privilages.

/home – This contains the home directories of most of the users on the system. You can type cd to return to your home directory, and you can use ~/ as a shortcut to refer to your home directory. Personal config and data files for normal users go here.

/etc – Probably where you’ll spend most of your time as root, this is where most system-wide configuration files are stored. Files for specific users are almost always stored in the user’s home directory. The contents will vary depending on what you’ve got installed, but some subdirectories that are probably of interest are listed below.

/etc/X11 – This is where system-wide X11 configuration files are stored. XF86Config stores data used by the server to set up the environment. /etc/X11/fonts is where the fonts used by the server are stored, and window managers generally create subdirectories for their config files.

Boot related stuff for Debian:

/etc/init.d – Debian stores the actual scripts for starting daemons and services here. Not all of these are necessarily started at boot time, so don’t remove any unless you’re absolutely sure its safe. Most are created and removed by their associated packages, so you’ll rarely have to do anything here.

/etc/rcS.d – These are soft links to scripts in /etc/init.d that are run during startup no matter what runlevel the system’s booting into. The files start with an S followed by two digits – services are started in an order determined by these two digits. For example, S24foo is started before S42bar. The rest of the filename should be the name of the file in /etc/init.d the file is linked to.

/etc/rc0.d through /etc/rc6.d – These are soft links, just like in /etc/rcS.d, except they’re only executed when entering the specified runlevel. 0 is shutdown and 6 is reboot. Anything starting with a K shuts down a process, and anything starting with an S starts one. Other than that, they follow the same rules as /etc/rcS.d. By default, as far as I can tell, Debian boots into runlevel 2.

/bin and /sbin – Programs and system programs needed when the system is booting, respectively. Most are also useful after the system boots up, but they’re put here because they’re generally needed before any other programs.

/usr – Unix System Resources. This is the really big directory. Almost everything goes under here, unless I mentioned it above, so I’m going to go into quite a bit of detail about subdirectories and so on.

usr/X11 – These are files used by X11, and the files under them are structured like the /usr directory.

/usr/bin – Binary files (program executables) that aren’t needed during boot go here. This is probably where most of the programs you use during normal system operation reside.

/usr/sbin – These are system programs not needed during boot.

/usr/games – Game programs and (sometimes) data files and configuration stuff.

/usr/include – C and C++ header files. Probably not of much interest to you unless you’re into programming with C and/or C++.

/usr/lib – Library and shared library files not needed at bootup.

/usr/info – Data files needed by the GNU info program.

/usr/man – Data files needed by the man program.

/usr/src – Source code files. The linux kernel source is usually in /usr/src/linux.

/usr/doc – Documentation files go under here. There’s probably quite a lot here, and there are quite a few programs that just put copyright and changelog files here and document themselves through man or info. Of particular interest is the HOWTO directory where (probably) your distribution has placed a collection of HOWTOs from http://www.linuxdoc.org. These aren’t quite as simplified as NHFs, but they’re still quite good.

(The perceptive will notice that most directories in /usr/doc are actually links to the real location of the documentation…)

/usr/local – This directory contains things that are specific to the local system. Really only takes on any meaning if /usr is being mounted from a remote machine, VIA smb or nfs or some other networking filesystem. In that case, /usr/local would be a partition on the local machine, and the machine’s user would put their programs there. This directory is usually structured like the /usr tree is.

/usr/shared – Shared files for programs go here. What a program puts here is, as far as I can tell, pretty much arbitrary, but sound files seem to be a fairly common thing to put here.

That’s all the major directories I could pick out of my filesystem. If I’ve made any mistakes, left anything out, or whatever E-Mail me at the above address and I’ll be glad to try and include it.

Start or Stop Iptables Firewall on Debian Linux

I have been given the task at work of configuring the firewalls for a client with a large network and various servers. The system has a lot of security implemented which requires specific control of users, subnetworks, and who has access rights to certain network and internet resources.

Configuring a single computer is relatively easy, and you can find many guides on the net, but I was curious to see that on some Ubuntu/Debian based forums and blogs, people were treating iptables as a service which it most certainly isn’t. There appears to be some confusion between Debian, Redhat, and derivatives (Ubuntu, Fedora, CentOS etc).

Difference between Redhat and Debian
Redhat, Fedora, CentOS do have a script in /etc/init.d which allows you to {save|stop} the iptables configuration, and I believe some people were mistakenly trying to apply it to Debian based systems. That’s not to say that you couldn’t create a Start/Stop script, but it doesn’t come as standard.

Iptables is a command, not a service
Iptables is a command to manipulate the netfilter kernel firewall. Just as modprobe will allow you to load a kernel module, but you can’t /etc/init.d/modprobe start, or service modprobe start. Iptables works the same. It issues, saves, removes commands.

To get Iptables:
sudo apt-get install iptables

Or see if it is already installed:
dpkg -l | grep iptables

How to Enable/Start/Configure Iptables (as root):
Create an empty firewall.rules file that can be manually configured by issuing commands via the terminal and then saving again.
iptables-save > /root/firewall.rules
and/or
iptables-restore < /root/firewall.rules

Now issue these commands as root sequentially:
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

Save your config:
Once you have issued them, save them to firewall.rules with the same command you used to create the file.
iptables-save > /root/firewall.rules

Now you can check to see if the rules file is no longer empty:
vim /root/firewall.rules

Which should give you something like this:(A completely open Firewall)
# Generated by iptables-save v1.4.8 on Wed Oct 27 09:40:48 2010
*mangle
:PREROUTING ACCEPT [106:16689]
:INPUT ACCEPT [79:11460]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [59:9812]
:POSTROUTING ACCEPT [65:10676]
COMMIT
# Completed on Wed Oct 27 09:40:48 2010
# Generated by iptables-save v1.4.8 on Wed Oct 27 09:40:48 2010
*nat
:PREROUTING ACCEPT [46:8205]
:POSTROUTING ACCEPT [14:1382]
:OUTPUT ACCEPT [14:1382]
COMMIT
# Completed on Wed Oct 27 09:40:48 2010
# Generated by iptables-save v1.4.8 on Wed Oct 27 09:40:48 2010
*filter
:INPUT ACCEPT [30:6110]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [24:4552]
COMMIT
# Completed on Wed Oct 27 09:40:48 2010

This is just a basic first step to setting up iptables manually. At work we have a template firewall script that runs from RC2.d at boot on our clients’ and our office servers, and is approximately 250 lines long.

Documentation on the web:
http://www.netfilter.org/
http://www.netfilter.org/projects/iptables/index.html
http://www.netfilter.org/documentation/index.html#documentation-howto

Asterisk 1.8 on Debian Squeeze

As we work a lot with Asterisk PBX systems at work, I decided to download and compile the latest version 1.8 on my Squeeze installation (which hopefully will become the new “stable” soon)

1. Create a temporary directory:
mkdir /home/rich/tmp

2. Change to tmp
cd /home/rich/tmp

3. Get the Asterisk 1.8 tarball from here:
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz

4. Unpack it:
tar xvf asterisk-1.8-current.tar.gz

5. Get some dependencies that are need for Asterisk and Documentation:
sudo apt-get install libxml2-dev libncurses5-dev doxygen libgtk2.0-dev

6. Compile Asterisk 1.8
./configure
make
sudo make install

7. Install the documentation:
make progdocs

All went schwimmingly!

Time to have a play. 🙂

How to Gpg sign emails with Mutt

After having set up Mutt, I decided to try and find out where to add any pgp settings to use my gpg key signature on each email.

I Googled a bit and read various guides, and the quickest one I found was t copy a default gpg config file over and leave it as it is:

cp /usr/share/doc/mutt/examples/gpg.rc /home/rich/.mutt

Now, when I compose a new email, I hit “:wq” to write and quit, and now all I need to do is hit “p” and a new Pgp encryption menu appears with various options.

I choose “a” for “Sign As…”, then add the name of the Gpg key I wish to use. In this case it’s “rich scadding (richs-lxh). Then once I hit “y” send, I get asked for my Gpg password and everything is done.

So, to recap:
1. cp /usr/share/doc/mutt/examples/gpg.rc /home/rich/.mutt
2. Open Mutt and hit “m” to compose an email
3. Write and Quit
4. Hit “p” to sign the email
5. Choose option “a” for “Sign As….”
6. Add the name of the Gpg key you wish to sign with.
7. Hit “y” for Yes to send
8. Enter your Gpg password

How to Use Mutt Email Client with Gmail

Going back to terminal based apps:
I’ve just recently gone back to the old-school ways of using the terminal instead of gui apps, as at work we administer a lot of Debian based servers remotely via ssh. My desktop now has one terminal open, with around 5-6 “Screens” with Mutt(email), Irssi(IRC), TwitVim(Identica), Elinks(Web) and a couple of spares for terminal/ssh work and editing with Vim.

Mutt is easier than you think:

Installing Mutt
To install mutt on Crunchbang/Squeeze:

sudo apt-get install mutt

Next, in the terminal, create these directories that mutt needs to cache message headers and bodies, and store certificates:

mkdir -p ~/.mutt/cache/headers
mkdir ~/.mutt/cache/bodies
touch ~/.mutt/certificates

Now, create a basic Gmail-ready .muttrc
Choose your own text editor, I use Vim

vim .muttrc

And paste this basic gmail-ready config:
Once you have it pasted, edit the Gmail account details (everything you’ll need to alter is IN CAPITALS.) and save the file.
**Note** If you are in the UK you will need to use a slightly different config:HERE

**Edit** Darrin suggested that as your password is in plaintext, it may also be a good idea to encrypt your home directory as well for added security. (I’ll try to post a guide on single file encryption, directory encryption and entire drive/partition encryption at a later date) Thanks for the suggestion Derrin.


# Change the following six lines to match your Gmail account details
set imap_user = "YOUR.EMAIL@gmail.com"
set imap_pass = "PASSWORD"
set smtp_url = "smtp://YOUR.EMAIL@smtp.gmail.com:587/"
set smtp_pass = "PASSWORD"
set from = "YOUR.EMAIL@gmail.com"
set realname = "YOUR NAME"

# Change the following line to a different editor you prefer.
set editor = "vim"

# Basic config, you can leave this as is
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set record = "+[GMail]/Sent Mail"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
alternative_order text/plain text/html *
auto_view text/html
bind editor complete-query
bind editor ^T complete
bind editor noop

# Gmail-style keyboard shortcuts
macro index,pager y "unset trash\n " "Gmail archive message"
macro index,pager d "set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n " "Gmail delete message"
macro index,pager gi "=INBOX" "Go to inbox"
macro index,pager ga "=[Gmail]/All Mail" "Go to all mail"
macro index,pager gs "=[Gmail]/Starred" "Go to starred messages"
macro index,pager gd "=[Gmail]/Drafts" "Go to drafts"

Start Using Mutt:
Run it from the terminal by simply typing mutt and hit “enter”. The first time you do this, you’ll be prompted to accept two SSL certificates from Google; press ‘a’ to always accept these certificates. You should now be greeted by your Gmail inbox.

Navigating, Reading and Sending Emails

Mutt is controlled from the keyboard and the following shortcuts will get you up and running:
For a more in depth list of commands and config features, either hit the “?” key in an open Mutt session or type “man mutt” in the terminal.

j to move down.
k to move up.
d to delete a message
y to archive one
gi to view your Inbox
ga to view All Mail
gd to view Drafts
gs to view Starred messages

And here are a few more that are particular to mutt:

t will mark a message
s will save one, or more
c lets you change to a different folder
/ lets you search the current folder

Sending Email with mutt
The basics look like this:

1. Type m (or r if you’re replying to a mail)
2. Enter the recipients email address; hit Return
3. Enter a subject; hit Return
4. Write your message.
5. Save it.
6. Type y, and your message will be sent.

Type q to quit mutt.

Smf Forum – Merge Member Posts and PM’s with MySQL

So what happens when you decide to have a clean up on your Simple Machines Forum, and part of that clean up is to remove inactive users?

Inactive Members Removed
Well, the user gets removed but their posts remain on the forum unless you specifically delete the account and choose to remove all post. Otherwise the username remains with the word “Guest” alongside each post.

Member Returns
It can sometimes happen that a member who hasn’t been around for a while comes back and has to create a new account as their old account has been removed. This leaves them with a zero post-count and all their PM’s associated with the old account.

How Do I Re-associate All Old Member Data with New Account?
Pretty easily really, with access to the database via phpMyAdmin and a few MySQL Query commands. On every Database, there is a Tab at the top which says “SQL” and has a box where you can issue queries (commands) and hit “Go”.
*Warning* BACKUP YOUR DATABASE FIRST !!

The main Syntax that we are going to issue as a MySQL query is this:
UPDATE whatever_table SET ID_MEMBER_whatever = '2', whateverName = 'new' WHERE whateverName = 'old'

1. Associating Old Posts with new Member account
For example, we want to change all forum posts with the name of a deleted member called OldBuddy, and associate them with his new name which is NewBuddy with member ID 1337.
UPDATE smf_messages SET ID_MEMBER = '1337', posterName = 'NewBuddy' WHERE posterName = 'OldBuddy'

2. Now we want to do the same with his old PM’s (Private/Personal Messages):
UPDATE smf_personal_messages SET ID_MEMBER_FROM = '1337', fromName = 'NewBuddy' WHERE fromName = 'OldBuddy'

By now you should be getting the idea. You just UPDATE whatever table, with new column data for a user ID by changing old for new. Once you get the hang of it, you can issue the UPDATE command on any MySQL database, not just Smf Forum, and recursively replace any data in any table.

Quickly create and delete multiple files or directories

Mkdir and Touch
I am pretty sure most of you already know what the mkdir command does.
Maybe new users won’t know too much about touch which is a great commandline tool which comes as part of the Gnu Coreutils.

For more information in the terminal type:
info coreutils touch invocation
and
man mkdir

To create multiple directories with the same name but a different number:
mkdir dir{1,2,3}

Which will give you:

dir1 dir2 dir3

To remove them:
rmdir dir{1,2,3}

To create multiple files with the same name but a different number:
touch file{1,2,3}.txt

Which will give you:

file1.txt file2.txt file2.txt

To remove them:
rm file{1,2,3}.txt

Mysql Cluster Quick Start Guide

MySQL Cluster Quick Start Guide – LINUX
This guide is intended to help the reader get a simple MySQL Cluster database up and running on a single LINUX server. Note that for a live deployment multiple hosts should be used to provide redundancy but a single host can be used to gain familiarity with MySQL Cluster; please refer to the final section for links to material that will help turn this into a production system.

1 Get the software
For Generally Available (GA), supported versions of the software, download from
http://www.mysql.com/downloads/cluster/
Make sure that you select the correct platform – in this case, “Linux – Generic”
and then the correct architecture (for LINUX this means x86 32 or 64 bit).
If you want to try out a pre-GA version then check
http://dev.mysql.com/downloads/cluster/
Note: Only use MySQL Server executables (mysqlds) that come with the MySQL
Cluster installation.

2 Install
Locate the tar ball that you’ve downloaded, extract it and then create a link to it:
tar xvf Downloads/mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23.tar.gz
ln -s mysql-cluster-gpl-7.1.3-linux-x86_64-glibc23 mysqlc
Optionally, you could add ~/mysqlc/bin to your path to avoid needing the full path when running the processes.

3 Configure
For a first Cluster, start with a single MySQL Server (mysqld), a pair of Data Nodes (ndbd) and a single management node (ndb_mgmd) – all running on the same server.

Create folders to store the configuration files and the data files:
mkdir my_cluster my_cluster/ndb_data my_cluster/mysqld_data my_cluster/conf
In the conf folder, create 2 files (note that “/home/user1” should be replaced with your home directory).

my.cnf:
[mysqld]
ndbcluster
datadir=/home/user1/my_cluster/mysqld_data
basedir=/home/user1/mysqlc
port=5000

config.ini:
[ndb_mgmd]
hostname=localhost
datadir=/home/user1/my_cluster/ndb_data
id=1
[ndbd default]
noofreplicas=2
datadir=/home/user1/my_cluster/ndb_data
[ndbd]
hostname=localhost
id=3
[ndbd]
hostname=localhost
id=4
[mysqld]
id=50

Note that in a production system there are other parameters that you would set to tune the configuration.
Just like any other MySQL Server, the mysqld process requires a ‘mysql’ database to be created and populated with essential system data:
cd mysqlc
scripts/mysql_install_db --no-defaults --datadir=$HOME/my_cluster/mysqld_data/

4 Run
The processes should be started in the order of management node, data nodes & then MySQL Server:
mysqlc]$ cd ../my_cluster/
my_cluster]$ $HOME/mysqlc/bin/ndb_mgmd -f conf/config.ini --initial --configdir=$HOME/my_cluster/conf/
$HOME/mysqlc/bin/ndbd -c localhost:1186
$HOME/mysqlc/bin/ndbd -c localhost:1186

Check the status of the Cluster and wait for the Data Nodes to finish starting before starting the MySQL Server:
$HOME/mysqlc/bin/ndb_mgm -e show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=3 @127.0.0.1 (mysql-5.1.44 ndb-7.1.3, Nodegroup: 0, Master)
id=4 @127.0.0.1 (mysql-5.1.44 ndb-7.1.3, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @127.0.0.1 (mysql-5.1.44 ndb-7.1.3)
[mysqld(API)] 1 node(s)
id=50 (not connected, accepting connect from any host)

$HOME/mysqlc/bin/mysqld --defaults-file=conf/my.cnf &

5 Test
Connect to the MySQL Server and confirm that a table can be created that uses the ndb (MySQL Cluster) storage engine:
$HOME/mysqlc/bin/mysql -h 127.0.0.1 -P 5000 -u root
mysql> create database clusterdb;use clusterdb;
mysql> create table simples (id int not null primary key) engine=ndb;
mysql> insert into simples values (1),(2),(3),(4);
mysql> select * from simples;
+----+
| id |
+----+
| 3 |
| 1 |
| 2 |
| 4 |
+----+

6 Safely shut down
The MySQL Server must be shut down manually but then the other Cluster nodes can be stopped using the ndb_mgm tool:
$HOME/mysqlc/bin/mysqladmin -u root -h 127.0.0.1 -P 5000 shutdown
$HOME/mysqlc/bin/ndb_mgm -e shutdown

Netcat – The Tcp/Udp Rambo Knife

Netcat
The netcat utility is used for practically anything involving TCP or UDP. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, port scan, and is cool with both IPv4 and IPv6 connections.

In this example, open port 6881 using nc command:

nc -l 6881

On a second console or from a second UNIX / Linux machine, connect to the machine and port being listened on:

nc localhost 6881

OR

nc unix.system.ip.here 6881

In this example, send data from one computer to another:

nc -l 6881 > output.txt

Using a second machine, connect to the listening nc process (@ port 6881), feeding it the file which is to be transferred:

nc your.ip.address 6881 < input.txt

You can run netstat command to view open ports:

netstat -a
netstat -nat | grep LISTEN

Sample outputs:

netstat -nat | grep LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:7634 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:55788 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:49198 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN

How to post on identi.ca from Vim with TwitVim

I recently discovered the TwitVim Twitter/Identi.ca Vim plugin created by Po Shan Cheah, so I thought i’d share it with you all.

Prerequisites: Vim (obviously), Curl and the twitvim.vba

1. Download the latest twitVim plugin from here (Currently version 0.5.5): http://www.vim.org/scripts/download_script.php?src_id=13653

2. Open Vim and issue these commands (version 0.5.5)

Open the vba file with Vim:

vim twitvim-0.5.5.vba

Now install the vba:

:source %

3. Configure your vimrc to use identi.ca

vim .vimrc

And at the bottom add:

let twitvim_api_root = “http://identi.ca/api&#8221;

let twitvim_cert_insecure = 1

let twitvim_login = “yourusername:yourpassword”
**NOTE** You may get an error for the url and the uname password lines, if so, just use a single quote mark [ ‘ ] instead of double quote marks [ ” ]
4. Send a test post:

:PosttoTwitter

Hit Enter (you’ll be prompted to enter a message), Type your message, and hit Enter again, that’s it. You have now sent your first identi.ca message from Vim !! 😉

This is a basic install and post guide, but I recommend you read the documentation as TwitVim has a whole heap of features and options, especially regarding security and secure authentication.

AuthorPo Shan Cheah

Shared on identi.ca by –  tante

DocumentationVim.org, Google Code

Asterisk PBX on Debian Stable Part 1

What this guide is:

This is basically a step by step reference of an Asterisk PBX quick start setup for anybody who wants to try it out, or if you are going to work for a company which sets up Asterisk PBX telephone systems.

What this guide isn’t:

This is by no means a complete guide, although it is an ongoing reference which I will add to it as I see fit.

Asterisk Docs and Info:

Asterisk is a hugely versatile and complete Open Source telephony system which already has its own documentation, man pages (man asterisk), support forums and wiki.

Debian:

This guide supposes that you have Debian Stable (Currently Lenny) installed, either as your main OS or as a server on the network.

Install and test Asterisk: (Do all the following as root, not with sudo)

apt-get install asterisk asterisk-dev asterisk-dbg asterisk-h323 asterisk-mp3 libasterisk-agi-perl asterisk-doc

We use Perl scripts for automated dialers and other advanced options, so I have added the Perl modules, that’s up to you. You may also like to do an “apt-cache search asterisk” if you need any language-specific files. As I am in Spain, I also add “asterisk-prompt-es”.

Test Asterisk (still as root)

asterisk -vvvvc

As I already have Asterisk installed, it automatically loads at boot, so the message I get is that it is already running:

ricpru:~# asterisk –vvvvc
Asterisk already running on /var/run/asterisk/asterisk.ctl.  Use ‘asterisk -r’ to connect.

So I do as it says:

ricpru:~# asterisk -r
Asterisk 1.4.21.2~dfsg-3+lenny1, Copyright (C) 1999 – 2008 Digium, Inc. and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.
==============================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
==============================================
Connected to Asterisk 1.4.21.2~dfsg-3+lenny1 currently running on ricpru (pid = 1844)

And I am left with the Asterisk prompt:

ricpru*CLI>

Asterisk is installed and working!

So now what?

First you need to get used to the config files. Then you need to select a phone. Asterisk works with Softphones , Analogue phones, IP phones, Mobile phones, Fax machines, basically anything that can be connected to a network or has an IP address and can make a call or send data.

Where are the config files?

ls /etc/asterisk

Yup, they all end in .conf and there are loads of them! Don’t panic! We are only going to start with a IAX/SIP Software Phone, which is the most basic to configure.

adsi.conf cdr_odbc.conf  features.conf  logger.conf  phone.conf  skinny.conf adtranvofr.conf  cdr_pgsql.conf   festival.conf  manager.conf  privacy.conf  sla.conf agents.conf         cdr_tds.conf  followme.conf  manager.d  queues.conf  smdi.conf alarmreceiver.conf  codecs.conf  func_odbc.conf  meetme.conf  res_odbc.conf  telcordia-1.adsi alsa.conf           dnsmgr.conf  gtalk.conf  mgcp.conf  res_pgsql.conf   udptl.conf amd.conf  dundi.conf   h323.conf  misdn.conf  res_snmp.conf  users.conf asterisk.adsi enum.conf  http.conf       modules.conf  rpt.conf  voicemail.conf asterisk.conf  esel.conf  iax.conf musiconhold.conf  rtp.conf  vpb.conf cdr.conf  extconfig.conf   iaxprov.conf  muted.conf  say.conf  watchdog.conf cdr_custom.conf  extensions.ael   indications.conf  osp.conf  sip.conf  zapata.conf cdr_manager.conf  extensions.conf  jabber.conf  oss.conf        sip_notify.conf

Software SIP/IAX phones:

Skype, Ekiga, etc etc….. there are loads, Google them and choose what you want. Personally I prefer VoixPhone. It’s easy to install and has a lot of features including IAX and SIP, but it’s all a matter of personal choice. The reason I want a phone with IAX is that we also use those configs for Hard Phones such as the Thomson ST2030 IP phone.

Download VoixPhone from HERE, Unpack it, Chmod -x it, and ./ Install it.

*HINT* I installed VoixPhone to /usr/local/bin as opposed to /usr/local which is the default and created a launcher called voix. This way I can launch the VoixPhone executable as voix from the command line.

Create an empty launcher file:

vim /usr/local/bin/voix

Insert this text:

# cat >/usr/local/bin/voix <<EOF
#!/bin/sh
/usr/local/bin/voixphone/VoixPhone
EOF

Then make it executable:

chmod 755 /usr/local/bin/voix

*64bit Hint* VoixPhone is a 32bit app. If you are running a 64bit system, install the ia32 libs:

apt-get install ia32-libs ia32-libs-gtk

Part 2 – Configuring Asterisk and your new VoixPhone:

PART 2 Coming soon………………………

In the meantime, have a read of this PDF Handbook and My Asterisk Bible 🙂

How to redirect old website url to new url including page links

The situation is that you have an old domain with a website or even various websites and sub-domains. You have moved all your files to another server or web address but you don’t want to lose the traffic from all the people who have bookmarked or link to you.

You want http://myoldcrapsite.com/a_post_about_monkeys.html to lead to http://mylovelynewsite.com/a_post_about_nicer_monkeys.html

In fact, you want ALL old links to go to the exact same place on the new server. This is how you redirect everything all in one go permanently with the htaccess file.

Creat a .htaccess file (don’t forget the DOT before it, it’s hidden from public view)

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^myoldcrapsite.com [nc]
rewriterule ^(.*)$ http://mylovelynewsite.com/$1 [r=301,nc]

Upload it to the root of your website, usually where your index.html or index.php files are and you are all set. Google some of your old links and see where they take you. It should be to the same page on the new website.

One thing to remember is this will only work on a Linux Apache webserver which allows the Mod Rewrite function.

PS: If you are on a Windows Server, try Googling the html redirect method.

That’s it, now all incoming links from any of the old posts/pages will be forwarded to the new site 🙂

How to Linux quick, easy, file sharing server with one command

Don’t install a server, just issue one command!

So, you want to share a file with a friend. It could be a document, a song, a directory of photos, anything.

Do you want to install and set up a server? NO!

Do you want to go to a directory and issue one command? YES!

Open your terminal and cd to the directory where you want to share the file(s) from:

cd /home/rich/shared

Now start the Python Simple HTTP Server:

python -m SimpleHTTPServer

That’s it! Open your browser and go to this url:

http://localhost:8000 or http://127.0.0.1:8000

Now you will see the files that you want to share. All you need to do is send a message to your friend with your IP address and port :8000 and he/she can download anything from your /shared directory.

You can get your external IP address by going to:

http://www.whatsmyip.org/

Once you have finished, go back to your terminal and hit Ctrl+C and the server will stop.

Starting with Perl

I have started to use Perl regularly at work for network, server and telephony systems. Bearing in mind that before I got into Perl, my only other exposure to code was html/php/css for my websites and forums, configuring Conky and putting a few Bash scripts together.

Getting into Perl

Everybody learns differently, and I found it very difficult to grasp Perl just by reading books, man pages and websites. All of these will explain the history of Perl and give you links to everything it can do. This is all well and good until you need to do something specific.

Perl – Conky example

For me personally, to “get” something, I need to have an aim, and put it into action. It’s a bit like when you decide you want to display the weather on Conky with some fancy images, you Google “conky weather” and look for the code that will get the data, then show it at a certain position. You know what you want to do, then you look up how to achieve the goal. I went about learning Perl this way. Have a goal, and look for the way to do it.

How to create a bootable USB pendrive Debian netinstall

**NOTE 1** There are various ways to create pendrive Linux installs, some work and some fail depending on the pendrive model and also how the computer BIOS boots from USB.
**NOTE 2** This didn’t work with a HP 4Gb pendrive, but did with my Kingston pendrive. Also, it worked with my laptop and netbook but didn’t boot on a RAID Cluster server at work when trying to install Debian Lenny Netinstall.

For other distros with Pendrive Install guides, see the end of this post

1. Insert the USB stick, but do not mount it, yet. If it automounts, unmount it.

2. Get the sid install files (even if you install etch/lenny/squeeze):
a) wget ftp.us.debian.org:/debian/dists/sid/main/installer-i386/\current/images/netboot/debian-installer/i386/linux
b) wget ftp.us.debian.org:/debian/dists/sid/main/installer-i386/\current/images/netboot/debian-installer/i386/initrd.gz
c) wget ftp.us.debian.org:/debian/dists/sid/main/installer-i386/\current/images/netboot/mini.iso

3. Insure these packages are installed on your machine:

apt-get install mbr syslinux mtools -y

4. Apply the following commands, replaceing sdb with the propper device name.

install-mbr /dev/sdb
syslinux /dev/sdb1
mount /dev/sdb1 /media/usb

cp linux initrd.gz mini.iso /media/usb

*NOTE* These are 3 separate commands, do NOT copy, paste and issue as one command. Hit “Enter” after each line.

echo -e "default linux\nappend priority=low vga=normal "\
"initrd=initrd.gz ramdisk_size=12000 root=/dev/ram rw"\
> /media/usb/syslinux.cfg

Now umount from /media/usb
umount /dev/sdb1

Other Distro Pendrive Guides
Crunchbang Statler (Debian Squeeze) http://crunchbanglinux.org/wiki/statler_usb_installation
Crunchbang Statler on EeePc http://richs-lxh.com/howto_crunchbang-statler-xfce-on-eeepc/
Debian Installer from USB http://linux.derkeiler.com/Mailing-Lists/Debian/2008-02/msg02948.html
Debian on USB + Links http://wiki.debian.org/BootUsb

Relevant Perl Man Pages

Man pages are awesome! To find the “Manual” for anything in Linux, just open a terminal and type man with the subject you are looking for. ie:

man perl

What if it’s something less precise? Use the -k switch to get a list of anything containing the subject you are looking for. ie:

man -k network

Once you’ve read what you need, just hit q to quit back to the terminal.

Relevant Perl man pages:

perl - overview               perlfaq - frequently asked questions
perltoc - doc TOC                perldata - data structures
perlsyn - syntax                 perlop - operators and precedence
perlrun - execution              perlfunc - builtin functions
perltrap - traps for the unwary   perlstyle - style guide

"perldoc" and "perldoc -f"

Perl and Elinks Search from script to terminal

I was Googling for some neat things to do with Perl (I have a pile of scripts in /usr/local/bin), when I thought, hey!? Why not use Perl to search Google? I’ve already started to use Elinks terminal web browser,(available in all Linux repos) so obviously any scripts that mean I am just one command away from finding any needed info would be a bonus.

I decided to call this script “goose”, yeah, I know lol! GooSe as in GOOgle SEarch.

sudo vim /usr/local/bin/goose

Add this:

#!/usr/bin/perl -w

# Created by Rich Scadding 02/08/2010

$browser = “/usr/bin/elinks”;

exec $browser, “http://www.google.com/advanced_search&#8221; unless @ARGV;

for ( @ARGV ){ s/.*/%22mce_markeramp;%22/ if y/ /+/; $s .= $s?”+$_”:”$_”; }

# $ENV{LANG} = “en_US.UTF8”;

#!/usr/bin/perl -w# Created by Rich Scadding 02/08/2010$browser = “/usr/bin/elinks”;
exec $browser, “http://www.google.com/advanced_search&#8221; unless @ARGV;
for ( @ARGV ){ s/.*/%22mce_markeramp;%22/ if y/ /+/; $s .= $s?”+$_”:”$_”; }
# $ENV{LANG} = “en_US.UTF8”;exec $browser, “http://www.google.com/search?num=30&hl=en&as_qdr=all&q=$s&btnG=Google+Search&#8221;

Now take ownership with chown and chmod -x it to run it from the terminal.

EXAMPLE: goose linux-hardcore

Thanks to Ben Okopnik for Perl inspiration ( http://okopnik.com/ ) He has a lot of scripts and articles  floating around the net which are great to learn from. ie. http://linuxgazette.net/134/okopnik.html

Asterisk CLI Commands

At work we setup Asterisk PBX phone systems along with our own Perl scripts for various purposes. Asterisk is an open source PBX phone system that works with Soft Phones and Hard Phones. I installed and setup Asterisk on my work laptop with a software VoixPhone (SIP/IAX).

The one thing with Asterisk is that each update introduces a few changes, mainly the choice of CLI commands to debug or find certain information.

This post is basically a quick reference to the current Asterisk CLI commands. If you are interested in taking a look at Asterisk (it’s in the Debian repos) and/or the VoixPhone software SIP/IAX phone, see these links:

VoixPhone – http://www.voixphone.com/

Asterisk – http://www.asterisk.org/

Debian Repo – http://packages.debian.org/search?keywords=asterisk

Current CLI Commands: ( Courtesy of: asteriskglobe.blogspot.com )

! – Execute a shell command
abort halt – Cancel a running halt
cdr status – Display the CDR status
feature show – Lists configured features
feature show channels – List status of feature channels
file convert – Convert audio file
group show channels – Display active channels with group(s)
help – Display help list, or specific help on a command
indication add – Add the given indication to the country
indication remove – Remove the given indication from the country
indication show – Display a list of all countries/indications
keys init – Initialize RSA key passcodes
keys show – Displays RSA key information
local show channels – List status of local channels
logger mute – Toggle logging output to a console
logger reload – Reopens the log files
logger rotate – Rotates and reopens the log files
logger show channels – List configured log channels
meetme – Execute a command on a conference or conferee
mixmonitor – Execute a MixMonitor command.
moh reload – Music On Hold
moh show classes – List MOH classes
moh show files – List MOH file-based classes
no debug channel (null)
originate – Originate a call
realtime load – Used to print out RealTime variables.
realtime update – Used to update RealTime variables.
restart gracefully – Restart Asterisk gracefully
restart now – Restart Asterisk immediately
restart when convenient – Restart Asterisk at empty call volume
sla show – Show status of Shared Line Appearances
soft hangup – Request a hangup on a given channel
stop gracefully – Gracefully shut down Asterisk
stop now – Shut down Asterisk immediately
stop when convenient – Shut down Asterisk at empty call volume
stun debug – Enable STUN debugging
stun debug off – Disable STUN debugging
udptl debug – Enable UDPTL debugging
udptl debug ip – Enable UDPTL debugging on IP
udptl debug off – Disable UDPTL debugging

AEL commands

ael debug contexts – Enable AEL contexts debug (does nothing)
ael debug macros – Enable AEL macros debug (does nothing)
ael debug read – Enable AEL read debug (does nothing)
ael debug tokens – Enable AEL tokens debug (does nothing)
ael nodebug – Disable AEL debug messages
ael reload – Reload AEL configuration

Agents commands

agent logoff – Sets an agent offline
agent show – Show status of agents
agent show online – Show all online agents

AGI commands

agi debug – Enable AGI debugging
agi debug off – Disable AGI debugging
agi dumphtml – Dumps a list of agi commands in html format
agi show– List AGI commands or specific help
dnsmgr reload – Reloads the DNS manager configuration
dnsmgr status – Display the DNS manager status
http show status – Display HTTP server status

Console commands

console active – Sets/displays active console
console answer – Answer an incoming console call
console autoanswer – Sets/displays autoanswer
console boost – Sets/displays mic boost in dB
console dial – Dial an extension on the console
console flash – Flash a call on the console
console hangup – Hangup a call on the console
console mute – Disable mic input
console send text – Send text to the remote device
console transfer – Transfer a call to a different extension
console unmute – Enable mic input

Core related commands

core clear profile – Clear profiling info
core set debug channel – Enable/disable debugging on a channel
core set debug – Set level of debug chattiness
core set debug off – Turns off debug chattiness
core set global – Set global dialplan variable
core set verbose – Set level of verboseness
core show applications – Shows registered dialplan applications
core show application – Describe a specific dialplan application
core show audio codecs – Displays a list of audio codecs
core show channels – Display information on channels
core show channel – Display information on a specific channel
core show channeltypes – List available channel types
core show channeltype – Give more details on that channel type
core show codecs – Displays a list of codecs
core show codec – Shows a specific codec
core show config mappings – Display config mappings (file names to config engines)
core show file formats – Displays file formats
core show file version – List versions of files used to build Asterisk
core show functions – Shows registered dialplan functions
core show function – Describe a specific dialplan function
core show globals – Show global dialplan variables
core show hints – Show dialplan hints
core show image codecs – Displays a list of image codecs
core show image formats – Displays image formats
core show license – Show the license(s) for this copy of Asterisk
core show profile – Display profiling info
core show switches – Show alternative switches
core show threads – Show running threads
core show translation – Display translation matrix
core show uptime – Show uptime information
core show version – Display version info
core show video codecs – Displays a list of video codecs
core show warranty – Show the warranty (if any) for this copy of Asterisk

Database commands

database del – Removes database key/value
database deltree – Removes database keytree/values
database get – Gets database value
database put – Adds/updates database value
database show – Shows database contents
database showkey – Shows database contents

Dialplan commands

dialplan add extension – Add new extension into context
dialplan add ignorepat – Add new ignore pattern
dialplan add include – Include context in other context
dialplan reload – Reload extensions and *only* extensions
dialplan remove extension – Remove a specified extension
dialplan remove ignorepat – Remove ignore pattern from context
dialplan remove include – Remove a specified include from context
dialplan save – Save dialplan
dialplan show – Show dialplan

DUNDI commands

dundi debug – Enable DUNDi debugging
dundi flush – Flush DUNDi cache
dundi lookup – Lookup a number in DUNDi
dundi no debug – Disable DUNDi debugging
dundi no store history – Disable DUNDi historic records
dundi precache – Precache a number in DUNDi
dundi query – Query a DUNDi EID
dundi show entityid – Display Global Entity ID
dundi show mappings – Show DUNDi mappings
dundi show peers – Show defined DUNDi peers
dundi show peer – Show info on a specific DUNDi peer
dundi show precache – Show DUNDi precache
dundi show requests – Show DUNDi requests
dundi show trans – Show active DUNDi transactions
dundi store history – Enable DUNDi historic records

GTalk & Jabber commands

gtalk reload – Enable Jabber debugging
gtalk show channels – Show GoogleTalk Channels
jabber debug – Enable Jabber debugging
jabber debug off – Disable Jabber debug
jabber reload – Enable Jabber debugging
jabber show connected – Show state of clients and components
jabber test – Shows roster, but is generally used for mog’s debugging.

IAX2 commands

iax2 provision – Provision an IAX device
iax2 prune realtime – Prune a cached realtime lookup
iax2 reload – Reload IAX configuration
iax2 set debug – Enable IAX debugging
iax2 set debug jb – Enable IAX jitterbuffer debugging
iax2 set debug jb off – Disable IAX jitterbuffer debugging
iax2 set debug off – Disable IAX debugging
iax2 set debug trunk – Enable IAX trunk debugging
iax2 set debug trunk off – Disable IAX trunk debugging
iax2 show cache – Display IAX cached dialplan
iax2 show channels – List active IAX channels
iax2 show firmware – List available IAX firmwares
iax2 show netstats – List active IAX channel netstats
iax2 show peers – List defined IAX peers
iax2 show peer – Show details on specific IAX peer
iax2 show provisioning – Display iax provisioning
iax2 show registry – Display IAX registration status
iax2 show stats – Display IAX statistics
iax2 show threads – Display IAX helper thread info
iax2 show users – List defined IAX users
iax2 test losspct – Set IAX2 incoming frame loss percentage

Manager commands

manager show command – Show a manager interface command
manager show commands – List manager interface commands
manager show connected – List connected manager interface users
manager show eventq – List manager interface queued events
manager show users – List configured manager users
manager show user – Display information on a specific manager user

MGCP commands

mgcp audit endpoint – Audit specified MGCP endpoint
mgcp reload – Reload MGCP configuration
mgcp set debug – Enable MGCP debugging
mgcp set debug off – Disable MGCP debugging
mgcp show endpoints – List defined MGCP endpoints

Module management

module load – Load a module by name
module reload – Reload configuration
module show – List modules and info
module show like – List modules and info
module unload – Unload a module by name

PRI commands

pri debug span – Enables PRI debugging on a span
pri intense debug span – Enables REALLY INTENSE PRI debugging
pri no debug span – Disables PRI debugging on a span
pri set debug file – Sends PRI debug output to the specified file
pri show debug – Displays current PRI debug settings
pri show spans – Displays PRI Information
pri show span – Displays PRI Information
pri unset debug file – Ends PRI debug output to file

Queue commands

queue add member – Add a channel to a specified queue
queue remove member – Removes a channel from a specified queue
queue show – Show status of a specified queue
rtcp debug ip – Enable RTCP debugging on IP
rtcp debug – Enable RTCP debugging
rtcp debug off – Disable RTCP debugging
rtcp stats – Enable RTCP stats
rtcp stats off – Disable RTCP stats
rtp debug ip – Enable RTP debugging on IP
rtp debug – Enable RTP debugging
rtp debug off – Disable RTP debugging
say load – Set/show the say mode
show parkedcalls – Lists parked calls
show queue – Show information for target queue
show queues – Show the queues

SIP commands

sip history – Enable SIP history
sip history off – Disable SIP history
sip notify – Send a notify packet to a SIP peer
sip prune realtime – Prune cached Realtime object(s)
sip prune realtime peer – Prune cached Realtime peer(s)
sip prune realtime user – Prune cached Realtime user(s)
sip reload – Reload SIP configuration
sip set debug – Enable SIP debugging
sip set debug ip – Enable SIP debugging on IP
sip set debug off – Disable SIP debugging
sip set debug peer – Enable SIP debugging on Peername
sip show channels – List active SIP channels
sip show channel – Show detailed SIP channel info
sip show domains – List our local SIP domains.
sip show history – Show SIP dialog history
sip show inuse – List all inuse/limits
sip show objects – List all SIP object allocations
sip show peers – List defined SIP peers
sip show peer – Show details on specific SIP peer
sip show registry – List SIP registration status
sip show settings – Show SIP global settings
sip show subscriptions – List active SIP subscriptions
sip show users – List defined SIP users
sip show user – Show details on specific SIP user

Skinny commands

skinny reset – Reset Skinny device(s)
skinny set debug – Enable Skinny debugging
skinny set debug off – Disable Skinny debugging
skinny show devices – List defined Skinny devices
skinny show lines – List defined Skinny lines per device

Voicemail commands

voicemail show users – List defined voicemail boxes
voicemail show users for – List defined voicemail boxes for target context
voicemail show zones – List zone message formats

Zaptel commands

zap destroy channel – Destroys a channel
zap restart – Fully restart zaptel channels
zap show cadences – List cadences
zap show channels – Show active zapata channels
zap show channel – Show information on a channel
zap show status – Show all Zaptel cards status

Howto Create a Custom Debian Installer Netinstall iso

Remote server installations or Custom distro:

This is handy if you need to have preconfigured netinstall isos for remote installations of servers. Or maybe you just want to create a custom Debian based distro. At work I create these isos tailor made to suit our customers needs (more or less) then perform an automated remote installation.

The basic steps:

The basics are that you download a Debian Netinstall iso : http://www.debian.org/CD/netinst/

We mount the iso to a temporary directory, where we insert a “Preseed” file which has our custom settings configured. Then we recreate the iso.

Custom preseed file:

Before doing anything you need to get the example Preseed and edit it to your liking:

http://www.debian.org/releases/lenny/example-preseed.txt

**All of these commands are performed as Root in the /root home directory.**

You know the risks of running as root, and I will take for granted that you are an experienced Linux user who respects the responsibility of being root.

Lets create a custom iso:

Create a temporary direcory to mount the iso:

mkdir -p loopdir

Mount the Debian netinstall iso:

mount -o loop debian_netinstall_iso.iso loopdir

Remove the cd dircetory

rm -rf cd

Recreate a new cd directory:

mkdir cd

Now we Rsync everything over from the loopdir to our new cd directory:

rsync -a -H –exclude=TRANS.TBL loopdir/ cd

Unmount the netinstall iso from loopdir:

umount loopdir

Make a new directory to extract the initrd.gz, change to that directory and extract:

mkdir irmod

cd irmod

**Note**

The initrd.gz for the 64bit Netinstall iso is in /install.amd/. If this command fails it’s becuase it is somewhere else. Just have a look for it and change the command accordingly.

*One command at a time, don’t copy and paste both lines* (arguments are two dashes not one ” – -“)

gzip -d < ../cd/install.amd/initrd.gz | \

cpio –extract –verbose –make-directories –no-absolute-filenames

Now we copy over our custom Preseed file to initrd:

cp ../my_preseed.cfg preseed.cfg

*One command at a time, don’t copy and paste both lines*

find . | cpio -H newc –create –verbose | \

gzip -9 > ../cd/install.amd/initrd.gz

Now we go back to the /root directory and remove the irmod directory:

cd ../

rm -fr irmod/

Change to the cd directory and create an Md5sum:

cd cd

md5sum `find -follow -type f` > md5sum.txt

Back to /root again to create your new iso:

cd ..

*One command at a time, don’t copy and paste both lines*

genisoimage -o name_of_you_iso.iso -r -J -no-emul-boot -boot-load-size 4 \

-boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./cd

Now you have your own custom iso which you can burn to CD or run in VirtualBox or a chosen Emulator. Have a good read of the Preseed documentation as you can configure practically everything on the Netinstall iso, including adding your own custom Debian applications, themes, etc. basically you can go from automated basic netinstall to full blown distro. It’s up to you.

Howto – Fix Firefox already running error

This is the error message that tells you Firefox is already running:

Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.

To fix it you can usually just kill Firefox with:

killall firefox-bin

But sometimes it decides to be a bit of a pest and you’ll need to find the Firefox PID and then kill the process:

ps auxwww | grep firefox

Which will give you something like this:

rich      2167  0.0  0.0   3300   764 pts/0    S+   19:36   0:00 grep firefox

Then you just kill the process number:

killall 2167

Still not able to kill Firefox?

1. Find your profile. This page tells you how to find the location of your Firefox profile. Under Linux (e.g. Ubuntu), it will be at ~/.mozilla/firefox/[Profile name]/ .

2. Remove the lock files. This page tells you what the lock files are for Firefox on Windows/Linux/Mac. Under Unix/Linux, you’ll need to remove two files “lock” and “.parentlock” .

CHMOD – Get those File Permissions Right

CHMOD is used to change permissions of a file.

        PERMISSION      COMMAND   

         U   G   W

        rwx rwx rwx     chmod 777 filename      

        rwx rwx r-x     chmod 775 filename

        rwx r-x r-x     chmod 755 filename

        rw- rw- r--     chmod 664 filename

        rw- r-- r--     chmod 644 filename

        U = User 

        G = Group 

        W = World

        r = Readable

        w = writable

        x = executable 

        - = no permission


Here is another way of looking at it:
Permissions:

400     read by owner

040     read by group

004     read by anybody (other)

200     write by owner

020     write by group

002     write by anybody

100     execute by owner

010     execute by group

001     execute by anybody

To get a combination, just add them up. For example, to get read, write, execute by owner, read, execute, by group, and execute by anybody, you would add 400+200+100+040+010+001 to give 751.

Ubuntu Lucid Gui Tool to Configure NotifyOSD

There is a nice gui and a patched notifyOSD available from leolik’s PPA

sudo add-apt-repository ppa:leolik/leolik

sudo add-apt-repository ppa:amandeepgrewal/notifyosdconfig

Update source list

sudo apt-get update

Now install notifyosdconfig using the following command from your terminal

sudo apt-get install notifyosdconfig

Using notifyosdconfig

Open notifyosdconfig from Applications -> Accessories -> NotifyOSD Configuration

PGP/GPG Cheat Sheet

**NOTE** (for those who are confused by GPG vs PGP)

GPG (GNU Privacy Guard, GnuPG) is a free software alternative to the PGP suite of cryptographic software. GPG is a part of the Free Software Foundation’s GNU software project, and has received major funding from the German government. It is released under the terms of version 3 of the GNU General Public License.

PGP (Pretty Good Privacy) is a data encryption and decryption computer program that provides cryptographic privacy and authentication for data communication. PGP is often used for signing, encrypting and decrypting e-mails to increase the security of e-mail communications. It was created by Philip Zimmermann in 1991.

This a personal backup of an original cheat sheet here:
http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html

to create a key:
gpg –gen-key
generally you can select the defaults.

to export a public key into file public.key:
gpg –export -a “User Name” > public.key
This will create a file called public.key with the ascii representation of the public key for User Name. This is a variation on:
gpg –export
which by itself is basically going to print out a bunch of crap to your screen. I recommend against doing this.
gpg –export -a “User Name”
prints out the public key for User Name to the command line, which is only semi-useful

to export a private key:
gpg –export-secret-key -a “User Name” > private.key
This will create a file called private.key with the ascii representation of the private key for User Name.
It’s pretty much like exporting a public key, but you have to override some default protections. There’s a note (*) at the bottom explaining why you may want to do this.

to import a public key:
gpg –import public.key
This adds the public key in the file “public.key” to your public key ring.

to import a private key:
gpg –allow-secret-key-import –import private.key
This adds the private key in the file “private.key” to your private key ring. There’s a note (*) at the bottom explaining why you may want to do this.

to delete a public key (from your public key ring):
gpg –delete-key “User Name”
This removes the public key from your public key ring.
NOTE! If there is a private key on your private key ring associated with this public key, you will get an error! You must delete your private key for this key pair from your private key ring first.

to delete an private key (a key on your private key ring):
gpg –delete-secret-key “User Name”
This deletes the secret key from your secret key ring.

To list the keys in your public key ring:
gpg –list-keys

To list the keys in your secret key ring:
gpg –list-secret-keys

To generate a short list of numbers that you can use via an alternative method to verify a public key, use:
gpg –fingerprint > fingerprint
This creates the file fingerprint with your fingerprint info.

To encrypt data, use:
gpg -e -u “Sender User Name” -r “Receiver User Name” somefile
There are some useful options here, such as -u to specify the secret key to be used, and -r to specify the public key of the recipient.
As an example: gpg -e -u “Charles Lockhart” -r “A Friend” mydata.tar
This should create a file called “mydata.tar.gpg” that contains the encrypted data. I think you specify the senders username so that the recipient can verify that the contents are from that person (using the fingerprint?).
NOTE!: mydata.tar is not removed, you end up with two files, so if you want to have only the encrypted file in existance, you probably have to delete mydata.tar yourself.
An interesting side note, I encrypted the preemptive kernel patch, a file of 55,247 bytes, and ended up with an encrypted file of 15,276 bytes.

To decrypt data, use:
gpg -d mydata.tar.gpg
If you have multiple secret keys, it’ll choose the correct one, or output an error if the correct one doesn’t exist. You’ll be prompted to enter your passphrase. Afterwards there will exist the file “mydata.tar”, and the encrypted “original,” mydata.tar.gpg.

Ok, so what if you’re a paranoid bastard and want to encrypt some of your own files, so nobody can break into your computer and get them? Simply encrypt them using yourself as the recipient.

I haven’t used the commands:
gpg –edit-key
gpg –gen-revoke

* –gen-revoke creates a revocation certificate, which when distributed to people and keyservers tells them that your key is no longer valid, see http://www.gnupg.org/gph/en/manual/r721.html
* –edit-key allows you do do an assortment of key tasks, see http://www.gnupg.org/gph/en/manual/r899.html

How to fix Ubuntu 10.04 Panel Volume Control and other annoyances

I installed Ubuntu 10.04 Lucid Lynx on our main home computer (wife and kids use it), and Lucid Lynx s LTS which means it should (in theory) be updateable for a long period of time without those nasty 6-monthly dist-upgrade surprises.

Little annoyances
Apart from having window maximize/minimize/close buttons on the left, having to add user permissions for network/wireless/sound….. well, everything basically, I also found that there was no Volume control on the panel.

Here’s the fix:
sudo apt-get install indicator-sound

Now right click on your “envelope” on the panel and choose “Remove From Panel” (Don’t panic, we’ll get it back in a minute)

Next right click on your panel and choose “Add To Panel…

Now select the “Indicator Applet” (that ‘s the envelope you just removed). Now it will come back, but this time with a Volume Control applet by its side 🙂

Ubuntu seems to get more stupid every release. I chose this for the family computer as once Ubuntu is setup “properly”, it’s low maintenance and has practically everything out of the box. But they really should get back to basics and have the base fixed before adding all this extra fluff and prettiness.

Slow System
To speed up the system I went to “Startup Applications” and shut it all down apart from Network and Sound. Compiz also got switched off. Those effects were cool back in the days of Beryl, but they offer nothing other than a little Bling to show off to Windows/Mac using buddies. Otherwise, just a useless system hog.

Sound – Pulse Audio
I don’t like this Pulse audio much, and will probably return to Alsa, which in my opinion is a very good sound architecture. Why people keep reinventing the wheel i’ll never know.

Canonical/Ubuntu services – 2Gb Storage and Music Store
Nope. That’s it, just nope. My personal data on an Ubuntu server? nuh uh!. Using a credit card online to buy music with an Ubuntu service? nuh uh! X2. Call me paranoid, but i’d currently only risk my cash and privacy on Debian and FreeBSD. You’ve just got to trust the big boys who are security conscious.
I still don’t see Canonical or Ubuntu as competent enough to deal with serious issues such as encryption and security when they can’t even decide which side to put buttons on a GUI. Whatsmore, the community is usually ignored regarding these simple decisions, who would have the last word with security issues?

Anyhoo. System all setup, looks nice and pretty. Runs faster now I removed and shut down all the bloat as well.

Fingers crossed for when it’s time to update and upgrade ^^

Howto Extra Swap without having to repartition

This is a great little trick if for some reason you need a little extra Swap. You may face a situation where your RAM and Swap are being eaten up by a hungry app. Well, no problem, all though not as fast or efficient as extra RAM or a bigger Swap partition, it is still handy in some situations.

How to add more Linux Swap with Swap File

Assuming you want to put it in “/”, Create an empty 500MB file
$ sudo dd if=/dev/zero of=/swap.img bs=1024k count=512

Format it as a swap file
$ sudo mkswap /swap.img

Add it to your running Linux system
$ sudo swapon /swap.img

Optionally you can add /swap.img to fstab for automatic swap activation.

$ sudo nano /etc/fstab

Add this line at the end of the file
/swap.img none swap sw 0 0

Then Ctrl+X, Y to save and Enter to close Nano

Run “free -m” command to verify that you’ve added the newly created swap to your Linux based operating system.

Howto Easy PGP Key Creation

HOWTO: Quick & Easy GPG Key


This HOWTO will take you through a quick & basic PGP Key creation and submission to MIT key servers

First you need to install gnupg and gnupg-agent. In order to create a key, you will also need a real email address.

1. Open a terminal.
2. type in the following code:

gpg --gen-key

3. Then enter a “1” – to create a standard DSA/ElGamal key. Press Enter.
4. Type in 1024. Press Enter.
5. Type in 0. Press Enter.
6. Enter a y. Press Enter.
7. Type in your Real Name. Press Enter.
8. Type in your REAL email address. Press Enter.
9. Type in Your First Name, followed by “‘s PGP Key”. Press Enter. IE Joe Blogg’s PGP key (without the “”)
10. Type O. Press Enter. It will now create your Key.
11. You will have to give it a “Pass Phrase”. Try to use a password with a mixture of upper and lower case letters as well as numbers to make it secure.

When it’s finished creating your Key, follow these steps:
1. Open a terminal.
2. Type in the following code:

gpg --export -a "User Name" > public.key

3. Open a nautilus window.
4. Find the file “public.key” in your home directory.
5. Right click on the file, left click on open in text editor.
6. Press CTRL+A, then CTRL+C (Select All, Copy)
7. Open http://pgp.mit.edu in a browser window.
8. In the box under the label, “Submit a key” – right click in the box and then left click on paste.
9. Click on “Submit this key to the keyserver!”
10. Go back to http://pgp.mit.edu
11. Type in your name in the Search String box.
12. Highlight and Copy the section of the result page under “User ID” (It should be your name, comment, and email address.)

Common Ssh Commands

This isn’t my work, I copied it to my blog for safe keeping. The original is here:

http://kb.mediatemple.net/questions/247/Common+SSH+Commands

Common SSH Commands

  • Applies to: All Service Types
  • Difficulty: Easy
  • Time needed: 5 minutes
  • Tools needed: ssh

DETAILS:

Not all of these commands will run on all Hosting Products.

This is a list of Common commands that can be run from root / SSH access.

I. Basic Commands

A. Retrieve Plesk Admin Password

cat /etc/psa/.psa.shadow

B. Change Directory (cd)

cd /path/to/directory/

C. Listing Files/SubFolders (ls)

ls -alh

(files and subfolders listed with perms in human-readable sizes)

D. Checking Processes

ps -a top -c

(process viewer – Ctrl+C to exit)

ps -auxf

(process list)

E. Start/Stop Services

/etc/init.d/ start|stop|restart|status

(“/etc/init.d/httpd stop” stops apache)

F. Check Bean Counters (hard and soft limits, failcounts, etc.)

cat /proc/user_beancounters

II. File System Commands (df & du are (dv)-only commands)

A. Check Total Disk Usage

df

(gives physical disk usage report with % used)

B. List Files/Folders +Sizes (du)

du

(lists all filesizes. This will take some time.)

du -sh

(lists all the subfolders/sizes in a dir)

C. Remove/Delete Files (rm /path/to/filename.htm) -DANGER- always verify

rm -vf

(force-deletes file. Dont run unless you know EXACTLY what you’re doing)

rm -vrf

(force deletes folder and all subfolders and files)

To Remove a Directory you can use the following command:

 rmdir  

D. Copy Files (cp)

cp filename.abc /new/path/filename.abc.123

E. Move Files (mv)

mv filename.abc /new/path/filename.abc.123

F. Create Empty File (touch)

touch filename.123

III. File Permissions and Ownership

A. Change Permissions of files (chmod)

chmod 000 filename.abc

(defaults are usually 755 for folders, 644 for files)

TIP:

1st digit=Owner; 2nd=Group; 3rd=Other
(-rwxrwxwrx = 777, -rwxr-xr-x = 755, -rw-r–r– = 644, etc.)
7 = Read + Write + Execute
6 = Read + Write
5 = Read + Execute
4 = Read
3 = Write + Execute
2 = Write
1 = Execute
0 = All access denied

B. Change Ownership of files (chmown)

chown user:group filename.abc

(you can see user and group w/ ls -alh)

TIP:

Anytime a user creates a file, the Ownership of the file matches that user. In Plesk, every domain that has hosting has a different user. So if you are copying files from one domain to another, you must remember to change ownership.

IV. Checking Log Files (dv)

Log files can tell you a lot about whats going on on a (dv). You can use the command:
‘tail -n 100’ before the logfile name to list the last 100 entries of the logfile.

Here are some of the most common:

A. Main Error Log

/var/log/messages

B. Apache Error Log

/var/log/httpd/error_log

(main)

/home/httpd/vhosts/mt-example.com/statistics/logs/error_log

(per-domain) (May also be: /var/www/vhosts on newer dvs)

C. MySQL Logs

/var/log/MySQLd.log

D. Mail Logs

/usr/local/psa/var/log/maillog

NOTE:

Common issues to look out for in log files

  • The main error log will not always give you all the information you want for a svc.
  • You may see alot of failed SSH and FTP connections, that is generally normal.
  • Keep an eye out for MaxClients errors in the Apache logs if a customer is complaining of Apache dying alot. You can check the KB for raising MaxClients settings.
  • If a customer does not set up Log Rotation for a domain under Plesk, then Log Files will build up and may take up alot of unneeded space. You can usually delete old log files in Plesk, and change the Log Rotation to Daily instead of by size.
  • MailLogs can show you if a customer is spamming, or if mail is coming in or out.
  • MySQL Logs should be able to show you general MySQL errors such as bad connections, or corrupted tables. Check the Int. KB for the ‘myisamchk -r’ repair table command.

V. Advanced Commands

A. Find. You can do alot with find. for now lets find all files over 10MB.

cd /
find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n

B. Grep. Another handy tool to get specific information

cat file | grep blah

(only lists the information where the word blah is found)

C. Less/More

less filename.abc 

(displays the content of a file. arrows to scroll, ‘q’ to quit.)

more == same thing basically. You can use the ‘| more’ command to scroll through something page or line at a time.

tail -n 1000 /var/log/httpd/error_log | more

VI. Vi is a basic text editor.

Careful what keys you hit while in vi.

vi /path/to/filename.abc

TIP:

You can learn more about using the VI/VIM text editor by reading the following guide:

Understanding basic vi (visual editor)

Reset Vodafone Router Admin Password

If you live in Spain and use Vodafone as your host provider, you may have seen that they remotely change the “Admin” password which stops you getting access to extra features such as opening specific ports for servers.

The “vodafone” user only has a basic mix of user-end tools for the router.

So, how do you get access to the admin account again, with your own password so they can’t change it?

  1. Disconnect the telephone line
  2. Clear the cache, cookies and saved vodafone router password from your browser (otherwise it will just automatically log you in with the user  “vodafone” not “admin”
  3. Press the reset button for between 15-20 seconds and release.
  4. Switch the router off then on again.
  5. Connect to the router from IE, FireFox, Chrome, etc, using this IP address: 192.168.0.1
  6. Log in as admin with the password VF-EShg553 and change the passwords for: vodafone, admin and support.

Youtube on Your desktop – No browser or Flash needed

This is a wicked app from http://flavio.tordini.org/minitube

Minitube

There’s life outside the browser!

Minitube is a native YouTube client. With it you can watch YouTube videos in a new way: you type a keyword, Minitube gives you an endless video stream. Minitube does not require the Flash Player.

Minitube is not about cloning the original YouTube web interface, it aims to create a new TV-like experience.

Download

Current version is 0.9, released on January 23, 2010. Here are the main changes since version 0.8:

  • Ability to clear recent keywords (by popular demand!)
  • Enhanced fullscreen mode with toolbar and playlist (Linux only)
  • Fixed buggy toolbar search box (Thanks to Salvatore Benedetto)
  • Fixed long queries in the recent keywords list (Thanks to Vadim P.)
  • Fixed time formatting bug with videos longer than an hour (Thanks to Rene Bogusch)
  • Norwegian translation by Jan W. Skjoldal

Full version history

Choose your platform:

  • Linux – 32bit binaries. You need Qt version >= 4.5 and the Phonon libraries. Ubuntu users can get their package from GetDeb or from Christian Mangold’s PPA. Gentoo has an official ebuild ready to be emerged. Also Slackware has an official build. ArchLinux users have their package too. OpenSUSE has user contributed RPMs. The GStreamer Phonon backend is recommended. Minitube strives to integrate well with both GNOME and KDE.
  • Mac OS X – Universal binary. You need at least OS X version 10.4 (Tiger) and QuickTime version 7.0.
  • Windows – A few people tried to build Minitube on Windows but the results were not releaseable. This is mainly due to the weakness/instability of Phonon on Windows. Let’s wait for Qt 4.6.
  • Source code. You’re free to build Minitube by yourself, modify it and redistribute it according to the GNU General Public License.

Mount a remote directory with sshfs

First install the Sshfs module:

sudo apt-get install sshfs

Now use modprobe command to load fuse

sudo modprobe fuse

Need to set up some permissions in to access the utilities.

sudo adduser richs fuse

sudo chown root:fuse /dev/fuse

sudo chmod +x /usr/bin/fusermount

Note: you might get this error. “chmd: cannot access ‘/dev/fusermount’ : No such file or directory.” I fix it by doing

whereis fusermount

Which gives

/usr/bin/fusermount

sudo chmod +x /usr/bin/fusermount

Logout and Log back in again.

Create a Directory called remotedir in you Home Directory (don’t use sudo, it’s YOUR home directory).

mkdir ~/remotedir

Now use this command to mount it. it will prompt to save the server key and for your remote computer password.

sshfs richs@192.168.0.2 :/media/storage ~/remotedir

Now you have full access to the remote directory as if it was physically on your local computer

Remotely connect to another Linux desktop

Adept Linux users would already be thinking about the System > Preferences > Remote Desktop menu entry. Of course we will use that. However, it lets you configure your computer to allow/disallow remote desktop access. It doesn’t let you connect to a remote computer. Extra software is required for that, which we now look into.

Allow Remote Desktop Connections

First off, you would need to enable remote desktop on the Linux computer that you want to access via remote desktop. Doing so is easy by using the System > Preferences > Remote Desktop option. In the dialog that shows up – check “Allow other users to view your desktop”. You can also configure additional options like requiring password for remote access and notification icons. It is advisable to use a password for remote access, so that only trusted users may be able to establish a connection.

How do i connect to a remote desktop

With all that set up, its time to connect to it from another Linux machine, Here’s how.

Connecting From Another Linux Machine

Linux uses Virtual Networking Connections for remote desktop. Your best bet would be to use a VNC viewer to access the remote desktop. Use the command sudo apt-get install xvnc4viewer to install VNC viewer. Now all you have to do is to issue the vncviewer command. You will be asked for a password (if it is configured on the remote machine) and you can then view and interact with the remote desktop.

vncviewer 192.168.0.3

Howto: Crunchbang Statler Xfce on EeePc

Got the full Crunchbang set

Well today I finally finished my complete collection of Crunchbang installs on all my computers. I had a bit of trouble with the first attempt of the USB install, but it was a Debian Installer formatting problem, not Crunchbang related. It also happened on one of my laptops where after formatting the partitions, the installer threw up a message about an unclean partition with a previous install. This was on a fresh partition.

How to install Crunchbang Statler on an EeePc
First you need to download you Crunchbang Statler of choice; OpenBox or Xfce, i486, i686, amd64bit.
See this post about which one to choose:
http://crunchbanglinux.org/wiki/statler_which_version
And the full list of downloads here:
http://crunchbanglinux.org/downloads/statler/alpha-01/

I chose the i686 Xfce Edition for my Netbook as I already have the OpenBox Edition on two laptops, and as the the processor is an Intel, I chose the i686 version.

My EeePc Specs:
Asus EeepPC 900 HD
Intel Celeron 900 MHz Processor
1Gb Ram
Intel Corporation Mobile 915GM/GMS/910GML Express Graphics
Realtek Semiconductor RTL8187SE Wireless
160Gb HDD

USB Pendrive Preparation, and Transferring the Iso:
I asked for help on the Crunchbang Forums and omns gave me the link to this guide (which I followed to the letter): http://crunchbanglinux.org/wiki/statler_usb_installation

Getting the EeePc ready:
I plugeed in my Pendrive fired up my EeePc and at boot hit F2 to get into the BIOS setup. My main task was to choose the USB as the main harddrive, then go to the boot order and select it as the first boot device before the harddrive. Hit F10 to save and exit and restart.

Lovely Jubbly! Got the Crunchbang install menu and chose Text Install and went through the motions which are pretty self-explanatory.

There was a very important note on the Crunchbang wiki about Cdrom drivers:

Using the USB stick to perform a HD install
If you are using your newly created CrunchBang USB stick to perform a hard disk installation, the install will prompt you to “Load CD-ROM drivers from removable media?” To workaround this, you should:
1. Select ”” when prompted to “Load CD-ROM drivers from removable media?”
2. Select ”” when prompted to “Manually select a CD-ROM module and device?”
3. Select “none” on the next screen.
4. Enter ”/dev/sdX” when prompted for “Device file for accessing the CD-ROM:“
❗ Replace /dev/sdX with the actual hard disk device learned from the command above.

The installation should now continue as normal.

I did as it said and chose “sda” which is the EeePc main harddrive and the setup continued.

Partitioning and Installing
I just went through the motions as with any other Debian install and the only problem I came up against was that something went wrong with the formatting of my chosen partition. I got an error saying that the partition was unclean, and that there were remnants of a previous install. I remember this happening on one of my laptops before, so I just chose to delete the partition, and then tell the Debian installer to automatically partition the free space. Worked like a charm. I got an Ext3 file system, which I always use on production systems, and a 2Gb Swap partition. I normally only choose 1Gb for Swap, but not really an issue on a 160Gb drive.

The install went perfectly, I shutdown, removed the USB pendrive, reset the boot order to main Harddrive, and fired up my spanking new Crunchbang EeePc.

Everything worked out of the box, including wireless. I still need to dig deeper and investigate further, but on first experiences it’s fast, light, and very well laid out for an EeePc desktop. I had Ubuntu UNR on it before, which had a custom menu that took up the entire screen and all the windows had the top bars removed (No minimize, close buttons) which made for a very bloated hard to manage desktop. Crunchbang on my EeePc looks and feels exactly like my other desktops, but a mini version. Currently very comfoirtably performing my daily tasks.

More to come once I have given everything a full work out for a week.

Easy File Encryption Decryption with CCrypt

CCrypt is in most Linux repos. I use it on Crunchbang Statler (Debian Squeeze) to encrypt and decrypt files quickly with nothing more than two commands and a password.

Firstly install Ccrypt:
sudo apt-get install ccrypt

Now create a test file and add some basic text:(I put encrypt decrypt)
nano encrypt-test.text

Now encrypt the file (it’ll ask for a password twice):
ccrypt encrypt-test.txt

Now open it and it is unreadable:
nano encrypt-test.txt

To decrypt: use the “-d” switch
ccrypt -d encrypt-test.txt

More information:
http://ccrypt.sourceforge.net/

Crunchbang Faster Internet – No iPv6

To disable iPv6 system-wide for all connections you can edit the aliases.conf file:
sudo nano /etc/modprobe.d/aliases.conf

Then uncomment iPv6 line and turn it off :

#alias net-pf-10 ipv6

So that the network protocols looks like this:

# network protocols ##########################################################
# alias net-pf-1 unix
# alias net-pf-2 ipv4
# alias net-pf-3 ax25
# alias net-pf-4 ipx
# alias net-pf-5 appletalk
# alias net-pf-6 netrom
# 7 BRIDGE
# alias net-pf-8 atm
# alias net-pf-9 x25
alias net-pf-10 ipv6 off
# alias net-pf-11 rose
# alias net-pf-12 decnet

Now reboot and go super-speed-surfing 😉

Howto – Linux – install Google Earth

Google Earth seems to throw up error messages lately:
setup.data/setup.xml:1: parser error : Document is empty

^
setup.data/setup.xml:1: parser error : Start tag expected, '<' not found

^
Couldn't load 'setup.data/setup.xml'

So here is the cure:

1. First install “lsb-core”
sudo apt-get install lsb-core

2. Download and extract Google Earth to a temporary dIrectory:
wget http://dl.google.com/earth/client/current/GoogleEarthLinux.bin && chmod +x GoogleEarthLinux.bin && ./GoogleEarthLinux.bin --target /tmp/ge

3. Change to the temp directory and change setupgtk to setupgtk2:
cd /tmp/ge/setup.data/bin/Linux/x86/
sudo mv setup.gtk setup.gtk2
cd /tmp/ge

4. Run the installer:
./setup.sh

Now the Google Gui installer will open.

If you have an Nvidia card, Google Earth may tell you it doesn’t recognise your card, just remove it and reinstall it. This worked for me with an Nvidia Geforce fx 5200 using the official Linux driver from the Nvidia website.

Happy Globe-trotting 😉

WordPress Show Excerpts Instead of Full Posts

WordPress Excerpt or Full post?
If you use different themes on your WordPress blog, you will notice that on the front page you can choose how many posts to show, and whether the reader gets the full post or just an excerpt. This excerpt function is the themer’s choice and not a standard WordPress feature.

So how do you enable it on a theme?
1. You need to go to the “index.php” file of your theme and change the_content() and change it to the_excerpt():

.

.

.

.

.
WordPress will now show only the first 120 words of each post.

This little tip came from: http://lorelle.wordpress.com/

Lightweight Hardware Information Gui

LSHW-GTK

Everybody knows about “lshw” and getting hardware information via the Terminal, you can even pipe it to a text document or get specific hardware info:

sudo lshw > hardware.txt
sudo lshw -html > hardware-info.html
sudo lshw -short
sudo lshw -class memory

But, today I also found lshw-gtk gui to go with it. It’s amazing what you find when you dig through the repos, or go searching for something related.
Basically I am running Crunchbang 10 “Statler” and wanted to pipe my harwdare profile to a text file, only to find that lshw isn’t installed by default.
So I did a search for “lshw” and saw “lshw-gtk”, cool methinks, i’ll have a look at that, being as I love Gtk apps if a gui is necessary.

sudo aptitude install lshw lshw-gtk

And run it from the terminal with:
gksudo lshw-gtk

This is what I got:

Nice little app 🙂

http://www.ezix.org/project/wiki/HardwareLiSter

How to BBC iPlayer from outside the UK

If you live outside the UK you will know about GeoBlocking where you will be denied access to certain data depending on your IP address. You can get around this by using FoxyProxy on Firefox with a UK proxy server IP.

1. Download and install FoxyProxy, and restart Firefox:
https://addons.mozilla.org/en-US/firefox/addon/15023

2. Open the FoxyProxy settings and configure a UK proxy:
Go to Tools > Addons > FoxyProxy > Preferences > Add New Proxy

3. Add the Required Data:
In the “General” Tab just add the name of your proxy. I put BBC iPlayer.
In the “Proxy Details” Tab put the IP address 92.52.125.17 with the port address 80
Now Click “Ok” to Save.

4. Optionally you can set the proxy to Auto for the BBC iPlayer url:
Just add the url http://bbc.co.uk/iplayer/* to the Automatic Proxy field and click “Ok” to Save.

5. Activate the BBC iPlayer proxy:
On the bottom right of Firefox you will have a FoxyProxy button. Right-Click it and choose “BBC iPlayer” and make sure it is set as “enabled”.

6. Get yourself something nice to eat!
Click on BBC2 and get yourself something nice from one of Raymond Blanc’s marvelous cookery programmes [/sarcasm]

That’s it, you are good to go. Happy viewing!

At certain points, Proxy servers can get flooded and slow, or even not work at all. If this happens just go and get the IP of a new UK proxy from here: http://www.xroxy.com/proxy-country-GB.htm

#! Crunchbang Set the Time via Terminal CLI

From: http://wiki.debian.org/DateTime

Set the time manually via the terminal cli

When setting the time manually, the time string may be confusing. The command date –set … accepts the date and time in many formats. You can read the ShUtils info document, or use the example below to figure out one possible format. The date is given in ISO 8601 standard format YYYY-MM-DD for Year-Month-DayOfMonth, and time of day using 24 hour clock. Leading zeros are significant.

Set the date
sudo date --set 2010-01-28

Set the time
sudo date --set 21:08:00

Restart Tint2 to see the correct time:
sudo killall tint2
tint2 &

Conky Forecast on #! Crunchbang

Add Kaivalagi’s Lucid repo, and install ConkyForecast:
sudo wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyforecast-lucid.list -O /etc/apt/sources.list.d/conkyhardcore-lucid.list

Get the repo Gpg key:
wget -q http://www.kaivalagi.com/ubuntu/ppa/conkyhardcore-key.gpg -O- | sudo apt-key add -

Update APT and install conkeyforecast:
sudo apt-get update && sudo apt-get install conkyforecast

Copy the conkyforecast config to your home directory:
cp /usr/share/conkyforecast/conkyForecast.config ~/.conkyForecast.config

Edit it to add your XOAP key: (which you get from ) http://www.weather.com/services/xmloap.html
nano ~/.conkyForecast.config

//

Install Swiftfox on #! Crunchbang

swiftfox

If you want a bit of speed to your browsing now that Firefox has gone all bloated and slow, try Swiftfox.
http://getswiftfox.com

Just download your desired version, I chose the i686 for my old AMD Mobile Sempron:
http://getswiftfox.com/deb.htm

Now you need to get a dependency: (libxp6)
sudo apt-get install libxp6

Then install the Swiftfox .deb file: (mine was downloaded to my “downloads” directory)
cd downloads

Change the next command to suit your Swiftfox build:
sudo dpkg -i swiftfox_3.6.0-1_i686.deb

That’s it, you can now run Swiftfox with the command:
swiftfox

As it reads from the standard Mozilla directory, all your bookmarks etc for Iceweasel will also be available.

How to Mount Ubuntu Ext4 on Debian Ext3

As Ext4 was experimental during the release of Lenny, it wasn’t fully implemented. However, you can mount an Ext4 file system on Ext3 with Debian Lenny, but only in “Read Only” mode.

As root
tune2fs -E test_fs /dev/XXX
mount -t ext4dev -o ro /dev/XXX /mnt/ZZZ

I had Ubuntu 10.04 Lucid Lynx and Windows 7 on two other partitions when I installed Lenny, I now have read access to Ubuntu’s Ext4 and read/write to Windows 7’s ntfs file system.

Debian Lenny on Acer 3004 laptop

I needed a stable, fast environment to get some work done so I decided that as I had a spare partition on my Acer 3004 laptop i’d go back to Debian Lenny.

I installed Debian Lenny Netinstall via a wired connection to my router.

I chose to install to an Ext3 partition, and only selected the base files and laptop files as I am going for a Fluxbox driven rocket box.

This laptop has Broadcom wireless, a Sis graphics card, and a Synaptics touchpad. Everything else is standard

I updated and upgraded after install and then got my wireless drivers and additional wireless necessities (I have a wpa2 tkip wireless connection):
aptitude instal bcm43-fwcutter wireless-tools wpasupplicant
Then as I like to use Wicd which isn’t available in the standard Lenny repos, I added Lenny backports and pinned the standard repos as default:
Lenny Backports:
# Backported packages for Debian Lenny
deb http://www.backports.org/debian lenny-backports main contrib non-free

Backports key:
apt-get install debian-backports-keyring

Pin Lenny as default:
echo 'APT::Default-Release "lenny";' > /etc/apt/apt.conf.d/default
While I was at it, I added “contrib” and “non-free” to the standard repos

Install Xorg Sis driver which automaticall installs Xorg dependencies
aptitude install xserver-xorg-video-sis
Incidentally, I always add video=sisfb after ro quiet splash on the menu.list or grub.cfg to make sure that the sisfb framebuffer gets used. Vesa witll leave you with a blurry desktop with the wrong colour depth. But that’s what you get for buying a laptop with a pile of crap graphics card like Sis. Sis have stated there will never be drivers for Linux, so we just have to put up with it, or buy Ati/Nvidia next time.

Synaptics Touchpad
aptitude install xserver-xorg-input-synaptics
(See my xorg.conf to add the relative synaptics section, without it you get no scroll action)

Next up I configured Xorg and copied the new xorg.conf over to /etc/X11
su to root
X -configure
Then copy it over:
cp /root/xorg.conf.new /etc/X11/xorg.conf

Next up I had to manually add my Spanish keyboard and the section for my Synaptics touchpad
As a quick fix to get your keyboard keymap correct while you are getting everything setup, you can issue this command with your keymap (mine is “es” for Spain):
setxkbmap es
My Xorg.conf for my laptop with everything working
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
RgbPath "/etc/X11/rgb"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

Section "Module"
Load "GLcore"
Load "dri"
Load "dbe"
Load "record"
Load "glx"
Load "xtrap"
Load "extmod"
Load "synaptics"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "es"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "synaptics"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
Option "TapButton1" "1"
Option "SpecialScrollAreaRight" "true"
Option "VertEdgeScroll" "true"
Option "VertTwoFingerScroll" "true"
Option "SHMConfig" "true"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Device"
### Available Driver options are:-
### Values: : integer, : float, : "True"/"False",
### : "String", : " Hz/kHz/MHz"
### [arg]: arg optional
#Option "Accel" # []
#Option "AccelMethod" #
#Option "TurboQueue" # []
#Option "FastVram" # []
#Option "HostBus" # []
#Option "RenderAcceleration" # []
#Option "ForceCRT1Type" #
#Option "ForceCRT2Type" #
#Option "ShadowFB" # []
#Option "DRI" # []
#Option "AGPSize" #
#Option "GARTSize" #
#Option "Vesa" # []
#Option "MaxXFBMem" #
#Option "EnableSiSCtrl" # []
#Option "SWCursor" # []
#Option "HWCursor" # []
#Option "UseColorHWCursor" # []
#Option "Rotate" #
#Option "Reflect" #
#Option "Xvideo" # []
#Option "InternalModes" # []
#Option "OverruleFrequencyRanges" # []
#Option "RestoreBySetMode" # []
#Option "ForceCRT1" # []
#Option "XvOnCRT2" # []
#Option "PanelDelayCompensation" #
#Option "PDC" #
#Option "PanelDelayCompensation2" #
#Option "PDC2" #
#Option "PanelDelayCompensation1" #
#Option "PDC1" #
#Option "EMI" #
#Option "LVDSHL" #
#Option "ForcePanelRGB" #
#Option "SpecialTiming" #
#Option "TVStandard" #
#Option "UseROMData" # []
#Option "UseOEMData" # []
#Option "YV12" # []
#Option "CHTVType" # []
#Option "CHTVOverscan" # []
#Option "CHTVSuperOverscan" # []
#Option "CHTVLumaBandwidthCVBS" #
#Option "CHTVLumaBandwidthSVIDEO" #
#Option "CHTVLumaFlickerFilter" #
#Option "CHTVChromaBandwidth" #
#Option "CHTVChromaFlickerFilter" #
#Option "CHTVCVBSColor" # []
#Option "CHTVTextEnhance" #
#Option "CHTVContrast" #
#Option "SISTVEdgeEnhance" #
#Option "SISTVAntiFlicker" #
#Option "SISTVSaturation" #
#Option "SISTVCFilter" # []
#Option "SISTVYFilter" #
#Option "SISTVColorCalibFine" #
#Option "SISTVColorCalibCoarse" #
#Option "SISTVXScale" #
#Option "SISTVYScale" #
#Option "TVXPosOffset" #
#Option "TVYPosOffset" #
#Option "SIS6326TVAntiFlicker" #
#Option "SIS6326TVEnableYFilter" # []
#Option "SIS6326TVYFilterStrong" # []
#Option "SIS6326TVForcePlug" #
#Option "SIS6326FSCAdjust" #
#Option "YPbPrAspectRatio" #
#Option "TVBlueWorkAround" # []
#Option "ColorHWCursorBlending" # []
#Option "ColorHWCursorBlendThreshold" #
#Option "CRT2Detection" # []
#Option "ForceCRT2ReDetection" # []
#Option "SenseYPbPr" # []
#Option "CRT1Gamma" # []
#Option "CRT2Gamma" # []
#Option "GammaBrightness" #
#Option "GammaBrightnessCRT2" #
#Option "CRT2GammaBrightness" #
#Option "Brightness" #
#Option "NewGammaBrightness" #
#Option "CRT2Brightness" #
#Option "CRT2NewGammaBrightness" #
#Option "Contrast" #
#Option "NewGammaContrast" #
#Option "CRT2Contrast" #
#Option "CRT2NewGammaContrast" #
#Option "CRT1Saturation" #
#Option "XvGamma" # []
#Option "XvDefaultContrast" #
#Option "XvDefaultBrightness" #
#Option "XvDefaultHue" #
#Option "XvDefaultSaturation" #
#Option "XvDefaultDisableGfx" # []
#Option "XvDefaultDisableGfxLR" # []
#Option "XvChromaMin" #
#Option "XvChromaMax" #
#Option "XvUseChromaKey" # []
#Option "XvInsideChromaKey" # []
#Option "XvYUVChromaKey" # []
#Option "XvDisableColorKey" # []
#Option "XvUseMemcpy" # []
#Option "BenchmarkMemcpy" # []
#Option "UseSSE" # []
#Option "XvDefaultAdaptor" #
#Option "ScaleLCD" # []
#Option "CenterLCD" # []
#Option "EnableHotkey" # []
#Option "ForceCRT1VGAAspect" #
#Option "ForceCRT2VGAAspect" #
#Option "MergedFB" # []
#Option "TwinView" # []
#Option "MergedFBAuto" # []
#Option "CRT2HSync" #
#Option "SecondMonitorHorizSync" #
#Option "CRT2VRefresh" #
#Option "SecondMonitorVertRefresh" #
#Option "CRT2Position" #
#Option "TwinViewOrientation" #
#Option "MetaModes" #
#Option "MergedDPI" #
#Option "MergedXinerama" # []
#Option "TwinviewXineramaInfo" # []
#Option "MergedXineramaCRT2IsScreen0" # []
#Option "MergedNonRectangular" # []
#Option "MergedMouseRestriction" # []
#Option "SHMConfig" "true"
Identifier "Card0"
Driver "sis"
VendorName "Silicon Integrated Systems [SiS]"
BoardName "661/741/760 PCI/AGP or 662/761Gx PCIE VGA Display Adapter"
BusID "PCI:1:0:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection

Once that was all done I installed my desktop and a few apps:
aptitude install fluxbox wicd gdm bbrun fluxconf fbpager xfce4-terminal conky lua50 imlib2 iceweasel scrot imagemagick
No themes, no wallpaper, no frills………….. at the moment 😉

Then reboot, at GDM choose Session > Fluxbox then login to a very sparse but very fast Fluxbox desktop.

Next up was to edit my ~/fluxbox/menu to add my main apps right at the top, and also add wicd and conky as my startup apps on ~/fluxbox/startup

That’s it for the moment for a basic Debian Lenny Acer laptop H4x0r-R0kk3t-B0x.

How to Ubuntu 10.04 Window buttons on the right

The new theme and lay out on Ubuntu 10.04 Lucid Lynx introduced a new annoyance. When you open an application window, the minimize, maximize and close buttons are now on the left. This is easily fixed with one command in the terminal:

Place just the buttons on the right:

gconftool-2 --set /apps/metacity/general/button_layout --type string “:maximize,minimize,close,”

If you also want the menu button on the left:

gconftool-2 --set /apps/metacity/general/button_layout --type string “menu:maximize,minimize,close,”

Not sure why the devs decided to go all Mac on us, but there you go, all easy to fix.

Quickest Archlinux install guide ever?

This was posted by willxtreme on the Crunchbang forum:
#! ArchBang
http://crunchbanglinux.org/forums/post/50583/#p50583

Setup Arch with OpenBox
He did it in VirtualBox so just add your graphics driver.

1) Boot cd & login as root & type /arch/setup
2) Select Source>CD
3) Set clock UTC
4) Prepare HD>Auto Prepare for now
***5) Select ALL Packages lol & install them***
6) Configure w/ Nano
-rc.conf>check timezone
>MODULES=(!net-pf-10 !snd_pcsp !pcspkr loop) #to disable ipv6 & beep
>change myhost to your desired cpu name (sasoria)
-/etc/hosts>be sure to see your hostname
-/etc/locale.gen>uncomment your locale
-/etc/pacman.d/mirrorlist>uncomment for your country (Canada)
-Set your root passwd & click Done
7) Bootloader>Grub (check menu.lst & see if all cool)>select your main HD>Reboot
8) Login as root & ping http://www.google.com to check your network
9) pacman -Syu & reboot if there was a kernel upgrade
10) useradd -m -G users,audio,video,wheel,storage,optical,power -s /bin/bash will
11) passwd will
12) pacman -S powerpill (powerpill -Syu from now on when you do big installs)
13) pacman -S alsa-utils also-oss>alsaconf (detect snd card)
>run alsamixer as normal user to adjust vol(m to unmute) ex:su – will
14) save settings by going back root & run alsactl store
15) #nano /etc/rc.conf to add alsa & hal: DAEMONS=(syslog-ng network crond alsa hal)
16) in the following order:pacman -S libgl>pacman -S xorg>pacman -S mesa
17) # pacman -S xf86-video-vmware
18) # Xorg -configure > cp /root/xorg.conf.new /etc/X11/xorg.conf
19) enable hotplugging # pacman -S hal dbus xf86-input-evdev xf86-input-synaptics
20) pacman -S openbox obconf obmenu
21) Once openbox is installed you will get a message to move menu.xml & rc.xml to ~/.config/openbox/ in your home directory:
# su – yourusername
$ mkdir -p ~/.config/openbox/
$ cp /etc/xdg/openbox/rc.xml ~/.config/openbox/
$ cp /etc/xdg/openbox/menu.xml ~/.config/openbox/
22)
edit your ~/.xinitrc (as non-root user) and add the following:
exec openbox-session

Howto Splashy on Debian

Tired of watching screens full of hardware releated info scrolling past during Startup and shutdown.

Welcome to the world of Splash Screen, Screenshots Here

In earlier stage bootsplash screen was configured throught a lot of kernel hacking and using it has a hell lot of hardwork including recompilling of kernel.

But the newest form SPLASHY in a userspace implementation of kernel so that it provides all the necessary features right at userspace.

In debian installing splashy is just a matter of few commands

1) IF you don’t have unstable repo’s in your source list then follow it otherwise skip to step 3

echo "deb http://http.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list
echo “deb-src http://http.us.debian.org/debian unstable main contrib non-free” >> /etc/apt/sources.list



2) then apt-get update

3) last apt-get install splashy splashy-themes

After this what you need to is just one thing

open your menu.lst (/boot/grub/menu.lst)
and in the line with kernel value add these words at the end of that line

"vga=791 splash quiet"

Ex : – kernel /boot/vmlinuz ro root=/dev/hda8 ro vga=791 splash quiet

4)THIS STEP IS OPTIONAL
To run Splashy from initramfs you need to create a new initramfs image. An initramfs image is a little system that is

launched during the kernel’s initalization, before the system starts.

During Splashy’s installation Splashy sets everything up so you can get it integrated into initramfs whenever you wish by

just running a single command.

But first you must edit /etc/default/splashy and set ENABLE_INITRAMFS=1 so that Splashy will integrate itself into future initramfs images.

update-initramfs -u -t -k `uname -r`

then reboot and you will have a slashy desktop

ADVANCE SETTINGS

All the themes are by defaults installed in /etc/splashy/themes

configuration for splashy is in/etc/splashy/config.xml

and configuration for respective themes is available in /etc/splash/themes/ in XML file format

some of the configuration’s that can be done include changing the colour theme as well as the progress bar size color

direction and image shown.

TO CHANGE THEME

Once the theme is installed, just run splashy_config -s where name is the name of the theme

To get the complete list of all the splashy themes installed just type in

splashy_config --info

I hope this article will help you all.

Original Source HERE

//

Block Obsessive Spam Bots by Redirecting their IP address

//

I had a major problem on two forums with obsessive spam attacks. These are the aggressive spambots which repeatedly attack every two minutes, clogging the forum logs with error messages.

Kaptcha was in place for sign ups, but sometimes human spammers sign up then add the details (login + password)  to a spambot script.

1. You add a ban trigger which stops them from posting – They continually try to post spam

2. You add a ban trigger which stops them from logging in – They continually try to login

3. You delete the account and ban the IP, Email address, User name – They come back with different details

I was at my wit’s end so I decided to try and use an htaccess file with a rewrite permanent redirect.

I Googled and found these two sites: HERE and HERE.

This is the result:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} ^94\.23\.216\.104$ [OR]
RewriteCond %{REMOTE_ADDR} ^94\.23\.216\.103$ [OR]
RewriteCond %{REMOTE_ADDR} ^62\.60\.136\.28$ [OR]
RewriteCond %{REMOTE_ADDR} ^94\.23\.207\.161$ [OR]
RewriteCond %{REMOTE_ADDR} ^61\.145\.121\.124$ [OR]
RewriteCond %{REMOTE_ADDR} ^94\.23\.216\.105$ [OR]
RewriteCond %{REMOTE_ADDR} ^94\.23\.216\.106$ [OR]
RewriteCond %{REMOTE_ADDR} ^212\.117\.162\.244$ [OR]
RewriteCond %{REMOTE_ADDR} ^216\.224\.124\.124$ [OR]
RewriteCond %{REMOTE_ADDR} ^212\.117\.164\.65$ [OR]
RewriteCond %{REMOTE_ADDR} ^91\.121\.109\.65$
RewriteRule .* http://www.usdoj.gov/criminal/cybercrime/cyberstalking.htm [R,L]

My domains are hosted at ICDsoft on Linux servers and have the mod rewrite engine turned off by default. So that had to be enabled. Below that are the Rewrite Conditions which basically tell the server to redirect the incoming IP addresses to the Cyberstalking page of usdoj.gov, which is very apt site for the bastards (spambots) to end up.

I basically have a clean error log directory now, and if a new spambot gets through, I just add its IP to htaccess, and redirect it well away from my forums.

Many people who use Linux have Linux forums, mine are Smf hosted at ICDsoft, and I thought that this info may help some of you fight back the ever increasing spam attacks.

Incidentally, the support at ICDsoft is awesome, I have 4 servers and many sites hosted with them and can do nothing but recommend the quality:

Ubuntu Slowdown – Dual Boot Loses Swap UUID [Fix]

//

ubuntu-logo-100x90This was reported as an issue before when dual-booting Ubuntu with another distro. Basically the Swap UUID Doesn’t get updated in /etc/fstab when another distro is installed on another partition.

I installed Fedora for a test run on a spare partition, with Grub being installed to MBR.

Later after an Ubuntu update, which included a new kernel and also a newer Grub, Ubuntu took back control of Grub.

I booted into Ubuntu, only to find that everything was a bit sluggish, and having experienced this before, I checked my Swap partition in  readiness to solve this problem which I had a feeling was repeating itself.

Check Swap:

free -m

With the result:

Swap:            0          0          0

Fix with “blkid” to find the real UUID of the Swap Partition:

blkid


/dev/sda1: LABEL="ACER" UUID="320D-180E" TYPE="vfat"
/dev/sda2: LABEL="Fedora-12-i686-L" UUID="3b915b51-c7ce-4077-975d-df2a177b94cb" TYPE="ext4"
/dev/sda3: UUID="78a42ee0-4d8a-474c-9cd6-b3f3a6dd6449" TYPE="ext4"
/dev/sda4: UUID="4bfbb29b-78da-4172-ae54-b1bb934de7f5" TYPE="swap"

Then use Nano to Fstab and change the old Swap UUID to the new UUID:

sudo nano /etc/fstab

Now just turn Swap on and check used memory again:

sudo swapon -a

with the result:

free -m

   Swap:         1153          0       1153

So there you have it, if you install another Linux distro on a spare partition to dual-boot and use the same Swap partition, you may find that when you boot into Ubuntu that it is a little sluggish than usual.

This is a known problem for dual and triple booters, but easily remedied, as you see above.

//

[Howto] Faster internet with Google DNS

Yet another contribution from Google to help us get what we need over the internet…………… quickly!

Google launched it’s own DNS service, and seeing as their bots crawl practically everything on the net, you will find even new sites will be stored, listed and ready to go. Hopefully this service will be a lot faster than your usual ISP.

How to configure them:

Gui
Every distro has it’s own Network Config Manager Gui, and i’m not going to post screenshots of all of them for Kde, Gnome and Xfce4 etc. The basic theory is that you right-click your netork icon, and edit the IpV4 settings and choose DHCP (addresses only) and then add the two Google DNS server IP’s – 8.8.8.8, 8.8.4.4.

Geek style
Open /etc/resolv.conf (I use Nano text editor)

sudo nano /etc/resolv.conf

Then edit the dns servers to the Google ones.

nameserver 8.8.8.8
nameserver 8.8.4.4

Follow our guide on how to stop Network manager overwriting your settings:
http://debianandi.blogspot.com.es/2013/01/stop-resolvconf-being-overwritten-by.html

Now either restart your network connection, or reboot completely and start surfing. You should see a faster domain name resolution.

It looks like OpenDNS has a new rival on the block!