Thursday, August 30, 2007

ssh using php

I found this link

it's really interesting, I like to give it a try!

Monday, August 27, 2007

simple mysql backup or transfer

sometimes we need to backup a database or transport a database from one server to another. the situations are not always good. you are stranded with no phpmyadmin help. mysql provide mysqldump to help you in non-gui environment. just do:

% mysqldump [name_of_the_database] -u [username] -p > [name_of_the_database].sql

as example,

% mysqldump krs -u krs_user -p > krs.sql

the process is finish in few minutes depends on the size of the databases. here you are the backup process is finish. to transport to other server, just copy the krs.sql to the directed server, than do:

% mysql krs < krs.sql -u krs_user -p

or see my previous post about mysql.

Thursday, August 23, 2007

installing ldap server

Easy steps to install LDAP Server:

% apt-get install slapd ldap-utils

Towards the end of the installation process you are asked to answer some configurations questions, if you get errors, just skipped the configuration process then use below command to configure it:

% dpkg-reconfigure slapd

Omit OpenLDAP server configuration? ... No
DNS domain name: ... [enter your domain name here, say]
Name of your organization: ... [enter your organization name here]
Admin Password: XXXXX
Confirm Password: XXXXX
choose Berkeley DB --> BDB
Do you want your database to be removed when slapd is purged? ... No
Move old database? ... Yes
Allow LDAPv2 Protocol? ... Yes/No [Depends on your situation]

To test it use:
% ldapsearch -x -b dc=example,dc=com

If you encountered this error message: ldap_bind: Can't contact LDAP server (-1)
it may caused by the ldap server not started yet, so try to start it using:
% /etc/init.d/slapd start

locales problem

During my revisited to my vps, I encountered this error:

perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

After googling, I found out that the problem is with the locales being not installed on the system. In order to install it:

% apt-get install locales
% dpkg-reconfigure locales

just choose everything started with en_US, and choose the default as en_US.
That's it, no more locales error message!

Tuesday, August 21, 2007

sshfs on mac

being maintaning student databases on several servers, I need a simple way to connect to the servers rather than typing ssh command all the time. Actually, I heard the term sshfs several months ago but never tried it. As now I am using a mac, I wanna try sshfs on mac, Uncle google give me this link to download and to get the step by step guide.

It's a little bit easier now, but I need to learn the sshkeychain to automate the process.

Thursday, August 16, 2007

uninstall linux ati driver

There is two way to install linux ati driver, automatic and package generation. Therefore, the uninstallation process depend on the way we install it.

1. Automatic:

% cd /usr/share/ati
# must be done as a root
% sh ./

2. Package generation
If you generate the package, then you install it using the package manager available in your compie, so just uninstall it using that. Simple.

Don't forget to uninstall it before install a new version!

Sunday, August 12, 2007

unrar in ubuntu

sometimes we need to extract a file. zip or tar.gz files could be opened directly in linux, but rar is not supported. to be able extract a rar file, we should install unrar.

% sudo apt-get install unrar

two useful and most used command is

% unrar e your-file-name.rar #--- to extract the rar file in the current directory

% unrar l your-file-name.rar #-- to list the content of the rar file

Friday, August 10, 2007

running iso image from hardisk using grub

sometimes you just wanna try a new linux, but you don't wanna burn it to a cd first, grub can be used to do that. [you need to run these command as root or use sudo in ubuntu]

1. mount the iso:
% mkdir /mnt/iso
% mount -o loop /path-to your-iso/youriso.iso /mnt/iso

2. copy vmlinuz and initrd to the /boot
% cd /mnt/iso/boot
% cp vmlinuz /boot/vmlinuz-yourdistro
% cp initrd.img /boot/initrd-YourDistro.img

3. modify /boot/grub/grub.conf (linked to by /etc/grub.conf)

This assumes that /boot is in the first partition of the first hard drive, usually /dev/hda1

title YourDistro
kernel /vmlinuz-YourDistro
initrd /initrd-YourDistro.img

Now you can reboot your pc and run the live cd.

Wednesday, August 8, 2007

ubuntu: listing and removing packages

To view installed packages by size:
% dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less

When you want to remove packages remember to use purge
% apt-get remove --purge package name

Sunday, August 5, 2007

mac fonts to ttf

I was very interesting in the font used in Eclipse IDE under MacOS, so I was thinking how could I used that font in my web.

After googling, I found out this utility called fondu, I downloaded it the macos version then installed it as usual pkg installation. Little bit confusion after installation. Where was the fondu? Looking around in Application found nothing. But, when typing in terminal it did exist there!

The font used by Eclipse IDE called Monaco.dfont. to transfer to ttf, just type:
% cd /System/Library/Fonts
% sudo fondu -show Monaco.dfont

-show is to see what fonts are created using fondu.
sudo needs as you try to create a new file in the System directory where your user does not allow to do so.

should you want to create .afm, just add -afm flag,
% sudo fondu -show -afm Monaco.dfont

Now, I could embed it to the html/css....[next]

Saturday, August 4, 2007

wifi, how dangerous it is?

I forgot the link where I read it, but just for a precautions, should you connect to the Internet through a wifi connection, you need to be carefull!

Someone has just show how vulnerable is a wifi connection, he can stole your cookies then play it back later to login to your gmail account, or other webmail.

One of the solution is to login through an https, for google