| 여러장의 이미지 간단히 합치기 | 움직이는GIF만들기 | 썸네일 쉽게 만들기
분류 전체보기 (85)
I am (0)
Today (1)
개발자이야기 (11)
나만의 유용한정보 (7)
서버관련 (40)
지름신 (5)
사진/여행 (1)
끄적끄적 (5)
골프 (11)
주식 (2)

«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Visitors up to today!
Today hit, Yesterday hit
daisy rss
티스토리 가입하기!
'FreeBSD'에 해당되는 글 12건
2013. 2. 14. 13:52

FreeBSD9.x / php5.3.x

 

--enable-fpm 설치시 아래와 같은 에러가 난다! ㅎ

 

/usr/local/php-5.3.9/sapi/fpm/fpm/fpm_sockets.c: In function 'fpm_socket_get_listening_queue':
/usr/local/php-5.3.9/sapi/fpm/fpm/fpm_sockets.c:400: error: 'struct tcp_info' has no member named 'tcpi_sacked'
/usr/local/php-5.3.9/sapi/fpm/fpm/fpm_sockets.c:405: error: 'struct tcp_info' has no member named 'tcpi_unacked'
/usr/local/php-5.3.9/sapi/fpm/fpm/fpm_sockets.c:409: error: 'struct tcp_info' has no member named 'tcpi_sacked'
*** [sapi/fpm/fpm/fpm_sockets.lo] Error code 1

 

아래와 같이 소스를 수정..

 

/usr/local/php-5.3.9]$ find . -name "fpm_sockets.c"
./sapi/fpm/fpm/fpm_sockets.c

 

vi ./sapi/fpm/fpm/fpm_sockets.c

 

tcpi_sacked -> __tcpi_sacked

tcpi_unacked -> __ tcpi_unacked

 

        if (info.tcpi_sacked == 0) {
                return -1;
        }

        if (cur_lq) {
                *cur_lq = info.tcpi_unacked;
        }

        if (max_lq) {
                *max_lq = info.tcpi_sacked;
        }

 

아래와 같이 수정

 

        if (info.__tcpi_sacked == 0) {
                return -1;
        }

        if (cur_lq) {
                *cur_lq = info.__tcpi_unacked;
        }

        if (max_lq) {
                *max_lq = info.__tcpi_sacked;
        }

 

재컴파일...    잘된다..ㅎㅎ

 

 

 

2013. 1. 15. 16:52

FreeBSD 9.1 이 릴리즈 되서 패키지 설치중

pkg_add -r 이 아래와 같이 안됨;

 

pkg_add -r rsync
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/Latest/rsync.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/Latest/rsync.tbz' by URL

 

 

http://www.freebsd.org/news/2012-compromise.html
일전의 보안이슈로 막아 놓은 모양;;

 

아래와 같이 해결은 가능하다..

 

c shell 일경우

 

setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest/

 

bash shell 일경우

 

export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest/


와 같이 환경변수 처리후 가능해졌다.ㅎ

 

 

2012. 11. 29. 14:21

파일다운로드 파일서버겸용 웹서버 가 트래픽 1G로 FULL 서비스하게 되었네요.

 

웹서버는 nginx

1G FULL서비스상황에서 load는 0.x 대.. ㅎㅎ

 

 

1000M 랜카드 대역폭의 한계치 까지와서

서버에 붙어 있는 랜카드2개를 라운드로빈하기로 결정..

 

FreeBSD의 커널부터 패치 하기 시작!

device lagg

추가후 커널컴파일

 

vi /boot/loader.conf 에

if_lagg_load="YES"

추가! 후 리부팅

 

vi /etc/rc.conf 에 랜설정

ifconfig_bce0="up"
ifconfig_bce1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto roundrobin laggport bce0 laggport bce1"
ipv4_addrs_lagg0="27.x.x.171/25"

 

두개의 랜카드가 라운드로빈되면서 분산시작! ㅎㅎ

 

 

 LAN1 LAN2

 

분산이 잘되고 있네요.ㅎㅎ

 

그나저나 nginx가 짱!

 

 

 

 

 

 

2011. 1. 25. 20:09

FreeBSD 에서 diskinfo 툴로 돌린값을 비교해보았습니다.
SSD 하드가 단편화문제와 빈번한 read/write에서 수명문제가 있긴하지만
빠르긴하네요..

Seek time 에서는 비교가 안되고, 당연한 결과겠지만 SSD에서는 seek time이
모든 영역에서 동일한 시간을 보이네요
..

두서버 모두 raid1 으로 512M cache메모리의 고성능 raid 콘트롤러를 장착하였습니다.


SSD 하드서버

Seek times:
        Full stroke:      250 iter in   0.031215 sec =    0.125 msec
        Half stroke:      250 iter in   0.031156 sec =    0.125 msec
        Quarter stroke:   500 iter in   0.062460 sec =    0.125 msec
        Short forward:    400 iter in   0.049768 sec =    0.124 msec
        Short backward:   400 iter in   0.050074 sec =    0.125 msec
        Seq outer:       2048 iter in   0.262656 sec =    0.128 msec
        Seq inner:       2048 iter in   0.251811 sec =    0.123 msec
