API 인증을 위한 php 모듈 oauth 추가 설치 방법입니다.


모듈 직접 다운로드 시 필요한 좌표는 아래와 같습니다.

http://pecl.php.net/package/oauth



아래는 우리 메일서버에 설치한 내역입니다.

 

 [root@mail bin]#cd /usr/local/php/bin        <-- php 소스 설치 위치 bin 디렉토리로 이동합니다

 

[root@mail bin]# ./pecl download oauth        <-- oauth 모듈을 다운로드 받습니다

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update

downloading oauth-1.2.3.tgz ...

Starting to download oauth-1.2.3.tgz (45,531 bytes)

.............done: 45,531 bytes

File /usr/local/php/bin/oauth-1.2.3.tgz downloaded

 

[root@mail bin]# ls

channel.xml  oauth-1.2.3.tgz  pear  peardev  pecl  phar  phar.phar  php  php-config  phpize

 

[root@mail bin]# tar xvzf oauth-1.2.3.tgz        <-- 압축 해제를 합니다

package.xml

oauth-1.2.3/examples/config.inc.php

oauth-1.2.3/examples/request_signing.php

oauth-1.2.3/examples/request_token.php

oauth-1.2.3/examples/access_token.php

oauth-1.2.3/examples/exec_api.php

oauth-1.2.3/examples/README

oauth-1.2.3/examples/yahoo/config.inc.php

oauth-1.2.3/examples/yahoo/request_signing.php

oauth-1.2.3/examples/yahoo/request_token.php

oauth-1.2.3/examples/yahoo/access_token.php

oauth-1.2.3/examples/yahoo/exec_yql.php

oauth-1.2.3/examples/yahoo/exec_yql_refresh_token.php

oauth-1.2.3/examples/fireeagle/config.inc.php

oauth-1.2.3/examples/fireeagle/request_signing.php

oauth-1.2.3/examples/fireeagle/request_token.php

oauth-1.2.3/examples/fireeagle/access_token.php

oauth-1.2.3/examples/fireeagle/exec_update_user.php

oauth-1.2.3/examples/netflix/config.inc.php

oauth-1.2.3/examples/netflix/request_token.php

oauth-1.2.3/examples/netflix/access_token.php

oauth-1.2.3/examples/netflix/feeds.php

oauth-1.2.3/examples/netflix/rental_history_atom.php

oauth-1.2.3/examples/twitter/README

oauth-1.2.3/examples/twitter/constants.php

oauth-1.2.3/examples/twitter/fetchTimeline.php

oauth-1.2.3/examples/twitter/updateStatus.php

oauth-1.2.3/examples/google/README

oauth-1.2.3/examples/google/config.inc.php

oauth-1.2.3/examples/google/request_token.php

oauth-1.2.3/examples/google/access_token.php

oauth-1.2.3/examples/google/getContactInfo.php

oauth-1.2.3/examples/wepay/README

oauth-1.2.3/examples/wepay/config.inc.php

oauth-1.2.3/examples/wepay/request_token.php

oauth-1.2.3/examples/wepay/access_token.php

oauth-1.2.3/examples/wepay/balances.php

oauth-1.2.3/examples/digg/config.inc.php

oauth-1.2.3/examples/digg/digg_a_story.php

oauth-1.2.3/config.m4

oauth-1.2.3/config.w32

oauth-1.2.3/oauth.c

oauth-1.2.3/provider.c

oauth-1.2.3/php_oauth.h

oauth-1.2.3/provider.h

oauth-1.2.3/LICENSE

 

[root@mail bin]# ls

channel.xml  oauth-1.2.3.tgz  pear     pecl  phar.phar  php-config

oauth-1.2.3  package.xml      peardev  phar  php        phpize

 

[root@mail bin]# cd oauth-1.2.3        <-- 압축 해제한 디렉토리로 이동합니다

 

[root@mail oauth-1.2.3]# pwd

/usr/local/php/bin/oauth-1.2.3

   

[root@mail oauth-1.2.3]# ../phpize        <-- 상위 디렉토리의 phpize 를 실행하여 확장 모듈 추가를 위한 환경을 구성(configure 생성)하여 줍니다

Configuring for:

PHP Api Version:         20090626

Zend Module Api No:      20090626

Zend Extension Api No:   220090626

 

[root@mail oauth-1.2.3]# ls

LICENSE          autom4te.cache  config.m4   configure.in  missing        provider.c

Makefile.global  build           config.sub  examples      mkinstalldirs  provider.h

acinclude.m4     config.guess    config.w32  install-sh    oauth.c        run-tests.php

aclocal.m4       config.h.in     configure   ltmain.sh     php_oauth.h

 

[root@mail oauth-1.2.3]# pwd

/usr/local/php/bin/oauth-1.2.3

 

[root@mail oauth-1.2.3]# ls

