./load envdir unix.a byte.a
/usr/bin/ld: errno: TLS definition in /lib64/libc.so.6 section .tbss mismatches non-TLS reference in envdir.o
/lib64/libc.so.6: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [envdir] Error 1

http://blog.nirkabel.org/2009/01/18/errnoh-problem/ 포스트를 참고했다.

src/conf-cc 파일을 다음과 같이 수정.



gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings



gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -include /usr/include/errno.h

이래도 안 될 경우, -include 뒤의 변수를 errno.h path로 바꿔주면 된다
저작자 표시
Bind 9.8.1-P1에서 pgsql 이나 mysql 드라이버와 함께 컴파일할 때
dlz_mysql_driver.o: In function `mysql_get_resultset':
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:279: 
undefined reference to `sdlzh_build_querystring'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:282: 
undefined reference to `sdlzh_build_querystring'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:285: 
undefined reference to `sdlzh_build_querystring'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:288: 
undefined reference to `sdlzh_build_querystring'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:291: 
undefined reference to `sdlzh_build_querystring'
dlz_mysql_driver.o:/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:294: 
more undefined references to `sdlzh_build_querystring' follow
dlz_mysql_driver.o: In function `mysql_create':
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:823: 
undefined reference to `sdlzh_get_parameter_value'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:833: 
undefined reference to `sdlzh_get_parameter_value'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:857: 
undefined reference to `sdlzh_build_sqldbinstance'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:902: 
undefined reference to `sdlzh_get_parameter_value'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:909: 
undefined reference to `sdlzh_get_parameter_value'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:916: 
undefined reference to `sdlzh_get_parameter_value'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:924: 
undefined reference to `sdlzh_get_parameter_value'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:925: 
undefined reference to `sdlzh_get_parameter_value'
dlz_mysql_driver.o:/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:926: 
more undefined references to `sdlzh_get_parameter_value' follow
dlz_mysql_driver.o: In function `mysql_create':
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:963: 
undefined reference to `sdlzh_destroy_sqldbinstance'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:861: 
undefined reference to `sdlzh_build_sqldbinstance'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:865: 
undefined reference to `sdlzh_build_sqldbinstance'
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:870: 
undefined reference to `sdlzh_build_sqldbinstance'
dlz_mysql_driver.o: In function `mysql_destroy':
/root/bind-9.8.1/bin/named/../../contrib/dlz/drivers/dlz_mysql_driver.c:1003: 
undefined reference to `sdlzh_destroy_sqldbinstance'
collect2: ld returned 1 exit status
make[2]: *** [named] Error 1
make[2]: Leaving directory `/root/bind-9.8.1/bin/named'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/root/bind-9.8.1/bin'
make: *** [subdirs] Error 1

이런 에러가 뜨면

diff -u -r1.3 sdlz_helper.c
--- contrib/dlz/drivers/sdlz_helper.c	14 May 2010 06:29:37 -0000	1.3
+++ contrib/dlz/drivers/sdlz_helper.c	5 Sep 2011 17:31:30 -0000
@@ -50,8 +50,6 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifdef DLZ
-
 #include <config.h>
 
 #include <dns/log.h>
@@ -527,5 +525,3 @@
 
 	return isc_mem_strdup(mctx, value);
 }
-
-#endif

이 패치를 적용해 주면 된다

9.8.2 때 패치가 적용되서 나온다는 듯..
저작자 표시

[Apache] mod_watch backup

리눅스/어플리케이션 2011/08/20 06:12 Posted by Relipmoc

Apache Mod_Watch & Munin Graphs showing vhost accesses

While this is more of an apache topic than a munin one, the main reason I wanted to compile the mod_watch module for apache is so I can graph vhost usage and access. Munin will then show graphs of how much a vhost is used. Also, while there are other how-to websites out there for this, they seem to drop off and disappear after a few years.

mod_watch itself is not supported and is actually quite difficult to get a hold of. I was using this on Debian Etch and Lenny on a x32 system. Copying the mod_watch.so and running on x64 failed so I needed to recomiple on a x64 debian squeeze.

The main reference I used was: http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ This worked perfectly. There was an issue with debian squeeze which will be sorted below.

Compile

apt-get install apache2-dev libcrypt-ssleay-perl libwww-perl make
wget http://wiki.kartbuilding.net/mod_watch-4.3_apache22_mod.tar.gz
#gunzip and tar -xvf
nano Makefile.dso
//change APXS location to:
APXS=/usr/bin/apxs2

make -f Makefile.dso build
make -f Makefile.dso install 

Add and config mod_watch apache module

vi /etc/apache2/mods-available/watch.load
//add in
LoadModule watch_module /usr/lib/apache2/modules/mod_watch.so

a2enmod watch
vi /etc/apache2/sites-enabled/01-default  (or whatever vhost you want)
       <Location /watch-info>
         SetHandler watch-info
           Order deny,allow
           Deny from all
           Allow from 127.0.0.1 ::1
       </Location>
       <Location /watch-list>
        SetHandler watch-list
           Order deny,allow
           Deny from all
           Allow from 127.0.0.1 ::1
       </Location>

/etc/init.d/apache2 restart

Checking mod_watch for errors

elinks http://localhost/watch-list
#check for output

mod_watch Errors received

in error.log with Debian Squeeze running 2.6.32-5-amd64

tail -f /var/log/apache2/error.log
//I noticed the following warns when I accessed any vhosts with mod_watch enabled
[Fri Mar 18 22:35:36 2011] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchPostReadRequestHash()
[Fri Mar 18 22:35:36 2011] [error] shVerifyString(7fca84e5aae8, 7fca83c946f8) failed!
[Fri Mar 18 22:35:36 2011] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "monitor2.burkesys.com") failed in watchLogHash()
[Fri Mar 18 22:35:36 2011] [error] shVerifyString(7fca84e5aae8, 7fca83c94718) failed!
[Fri Mar 18 22:35:36 2011] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchLogHash()

resolve mod_watch errors

Googling led me to http://forums.cacti.net/viewtopic.php?p=186639#p186639

cd /root/mod_watch-4.3_apache22_mod/
vi SharedHash.c
//on line 102 change to look like:
shVerifyString(struct shTable *tp, char *str)
{
   /* if ((char *) tp->shared <= str && str < (char *) tp->eshared) { */
   if ((char *) apr_shm_baseaddr_get(tp->shared) <= str && str < (char *) tp->eshared) {
       if (str + strlen(str) < (char *) tp->eshared)
           return str;
   }

So now browing various vhosts on the server showed no errors in error.log. Using elinks (apt-get install elinks) going to http://localhost/watch-list showed results.

Munin Plugin for Mod_Watch

cd /usr/share/munin/plugins
wget http://wiki.kartbuilding.net/apache_watch
chmod 755 apache_watch
vi apache_watch
//change my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://monitor2.burkesys.com:%d/watch-list"; to:
my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://server.com:%d/watch-list";

ln -s /usr/share/munin/plugins/apache_watch /etc/munin/plugins/apache_watch_requests

That should do it. Once mod_watch is working and accessible munin should pick it up ok. References: http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ 
http://exchange.munin-monitoring.org/plugins/apache_watch_/version/1 
http://forums.cacti.net/about15475.html

This is a nice apache module. I'm surprised that there is no maintained similar apache module. I've seen another similar munin plugin that parses /var/log/apache2/vhost%_access.log to generate these graphs, however it requires separate log files for each vhost and parses the logs every so often. Any more info /queries / suggestions drop us a mail sburke[at]burkesys.com

저작자 표시
CentOS 5 기준이며, 다른 배포판일 경우 패키지 설치 명령어만 다르고 나머지는 같으.. ㄹ 겁니다
실사용 하실 때 설치 스크립트에서 주석은 달아 놨으니 변수부분만 바꿔주시면 되며, 이 스크립트는 MRTG 설치&설정 스크립트지 SNMP 설정은 하지 않습니다.

#!/bin/sh
# Author: Larry Kim <admin@relip.org>

# ============= 변수 선언 =============

MRTG_CFG_PATH="/etc/mrtg/local.cfg" # MRTG 설정파일 경로. 꼭 obsolute path 여야함!
MRTG_WORK_DIR="/data/www/www.relip.org/mrtg/" # 데이터, 그래프들을 저장할 경로
SNMP_VERSION="2" # SNMP 버전 
SNMP_HOST="localhost" # SNMP 데이터를 가져올 서버의 아이피 또는 도메인
SNMP_COMMUNITY="public" # SNMP 커뮤니티 이름

# ============= 변수 선언 끝 ==========

yum -y install mrtg
cfgmaker --snmp-options=:::::${MRTG_SNMP_VERSION} --global "WorkDir: ${MRTG_WORK_DIR}" --global 'Language: korean' --global 'Options[_]: bits,growright' --global 'Refresh: 300' --global 'WriteExpires: Yes' --output ${MRTG_CFG_PATH} ${SNMP_COMMUNITY}@${SNMP_HOST}
indexmaker ${MRTG_CFG_PATH} --output=${MRTG_WORK_DIR}/index.html
echo "*/5 * * * * root env LANG=C /usr/bin/mrtg ${MRTG_CFG_PATH}  > /dev/null 2>&1" >>  /etc/crontab 

참 쉽ㅈ.. 
저작자 표시
TAG MRTG
그냥 복붙할 수 있도록 스크립트 형식으로 작성.


#기본적인 라이브러리/툴 설치:
yum groupinstall "Development Tools"
yum groupinstall "Development Libraries"

#mysql: Version: 5.5.15
# groupadd 가 안될 경우 밑의 주석을 풀어준다.
# export PATH=$PATH:/usr/sbin:/sbin
groupadd mysql
useradd mysql
wget http://mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mirror.khlug.org/mysql/
tar zxvf mysql-5.5.15.tar.gz
cd mysql-5.5.15
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum -y install cmake

cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DMYSQL_DATADIR=/opt/mysql/data \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSCONFIGDIR=/etc \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_DEBUG=0  
make
make install

cd ../

#apache: Version: 2.2.19
wget http://mirror.khlug.org/apache//httpd/httpd-2.2.19.tar.gz
tar zxvf httpd-2.2.19.tar.gz 
cd httpd-2.2.19
 ./configure --prefix=/opt/httpd --enable-modules=so --enable-module=shared --enable-mods-shared=all --enable-so --enable-ssl --enable-rewrite --enable-rule=SHARED_CORE --enable-mods-shared=ssl --with-ssl --with-mpm=prefork --enable-modules=unique_id
make
make install

cd ../

#php: Version: 5.3.6
wget http://www.php.net/get/php-5.3.6.tar.gz/from/kr.php.net/mirror 
tar zxvf php-5.3.6.tar.gz
cd php-5.3.6
yum install -y libjpeg-devel libpng-devel net-snmp-devel libmcrypt-devel libc-client-devel 
./configure  --prefix=/opt/php --with-apxs2=/opt/httpd/bin/apxs --with-config-file-path=/opt/httpd/conf --disable-debug --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-magic-quotes --enable-mbregex --enable-mbstring --enable-mod-charset --enable-sigchild --enable-soap --enable-sockets --enable-wddx --enable-zip --with-bz2 --with-curl=/usr --with-freetype-dir=/usr --with-gd --with-gdbm=/usr --with-gettext --with-iconv --with-imap --with-imap-ssl --with-jpeg-dir=/usr --with-kerberos --with-ldap --with-libexpat-dir --with-libxml-dir --with-mcrypt --with-openssl --without-sqlite --with-png-dir=/usr --with-snmp --with-xmlrpc --with-zlib --with-mcrypt --with-mysql=/opt/mysql --with-pdo-mysql=/opt/mysql
make
make install

cd ../ 

저작자 표시
PHP Version: 5.2.13

이 오류가 나는 이유는, FreeTDS 를 패키지로 설치할 때, 라이브러리가 lib64에 복사되기 때문이다. 하지만 PHP 는 --with-mssql 옵션을 주면 /usr/lib 에서 라이브러리를 찾는다. 여기까지 말 했으면 설명이 the 必要漢紙? 

ln -s /usr/lib64/libsybdb.so /usr/lib/
./configure [중간 옵션] --with-mssql
make
make install
저작자 표시

우분투, 센토스 등 패키지로 제공되는 아파치는 잘 모르겠으나, 컴파일한 아파치의 경우에는 apachectl 이 chkconfig 로 등록이 안된다. 왜냐하면, chkconfig 는 쉘스크립트 내용안에 

# chkconfig: - 85 15
# description: Apache is a World Wide Web server. \
# It is used to serve HTML files and CGI.
같은 내용을 포함하고 있어야 하는데, 기본으로 제공되는 스크립트에는 포함이 안돼있기 때문이다. 
여기까지 설명하면 다들 알아차리겠지만,

엄청쉽다. 
그냥 위에 쓴 저 내용을 apachectl 파일의 #!/bin/sh 다음줄에 추가만 하면 끝이다. 

즉,

Before 
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0

After 
#!/bin/sh
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  \
#              It is used to serve HTML files and CGI.

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0

그리고 chkconfig 에 등록

[root@test ~]# /sbin/chkconfig --add httpd
[root@test ~]# /sbin/chkconfig --level 2345 httpd on

결과:

[root@rb1 ~]# chkconfig --list | grep httpd
httpd           0:해제 1:해제 2:활성 3:활성 4:활성 5:활성 6:해제
저작자 표시
[작성중] 

CentOS 5.5 기준 

# yum install -y libjpeg-devel libpng-devel net-snmp-devel libmcrypt-devel libc-client-devel 
#  ./configure  --prefix=/opt/php --with-apxs2=/opt/httpd/bin/apxs --with-config-file-path=/opt/httpd/conf --disable-debug --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-magic-quotes --enable-mbregex --enable-mbstring --enable-mod-charset --enable-sigchild --enable-soap --enable-sockets --enable-wddx --enable-zip --with-bz2 --with-curl=/usr --with-freetype-dir=/usr --with-gd --with-gdbm=/usr --with-gettext --with-iconv --with-imap --with-imap-ssl --with-jpeg-dir=/usr --with-kerberos --with-ldap --with-libexpat-dir --with-libxml-dir --with-mcrypt --with-openssl --without-sqlite --with-png-dir=/usr --with-snmp --with-xmlrpc --with-zlib --with-mcrypt --with-mysql=/opt/mysql --with-pdo-mysql=/opt/mysql
# make
# make install
저작자 표시

PostgreSQL 설치

리눅스/Database 2010/06/13 19:02 Posted by Relipmoc
원래 bind (named) 랑 연동할려고 컴파일 해서 올린거지만 결국 실패했... 쓸데없이 시간 날린것 같네요 -_-;
실패라기 보다는 포기지만요 (성공하신분 계시면 트랙뷁이나 댓글좀요 (...))

아무튼 각 배포판에서 패키지로 설치할 수 있지만, (apt-get emerge yum ports etc..)
그냥 컴파일 및 설정하는 방법을 포스팅하도록 하겠습니다.

먼저 http://www.postgresql.org/ 에서 소스를 받고 다음 명령어들을 입력 하시면 됩니다.
(셜명은 안해도 왠만한건 다 명령어 이름보고 아실거라 믿습니다)

# tar xvf postgresql*
# cd postgresql-*
# ./configure --prefix=/usr/local/pgsql --with-ldap --with-libxml  --with-openssl
# make && make install
# cd /usr/local/pgsql
# useradd -s /bin/bash -d /usr/local/pgsql postgres # pgsql 은 root 로 뭘 할려그러면 오류를 뱉기 때문에 유저생성
# passwd postgres
# chown -R postgres.postgres .
# su postgres
$ bin/initdb -D data
$ bin/pg_ctl -D data -l data/postmaster.log start
$ bin/psql template1
psql (9.0beta2)
Type "help" for help.
template1=# alter user postgres with password 'password';
template1=# \q
$ data/pg_hba.conf  ## 여기서 제일 마지막에 있는 trust 를 password 로 바꾸고 저장한다.
$ bin/pg_ctl -D data restart
$ bin/createuser
Enter name of role to add: relip
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
Password:
$ ./createdb -U relip relip
Password:
$ ./psql
Password:
psql (9.0beta2)
Type "help" for help.
postgres=# ALTER USER relip with password 'password';
ALTER ROLE
postgres=# \q
$

명령어만 쭉 나열했지만 아무튼 이걸로 기본적인 설치 및 설정이 끝났습니다. (...)
(TCP 로 접속하는 설정은 다른문서 찾으면 나오니 그거 보시고 하시면 됩니다.)









참 쉽죠?

* MySQL 에는 phpmyadmin 이 있듯이 pgSQL 에는 phppgadmin 이 있습니다. 설치방법은 쉬우니 그냥 생략 (받아서 압축풀기)
저작자 표시

'리눅스 > Database' 카테고리의 다른 글

PostgreSQL 설치  (3) 2010/06/13