본문 바로가기

Linux

Ubuntu - 리눅스에 최적화 된 MailCow 메일 서버 우분투에 설치하기

반응형

새로 회사에 구축한 우분투 서버에 hMailServer 대체품인 MailCow 설치 하는데 어려움이 있어 

글을 남긴다 이게 설치할 때 버전 문제도 많이 생기는거 같아 도움이 될지 모르겠다. 

https://wiki.crowncloud.net/How_to_Install_Gitea_on_Ubuntu_18_04?How_to_install_Mailcow_Server_on_Ubuntu_18_04 

 

How To Install Mailcow Server On Ubuntu 18 04=

 

wiki.crowncloud.net

https://www.youtube.com/watch?v=H4z-5zB7WHk 

일당 이 두개를 제일 많이 참고 했는데 

hostnamectl set-hostname mail.example.com

일단 이와 같이 hostname을 설정해줍니다 

sudo apt update
sudo apt install sudo apt-transport-https ca-certificates curl gnupg-agent software-properties-common
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io

여기까지는 아무 문제 없이 잘 설치가 되었다 

$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

여기서 부터 진행이 안되고 거부 당했다. 

뭐때문인지 검색해도 잘 확인이 안되어서 그냥 

새로운 루트 확인하였다.

1. sudo apt update ; sudo apt -y install docker.io docker-compose -y
2. docker --version ; docker-compose --version
3. git clone https://github.com/mailcow/mailcow-dockerized
4. cd mailcow-dockerized
5. ./generate_config.sh

./generate_config.sh -> 이부분에서 또 에러가 났다.

에러 발생

Cannot find Docker Compose.
Please install it regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/

 

Installation - mailcow: dockerized documentation

Installation Docker and Docker Compose Installation You need Docker (a version >= 20.10.2 is required) and Docker Compose (a version >= 2.0 is required). Learn how to install Docker and Docker Compose. Quick installation for most operation systems: Docker

docs.mailcow.email

혹시나 해서 다음 명령어를 넣었는데 아래와 같은 에러가 나서 docker-compose 설치해줬다.

docker-compose pull



Command 'docker-compose' not found, but can be installed with:

sudo snap install docker          # version 20.10.17, or
sudo apt  install docker-compose  # version 1.25.0-1

See 'snap info docker' for additional versions.
sudo apt  install docker-compose

 

다시 버전 확인 해주니 

Docker version 20.10.21, build baeda1f
docker-compose version 1.25.0, build unknown

docker-compose 설치를 해주니 에러가 바뀌었다

~/mailcow-dockerized$ docker-compose pull
WARNING: The TZ variable is not set. Defaulting to a blank string.
WARNING: The DBROOT variable is not set. Defaulting to a blank string.
WARNING: The DBNAME variable is not set. Defaulting to a blank string.
WARNING: The DBUSER variable is not set. Defaulting to a blank string.
WARNING: The DBPASS variable is not set. Defaulting to a blank string.
WARNING: The MAILCOW_HOSTNAME variable is not set. Defaulting to a blank string.
WARNING: The ADDITIONAL_SAN variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.nginx-mailcow.ports is invalid: Invalid port ":443:443", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.nginx-mailcow.ports is invalid: Invalid port ":80:80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]

이걸 검색해보았다

구글링해서 딱 2개가 나오는데

https://community.mailcow.email/d/1781-error-with-docker-composeyml-file

 

Error with docker-compose.yml file

What was done? Hi I recently pull the code (28th July, 2022) ran generate_config.sh enter a valid hostname and Timezone and then execute docker-compose u co...

community.mailcow.email

이분걸 참고해서 수정하였다

vi generate_config.sh -> 안에 들어가보니

HTTP_PORT=80
HTTP_BIND=0.0.0.0

HTTPS_PORT=443
HTTPS_BIND=0.0.0.0

동일한 부분이 있어서 수정해주었다. 

아 mail hostnam에 관한 설정도 있어서

"mail.example.com" 으로 수정해주었다. 

https://github.com/mailcow/mailcow-dockerized/issues/4648

 

The Compose file './docker-compose.yml' is invalid · Issue #4648 · mailcow/mailcow-dockerized

Contribution guidelines I've read the contribution guidelines and wholeheartedly agree I've found a bug and checked that ... ... I understand that not following the below instructions will ...

github.com

sudo git diff origin/master update.sh

여기도 내용 확인하다가 해당 명령어도 입력해주었다 상관 있는지는 모르겠다. 

그러다가 

더이상 할 수 있는게 없어서 그냥 

5. ./generate_config.sh

명령어를 넣었는데 정상 진행 되었다. 

-> hostname 넣으라는 내용이 나오는데 : mail.example.com 입력하면된다

docker-compose pull
docker-compose up -d
https://mail.example.com/
Username - admin | Default password- moohoo

그래로 진행하면 되고 

초기 아이디와 비밀번호는 위와 같다 

비밀번호 : moohoo (소울음 소리인가봉가)

 

반응형