LICENSE          autom4te.cache  config.m4   configure.in  missing        provider.c

Makefile.global  build           config.sub  examples      mkinstalldirs  provider.h

acinclude.m4     config.guess    config.w32  install-sh    oauth.c        run-tests.php

aclocal.m4       config.h.in     configure   ltmain.sh     php_oauth.h

 

[root@mail oauth-1.2.3]# ./configure --with-php-config=/usr/local/php/bin/php-config    <-- 기존 php설치 디렉토리의 php-config를 사용합니다

checking for egrep... grep -E

checking for a sed that does not truncate output... /bin/sed

checking for cc... cc

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

checking whether we are using the GNU C compiler... yes

checking whether cc accepts -g... yes

checking for cc option to accept ANSI C... none needed

checking how to run the C preprocessor... cc -E

checking for icc... no

checking for suncc... no

checking whether cc understands -c and -o together... yes

checking for system library directory... lib

checking if compiler supports -R... no

checking if compiler supports -Wl,-rpath,... yes

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 PHP prefix... /usr/local/php

checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib

checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-zts-20090626

checking for PHP installed headers prefix... /usr/local/php/include/php

checking if debug is enabled... no

checking if zts is enabled... no

checking for re2c... no

configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.

checking for gawk... gawk

checking for oauth support... yes, shared

checking for cURL in default path... found in /usr

checking for ld used by cc... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking for /usr/bin/ld option to reload object files... -r

checking for BSD-compatible nm... /usr/bin/nm -B

checking whether ln -s works... yes

checking how to recognize dependent libraries... pass_all

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking dlfcn.h usability... yes

checking dlfcn.h presence... yes

checking for dlfcn.h... yes

checking the maximum length of command line arguments... 98304

checking command to parse /usr/bin/nm -B output from cc object... ok

checking for objdir... .libs

checking for ar... ar

checking for ranlib... ranlib

checking for strip... strip

checking if cc supports -fno-rtti -fno-exceptions... no

checking for cc option to produce PIC... -fPIC

checking if cc PIC flag -fPIC works... yes

checking if cc static flag -static works... yes

checking if cc supports -c -o file.o... yes

checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

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

configure: creating ./config.status

config.status: creating config.h

 

[root@mail oauth-1.2.3]# make && make install        <-- 컴파일 진행해줍니다

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=compile cc  -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -c /usr/local/php/bin/oauth-1.2.3/oauth.c -o oauth.lo

mkdir .libs

cc -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /usr/local/php/bin/oauth-1.2.3/oauth.c  -fPIC -DPIC -o .libs/oauth.o

/usr/local/php/bin/oauth-1.2.3/oauth.c: In function 'oauth_http_build_query':

/usr/local/php/bin/oauth-1.2.3/oauth.c:630: warning: dereferencing type-punned pointer will break strict-aliasing rules

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=compile cc  -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -c /usr/local/php/bin/oauth-1.2.3/provider.c -o provider.lo

 cc -I. -I/usr/local/php/bin/oauth-1.2.3 -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /usr/local/php/bin/oauth-1.2.3/provider.c  -fPIC -DPIC -o .libs/provider.o

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_remove_required_param':

/usr/local/php/bin/oauth-1.2.3/provider.c:67: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_add_required_param':

/usr/local/php/bin/oauth-1.2.3/provider.c:88: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_apply_custom_param':

/usr/local/php/bin/oauth-1.2.3/provider.c:109: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_check_required_params':

/usr/local/php/bin/oauth-1.2.3/provider.c:171: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_set_std_params':

/usr/local/php/bin/oauth-1.2.3/provider.c:189: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:190: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:191: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:192: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:193: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:194: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:195: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:196: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:197: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_parse_auth_header':

/usr/local/php/bin/oauth-1.2.3/provider.c:254: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:265: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:267: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:268: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_get_http_verb':

/usr/local/php/bin/oauth-1.2.3/provider.c:404: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:404: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'oauth_provider_get_current_uri':

/usr/local/php/bin/oauth-1.2.3/provider.c:418: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:419: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:420: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:421: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:422: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'zim_oauthprovider___construct':

/usr/local/php/bin/oauth-1.2.3/provider.c:525: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:528: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:537: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:556: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:559: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c:583: warning: dereferencing type-punned pointer will break strict-aliasing rules

/usr/local/php/bin/oauth-1.2.3/provider.c: In function 'zim_oauthprovider_checkOAuthRequest':

/usr/local/php/bin/oauth-1.2.3/provider.c:745: warning: dereferencing type-punned pointer will break strict-aliasing rules

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/php/bin/oauth-1.2.3/include -I/usr/local/php/bin/oauth-1.2.3/main -I/usr/local/php/bin/oauth-1.2.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -o oauth.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/php/bin/oauth-1.2.3/modules  oauth.lo provider.lo -lcurl

