email邮件营销服务器搭建

docker安装iRedMail邮件服务器

官网文档地址 https://github.com/iredmail/dockerized

安装docker:

# update software repositories
sudo apt update
# install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER

运行iRedMail 容器:

# create main working directory
mkdir ~/docker/iRedMail -p
# create required sub-directories
mkdir ~/docker/iRedMail/data/{backup-mysql,clamav,custom,imapsieve_copy,mailboxes,mlmmj,mlmmj-archive,mysql,sa_rules,ssl,postfix_queue} -p
# create config file
touch ~/docker/iRedMail/iredmail-docker.conf
# write hostname to config
echo HOSTNAME=mail.moneyslow.com >> ~/docker/iRedMail/iredmail-docker.conf
echo FIRST_MAIL_DOMAIN=moneyslow.com >> ~/docker/iRedMail/iredmail-docker.conf
echo FIRST_MAIL_DOMAIN_ADMIN_PASSWORD=SomethingSecure >> ~/docker/iRedMail/iredmail-docker.conf
echo MLMMJADMIN_API_TOKEN=$(openssl rand -base64 32) >> ~/docker/iRedMail/iredmail-docker.conf
echo ROUNDCUBE_DES_KEY=$(openssl rand -base64 24) >> ~/docker/iRedMail/iredmail-docker.conf
# output the conf file and verify the values
cat ~/docker/iRedMail/iredmail-docker.conf
# set owner of working directories
sudo chown "$USER":"$USER" ~/docker -R
# run the iRedMail container
docker run -d --name iRedMail --env-file ~/docker/iRedMail/iredmail-docker.conf -p 80:80 -p 443:443 -p 110:110 -p 995:995 -p 143:143 -p 993:993 -p 25:25 -p 465:465 -p 587:587 -v ~/docker/iRedMail/data/backup-mysql:/var/vmail/backup/mysql -v ~/docker/iRedMail/data/mailboxes:/var/vmail/vmail1 -v ~/docker/iRedMail/data/mlmmj:/var/vmail/mlmmj -v ~/docker/iRedMail/data/mlmmj-archive:/var/vmail/mlmmj-archive -v ~/docker/iRedMail/data/imapsieve_copy:/var/vmail/imapsieve_copy -v ~/docker/iRedMail/data/custom:/opt/iredmail/custom -v ~/docker/iRedMail/data/ssl:/opt/iredmail/ssl -v ~/docker/iRedMail/data/mysql:/var/lib/mysql -v ~/docker/iRedMail/data/clamav:/var/lib/clamav -v ~/docker/iRedMail/data/sa_rules:/var/lib/spamassassin -v ~/docker/iRedMail/data/postfix_queue:/var/spool/postfix iredmail/mariadb:stable

实际案例:


mkdir /backup/docker_soft/iRedMail -p

mkdir /backup/docker_soft/iRedMail/data/{backup-mysql,clamav,custom,imapsieve_copy,mailboxes,mlmmj,mlmmj-archive,mysql,sa_rules,ssl,postfix_queue} -p

touch /backup/docker_soft/iRedMail/iredmail-docker.conf

echo HOSTNAME=mail.wmydt.com >> /backup/docker_soft/iRedMail/iredmail-docker.conf
echo FIRST_MAIL_DOMAIN=wmydt.com >> /backup/docker_soft/iRedMail/iredmail-docker.conf
echo FIRST_MAIL_DOMAIN_ADMIN_PASSWORD=SomethingSecure >> /backup/docker_soft/iRedMail/iredmail-docker.conf
echo MLMMJADMIN_API_TOKEN=$(openssl rand -base64 32) >> /backup/docker_soft/iRedMail/iredmail-docker.conf
echo ROUNDCUBE_DES_KEY=$(openssl rand -base64 24) >> /backup/docker_soft/iRedMail/iredmail-docker.conf

cat /backup/docker_soft/iRedMail/iredmail-docker.conf

#sudo chown "$USER":"$USER" ~/docker -R

docker run -d --name iRedMail --env-file /backup/docker_soft/iRedMail/iredmail-docker.conf -p 8081:80 -p 110:110 -p 995:995 -p 143:143 -p 993:993 -p 25:25 -p 465:465 -p 587:587 -v /backup/docker_soft/iRedMail/data/backup-mysql:/var/vmail/backup/mysql -v /backup/docker_soft/iRedMail/data/mailboxes:/var/vmail/vmail1 -v /backup/docker_soft/iRedMail/data/mlmmj:/var/vmail/mlmmj -v /backup/docker_soft/iRedMail/data/mlmmj-archive:/var/vmail/mlmmj-archive -v /backup/docker_soft/iRedMail/data/imapsieve_copy:/var/vmail/imapsieve_copy -v /backup/docker_soft/iRedMail/data/custom:/opt/iredmail/custom -v /backup/docker_soft/iRedMail/data/ssl:/opt/iredmail/ssl -v /backup/docker_soft/iRedMail/data/mysql:/var/lib/mysql -v /backup/docker_soft/iRedMail/data/clamav:/var/lib/clamav -v /backup/docker_soft/iRedMail/data/sa_rules:/var/lib/spamassassin -v /backup/docker_soft/iRedMail/data/postfix_queue:/var/spool/postfix iredmail/mariadb:stable

可以了,访问你的后台: http://moneyslow.com/iredadmin
用户名 postmaster@admin
密码这里找:FIRST_MAIL_DOMAIN_ADMIN_PASSWORD set in iredmail-docker.conf

访问你的web邮箱:http://moneyslow.com

官网:https://github.com/iredmail/dockerized

京ICP备11047313号-21