Friday, February 15, 2008

Mounting a new hardsikd to linux

Last night I mounted a new disk to the Ubuntu system I am using and here were the steps:
  • using fdisk -l to find out the list of hard drives installed on you computer. then you should get something like the following:
Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080

Device Boot Start End Blocks Id System
/dev/sda1 * 1 29637 238059171 83 Linux
/dev/sda2 29638 30394 6080602+ 5 Extended
/dev/sda5 29638 30394 6080571 82 Linux swap / Solaris

Disk /dev/sdb: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000081

Device Boot Start End Blocks Id System
Apparently, the /dev/sdb is not mounted and also not formated.
  • if your hard disk is not formated, you need an extra formating step, I usually just do:
mkfs.ext3 /dev/sdb
  • Create a mount point. I usually load the 2nd driver as the data drive and this command will work
mkdir /data
chmod 777 /data
  • If you want to mount your drive right away( this will not mounted automatically every time you reboot )

mount /dev/sdb /data

  • if you want to mount automatically, you need to add an entry in the /etc/fstab file.
/dev/sdb /data ext3 defaults 0 0
To mount the usb external drive you need to use this:

mount -t vfat /dev/sdc1 /backup
Please note you need to specify the type here as fat. for auto mounting, add this to /etc/fstab
/dev/sdc1 /backup vfat auto,users,rw,umask=0 0 0

Pretty simple!


Tuesday, February 12, 2008

Useful apt-* commands

apt-cache for searching
apt-cache search keyword
will give you a list of all packages contain the keyword.
apt-cache show package_name
will give you a lot detail about the package
apt-cache depends package_name
will give you what packages it depends on.


Tips on removing the annoying Ubuntu cdrom needed action in apt-get

When you install any new packages using apt-get, some of the packages will be considered as "Media changes" and need you to put the OS CD into the physical machine. like this
Get:1 http://us.archive.ubuntu.com gutsy/universe python-genshi 0.4.3-1 [271kB]
Media change: please insert the disc labeled
'Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)'
in the drive '/cdrom/' and press enter


What if you are unable to do this? or tired of running from room to room? there is a little change to do to save the labor.

Just comment out the line referring cdrom in /etc/apt/sources.list. In my system this is the line you need to be commented out.
deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted


There is a complete doc on the apt-* commands in
http://www.debian.org/doc/manuals/apt-howto/index.en.html
and will find it useful on and off.

Monday, February 11, 2008

tips on configuring MySql

It was pretty a turn-key to install and run MySQL on Ubuntu. but there are several tricks you might need to know:

1) if you want to access the database from you localhost, you definitely need to grant privileges to the specified user @localhost. otherwise, mysql will always check anonymous user at locahost and most likely you will be returned with "cannot access"
2) when you are in a remote machine and you have no connection to mysql. try to use ''telnet sqlhost 3306". if this fails. the mysql server might be deny all access since the default is binding to localhost (127.0.0.1) only, this means it will only accept connections from localhost applications to avoid security hits.
To change that, edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1:
and restart the mysql server with:
/etc/init.d/mysql restart

Saturday, February 9, 2008

Idea 6.0.6 and Idea-spring

I installed the idea-spring package last week and today I found out that my IDEA does not work anymore, The error message is that "License is not valid" and stop right after that. since I do not believe the License is an issue here, I did a browsing of the idea log file and found out screams of the common logging classes. so I went to newly installed plugin directories and deleted the idea-spring since I saw the old version of comm-logging was there.

After this deletion, everyhting back to normal now.

Looks like this plugin needs to be updated.

Also I was thinkingof upgrading Idea to 7.0.x and after reading this blog. I am hesitating now. It says:
IDEA is pretty much a yearly subscription service.

Setup hylafax server on Ubuntu

I am starting to setup the fax server on my new Dell system with OS Ubuntu 7.10. this is not very smooth so I am trying to document what I did here.

The sites I found most useful are:

Pre-requisites
apt-get install hylafax-server hylafax-client cu setserial sendmail wvdial

please make sure that you have the OS cd/dvd avaialable since this is considered as media change.

Following commands might be useful for you:

find the serial port that modem is installed:
dmesg | grep tty
in this case I assume the modem is on ttyS0.

You might need to manually set the serial like this
setserial /dev/ttyS0 irq 4 port 0xc800 uart 16550


if setserial /dev/ttyS? is not working please see the dmesg for the parameters.

or you might find that lspci command useful to find all the pci installed.
Test your modem:
echo atdt3333333 > /dev/ttyS0

if you hear signal you should use the following command to stop it.
echo ath > /dev/ttyS0
Please be aware that if you setup is not finished correctly, the lock file in /var/lock/LCK..ttyS0
is not removed, you might need to manually remove it to be able to move forward for another setup.

Run faxsetup and following the above site #2 for line by line instructions.

if you run faxstat and get the following
Can not reach server at host "localhost", port 4559.

than the fax server is not started, you should run something like this:
/etc/init.d/hylafax start