cc -shared  .libs/oauth.o .libs/provider.o  -lcurl  -Wl,-soname -Wl,oauth.so -o .libs/oauth.so

creating oauth.la

(cd .libs && rm -f oauth.la && ln -s ../oauth.la oauth.la)

/bin/sh /usr/local/php/bin/oauth-1.2.3/libtool --mode=install cp ./oauth.la /usr/local/php/bin/oauth-1.2.3/modules

cp ./.libs/oauth.so /usr/local/php/bin/oauth-1.2.3/modules/oauth.so

cp ./.libs/oauth.lai /usr/local/php/bin/oauth-1.2.3/modules/oauth.la

PATH="$PATH:/sbin" ldconfig -n /usr/local/php/bin/oauth-1.2.3/modules

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

Libraries have been installed in:

   /usr/local/php/bin/oauth-1.2.3/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.

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

 

Build complete.

Don't forget to run 'make test'.

 

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20090626/

 

[root@mail oauth-1.2.3]# cd modules/

[root@mail modules]# ls

oauth.so

[root@mail modules]#

 

 

설치가 완료 되면 php.ini 파일에 모듈 위치를 절대 경로로 삽입해주면 됩니다.

extension=/usr/local/php/bin/oauth-1.2.3/modules/oauth.so



- 지메이트시스템즈 이정식 -

'OS > Linux' 카테고리의 다른 글

Clusterssh 설치  (0) 2013.04.22
LVS HA 구성  (0) 2013.04.19
fail2ban  (0) 2013.04.04
GlusterFS  (0) 2013.02.05
rsync를 이용한 미러링  (0) 2013.01.16

fail2ban

2013. 4. 4. 14:26

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

GlusterFS

2013. 2. 5. 14:58

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

rsync를 이용한 미러링

2013. 1. 16. 18:10

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

패스워드 만료 일자 간단 변경

OS/Linux 2013. 1. 10. 10:28 Posted by 이정식

[root@mail ~]# chage -d 2011-05-25 jsclub


[root@mail ~]# chage -l jsclub

마지막으로 열쇠글을 바꾼 날 : 5월 25, 2011

열쇠글 만료 :안함

열쇠글이 비활성화 기간 :안함

계정 만료 : 3월 15, 2012

열쇠글을 바꿀 수 있는 최소 날 수 : 0

열쇠글을 바꿔야 하는 최대 날 수 : 99999

열쇠글 만료 예고를 하는 날 수 : 7

/etc/shadow

jsclub:$1$I2d5T0RE$3OC6qqnfrZgUo1U/ni.gE1:15119:0:99999:7::15414:

'OS > Linux' 카테고리의 다른 글

RHEL 6에서 Network Card bonding  (0) 2013.01.16
리눅스 하드웨어 정보 확인 방법  (0) 2013.01.10
SUDO 제한 방법  (0) 2013.01.10
Python 설치(easy install)  (0) 2013.01.10
Core 파일 생성 방법  (0) 2013.01.10

SUDO 제한 방법

OS/Linux 2013. 1. 10. 10:20 Posted by 이정식

#visudo 실행 ; #vi /etc/sudoers 와 같음.

 

root ALL = (ALL) ALL

gmate ALL = (ALL) ALL        ; 추가 삽입

 

# wheel 그룹에 sudo를 설정하는 방법

%wheel ALL=(ALL) ALL        ; 기본 주석되어 있으니 플어주면 된다.

 

gmate 계정을 wheel 그룹에 추가한다.

# usermod -G wheel gmate

 

만약 패스워드 물어보는 것을 하지 않으려면 아래와 같이 추가한다. 하지만 사용하지 말자..보안상..

%wheel ALL=(ALL) NOPASSWD: ALL

'OS > Linux' 카테고리의 다른 글

리눅스 하드웨어 정보 확인 방법  (0) 2013.01.10
패스워드 만료 일자 간단 변경  (0) 2013.01.10
Python 설치(easy install)  (0) 2013.01.10
Core 파일 생성 방법  (0) 2013.01.10
커널 파라미터 설정 정보  (0) 2013.01.10

Python 설치(easy install)

OS/Linux 2013. 1. 10. 09:54 Posted by 이정식

python module을 설치한다는 것은 특정 디렉토리에 파일을 풀고 PATH를 잡아주면 되는 것이다.

이 과정을 자동화한 것이 easy-install이다.

받은 소스 안에 setup.py라는 파일이 있다면 다음의 명령으로 egg 파일을 만들 수 있다.

# python setup.py bdist_egg

egg 파일은 설치되는 파일을 zip으로 묶고 확장자를 egg로 변경한 것으로 이해하면 된다. 설치에 사용되는
패키지 정보를 담고 있는 그들만의 파일을 담고 있기도 한다.

