Pages

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, March 12, 2008

ntp time server correction

ntp time server

sudo /etc/init.d/ntp stop
sudo ntpdate time.nist.gov
sudo /etc/init.d/hwclock.sh restart
sudo /etc/init.d/ntp start

Thursday, February 28, 2008

Audio file from video file

$ ffmpeg -vn -acodec copy -i infile.avi outfile.mp3

$ mplayer -vo null -dumpaudio video.avi -dumpfile audio.mp3

Thursday, February 21, 2008

setup clock in linux

$ sudo emacs /etc/ntp.conf

server time.nist.gov
fudge time.nist.gov stratum 10

$ sudo timeconfig
$ sudo dateconfig

Wednesday, February 20, 2008

Linux as the WebDAV Server

Linux as the WebDAV Server:

On Linux, use your favorite package manager to install Apache. Most distributions will use Apache httpd 2.0 which has mod_dav built-in, so the only editing of the httpd.conf file needed are the DAVLockDB and Directory definitions. Note that you can also authenticate against Active Directory or LDAP using the mod_auth_kerb or mod_auth_ldap Apache modules. For this example, we’ll stick with using htpasswd:

$ sudo vi /etc/httpd/conf/http.conf
..
DAVLockDB /var/lib/dav/DAVLockDB

DAV On
AuthName "WebDAV Login"
AuthType Basic
AuthUserFile /etc/httpd/.htpasswd

require valid-user

Order allow,deny
Allow from all


Now create the directories and set permissions:

$ sudo su
# mkdir /usr/local/apache/var
# chown apache:apache /usr/local/apache/var
# mkdir /var/www/html/webdav
# chown www:www /var/www/html/webdav

Finally, on Linux create the user and password file and restart the httpd daemon:

# htpasswd -m -c /etc/httpd/.htpasswd testuser
New password:
Re-type new password:
Adding password for user testuser
# /sbin/service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

Now let’s try it out by connecting some clients!

reference:
http://weblog.bignerdranch.com/?p=18

apache, DocumentRoot must be a directory

You got "DocumentRoot must be a directory" error even it is really a
directory because of SELinux extensions. Run
system-config-securitylevel (or redhat-config-securitylevel) to
disable SELinux for httpd or give SELinux permissions to that
directory:
chcon -R -h -t httpd_sys_content_t /path/to/directory

More help at: http://fedora.redhat.com/docs/selinux-faq-fc3/index.html

reference:
http://www.issociate.de/board/post/186682/DocumentRoot_must_be_a_directory.html

Tuesday, January 22, 2008

Eclipse Java debugging problem

To install proprietary Java, you must have the Multiverse repository enabled.

Ubuntu 7.04

  • Sun Java6: sun-java6-bin, sun-java6-jre

sudo apt-get install sun-java6-bin sun-java6-jre
Now you need to open Eclipse and specify that the default workspace JRE
should be SUNs JRE. Go to Window - Preferences - Java - Installed JREs
and click add to add SUN JRE.
The JRE home directory is: /usr/lib/jvm/java-6-sun

Wednesday, July 25, 2007

Linux UVC Installation

Linux UVC for my web cam

1. install subversion to download UVC source codes
$ sudo apt-get install subversion

2. download UVC sources
$ svn checkout svn://svn.berlios.de/linux-uvc/linux-uvc/trunk

3. before compile the sources
$ sudo apt-get build-essential
$ sudo apt-get kernel-headers

4. go to the Linux UVC directory
$ cd trunk

5. open the Make file in this directory
$ sudo make

6. open Makefile
$ vi Makefile
INSTALL_MOD_DIR := usb/media
to
INSTALL_MOD_DIR := kernel/ubuntu/media/usbvideo

7. make
$ make

8. install
$ sudo make install

Reference:
http://openfacts.berlios.de/index-en.phtml?title=Linux+UVC

Monday, July 23, 2007

Speed up firefox on Ubuntu

about:config

1. network.http.pipelining -> true
2.
network.http.pipelining.maxrequests -> 8
3. network.http.proxy.pipelining -> true
4. network.dns.disableIPv6 -> true
5. plugin.expose_full_path -> true
6. Right click -> New -> Integer: nglayout.initialpaint.delay -> 0
7. Right click -> New -> Integer: content.notify.backoffcount -> 5
8. Right click -> New -> Boolean: content.notify.ontimer -> true
9. Right click -> New -> Integer: ui.submenuDelay -> 0
10. layout.spellcheckDefault -> 2
11. Right click -> New -> Integer: browser.cache.memory.capacity -> 16384
12. Right click -> New -> Integer: content.maxtextrun -> 5000
13. add-on : fasterfox

References:
http://www.ubuntugeek.com/speed-up-firefox-web-browser.html
http://fasterfox.mozdev.org
http://kb.mozillazine.org

Install K3B MAD MP3 codec on Ubuntu

It's very simple now.
Ubuntu 7.04 Feisty

Install K3B MAD MP3 Codec
$ sudo apt-get install libk3b2-mp3

Emulating the XO/Quick Start/Linux

