mailcow/docs/install.md

125 lines
4.1 KiB
Markdown
Raw Normal View History

2017-03-07 09:19:07 +01:00
## Install mailcow
2017-03-02 11:23:23 +01:00
2017-03-02 22:27:46 +01:00
You need Docker and Docker Compose.
2017-03-02 11:23:23 +01:00
2017-03-02 22:27:46 +01:00
1\. Learn how to install [Docker](https://docs.docker.com/engine/installation/linux/) and [Docker Compose](https://docs.docker.com/compose/install/).
2017-03-02 11:23:23 +01:00
Quick installation for most operation systems:
- Docker
```
curl -sSL https://get.docker.com/ | sh
```
- Docker-Compose
```
curl -L https://github.com/docker/compose/releases/download/$(curl -Ls https://www.servercow.de/docker-compose/latest.php)/docker-compose-$(uname -s)-$(uname -m) > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
```
2017-03-03 03:56:11 +01:00
Please use the latest Docker engine available and do not use the engine that ships with your distros repository.
2017-03-02 22:27:46 +01:00
2\. Clone the master branch of the repository
```
git clone https://github.com/andryyy/mailcow-dockerized && cd mailcow-dockerized
```
2017-03-02 21:43:08 +01:00
2017-03-02 22:27:46 +01:00
3\. Generate a configuration file. Use a FQDN (`host.domain.tld`) as hostname when asked.
```
./generate_config.sh
```
2017-03-02 11:23:23 +01:00
2017-03-02 22:27:46 +01:00
4\. Change configuration if you want or need to.
```
nano mailcow.conf
```
2017-03-02 20:11:48 +01:00
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](https://andryyy.github.io/mailcow-dockerized/first_steps/#install-a-local-mta) to learn how to reconfigure Postfix to run besides mailcow after a successful installation.
5\. Pull the images and run the composer file. The paramter `-d` will start mailcow: dockerized detached:
2017-03-02 22:27:46 +01:00
```
docker-compose pull
2017-03-02 22:27:46 +01:00
docker-compose up -d
```
2017-03-02 20:11:48 +01:00
Done!
2017-03-02 11:23:23 +01:00
You can now access **https://${MAILCOW_HOSTNAME}** with the default credentials `admin` + password `moohoo`.
The database will be initialized right after a connection to MySQL can be established.
2017-03-07 09:19:07 +01:00
## Update mailcow
2017-03-02 11:23:23 +01:00
2017-03-24 20:38:58 +01:00
There is no update routine. You need to refresh your pulled repository clone and apply your local changes (if any). Actually there are many ways to merge local changes.
### Step 1, method 1
Stash all local changes, pull changes from the remote master branch and apply your stash on top of it. You will most likely see warnings about non-commited changes; you can ignore them:
2017-03-02 11:23:23 +01:00
```
2017-03-05 13:51:56 +01:00
# Stash local changes
2017-03-05 13:41:41 +01:00
git stash
2017-03-05 13:51:56 +01:00
# Re-pull master
2017-03-05 13:41:41 +01:00
git pull
2017-03-05 13:51:56 +01:00
# Apply stash and remove it
2017-03-05 13:41:41 +01:00
git stash pop
2017-03-02 11:23:23 +01:00
```
2017-03-24 20:38:58 +01:00
### Step 1, method 2
Fetch new data from GitHub, commit changes and merge remote repository:
```
# Get updates/changes
git fetch
# Add all changed files to local clone
git add -A
# Commit changes, ignore git complaining about username and mail address
git commit -m "Local config aat $(date)"
# Merge changes
git merge
```
If git complains about conflicts, solve them! Example:
```
CONFLICT (content): Merge conflict in data/web/index.php
```
Open `data/web/index.php`, solve the conflict, close the file and run `git add -A` + `git commit -m "Solved conflict"`.
### Step 1, method 3
Thanks to fabreg @ GitHub!
In case both methods do not work (for many reason like you're unable to fix the CONFLICTS or any other reasons) you can simply start all over again.
Keep in mind that all local changes _to configuration files_ will be lost. However, your volumes will not be removed.
- Copy mailcow.conf somewhere outside the mailcow-dockerized directory
- Stop and remove mailcow containers: `docker-compose down`
- Delete the directory or rename it
- Clone the remote repository again (`git clone https://github.com/andryyy/mailcow-dockerized && cd mailcow-dockerized`). **Pay attention** to this step - the folder must have the same name of the previous one!
- Copy back your previous `mailcow.conf` into the mailcow-dockerizd folder
If you forgot to stop Docker before deleting the cloned directoy, you can use the following commands:
```
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
```
### Step 2
2017-03-05 13:41:41 +01:00
Pull new images (if any) and recreate changed containers:
2017-03-02 11:23:23 +01:00
```
docker-compose pull
docker-compose up -d --remove-orphans
```
2017-03-24 20:38:58 +01:00
### Step 3
Clean-up dangling (unused) images and volumes:
```
docker rmi -f $(docker images -f "dangling=true" -q)
docker volume rm $(docker volume ls -qf dangling=true)
```