'프로그래밍'에 해당되는 글 100건

  1. 2013/04/22 용비 ODP 개발 서버 환경
  2. 2013/04/22 용비 CentOS 5.4 + PostgreSQL 8.1.23 설치
  3. 2013/04/19 용비 CentOS 5.4 + Apache + mod_wsgi 설치
  4. 2013/04/19 용비 CentOS 5.4 + nGinX + uWSGI Install
  5. 2013/04/09 용비 CentOS 5.4 Apache 2.4.4 설치 [mpm]

ODP 개발 서버 환경

Articles 2013/04/22 18:26 용비
1. OS : Linux CentOS 5.4
2. Java : OpenJDK 1.6.0.31
3. Database : PostgreSQL 8.1.31
4. WAS : Jboss 7.1.1.Final
5. Gateway Application : Jersey를 이용한 Java Servlet
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/555

<PostgreSQL Install>

  • 의존 라이브러리 설치

yum -y install zlib curl gcc g++ cpp gcc-c++ compat-gcc-34-g77 libxml2 libxml2-devel gd gd-devel freetype freetype-devel libpng libpng-devel libjpeg libjpeg-devel fontconfig  fontconfig-devel mhash mhash-devel libmcrypt libmcrypt-devel openssl openssl-devel gmp gmp-devel flex libtermcap-devel ncurses-devel libc-client-devel bzip2-devel termcap libtermcap gdbm-devel readline-devel zlib-devel tcl-devel python-devel


  • PostgreSQL 8.1.23 설치

./configure --prefix=$HOME/pgsql

make && make install


  • PostgreSQL 초기화

Initdb -D $HOME/pgsql/data


  • PostgreSQL DB 시작

bin/pg_ctl -D $HOME/pgsql/data -l logfile start


  • Database 생성

bin/createdb database_name


  • PostgreSQL SQL Console 사용

bin/psql database_name


  • PostgreSQL SQL Console 종료

\q


  • PostgreSQL Table 생성

Create table table_name (column_name varchar(10), mod_date TIMESTAMP....);


  • PostgreSQL Column 추가

Alter table table_name ADD column_name varchar(10);


  • PostgreSQL Column 변경

Alter table table_name rename column column_name to new_column_name;


  • 생성한 테이블 조회

Select * from pg_tables where schemaname='public';


  • 테이블의 Column 정보 조회

Select * from information_schema.columns where table_name='table_name';


  • PostgreSQL 사용자 생성

bin/createuser -s username -P

Enter password for new role : xxx


  • PostgreSQL 사용자 조회

select * from pg_user;


  • PostgreSQL User 권한 주기

Grant all on all tables in schema public to user_id;

받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/554

<Binary Versions>
Apache : 2.4.4
mod_wsgi : 3.4
Python : 2.7.3

<Binary Install>
1. Python 2.7.3
<의존 라이브러리 설치>
yum install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-develsqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel

<Python 설치>
./configure --prefix=$HOME/python --with-threads --enable-shared
make && make install

<Profile에 환경변수 추가>
vi .bash_profile

PATH=$PATH:$HOME/python/bin:$HOME/python/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/python/lib:$HOME/python/bin
alias python='$HOME/python/bin/python2.7'

2. Apache 2.4.4
<Pre-requirement>
   - apr-1.4.6, apr-util-1.5.2 필요함
   - 위 2개의 파일을 httpd-2.4.4/srclib 폴더 아래에 압축 해제

<Apache Install>
./configure --prefix=$HOME/apache2 --with-included-apr
make && make install


3. mod_wsgi 3.4
<mod_wsgi 설치>
LD_LIBRARY_PATH=$HOME/python/lib  ./configure --with-apxs=$HOME/apache2/bin/apxs --with-python=$HOME/python/bin/python
make && make install

<mod_wsgi 설치 확인>
$HOME/apache2/modules/mod_wsgi.so가 있는지 확인
4. Apache 설정 변경
   vi httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so

WSGIDaemonProcess daemon processes=2 threads=15
WSGIScriptAlias / /wsgi/file/path/test.py

<Directory />
     AddHandler wsgi-script .py
</Directory>
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/553

<Binary Versions>
nGinX : 1.2.8
uWSGI Module : 1.9.5
Python : 2.7.3

<Install>
1. Python Install
<의존 라이브러리 설치>
yum -y install gcc* automake autoconf libtool make termcap libtermca* gdbm-devel zlib* libxml* freetype* libpng* libjpeg* gd* libmcrypt* mhash* apr apr-* pcre* bzip2-devel openssl* libevent-deve

<Python 설치>
./configure --prefix=$HOME/python

2. uWSGI Module Install
<실행 바이너리 빌드>
- tar 명령으로 압축 해제
- 압축 해제된 폴더에서 다음 커맨드 실행 :
   python uwsgiconfig.py --build

3. uWSGI Module 설치 확인
<샘플 코드 작성>
# test.py
def app(env, start_response):
  start_response('200 OK', [('Content-Type', 'text/html')])
  return "Hello World"

<샘플 코드 실행>
uwsgi --http :8000 --wsgi-file test.py

<샘플 코드 실행 결과>
웹브라우저에서 127.0.0.1:8000 호출시 Hello World가 보이면 모듈 설치 성공

