STEP 1. PHP 설치를 한다.


[root@localhost download]# tar xvfz php-5.6.16.tar.gz 

..... 중략 .....

php-5.6.16/EXTENSIONS

php-5.6.16/README.namespaces

php-5.6.16/pear/

php-5.6.16/pear/install-pear.txt

php-5.6.16/pear/install-pear-nozlib.phar

php-5.6.16/pear/fetch.php

php-5.6.16/pear/Makefile.frag

php-5.6.16/README.SUBMITTING_PATCH

[root@localhost download]# 

[root@localhost download]# cd php-5.6.16
[root@localhost php-5.6.16]# 


[root@localhost php-5.6.16]# ./configure --prefix=/usr/local/server/php --with-apxs2=/usr/local/server/apache/bin/apxs --with-mysql=/usr/local/server/mysql --with-config-file-path=/usr/local/server/apache/conf --disable-debug --enable-safe-mode --enable-track-vars --enable-sockets --with-mod_charset --with-charset=utf8 --with-xml --with-language=korean --enable-mailparse --enable-calender --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-url-includes --enable-trans-id --enable-inline-optimization --enable-bcmath --with-jpeg --with-png --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring
..... 중략 .....

checking libxml2 install dir... /usr

checking for xml2-config path... 

configure: error: xml2-config not found. Please check your libxml2 installation.

[root@localhost php-5.6.16]# 

[root@localhost php-5.6.16]# 

[root@localhost php-5.6.16]# 

[root@localhost php-5.6.16]# 

[root@localhost php-5.6.16]# yum -y install xml2-config

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: mirror.premi.st

 * extras: mirror.premi.st

 * updates: mirror.premi.st

No package xml2-config available.

Error: Nothing to do

[root@localhost php-5.6.16]# yum -y install xml2

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: mirror.premi.st

 * extras: mirror.premi.st

 * updates: mirror.premi.st

No package xml2 available.

Error: Nothing to do

[root@localhost php-5.6.16]# 





STEP 2. libxml2, libxml2-devel을 설치한다.

[root@localhost php-5.6.16]# yum -y install libxml2 libxml2-devel

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: mirror.premi.st

 * extras: mirror.premi.st

 * updates: mirror.premi.st

Resolving Dependencies

--> Running transaction check

---> Package libxml2.x86_64 0:2.7.6-14.el6_5.2 will be updated

--> Processing Dependency: libxml2 = 2.7.6-14.el6_5.2 for package: libxml2-python-2.7.6-14.el6_5.2.x86_64

---> Package libxml2.x86_64 0:2.7.6-20.el6_7.1 will be an update

---> Package libxml2-devel.x86_64 0:2.7.6-20.el6_7.1 will be installed

--> Running transaction check

---> Package libxml2-python.x86_64 0:2.7.6-14.el6_5.2 will be updated

---> Package libxml2-python.x86_64 0:2.7.6-20.el6_7.1 will be an update

--> Finished Dependency Resolution


Dependencies Resolved


=====================================================================================================================

 Package                       Arch                  Version                            Repository              Size

=====================================================================================================================

Installing:

 libxml2-devel                 x86_64                2.7.6-20.el6_7.1                   updates                1.1 M

Updating:

 libxml2                       x86_64                2.7.6-20.el6_7.1                   updates                803 k

Updating for dependencies:

 libxml2-python                x86_64                2.7.6-20.el6_7.1                   updates                323 k


Transaction Summary

=====================================================================================================================

Install       1 Package(s)

Upgrade       2 Package(s)


Total download size: 2.2 M

Downloading Packages:

(1/3): libxml2-2.7.6-20.el6_7.1.x86_64.rpm                                                    | 803 kB     00:00     

(2/3): libxml2-devel-2.7.6-20.el6_7.1.x86_64.rpm                                              | 1.1 MB     00:00     

(3/3): libxml2-python-2.7.6-20.el6_7.1.x86_64.rpm                                             | 323 kB     00:00     

---------------------------------------------------------------------------------------------------------------------

Total                                                                                1.0 MB/s | 2.2 MB     00:02     

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Updating   : libxml2-2.7.6-20.el6_7.1.x86_64                                                                   1/5 

  Updating   : libxml2-python-2.7.6-20.el6_7.1.x86_64                                                            2/5 

  Installing : libxml2-devel-2.7.6-20.el6_7.1.x86_64                                                             3/5 

  Cleanup    : libxml2-python-2.7.6-14.el6_5.2.x86_64                                                            4/5 

  Cleanup    : libxml2-2.7.6-14.el6_5.2.x86_64                                                                   5/5 

  Verifying  : libxml2-python-2.7.6-20.el6_7.1.x86_64                                                            1/5 

  Verifying  : libxml2-2.7.6-20.el6_7.1.x86_64                                                                   2/5 

  Verifying  : libxml2-devel-2.7.6-20.el6_7.1.x86_64                                                             3/5 

  Verifying  : libxml2-2.7.6-14.el6_5.2.x86_64                                                                   4/5 

  Verifying  : libxml2-python-2.7.6-14.el6_5.2.x86_64                                                            5/5 


Installed:

  libxml2-devel.x86_64 0:2.7.6-20.el6_7.1                                                                            


Updated:

  libxml2.x86_64 0:2.7.6-20.el6_7.1                                                                                  


Dependency Updated:

  libxml2-python.x86_64 0:2.7.6-20.el6_7.1                                                                           


Complete!

[root@localhost php-5.6.16]# 










저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.






CentOS 6.6에서 openssl 버전이 낮아 yum update를 했는데 안된다.

그래서 직접 소스를 다운 받아 컴파일하는 방법을 작성한다.




