'ITWeb/서버관리'에 해당되는 글 125건

  1. 2011.09.21 tracd 실행 shell 스크립트
  2. 2011.09.07 php 설치 오류 -lltdl
  3. 2011.09.07 [개발서버] rsyncd 설정
  4. 2011.09.07 [Mail] MTA, MUA, MDA, MRA....
  5. 2011.09.07 apache ab 사용방법.
  6. 2011.09.07 ssh no passphrase 생성.
  7. 2011.09.07 서버 IP 변경
  8. 2011.09.07 [Trac] SVN commit 로그와 ticket 연동 하기
  9. 2011.09.07 sendmail 실행/발송
  10. 2011.09.07 [Trac] Custom field 사용하기.

tracd 실행 shell 스크립트

ITWeb/서버관리 2011. 9. 21. 10:20

#!/bin/sh

echo "You must start by sudo!! Check up."
tracd -s --port 8000 --basic-auth="PROJECT,/home/계정/conf/trac/passwd,DOMAIN" /home/계정/service/trac/PROJECT > /dev/null 2>&1 &
:

php 설치 오류 -lltdl

ITWeb/서버관리 2011. 9. 7. 14:48

php 설치 시 오류

/usr/bin/ld: cannot find -lltdl 

yum install libtool-ltdl-devel

:

[개발서버] rsyncd 설정

ITWeb/서버관리 2011. 9. 7. 14:48

[기본설명]

rsyncd.conf 를 설정한 서버가 source 가 되며 client 에서는 read 만 가능 하도록 설정 하여 사용을 한다.

 

sudo vi /etc/xinetd.d/rsync

service rsync
{
        disable = no
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}

disable = yes 를 disable = no 로 변경

 

service xinetd restart

 

sudo vi /etc/rsyncd.conf

[temp]
path=/home/계정/temp
hosts allow=192.254.0.0/16
uid = nobody
gid = nobody
use chroot = yes
max connections = 4

192.254.0.0 ~ 192.254.255.255 까지 접속 가능 하며

/home/계정/temp 아래 파일을 읽어 갈수 있다.

 

[source]

- hostname : src1

 

[client]

- command : rsync -avz --progress  src1::temp/temp.log .

- src1 서버에 temp.log 파일을 가져와라. src1::temp 는 client 에서 알 필요가 없다.

:

[Mail] MTA, MUA, MDA, MRA....

ITWeb/서버관리 2011. 9. 7. 14:46

인터넷 메일 시스템은 상당히 복잡해 보이지만 여러 요소로 이루어진 하나의 시스템으로 보통 다음과 같은 요소로 구성 되어 있습니다.

 

MTA (Mail Transfer Agent)
인터넷 상에 있는 어떤 컴퓨터로부터 다른 컴퓨터로 전자 메일을 전송하는 서버 프로그램

 

MUA (Mail User Agent)
사용자가 전자 메일을 송수신할 때 사용하는 클라이언트 프로그램

 

MDA (Mail Delivery Agent)
MTA가 수신한 메시지를 사용자의 우편함에 쓰기 위한 프로그램

 

MRA (Mail Retrieval Agent)
리모트 서버에 있는 우편함으로부터 사용자의 MUA로 메시지를 가져오는 프로그램

 

일반적인 메일의 전달 과정은 다음과 같습니다.
전자 메일은 사용자가 MUA를 이용하여 MTA로 보냅니다. 이 송신 MTA는 메시지가 목적지에 도착할 때까지 메시지를 하나 혹은 그 이상의 MTA로 전송하게 됩니다. 목적지 MTA(수신 MTA)에 도달된 메시지는 사용자 정보에 따라서 MDA로 전송 되어 지며, MDA는 메시지를 수신자의 우편함에 쓰게 됩니다. 수신자는 메시지를 읽기 위해서 자신의 메일 서버에 직접 접근하거나 MUA를 사용하여 자신의 메일 서버의 우편함으로부터 메시지를 로컬로 가져옵니다. 이 때 MUA가 메시지를 분류하거나 정렬하기도 합니다. 수신자가 로컬이 아닌 리모트 메일 서버로부터 메일을 읽어 올 때 MRA를 사용합니다.

