Unix/Solaris10

GNU Mailman 재도전

ForceCore 2007. 11. 5. 00:24
전에는 비참하게 실패했고 일찍 포기했다 ㅡ,.ㅡ
Mailman이 좋은 게, 웹으로 메일링스트 자동 가입 신청이 가능하단 것!
http://blog.naver.com/ssanzing2/140041409921
재도전이다.

거의 그대로 하고,
$ make install시도!
mailman도 버전업 해서 이번엔 에러메시지가 바뀌어있었다.

Traceback (most recent call last):
  File "bin/update", line 46, in <module>
    import paths
  File "/usr/local/mailman/bin/paths.py", line 60, in <module>
    import korean
ImportError: No module named korean

어쨌거나 한국어 관련. 구리다 -_-...;;
CJK코덱 (chinese, japanese, korean)코덱은 2.4부터 디폴트로 들어가있다지만...
일단은 CJK코덱을 설치해보기로 결정.
http://cjkpython.i18n.org/
여기가 공식사이트다. 필자는  cjkcodecs-1.1.1.tar.bz2 (Source tarball in bzip2)
를 받았다. 그리고 압축해제.
README파일을 읽어보니

# python setup.py install

로 설치하면 된다는군. 애먹이지 않고 쉽게 설치되었다.

다시
$make install
...

CJK코덱 문제가 아니다 ㅡ,.ㅡ
mailman소스안의 misc에 보면 korean codec이 있고 그것을
$ python setup.py install
를 해야 한다.

src/hangul.c:33: error: syntax error before numeric constant
src/hangul.c:34: error: syntax error before numeric constant
다시 이전의 버그로 돌아왔군! (포기했었을 때의 그 에러.)

misc안에서,
$ perl -i -pe 's/GS, N/MYGS, N/; s/CODE.GS./CODE(MYGS)/; s/SS, N/MYSS, N/; s/CODE.SS./CODE(MYSS)/;' KoreanCodecs-2.0.5/src/hangul.c
명령을 쓴다. 그러면 python setup.py install이 성공할 것이다...
솔라리스만의 문제이다. namespace끼리 충돌하는 것이라서 hangul.c만 좀 개조해야 하는데 위 명령어는 개조 작업을 자동으로 해준다. 그래도 이후에도 문제가 있을 수 있다. 아래 case로 정리해 두었다.

case1.
AttributeError: class Jaeum has no attribute 'SS'
Python 버전이 낮아서 그랬는 듯.
python 2.4.x를 쓰다가 2.5.1로 바꿔서 설치하니 (물론 패키지) 이 에러는 없어지고 아래 case2의 에러로 변했다.

case 2.
ImportError: No module named _md5
python 2.5.1을 설치하면 이런 메시지가 나오면서 make install이 실패한다.
openssl-0.9.8f (썬프리웨어에서 python의 requirement로 요구한다.)를 설치하니 해결되었다.
http://www.thescripts.com/forum/thread553380.html
위 글을 보고 openssl문제라는 힌트를 얻을 수 있었다.
이후 성공함.

다시 mailman을
# make install
성공! 후후후후후..

# cd /usr/local/mailman
# bin/check_perms -f
그러면 파일 퍼미션이 현재 어떠한지 체크할 것이다.
-f를 붙여서 실행했기 때문에 알아서 fix까지 해준다.
에러가 없을 때 까지 반복실행.

Warning: Private archive directory is other-executable (o+x).
         This could allow other users on your system to read private archives.
         If you're on a shared multiuser system, you should consult the
         installation manual on how to fix this.

이 에러만은 수동수정해야 함.
archives/private를 chmod o-x 해준다.

# chmod o-x archives/private
그리고 웹서버유저에게 소유권을 주기도 해야 함.
# chown webservd archives/private

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

이제 mailman을 postfix와 apache와 연동시키는 것이 남았다.
Mailman은 CGI로 돌아가는데...

Apache2의 ScriptAlias를 쓰자.
ScriptAlias로 httpd.conf를 검색해보면
ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
이런 것이 있는데 이것을 컨닝해서 (물론 README에 있기도 하지만.)
ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"
이렇게 적어주었다.

메일맨 로고 복사.
# cp /usr/local/mailman/icons/*.{jpg,png} /usr/local/apache2/icons

Alias로 걸 것이 또 있는데,
Alias /icons/ "/usr/local/apache2/icons/" 를 컨닝해서 그 밑에

Alias /pipermail/ "/usr/local/mailman/archives/public/"
<Directory "/usr/local/mailman/archives/public/">
        AddDefaultCharset Off
</Directory>
추가.

아파치 재시작. /mailman/을 웹으로 접근하려면 forbidden이 떠야 한다. (not found가 아니라)
그리고 /pipermail/역시 그래야 한다. 끝에 /를 안 붙이면 Not Found, 붙이면 Forbidden으로 뜰 것이다. ㅡ,.ㅡ... 그 점을 주의할 것.

----------------------------------------------------------------------
Postfix와 연동 처리
아직 postfix도 완전히 돌아가는 상태가 아니라 보류....
하였지만 최근에 다시 시도중.
http://blog.naver.com/ssanzing2/140047262760
글을 참고하시오.