4. nGinx Install
<의존 라이브러리 설치>
yum -y install gcc g++ cpp gcc-c++ pcre-devel openssl openssl-devel gd gd-devel

<nGinX 설치>
./configure --prefix=$HOME/nginx \
--conf-path=$HOME/nginx/conf/nginx.conf \
--sbin-path=$HOME/nginx/sbin/nginx \
--lock-path=$HOME/nginx/lock/nginx.lock \
--pid-path=$HOME/nginx/run/nginx.pid \
--http-client-body-temp-path=$HOME/nginx/lib/nginx/body \
--http-proxy-temp-path=$HOME/nginx/lib/nginx/proxy \
--http-fastcgi-temp-path=$HOME/nginx/lib/nginx/fastcgi \
--http-uwsgi-temp-path=$HOME/nginx/lib/nginx/uwsgi \
--http-scgi-temp-path=$HOME/nginx/lib/nginx/scgi \
--http-log-path=$HOME/nginx/logs/access.log \
--error-log-path=$HOME/nginx/logs/error.log \
--with-http_addition_module \
--with-http_addition_module \
--with-http_degradation_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_image_filter_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_realip_module \
--user=nobody \
--group=nobody

<nginx.conf 수정>
- nginx web server와 uwsgi module 연결할 수 있도록 설정 변경해야 함
server {
      listen 8080;
      server_name localhost;
      charset utf-8;

      client_max_body_size 75M;

      location / {
             uwsgi_pass 127.0.0.2:8000;
             include uwsgi_params;
      }
}

5. nginx, uwsgi module 기동
 - uWSGI Module 기동
uwsgi --http :8000 --wsgi-file test.py

- nginx 기동
$HOME/nginx/bin/nginx
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/552

1) 기존 설치된 Apache 제거
(1) root 계정으로 로그인 : su
(2) 실행중인 httpd 프로세스 검색 : ps -ef | grep httpd
(3) 실행중인 httpd 프로세스가 있으면 종료 : /etc/rc.d/init.d/httpd stop
(4) 패키지 제거 : yum remove -q httpd
(5) Apache control 검색 : find / -name apachectl
(6) 만약 apachectl이 /usr/local/apache/bin/apachectl에 설치되었을 경우, 폴더 삭제 : rm -rf /usr/local/apache
(7) root 계정 로그아웃 : exit

2) 최선 버전 Apache 다운로드
(1) wget http://ftp.daum/net/apache//httpd/httpd-2.4.4.tar.gz
(2) 압축 해제 : tar -zxvf httpd-2.4.4.tar.gz

3) APR (Apache Portable Runtime) 코어 라이브러리 다운로드
(1)  apr-1.4.6.tar.gz, apr-util-1.5.1.tar.gz 다운로드
(2) 압축 해제
(3) apr, apr-util로 이름 변경
(4) httpd-2.4.4/srclib/ 폴더로 apr, apr-util 폴더 이동

4) Apache 설치를 위한 Dependency 라이브러리 설치
(1) yum install apr-devel apr-util-devel gcc pcre-devel.x86_64 zlib-devel openssl-devel

5) Apache 설치
(1) cd $HOME/httpd-2.4.4
(2) ./configure --prefix=$HOME/apache2 --with-included-apr --with-included-apr-util
(3) make; make install
※ mpm 옵션을 주지 않으면 기본 설정은 "event" 방식 입니다. --with-mpm=worker, --with-mpm=prefork
※ 만약 모든 mpm 옵션을 동적으로 설정하고 싶으면 "--enable-mpms-shared=all" 옵션을 추가 하면 됩니다.
ex) ./configure --prefix=$HOME/apache2 --enable-mods-shared=most --enable-ssl --with-ssl=/usr/local/openssl --enable-modules=ssl --enable-rewrite --with-included-apr --with-included-apr-util --enable-deflate --enable-expires --enable-headers --enable-proxy --enable-mpms-shared=all

6) 설치 확인
(1) 아파치 버전 정보 : $HOME/apache2/bin/httpd -V
(2) 컴파일된 모듈 리스트 : $HOME/apache2/bin/apachectl -l
             -core.c
             -mod_so.c
             -http_core.c
             -event.c
             (리스트 중에 event.c가 없으면 새로 설치할 것)

7) Apache 기본 포트 변경 (80 -> 8080)
(1) httpd.conf 수정 : vi $HOME/apache2/conf/httpd.conf ; Listen 80 -> 8080으로 변경
(2) 8080 방화벽 포트 설정 :
(3) 아파치 실행 : $HOME/apache2/bin/apachectl start
(4) 실행중인 apache 프로세스 확인 : ps -ef | grep httpd

8) mpm 튜닝
(1) 주석 해제 :  vi $HOME/apache2/conf/httpd.conf
Include conf/extra/httpd-mpm.conf
(2) 파일 생성 : vi $HOME/apache2/conf/extra/httpd-mpm.conf
<IfModule mpm_event_module>
  ThreadLimit            100
  StartServers           5
  MaxRequestWorkers     5500
  ServerLimit           200
  MinSpareThreads        100
  MaxSpareThreads     1000
  ThreadsPerChild       100
  MaxRequestsPerChild    0
</IfModule>

받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/551