Transfer rates:
        outside:       102400 kbytes in   0.494756 sec =   206971 kbytes/sec
        middle:        102400 kbytes in   0.492494 sec =   207921 kbytes/sec
        inside:        102400 kbytes in   0.496554 sec =   206221 kbytes/sec

 

SATA 하드서버


Seek times:
        Full stroke:      250 iter in   1.477391 sec =    5.910 msec
        Half stroke:      250 iter in   1.423015 sec =    5.692 msec
        Quarter stroke:   500 iter in   2.953463 sec =    5.907 msec
        Short forward:    400 iter in   1.703787 sec =    4.259 msec
        Short backward:   400 iter in   1.731393 sec =    4.328 msec
        Seq outer:       2048 iter in   0.489363 sec =    0.239 msec
        Seq inner:       2048 iter in   0.382542 sec =    0.187 msec
Transfer rates:
        outside:       102400 kbytes in   0.889493 sec =   115122 kbytes/sec
        middle:        102400 kbytes in   0.887746 sec =   115348 kbytes/sec
        inside:        102400 kbytes in   0.901085 sec =   113641 kbytes/sec



 

2009. 7. 17. 09:52


FreeBSD에서 포트로 리눅스 에뮬레이터 설치시

compat.linux.osrelease: 2.4.2 is not supported, please use 2.6.16


와 같은 에러가 난다면,

sysctl compat.linux.osrelease=2.6.16


를 한번 해주고, 설치를 재시도하면 된다.

2008. 3. 17. 11:58

사내직원이 100명이 넘어가면서 imap(메일관련데몬)의 접속이 많아져서
가끔 아래와 같이 /var/log/messages 에 에러를 내뱉는다.

inetd[624]: imap from 203.x.x.x exceeded counts/min (limit 60/min)


우선 inetd의 데몬옵션을 확인
ps aux | grep inetd

root        624  0.0  0.0  1388   980  ??  Ss   20 208    0:28.94 /usr/sbin/inetd -wW -C 60


기본값으로 데몬이 떠 있는것...

-C 옵션은 max-connections-per-ip-per-minute 로 동일IP에 대해서 동일포트의 1분간 설정회수란다..
좀더 높여보자(imapd를 사용하는 웹메일에 문제가 있나?)

이왕 -R 값도 좀 높여보자..

일단 기존 inetd를 죽이고..
kill -9 624
재가동한다.

/usr/sbin/inetd -wW -C 256 -R 2048

그리고,
/etc/rc.conf 에 inetd_flag추가해주는 센쓰~

inetd_flag="-wW -C 256 -R 2048"

2008. 3. 4. 21:04
FreeBSD 에서 Apache2 + PHP 5.x 를 설치하는 방법

kldload accf_http
를 띄운다.

vi /boot/loader.conf 에
accf_http_load="YES"
추가하고 리부팅 한번 때려주거나,

커널옵션에
options ACCEPT_FILTER_HTTP
를 추가하고 커널컴팔 후 리부팅한다.

최신 아파치(현재는 2.2.8) 을 가져와서 소스를 푼다.

./configure --prefix=/usr/local/apache2 --enable-module=most --enable-shared=max --enable-rewrite --enable-headers --enable-rewrite --enable-deflate --enable-so --with-included-apr

PHP를 동적으로 컴파일해야 하기때문에  --enable-so는 반드시 있어야한다.
그외 옵션추가는 ./configure --help  로 참조한다.
설치디렉토리는 --prefix 의 경로로  변경이 가능하다.

make; make install

위의 과정으로 아파치 컴파일은 완료!

FreeBSD 6.x 의 경우 기본적으로 perl이 설치안되어 있으므로 perl을 설치하는것이 좋겠다.

cd /usr/port/lang/perl5.8
make install

최신의 PHP 소스롤 가져다가 푼다.

./configure  --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/apache2/conf --with-mysql=/usr/local/mysql --with-zlib-dir=/usr/local/zlib --enable-ftp --enable-sockets --enable-mbstring --disable-debug --with-config-file-path=/usr/local/lib --with-iconv

아파치 설치된 경로로 apxs 를 지정한다.
그외 gd를 설치하거나 기타 옵션을 주려면, 마찬가지로 ./configure --help를 참고한다.

make; make install

인스톨후
# php -v
PHP 5.2.5 (cli) (built: Nov  5 2007 16:11:19)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
와 같이 버젼이 제대로 나오는지 확인한다.

아파치 설치 디렉토리에서
vi /usr/local/apache2/conf/httpd.conf
후에 아래를 추가한다.
LoadModule php5_module        modules/libphp5.so
AddType application/x-httpd-php .php

그외 아파치 설정파일은 아파치 문서를 참고한다.
.php 외의 확장자나 다른확장자로 php 스크립트를 만드려면 뒤에 추가해도 된다.
ex) AddType application/x-httpd-php .php .html .phps

/usr/local/apache2/bin/apachectl start