설치할 때에는 easy-install somename.egg와 같이 실행하면 패키지들이 모여있는 site-packages안에 옮기거나
풀어주고 디렉토리 경로를 저정하고 있는 easy-install.pth에 새로운 경로를 추가해 준다.

압축이 된 상태로 사용할 수도 있고 압축을 풀어서(—always-unzip 옵션) 사용할 수도 있다.

zip으로 된 파일을 egg로 변경하고 easy-install을 수행하면 설치되는 것으로 보일 경우가 있다. 그렇지만 제대로
설치되지 않아서 동작을 하지 않을 것이다. egg 파일의 내용에는 EGG-INFO 디렉토리가 있으며 setup.py 파일은
보이지 않는 것이 일반적이다.

'OS > Linux' 카테고리의 다른 글

패스워드 만료 일자 간단 변경  (0) 2013.01.10
SUDO 제한 방법  (0) 2013.01.10
Core 파일 생성 방법  (0) 2013.01.10
커널 파라미터 설정 정보  (0) 2013.01.10
커널 패닉 시 자동 리부팅 설정  (0) 2013.01.10

Core 파일 생성 방법

OS/Linux 2013. 1. 10. 09:47 Posted by 이정식

1. /etc/security/limits.conf 수정

* soft core -1
* hard core -1

-1 은 unlimited 뜻함.

2. /etc/profile 수정
#ulimit -S -c 0 > /dev/null 2>&1 ; 변경 전
ulimit -S -c unlimited > /dev/null 2>&1 ; 변경 후

3. reboot

#### 자세한 설명 ###
초기 설정에는 core file size가 0으로 설정이 되어있어, core file이 생성이 되지 않는다.
따라서 core dump시 core file이 생성되게 하려면 다음과 같이 설정값을 수정해야 한다.

ulimit 설정 값 변경은 위의 현재 설정값에서 나온 옵션을 써주고 값을 써주면 된다.

[root@devlinux ~]# ulimit -c unlimited
[root@devlinux ~]# ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 98304
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 98304
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

위와 같은 명령으로 변경한 것은 해당 user만 변경되어 적용이 되며, reboot 후에는 다시 설정을 해야한다.
위의 설정을 reboot 후에도 유지되게 하기 위해선 아래의 파일 수정이 필요하다.


/etc/security/limits.conf


위 파일에는 ulimit값을 적용할 domain, type, item, value가 들어가게 되어있다.
입력 형식은 다음과 같다.


<domain> <type> <item> <value>
< domain> 해당 설정값을 적용시킬 범위
- user name (userid) - 한 유저의 설정 변경
- group name (@groupid) - 한 그룹에 대한 설정 변경
- wildcard (*) - 모든 유저, 그룹에 대한 설정 변경
- wildcard (%) - * 와 동일, 단 maxlogins 변경에만 사용

<type>
- hard : superuser와 kernel에 의해 설정이 되게 하며, user는 설정된 값 이상으로 변경이 불가능하다.
- soft : soft로 설정한 값은 user가 얼마든지 설정값을 변경 가능하다.
- - : hard와 soft 둘다 설정

<item>
- core : limits the core file size (KB)
- data : maximum data size (KB)
- fsize : maximum filesize (KB)
- memlock : maximum locked-in-memory address space (KB)
- nofile : maximum number of open files
- rss : maximum resident set size (KB) (Ignored in Linux 2.4.30 and higher)
- stack : maximum stack size (KB)
- cpu : maximum CPU time (minutes)
- nproc : maximum number of processes
- as : address space limit
- maxlogins : maximum number of logins for this user
- maxsyslogins : maximum number of logins on system
- priority : the priority to run user process with (negative values boost process priority)
- locks : maximum locked files (Linux 2.4 and higher)
- sigpending : maximum number of pending signals (Linux 2.6 and higher)
- msqueue : maximum memory used by POSIX message queues (bytes) (Linux 2.6 and higher)
- nice : maximum nice priority allowed to raise to (Linux 2.6.12 and higher)
- rtprio : maximum realtime priority allowed for non-privileged processes (Linux 2.6.12 and higher)

example) core dump file size를 변경

astrix - core 1000
@group1 - core unlimited
* - core 200000

이 설정을 변경 하였는데도 불구하고, reboot 시 적용이 안된다면 /etc/profile 파일을 살펴보자!!

...

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
...


위 빨간 글자로 된 부분을 주석처리 해버리고 reboot하면 적용 된다.

'OS > Linux' 카테고리의 다른 글

SUDO 제한 방법  (0) 2013.01.10
Python 설치(easy install)  (0) 2013.01.10
커널 파라미터 설정 정보  (0) 2013.01.10
커널 패닉 시 자동 리부팅 설정  (0) 2013.01.10
메모리 누수 확인 방법  (0) 2013.01.10