Wednesday, January 26, 2011

mysql stuff - setting up a (super) user

1. Install mysql-server package
2. Create a super user
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;
3. Install phpmyadmin package

4. Go ahead and import Excel tables!

Friday, January 21, 2011

Raid 1 not starting and mounting on boot - Ubuntu 10.10 Maverick

Still a work in progress.

Here are my link resources to figure this out -
Ubuntu forums #1

Ubuntu forums #2

and a new lead here.


and here's a draft:
hard disk1: /dev/sda
hard disk2: /dev/sdb, raid device: /dev/sdb1
hard disk3: /dev/sdc, raid device: /dev/sdc1
raid1 device name: /dev/md0

ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1


mount raid1
sudo rm /etc/mdadm/mdadm.conf
sudo dpkg-reconfigure mdadm

click Yes (redundancy checks), Yes (monitor daemon), enter email address, No (boot system if RAID gets degraded)

gksu gedit /etc/mdadm/mdadm.conf
replace the ARRAY /dev/md0, and remove the UUID references, replace with devices=/dev/sdb1,/dev/sdc1

then rerun:
sudo dpkg-reconfigure mdadm

get UUID of the raid device:
sudo blkid

and modify fstab
gksu gedit /etc/fstab, inserting this line:

UUID=ae5f4540-59af-4e7a-84b0-ea97cc12e425  /Raid500    ext3          nodev,nosuid       0       2

The puzzle revealed
Inspecting my Ubuntu-10.04-with-RAID1 at home - which works starting up the raid and automounting it - I observed the following:
sudo blkid
reveals the following information:
dan@athena:~$ sudo blkid
/dev/sda1: UUID="7272061b-81d4-7395-e009-c51128a3b5c6" TYPE="linux_raid_member" 
/dev/sda2: UUID="c9ce349c-636a-667d-51a5-cb52c66e37ae" TYPE="linux_raid_member" 
/dev/sdb1: UUID="7272061b-81d4-7395-e009-c51128a3b5c6" TYPE="linux_raid_member" 
/dev/sdb2: UUID="c9ce349c-636a-667d-51a5-cb52c66e37ae" TYPE="linux_raid_member" 
/dev/md0: UUID="97019d30-06b0-42ef-8bfd-1699316f3012" TYPE="swap" 
/dev/md1: LABEL="raid1now" UUID="f1d9e97a-b766-4af1-bafd-ce0192aa04e1" TYPE="ext4"

I am guessing here that the /dev/sda1 and /dev/sdb1 are the swap partitions of the 2 actual physical drives. And the /dev/sda2 and /dev/sdb2 are, in turn, the ext4 partitions also of the 2 actual physical drives. And notice how both sda1 and sdb1 are the same, as well as sda2 and sdb2.

The raid device then takes new UUID values for swap (/dev/md0) and ext4 (/dev/md1).

BUT, the mdadm.conf tells a different story.
# definitions of existing MD arrays
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=7272061b:81d47395:e009c511:28a3b5$
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=c9ce349c:636a667d:51a5cb52:c66e37$

The mdadm.conf's md0 = blkid's sda1 (and sdb1), while its md1 = blkid's sda2 (and sdb2) - with slight variations:
Comparing blkid's sda1 (and sdb1) with mdadm's md0:
7272061b-81d4-7395-e009-c51128a3b5c6
7272061b:81d47395:e009c511:28a3b5$

and blkid's sda2/sdb2 with mdadm's md1:
c9ce349c-636a-667d-51a5-cb52c66e37ae
c9ce349c:636a667d:51a5cb52:c66e37$

So mdadm.conf references the blkid's sda/sdb UUIDs, and NOT the blkid's md0/md1 UUIDs.

Finally, fstab reveals the following:
# / was on /dev/md1 during installation
UUID=f1d9e97a-b766-4af1-bafd-ce0192aa04e1 /               ext4    errors=remoun$
# swap was on /dev/md0 during installation
UUID=97019d30-06b0-42ef-8bfd-1699316f3012 none            swap    sw           $