아파치를 구동한다.
2008. 3. 3. 15:37

늘상있는대로 컴파일을 시도했다.


1.3.0 에서는 나오지 않는 에러가 나오는군... 뭔가 호환이 안되나...


gcc -DHAVE_CONFIG_H  -DFREEBSD6_2 -DFREEBSD6 -I.. -I../include -I/usr/local/mysql/include/mysql -O2 -Wall -c mod_sql_mysql.c
mod_sql_mysql.c: In function `cmd_defineconnection':
mod_sql_mysql.c:598: error: missing terminating " character
*** Error code 1

Stop in /usr/local/proftpd-1.3.1rc3/modules.
*** Error code 1

Stop in /usr/local/proftpd-1.3.1rc3.



따옴표문제가 설마...
일단 에러소스를 찾아보자.


vi ./contrib/mod_sql_mysql.c


598번째 라인이라... 헉!


     pr_log_pri(PR_LOG_WARNING, "warning: the mod_sql_mysql module has not been
      "properly intialized.  Please make sure your --with-modules configure "
      "option lists mod_sql *before* mod_sql_mysql, and recompile.");

    sql_log(DEBUG_FUNC, "%s", "The mod_sql_mysql module has not been properly "
      "intialized.  Please make sure your --with-modules configure option "
      "lists mod_sql *before* mod_sql_mysql, and recompile.");


뭐야.. 뭔가 이상하다... text를 그냥 엔터를 쳤네? 따옴표는 뭐양?


     pr_log_pri(PR_LOG_WARNING, "warning: the mod_sql_mysql module has not been \
      properly intialized.  Please make sure your --with-modules configure \
      option lists mod_sql *before* mod_sql_mysql, and recompile.");

    sql_log(DEBUG_FUNC, "%s", "The mod_sql_mysql module has not been properly \
      intialized.  Please make sure your --with-modules configure option \
      lists mod_sql *before* mod_sql_mysql, and recompile.");


위와 같이 고치고 컴파일을 해봤따아..

잘된다.. -.-;;

2008. 2. 21. 15:29

요즘 300만원을 주지 않으면 쇼핑몰을 다운시키겠다는 협박이 많이 있어난다.
수십대의 좀비PC를 컨트롤 할 수 있으면 가능한이고, 추적하기 힘들기때문에 오버추어의 상위
광고업체(돈좀있으니 광고를 한다는 생각?)에 협박을 많이 하는것 같다.

FreeBSD에서 DDOS공격의 하나인 ICMP flood attack 이 일어나게 되면,

Limiting icmp unreach response from 31377 to 200 packets/sec
Limiting icmp unreach response from 30094 to 200 packets/sec
Limiting icmp unreach response from 30958 to 200 packets/sec
Limiting icmp unreach response from 30992 to 200 packets/sec
Limiting icmp unreach response from 31039 to 200 packets/sec

위와 같은 메시지를 자주보게 된다. 주로 포트스캐닝할때 나타난다.
이러한 공격은 해당 서버의 네트워크의 자원을 고갈시키면서 정상적인 서비스를 불가능하게 만든다.
MRTG트래픽을 보니깐.. 200M 이상의 DDOS공격을 해오는듯..

사용자 삽입 이미지

위의 파란색그래프(트래픽유입,업로드)가 튄것을 볼 수 있다.

일단 FreeBSD에서

sysctl -w net.inet.udp.blackhole=1
sysctl -w net.inet.tcp.blackhole=2

위와 같이 설정하면,  어느정도 해결할 수 있다.

IP로그를 보려면,

sysctl -w net.inet.tcp.log_in_vain=1

을 설정하면 아래와 같이 나타난다.

Connection attempt to TCP 203.x.x.59:139 from 203.238.53.121:1762 flags:0x02
Connection attempt to TCP 203.x.x.59:139 from 203.238.53.121:1762 flags:0x02
Connection attempt to TCP 203.x.x.59:135 from 203.238.187.188:2610 flags:0x02
Connection attempt to TCP 203.x.x.59:139 from 203.238.51.239:4365 flags:0x02
Connection attempt to TCP 203.x.x.59:139 from 203.238.51.239:4365 flags:0x02
Connection attempt to TCP 203.x.x.59:139 from 203.238.51.239:2254 flags:0x02
Connection attempt to TCP 203.x.x.59:139 from 203.238.51.239:2254 flags:0x02
Connection attempt to TCP 203.x.x.59:135 from 203.238.187.188:2869 flags:0x02
2008. 2. 20. 21:03
사용자 삽입 이미지

위의 그래프는 웹서버 한대가 내는 mrtg그래프! 웹서버 한대가 200M 정도의 트래픽은 그냥 버텨준다.
서버환경은 FreeBSD 6.2, Xeon 2.13, 2G RAM, SAS Disk RAID1

평균로드는 0.2 대... 아직 널널하군요..
서비스가 저장된 파일시스템은 NFS로 연결된것이니 더욱 놀라울따름!

www.lighttpd.net 
prev"" #1 #2 next