2.1.2.1. Cài thư viện flex.
Để biên dịch libpcap thành công ta cần cài thư viện hỗ trợ flex. Ta tiến hành tải flex về và cài đặt theo link:
http://biznetnetworks.dl.sourceforge.net/sourceforge/flex/flex-2.5.35.tar.gz. Tiến hành cài đặt theo các bước sau:
- Tải flex về máy:
root@Ubuntu:/home/chau/Desktop/Install#
wget http://biznetworks.dl.sourceforge.net/sourceforge /flex/flex- 2.5.35.tar.gz
- Copy file flex vào thư mục cài đặt.
root@Ubuntu:/home/chau/Desktop/Install# cp flex-2.5.35.tar.gz /usr/local/
- Cd đến thư mục cài đặt:
root@Ubuntu:/home/chau/Desktop/Install# cd /usr/local
- Giải nén flex:
root@Ubuntu:/usr/local# tar -xvzf flex-2.5.35.tar.gz
- Cd đến flex-2.5.35
root@Ubuntu:/usr/local# cd flex-2.5.35
- Cấu hình, biên dịch và cài đặt flex
root@Ubuntu:/usr/local/flex-2.5.35# ./configure
root@Ubuntu:/usr/local/flex-2.5.35# make && make install
2.1.2.2. Cài thư viện Bison:
Ta thực hiện các bước tương tự như cài flex.
root@Ubuntu:/home/chau/Desktop/Install#
wget http://ftp.gnu.org/gnu/bison/bison-2.4.1.tar.gz
root@Ubuntu:/home/chau/Desktop/Install# cp bison-2.4.1.tar.gz /usr/local/ root@Ubuntu:/home/chau/Desktop/Install# cd /usr/local
root@Ubuntu:/usr/local # tar -xvzf bison-2.4.1.tar.gz root@Ubuntu:/usr/local # cd bison-2.4.1
root@Ubuntu:/usr/local/bison-2.4.1# ./configure
root@Ubuntu:/usr/local/bison-2.4.1# make && make install
2.1.2.3. Cài libpcap
Cài libpcap từ source: http://www.tcpdump.org/release/libpcap-1.0.0.tar.gz
root@ubuntu:/home/chau/Desktop/Install#
wget http://www.tcpdump.org/release/libpcap-1.0.0.tar.gz
root@ubuntu:/home/chau/Desktop/Install # cp libpcap-1.0.0.tar.gz /usr/local/
root@Ubuntu:/home/chau/Desktop/Install# cd /usr/local root@Ubuntu:/usr/local# tar -xvzf libpcap-1.0.0.tar.gz root@Ubuntu:/usr/local# cd libpcap-1.0.0
root@Ubuntu:/usr/local/libpcap-1.0.0# ./confugure
root@Ubuntu:/usr/local/libpcap-1.0.0# make && make install
2.1.2.4. Cài đặt pcre
root@ubuntu:/home/chau/Desktop/Install#
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre- 7.9.tar.gz
root@ubuntu:/home/chau/Desktop/Install # cp pcre-7.9.tar.gz /usr/local/ root@Ubuntu:/home/chau/Desktop/Install# cd /usr/local
root@Ubuntu:/usr/local# tar -xvzf pcre-7.9.tar.gz root@Ubuntu:/usr/local# cd pcre-7.9
root@Ubuntu:/usr/local/pcre-7.9# ./configure
root@Ubuntu:/usr/loca/pcre-7.9l# make && make install
2.1.2.5. Cài Libnet :
root@Ubuntu:/home/chau/Desktop/Install#
wget ftp://64.50.238.52/.1/gentoo/distfiles/libnet-1.1.2.1.tar.gz
root@ubuntu:/home/chau/Desktop/Install # cp libnet-1.1.2.1.tar.gz /usr/local/ root@Ubuntu:/home/chau.Desktop/Instal# cd /usr/local/
root@Ubuntu:/usr/local# cd libnet
root@Ubuntu:/usr/local/ libnet# ./configure
root@Ubuntu:/usr/local/ libnet# make && make install