Fstab references blkid's md1 with it's own md1 for the ext4 partition:
blkid: f1d9e97a-b766-4af1-bafd-ce0192aa04e1
fstab: f1d9e97a-b766-4af1-bafd-ce0192aa04e1

and same with the swap partition.

Saturday, November 20, 2010

Creating a bootable USB for Meego 1.1 in Ubuntu

What is Meego? Yet another netbook OS.

Site reference of Meego.

1. Download the image file from Meego's website.
2. After download is complete, insert a USB in your computer. At least 1gb in size. It doesn't matter if it is formatted or not. ALL DATA WILL BE ERASED.
3. Determine the device ID assigned by Ubuntu to the USB. In a terminal window, type:
sudo fdisk -l

You will see an output similar to this:
Disk /dev/sdc: 2003 MB, 2003828736 bytes
16 heads, 32 sectors/track, 7644 cylinders
Units = cylinders of 512 * 512 = 262144 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          16        7644     1952832    b  W95 FAT32

Your hard disk will usually be /dev/sda. Don't pick that!

4. Unmount your USB drive.
umount /dev/sdc1

5. Run the dd command in the terminal.
sudo dd bs=4096 if=<image file> of=<usb drive>

example:
sudo dd bs=4096 if=Downloads/linux/meego-netbook-ia32-1.1.img of=/dev/sdc1

At the end of the process, you will see an output in the terminal window similar to this:
210688+0 records in
210688+0 records out
862978048 bytes (863 MB) copied, 169.138 s, 5.1 MB/s

That's it. You may now boot your netbook with the USB Meego.

Monday, November 15, 2010

Audacity in Ubuntu 10.04

Make sure you have installed the ubuntu restricted package first.
sudo apt-get install ubuntu-restricted-extras

Then to install audacity:
sudo apt-get install audacity libmp3lame0

Saturday, November 13, 2010

How to resize pictures in Knoppix command-line

Here's a short how-to to reduce the size of picture files downloaded from a digicam, to prepare the picture files for upload to Facebook or other social network sites.

One word: Mogrify.

sudo apt-get install imagemagick

after the package installs, go to the folder containing the images you want resized, and go ahead to resize all the pictures to your preferred size, mine being 800x600. You also have to watch the lower - upper case of the file extension for the jpeg files, it could be ALL CAPS or small caps.

mogrify -resize 800x600 *.JPG

Here is a more detailed reference.

Saturday, November 6, 2010

Knoppix 6.2.1 versus Knoppix 6.2, installing flash

Well, I just had to take a note on the differences here.

Knoppix 6.2.1 uses kernel 2.6.32.6, and was released January 2010.
Knoppix 6.2 uses kernel 2.6.31.6, and released two months earlier, November 2009.

And here's the simple way to install Flash in Knoppix's Iceweasel browser, via terminal window:
sudo apt-get install flashplugin-nonfree

Knoppix 6.2.1 - setting system date and time

Installing the correct system date and time
In a terminal window, run as root:
dpkg-reconfigure tzdata

and search for your region and city. Mine is Asia/Manila.

Open the autoconfig file as follows:
sudo nano /etc/init.d/knoppix-autoconfig

Go to line 355 - ctrl+w, then ctrl-t - to the entry KTZ="$(getbootparam tz)" and change that to:
KTZ='Asia/Manila'

substituting your own region and city. Save the file - ctrl+x.

In the terminal window, again:
sudo apt-get install ntpdate

If apt generates an error, try updating the repositories first, like:
sudo apt-get update

then try to get the ntpdate package again.

After ntpdate package is installed, edit the ntpdate config file:
sudo nano /etc/default/ntpdate

The changes I did on my configuration:
NTPDATE_USE_NTP_CONF=no
NTPSERVER="0.asia.pool.ntp.org 1.asia.pool.ntp.org 2.asia.pool.ntp.org 3.asia.pool.ntp.org"

substituting your own ntp.org servers in that line. You may google your ntp server by googling something like sydney ntp server, for example.

Then save the file. Done!

My reference is this Knoppix forum thread.