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

Tuesday, December 18, 2012

HowTo - [Gentoo] Apply a patch to sources using ebuild

1. Locate the ebuild file, for example, libdrm-2.4.31.ebuild.

$ ls /usr/portage/x11-libs/libdrm/libdrm-2.4.31.ebuild

2. Digest, fetch, unpack

$ sudo ebuild /usr/portage/x11-libs/libdrm/libdrm-2.4.31.ebuild digest
$ sudo ebuild /usr/portage/x11-libs/libdrm/libdrm-2.4.31.ebuild fetch
$ sudo ebuild /usr/portage/x11-libs/libdrm/libdrm-2.4.31.ebuild unpack

3. The unpacked source file would be in the /tmp folder. You might need to switch to super user to access that folder.


$ sudo su
# cd /var/tmp/portage/x11-libs/libdrm-2.4.31/work/libdrm-2.4.31/
# patch -p1 < patch1.patch
...
# exit

4. Compile, install and qmerge

$ sudo ebuild /usr/portage/x11-libs/libdrm/libdrm-2.4.31.ebuild compile
$ sudo ebuild /usr/portage/x11-libs/libdrm/libdrm-2.4.31.ebuild install
$ sudo ebuild /usr/portage/x11-libs/libdrm/libdrm-2.4.31.ebuild qmerge

The generated executable file will replace the original ones. Patch applying finished. 

Tuesday, September 11, 2012

HowTo - Compile Linux kernel 3.5 under Ubuntu 12.04


1. Dependencies


$ sudo apt-get install gcc libncurses5-dev git-core kernel-package fakeroot build-essential

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


2. Download kernel source


$ wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.5.tar.bz2

$ tar -xvf linux-3.5.tar.bz2

$ cd linux-3.5/


3. Compile


If you want to use your current kernel configuration:

$ cp /boot/config-`uname -r` ./.config

$ make menuconfig

Compile the kernel and modules to be .deb packages so that we can easily install/uninstall them.

$ make-kpkg clean

$ fakeroot make-kpkg --initrd --append-to-version=-spica kernel_image kernel_headers


4. Install


Now you have two .deb packages generated, one is to install the kernel headers, another one is to install the kernel image. 

$ sudo dpkg -i linux-*.deb


5. Reboot


During reboot, choose the new kernel in your grub menu. Once you finish rebooting, check your new kernel information by typing in:

$ uname -r

Thursday, June 14, 2012

HowTo - Using Git behind a Proxy

1. $ sudo aptitude install corkscrew

2. Create a file named “git-proxy” in $HOME/bin director which includes following content:

#!/bin/sh
exec /usr/bin/corkscrew $*

3. $ git config --global core.gitproxy '$HOME/bin/git-proxy'

Wednesday, June 6, 2012

Error: Encountered a section with no Package: header, E:Problem with MergeList


$ sudo rm /var/lib/apt/lists/* -vf

$ sudo apt-get update


HowTo - Installing Ubuntu from External Hard Drive

1. Make a separate partition on your external hard drive. Format it to be FAT32.


2. Set the partition as Active (In storage management)


3. Use universal-usb-installer

4. Boot 

5. Choose boot source. Press F12 if you are using ThinkPad Edge laptop.

6. Install Ubuntu

6.1 Manual partition

6.1.1 Choose a free space

6.2.2 Add a partition for /
6.2.3 Add a partition for swap
6.2.4 Add a partition for /home

7. Reboot


9. Done!

Friday, May 11, 2012

Error: No grub Menu after Installing Ubuntu


sudo update-grub

If that doesn't solve the problem, run sudo grub-install /dev/sda (if you get an error, replace sda with hda), and then run sudo update-grub


http://askubuntu.com/questions/127666/no-grub-menu-for-11-10-and-12-04lts

Tuesday, April 3, 2012

HowTo - ssh, sftp, scp

Download from remote server:
$ sftp username@server.com
$ get filename


Upload to remote server: *
$ sudo scp filename username@server.com

SCP a file to Duke CS my home directory
$ sudo scp filename username@server.com:~/
(Don't forget the ~)






* You might have this error:

Error: scp permission denied

Solution:

Step 1. Don't panic.

Step 2. Use sudo before scp.

Step 3. Make sure the remote file folder's permission mode is okay such as:

$ sudo chmod 777 -R filefolder/
Step 4. Problem Solved.

http://support.cs.utah.edu/index.php?option=com_content&view=article&id=33&Itemid=59
http://www.cs.duke.edu/courses/fall10/cps216/TA_Material/git.txt

Sunday, February 26, 2012

Do Not - Ban lo

Don't ban lo in the /etc/network/interfaces

lo - local host

otherwise NFS won't work.

Tuesday, November 22, 2011

HowTo - NFS


Installation




Setting up IP addresses



# ifconfig eth0 192.168.0.x

Server : 192.168.0.8

Client1: 192.168.0.7


Server


1. Install the nfs-kernel-server packet

I used synaptic package manager in Ubuntu 10.04 to install it.


2. Change
/etc/exports file [1]

/home/synrg/server 192.168.0.7(rw,no_root_squash,async)

I also changed /etc/hosts.allow file for permission concern (I don't know whether it is necessary.)

portmap:ALL

3. Start nfs server
You might need to stop and start again if it's already running.

# bash /etc/init.d/nfs-kernel-server start

Client


1. Mount from server
# mount 192.168.0.8:/home/synrg/server /mnt/synrg/

Files written into /mnt/synrg folder on the client machine will simultaneously transferred to the /home/synrg/server folder on the server machine.

References


[1]http://nfs.sourceforge.net/nfs-howto/ar01s03.html

Wednesday, November 16, 2011

HowTo - TCPDump


Installation[1]




# git clone git://bpf.tcpdump.org/tcpdump                                                                         

Configurations [3]


Change into monitor mode [4]

First
wlanconfig ath0 destroy
And then to create an interface (called ath0) in monitor mode, issue the command:
wlanconfig ath0 create wlandev wifi0 wlanmode monitor
To finish bring the interface up
ifconfig ath0 up

By default, monitor mode receives packets with prism2 headers prepended on them. To change this, you must run one of the following:
  • Only 802.11 headers: echo '801' > /proc/sys/net/ath0/dev_type
  • Prism2 headers: echo '802' > /proc/sys/net/ath0/dev_type
  • Radiotap headers: echo '803' > /proc/sys/net/ath0/dev_type
  • Atheros Descriptors: echo '804' > /proc/sys/net/ath0/dev_type

Command



Capture packets from a particular ethernet interface 


# tcpdump -i ath0 -w file -y IEEE802_11_RADIO
                                                                                       

-i: interface
-y: radiotap header
-w: write into files


Whole package viewing[5]



# tcpdump -nnvvXSs 1514

// the final "s" increases the snaplength, grabbing the whole packet

References


[1] http://www.tcpdump.org/#source
[3] http://www.thegeekstuff.com/2010/08/tcpdump-command-examples/
[4] http://madwifi-project.org/wiki/UserDocs/MonitorModeInterface