Debian/Ubuntu/Fedora/...

1 - Unpack the image

bzcat olpc-redhat-stream-development-ext3.img.bz2 > laptop.img

2 - Obtain qemu

On Debian/Ubuntu, as root:

apt-get install qemu

On Fedora, as root:

yum install qemu

3 - Run qemu on the image

qemu -soundhw es1370 -serial `tty` -hda laptop.img 

Then see Running for the first time.

4 - (optional, but recommended) Make qemu run faster

If you have an x86 or x86_64 cpu, you can use kqemu to speed up the emulation several 100%.

4 a - Obtain kqemu

On Debian/Ubuntu, as root, do one of:

apt-get install kqemu-modules-2.6-486    # if you have a 486/original Pentium
apt-get install kqemu-modules-2.6-686 # if you have a later Pentium
apt-get install kqemu-modules-2.6-k7 # if you have a 32-bit AMD Duron/Athlon/AthlonXP

Then

apt-get install kqemu-common

to add docs and have it auto-load at boot time.

In Ubuntu 7.04, you'll have to use module-assistant to compile kqemu.

Install the program:

sudo apt-get install module-assistant

Download the kernel headers:

sudo module-assistant prepare kqemu

Download, compile and install the kqemu module package:

sudo module-assistant auto-install kqemu

Due to an open bug in ubuntu's kqemu-source package, you'll need to do the following as well:

sudo nano /etc/modprobe.d/kqemu

Change the contents to be:

options kqemu major=0

Save the file and exit nano. Then do:

sudo nano /etc/udev/rules.d/60-kqemu.rules

Enter this text into the empty file:

KERNEL=="kqemu", NAME="%k", MODE="0666"

Save the file and exit nano.

On Fedora x86,

XXX please fill this in if you know

On Fedora x86_64,

as of 2007-05-13, there are no official rpms for kqemu, or the kqemu kernel module, and they are not included in the qemu rpm. atrpms.net has kqemu rpms. Or install from source.
I was successful using kqemu-1.3.0-2.fc6.i386.rpm and kqemu-kmdl-2.6.20-1.2962.fc6-1.3.0-2.fc6.x86_64.rpm from atrpms on fc6. 2962 is the kernel version (eg, ls /boot/). MitchellNCharity 19:40, 1 July 2007 (EDT)

4 b - Run modprobe

/sbin/modprobe kqemu major=0

This will need to be run again if the host computer is rebooted (unless noted above). If you forget, qemu will be slow again (and a one-line error message scroll by when you run qemu).

4 c - Run a qemu variant with the -kernel-kqemu option

On x86,

qemu -kernel-kqemu ...

On x86_64,

qemu-system-x86_64 -kernel-kqemu ...

If you forget and use just qemu instead, things will be slow again.


Reference: http://wiki.laptop.org/go/Emulating_the_XO/Quick_Start/Linux


Saturday, July 21, 2007

Switch Caps Lock to Ctrl

On Windows XP Professional
It's actually not switch but swap Caps Lock key with Control key on a Windows XP professional version.

1. start -> Run -> regedit
2. Find the Keyboard Layout directory where is in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
3. Click on Edit->New->Binary Value
4. Name it "Scancode Map" without the quotes
5. Right click -> Modify
6. Input the values below
00,00,00,00,00,00,00,00,
03,00,00,00,1d,00,3a,00,
3a,00,1d,00,00,00,00,00

Reference: http://www.usnetizen.com/fix_capslock.html

On Ubuntu 7.04 Feisty
1. create .Xmodmap file in your home directory
$ vi ~/.Xmodmap
2. write down below
! Switch caps lock and left control
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
3. load .Xmodmap file
$ xmodmap ~/.Xmodmap
4. next time you log in to your Gnome, it will detect .Xmodmap file automatically. Thus, next steps are not really necessary.

If ~/.xinitrc doesn't exist
$ cp /etc/X11/xinit/xinitrc ~/.xinitrc
In all cases
$ vi ~/.xinitrc
in the first line,
xmodmap ~/.Xmodmap

References:
http://ubuntuguide.org/wiki/Ubuntu:Feisty#How_to_remap_the_Caps_Lock_key_as_another_Control_key
http://dinomite.net/archives/caps-lock-to-control-on-ubuntu

Monday, July 16, 2007

External Hard Drive Install, Making a File System in Linux

// report file system disk usages
$ df

// low level format, fulfill with zero
# dd if=/dev/zero of=/dev/sdb1

// create or delete the partition
# fdisk /dev/sdb
or # cfdisk /dev/sdb

Remain in fdisk and do the following:
a. You need to add a new partition so type n
b. Make it a primary. Press p
c. Make it the 1st partition. Press 1
d. Use the defaults to create one big hard disk. Press enter twice
e. You need to change the partition's system id so type t
f. To see the list of codes type L
g. To select vfat, W95 Ext'd (LBA), press c
h. Now write the changes to disk. Press w

// Create the file system.
# mkfs.vfat -F 32 -n VolumeName /dev/sdb1