본문 바로가기

리눅스

[WIP] SquirrelMail 설치 및 Apache 연동 설정 (CentOS/RHEL)

728x90

[WIP] SquirrelMail 설치 및 Apache 연동 설정 (CentOS/RHEL)

SquirrelMail은 PHP 기반의 웹메일(Webmail) 서비스로 IMAP 서버와 연동하여 브라우저 환경에서 메일을 사용할 수 있도록 지원합니다.

1. Apache(httpd) 설치

먼저 웹메일 서비스를 제공하기 위한 Apache 웹 서버를 설치합니다.

yum install httpd

systemctl enable httpd
systemctl start httpd

systemctl status httpd

2. MySQL 설치

메일 시스템에서 사용할 데이터베이스 환경이 필요한 경우 MySQL을 설치합니다.

yum install -y mysql mysql-server

systemctl enable mysqld
systemctl start mysqld

3. PHP 설치

SquirrelMail은 PHP 기반으로 동작하기 때문에 PHP 환경을 구성합니다.

yum install -y php

php -v

4. PHP MySQL 연동 모듈 설치

PHP에서 MySQL을 사용할 수 있도록 연동 모듈을 설치합니다.

yum install -y php-mysql

systemctl restart httpd

5. PHP 문자셋 모듈 설치

한글 메일 및 멀티바이트 문자를 정상 처리하기 위해 mbstring 모듈을 설치합니다.

yum install -y php-mbstring

systemctl restart httpd

6. SquirrelMail 설치

SquirrelMail 패키지를 설치합니다.

yum -y install squirrelmail

rpm -ql squirrelmail | head

기본 설치 경로

/usr/share/squirrelmail
728x90

7. SquirrelMail 환경 설정

설정 파일 생성 및 수정은 제공되는 설정 도구를 이용합니다.

/usr/share/squirrelmail/config/conf.pl
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages
 
D.  Set pre-defined settings for specific IMAP servers
 
C   Turn color off
S   Save data
Q   Quit
 
Command >> 2
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
 
General
-------
1.  Domain                 : localhost
2.  Invert Time             : false
3.  Sendmail or SMTP       : Sendmail
 
A.  Update IMAP Settings   : localhost:143 (uw)
B.  Change Sendmail Config : /usr/sbin/sendmail
 
R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit
 
Command >> 1
The domain name is the suffix at the end of all email addresses.  If
for example, your email address is jdoe@example.com, then your domain
would be example.com.
 
[localhost]: sangchul.kr
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
 
General
-------
1.  Domain                 : sangchul.kr
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail
 
A.  Update IMAP Settings   : localhost:143 (uw)
B.  Change Sendmail Config : /usr/sbin/sendmail
 
R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit
 
Command >> A
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
 
General
-------
1.  Domain                 : sangchul.kr
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail
 
IMAP Settings
--------------
4.  IMAP Server            : localhost
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : uw
9.  Delimiter              : /
 
B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings
 
R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit
 
Command >> 4
This is the hostname where your IMAP server can be contacted.
[localhost]: sangchul.kr
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
 
General
-------
1.  Domain                 : sangchul.kr
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail
 
IMAP Settings
--------------
4.  IMAP Server            : sangchul.kr
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : uw
9.  Delimiter              : /
 
B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings
 
R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit
 
Command >> 8
Each IMAP server has its own quirks.  As much as we tried to stick
to standards, it doesn't help much if the IMAP server doesn't follow
the same principles.  We have made some work-arounds for some of
these servers.  If you would like to use them, please select your
IMAP server.  If you do not wish to use these work-arounds, you can
set this to "other", and none will be used.
    cyrus       = Cyrus IMAP server
    uw          = University of Washington's IMAP server
    exchange    = Microsoft Exchange IMAP server
    courier     = Courier IMAP server
    macosx      = Mac OS X Mailserver
    hmailserver = hMailServer
    other       = Not one of the above servers
[uw]: other
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
 
General
-------
1.  Domain                 : sangchul.kr
2.  Invert Time             : false
3.  Sendmail or SMTP       : Sendmail
 
IMAP Settings
--------------
4.  IMAP Server            : sangchul.kr
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : other
9.  Delimiter              : /
 
B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings
 
R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit
 
Command >> S
Data saved in config.php
Press enter to continue...
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
 
General
-------
1.  Domain                 : sangchul.kr
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail
 
IMAP Settings
--------------
4.  IMAP Server            : sangchul.kr
5.  IMAP Port              : 143
6.  Authentication type    : login
7.  Secure IMAP (TLS)      : false
8.  Server software        : other
9.  Delimiter              : /
 
B.  Change Sendmail Config : /usr/sbin/sendmail
H.  Hide IMAP Server Settings
 
R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit
 
Command >> Q
Exiting conf.pl.
You might want to test your configuration by browsing to
http://your-squirrelmail-location/src/configtest.php
Happy SquirrelMailing!

8. SquirrelMail Apache Alias 설정

SquirrelMail 설치 시 Apache 설정 파일이 생성됩니다.

cat /etc/httpd/conf.d/squirrelmail.conf
#
# SquirrelMail is a webmail package written in PHP.
#
 
Alias /webmail /usr/share/squirrelmail

9. Apache VirtualHost 설정

웹메일 전용 VirtualHost를 구성합니다.

vim /etc/httpd/conf/httpd.conf
...
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
    ServerAdmin webmaster@sangchul.kr
    DocumentRoot /usr/share/squirrelmail
    ServerName webmail.sangchul.kr
    ErrorLog logs/webmail.sangchul.kr-error_log
    CustomLog logs/webmail.sangchul.kr-access_log common
</VirtualHost>
apachectl configtest

systemctl restart httpd

10. SquirrelMail 접속 테스트

브라우저에서 접속합니다.

http://webmail.sangchul.kr

또는

http://mail.sangchul.kr/webmail/src/login.php

SquirrelMail

11. SquirrelMail 설정 테스트

설정 검증 페이지

http://webmail.sangchul.kr/src/configtest.php

확인 항목

  • PHP 동작 여부
  • IMAP 연결 여부
  • SquirrelMail 설정 상태

SquirrelMail은 단독 메일 서버가 아니라 웹 인터페이스 역할을 수행하며 실제 메일 송수신은 SMTP(Postfix 등)와 IMAP(Dovecot 등) 서버가 담당합니다.

 

아파치 구성 테스트 systemctl httpd 다시 시작
 
728x90