본문 바로가기
카테고리 없음

[Linux] 메일 서버 시리즈 - mailcow

by james_janghun 2024. 11. 20.

 

메일서버 관련해서 학습하다 보면 정말 많은 서비스를 설치해 운영해야합니다.

sendmail 등 이것 저것...

그런것을 한꺼번에 docker로 관리하면 편하겠죠?

요즘은 docker로 제공하는 메일 서버들도 많아서 소개해드립니다.

 

 

 

설치

당연히 docker로 사용하기 때문에 docker와 docker-compose는 설치되어있다고 가정합니다.

설치를 모르겠다면 여기에서 확인하세요.

mailcow 저장소를 복사하여 설치파일을 실행합니다.

git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized/

 

설치시 물어보는 설정 값

./generate_config.sh

먼저 ./generate_config.sh를 실행하면 호스트의 환경변수에 설정값들을 자동으로 저장합니다.

(일시적인 환경변수이므로 만약에 세션이 끊어지면 환경변수는 소멸되니 다시 실행하셔야합니다)

Found Docker Compose Standalone.
Setting the DOCKER_COMPOSE_VERSION Variable to standalone
Notice: For an automatic update of docker-compose please use the update_compose.sh scripts located at the helper-scripts folder.
Press enter to confirm the detected value '[value]' where applicable or enter a custom value.


Mail server hostname (FQDN) - this is not your mail domain, but your mail servers hostname: 
# mail.devopsjames.com 메일서버의 FQDN설정


MAILCOW_HOSTNAME (devopsjames.com) does not contain a Subdomain. This is not fully tested and may cause issues.
Find more information about why this message exists here: https://github.com/mailcow/mailcow-dockerized/issues/1572
Do you want to proceed anyway? [y/N] # y


OK. Procceding.


Timezone: # Asia/Seoul 타임존 설정으로 서울 설정함
Which branch of mailcow do you want to use?

Available Branches:
- master branch (stable updates) | default, recommended [1]
- nightly branch (unstable updates, testing) | not-production ready [2]
Choose the Branch with it's number [1/2] # 1선택함


Already on 'master'
Your branch is up to date with 'origin/master'.

 

기본적으로 FQDN의 경우 mail을 붙인 서브도메인을 사용합니다.

그리고 timezone은 https://en.wikipedia.org/wiki/List_of_tz_database_time_zones 여기 링크에서 확인하시기 바랍니다.

여기에 존재하는 양식으로 지정해야 합니다.

 

config 설정

 

If you plan to use a reverse proxy, you can, for example, bind HTTPS to 127.0.0.1 on port 8443 and HTTP to 127.0.0.1 on port 8080.

You may need to stop an existing pre-installed MTA which blocks port 25/tcp. See this chapter to learn how to reconfigure Postfix to run besides mailcow after a successful installation.

Some updates modify mailcow.conf and add new parameters. It is hard to keep track of them in the documentation. Please check their description and, if unsure, ask at the known channels for advise.

 

docker로 설치하는 컨테이너

 ✔ memcached-mailcow Pulled                                                                                                                                           1.9s 
 ✔ mysql-mailcow Pulled                                                                                                                                               2.0s 
 ✔ postfix-mailcow Pulled                                                                                                                                             1.9s 
 ✔ unbound-mailcow Pulled                                                                                                                                             2.0s 
 ✔ ipv6nat-mailcow Pulled                                                                                                                                             2.0s 
 ✔ dovecot-mailcow Pulled                                                                                                                                             1.9s 
 ✔ clamd-mailcow Pulled                                                                                                                                               1.9s 
 ✔ watchdog-mailcow Pulled                                                                                                                                            1.9s 
 ✔ acme-mailcow Pulled                                                                                                                                                1.9s 
 ✔ netfilter-mailcow Pulled                                                                                                                                           1.9s 
 ✔ solr-mailcow Pulled                                                                                                                                                1.9s 
 ✔ nginx-mailcow Pulled                                                                                                                                               2.0s 
 ✔ olefy-mailcow Pulled                                                                                                                                               1.9s 
 ✔ redis-mailcow Pulled                                                                                                                                               1.9s 
 ✔ rspamd-mailcow Pulled                                                                                                                                              1.9s 
 ✔ ofelia-mailcow Pulled                                                                                                                                              1.9s 
 ✔ sogo-mailcow Pulled                                                                                                                                                1.9s 
 ✔ php-fpm-mailcow Pulled                                                                                                                                             1.9s 
 ✔ dockerapi-mailcow Pulled

docker-compose up

이제 컨테이너를 기동해 봅시다.

docker-compose를 사용해 up합니다.

docker-compose pull
docker-compose up -d

 

 

참고로 구동전에 각종 프로토콜을 사용중지 해야합니다.

로컬에서 작동중인 25(sendmail), 110(pop3), 143(imap) 등은 포트 충돌을 야기할 수 있습니다.