MUA로부터 MTA까지는 SMTP(Simple Mail Transfer Protocol)을 사용하여 메시지를 보내며, MTA와 MTA 사이에도 SMTP가 사용됩니다. MUA는 MRA를 통하여 POP(Post Office Protocol)나 IMAP (Internet Message Access Protocol)을 주로 사용하여 메일 서버로부터 로컬로 메시지를 읽어 옵니다.

:

apache ab 사용방법.

ITWeb/서버관리 2011. 9. 7. 14:46

refs. http://nickdenardis.com/2007/06/27/stress_testing_a_site_with/

Stress testing a site with Apache’s ab tool, part 1

Apache’s AB tool is a great way to really put stress on a server. I have compiled a list of the parameters I use to test my sites and applications.

First we have to make sure AB can hit the desired page and get the desired results. The most basic page is the homepage of a site, use the command below to send as many single requests as it can in 1 second

ab http://example.com/

But that is great and dandy but what happens if we want to try to stress a page that hits the database and has to do some actual dynamic work

ab http://example.com/search.php?q=Trees

Last but not least what if the site is behind a login that is an http form and not an htaccess form? That is where POST variables come into play, it is a little trickier but doable. Here is the command I use to hit a page behind a login.

ab -p ~/Documents/post.txt -T application/x-www-form-urlencoded -e http://example.com/manager/

Here is what my post.txt file contains:

email=test@domain.com&password=testing&submit=Login

Next we need to get these results to a file so we can work with them and have a record of progress as we tweak our site. It can be done with the “-e” parameter. An example is below:

ab http://example.com/search.php?q=Trees -e ~/Documents/results1.csv

What that does is hits the search page and puts the results in the results1.csv file. It is useful to put the file at the end of the command since you will want to change the filename on each run to keep a history of your results.

The csv file is separated into two columns. The first is the percentage complete and the second is the time in ms that it took to get to that percentage.

The first thing you want to look at is the zero percent. This is your latency, it is the amount of time it takes to fulfill the first request. You want this number to be as low as possible. I am running my site on a development server on my local network so the times will be lower but at the end I will show the results from the testing server.

ab -p ~/Documents/aci_post.txt -T application/x-www-form-urlencoded -e ~/Documents/aci_output.csv -kc 10 -t 10 http://aci/manager/makes.php
:

ssh no passphrase 생성.

ITWeb/서버관리 2011. 9. 7. 14:19

1. 관문이 되는 gateway 서버에서 key 생성

ssh-keygen -t rsa

암호 입력 없이 엔터 세번

 

Generating public/private rsa key pair.
Enter file in which to save the key (/home/계정명/.ssh/id_rsa):
Created directory '/home/계정명/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/계정명/.ssh/id_rsa.
Your public key has been saved in /home/계정명/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4

 

cat id_ras.pub

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvtSlFMETwPauw5qHjyC4FD9J0AoeHSc9waZGMr70OSJruOXC5rxqfgvj0Ux1J+1ZQADgXz5wvP8Z9UL4hoa0Mq+eTVxOdC40AV3YtiXZA+7y/SQKy5EHdRsFTU+7QQVYm5S/nPnV0QU+g8WzCegZB5hwrQCFE7PzDGYeRPS0lK6fuYo74Q5U9n+AjPloaK7qgnKkEuShr1yIxvdfQkemrGSgmC1z7pYrNHjbpCYRngxnS60iNkRmicDJb5XmgTTNfClOuwaf2xyQYbh5+Qo1PLo9eQ/xDtKoxij4p0Mp1yCU/wYWP+HRwbKyvjaWjS3fN/dSRodNRbDQu+ZnNfl4nQ== j계정명@HOSTNAME

 

2. gateway 서버에서 접속하고자 하는 서버들에 authorized_keys 생성

