... | ... | @@ -12,7 +12,7 @@ Then we install rust from source, which is needed for python Cryptography librar |
|
|
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
# rustc --version
|
|
|
```
|
|
|
Install some extra dependencies for softwate compiling:
|
|
|
Install some extra dependencies for software compiling:
|
|
|
|
|
|
`# apt-get install build-essential libssl-dev libffi-dev python3-dev cargo`
|
|
|
|
... | ... | @@ -45,12 +45,14 @@ https://docs.mailman3.org/en/latest/install/virtualenv.html#setup-database |
|
|
|
|
|
`useradd -m -d /opt/mailman -s /usr/bin/bash mailman`
|
|
|
|
|
|
enter user mailman and create
|
|
|
|
|
|
Go to mailman’s dir and create a virtualenv
|
|
|
|
|
|
`python3 -m venv venv`
|
|
|
|
|
|
To activate the virtualenv when we enter user mailman, we can add the following in mailman's .bashrc:
|
|
|
|
|
|
`source /opt/mailman/venv/bin/activate`
|
|
|
|
|
|
Ref: https://docs.mailman3.org/en/latest/install/virtualenv.html#virtualenv-setup
|
|
|
|
|
|
## Install Mailman and other python libraries
|
... | ... | @@ -64,7 +66,7 @@ mailman-web provides hyperkitty and postorius for the web interface, as well as |
|
|
## Mailman and hyperkitty configurations
|
|
|
|
|
|
Exit mailman user and as root we create
|
|
|
/etc/mailman3/ dir, we make owner of this dir the user mailman and create the files `mailman.cfg` and `settings.py`. Then as mailman user again, we also create an extra dir under `/opt/mailman` to place the `mailman-hyperkitty.cfg` settings.
|
|
|
`/etc/mailman3/` directory, we make owner of this directory the user mailman, and create under it the files `mailman.cfg` and `settings.py`. Then as mailman user again, we create the `mailman-hyperkitty.cfg` file under the `/opt/mailman`.
|
|
|
|
|
|
*mailman.cfg and setting.py samples:*
|
|
|
|
... | ... | @@ -72,6 +74,26 @@ https://docs.mailman3.org/en/latest/install/virtualenv.html#installing-mailman-c |
|
|
|
|
|
https://docs.mailman3.org/en/latest/install/virtualenv.html#initial-configuration
|
|
|
|
|
|
In the `mailman.cfg` edit the archiver directive as following:
|
|
|
```
|
|
|
[archiver.hyperkitty]
|
|
|
class: mailman_hyperkitty.Archiver
|
|
|
enable: yes
|
|
|
configuration: /path/to/example_project/mailman-hyperkitty.cfg
|
|
|
```
|
|
|
And in mailman-hyperkitty.cfg:
|
|
|
```
|
|
|
# The base_url should correspond with the apache2 links we configure later
|
|
|
base_url: http://localhost/archives
|
|
|
|
|
|
# Shared API key, must be the identical to the value the same as in the /etc/mailman3/settings.py
|
|
|
api_key: SecretArchiverAPIKey
|
|
|
```
|
|
|
Ref:
|
|
|
https://hyperkitty.readthedocs.io/en/latest/install.html#connecting-to-mailman
|
|
|
|
|
|
https://gitlab.com/mailman/mailman-hyperkitty/blob/master/mailman-hyperkitty.cfg
|
|
|
|
|
|
## Postfix configuration
|
|
|
|
|
|
Check open ports in the system. Look for the smtpd port 25 if it’s open. Postfix is the MTP which relays incoming and outgoing mails to mailman.
|
... | ... | @@ -80,35 +102,66 @@ Check open ports in the system. Look for the smtpd port 25 if it’s open. Postf |
|
|
|
|
|
https://serverfault.com/questions/149903/what-ports-to-open-for-mail-server
|
|
|
|
|
|
*postfix configurations here:
|
|
|
*postfix configurations here:*
|
|
|
|
|
|
https://docs.mailman3.org/en/latest/install/virtualenv.html#setup-mta
|
|
|
|
|
|
if postfix is already installed skip that step and just edit the postfix/main.cf with the sample in the above step.
|
|
|
|
|
|
**I. Enter mailman user again**
|
|
|
and run migrations, collect static files for the mailman-web, and create a django admin superuser
|
|
|
## Configure mailman-web UI
|
|
|
*Mailman web is a django site, which includes postorius and hyperkitty (that we installed before in our virtualenv).*
|
|
|
Enter mailman user again and run migrations, collect static files for the mailman-web, and create a django admin superuser, see [details](https://docs.mailman3.org/en/latest/install/virtualenv.html#run-database-migrations).
|
|
|
|
|
|
https://docs.mailman3.org/en/latest/install/virtualenv.html#run-database-migrations
|
|
|
## Run mailman-web locally
|
|
|
First with the local django server
|
|
|
```
|
|
|
(venv) $ pip install Werkzeug
|
|
|
(venv) $ mailman-web runserver_plus
|
|
|
```
|
|
|
then with gunicorn, e,g:
|
|
|
`(venv) $ gunicorn -c /opt/mailman/gunicorn.py mailman_web.wsgi:application`
|
|
|
|
|
|
Sample gunicorn.py file:
|
|
|
```
|
|
|
#!/opt/mailman/venv/bin/python
|
|
|
|
|
|
import sys
|
|
|
sys.path[0:0] = [
|
|
|
'/opt/mailman/',
|
|
|
'/etc/mailman3/'
|
|
|
]
|
|
|
|
|
|
**J. Run mailman-web locally**
|
|
|
first with the local django server, then with gunicorn
|
|
|
import os
|
|
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
|
|
|
|
|
**K. System services**
|
|
|
import gunicorn.app.wsgiapp
|
|
|
|
|
|
Run as daemons the above by adding them as services
|
|
|
if __name__ == '__main__':
|
|
|
sys.exit(gunicorn.app.wsgiapp.run())
|
|
|
```
|
|
|
|
|
|
## System services
|
|
|
|
|
|
Run as daemons the django server by adding the following services:
|
|
|
/lib/systemd/system/ + mailman3.service + gunicorn + qcluster
|
|
|
|
|
|
https://docs.mailman3.org/en/latest/install/virtualenv.html#starting-mailman-automatically
|
|
|
sample gunicorn unit service:
|
|
|
[Sample mailman3.service](https://docs.mailman3.org/en/latest/install/virtualenv.html#starting-mailman-automatically)
|
|
|
|
|
|
[Sample gunicorn unit service](https://wiki.list.org/DOC/Mailman%203%20installation%20experience?action=AttachFile&do=view&target=systemd_gunicorn.txt)
|
|
|
|
|
|
https://wiki.list.org/DOC/Mailman%203%20installation%20experience?action=AttachFile&do=view&target=systemd_gunicorn.txt
|
|
|
[Sample qcluster unit service](https://wiki.list.org/DOC/Mailman%203%20installation%20experience?action=AttachFile&do=view&target=systemd_qcluster.txt)
|
|
|
|
|
|
sample qcluster unit service:
|
|
|
After reload the services and check their status
|
|
|
```
|
|
|
# systemctl daemon-reload
|
|
|
# systemctl status mailman3
|
|
|
```
|
|
|
Check status for gunicorn and qcluster too!
|
|
|
|
|
|
https://wiki.list.org/DOC/Mailman%203%20installation%20experience?action=AttachFile&do=view&target=systemd_qcluster.txt
|
|
|
## Cron jobs
|
|
|
|
|
|
**L. Cron jobs**
|
|
|
From mailman user run
|
|
|
`crontab -e` and add the following:
|
|
|
|
|
|
```
|
|
|
@hourly /opt/mailman/mm/bin/django-admin runjobs hourly
|
... | ... | @@ -138,7 +191,7 @@ See more details: |
|
|
https://djangodeployment.readthedocs.io/en/latest/04-web-server.html?highlight=apache2#configuring-apache-for-django
|
|
|
|
|
|
|
|
|
## Copy existing list from one server to another
|
|
|
## Copy existing list from old mailman server to mailman3
|
|
|
|
|
|
Create ssh keys for server where old lists reside and copy public key to current mailman3 server.
|
|
|
A howto [here](https://www.simplified.guide/ssh/copy-public-key).
|
... | ... | @@ -159,7 +212,7 @@ Then we import the old list, the archives, and we do an index update: |
|
|
```
|
|
|
(venv) $ mailman import21 foo-list@<new-lists-domain> ~/tmp/lists/foo-list/config.pck
|
|
|
(venv) $ python manage.py hyperkitty_import -l foo-list@<new-lists-domain> ~/tmp/archives/private/<list>.mbox/<list>.mbox
|
|
|
<venv) $ mailman-web update_index_one_list foo-list@<new-lists-domain>
|
|
|
(venv) $ mailman-web update_index_one_list foo-list@<new-lists-domain>
|
|
|
```
|
|
|
Ref: https://docs.mailman3.org/en/latest/migration.html#upgrade-strategy
|
|
|
|
... | ... | @@ -169,7 +222,7 @@ Old members of the migrated list, would need to create new accounts via this web |
|
|
|
|
|
Ref: https://docs.mailman3.org/en/latest/userguide.html#making-a-mailman-account
|
|
|
|
|
|
The admin of mailman3 has to create a superuser as a mailman user:
|
|
|
The admin of mailman3 has to create a superuser as a mailman user (if you haven't done it already):
|
|
|
|
|
|
`(venv) $ mailman-web createsuperuser`
|
|
|
|
... | ... | |