STEP 1. OpenSSL 사이트(https://www.openssl.org/)로 이동한다.


1> Downloads를 클릭한다.




2> 아래로 스크롤을 내린다.




3> openssl-1.0.2e.tar.gz에서 마우스 우클릭으로 속성을 클릭한다.



4>주소 URL을 복사한다.

복사 된 링크 값 ( https://www.openssl.org/source/openssl-1.0.2e.tar.gz )






STEP 2. OpenSSL 다운 받아 설치한다.


[root@localhost download]# wget https://www.openssl.org/source/openssl-1.0.2e.tar.gz

--2016-01-03 23:06:27--  https://www.openssl.org/source/openssl-1.0.2e.tar.gz

Resolving www.openssl.org... 194.97.150.234, 2001:608:c00:180::1:ea

Connecting to www.openssl.org|194.97.150.234|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 5256555 (5.0M) [application/x-gzip]

Saving to: “openssl-1.0.2e.tar.gz”


100%[===========================================================================>] 5,256,555    978K/s   in 5.3s    


2016-01-03 23:06:38 (978 KB/s) - “openssl-1.0.2e.tar.gz” saved [5256555/5256555]


[root@localhost download]# 



[root@localhost download]# tar xvfz openssl-1.0.2e.tar.gz 

..... 중략 .....
openssl-1.0.2e/VMS/ucx_shr_decc_log.opt
openssl-1.0.2e/VMS/ucx_shr_decc.opt
openssl-1.0.2e/VMS/ucx_shr_vaxc.opt
openssl-1.0.2e/VMS/VMSify-conf.pl
openssl-1.0.2e/VMS/WISHLIST.TXT
openssl-1.0.2e/test/bctest
openssl-1.0.2e/util/pod2mantest
[root@localhost download]# 
[root@localhost download]# cd openssl-1.0.2e
[root@localhost openssl-1.0.2e]# 


[root@localhost openssl-1.0.2e]# ./config --prefix=/usr --openssldir=/usr/local/openssl shared
..... 중략 .....
make[1]: Leaving directory `/download/openssl-1.0.2e/tools'
generating dummy tests (if needed)...
make[1]: Entering directory `/download/openssl-1.0.2e/test'
md2test.c => dummytest.c
rc5test.c => dummytest.c
jpaketest.c => dummytest.c
make[1]: Leaving directory `/download/openssl-1.0.2e/test'

Configured for linux-x86_64.
[root@localhost openssl-1.0.2e]# 


[root@localhost openssl-1.0.2e]# make
..... 중략 .....
make[2]: Leaving directory `/download/openssl-1.0.2e/test'
gcc -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM   -c -o dummytest.o dummytest.c
make[2]: Entering directory `/download/openssl-1.0.2e/test'
make[2]: Leaving directory `/download/openssl-1.0.2e/test'
make[1]: Leaving directory `/download/openssl-1.0.2e/test'
making all in tools...
make[1]: Entering directory `/download/openssl-1.0.2e/tools'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/download/openssl-1.0.2e/tools'
[root@localhost openssl-1.0.2e]# 


[root@localhost openssl-1.0.2e]# make install
..... 중략 .....
make[1]: Entering directory `/usr/lib64'
make[2]: Entering directory `/usr/lib64'
make[2]: Leaving directory `/usr/lib64'
make[2]: Entering directory `/usr/lib64'
make[2]: Leaving directory `/usr/lib64'
make[1]: Leaving directory `/usr/lib64'
cp libcrypto.pc /usr/lib64/pkgconfig
chmod 644 /usr/lib64/pkgconfig/libcrypto.pc
cp libssl.pc /usr/lib64/pkgconfig
chmod 644 /usr/lib64/pkgconfig/libssl.pc
cp openssl.pc /usr/lib64/pkgconfig
chmod 644 /usr/lib64/pkgconfig/openssl.pc
[root@localhost openssl-1.0.2e]# 


[root@localhost openssl-1.0.2e]# openssl version
OpenSSL 1.0.2e 3 Dec 2015
[root@localhost openssl-1.0.2e]# 

 

 ./config를 하면 /usr/local/ssl로 설치되고, /usr/local/ssl/bin/openssl 로 설치 된다.

 openssl 를 /usr/bin에 덮어쓰기 위해서 --prefix=/usr 옵션을 준 것이다.

 




저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.






APM(Apache, PHP, MySQL)을 다운받을 때 경로를 모르는 경우 받는 방법에 대해 설명하겠다.



STEP 1. Apache 사이트(http://httpd.apache.org/)로 이동한다.


1> From a Mirror 클릭한다.



2> 2.4.18에서 마우스 우클릭으로 속성을 클릭한다.




3> 주소 URL을 복사한다.

복사 된 링크 값 ( https://httpd.apache.org/download.cgi#apache24 )






STEP 2. Apache 사이트(http://apr.apache.org/download.cgi)로 이동한다.


1> apr-1.5.2.tar.gz에서 마우스 우클릭으로 속성을 클릭한다.




2> 주소 URL을 복사한다.

복사 된 링크 값 ( http://apache.mirror.cdnetworks.com//apr/apr-1.5.2.tar.gz )






3> apt-util-1.5.4.tar.gz에서 마우스 우클릭으로 속성을 클릭한다.




4> 주소 URL을 복사한다.

복사 된 링크 값 ( http://apache.mirror.cdnetworks.com//apr/apr-util-1.5.4.tar.gz )






STEP 3. pcre 사이트(http://pcre.org/)로 이동한다.


1>  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/를 클릭한다.




2> pcre-8.37.tar.gz에서 마우스 우클릭으로 속성을 클릭한다.




3> 주소 URL을 복사한다.

복사 된 링크 값 ( ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz )






STEP 4. PHP 사이트(http://php.net/)로 이동한다.


1> Downloads를 클릭한다.




2> php-5.6.16.tar.gz를 클릭한다.




3> 스크롤을 아래로 내려서 한국을 찾는다.




4> kr1.php.net에서 마우스 우클릭으로 속성을 클릭한다.



5> 주소 URL을 복사한다.

복사 된 링크 값 ( http://pa1.php.net/get/php-5.6.16.tar.gz/from/this/mirror )





STEP 5. MySQL 사이트(http://dev.mysql.com/)로 이동한다.


1> Downloads를 클릭한다.




2> Community를 클릭한다.




3> DOWNLOAD를 클릭한다.




4> 스크롤을 아래로 내려서 플랫폼 체크박스를 찾는다.




5> Windows 플랫폼을 Source Code로 바꾼다.




6> CentOS 6.6 x64를 설치했으므로, 64비트 Download를 클릭한다.




7> 스크롤을 아래로 내린다.



8> No thanks, just start my download에서 마우스 우클릭으로 속성을 클릭한다.




9> 주소 URL을 복사한다.

복사 된 링크 값 ( http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz )




저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.






웹서버를 운영하는데 DOS 공격을 할 위험이 있는 서버인 경우에는 mod_evasive를 설치하면 좋다.




1. mod_evasive 파일을 다운로드 한다.

[root@mrtg mod_evasive]# wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz
[root@mrtg rrdbuild]# tar xvfz mod_evasive_1.10.1.tar.gz
mod_evasive/
mod_evasive/.cvsignore
mod_evasive/LICENSE
mod_evasive/Makefile.tmpl
mod_evasive/README
mod_evasive/mod_evasive.c
mod_evasive/mod_evasive20.c
mod_evasive/mod_evasiveNSAPI.c
mod_evasive/test.pl
mod_evasive/CHANGELOG
[root@mrtg rrdbuild]# cd mod_evasive
[root@mrtg mod_evasive]# ll
total 104
-rw-r--r-- 1 root root  1373 Oct  9  2005 CHANGELOG
-rw-r--r-- 1 root root 18103 Aug 31  2003 LICENSE
-rw-r--r-- 1 root root   470 Oct  9  2005 Makefile.tmpl
-rw-r--r-- 1 root root 14269 Oct  9  2005 README
-rw-r--r-- 1 root root 19395 Oct  9  2005 mod_evasive.c
-rw-r--r-- 1 root root 18242 Oct  9  2005 mod_evasive20.c
-rw-r--r-- 1 root root 15621 Oct  9  2005 mod_evasiveNSAPI.c
-rw-r--r-- 1 root root   406 Aug 31  2003 test.pl
[root@mrtg mod_evasive]# /usr/local/apache/bin/apxs -iac mod_evasive20.c



2. mod_evasive를 설치한다.

[root@mrtg mod_evasive]# /usr/local/apache/bin/apxs -iac mod_evasive20.c
/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -O3  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/local/apache/include  -I/usr/local/apache/include   -I/usr/local/apache/include   -c -o mod_evasive20.lo mod_evasive20.c && touch mod_evasive20.slo
/usr/local/apache/build/libtool --silent --mode=link gcc -o mod_evasive20.la  -rpath /usr/local/apache/modules -module -avoid-version    mod_evasive20.lo
/usr/local/apache/build/instdso.sh SH_LIBTOOL='/usr/local/apache/build/libtool' mod_evasive20.la /usr/local/apache/modules
/usr/local/apache/build/libtool --mode=install cp mod_evasive20.la /usr/local/apache/modules/
cp .libs/mod_evasive20.so /usr/local/apache/modules/mod_evasive20.so
cp .libs/mod_evasive20.lai /usr/local/apache/modules/mod_evasive20.la
cp .libs/mod_evasive20.a /usr/local/apache/modules/mod_evasive20.a
chmod 644 /usr/local/apache/modules/mod_evasive20.a
ranlib /usr/local/apache/modules/mod_evasive20.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/apache/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/apache/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/apache/modules/mod_evasive20.so
[activating module `evasive20' in /usr/local/apache/conf/httpd.conf]
[root@mrtg mod_evasive]#



3. httpd.conf에 LoadModule evasive20_module   modules/mod_evasive20.so 가 추가 되었는지 확인한다.

[root@mrtg mod_evasive]# vi /usr/local/apache/conf/httpd.conf
............. 생략 ..............
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module        modules/libphp5.so
LoadModule evasive20_module   modules/mod_evasive20.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
............. 생략 ....................





이 모듈을 사용하기 위해서 httpd.conf의 가장 아래부분에 아래와 같이 추가한다.

............. 생략 ....................
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

<IfModule mod_evasive20.c>
DOSHashTableSize        3097
DOSPageCount            5
DOSSiteCount            50
DOSPageInterval         1
DOSSiteInterval         1
DOSBlockingPeriod       60
</IfModule>


DOSHashTableSize는 수치가 높으면 더 좋지만 테이블스페이스에 메모리를 남기게 된다.
DOSPageCount는 같은 페이지를 요청에 대한 카운트 수이다. 지정한 값을 초과하면 해당 IP가 블러킹되고 블럭킹 된 시간동안 403(Forbidden) 에러를 출력한다.
DOSSiteCount 동시에 접속하여 같은 페이지를 볼 수 있는 숫자이다.
DOSPageInterval 페이지 카운트 시발점이다.
DOSSiteInterval 사이트 카운트의 시발점이다.
DOSBlocingPeriod 블럭킹 된 IP는 30초 동안 접속을 할 수 없다. 403(Forbidden) 에러를 출력해준다.



4. 테스트를 해 본다.

파일에서 제공하는 test.pl을 실행 시켜본다.

[root@mrtg mod_evasive]# perl test.pl
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
........... 생략 ..............
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
[root@mrtg mod_evasive]#

구동 중인 웹서버를 재시작하여 mod_evasive가 적용되게 한 후 다시 테스트 한다.

[root@mrtg mod_evasive]# /usr/local/apache/bin/apachectl restart
[root@mrtg mod_evasive]# perl test.pl
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
........... 생략 ................
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
[root@mrtg mod_evasive]#


웹서버에서 새로고침(F5)을 반복 하면 아래와 같은 에러 메시지를 확인 할 수 있다.




저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License

'Linux tools > mod_evasive' 카테고리의 다른 글

DOS공격 방어(mod_evasive) 설치하기  (0) 2010.10.27
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.







1. http://celltwo.tistory.com/99 게시글을 확인하면 VNC를 설치하는 법에 대해서 올려두었다.

기본적으로 VNC를 설치하고, 추가로 생성한 계정 openflow에 대해서 추가로 VNC에 접속이 가능하게 할 것이다.



2. SSH 프로그램을 이용하여 vnctest 계정으로 로그인 한다.
Last login: Tue Aug 31 15:37:47 2010 from 192.168.10.20

[openflow@Server ~]$



3. VNC 관련 서비스를 사용하기 위해서 해당 계정에 /home/vnctest/.vnc/ 가 생성이 되도록 VNC를 구동시킨다.

[openflow@Server ~]$  vncserver
 

You will require a password to access your desktops.

Password:
Verify:

New 'NetFPGA3:1 (openflow)' desktop is NetFPGA3:1

 

Creating default startup script /home/openflow/.vnc/xstartup
Starting applications specified in /home/openflow/.vnc/xstartup
Log file is /home/openflow/.vnc/NetFPGA3:1.log

[openflow@Server ~]$




4. root 계정의 Display를 설정 할 때 처럼 X윈도에서 xinitrc 파일을 복사 해왔듯이 openflow 계정 역시 xstartup 파일을 복사한다.

[openflow@Server ~]$ cd .vnc/
[openflow@Server ~]$ mv xstartup xstartup.old
[openflow@Server ~]$ cp /etc/X11/xinit/xinitrc xstartup
[openflow@Server ~]$




5. 기존에 실행중인 VNCSERVER가 있을 수 있으니 강제로 종료한다.

[openflow@Server ~]$ vncserver -kill :1
Killing Xvnc process ID 5732
[openflow@Server ~]$



6. 슈퍼유저(root) 권한으로 VNCSERVER 관련 옵션을 수정한다.

[root@Server ~]# vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html.
 
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
 
# Use "-nohttpd" to prevent web-based VNC clients connecting.
 
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
 
VNCSERVERS="1:root 2:openflow"
VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp -nohttpd"
VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -nohttpd"



7. 5900 포트 이후부터 1씩 증가하여 열어준 방화벽에 5902 포트를 열어준다.
5901 포트는 root, 5902 포트는 openflow 계정으로 접속하게 된다.

[root@Server ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 5902 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 5902 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5001 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT


방화벽에 5901, 5902가 추가가 되었다면 방화벽을 재시작 한다.
(5901의 경우 앞의 게시글에서 추가하였기 때문에 실질적으로 5902 포트만 추가하여준다.)

[root@Server ~]# /etc/init.d/iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: nat filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_netbios_n[ OK ]
[root@Server ~]#



8. root 계정과 openflow 계정으로 vnc 접속이 가능하게 되었다.
먼저 root 계정으로 접속을 해본다.



위와 같이 root 계정으로 접속을 한 화면을 확인 할 수 있다.



이제 openflow 계정으로 접속을 하도록 한다.







9. 위와 같은 방법으로 추가 계정을 생성하고, VNCviewer를 이용하여 각 계정마다 접속 할 수 있게 설정 할 수 있다.
내가 설치하는 서버에서 VNC를 설치 할 필요가 있어서 정리하고 올린 글이다.

리눅스가 재부팅되면 VNCSERVER는 기본적으로 구동되지 않는다.


VNCSERVER 구동 하는 법

[root@Server ~]# /etc/init.d/vncserver start
Starting VNC server: 1:root
New 'Server:1 (root)' desktop is Server:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/Server:1.log

2:openflow
New 'Server:2 (openflow)' desktop is NetFPGA3:2

Starting applications specified in /home/openflow/.vnc/xstartup
Log file is /home/openflow/.vnc/Server:2.log

                                                           [  OK  ]
[root@Server ~]#



VNCSERVER 정지 하는 법

[root@Server ~]# /etc/init.d/vncserver stop
Shutting down VNC server: 1:root 2:openflow                [  OK  ]
[root@Server ~]#



VNCSERVER 재시작 하는 법

[root@Server ~]# /etc/init.d/vncserver restart
Shutting down VNC server: 1:root 2:openflow                [  OK  ]
Starting VNC server: 1:root
New 'Server:1 (root)' desktop is Server:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/Server:1.log

2:openflow
New 'Server:2 (openflow)' desktop is Server:2

Starting applications specified in /home/openflow/.vnc/xstartup
Log file is /home/openflow/.vnc/Server:2.log

                                                           [  OK  ]
[root@Server ~]#



10. setup 명령어로 서비스를 추가하면, 부팅과 동시에 VNCSERVER가 구동되기 때문에 따로 명령어를 주지 않아도 되는 편리한 점이 있다.

SSH 프로그램이나 VNCSERVER에 root 계정으로 접속하여 setup 명령을 주면 되는데, VNCSERVER에 터미널 창을 열어주고 setup 명령어를 실행하면 아래와 같은 메뉴를 볼 수 있다.

System services 메뉴를 들어 간다.



vncserver 항목을 스페이스바를 눌러 체크한다.
(체크가 되면 *를 표시하게 되며, TAB 키를 이용하여 Ok에서 엔터키를 입력한다)



Quit에서 엔터를 치면 터미널창으로 돌아가게된다.
이후부터 서버가 재부팅 되더라도 VNCSERVER를 시작하지 않더라도 VNC 접속이 가능하게 된다.
저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.







1. VNC 서버가 설치되었는지 확인한다.

[root@Server ~]# rpm -qa vnc
vnc-4.1.2-14.el5_5.4
[root@Server ~]#




2. VNC 사용자를 설정한다.

[root@Server ~]# vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# <
URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"


아래와 같이 계정을 추가한다.

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# <
URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp -nohttpd"


vncservers 파일은 기본 내용이 들어있으며 입맛에 맞게 설정을 하면 된다.
기본적으로 X윈도가 0번 화면을 사용하므로 0번이 아닌 다른 번호를 사용해야 에러 없이 사용이 가능하다.
0번으로 설정하면 로컬에서 X윈도를 사용할 수 없게되어 1번을 사용하면서 다른 프로그램에 영향을 줄 수 있으므로 1번 설정을 한다.

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp -nohttpd"


# 으로 된 주석을 지우거나 새로 추가하면 된다.
VNCSERVERS="1:root"와 VNCSERVERARGS[1]는 동일한 숫자를 넣어주었으며 0번보다 큰 숫자를 입력하였다.

-localhost 역시 삭제하였는데 로컬에서만 접속하는 옵션이므로, 원격 제어를 가능하게 하기 위해서 삭제하였다.

마지막으로 800x600의 해상도에서 1024x768으로 변경하였다.




3. 방화벽에 VNC를 추가하여 준다.

VNC의 포트번호는 5900번이며 X윈도 화면번호를 더해준 값이 실제로 사용하는 포트 번호이다.
위에서 설정한 것을 바탕으로 5900번에 1번을 더한 5901번으로 설정하면 된다.

[root@Server ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6633 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 6633 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT


아래와 같이 추가한다.

# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 5901 -j ACCEPT

-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 5001 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6633 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 6633 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT


방화벽을 다시 시작하여 추가한 포트가 열리도록 한다. 
[root@Server ~]# service iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]

[root@Server ~]#




4. VNC를 접속 할 때 사용할 패스워드를 설정한다.

[root@Server ~]# vncpasswd
Password:
Verify:

[root@Server ~]#




5. VNC 서버를 가동한다.

VNC가 동작하고 있는지 확인을 하고, 동작하지 않는다면 실행시킨다.
[root@Server ~]# service vncserver status
Xvnc is stopped
[root@Server ~]#

동작하지 않으므로, 아래와 같은 명령으로 동작 시킨다.
[root@Server ~]# service vncserver start
Starting VNC server: 1:root xauth:  creating new authority file /root/.Xauthority

New 'Server:1 (root)' desktop is Server:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/Server:1.log

                                                           [  OK  ]
[root@Server ~]#

정상적으로 동작하고 있는지 다시 확인한다.
[root@Server ~]# service vncserver status
Xvnc (pid 14733) is running...
[root@Server ~]#




6. VNC 서버가 제대로 동작하고 있는지 접속하여 확인한다.


VNC Viewer를 이용하여 접속을 하는데 Server라고 된 부분에 해당 서버의 주소를 입력하고, :5901은 위에서 설명한대로 VNC가 사용 할 포트번호이다.



위에서 설정한 패스워드를 입력하여 VNC에 접속을 한다.


위와 같은 기본 X윈도의 화면을 출력할 것이다.
설정이 전혀 되어있지 않으므로 원격제어를 하기 위한 화면과 다소 거리가 멀다.




7. 원격으로 접속 할 때 X윈도를 로컬에서 보듯이 변경하는 설정을 한다.

[root@Server ~]# pwd
/root
[root@Server ~]# cd .vnc/
[root@Server .vnc]# mv xstartup xstartup.old
[root@Server .vnc]# cp /etc/X11/xinit/xinitrc xstartup
[root@Server .vnc]# service vncserver restart
Shutting down VNC server: 1:root                           [  OK  ]
Starting VNC server: 1:root
New 'Server:1 (root)' desktop is Server:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/Server:1.log

                                                           [  OK  ]
[root@Server .vnc]#

홈디렉토리( /root )를 확인하고 .vnc 디렉토리에 있는 xstartup 이라는 설정 관련 내용을 로컬 서버의 X윈도에서 사용되는 xinitrc 파일을 복사하는 과정이다. VNC 서비스를 재시작하여 바뀐 설정을 불러온다.




8. VNCviewer를 이용하여 서버에 다시 접속한다.

위 그림과 같이 로컬에서 보는 화면과 동일한 화면으로 로컬 서버를 제어 할 수 있다.



저작자 표시 비영리 변경 금지
크리에이티브 커먼즈 라이선스
Creative Commons License
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.






DokuWiki는 사용자들에게 보다 다양한 문서 저장소를 구성할 수 있게 도와주는 위키이며 표준을 준수하여 사용하기 쉽다.

DokuWiki는 데이터 자료가 위키 외부에서 구조화되고, 읽을 수 있는 형태로 나타나도록 보장하며 간단하고 강력한 문법을 사용해 개인이나 팀 구성원, 회사 등이 해당 자료를 쉽게 이용할 수 있는 환경을 제공한다.

무제한적인 페이지 생성은 페이지 초기 혹은 특정 버전으로 복원을 할 수 있고, 이 때 데이터베이스가 필요하지 않는 텍스트 파일에 저장된 데이터도 함께 복원된다. 강력한 plugin을 활용하면 DokuWiki의 코어 시스템을 확장하거나 강화 할 수 있다.

DokuWiki의 보다 자세한 설명은 http://www.dokuwiki.org/ko:dokuwiki 사이트를 참조하기 바란다.




설치환경

OS : CentOS 5.4 i386
Web : Apache2
CGG : gcc version 4.1.2
Perl : 5.8.8



STEP 1.

CentOS 5.4의 설치는 다른 카테고리에 있으므로 설치 과정은 생략한다.
DokuWiki설치에 필요한 파일 등을 다운 받을 디렉토리(download)를 생성하고, 웹서버인 Apache를 설치하기로 한다.

[root@wiki ~]# cd /usr/local/
[root@wiki local]# mkdir download
[root@wiki local]# cd download


PHP를 설치 할 때 사용할 libjpeg, libpng, freetype의 라이브러리를 yum을 통해 업데이트 한다.

[root@wiki download]# yum -y install libjpeg-devel libpng-devel freetype-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: data.nicehosting.co.kr
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * updates: data.nicehosting.co.kr
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libjpeg-devel.i386 0:6b-37 set to be updated
---> Package libpng-devel.i386 2:1.2.10-7.1.el5_3.2 set to be updated
---> Package freetype-devel.i386 0:2.2.1-21.el5_3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================
 Package                            Arch                        Version                                      Repository                     Size
=============================================================================================================
Installing:
 libjpeg-devel                      i386                          6b-37                                           base                          105 k
 libpng-devel                       i386                   2:1.2.10-7.1.el5_3.2                               base                          181 k
 freetype-devel                    i386                      2.2.1-21.el5_3                                    base                          146 k

Transaction Summary
=============================================================================================================
Install      3 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 433 k
Downloading Packages:
(1/3): libjpeg-devel-6b-37.i386.rpm                                                                                     | 105 kB     00:00    
(2/3): libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm                                                                     | 181 kB     00:00    
(3/3): freetype-devel-2.2.1-21.el5_3.i386.rpm                                                                        | 146 kB     00:00
-------------------------------------------------------------------------------------------------------------
Total                                                                                                                2.3 MB/s | 433 kB     00:00    
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey                                                                                                                   | 1.5 kB     00:00    
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <
centos-5-key@centos.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libpng-devel                                                                                                                      1/3 
  Installing     : libjpeg-devel                                                                                                                     2/3 
  Installing     : freetype-devel                                                                                                                   3/3

Installed:
  libjpeg-devel.i386 0:6b-37             libpng-devel.i386 2:1.2.10-7.1.el5_3.2            freetype-devel.i386 0:2.2.1-21.el5_3

Complete!
[root@wiki download]#




[root@wiki download]# wget http://mirror.apache-kr.org/httpd/httpd-2.2.15.tar.gz
--2010-04-06 11:06:52--  http://mirror.apache-kr.org/httpd/httpd-2.2.15.tar.gz
Resolving mirror.apache-kr.org... 211.174.58.187
Connecting to mirror.apache-kr.org|211.174.58.187|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6593633 (6.3M) [application/x-gzip]
Saving to: `httpd-2.2.15.tar.gz'

100%[========================================================================>] 6,593,633   7.73M/s   in 0.8s   

2010-04-06 11:06:53 (7.73 MB/s) - `httpd-2.2.15.tar.gz' saved [6593633/6593633]

[root@wiki download]# tar xvfz httpd-2.2.15.tar.gz
..................... 생략 ...................
httpd-2.2.15/server/mpm_common.c
httpd-2.2.15/server/.indent.pro
httpd-2.2.15/server/util_charset.c
httpd-2.2.15/server/eoc_bucket.c
httpd-2.2.15/BuildAll.dsp
httpd-2.2.15/acinclude.m4
httpd-2.2.15/Makefile.win
httpd-2.2.15/httpd.spec
httpd-2.2.15/configure
httpd-2.2.15/configure.in
httpd-2.2.15/VERSIONING
httpd-2.2.15/README
httpd-2.2.15/LAYOUT
httpd-2.2.15/buildconf
httpd-2.2.15/.gdbinit

[root@wiki download]# cd httpd-2.2.15
[root@wiki httpd-2.2.15]# ./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-so --enable-rewrite
...................... 생략 ........................
config.status: creating docs/conf/extra/httpd-mpm.conf
config.status: creating docs/conf/extra/httpd-multilang-errordoc.conf
config.status: creating docs/conf/extra/httpd-ssl.conf
config.status: creating docs/conf/extra/httpd-userdir.conf
config.status: creating docs/conf/extra/httpd-vhosts.conf
config.status: creating include/ap_config_layout.h
config.status: creating support/apxs
config.status: creating support/apachectl
config.status: creating support/dbmmanage
config.status: creating support/envvars-std
config.status: creating support/log_server_status
config.status: creating support/logresolve.pl
config.status: creating support/phf_abuse_log.cgi
config.status: creating support/split-logfile
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
[root@wiki httpd-2.2.15]#

--prefix=/usr/local/apache는 /usr/local/apache에 설치한다.

--enable-mods-shared=all은 DSO모드라고 한다는데, 모듈이 추가로 설치 되었을 때 다시 컴파일 하지 않고 추가 할 수 있어서 좋다고 한다.

--enable-so는 DSO모드를 활성화 한다고 한다.

--enable-rewrite는 URL 재작성 모듈을 활성화 한다.



[root@wiki httpd-2.2.15]# make
......................... 생략 ...............................
wnload/httpd-2.2.15/modules/database -I/usr/local/download/httpd-2.2.15/srclib/apr/include -I/usr/local/download/httpd-2.2.15/srclib/apr-util/include -I/usr/local/download/httpd-2.2.15/server -I/usr/local/download/httpd-2.2.15/modules/proxy/../generators -I/usr/local/download/httpd-2.2.15/modules/ssl -I/usr/local/download/httpd-2.2.15/modules/dav/main -prefer-pic -c mod_rewrite.c && touch mod_rewrite.slo
/usr/local/download/httpd-2.2.15/srclib/apr/libtool --silent --mode=link gcc -g -O2 -pthread          -o mod_rewrite.la -rpath /usr/local/apache/modules -module -avoid-version  mod_rewrite.lo
make[4]: Leaving directory `/usr/local/download/httpd-2.2.15/modules/mappers'
make[3]: Leaving directory `/usr/local/download/httpd-2.2.15/modules/mappers'
make[2]: Leaving directory `/usr/local/download/httpd-2.2.15/modules'
make[2]: Entering directory `/usr/local/download/httpd-2.2.15/support'
make[2]: Leaving directory `/usr/local/download/httpd-2.2.15/support'

make[1]: Leaving directory `/usr/local/download/httpd-2.2.15'
[root@wiki httpd-2.2.15]# make install
............... 생략 ..................
mkdir /usr/local/apache/htdocs
Installing error documents
mkdir /usr/local/apache/error
Installing icons
mkdir /usr/local/apache/icons
mkdir /usr/local/apache/logs
Installing CGIs
mkdir /usr/local/apache/cgi-bin
Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache/man
mkdir /usr/local/apache/man/man1
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
make[1]: Leaving directory `/usr/local/download/httpd-2.2.15'

[root@wiki httpd-2.2.15]#

Apache의 환경을 설정한다.


[root@wiki httpd-2.2.15]# vi /usr/local/apache/conf/httpd.conf
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>
</IfModule>


아래와 같이 변경한다.

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nobody

</IfModule>
</IfModule>




# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName
www.example.com:80

아래와 같이 주석을 제거하고 서버의 IP에 맞게 웹서버를 등록한다.
(도메인이 등록되었다면 도메인 이름을 도메인이 없다면 IP를 입력하면 된다.)

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName
123.123.123.123:80



# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>


아래와 같이 추가하여 준다.

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>





    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":


뒤에 설치 할 php를 사용하기 위해서 아래와 같이 추가한다.

    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    #
    # AddHandler allows you to map certain file extensions to "handlers":





Apache 설정이 완료되었으며, Apache를 실행하여 웹서버가 동작하는지 확인한다.
리눅스 방화벽에서 웹서버 포트를 열어주는 것은 잊지말자.

[root@wiki httpd-2.2.15]# /usr/local/apache/bin/apachectl start
[root@wiki httpd-2.2.15]#



웹서버가 동작하는 것을 확인 할 수 있다.
보안 때문에 내가 설치한 서버의 주소는 공개하지 않는다.



[root@wiki httpd-2.2.15]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local


아래와 같이 변경하여 서버가 재부팅 되더라도 웹서버가 자동으로 실행 할 수 있게 변경한다.

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/local/apache/bin/apachectl start





STEP 2.

DokuWiki는 php를 기반으로 구동되기 때문에 서버에 php를 설치 할 것이다.

[root@wiki httpd-2.2.15]# cd /usr/local/download/
[root@wiki download]# wget http://kr2.php.net/get/php-5.2.13.tar.gz/from/kr.php.net/mirror
--2010-04-06 11:34:08--  http://kr2.php.net/get/php-5.2.13.tar.gz/from/kr.php.net/mirror
Resolving kr2.php.net... 211.234.110.150
Connecting to kr2.php.net|211.234.110.150|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location:
http://kr.php.net/distributions/php-5.2.13.tar.gz [following]
--2010-04-06 11:34:08-- 
http://kr.php.net/distributions/php-5.2.13.tar.gz
Resolving kr.php.net... 115.165.178.40
Connecting to kr.php.net|115.165.178.40|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11719620 (11M) [application/x-gzip]
Saving to: `php-5.2.13.tar.gz'

100%[========================================================================>] 11,719,620  8.99M/s   in 1.2s   

2010-04-06 11:34:09 (8.99 MB/s) - `php-5.2.13.tar.gz' saved [11719620/11719620]

[root@wiki download]#


PHP를 다운 받았으며 압축을 풀고 설치를 한다.


[root@wiki download]# tar xvfz php-5.2.13.tar.gz
.................... 생략 ....................
php-5.2.13/README.SELF-CONTAINED-EXTENSIONS
php-5.2.13/stub.c
php-5.2.13/buildconf
php-5.2.13/stamp-h.in
php-5.2.13/README.SVN-RULES
php-5.2.13/README.input_filter
php-5.2.13/generated_lists
php-5.2.13/README.Zeus
php-5.2.13/INSTALL
php-5.2.13/TODO-PHP5
php-5.2.13/EXTENSIONS
php-5.2.13/server-tests-config.php
php-5.2.13/snapshot
php-5.2.13/php.gif
php-5.2.13/README.PARAMETER_PARSING_API
php-5.2.13/acconfig.h
php-5.2.13/README.PHP4-TO-PHP5-THIN-CHANGES
php-5.2.13/CREDITS
php-5.2.13/README.UPDATE_5_2
php-5.2.13/README.UNIX-BUILD-SYSTEM
php-5.2.13/buildconf.bat

[root@wiki download]# cd php-5.2.13
[root@wiki php-5.2.13]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --disable-debug --enable-safe-mode --enable-sockets --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-inline-optimization --enable-bcmath --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring
.................... 생략 .....................
creating libtool
appending configuration tag "CXX" to libtool

Generating files
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/man1/phpize.1
creating scripts/php-config
creating scripts/man1/php-config.1
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

[root@wiki php-5.2.13]#

--prefix=/usr/local/php는 php가 설치될 디렉토리 경로이다.
--with-apxs2=/usr/local/apache/bin/apxs는 Apache의 apxs를 이용해 아파치에 모듈을 적재한다.
--with-config-file-path=/usr/local/apache/conf는 php의 환경설정 파일인 php.ini가 생성 될 위치이다.



[root@wiki php-5.2.13]# make
................ 생략 ................
lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/php_cli_readline.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lrt -lfreetype -lpng -lz -ljpeg -lz -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt  -o sapi/cli/php

Build complete.
Don't forget to run 'make test'.

[root@wiki php-5.2.13]# make install
Installing PHP SAPI module:       apache2handler
/usr/local/apache/build/instdso.sh SH_LIBTOOL='/usr/local/apache/build/libtool' libphp5.la /usr/local/apache/modules
/usr/local/apache/build/libtool --mode=install cp libphp5.la /usr/local/apache/modules/
cp .libs/libphp5.so /usr/local/apache/modules/libphp5.so
cp .libs/libphp5.lai /usr/local/apache/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /usr/local/download/php-5.2.13/libs'
chmod 755 /usr/local/apache/modules/libphp5.so
[activating module `php5' in /usr/local/apache/conf/httpd.conf]
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:          /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php/lib/php/
[PEAR] Archive_Tar    - installed: 1.3.3
[PEAR] Console_Getopt - installed: 1.2.3
[PEAR] Structures_Graph- installed: 1.0.2
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.0
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
Installing PDO headers:          /usr/local/php/include/php/ext/pdo/

[root@wiki php-5.2.13]#



PHP의 환경 설정을 한다. /usr/local/apache/conf에 php.ini라는 이름으로 복사 한다.

[root@wiki php-5.2.13]# cp php.ini-dist /usr/local/apache/conf/php.ini
[root@wiki php-5.2.13]#



테스트 페이지를 만들어 PHP의 정보를 보여주는 함수를 입력한다.
[root@wiki php-5.2.13]# vi /usr/local/apache/htdocs/phpinfo.php
[root@wiki php-5.2.13]#


웹 서버를 멈췄다가 재시작하여 테스트 하도록 한다.
[root@wiki php-5.2.13]# /usr/local/apache/bin/apachectl stop
[root@wiki php-5.2.13]# /usr/local/apache/bin/apachectl start
[root@wiki php-5.2.13]#


웹브라우저에서 위와 같이 뜨는 것을 확인하면 된다.




STEP 3.

DokuWiki를 다운받고 설치하도록 한다.

[root@wiki php-5.2.13]# cd /usr/local/download/
[root@wiki download]# wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-12-25c.tgz
--2010-04-06 13:50:02--  http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-12-25c.tgz
Resolving www.splitbrain.org... 78.46.97.149
Connecting to
www.splitbrain.org|78.46.97.149|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2543601 (2.4M) [application/octet-stream]
Saving to: `dokuwiki-2009-12-25c.tgz'

100%[========================================================================>] 2,543,601   39.3K/s   in 64s    

2010-04-06 13:51:06 (39.0 KB/s) - `dokuwiki-2009-12-25c.tgz' saved [2543601/2543601]

[root@wiki download]# tar xvfz dokuwiki-2009-12-25c.tgz
........................ 생략 ............................
dokuwiki-2009-12-25/data/pages/playground/playground.txt
dokuwiki-2009-12-25/data/pages/wiki/
dokuwiki-2009-12-25/data/pages/wiki/syntax.txt
dokuwiki-2009-12-25/data/pages/wiki/dokuwiki.txt
dokuwiki-2009-12-25/data/meta/
dokuwiki-2009-12-25/data/meta/_dummy
dokuwiki-2009-12-25/data/attic/
dokuwiki-2009-12-25/data/attic/_dummy
dokuwiki-2009-12-25/data/_dummy
dokuwiki-2009-12-25/data/tmp/
dokuwiki-2009-12-25/data/tmp/_dummy
dokuwiki-2009-12-25/install.php
dokuwiki-2009-12-25/bin/
dokuwiki-2009-12-25/bin/.htaccess
dokuwiki-2009-12-25/bin/wantedpages.php
dokuwiki-2009-12-25/bin/dwpage.php
dokuwiki-2009-12-25/bin/indexer.php
[root@wiki download]# mv dokuwiki-2009-12-25 /usr/local/apache/htdocs/dokuwiki

[root@wiki download]#

DokuWiki를 서버의 dokuwiki라는 디렉토리 이름으로 Apache 경로로 이동을 시켜주었다.
아래와 같이 경로에 맞게 접속하여 install을 할 수 있는 화면이 뜨면 끝나게 된다.


run the installer를 클릭한다.







편의(?)를 위해서 언어를 영어에서 한글로 변경한다.
en이라고 된 체크박스를 ko로 바꾸고 Update를 클릭하면 아래와 같은 화면으로 변경된다.



위와 같은 화면을 보이며 설치가 진행되지 않을 것이다.
압축을 풀고 디렉토리를 옮기기만 했을 뿐 사용권한을 주지 않았기 때문에 위와 같은 메시지를 띄운다.
dokuwiki 디렉토리를 찾아가 설정을 쓸 수 있게 파일 권한을 변경하여준다.

[root@wiki download]# cd /usr/local/apache/htdocs/dokuwiki/
[root@wiki dokuwiki]# chmod 777 conf
[root@wiki dokuwiki]# chmod 777 -R data
[root@wiki dokuwiki]#

디렉토리 권한을 변경한 후 스크롤 아래에 있어서 보이지 않지만, 웹 페이지 하단에 있는 [다시 시도] 버튼을 클릭하면 아래와 같은 화면으로 변경 된 것을 확인 할 수 있다.


위키 이름과 슈퍼유저 등 해당 정보를 입력하여 DokuWiki를 관리자 입맛에 맞게 사용 할 수 있다.




위 화면은 허용된 사용자만 글을 게시하거나 쓸 수 있게 한 화면이다.
로그인 버튼을 눌러서 로그인을 한다.




사용자(ID)와 패스워드(Password)를 입력하여 로그인 한다.




위와 같이 로그인을 하고나면 글을 게시하여 페이지를 만들 수 있다.
이상으로 DokuWiki를 설치하는 방법을 설명하였다.



저작자 표시 비영리 동일 조건 변경 허락
크리에이티브 커먼즈 라이선스
Creative Commons License

'Linux tools > DokuWiki' 카테고리의 다른 글

DokuWiki 설치  (1) 2010.04.06
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.






 STEP 1.

Weathermap4RRD는 Perl 버전과 PHP 버전이 있는데 PHP 버전으로 설치하고, 사용 할 것이다.
PHP 버전을 설치 하기에 앞서 PHP를 먼저 설치해야 한다.

[root@mrtg mrtg]# cd /usr/local/rrdbuild/
[root@mrtg rrdbuild]# wget http://kr2.php.net/get/php-5.2.13.tar.gz/from/kr.php.net/mirror
--2010-03-26 10:56:49--  http://kr2.php.net/get/php-5.2.13.tar.gz/from/kr.php.net/mirror
Resolving kr2.php.net... 211.234.110.150
Connecting to kr2.php.net|211.234.110.150|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location:
http://kr.php.net/distributions/php-5.2.13.tar.gz [following]
--2010-03-26 10:56:49-- 
http://kr.php.net/distributions/php-5.2.13.tar.gz
Resolving kr.php.net... 115.165.178.40
Connecting to kr.php.net|115.165.178.40|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11719620 (11M) [application/x-gzip]
Saving to: `php-5.2.13.tar.gz'

100%[=======================================================================>] 11,719,620  3.55M/s   in 3.1s   

2010-03-26 10:56:52 (3.55 MB/s) - `php-5.2.13.tar.gz' saved [11719620/11719620]

[root@mrtg rrdbuild]#


PHP를 다운 받았으므로, 이제 압축을 해제하고 설치를 시작 하겠다.

[root@mrtg rrdbuild]# tar xvfz php-5.2.13.tar.gz
................ 생략(참고로 PHP는 굉장히 오랫 동안 압축을 푼다) ................
php-5.2.13/README.SELF-CONTAINED-EXTENSIONS
php-5.2.13/stub.c
php-5.2.13/buildconf
php-5.2.13/stamp-h.in
php-5.2.13/README.SVN-RULES
php-5.2.13/README.input_filter
php-5.2.13/generated_lists
php-5.2.13/README.Zeus
php-5.2.13/INSTALL
php-5.2.13/TODO-PHP5
php-5.2.13/EXTENSIONS
php-5.2.13/server-tests-config.php
php-5.2.13/snapshot
php-5.2.13/php.gif
php-5.2.13/README.PARAMETER_PARSING_API
php-5.2.13/acconfig.h
php-5.2.13/README.PHP4-TO-PHP5-THIN-CHANGES
php-5.2.13/CREDITS
php-5.2.13/README.UPDATE_5_2
php-5.2.13/README.UNIX-BUILD-SYSTEM
php-5.2.13/buildconf.bat

[root@mrtg rrdbuild]# cd php-5.2.13
[root@mrtg php-5.2.13]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --disable-debug --enable-safe-mode --enable-sockets --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-inline-optimization --enable-bcmath --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring
.............. 생략(이것 역시 길다)...............
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool

Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/man1/phpize.1
creating scripts/php-config
creating scripts/man1/php-config.1
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

[root@mrtg php-5.2.13]#

--prefix=/usr/local/php는 php가 설치될 디렉토리 경로이다.
--with-apxs2=/usr/local/apache/bin/apxs는 Apache의 apxs를 이용해 아파치에 모듈을 적재한다.
--with-config-file-path=/usr/local/apache/conf는 php의 환경설정 파일인 php.ini가 생성 될 위치이다.

그 외 각종 라이브러리를 포함하는 옵션이다.



[root@mrtg php-5.2.13]# make
/bin/sh /usr/local/rrdbuild/php-5.2.13/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/date/lib -Iext/date/ -I/usr/local/rrdbuild/php-5.2.13/ext/date/ -DPHP_ATOM_INC -I/usr/local/rrdbuild/php-5.2.13/include -I/usr/local/rrdbuild/php-5.2.13/main -I/usr/local/rrdbuild/php-5.2.13 -I/usr/local/rrdbuild/php-5.2.13/ext/date/lib -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/local/rrdbuild/php-5.2.13/ext/mbstring/oniguruma -I/usr/local/rrdbuild/php-5.2.13/ext/mbstring/libmbfl -I/usr/local/rrdbuild/php-5.2.13/ext/mbstring/libmbfl/mbfl -I/usr/local/rrdbuild/php-5.2.13/TSRM -I/usr/local/rrdbuild/php-5.2.13/Zend    -I/usr/include -g -O2  -prefer-non-pic -c /usr/local/rrdbuild/php-5.2.13/ext/date/php_date.c -o ext/date/php_date.lo
/bin/sh /usr/local/rrdbuild/php-5.2.13/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/date/lib -Iext/date/ -I/usr/local/rrdbuild/php-5.2.13/ext/date/ -DPHP_ATOM_INC -I/usr/local/rrdbuild/php-5.2.13/include -I/usr/local/rrdbuild/php-5.2.13/main -I/usr/local/rrdbuild/php-5.2.13 -I/usr/local/rrdbuild/php-5.2.13/ext/date/lib -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/local/rrdbuild/php-5.2.13/ext/mbstring/oniguruma -I/usr/local/rrdbuild/php-5.2.13/ext/mbstring/libmbfl -I/usr/local/rrdbuild/php-5.2.13/ext/mbstring/libmbfl/mbfl -I/usr/local/rrdbuild/php-5.2.13/TSRM -I/usr/local/rrdbuild/php-5.2.13/Zend    -I/usr/include -g -O2  -prefer-non-pic -c /usr/local/rrdbuild/php-5.2.13/ext/date/lib/astro.c -o ext/date/lib/astro.lo
............... 생략 ..............
ge_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/php_cli_readline.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lrt -lfreetype -lpng -lz -ljpeg -lz -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt  -o sapi/cli/php

Build complete.
Don't forget to run 'make test'.


[root@mrtg php-5.2.13]# make install
Installing PHP SAPI module:       apache2handler
/usr/local/apache/build/instdso.sh SH_LIBTOOL='/usr/local/apache/build/libtool' libphp5.la /usr/local/apache/modules
/usr/local/apache/build/libtool --mode=install cp libphp5.la /usr/local/apache/modules/
cp .libs/libphp5.so /usr/local/apache/modules/libphp5.so
cp .libs/libphp5.lai /usr/local/apache/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /usr/local/rrdbuild/php-5.2.13/libs'
chmod 755 /usr/local/apache/modules/libphp5.so
[activating module `php5' in /usr/local/apache/conf/httpd.conf]
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:          /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php/lib/php/
[PEAR] Archive_Tar    - installed: 1.3.3
[PEAR] Console_Getopt - installed: 1.2.3
[PEAR] Structures_Graph- installed: 1.0.2
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.0
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
Installing PDO headers:          /usr/local/php/include/php/ext/pdo/

[root@mrtg php-5.2.13]#



PHP의 환경 설정을 한다. /usr/local/apache/conf에 php.ini라는 이름으로 복사 한다.

[root@mrtg php-5.2.13]# cp php.ini-dist /usr/local/apache/conf/php.ini
[root@mrtg php-5.2.13]#


웹서버(아파치)와 연동하기 위해서는 httpd.conf를 수정해야 하는데 앞에서 웹서버 설치 할 때 이미 php 관련된 사항을 모두 입력 하였다. 그래도 확인 차원에서 입력해야 하는 부분을 다시 한번 보여주겠다.

[root@mrtg php-5.2.13]# vi /usr/local/apache/conf/httpd.conf
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php index.cgi
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being




    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    AddType application/x-httpd-cgi .cgi .pl
    #
    # AddHandler allows you to map certain file extensions to "handlers":




웹서버를 멈췄다가 다시 시작하여, 테스트를 해 보도록 한다.

[root@mrtg php-5.2.13]# /usr/local/apache/bin/apachectl stop
[root@mrtg php-5.2.13]# /usr/local/apache/bin/apachectl start
[root@mrtg php-5.2.13]#



테스트 페이지를 만들어서 php의 정보를 보여주는 함수를 사용해 본다.

[root@mrtg php-5.2.13]# vi /usr/local/apache/htdocs/phpinfo.php
<? phpinfo(); ?>
[root@mrtg php-5.2.13]#


위와 같이 웹브라우저를 띄우고 웹서버 주소에서 phpinfo.php를 입력하면 PHP 정보가 나오게 된다.





STEP 2.

이제 본격적으로 Weathermap4RRD를 설치 할 것이다. 우선 Weathermap4RRD를 다운 받고 압축을 해제한다.

[root@mrtg php-5.2.13]# cd /usr/local/rrdbuild/
[root@mrtg rrdbuild]# lftpget "http://weathermap4rrd.tropicalex.net/get_file.php?id=21&path=/code&filename=weathermap4rrd-php-1.2bfinal.tgz"

위에서 파일을 받을 주소가 특수문자(?, &)등을 포함하고 있어서 wget이나 lftpget만 입력하면 제대로 파일을 다운로드하지 못하여 주소에 " " 로 묶어주었다. wget으로 받은 경우에는 ? 뒤부터 파일 이름으로 해석을 한 반면, lftpget을 이용하니 제대로 weathermap4rrd-php-1.2bfinal.tgz으로 받아졌다.


[root@mrtg rrdbuild]# tar xvfz weathermap4rrd-php-1.2bfinal.tgz
weathermap4rrd-php-1.2bfinal/
weathermap4rrd-php-1.2bfinal/graph.php
weathermap4rrd-php-1.2bfinal/net.php
weathermap4rrd-php-1.2bfinal/graphic.php
weathermap4rrd-php-1.2bfinal/INSTALL
weathermap4rrd-php-1.2bfinal/overlib_mini.js
weathermap4rrd-php-1.2bfinal/weathermap.conf
weathermap4rrd-php-1.2bfinal/rrd.php
weathermap4rrd-php-1.2bfinal/w4rrd.php
weathermap4rrd-php-1.2bfinal/config.php
weathermap4rrd-php-1.2bfinal/map.htm
weathermap4rrd-php-1.2bfinal/histo.php
weathermap4rrd-php-1.2bfinal/overlib.js
weathermap4rrd-php-1.2bfinal/CHANGELOG
weathermap4rrd-php-1.2bfinal/linkgraph.php
weathermap4rrd-php-1.2bfinal/overlib/
weathermap4rrd-php-1.2bfinal/index.php
weathermap4rrd-php-1.2bfinal/README
weathermap4rrd-php-1.2bfinal/icons/
weathermap4rrd-php-1.2bfinal/icons/wireless_router.png
weathermap4rrd-php-1.2bfinal/icons/router_cisco.png
weathermap4rrd-php-1.2bfinal/icons/terminal.png
weathermap4rrd-php-1.2bfinal/icons/router2.png
weathermap4rrd-php-1.2bfinal/icons/pix.png
weathermap4rrd-php-1.2bfinal/icons/server.png
weathermap4rrd-php-1.2bfinal/config_tool.php
weathermap4rrd-php-1.2bfinal/LICENSE
weathermap4rrd-php-1.2bfinal/currentvalues.php

[root@mrtg rrdbuild]#


압축을 해제하였으니, 이제 config.php와 weathermap.conf를 편집한다.
config.php는 RRDTool 실행을 위한 경로 설정과 weahtermap.conf의 경로를 설정한다.
weahtermap.conf에서는 weahtermap에서의 노드와 회선등의 설정 정보를 정의한다.


우선 config.php 파일을 수정한다.

[root@mrtg rrdbuild]# cd weathermap4rrd-php-1.2bfinal
[root@mrtg weathermap4rrd-php-1.2bfinal]# vi config.php

<?php

//$rrdtool = "/usr/bin/rrdtool";
//$rrdtool = "/usr/src/rrdtool-1.3.6/src/rrdtool";
$rrdtool = "/usr/local/rrdtool-1.2.12/bin/rrdtool";


# You have to set up this variable to your weathermap4rrd path
# it will be used to read config file
$weathermap4php= dirname($_SERVER['PATH_TRANSLATED']);
#$configfile=$weathermap4php."/weathermap.conf";
$configfile=$_GET['config'];
if (empty($configfile)) {
        if (empty($weathermap4php)) {
            $configfile = "weathermap.conf";
        } else {
            $configfile = $weathermap4php."/weathermap.conf";
        }
} else {
        if (empty($weathermap4php)) {
            $configfile = $configfile;
        } else {
            $configfile = $weathermap4php."/".$configfile;
        }
}



weahtermap.conf를 수정한다. 웹서버에서 구동시키기 위하여, weathermap4rrd-php-1.2bfinal 디렉토리를 웹서버가 위치한 디렉토리로 복사를 할 것이다.

[root@mrtg weathermap4rrd-php-1.2bfinal]# cd /usr/local/rrdbuild/
[root@mrtg rrdbuild]# cp -r weathermap4rrd-php-1.2bfinal /usr/local/apache/htdocs/weathermap
[root@mrtg rrdbuild]# cd /usr/local/apache/htdocs/weathermap/
[root@mrtg weathermap]# vi weathermap.conf
# This file is an example of what directives may be used in your configuration file. For more details, please visit :
#
#
http://weathermap4rrd.tropicalex.net
# December 2005  /  Alexandre Fontelle

# BACKGROUND directive defines a background PNG file.
# (optional)
#BACKGROUND france_.png

# Size of image generated if no background has been defined. If one background is defined, size of background will be used.
HEIGHT 600
WIDTH 740

# FONT from 1 to 5 (define size of font that will be used in graph to display node's names, title...)
FONT 4

# Position of legend
LEGENDPOS       300 460

# LEGENDSTYLE should be "orignal" or "line"
LEGENDSTYLE     line

# label of TITLE
TITLE "Example Tropicalex Network map"
# Position of title in graph
TITLEPOS 4 470
# Color of background title
TITLEBACKGROUND 255 255 128
# Color of font to display title
TITLEFOREGROUND 0 0 0

# Allow to define if CHECK directive in NODE section has to be used or not
# *******
# WARNING : use of this feature could really slow generation of map because of ping function call (especially when a node is down)
# *******
# IPCHECK default value is 0
IPCHECK 0

# Time between two refresh of display in seconds
REFRESH 40

# OUTPUTFILE define path and name of PNG picture that will be generated
OUTPUTFILE /var/www/weathermap4rrdtest.tropicalex.net/htdocs/weathermap4rrd-php-1.2final/weathermap.png
# HTMLFILE define path and name of html file that will be generated to store html map of network weathermap
HTMLFILE /var/www/weathermap4rrdtest.tropicalex.net/htdocs/weathermap4rrd-php-1.2final/weathermap.html

# Legend colors and boundaries values
# For example first line means that between 1 and 10% of bandwidth use, color used to draw the arrow will be RGB(140,0,255)
#     low  high   red green blue
SCALE   1   10    140     0  255
SCALE  10   25     32    32  255
SCALE  25   40      0   192  255
SCALE  40   55      0   240    0
SCALE  55   70    240   240    0
SCALE  70   85    255   192    0
SCALE  85  90     255   100    0
SCALE  90  100    255     0    0

# You may use AUTOSCALE directive to create a dynamic colors scale
# Example of AUTOSCALE syntax :
# AUTOSCALE 15 24 232 2 0 0 0
# AUTOSCALE 11

################
# NODES SECTION #
################

# Name of node (this name won't be displayed on map)
NODE Freebackbone
                # Position of node in the map
        POSITION 135 125
                # Name that will be displayed on the map in label
        LABEL Freebackbone
                # You have ability to choose between several kind of label : "round" or "normal" for square
                LABELTYPE round

NODE Bastille2
        POSITION 200 387
                # You need to define IP of node if you plan to use CHECK directive (see below)
                IP 192.168.0.7
                # Weathermap4rrd will test if node is down or up with a TCP request on port 80 of node
                # *******
                # WARNING : use of this feature could really slow generation of map (especially when a node is down)
                # *******
                CHECK tcp 80
        LABEL Bastille2
                LABELTYPE       round
                # LABELTPT defined transparency of node on network weathermap.
                # Be careful 0 will disable LABELTPT value reading and it will be like LABELTPT 100
                LABELTPT        80
                # You may associate an icon to your node. To do so, use ICON directive
                # Icon has to be a PNG file format
                ICON icons/router_cisco.png
                # You may want to resize icon...then use ICONRESIZE. Value is in % of original image. In this example icon displayed on map will be 75% of original size
                ICONRESIZE 75

NODE k7
        POSITION 478 387
                IP 192.168.0.8
                # Weathermap4rrd will test if node is down or up with a "ping" request (use ICMP protocol).
                # *******
                # WARNING : use of this feature could really slow generation of map (especially when a node is down)
                # *******
                CHECK ping
        LABEL K7
                # if no LABELTYPE is defined, default is "normal" (square)
#               LABELTYPE round
                ICON icons/terminal.png
                ICONTPT 50

NODE switch    
                POSITION 405 125
                LABEL switch
                LABELTYPE round

NODE workstation1
                POSITION 500 250
                LABEL workstation1
                LABELTYPE round

NODE workstation2
                POSITION 500 300
                LABEL workstation2
                LABELTYPE round


#################
# LINKS section #
#################

# Name of link (won't be displayed on map, just useful for internal use of weathermap4rrd)
LINK internet-switch
                # Put name of nodes A and B that are linked
        NODES   Freebackbone switch
                # Define file where interfaces trafic values have to be read (could be a MRTG file or RRD file). See
http://weathermap4rrd.tropicalex.net for details
                # You may have a different file for inbound and outbound values. If so, use TARGETIN and TARGETOUT directives.
        TARGET  /home/monitor/monitoring/rrd/bastille2.eth1.rrd                 # LINKOVERLIBGRAPH allow you to display a popup window when mouse cursor is over a link. Content of this window will be result of call to script defined as value of LINKOVERLIBGRAPH directive. If LINKOVERLIBGRAPH is used without parameter (as in this example), script graph.php will be used.
                LINKOVERLIBGRAPH
                # LINKINFOURL defined URL link that will be used if you click on link. Default is globalgraph (that in fact called linkgraph.php)
                # You may put what you like
                LINKINFOURL globalgraph
                # Define position of RRA in RRD file for inbound bandwidth values for node A (here Freebackbone)
                INPOS   1
                # Define position of RRA in RRD file for outbound bandwidth values for node A (here Freebackbone)
                OUTPOS  2
                # UNIT defines unit of values stored in TARGET file
                UNIT    bytes
                # Define bandwidth of link in Kilobits
                BANDWIDTH 316
                # DISPLAYVALUE allow you to display value of bandwith just below the % bandwidth
                DISPLAYVALUE 1
                # Type of ARROW to display. You may choose between : "normal", "round" or "halfarrow"
                ARROW   halfarrow
                # You may create group of link in order to filter display
                GROUP   dsl
                #INTERNODEDISPLAY 100
                # Define if middle internode will be displayed when number of internodes is odd
                INTERNODEDISPLAYMID no
                INTERNODEDISPLAYNUM no

LINK internet-Bastille2
        NODES   Freebackbone Bastille2
        TARGET  /home/monitor/monitoring/rrd/bastille2.eth1.rrd
#               LINKOVERLIBGRAPH
http://www.google.fr/intl/fr_fr/images/logo.gif
                LINKOVERLIBGRAPH
                LINKINFOURL globalgraph
                INPOS   1
                OUTPOS  2
                UNIT    bytes
                BANDWIDTH 316
                DISPLAYVALUE 1
                ARROW   normal
                # Define points that have to be used to draw link between nodes A & B
                INTERNODE       135 250
                # Define  transparency of round that will be display on internode position
                INTERNODEDISPLAY 75
                # When there is a odd number of internodes defined. You may choose if you want to display a round as for an internode in middle of link.
                INTERNODEDISPLAYMID no
                # You may want to display a number in round (for debug)
                INTERNODEDISPLAYNUM no

LINK k7-Bastille2
                NODES   Bastille2 k7
                TARGETOUT /home/monitor/monitoring/rrd/bastille2.eri0.rrd
                TARGETIN /home/monitor/monitoring/rrd/bastille2.eri0.rrd
                LINKOVERLIBGRAPH currentvalues.php
                LINKINFOURL globalgraph
                INPOS   1
                OUTPOS  2
                UNIT    bytes
                BANDWIDTH       316
                DISPLAYVALUE    1
                ARROW   normal


LINK switch-workstation1
                NODES switch workstation1
                TARGET /home/monitor/monitoring/rrd/bastille2.eri0.rrd
                INPOS   1
                OUTPOS  2
                UNIT    bytes  
                BANDWIDTH       31
                DISPLAYVALUE    0
                ARROW   circle
                INTERNODE 500 125

LINK switch-workstation2
                NODES switch workstation2
                TARGET /home/monitor/monitoring/rrd/bastille2.eri0.rrd
                INPOS   1
                OUTPOS  2
                UNIT    bytes  
                BANDWIDTH       13
                DISPLAYVALUE    0
                ARROW   circle
                INTERNODE 405 300
                INTERNODEDISPLAY 75



weathermap.conf는 위와 같이 되어있을 것이다.

OUTPUTFILE에서는 Weahtermap을 경험해 본 사람은 알겠지만, html로 생성 된 파일에서 스크린을 png 파일로 변환하여 저장을 할 수 있는 경로를 입력한다.

HTMLFILE에서는 웹브라우저에서 볼 수 있게 weathermap.html이 생성 될 경로를 입력한다. 사용자 편의에 맞춰 이름이나 경로 수정이 가능하다.

SCALE은 그래프에서 구간을 설정하여 트래픽을 나타내는 화살표를 색으로 구분 할 수 있게 해준다.
기본으로 들어있는 파일을 살펴보면 SCALE 1  10  140  0  255 라고 되어있다. 물론 그 위에 #으로 주석처리를 하여 low high red green blue라고 써 있는 것을 확인 할 수 있다.
트래픽이 1~10%까지 트래픽의 경우에는 화살표의 색상을 색상표 RGB에 맞춰 Red 140 , Green 0 , Blue 255로 색깔을 표현 할 것이다. 사용자가 구축하는 서버의 특성에 맞춰서 %의 단위나, 색상이나 변경이 가능하다.

NODE는 트래픽 화살표를 그리기 위한 축이라고 할 수 있으며, NODE의 이름으로 LINK를 표현 할 때 이용되므로 서버 관리자가 관리하기 편하고 기억하기 쉽게 정리하는 것이 좋다. POSITION을 통해서 X축과 Y축 값에 따라 위치를 정할 수 있다. 웹브라우저에서 위치를 정할 때는 조금씩 수정하고, 새로고침 하는것이 가장 좋은 방법이라고 생각한다.
LABEL은 NODE에 마우스를 가져가면 띄워주는 라벨이며, IP를 입력하면 ping 테스트를 하며, ping이 정상적인 경우에는 녹색으로 정상적으로 되지 않을 경우에는 붉은색으로 표시한다. LABELTYPE으로 라벨의 모양이나 위치 등도 변경이 가능하다.
ICON 등을 하위 경로 등에 두어 NODE에 이미지를 넣을 수 도 있고, ICONSIZE를 통해서 이미지의 사이즈도 변경이 가능하다. ICONESIZE 75는 이미지의 75%로 표시 한다는 의미이다.

LINK는 NODE와 NODE를 이어주는 화살표라고 할 수 있으며, TARGET을 통해 서버에 저장된 rrd 파일을 읽어와서 맵에 맞게 표현해준다.
LINKINFOURL을 통해 특정 회선에 대한 MRTG를 웨더맵과 연동한다.
LINKOVERLIBGRAPH 옵션을 통해서 마우스 포인터가 화살표에 올라가면, MRTG 그래프를 표시해주기도 한다.
트래픽의 BANDWIDTH나 ARROW의 옵션을 통하여 화살표를 양방향, 단방향등 여러가지 옵션을 줄 수 있다.



설정을 변경 하였는데도 그래프가 아래 그림과 같이 나올 것이다.




위에 설정에서 알 수 있듯이 weahtermap을 표현하기 위해서는 html과 png 파일등을 쓰거나 실행 할 수 있어야 한다.
[root@mrtg weathermap]# cd /usr/local/apache/htdocs/
[root@mrtg htdocs]# chmod 777 weathermap/
[root@mrtg htdocs]#


권한 변경 후 아래와 같이 그래프가 제대로 나오기 시작한다.
설정 부분은 본인이 직접 운영을 하면서 시행착오를 거치다보면 더 좋은 Weahtermap을 표현 할 수 있다고 생각한다.




저작자 표시 비영리 동일 조건 변경 허락
크리에이티브 커먼즈 라이선스
Creative Commons License

'Linux tools > MRTG' 카테고리의 다른 글

MRTG서버에 Weathermap 설치 및 사용하기  (0) 2010.03.26
MRTG 설정 및 사용하기  (0) 2010.03.25
MRTG 설치 방법  (0) 2010.03.23
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.






STEP 1.

MRTG를 설치하였으니 이제 MRTG를 사용하는 방법에 대해서 알아보도록 하겠다.
내 경우에는 MRTG를 관리 할 계정으로 mrtg 라는 계정을 만들었으며, 그 디렉토리 안에 cfg, data, log를 만들었다.

[root@mrtg cfg]# cfgmaker --global Workdir:/home/mrtg/data --global 'Options[_]:growright,bits' --output=/home/mrtg/cfg/test.cfg public@123.123.123.123:::::2
--base: Get Device Info on public@123.123.123.123:::::2
--base: Vendor Id: cisco
--base: Populating confcache
--coca: populate confcache
public@123.123.123.123:::::2
--coca: store in confcache public@123.123.123.123__2 Name Te3/1 --> 1
--coca: store in confcache
public@123.123.123.123__2 Name Te3/2 --> 2
--coca: store in confcache
public@123.123.123.123__2 Name Gi5/1 --> 3
--coca: store in confcache
public@123.123.123.123__2 Name Gi5/2 --> 4
--coca: store in confcache
public@123.123.123.123__2 Name Gi7/1 --> 5
--coca: store in confcache
public@123.123.123.123__2 Name Gi7/2 --> 6
--coca: store in confcache
public@123.123.123.123__2 Name Vl1 --> 7
--coca: store in confcache
public@123.123.123.123__2 Descr TenGigabitEthernet3/1 --> 1
--coca: store in confcache
public@123.123.123.123__2 Descr TenGigabitEthernet3/2 --> 2
--coca: store in confcache
public@123.123.123.123__2 Descr GigabitEthernet5/1 --> 3
--coca: store in confcache
public@123.123.123.123__2 Descr GigabitEthernet5/2 --> 4
--coca: store in confcache
public@123.123.123.123__2 Descr GigabitEthernet7/1 --> 5
--coca: store in confcache
public@123.123.123.123__2 Descr GigabitEthernet7/2 --> 6
--coca: store in confcache
public@123.123.123.123__2 Descr Vlan1 --> 7
--coca: store in confcache
public@123.123.123.123__2 Type 6 --> 1
--coca: store in confcache
public@123.123.123.123__2 Type 6 --> 2 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Type 6 --> 3 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Type 6 --> 4 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Type 6 --> 5 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Type 6 --> 6 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Type 53 --> 7
--coca: store in confcache
public@123.123.123.123__2 Eth 00-16-9d-ab-13-78 --> 1
--coca: store in confcache
public@123.123.123.123__2 Eth 00-1c-b0-b6-67-40 --> 2
--coca: store in confcache
public@123.123.123.123__2 Eth 00-1c-b0-b6-67-40 --> 3 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Eth 00-1c-b0-b6-67-40 --> 4 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Eth 00-16-46-e3-18-18 --> 5
--coca: store in confcache
public@123.123.123.123__2 Eth 00-1c-b0-b6-67-40 --> 6 (duplicate)
--coca: store in confcache
public@123.123.123.123__2 Eth 00-00-15-00-00-00 --> 7
--base: Get Interface Info
--base: Walking ifIndex
--base: Walking ifType
--base: Walking ifAdminStatus
--base: Walking ifOperStatus
--base: Walking ifMtu
--base: Walking ifAlias
--base: Walking vmVlan
--base: Walking ifSpeed
--base: Walking ifHighSpeed
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHighSpeed.1 -> 10000 Mb/s
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHCInOctets.1 -> 2554890072645173
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHighSpeed.2 -> 10000 Mb/s
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHCInOctets.2 -> 0
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHighSpeed.3 -> 1000 Mb/s
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHCInOctets.3 -> 88837206
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHighSpeed.4 -> 100 Mb/s
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHCInOctets.4 -> 294876
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHighSpeed.5 -> 1000 Mb/s
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHCInOctets.5 -> 8261120
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHighSpeed.6 -> 1000 Mb/s
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHCInOctets.6 -> 0
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHighSpeed.7 -> 100 Mb/s
--base: snmpget
public@123.123.123.123:::::2:v4only for ifHCInOctets.7 -> 1120902719935
--base: check for HighspeedCounters failed ... Dropping back to V1
--base: Writing /home/mrtg/cfg/test.cfg

[root@mrtg cfg]#

보안상 내가 설치한 서버의 정보는 공개하지 않았다.
--global Workdir:/home/mrtg/data는 MRTG의 작업 디렉토리를 지정 하는 것이다. 이 때 MRTG는 MRTG의 로그 파일 및 웹 페이지 작업을 디렉토리에 생성한다.
--global 'Options[_]:growright,bits'는 MRTG 그래프에서 트래픽에 관한 표시를 Bit per Second로 하여 X축의 시간 증가가 오른쪽임을 의미한다.
output=/home/cfg/test.cfg는 cfgmaker를 통하여 생선한 cfg 파일 저장 경로와 파일의 이름을 의미한다.
public@123.123.123.123:::::2는 트래픽 정보를 수집하는 라우터에 관한 정보로 123.123.123.123은 라우터 IP의 정보이며, public은 community를 통해 SNMP Request로 접근함을 의미한다. :::::2는 SNMP v2로 접근하는 것을 의미한다.




STEP 2.

MRTG를 주기적으로 라우터의 트래픽 정보를 수집하는 것은 cron을 이용하여 주기적으로 MRTG를 실행시키는 방법과 MRTG의 데몬 모드로 실행시켜 주기적으로 데이터를 수집 할 수 있다.

cron을 통해 주기적으로 실행시키면 실행을 할 때 마다 MRTG cfg 파일을 읽어 초기화 하는 단점이 있기 때문에 MRTG 데몬 모드를 실행하는 것이 더 효율적이어서 MRTG 데몬 모드로 실행하는 방법을 설명하겠다.

[root@mrtg cfg]# vi test.cfg
# Created by
# /usr/local/mrtg-2/bin/cfgmaker --global Workdir:/home/mrtg/data --global 'Options[_]:growright,bits' --output=/home/mrtg/cfg/test.cfg
public@123.123.123.123:::::2


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no
Workdir:/home/mrtg/data
Options[_]:growright,bits

######################################################################
# System: Cisco-Router
# Description: Cisco Internetwork Operating System Software


test.cfg 파일을 열었을 경우 위와 같은 설정으로 생성이 되어있다.
여기에 RusAsDaemon과 이 데몬이 실행 될 주기를 입력하면 된다.

# Created by
# /usr/local/mrtg-2/bin/cfgmaker --global Workdir:/home/mrtg/data --global 'Options[_]:growright,bits' --output=/home/mrtg/cfg/test.cfg
public@123.123.123.123:::::2


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no
Workdir:/home/mrtg/data
Options[_]:growright,bits
RunAsDaemon: Yes
Interval: 3


######################################################################
# System: Cisco-Router
# Description: Cisco Internetwork Operating System Software


RunAsDaemon을 Yes로 하고, Interval에서 3으로 3분 주기로 설정을 하였다.



MRTG를 실행 시키는 방법은 아래와 같다.
[root@mrtg cfg]# mrtg /home/mrtg/cfg/test.cfg --logging /home/mrtg/log/test.log
Daemonizing MRTG ...
[root@mrtg cfg]#

MRTG가 제대로 실행되고 있는지 확인 해 본다.
[root@mrtg cfg]# ps aux | grep mrtg
avahi     2804  0.0  0.0   2592  1344 ?        Ss   11:55   0:00 avahi-daemon: running [mrtg.local]
root      6764  1.1  0.2  12316 10248 ?        Ss   16:22   0:00 /usr/bin/perl -w /usr/local/mrtg-2/bin/mrtg /home/mrtg/
cfg/test.cfg --logging /home/mrtg/log/test.log
root      6815  0.0  0.0   1844   528 pts/1    S+   16:23   0:00 grep mrtg

[root@mrtg cfg]#



서버를 재부팅 할 경우 MRTG를 실행하기 위해서는 /etc/rc.local 파일에 MRTG를 실행시키는 스크립트를 추가하면, 서버가 혹시라도 재부팅 되는 경우가 발생하더라도 자동으로 MRTG가 실행 될 것이다.

[root@mrtg cfg]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
LANG=C
/usr/local/apache/bin/apachectl start


아래와 같이 스크립트를 추가한다.

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
LANG=C
/usr/local/apache/bin/apachectl start

mrtg /home/mrtg/cfg/test.cfg --logging /home/mrtg/log/test.log





STEP 3.

MRTG로 수집한 트래픽 정보를 RRDTool에 저장을 하면 MRTG의 동작 속도를 향상 시킬 수 있으며, RRDTool의 경우 일정한 용량의 데이터로 수집하고 저장하기 때문에 서버의 용량이 크게 작용하지 않는 장점을 가지고 있다.
물론 시간이 많이 지나게되면, 처음에 수집한 데이터 값을 일정한 시간의 평균 값으로 저장하기 때문에 실제 데이터와 차이를 보이는 단점은 있다.

MRTG에서 수집한 트래픽 정보를 RRD에 저장하기 위해서 MRTG cfg 파일 내에 로그파일 형식을 RRDTool로 선언하는 항목을 추가하면된다. 또, MRTG에서 RRDTool을 이용하기 위해서는 RRDs.pm이라는 RRDTool의 perl모듈이 필요하며 RRDTool을 실행 할 수 있어야 한다.

[root@mrtg cfg]# vi test.cfg
# Created by
# /usr/local/mrtg-2/bin/cfgmaker --global Workdir:/home/mrtg/data/ --global 'Options[_]:growright,bits' --output=/home/mrtg/cfg/test.cfg
public@123.123.123.123:::::2


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no
WorkDir:/home/mrtg/data
icondir:/images/mrtg
Options[_]:growright,bits
RunAsDaemon: Yes
Interval: 3

######################################################################
# System: Cisco-Router
# Description: Cisco Internetwork Operating System Software


아래와 같이 추가한다.

# Created by
# /usr/local/mrtg-2/bin/cfgmaker --global Workdir:/home/mrtg/data/ --global 'Options[_]:growright,bits' --output=/home/mrtg/cfg/test.cfg
public@123.123.123.123:::::2


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no
WorkDir:/home/mrtg/data
icondir:/images/mrtg
Options[_]:growright,bits
RunAsDaemon: Yes
Interval: 3

PathAdd: /usr/local/rrdtool-1.2.12/bin/
LibAdd: /usr/local/rrdtool-1.2.12/lib/perl/5.8.8/i386-linux-thread-multi/
LogFormat: rrdtool

######################################################################
# System: Cisco-Router
# Description: Cisco Internetwork Operating System Software






STEP 4.

MRTG-RRD는 CGI/FastCGI로 개발된 RRDTool 형태의 데이터로부터 MRTG 그래프를 생성하는 스크립트이다.

MRTG를 이용하여 그래프를 생성하는 스크립트를 받는다.
이 스크립트는 매 5분마다 PNG파일을 생성하지 않아 MRTG를 이용한 모니터링 시스템의 성능을 향상 시킨다.

[root@mrtg cfg]#  cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget ftp://ftp.linux.cz/pub/linux/people/jan_kasprzak/mrtg-rrd/mrtg-rrd-0.7.tar.gz
[root@mrtg mrtg-rrd-0.7]# cp * /usr/local/apache/cgi-bin/
[root@mrtg cfg]# cd /usr/local/apache/cgi-bin/
[root@mrtg cgi-bin]# vi mrtg-rrd.cgi

# Location of RRDs.pm, if it is not in @INC
# use lib '/usr/lib/perl5/5.00503/i386-linux';
use RRDs;

use vars qw(@config_files @all_config_files %targets $config_time
        %directories $version $imagetype);

# EDIT THIS to reflect all your MRTG config files
BEGIN { @config_files = qw(/home/fadmin/mrtg/cfg/mrtg.cfg); }

$version = '0.7';

아래와 같이 변경한다.

# Location of RRDs.pm, if it is not in @INC
use lib '/usr/local/rrdtool-1.2.12/lib/perl/5.8.8/i386-linux-thread-multi';

use RRDs;

use vars qw(@config_files @all_config_files %targets $config_time
        %directories $version $imagetype);

# EDIT THIS to reflect all your MRTG config files
BEGIN { @config_files = qw(/home/mrtg/cfg/test.cfg); }

$version = '0.7';

RRDs.pm 모듈에 대한 경로 설정 및 mrtg.cfg 파일의 경로를 지정한 것이다.
현재 내가 설치 한 서버에서는 /usr/local/rrdtool-1.2.12/lib/perl/5.8.8/i386-linux-thread-multi에 RRDs.pm 모듈이 존재하며, cfg 파일은 /home/mrtg/cfg에 rrd 파일은 /home/mrtg/data에 마지막으로 log 파일은 /home/mrtg/log에 저장 할 것이다. BEGIN { @config_files = qw(/home/mrtg/cfg/mrtg.cfg); } 의 위치는 각자 자신이 저장할 위치에 맞춰서 저장하면 될 것이다.


이제 웹브라우저를 실행시켜 웹으로 접속을 해 보겠다.


올바른 경로로 접속을 하였지만 기대했던 그래프는 나오지 않고, Error 메시지가 우리를 반긴다.
test.cfg가 저장 된 /home/mrtg 디렉토리가 사용자만 사용 할 수 있기 때문에 현재 권한이 없다고 나오는 것이다.

[root@mrtg home]# ls -al
total 48
drwxr-xr-x  6 root    root     4096 Mar 23 13:44 .
drwxr-xr-x 23 root    root     4096 Mar 25 11:55 ..
drwx------  3 celltwo celltwo  4096 Mar 25 16:38 celltwo
drwx------  2 root    root    16384 Mar 23 10:26 lost+found
drwx------  6 mrtg    mrtg     4096 Mar 25 16:38 mrtg

[root@mrtg home]#

웹에서 디렉토리에 접근하여 볼 수 있게 접근 권한을 변경한다.

[root@mrtg home]# chmod 777 mrtg/
[root@mrtg home]# ls -al
total 48
drwxr-xr-x  6 root    root     4096 Mar 23 13:44 .
drwxr-xr-x 23 root    root     4096 Mar 25 11:55 ..
drwx------  3 celltwo celltwo  4096 Mar 25 16:38 celltwo
drwx------  2 root    root    16384 Mar 23 10:26 lost+found
drwxrwxrwx  6 mrtg    mrtg     4096 Mar 25 16:38 mrtg

[root@mrtg home]#


/home/mrtg 안에 설치 할 때 만든 cfg, data, log 디렉토리가 있을 것이다. (다르게 설치했다면, 그 설정에 맞출 것)
하위 디렉토리도 그에 맞게 설정을 변경을 하여야 한다.

[root@mrtg home]# cd mrtg/
[root@mrtg mrtg]# chmod 755 cfg
[root@mrtg mrtg]# chmod 755 log
[root@mrtg mrtg]# chmod 777 data


cfg와 log는 읽고 실행만 가능하게 해줬는데 data 디렉토리만 읽고 쓰고 실행 모든 권한을 다 줬는지 궁굼할 것이다.
MRTG가 RRDTool에서 데이터를 불러와 그래프로 표현 할 때 쓰기 권한이 없으면 그래프를 생성 할 수 없기 때문에 모든 권한을 다 열어 준 것이다.

이제 설정이 완료 되었으므로 웹브라우저를 새로고침 해 본다.


이제부터는 5분마다 그래프를 그리며 라우터의 트래픽을 보여 줄 것이다.




저작자 표시 비영리 동일 조건 변경 허락
크리에이티브 커먼즈 라이선스
Creative Commons License

'Linux tools > MRTG' 카테고리의 다른 글

MRTG서버에 Weathermap 설치 및 사용하기  (0) 2010.03.26
MRTG 설정 및 사용하기  (0) 2010.03.25
MRTG 설치 방법  (0) 2010.03.23
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.






설치 환경

OS : CentOS 5.4 i386
Web : Apache2
CGG : gcc version 4.1.2
Perl : 5.8.8


아래와 같은 라이브러리가 필요하다. 웹에서 검색하여 다운 받도록 하자.

GD-2.0.33
ZLIB-1.2.3
LIBPNG-1.2.8
FREETYPE-2.1.10
RRDTOOL-1.2.12
libart-lgpl-2.1.10


설치에 앞서 환경변수를 설정한다.

[root@mrtg ~]# BUILD_DIR=/usr/local/rrdbuild
[root@mrtg ~]# INSTALL_DIR=/usr/local/rrdtool-1.2.12
[root@mrtg ~]# export BUILD_DIR INSTALL_DIR



STEP 1.

zlib부터 설치를 시작한다.

[root@mrtg ~]# cd /usr/local
[root@mrtg local]# mkdir -p rrdbuild
[root@mrtg local]# cd rrdbuild
[root@mrtg rrdbuild]# lftpget http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz
[root@mrtg rrdbuild]# tar xvfz zlib-1.2.3.tar.gz
zlib/
zlib/1.2.3/
zlib/1.2.3/ChangeLog
zlib/1.2.3/FAQ
zlib/1.2.3/INDEX
zlib/1.2.3/Makefile
zlib/1.2.3/Makefile.in
zlib/1.2.3/README
zlib/1.2.3/adler32.c
zlib/1.2.3/algorithm.txt
zlib/1.2.3/compress.c
zlib/1.2.3/configure
zlib/1.2.3/crc32.c
.................... 생략 .......................
zlib/1.2.3/projects/visualc6/zlib.dsp
zlib/1.2.3/projects/visualc6/zlib.dsw
zlib/1.2.3/qnx/
zlib/1.2.3/qnx/package.qpg
zlib/1.2.3/win32/
zlib/1.2.3/win32/DLL_FAQ.txt
zlib/1.2.3/win32/Makefile.bor
zlib/1.2.3/win32/Makefile.emx
zlib/1.2.3/win32/Makefile.gcc
zlib/1.2.3/win32/Makefile.msc
zlib/1.2.3/win32/VisualC.txt
zlib/1.2.3/win32/zlib.def
zlib/1.2.3/win32/zlib1.rc

[root@mrtg rrdbuild]# CFLAGS="-O3 -fPIC"
[root@mrtg rrdbuild]# export CFLAGS
[root@mrtg rrdbuild]# cd zlib
[root@mrtg zlib]# cd 1.2.3
[root@mrtg 1.2.3]# ./configure --prefix=$BUILD_DIR/lb
Checking for gcc...
Building static library libz.a version 1.2.3 with gcc.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.
[root@mrtg 1.2.3]# make
gcc -O3 -fPIC -DUSE_MMAP   -c -o example.o example.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o adler32.o adler32.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o compress.o compress.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o crc32.o crc32.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o gzio.o gzio.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o uncompr.o uncompr.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o deflate.o deflate.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o trees.o trees.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o zutil.o zutil.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o inflate.o inflate.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o infback.o infback.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o inftrees.o inftrees.c
gcc -O3 -fPIC -DUSE_MMAP   -c -o inffast.o inffast.c
ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
gcc -O3 -fPIC -DUSE_MMAP -o example example.o -L. libz.a
gcc -O3 -fPIC -DUSE_MMAP   -c -o minigzip.o minigzip.c
gcc -O3 -fPIC -DUSE_MMAP -o minigzip minigzip.o -L. libz.a

[root@mrtg 1.2.3]# make install
cp zlib.h zconf.h /usr/local/rrdbuild/lb/include
chmod 644 /usr/local/rrdbuild/lb/include/zlib.h /usr/local/rrdbuild/lb/include/zconf.h
cp libz.a /usr/local/rrdbuild/lb/lib
cd /usr/local/rrdbuild/lb/lib; chmod 755 libz.a
cd /usr/local/rrdbuild/lb/lib; if test -f libz.so.1.2.3; then \
          rm -f libz.so libz.so.1; \
          ln -s libz.so.1.2.3 libz.so; \
          ln -s libz.so.1.2.3 libz.so.1; \
          (ldconfig || true)  >/dev/null 2>&1; \
        fi
cp zlib.3 /usr/local/rrdbuild/lb/share/man/man3
chmod 644 /usr/local/rrdbuild/lb/share/man/man3/zlib.3

[root@mrtg 1.2.3]#

zlib 설치가 완료 되었다.




STEP 2.

libpng를 설치한다.

[root@mrtg rrdbuild]# cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget ftp://ftp.kr.freebsd.org/pub/xorg/X11R7.0/src/extras/libpng-1.2.8-config.tar.gz
[root@mrtg rrdbuild]# tar xvfz libpng-1.2.8-config.tar.gz
libpng-1.2.8-config/
libpng-1.2.8-config/contrib/
libpng-1.2.8-config/contrib/gregbook/
libpng-1.2.8-config/contrib/gregbook/writepng.h
libpng-1.2.8-config/contrib/gregbook/Makefile.sgi
libpng-1.2.8-config/contrib/gregbook/Makefile.unx
libpng-1.2.8-config/contrib/gregbook/Makefile.w32
libpng-1.2.8-config/contrib/gregbook/README
libpng-1.2.8-config/contrib/gregbook/makevms.com
libpng-1.2.8-config/contrib/gregbook/readpng.c
libpng-1.2.8-config/contrib/gregbook/readpng.h
libpng-1.2.8-config/contrib/gregbook/readpng2.c
libpng-1.2.8-config/contrib/gregbook/readpng2.h
libpng-1.2.8-config/contrib/gregbook/rpng-win.c
libpng-1.2.8-config/contrib/gregbook/rpng-x.c
libpng-1.2.8-config/contrib/gregbook/rpng2-win.c
libpng-1.2.8-config/contrib/gregbook/rpng2-x.c
..................... 생략 ...................
libpng-1.2.8-config/autogen.sh
libpng-1.2.8-config/config.guess
libpng-1.2.8-config/config.h.in
libpng-1.2.8-config/config.sub
libpng-1.2.8-config/configure.ac
libpng-1.2.8-config/depcomp
libpng-1.2.8-config/install-sh
libpng-1.2.8-config/missing
libpng-1.2.8-config/ltmain.sh
libpng-1.2.8-config/mkinstalldirs
libpng-1.2.8-config/test-pngtest.sh

[root@mrtg rrdbuild]# CPPFLAGS=-I$BUILD_DIR/lb/include
[root@mrtg rrdbuild]# LDFLAGS=-L$BUILD_DIR/lb/lib
[root@mrtg rrdbuild]# CFLAGS="-O3 -fPIC"
[root@mrtg rrdbuild]# export CPPFLAGS LDFLAGS CFLAGS
[root@mrtg rrdbuild]# cd libpng-1.2.8-config
[root@mrtg libpng-1.2.8-config]# ./configure --prefix=$BUILD_DIR/lb --disable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
..................... 생략 ......................
checking for memset... yes
checking for pow... no
checking for strrchr... yes
checking for sqrt... no
checking for sqrt in -lm... yes
checking for zlibVersion in -lz... yes
checking pkgconfig directory... ${prefix}/lib/pkgconfig
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands

[root@mrtg libpng-1.2.8-config]# make
make  all-am
make[1]: Entering directory `/usr/local/rrdbuild/libpng-1.2.8-config'
if /bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.     -O3 -fPIC -MT png.lo -MD -MP -MF ".deps/png.Tpo" \
          -c -o png.lo `test -f 'png.c' || echo './'`png.c; \
        then mv ".deps/png.Tpo" ".deps/png.Plo"; \
........................ 생략 ......................
( cat ./scripts/libpng-config-head.in; \
        echo prefix=\"/usr/local/rrdbuild/lb\"; \
        echo I_opts=\"-I/usr/local/rrdbuild/lb/include\"; \
        echo L_opts=\"-L/usr/local/rrdbuild/lb/lib\"; \
        echo R_opts=\"-Wl,-rpath,/usr/local/rrdbuild/lb/lib\"; \
        echo libs=\"-lpng12 -lz -lm\"; \
        cat ./scripts/libpng-config-body.in ) > libpng-config
cp libpng-config libpng12-config
make[1]: Leaving directory `/usr/local/rrdbuild/libpng-1.2.8-config'

[root@mrtg libpng-1.2.8-config]# make install
make[1]: Entering directory `/usr/local/rrdbuild/libpng-1.2.8-config'
/bin/sh ./mkinstalldirs /usr/local/rrdbuild/lb/bin
mkdir -p -- /usr/local/rrdbuild/lb/bin
 /usr/bin/install -c libpng-config /usr/local/rrdbuild/lb/bin/libpng-config
 /usr/bin/install -c libpng12-config /usr/local/rrdbuild/lb/bin/libpng12-config
/bin/sh ./mkinstalldirs /usr/local/rrdbuild/lb/lib
 /bin/sh ./libtool --mode=install /usr/bin/install -c  libpng12.la /usr/local/rrdbuild/lb/lib/libpng12.la
/usr/bin/install -c .libs/libpng12.lai /usr/local/rrdbuild/lb/lib/libpng12.la
......................... 생략 .........................
mkdir -p -- /usr/local/rrdbuild/lb/man/man5
 /usr/bin/install -c -m 644 ./png.5 /usr/local/rrdbuild/lb/man/man5/png.5
/bin/sh ./mkinstalldirs /usr/local/rrdbuild/lb/include/libpng
mkdir -p -- /usr/local/rrdbuild/lb/include/libpng
 /usr/bin/install -c -m 644 png.h /usr/local/rrdbuild/lb/include/libpng/png.h
 /usr/bin/install -c -m 644 pngconf.h /usr/local/rrdbuild/lb/include/libpng/pngconf.h
make[1]: Leaving directory `/usr/local/rrdbuild/libpng-1.2.8-config'
[root@mrtg libpng-1.2.8-config]#

libpng 설치가 완료 되었다.




STEP 3.

freetype2를 설치한다.

[root@mrtg libpng-1.2.8-config]# cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget ftp://ftp.netlabs.org/pub/Cairo/cairo-1.0.2-2005.11.01/cairo-1.0.2-os2-deps/freetype-2.1.10.tar.gz
[root@mrtg freetype-2.1.10]# tar xvfz freetype-2.1.10.tar.gz
....................... 생략 .........................
freetype-2.1.10/src/type42/type42.c
freetype-2.1.10/src/winfonts/
freetype-2.1.10/src/winfonts/fnterrs.h
freetype-2.1.10/src/winfonts/Jamfile
freetype-2.1.10/src/winfonts/module.mk
freetype-2.1.10/src/winfonts/rules.mk
freetype-2.1.10/src/winfonts/winfnt.c
freetype-2.1.10/src/winfonts/winfnt.h

[root@mrtg rrdbuild]# CPPFLAGS=-I$BUILD_DIR/lb/include
[root@mrtg rrdbuild]# LDFLAGS=-L$BUILD_DIR/lb/lib
[root@mrtg rrdbuild]# CFLAGS="-O3 -fPIC"
[root@mrtg rrdbuild]# export CPPFLAGS LDFLAGS CFLAGS
[root@mrtg rrdbuild]# cd freetype-2.1.10
[root@mrtg freetype-2.1.10]# ./configure --prefix=$BUILD_DIR/lb --disable-shared
cd builds/unix; ./configure --prefix=/usr/local/rrdbuild/lb --disable-shared
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
..................... 생략 .......................
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.

Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python).

make: Nothing to be done for `unix'.
[root@mrtg freetype-2.1.10]# set env GNUMAKE /usr/local/bin/make
[root@mrtg freetype-2.1.10]# ./configure --prefix=$BUILD_DIR/lb --disable-shared
cd builds/unix; ./configure --prefix=/usr/local/rrdbuild/lb --disable-shared
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc
........................ 생략 .........................
  configuration rules         ./builds/unix/unix.mk

If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.

Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python).

make: Nothing to be done for `unix'.
[root@mrtg freetype-2.1.10]# make
.................... 생략 ...................
2.1.10/objs/ftlzw.o /usr/local/rrdbuild/freetype-2.1.10/objs/otvalid.o /usr/local/rrdbuild/freetype-2.1.10/objs/pcf.o /usr/local/rrdbuild/freetype-2.1.10/objs/pfr.o /usr/local/rrdbuild/freetype-2.1.10/objs/psaux.o /usr/local/rrdbuild/freetype-2.1.10/objs/pshinter.o /usr/local/rrdbuild/freetype-2.1.10/objs/psnames.o /usr/local/rrdbuild/freetype-2.1.10/objs/raster.o /usr/local/rrdbuild/freetype-2.1.10/objs/sfnt.o /usr/local/rrdbuild/freetype-2.1.10/objs/smooth.o /usr/local/rrdbuild/freetype-2.1.10/objs/truetype.o /usr/local/rrdbuild/freetype-2.1.10/objs/type1.o /usr/local/rrdbuild/freetype-2.1.10/objs/type42.o /usr/local/rrdbuild/freetype-2.1.10/objs/winfnt.o
ranlib /usr/local/rrdbuild/freetype-2.1.10/objs/.libs/libfreetype.a
creating /usr/local/rrdbuild/freetype-2.1.10/objs/libfreetype.la
(cd /usr/local/rrdbuild/freetype-2.1.10/objs/.libs && rm -f libfreetype.la && ln -s ../libfreetype.la libfreetype.la)

[root@mrtg freetype-2.1.10]# make install
/usr/bin/install -c -m 644 ./builds/unix/ftconfig.h \
          /usr/local/rrdbuild/lb/include/freetype2/freetype/config/ftconfig.h
/usr/bin/install -c -m 755 ./builds/unix/freetype-config \
          /usr/local/rrdbuild/lb/bin/freetype-config
/usr/bin/install -c -m 644 ./builds/unix/freetype2.m4 \
          /usr/local/rrdbuild/lb/share/aclocal/freetype2.m4
/usr/bin/install -c -m 644 ./builds/unix/freetype2.pc \
          /usr/local/rrdbuild/lb/lib/pkgconfig/freetype2.pc

[root@mrtg freetype-2.1.10]#

freetype2 설치가 완료 되었다.




STEP 4.

libart-lgpl을 설치한다.

[root@mrtg freetype-2.1.10]# cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget http://ftp.se.debian.org/pub/gnome/sources/libart_lgpl/2.3/libart_lgpl-2.3.17.tar.gz
[root@mrtg rrdbuild]# tar xvfz libart_lgpl-2.3.17.tar.gz
libart_lgpl-2.3.17/
libart_lgpl-2.3.17/art_svp_vpath.h
libart_lgpl-2.3.17/art_svp_vpath_stroke.c
libart_lgpl-2.3.17/art_rgb_affine.c
libart_lgpl-2.3.17/art_svp_ops.h
libart_lgpl-2.3.17/art_uta_vpath.h
.................. 생략 ....................
libart_lgpl-2.3.17/art_render_gradient.c
libart_lgpl-2.3.17/art_rgb_affine.h
libart_lgpl-2.3.17/art_misc.c
libart_lgpl-2.3.17/art_render.c
libart_lgpl-2.3.17/art_rgb_pixbuf_affine.c

[root@mrtg rrdbuild]# cd libart_lgpl-2.3.17
[root@mrtg libart_lgpl-2.3.17]# CFLAGS="-O3 -fPIC"
[root@mrtg libart_lgpl-2.3.17]# export CPPFLAGS
[root@mrtg libart_lgpl-2.3.17]# ./configure --prefix=$BUILD_DIR/lb --disable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets $(MAKE)... yes
checking for working aclocal-1.4... found
................... 생략 .....................
config.status: creating libart-2.0.pc
config.status: creating libart-2.0-uninstalled.pc
config.status: creating libart-zip
config.status: creating config.h
config.status: executing default-1 commands
config.status: executing default commands
[root@mrtg libart_lgpl-2.3.17]# make

.................... 생략 ......................
testart.c:520: warning: ?utput_svp_ppm?defined but not used
/bin/sh ./libtool --mode=link gcc  -O3 -fPIC -Wall -Wmissing-prototypes -L/usr/local/rrdbuild/lb/lib -o testart  testart.o ./libart_lgpl_2.la -lm
gcc -O3 -fPIC -Wall -Wmissing-prototypes -o testart testart.o  -L/usr/local/rrdbuild/lb/lib ./.libs/libart_lgpl_2.a -lm
gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -I. -DLIBART_COMPILATION    -O3 -fPIC -Wall -Wmissing-prototypes -c testuta.c
/bin/sh ./libtool --mode=link gcc  -O3 -fPIC -Wall -Wmissing-prototypes -L/usr/local/rrdbuild/lb/lib -o testuta  testuta.o ./libart_lgpl_2.la -lm
gcc -O3 -fPIC -Wall -Wmissing-prototypes -o testuta testuta.o  -L/usr/local/rrdbuild/lb/lib ./.libs/libart_lgpl_2.a -lm
cp -f libart-config libart2-config

[root@mrtg libart_lgpl-2.3.17]# make install
make[1]: Entering directory `/usr/local/rrdbuild/libart_lgpl-2.3.17'
/bin/sh ./mkinstalldirs /usr/local/rrdbuild/lb/lib
/bin/sh ./libtool  --mode=install /usr/bin/install -c libart_lgpl_2.la /usr/local/rrdbuild/lb/lib/libart_lgpl_2.la
/usr/bin/install -c .libs/libart_lgpl_2.lai /usr/local/rrdbuild/lb/lib/libart_lgpl_2.la
/usr/bin/install -c .libs/libart_lgpl_2.a /usr/local/rrdbuild/lb/lib/libart_lgpl_2.a
ranlib /usr/local/rrdbuild/lb/lib/libart_lgpl_2.a
chmod 644 /usr/local/rrdbuild/lb/lib/libart_lgpl_2.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/rrdbuild/lb/lib
....................... 생략 .....................
 /usr/bin/install -c -m 644 art_vpath_bpath.h /usr/local/rrdbuild/lb/include/libart-2.0/libart_lgpl/art_vpath_bpath.h
 /usr/bin/install -c -m 644 art_vpath_dash.h /usr/local/rrdbuild/lb/include/libart-2.0/libart_lgpl/art_vpath_dash.h
 /usr/bin/install -c -m 644 art_vpath_svp.h /usr/local/rrdbuild/lb/include/libart-2.0/libart_lgpl/art_vpath_svp.h
 /usr/bin/install -c -m 644 libart.h /usr/local/rrdbuild/lb/include/libart-2.0/libart_lgpl/libart.h
 /usr/bin/install -c -m 644 libart-features.h /usr/local/rrdbuild/lb/include/libart-2.0/libart_lgpl/libart-features.h
make[1]: Leaving directory `/usr/local/rrdbuild/libart_lgpl-2.3.17'

[root@mrtg libart_lgpl-2.3.17]#

지금까지 설치한 라이브러리는 모두 static 형태이므로 라이브러리를 사용하기 위하여 ranlib을 사용한다.

[root@mrtg libart_lgpl-2.3.17]# ranlib $BUILD_DIR/lb/lib/*.a

libart-lgpl 설치가 완료 되었다.





STEP 5.

gd를 설치 한다.

[root@mrtg libart_lgpl-2.3.17]# cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
[root@mrtg rrdbuild]# tar xvfz gd-2.0.33.tar.gz                              
gd-2.0.33/
gd-2.0.33/config/
gd-2.0.33/config/Makefile.am
gd-2.0.33/config/Makefile.in
............................ 생략 .............................
gd-2.0.33/test/Makefile.in
gd-2.0.33/test/gdtest.gd2
gd-2.0.33/test/gdtest.png
gd-2.0.33/test/gdtest_200_300_150_100.png
gd-2.0.33/test/gdtest_merge.png
gd-2.0.33/test/gdtest_wbmp_to_png.png

[root@mrtg rrdbuild]# cd gd-2.0.33
[root@mrtg gd-2.0.33]# CPPFLAGS=-I$BUILD_DIR/lb/include
[root@mrtg gd-2.0.33]# export CPPFLAGS
[root@mrtg gd-2.0.33]# ./configure --prefix=$BUILD_DIR/lb --disable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
........................ 생략 ......................
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating config/gdlib-config
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles commands

[root@mrtg gd-2.0.33]# make
make  all-recursive
make[1]: Entering directory `/usr/local/rrdbuild/gd-2.0.33'
Making all in config
make[2]: Entering directory `/usr/local/rrdbuild/gd-2.0.33/config'
make[2]: Nothing to be done for `all'.
................... 생략 ................
gd_png.c:741: error: expected ')' before 'gdMalloc'
gd_png.c:798: error: expected ')' before 'gdMalloc'
make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory `/usr/local/rrdbuild/gd-2.0.33'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/rrdbuild/gd-2.0.33'
make: *** [all] Error 2

[root@mrtg gd-2.0.33]# make install
Making install in config
make[1]: Entering directory `/usr/local/rrdbuild/gd-2.0.33/config'
make[2]: Entering directory `/usr/local/rrdbuild/gd-2.0.33/config'
test -z "/usr/local/rrdbuild/lb/bin" || mkdir -p -- "/usr/local/rrdbuild/lb/bin"
 /usr/bin/install -c 'gdlib-config' '/usr/local/rrdbuild/lb/bin/gdlib-config'
..................... 생략 ..................
gd_png.c:688: error: 'palette' undeclared (first use in this function)
gd_png.c:719: error: 'png_bytep' undeclared (first use in this function)
gd_png.c:719: error: 'row_pointers' undeclared (first use in this function)
gd_png.c:725: error: 'prow_pointers' undeclared (first use in this function)
gd_png.c:741: error: expected ')' before 'gdMalloc'
gd_png.c:798: error: expected ')' before 'gdMalloc'
make[1]: *** [gd_png.lo] Error 1
make[1]: Leaving directory `/usr/local/rrdbuild/gd-2.0.33'
make: *** [install-recursive] Error 1

[root@mrtg gd-2.0.33]#

gd 설치가 완료 되었다.

GD 컴파일시 위에서 설치한 라이브러리가 인식되는지 반드시 확인한다. freetype을 인식하지 못하는 경우가 있는데, 이때는 PATH에 /usr/local/rrdbuild/lb/bin or /usr/local/rrdbuild/lib/include를 추가한다.

[root@mrtg gd-2.0.33]# vi ~/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME


아래와 같이 변경한다.

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/rrdbuild/lb/bin:/usr/local/rrdbuild/lib/include

export PATH
unset USERNAME


변경된 PATH를 적용 시키려면 아래와 같이 명령어를 입력한다.

[root@mrtg gd-2.0.33]# source ~/.bash_profile




STEP 6.

RRDTOOL을 설치한다.

[root@mrtg gd-2.0.33]# IR=-I$BUILD_DIR/lb/include
[root@mrtg gd-2.0.33]# CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
[root@mrtg gd-2.0.33]# LDFLAGS="-L$BUILD_DIR/lb/lib"
[root@mrtg gd-2.0.33]# CFLAGS=-O3
[root@mrtg gd-2.0.33]# export CPPFLAGS LDFLAGS CFLAGS
[root@mrtg gd-2.0.33]# cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget ftp://ftp.free.fr/.mirrors1/ftp.netbsd.org/packages/distfiles/rrdtool-1.2.12.tar.gz
[root@mrtg rrdbuild]# tar xvfz rrdtool-1.2.12.tar.gz                                                                   
rrdtool-1.2.12/bindings/tcl/README
rrdtool-1.2.12/bindings/tcl/Makefile.am
rrdtool-1.2.12/bindings/tcl/Makefile.in
rrdtool-1.2.12/bindings/tcl/ifOctets.tcl.in
rrdtool-1.2.12/bindings/tcl/tclrrd.c
................... 생략 .....................
rrdtool-1.2.12/doc/rrdgraph_data.txt
rrdtool-1.2.12/doc/rrdresize.txt
rrdtool-1.2.12/doc/rrdtutorial.txt
rrdtool-1.2.12/doc/rrdtool-dump.dtd
rrdtool-1.2.12/doc/rrdtool-xport.dtd
[root@mrtg rrdbuild]# cd rrdtool-1.2.12
[root@mrtg rrdtool-1.2.12]#
[root@mrtg rrdtool-1.2.12]# ./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
..................... 생략 .....................
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default commands
checking in... and out again
ordering CD from
http://people.ee.ethz.ch/~oetiker/wish .... just kidding ;-)

----------------------------------------------------------------
Config is DONE!

          With MMAP IO: yes
          Perl Modules: perl_piped perl_shared
           Perl Binary: /usr/bin/perl
          Perl Version: 5.8.8
          Perl Options: PREFIX=/usr/local/rrdtool-1.2.12 LIB=/usr/local/rrdtool-1.2.12/lib/perl/5.8.8
    Build Tcl Bindings: no
 Build Python Bindings: no
          Build rrdcgi: yes
       Build librrd MT: yes


Type 'make' to compile the software and use 'make install' to
install everything to: /usr/local/rrdtool-1.2.12.

       ... that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go to
http://people.ee.ethz.ch/oetiker/wish and
place an order.

                               -- Tobi Oetiker <tobi@oetiker.ch>
----------------------------------------------------------------

[root@mrtg rrdtool-1.2.12]# make clean
Making clean in examples
make[1]: Entering directory `/usr/local/rrdbuild/rrdtool-1.2.12/examples'
rm -rf .libs _libs
rm -f *.lo
make[1]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12/examples'
.................... 생략 ........................
make[1]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12/src'
Making clean in .
make[1]: Entering directory `/usr/local/rrdbuild/rrdtool-1.2.12'
test -z "config.cache" || rm -f config.cache
rm -rf .libs _libs
rm -f *.lo
make[1]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12'

[root@mrtg rrdtool-1.2.12]# make
.................... 생략 ........................
pod2html --infile=rrdtutorial.pod --outfile=rrdtutorial.html --noindex --htmlroot=. --podpath=. --title=rrdtutorial
ln -s ../bindings/perl-shared/RRDs.pm RRDs.pod
pod2html --infile=RRDs.pod --outfile=RRDs.html --noindex --htmlroot=. --podpath=. --title=RRDs
ln -s ../bindings/perl-piped/RRDp.pm RRDp.pod
pod2html --infile=RRDp.pod --outfile=RRDp.html --noindex --htmlroot=. --podpath=. --title=RRDp
make[2]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12/doc'
Making all in examples
make[2]: Entering directory `/usr/local/rrdbuild/rrdtool-1.2.12/examples'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12/examples'
make[2]: Entering directory `/usr/local/rrdbuild/rrdtool-1.2.12'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12'
make[1]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12'

[root@mrtg rrdtool-1.2.12]# make install
.................... 생략 ........................
 /usr/bin/install -c 'cgi-demo.cgi' '/usr/local/rrdtool-1.2.12/share/rrdtool/examples/cgi-demo.cgi'
 /usr/bin/install -c 'piped-demo.pl' '/usr/local/rrdtool-1.2.12/share/rrdtool/examples/piped-demo.pl'
 /usr/bin/install -c 'shared-demo.pl' '/usr/local/rrdtool-1.2.12/share/rrdtool/examples/shared-demo.pl'
 /usr/bin/install -c 'stripes.pl' '/usr/local/rrdtool-1.2.12/share/rrdtool/examples/stripes.pl'
 /usr/bin/install -c 'bigtops.pl' '/usr/local/rrdtool-1.2.12/share/rrdtool/examples/bigtops.pl'
 /usr/bin/install -c 'minmax.pl' '/usr/local/rrdtool-1.2.12/share/rrdtool/examples/minmax.pl'
 /usr/bin/install -c '4charts.pl' '/usr/local/rrdtool-1.2.12/share/rrdtool/examples/4charts.pl'
make[2]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12/examples'
make[1]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12/examples'
make[1]: Entering directory `/usr/local/rrdbuild/rrdtool-1.2.12'
make[2]: Entering directory `/usr/local/rrdbuild/rrdtool-1.2.12'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12'
make[1]: Leaving directory `/usr/local/rrdbuild/rrdtool-1.2.12'

[root@mrtg rrdtool-1.2.12]#





STEP 7.

MRTG를 설치 한다.

[root@mrtg rrdtool-1.2.12]# cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget ftp://ftp.ps.pl/dsk0/ftp.freebsd.org/FreeBSD/ports/distfiles/mrtg-2.12.2.tar.gz
[root@mrtg mrtg-2.12.2]# tar xvfz mrtg-2.12.2.tar.gz
....................... 생략 ........................
mrtg-2.12.2/doc/mrtg-squid.1
mrtg-2.12.2/doc/mrtg-squid.html
mrtg-2.12.2/doc/mrtg-squid.pod
mrtg-2.12.2/doc/mrtg-squid.txt
mrtg-2.12.2/doc/mrtg-unix-guide.1
mrtg-2.12.2/doc/mrtg-unix-guide.html
mrtg-2.12.2/doc/mrtg-unix-guide.pod
mrtg-2.12.2/doc/mrtg-unix-guide.txt
mrtg-2.12.2/doc/mrtg-webserver.1
mrtg-2.12.2/doc/mrtg-webserver.html
mrtg-2.12.2/doc/mrtg-webserver.pod
mrtg-2.12.2/doc/mrtg-webserver.txt
mrtg-2.12.2/doc/mrtg.1
mrtg-2.12.2/doc/mrtg.html
mrtg-2.12.2/doc/mrtg.pod
mrtg-2.12.2/doc/mrtg.txt

[root@mrtg rrdbuild]# cd mrtg-2.12.2
[root@mrtg mrtg-2.12.2]# ./configure --prefix=/usr/local/mrtg-2  --with-gd=/usr/loca/rrdbuild/lb --with-z=/usr/local/rrdbuild/lb --with-png=/usr/local/rrdbuild/lb
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
....................... 생략 ........................
** Ooops, one of many bad things happened:

   a)  You don't have the GD library installed.
       Get it from
http://www.boutell.com, compile it and
       use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify
       its location. You might also have to use --with-z-inc,
             --with-z-lib and --with-png-inc, --with-png-lib for gd
             versions 1.6 and higher.  Check config.log for more
       information on the problem.

   b)  You have the GD library installed, but not the gd.h
       header file.  Download the source (see above) and use
       --with-gd-inc=DIR to specify where the file can be found.

   c)  You have the library and the header file installed, but
       you also have a shared GD library in the same directory.
       Remove the shared library files and/or links (e.g.
       libgd.so.2.0.0, libgd.so and libgd.so.2).  This is especially
             likely if you're using a recent (post 1.8.4) version of GD
       and didn't configure it with --disable-shared.

   d)  You have gd library installed and also it's headers, but you are
       missing libpng (and headers) or freetype (and headers)
       (mrtg does not use freetype, but if your copy of gd is precompiled
       against it, you have to install it ...

   Consider following the instructions in doc/mrtg-unix-guide.txt
[root@mrtg mrtg-2.12.2]# --with-z=/usr/local/rrdbuild/lb  -with-png=/usr/local/rrdbuild/lb
-bash: --with-z=/usr/local/rrdbuild/lb: No such file or directory

[root@mrtg mrtg-2.12.2]#

gd관련 라이브러리가 설치되지 않아서 mrtg를 설치 할 수 없으므로, 관련 라이브러리를 yum을 통해 설치한다.

[root@mrtg mrtg-2.12.2]# yum -y install gd-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons:
ftp.daum.net
 * base: ftp.daum.net
 * extras: ftp.daum.net
 * updates: ftp.daum.net
addons                                                                                      |  951 B     00:00    
base                                                                                      | 2.1 kB     00:00    
extras                                                                                      | 2.1 kB     00:00    
updates                                                                                      | 1.9 kB     00:00    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gd-devel.i386 0:2.0.33-9.4.el5_4.2 set to be updated
--> Processing Dependency: gd = 2.0.33-9.4.el5_4.2 for package: gd-devel
--> Processing Dependency: freetype-devel for package: gd-devel
--> Processing Dependency: libpng-devel for package: gd-devel
--> Processing Dependency: libXpm-devel for package: gd-devel
--> Processing Dependency: libX11-devel for package: gd-devel
--> Processing Dependency: libjpeg-devel for package: gd-devel
--> Processing Dependency: fontconfig-devel for package: gd-devel
--> Running transaction check
---> Package fontconfig-devel.i386 0:2.4.1-7.el5 set to be updated
---> Package freetype-devel.i386 0:2.2.1-21.el5_3 set to be updated
---> Package gd.i386 0:2.0.33-9.4.el5_4.2 set to be updated
---> Package libX11-devel.i386 0:1.0.3-11.el5 set to be updated
--> Processing Dependency: xorg-x11-proto-devel >= 7.1-2 for package: libX11-devel
--> Processing Dependency: libXau-devel for package: libX11-devel
--> Processing Dependency: libXdmcp-devel for package: libX11-devel
---> Package libXpm-devel.i386 0:3.5.5-3 set to be updated
---> Package libjpeg-devel.i386 0:6b-37 set to be updated
---> Package libpng-devel.i386 2:1.2.10-7.1.el5_3.2 set to be updated
--> Running transaction check
---> Package libXau-devel.i386 0:1.0.1-3.1 set to be updated
---> Package libXdmcp-devel.i386 0:1.0.1-2.1 set to be updated
---> Package xorg-x11-proto-devel.i386 0:7.1-13.el5 set to be updated
--> Processing Dependency: mesa-libGL-devel for package: xorg-x11-proto-devel
--> Running transaction check
---> Package mesa-libGL-devel.i386 0:6.5.1-7.7.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package                       Arch                             Version                          Repository                            Size
===========================================================================================================
Installing:
 gd-devel                       i386                       2.0.33-9.4.el5_4.2                      updates                               97 k
Installing for dependencies:
 fontconfig-devel             i386                            2.4.1-7.el5                             base                                168 k
 freetype-devel               i386                            2.2.1-21.el5_3                         base                                146 k
 libX11-devel                  i386                            1.0.3-11.el5                            base                                661 k
 libXau-devel                  i386                             1.0.1-3.1                              base                                 11 k
 libXdmcp-devel             i386                             1.0.1-2.1                               base                                7.5 k
 libXpm-devel                 i386                              3.5.5-3                                base                                31 k
 libjpeg-devel                 i386                               6b-37                                 base                               105 k
 libpng-devel                  i386                       2:1.2.10-7.1.el5_3.2                      base                               181 k
 mesa-libGL-devel         i386                             6.5.1-7.7.el5                          base                               466 k
 xorg-x11-proto-devel     i386                              7.1-13.el5                             base                              247 k
Updating for dependencies:
 gd                       i386                                 2.0.33-9.4.el5_4.2                      updates                            154 k

Transaction Summary
===================================================================================================================================================================================================================================================================================
Install     11 Package(s)        
Update       1 Package(s)        
Remove       0 Package(s)        

Total download size: 2.2 M
Downloading Packages:
(1/12): libXdmcp-devel-1.0.1-2.1.i386.rpm                                                                           | 7.5 kB     00:00    
(2/12): libXau-devel-1.0.1-3.1.i386.rpm                                                                               |  11 kB     00:00    
(3/12): libXpm-devel-3.5.5-3.i386.rpm                                                                                 |  31 kB     00:00    
(4/12): gd-devel-2.0.33-9.4.el5_4.2.i386.rpm                                                                         |  97 kB     00:00    
(5/12): libjpeg-devel-6b-37.i386.rpm                                                                                   | 105 kB     00:00    
(6/12): freetype-devel-2.2.1-21.el5_3.i386.rpm                                                                      | 146 kB     00:00    
(7/12): gd-2.0.33-9.4.el5_4.2.i386.rpm                                                                                 | 154 kB     00:00    
(8/12): fontconfig-devel-2.4.1-7.el5.i386.rpm                                                                        | 168 kB     00:00    
(9/12): libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm                                                                    | 181 kB     00:00    
(10/12): xorg-x11-proto-devel-7.1-13.el5.i386.rpm                                                                | 247 kB     00:00    
(11/12): mesa-libGL-devel-6.5.1-7.7.el5.i386.rpm                                                                | 466 kB     00:00    
(12/12): libX11-devel-1.0.3-11.el5.i386.rpm                                                                          | 661 kB     00:00    
------------------------------------------------------------------------------------------------------------Total                                                                                                                1.6 MB/s | 2.2 MB     00:01    
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey                                                                                                                   | 1.5 kB     00:00    
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <
centos-5-key@centos.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : freetype-devel                                                                                               1/13
  Installing     : fontconfig-devel                                                                                             2/13
  Installing     : libpng-devel                                                                                                  3/13
  Installing     : libXau-devel                                                                                                  4/13
  Installing     : libjpeg-devel                                                                                                  5/13
  Updating       : gd                                                                                                              6/13
  Installing     : xorg-x11-proto-devel                                                                                      7/13
  Installing     : libXdmcp-devel                                                                                              8/13
  Installing     : libX11-devel                                                                                                   9/13
  Installing     : mesa-libGL-devel                                                                                          10/13
  Installing     : libXpm-devel                                                                                                11/13
  Installing     : gd-devel                                                                                                      12/13
  Cleanup        : gd                                                                                                             13/13

Installed:
  gd-devel.i386 0:2.0.33-9.4.el5_4.2
Dependency Installed:
  fontconfig-devel.i386 0:2.4.1-7.el5    freetype-devel.i386 0:2.2.1-21.el5_3    libX11-devel.i386 0:1.0.3-11.el5  libXau-devel.i386 0:1.0.1-3.1  libXdmcp-devel.i386 0:1.0.1-2.1  libXpm-devel.i386 0:3.5.5-3  libjpeg-devel.i386 0:6b-37  libpng-devel.i386 2:1.2.10-7.1.el5_3.2
  mesa-libGL-devel.i386 0:6.5.1-7.7.el5  xorg-x11-proto-devel.i386 0:7.1-13.el5

Dependency Updated:
  gd.i386 0:2.0.33-9.4.el5_4.2                                                                                                                                                                                                                                                    

Complete!
[root@mrtg mrtg-2.12.2]#

gd 관련 라이브러리를 설치 하였으므로, mrtg를 다시 설치 해 본다.

[root@mrtg mrtg-2.12.2]# ./configure --prefix=/usr/local/mrtg-2  --with-gd=/usr/loca/rrdbuild/lb --with-z=/usr/local/rrdbuild/lb --with-png=/usr/local/rrdbuild/lb
........................ 생략 ........................
checking for gdImagePng_jpg in -lgd... no
checking for gdImagePng_jpg_ft in -lgd... no
checking for gdImageGd in -lgd... yes
checking gd.h usability... yes
checking gd.h presence... yes
checking for gd.h... yes
checking the weather... (cached) it's fine
checking if we can use GCC-specific compiler options... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
ordering CD from
http://people.ee.ethz.ch/~oetiker/wish .... just kidding ;-)

----------------------------------------------------------------
Config is DONE!

Type 'make' to compile the software

       ... that wishlist mentioned above does really exist. So if
you feel like showing your appreciation for MRTG, this is the
place to go. I just love CDs and DVDs

                            -- Tobi Oetiker <oetiker@ee.ethz.ch>
----------------------------------------------------------------
[root@mrtg mrtg-2.12.2]# make
gcc -I/usr/local/rrdbuild/lb/include -I/usr/local/rrdbuild/lb/include/libart-2.0 -I/usr/local/rrdbuild/lb/include/freetype2 -I/usr/local/rrdbuild/lb/include/libpng -I/usr/loca/rrdbuild/lb -I/usr/local/rrdbuild/lb -I/usr/local/rrdbuild/lb -DGFORM_GD=gdImagePng -O3 -Wall -Wpointer-arith -Wcast-align -Wmissing-declarations -Wnested-externs -Winline -W -DHAVE_CONFIG_H -c ./src/rateup.c -o bin/rateup.o
./src/rateup.c: In function ?mage?
./src/rateup.c:1142: warning: pointer targets in passing argument 5 of ?dImageString?differ in signedness
LD_RUN_PATH=/usr/local/rrdbuild/lb:/usr/local/rrdbuild/lb:/usr/loca/rrdbuild/lb gcc bin/rateup.o -o bin/rateup -L/usr/local/rrdbuild/lb/lib -L/usr/loca/rrdbuild/lb -L/usr/local/rrdbuild/lb -L/usr/local/rrdbuild/lb  -Wl,-Bstatic -lgd -lpng -lz -Wl,-Bdynamic  -lm
/usr/bin/perl -0777 -p -i~ -e
's@^#!\s*/\S*perl@#! /usr/bin/perl@' ./bin/cfgmaker ./bin/indexmaker ./bin/mrtg
/usr/bin/perl -0777 -p -i~ -e
's@GRAPHFMT="...";@GRAPHFMT="png";@' ./bin/mrtg ./bin/indexmaker
[root@mrtg mrtg-2.12.2]# make install
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/bin
mkdir /usr/local/mrtg-2
mkdir /usr/local/mrtg-2/bin
for x in ./bin/mrtg ./bin/cfgmaker ./bin/indexmaker; do \
          /usr/bin/install -c -m 755 $x /usr/local/mrtg-2/bin; done
for x in bin/rateup; do \
          /usr/bin/install -c -m 755 $x /usr/local/mrtg-2/bin; done
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/lib/mrtg2/Pod
mkdir /usr/local/mrtg-2/lib
mkdir /usr/local/mrtg-2/lib/mrtg2
mkdir /usr/local/mrtg-2/lib/mrtg2/Pod
for x in ./lib/mrtg2/*.pm; do \
          /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/lib/mrtg2; done
for x in ./lib/mrtg2/Pod/*.pm; do \
          /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/lib/mrtg2/Pod; done
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/share/mrtg2/icons
mkdir /usr/local/mrtg-2/share
mkdir /usr/local/mrtg-2/share/mrtg2
mkdir /usr/local/mrtg-2/share/mrtg2/icons
for x in ./images/*.gif ./images/*.png; do \
          /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/share/mrtg2/icons; done
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/share/doc/mrtg2
mkdir /usr/local/mrtg-2/share/doc
mkdir /usr/local/mrtg-2/share/doc/mrtg2
(cd .; for x in COPYING COPYRIGHT README CHANGES THANKS doc/*.pod doc/*.html doc/*.wml doc/*.txt doc/*.png; do \
          /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/share/doc/mrtg2; done)
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/man/man1
mkdir /usr/local/mrtg-2/man
mkdir /usr/local/mrtg-2/man/man1
for x in ./doc/*.1; do \
          /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/man/man1; done

[root@mrtg mrtg-2.12.2]#


MRTG 설치가 완료 되었으며, MRTG나 RRDTOOL을 사용하기 위해서 PATH를 지정하여 편리하게 사용하기로 한다.
[root@mrtg mrtg-2.12.2]# vi ~root/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/rrdbuild/lb/bin:/usr/local/rrdbuild/lib/include:/usr/local/mrtg-2/bin/:/usr/local/rrdtool-1.2.12/bin

export PATH
unset USERNAME



위에 굵게 표시 된 부분을 추가한다.

[root@mrtg mrtg-2.12.2]# source ~root/.bash_profile
[root@mrtg mrtg-2.12.2]#

변경된 PATH를 불러와 설정을 적용 시킨다. 이 설정 이후부터는 서버를 재부팅 하더라도 PATH가 적용된다.

[root@mrtg mrtg-2.12.2]# mrtg
-----------------------------------------------------------------------
ERROR: Mrtg will most likely not work properly when the environment
       variable LANG is set to UTF-8. Please run mrtg in an environment
       where this is not the case. Try the following command to start:

       env LANG=C /usr/local/mrtg-2/bin/mrtg 
-----------------------------------------------------------------------

[root@mrtg mrtg-2.12.2]#

MRTG가 제대로 적용 되었는지 확인하기 위해서 mrtg를 실행시켰다.
mrtg가 실행은 되었지만, 언어 설정이 맞지 않아 동작을 하지 않으므로 이에 맞게 설정을 변경 해주어야 한다.
X윈도에서 한글로 사용하는 것이 편리하다는 생각으로 한글로 설치도 해보고, 영문으로 설치도 해보았는데 근본적으로 위에 맡게 언어를 설정해주면 이 문제가 해결 되었다.

[root@mrtg mrtg-2.12.2]# vi /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"


아래와 같이 변경하고 저장한다.

LANG="C"
SYSFONT="latarcyrheb-sun16"



[root@mrtg mrtg-2.12.2]# reboot

Broadcast message from root (pts/1) (Thu Mar 25 11:52:28 2010):

The system is going down for reboot NOW!
[root@mrtg mrtg-2.12.2]#

재부팅을 하여도 설정사항이 제대로 적용 되었는지 확인하기 위해서 재부팅을 하였다.



서버가 부팅 된 후 MRTG가 제대로 동작하는지 확인 해 본다.

[root@mrtg ~]# mrtg
Usage: mrtg <config-file>

mrtg-2.12.2 is the Multi Router Traffic Grapher.

If you want to know more about this tool, you might want
to read the docs. They came together with mrtg!

Home: http://people.ee.ethz.ch/~oetiker/webtools/mrtg/

[root@mrtg ~]#

MRTG가 제대로 작동하며, 이로써 MRTG 설치가 완료 되었다.
MRTG를 사용 하기 위해서 cfg 파일과 rrd 파일 그리고 log를 저장 할 곳이 필요 할 것이다.
내가 설치 한 서버에서는 mrtg를 관리 할 사용자를 생성하였으며, 그 디렉토리 안에 cfg, data, log 라는 이름으로 각 저장 할 디렉토리를 추가로 생성 해 주었다.

[root@mrtg ~]# adduser mrtg
[root@mrtg ~]# cd /home/mrtg/
[root@mrtg mrtg]# mkdir cfg
[root@mrtg mrtg]# mkdir data
[root@mrtg mrtg]# mkdir log




STEP 8.

웹에서 mrtg를 세팅 한 후 볼 수 있게 Apache를 설치한다.

[root@mrtg mrtg-2.12.2]# cd /usr/local/rrdbuild
[root@mrtg rrdbuild]# lftpget http://mirror.apache-kr.org/httpd/httpd-2.2.15.tar.gz
[root@mrtg rrdbuild]# tar xvfz httpd-2.2.15.tar.gz
..................... 생략 ...................
httpd-2.2.15/server/mpm_common.c
httpd-2.2.15/server/.indent.pro
httpd-2.2.15/server/util_charset.c
httpd-2.2.15/server/eoc_bucket.c
httpd-2.2.15/BuildAll.dsp
httpd-2.2.15/acinclude.m4
httpd-2.2.15/Makefile.win
httpd-2.2.15/httpd.spec
httpd-2.2.15/configure
httpd-2.2.15/configure.in
httpd-2.2.15/VERSIONING
httpd-2.2.15/README
httpd-2.2.15/LAYOUT
httpd-2.2.15/buildconf
httpd-2.2.15/.gdbinit
[root@mrtg rrdbuild]# cd httpd-2.2.15
[root@mrtg httpd-2.2.15]# ./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-so --enable-rewrite
...................... 생략 ........................
config.status: creating docs/conf/extra/httpd-mpm.conf
config.status: creating docs/conf/extra/httpd-multilang-errordoc.conf
config.status: creating docs/conf/extra/httpd-ssl.conf
config.status: creating docs/conf/extra/httpd-userdir.conf
config.status: creating docs/conf/extra/httpd-vhosts.conf
config.status: creating include/ap_config_layout.h
config.status: creating support/apxs
config.status: creating support/apachectl
config.status: creating support/dbmmanage
config.status: creating support/envvars-std
config.status: creating support/log_server_status
config.status: creating support/logresolve.pl
config.status: creating support/phf_abuse_log.cgi
config.status: creating support/split-logfile
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands

[root@mrtg httpd-2.2.15]#

--prefix=/usr/local/apache는 /usr/local/apache에 설치한다.

--enable-mods-shared=all은 DSO모드라고 한다는데, 모듈이 추가로 설치 되었을 때 다시 컴파일 하지 않고 추가 할 수 있어서 좋다고 한다.

--enable-so는 DSO모드를 활성화 한다고 한다.

--enable-rewrite는 URL 재작성 모듈을 활성화 한다.


[root@mrtg httpd-2.2.15]# make
......................... 생략 ...............................
/usr/local/rrdbuild/httpd-2.2.15/srclib/apr/libtool --silent --mode=compile gcc -pthread  -O3  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -I/usr/local/rrdbuild/lb/include -I/usr/local/rrdbuild/lb/include/libart-2.0 -I/usr/local/rrdbuild/lb/include/freetype2 -I/usr/local/rrdbuild/lb/include/libpng  -I/usr/local/rrdbuild/httpd-2.2.15/srclib/pcre -I. -I/usr/local/rrdbuild/httpd-2.2.15/os/unix -I/usr/local/rrdbuild/httpd-2.2.15/server/mpm/prefork -I/usr/local/rrdbuild/httpd-2.2.15/modules/http -I/usr/local/rrdbuild/httpd-2.2.15/modules/filters -I/usr/local/rrdbuild/httpd-2.2.15/modules/proxy -I/usr/local/rrdbuild/httpd-2.2.15/include -I/usr/local/rrdbuild/httpd-2.2.15/modules/generators -I/usr/local/rrdbuild/httpd-2.2.15/modules/mappers -I/usr/local/rrdbuild/httpd-2.2.15/modules/database -I/usr/local/rrdbuild/httpd-2.2.15/srclib/apr/include -I/usr/local/rrdbuild/httpd-2.2.15/srclib/apr-util/include -I/usr/local/rrdbuild/httpd-2.2.15/server -I/usr/local/rrdbuild/httpd-2.2.15/modules/proxy/../generators -I/usr/local/rrdbuild/httpd-2.2.15/modules/ssl -I/usr/local/rrdbuild/httpd-2.2.15/modules/dav/main -prefer-pic -c mod_rewrite.c && touch mod_rewrite.slo
/usr/local/rrdbuild/httpd-2.2.15/srclib/apr/libtool --silent --mode=link gcc -pthread  -O3    -L/usr/local/rrdbuild/lb/lib    -o mod_rewrite.la -rpath /usr/local/apache/modules -module -avoid-version  mod_rewrite.lo
make[4]: Leaving directory `/usr/local/rrdbuild/httpd-2.2.15/modules/mappers'
make[3]: Leaving directory `/usr/local/rrdbuild/httpd-2.2.15/modules/mappers'
make[2]: Leaving directory `/usr/local/rrdbuild/httpd-2.2.15/modules'
make[2]: Entering directory `/usr/local/rrdbuild/httpd-2.2.15/support'
make[2]: Leaving directory `/usr/local/rrdbuild/httpd-2.2.15/support'

make[1]: Leaving directory `/usr/local/rrdbuild/httpd-2.2.15'
[root@mrtg httpd-2.2.15]# make install
................... 생략 ...................
mkdir /usr/local/apache/htdocs
Installing error documents
mkdir /usr/local/apache/error
Installing icons
mkdir /usr/local/apache/icons
mkdir /usr/local/apache/logs
Installing CGIs
mkdir /usr/local/apache/cgi-bin
Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache/man
mkdir /usr/local/apache/man/man1
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
make[1]: Leaving directory `/usr/local/rrdbuild/httpd-2.2.15'

[root@mrtg httpd-2.2.15]#

Apache의 환경을 설정한다.

[root@mrtg httpd-2.2.15]# vi /usr/local/apache/conf/httpd.conf
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>
</IfModule>


위 부분을 아래와 같이 변경한다.

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch. 
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nobody

</IfModule>
</IfModule>



# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName
www.example.com:80

위 부분을 아래와 같이 주석을 제거해 준다. 그리고 IP에 맞게 웹서버를 등록 해 준다.

필자의 경우에는 DNS 서버를 올리지 않았기 때문에 IP를 입력 하였다.

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#

ServerName 192.168.100.2:80

이제 Apache 설치는 완료 되었으며 Apache를 실행하면 된다.

[root@mrtg httpd-2.2.15]# /usr/local/apache/bin/apachectl start
[root@mrtg httpd-2.2.15]#


웹서버가 뜨는 것을 확인 할 수 있다.

위 스샷과 같이 안 나온다면, 리눅스 설치 시 방화벽에 http 포트를 열어주었는지 확인한다.



[root@mrtg httpd-2.2.15]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/local/apache/bin/apachectl start

위와 같이 리눅스가 부팅 될 때 웹서버가 자동으로 실행되게 저장한다.



Apache 설치가 완료 되었지만, MRTG는 cgi를 이용하여 웹서버에 표현을 해주기 때문에 cgi를 실행 할 수 있게 httpd.conf의 설정 부분을 변경해야 한다.

[root@mrtg httpd-2.2.15]# cd /usr/local/apache/conf/
[root@mrtg conf]# vi httpd.conf
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>
</IfModule>

# 'Main' server configuration

아래와 같이 변경 한다.

# running httpd, as with most system services.
#
User nobody
Group nobody

</IfModule>
</IfModule>

# 'Main' server configuration



# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being


역시 아래와 같이 추가한다.

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php index.cgi
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being



<Directory "/usr/local/apache/cgi-bin">
    AllowOverride None
    Options none
    Order allow,deny
    Allow from all
</Directory>


아래와 같이 변경한다.

<Directory "/usr/local/apache/cgi-bin">
    AllowOverride None
   
Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>



    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":


아래와 같이 추가한다.

    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    AddType application/x-httpd-cgi .cgi .pl

    #
    # AddHandler allows you to map certain file extensions to "handlers":




    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var


아래와 같이 추가한다.

    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    AddHandler cgi-script .cgi .pl

    # For type maps (negotiated resources):
    #AddHandler type-map var


이제 웹서버에서 cgi를 적용 할 수 있는 환경이 완료 되었다.
기본 cgi-bin 경로는 /usr/local/apache/cgi-bin 으로 설정 되어있다.




저작자 표시 비영리 동일 조건 변경 허락
크리에이티브 커먼즈 라이선스
Creative Commons License

'Linux tools > MRTG' 카테고리의 다른 글

MRTG서버에 Weathermap 설치 및 사용하기  (0) 2010.03.26
MRTG 설정 및 사용하기  (0) 2010.03.25
MRTG 설치 방법  (0) 2010.03.23
블로그 이미지

쭈꾸댕이

아직 어설픈 실력으로 나름 제가 하는 것에 대한 것들을 옮기는 공간입니다. 틀린 부분도 있을 수 있으니 이 점 양해하시고, 도움이 되셨으면 좋겠네요.

티스토리 툴바