mkdir .ssh

cd .ssh

vi authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvtSlFMETwPauw5qHjyC4FD9J0AoeHSc9waZGMr70OSJruOXC5rxqfgvj0Ux1J+1ZQADgXz5wvP8Z9UL4hoa0Mq+eTVxOdC40AV3YtiXZA+7y/SQKy5EHdRsFTU+7QQVYm5S/nPnV0QU+g8WzCegZB5hwrQCFE7PzDGYeRPS0lK6fuYo74Q5U9n+AjPloaK7qgnKkEuShr1yIxvdfQkemrGSgmC1z7pYrNHjbpCYRngxnS60iNkRmicDJb5XmgTTNfClOuwaf2xyQYbh5+Qo1PLo9eQ/xDtKoxij4p0Mp1yCU/wYWP+HRwbKyvjaWjS3fN/dSRodNRbDQu+ZnNfl4nQ== j계정명@HOSTNAME

 

chmod 600 authorized_keys

※ chmod 600 을 안하면 암호를 물어 보기 때문에 permission 에 주의 할것!!

 

3. gateway 서버에서 원격서버로 접속 테스트 되면 끝.

 

public key 가 원격지 서버에 authorized_keys 로 복사 되어 있으면 됨.

 

※ 쌍방향으로 로그인이 되게 하려면 private key 도 함께 복사해 놓으면 끝.

 

cat authorized_keys | ssh HOSTNAME 'cat >> .ssh/authorized_keys; cd /home/계정/.ssh; chmod 600 authorized_keys'

:

서버 IP 변경

ITWeb/서버관리 2011. 9. 7. 14:16

/etc/sysconfig/network 파일을 설정

#vi /etc/sysconfig/network
- 호스트네임과 게이트웨이를 변경함

interface 장치파일 설정( /etc/sysconfig/network-scripts/ifcfg-eth0)
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 : 이네넷카드가 ech0일때)
  - broadcast, network, netmask, ip address변경

network 서비스 restart
# /etc/rc.d/init.d/network restart

:

[Trac] SVN commit 로그와 ticket 연동 하기

ITWeb/서버관리 2011. 9. 7. 14:15

http://trac.edgewall.org/wiki/CommitTicketUpdater
tracopt.ticket.commit_updater.* = enabled
wget http://ftp.edgewall.com/pub/trac/Trac-0.11.7.tar.gz

0.12.2 에는 trac-post-commit-hook 파일이 없어 0.11.7 압축푼 후 복사해서 사용
로그 연동을 위해서 http auth 를 사용하지 않을 경우 svn 프로토콜로 인증 사용하여 구현

 

 

http://yshmnet.homelinux.com/wordpress/?p=311


SVN commit을 trac과 연동하여 특정 동작을 수행하도록 지정할 수 있다.

trac에서는 bug, 개발작업, 등의 내용을 ticket을 작성하여 관리한다. ticket을 작성하는 경우 일반적으로, ticket을 open한다고 한다.
ticket을 open하면, 해당 ticket의 내용을 보고, 관련 작업이 source와 관련된 경우, source code작업을 완료한 후 ticket을 close한다.
이때, ticket을 close하는 작업을 svn commit시에 자동으로 이루어 지도록 할 수 있다.

실제로는, svn commit이 발생할때 log를 hooking해서, 해당 log에 ticket 정보가 있는지 확인하고, ticket정보가 있다면,
해당 ticket을 close하거나, 해당 ticket에 log를 남기게 된다.

post-commit hook template으로부터 post-commit hook script 생성

svn의 hook은 commit외에 다른 작업에도 사용할 수 있도록 다양한 script들을 제공하지만, commit이 완료된 이후에 적용될 수 있도록 한다.
hook은 각 repository별로 따로 지정할 수 있고, 각 repository의 hooks에 hook을 위한 template들이 준비되어 있다.

먼저, 다음과 같이 post-commit hook template를 복사하고, 실행 속성을 준다.

/svnroot/project/hooks# cp post-commit.tmpl post-commit
/svnroot/project/hooks# chmod 755 post-commit
복사한, post-commit의 내용을 아래와 같이 svnlook을 이용하도록, 수정한다.

/svnroot/project/hooks# vi post-commit
...
REPOS="$1"
REV="$2"
 
#commit-email.pl "$REPOS" "$REV" commit-watchers@example.org
#log-commit.py --repository "$REPOS" --revision "$REV"
 
SVNLOOK=/usr/bin/svnlook
 
LOG=`$SVNLOOK log -r "$REV" "$REPOS"`
AUTHOR=`$SVNLOOK author -r "$REV" "$REPOS"`
DIRS="`$SVNLOOK dirs-changed -r "$REV" "$REPOS"`"
$REPOS/hooks/trac-post-commit-hook -p /tracroot/project \
    -r "$REV" -u "$AUTHOR" -m "$LOG"
이 hook은 svn에서 commit시에 repository 정보, revision 정보, 사용자 정보와 log message를 trac-post-commit-hook에 전달하게
된다.

Trac source package로부터 trac-post-commit-hook 생성

trac-post-commit-hook은 Trac source package의 contrib directory에서 제공되므로, 다음과 같이 복사해서 그대로 사용한다.

/svnroot/project/hooks# cp /trac-0.11.5/contrib/trac-post-commit-hook .
/svnroot/project/hooks# chmod 755 trac-post-commit-hook
svn commit시에 ticket을 close하거나, comment 저장 방법

svn commit시에 trac의 ticket에 그 정보를 전달하여, 2가지 action을 취할 수 있는데, ticket을 close하거나, log정보를 저장하고, ticket의 상태는 변경하지 않는것이다.

다음은 ticket을 close하기 위하여 log message에 포함되어야 하는 내용이다. 여기서는 ticket 5번과 10번인 경우를 예로 든다.

close #5, #10
close #5 & #10
close #5 and #10
close ticket:5, ticket:10
“close”대신에, “closed”, “closes”, “fix”, “fixed”, “fixes”등을 사용할 수 있으며, commit log에 위의 내용들이 포함된 경우 ticket은 close된다.

ticket을 close하지 않고, 현재까지 작업한 내용에 대한 commit log message를 추가할 수 있다.

refs #5, #10
refs #5, #10
refs #5 & #10
refs #5 and #10
refs ticket:5, ticket:10
“refs”대신에, “references”, “addresses”, “re”, “see”등을 사용할 수 있으며, 위와 같이 사용된 경우 ticket의 status는 변경되지 않고, log message가 추가된다.

 

:

sendmail 실행/발송

ITWeb/서버관리 2011. 9. 7. 14:14

# /etc/rc.d/init.d/sendmail start | restart | stop

OR

# /etc/init.d/sendmail start | restart | stop

OR

# service sendmail start | restart | stop

 

# service saslauthd start

 

# telnet localhost 25
<안내 메시지가 나옴>
mail from:aaaa@naver.com
<성공 메시지가 나옴>
rcpt to:bbbb@naver.com
<성공 메시지가 나옴>
data
<메시지 작성 후 '.' 입력>
quit

:

[Trac] Custom field 사용하기.

ITWeb/서버관리 2011. 9. 7. 14:13

trac.ini 에 아래 코드 추가

 

[ticket-custom]

test_one = text
test_one.label = Just a text box

test_two = text
test_two.label = Another text-box
test_two.value = Just a default value

test_three = checkbox
test_three.label = Some checkbox
test_three.value = 1

test_four = select
test_four.label = My selectbox
test_four.options = one|two|third option|four
test_four.value = two

test_five = radio
test_five.label = Radio buttons are fun
test_five.options = uno|dos|tres|cuatro|cinco
test_five.value = dos

test_six = textarea
test_six.label = This is a large textarea
test_six.value = Default text
test_six.cols = 60
test_six.rows = 30

: