Update html/install.iredmail.on.freebsd.with.jail.html.

This commit is contained in:
Zhang Huangbin 2016-02-22 02:11:25 +08:00
parent 37c7946406
commit 04b1e0cf6f
10 changed files with 200 additions and 176 deletions

View File

@ -8,7 +8,7 @@ __IMPORTANT WARNING__: iRedMail is designed to be deployed on a FRESH server sys
which means your server does __NOT__ have mail related components installed, which means your server does __NOT__ have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected. and it may not be working as expected.
To install iRedMail on Debian or Ubuntu Linux, you need: To install iRedMail on Debian or Ubuntu Linux, you need:
@ -94,12 +94,17 @@ mx.example.com
It's now ready to start iRedMail installer, it will ask you several simple It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server. questions, that's all required to setup a full-featured mail server.
> For Chinese users: Our domain name `iredmail.org` is blocked in mainland > __Note to Chinese users__:
> China since Jun 04, 2011, please run below command with a nearest mirror >
> site. For example: `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`. > Our domain name `iredmail.org` is blocked in mainland
> > China since Jun 04, 2011, please run command below to finish the installation:
> * `http://42.159.241.31` is a mirror in mainland China. recommended. >
> * `http://106.187.51.47` is a Linode VPS hosted in Tokyo, Japan. > `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`
>
> Additional variables are:
>
> * EPEL repo: `IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'`
> * SOGo repo: `SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'`
``` ```
# cd /root/iRedMail-x.y.z/ # cd /root/iRedMail-x.y.z/

View File

@ -12,7 +12,7 @@ __IMPORTANT WARNING__: iRedMail is designed to be deployed on a FRESH server sys
which means your server does __NOT__ have mail related components installed, which means your server does __NOT__ have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected. and it may not be working as expected.
To install iRedMail on FreeBSD, you need: To install iRedMail on FreeBSD, you need:
@ -99,12 +99,17 @@ mx.example.com
It's now ready to start iRedMail installer, it will ask you several simple It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server. questions, that's all required to setup a full-featured mail server.
> For Chinese users: Our domain name `iredmail.org` is blocked in mainland > __Note to Chinese users__:
> China since Jun 04, 2011, please run below command with a nearest mirror >
> site. For example: `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`. > Our domain name `iredmail.org` is blocked in mainland
> > China since Jun 04, 2011, please run command below to finish the installation:
> * `http://42.159.241.31` is a mirror in mainland China. recommended. >
> * `http://106.187.51.47` is a Linode VPS hosted in Tokyo, Japan. > `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`
>
> Additional variables are:
>
> * EPEL repo: `IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'`
> * SOGo repo: `SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'`
``` ```
# cd /root/iRedMail-x.y.z/ # cd /root/iRedMail-x.y.z/

View File

@ -6,14 +6,16 @@
* This tutorial describes how to create a FreeBSD Jail with ezjail, then * This tutorial describes how to create a FreeBSD Jail with ezjail, then
install the latest iRedMail in Jail. install the latest iRedMail in Jail.
* We use hostname `mx.example.com` and IP address `172.16.122.244` for our Jail server. * We use hostname `mx.example.com` and IP address `172.16.244.254` for our Jail server.
Notes: Notes:
* This tutorial was tested with FreeBSD 9 and the latest ports tree, but it * This tutorial was tested with FreeBSD 10 and the latest ports tree, but it
should work on FreeBSD 8 and 10 too. should work on FreeBSD 9 and other releases.
* All backends available in iRedMail (OpenLDAP, MySQL/MariaDB, PostgreSQL) were * All backends available in iRedMail (OpenLDAP, MySQL/MariaDB, PostgreSQL) were
tested, work like a charm. :) tested, work like a charm. :)
* For more details about ezjail, please check FreeBSD Handbook:
[Managing Jails with ezjail](https://www.freebsd.org/doc/handbook/jails-ezjail.html).
## System Requirements ## System Requirements
@ -21,7 +23,7 @@ __IMPORTANT WARNING__: iRedMail is designed to be deployed on a FRESH server sys
which means your server does __NOT__ have mail related components installed, which means your server does __NOT__ have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected. and it may not be working as expected.
* The latest stable release of iRedMail. You can download it here: http://www.iredmail.org/download.html * The latest stable release of iRedMail. You can download it here: http://www.iredmail.org/download.html
@ -29,25 +31,6 @@ and it may not be working as expected.
## Preparations ## Preparations
### Set a proper hostname and IP address for Jail server
We use hostname `mx.example.com` and internal IP address `172.16.122.244` for
example. We created an alias IP address on network interface `em0`, so we have
below setting in `/etc/rc.conf` for this IP address like below:
```
# Part of file: /etc/rc.conf
ifconfig_em0_alias0="inet 172.16.122.244 netmask 255.255.255.0"
# Settings for our Jail: mx.example.com.
jail_mx_example_com_hostname="mx.example.com"
jail_mx_example_com_ip="172.16.122.244"
# Required by PostgreSQL, otherwise initializing database will fail.
jail_mx_example_com_parameters='allow.sysvipc=1'
```
### Install sysutils/ezjail and add required settings ### Install sysutils/ezjail and add required settings
* Install ezjail with ports tree: * Install ezjail with ports tree:
@ -57,23 +40,13 @@ jail_mx_example_com_parameters='allow.sysvipc=1'
# make install clean # make install clean
``` ```
* Enable Jail by adding below setting in `/etc/rc.conf`: * Enable ezjail service by appending below line in `/etc/rc.conf`:
``` ```
# Part of file: /etc/rc.conf
# Start ezjail while system start up # Start ezjail while system start up
ezjail_enable="YES" ezjail_enable="YES"
``` ```
* [OPTIONAL] Allow to use `ping` command inside Jail by adding below line in
`/etc/sysctl.conf`:
```
# Part of file: /etc/sysctl.conf
security.jail.allow_raw_sockets=1
```
* Rebooting system is required after changing `/etc/rc.conf`. * Rebooting system is required after changing `/etc/rc.conf`.
``` ```
@ -82,42 +55,26 @@ security.jail.allow_raw_sockets=1
### Create Jail ### Create Jail
* After server reboot, create the base jail that all jails we created later will use: * After server reboot, populate the Jail with FreeBSD-RELEASE
``` ```
# ezjail-admin install -p # ezjail-admin install -p
``` ```
* Create Jail for domain name `mx.example.com`, bound to internal IP address * Create Jail
`172.16.122.244`. All files are placed under `/jails/mx.example.com`:
* hostname `mx.example.com`
* bound IP address `172.16.244.254` to network interface `em0`
* Jail is placed under `/jails/mx.example.com`
``` ```
# ezjail-admin create -r /jails/mx.example.com mx.example.com 172.16.122.244 # ezjail-admin create -r /jails/mx.example.com mx.example.com 'em0|172.16.244.254'
```
* Set hostname of Jail in `/jails/mx.example.com/etc/rc.conf`:
```
# File: /jails/mx.example.com/etc/rc.conf
hostname="mx.example.com"
```
* [OPTIONAL] Share /usr/ports/distfiles/ with Jail by adding below line in
`/etc/fstab.mx_example_com`:
* NOTE: Jail will set ports tree directory to `/var/ports` instead of
`/usr/ports` in `/jails/mx.example.com/etc/make.conf`, you can either
use this default setting or change it to `/usr/ports`.
```
# Part of file: /etc/fstab.mx_example.com
/usr/ports/distfiles /jails/mx.example.com/basejail/usr/ports/distfiles nullfs rw 0 0
``` ```
* Start Jail. * Start Jail.
``` ```
# /usr/local/etc/rc.d/ezjail restart # service ezjail restart
``` ```
* List all Jails: * List all Jails:
@ -126,7 +83,7 @@ hostname="mx.example.com"
# ezjail-admin list # ezjail-admin list
STA JID IP Hostname Root Directory STA JID IP Hostname Root Directory
--- ---- ---------------- --------------------------------- ------------------------ --- ---- ---------------- --------------------------------- ------------------------
DS 1 172.16.122.244 mx.example.com /jails/mx.example.com DS 1 172.16.244.254 mx.example.com /jails/mx.example.com
``` ```
## Install iRedMail ## Install iRedMail
@ -141,13 +98,17 @@ We can now enter this Jail with below command:
``` ```
# File: /etc/resolv.conf # File: /etc/resolv.conf
nameserver 172.16.122.2 nameserver 172.16.244.2
``` ```
* In Jail, install binary package `bash-static`, it's required by iRedMail. * In Jail, install binary package `bash-static`, it's required by iRedMail.
``` ```
# -- For FreeBSD 9 or earlier releases --
# pkg_add -r bash-static # pkg_add -r bash-static
# -- For FreeBSD 10 or later releases --
# pkg install bash-static
``` ```
## Start iRedMail installer ## Start iRedMail installer
@ -155,17 +116,22 @@ nameserver 172.16.122.2
It's now ready to start iRedMail installer inside Jail, it will ask you several simple It's now ready to start iRedMail installer inside Jail, it will ask you several simple
questions, that's all required to setup a full-featured mail server. questions, that's all required to setup a full-featured mail server.
> For Chinese users: Our domain name `iredmail.org` is blocked in mainland > __Note to Chinese users__:
> China since Jun 04, 2011, please run below command with a nearest mirror >
> site. For example: `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`. > Our domain name `iredmail.org` is blocked in mainland
> > China since Jun 04, 2011, please run command below to finish the installation:
> * `http://42.159.241.31` is a mirror in mainland China. recommended. >
> * `http://106.187.51.47` is a Linode VPS hosted in Tokyo, Japan. > `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`
>
> Additional variables are:
>
> * EPEL repo: `IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'`
> * SOGo repo: `SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'`
``` ```
# bash # <- start bash shell, REQUIRED # bash # <- start bash shell, REQUIRED
# cd /root/iRedMail/ # cd /root/iRedMail/
# LOCAL_ADDRESS='172.16.122.244' bash iRedMail.sh # LOCAL_ADDRESS='172.16.244.254' bash iRedMail.sh
``` ```
## Screenshots of installation: ## Screenshots of installation:
@ -283,3 +249,40 @@ hostname or IP address.
Please post all issues, feedbacks, feature requests, suggestions in our [online Please post all issues, feedbacks, feature requests, suggestions in our [online
support forum](http://www.iredmail.org/forum/), it's more responsible than you support forum](http://www.iredmail.org/forum/), it's more responsible than you
expected. expected.
## Some Tips for FreeBSD Jail
### Allow `ping` in Jail
* Appending below line in `/etc/sysctl.conf` to allow to use `ping` command
inside Jail:
```
security.jail.allow_raw_sockets=1
```
* Update `/usr/local/etc/ezjail/mx_example_com` to allow `ping` inside Jail:
```
export jail_mx_example_com_parameters="allow.raw_sockets=1"
```
### Share `/usr/ports/distfiles` with Jail
To share `/usr/ports/distfiles/` with Jail, please append below line in
`/etc/fstab.mx_example_com`:
> Jail will set ports tree directory to `/var/ports` instead of
> `/usr/ports` in `/jails/mx.example.com/etc/make.conf` by default, you can
> either use this default setting or change it to `/usr/ports`.
```
# Part of file: /etc/fstab.mx_example.com
/usr/ports/distfiles /jails/mx.example.com/basejail/var/ports/distfiles nullfs rw 0 0
```
Create directory `/usr/jails/basejail/var/ports/distfiles`:
```
# mkdir /usr/jails/basejail/var/ports/distfiles
```

View File

@ -8,7 +8,7 @@ __IMPORTANT WARNING__: iRedMail is designed to be deployed on a FRESH server sys
which means your server does __NOT__ have mail related components installed, which means your server does __NOT__ have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected. and it may not be working as expected.
To install iRedMail on OpenBSD, you need: To install iRedMail on OpenBSD, you need:
@ -123,12 +123,17 @@ Install Bash shell, it's required by iRedMail.
It's now ready to start iRedMail installer, it will ask you several simple It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server. questions, that's all required to setup a full-featured mail server.
> For Chinese users: Our domain name `iredmail.org` is blocked in mainland > __Note to Chinese users__:
> China since Jun 04, 2011, please run below command with a nearest mirror >
> site. For example: `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`. > Our domain name `iredmail.org` is blocked in mainland
> > China since Jun 04, 2011, please run command below to finish the installation:
> * `http://42.159.241.31` is a mirror in mainland China. recommended. >
> * `http://106.187.51.47` is a Linode VPS hosted in Tokyo, Japan. > `IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh`
>
> Additional variables are:
>
> * EPEL repo: `IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'`
> * SOGo repo: `SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'`
``` ```
# cd /root/iRedMail-x.y.z/ # cd /root/iRedMail-x.y.z/

View File

@ -8,7 +8,7 @@ __IMPORTANT WARNING__: iRedMail is designed to be deployed on a FRESH server sys
which means your server does __NOT__ have mail related components installed, which means your server does __NOT__ have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected. and it may not be working as expected.
To install iRedMail on RHEL or CentOS Linux, you need: To install iRedMail on RHEL or CentOS Linux, you need:
@ -121,7 +121,7 @@ Disable it immediately without rebooting your server.
It's now ready to start iRedMail installer, it will ask you several simple It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server. questions, that's all required to setup a full-featured mail server.
> __For Chinese users__: > __Note to Chinese users__:
> >
> Our domain name `iredmail.org` is blocked in mainland > Our domain name `iredmail.org` is blocked in mainland
> China since Jun 04, 2011, please run command below to finish the installation: > China since Jun 04, 2011, please run command below to finish the installation:

View File

@ -35,7 +35,7 @@
which means your server does <strong>NOT</strong> have mail related components installed, which means your server does <strong>NOT</strong> have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected.</p> and it may not be working as expected.</p>
<p>To install iRedMail on Debian or Ubuntu Linux, you need:</p> <p>To install iRedMail on Debian or Ubuntu Linux, you need:</p>
<ul> <ul>
@ -113,12 +113,14 @@ mx.example.com
<p>It's now ready to start iRedMail installer, it will ask you several simple <p>It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server.</p> questions, that's all required to setup a full-featured mail server.</p>
<blockquote> <blockquote>
<p>For Chinese users: Our domain name <code>iredmail.org</code> is blocked in mainland <p><strong>Note to Chinese users</strong>:</p>
China since Jun 04, 2011, please run below command with a nearest mirror <p>Our domain name <code>iredmail.org</code> is blocked in mainland
site. For example: <code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code>.</p> China since Jun 04, 2011, please run command below to finish the installation:</p>
<p><code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code></p>
<p>Additional variables are:</p>
<ul> <ul>
<li><code>http://42.159.241.31</code> is a mirror in mainland China. recommended.</li> <li>EPEL repo: <code>IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'</code></li>
<li><code>http://106.187.51.47</code> is a Linode VPS hosted in Tokyo, Japan.</li> <li>SOGo repo: <code>SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'</code></li>
</ul> </ul>
</blockquote> </blockquote>
<pre><code># cd /root/iRedMail-x.y.z/ <pre><code># cd /root/iRedMail-x.y.z/

View File

@ -41,7 +41,7 @@ this installation guide instead:
which means your server does <strong>NOT</strong> have mail related components installed, which means your server does <strong>NOT</strong> have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected.</p> and it may not be working as expected.</p>
<p>To install iRedMail on FreeBSD, you need:</p> <p>To install iRedMail on FreeBSD, you need:</p>
<ul> <ul>
@ -116,12 +116,14 @@ mx.example.com
<p>It's now ready to start iRedMail installer, it will ask you several simple <p>It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server.</p> questions, that's all required to setup a full-featured mail server.</p>
<blockquote> <blockquote>
<p>For Chinese users: Our domain name <code>iredmail.org</code> is blocked in mainland <p><strong>Note to Chinese users</strong>:</p>
China since Jun 04, 2011, please run below command with a nearest mirror <p>Our domain name <code>iredmail.org</code> is blocked in mainland
site. For example: <code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code>.</p> China since Jun 04, 2011, please run command below to finish the installation:</p>
<p><code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code></p>
<p>Additional variables are:</p>
<ul> <ul>
<li><code>http://42.159.241.31</code> is a mirror in mainland China. recommended.</li> <li>EPEL repo: <code>IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'</code></li>
<li><code>http://106.187.51.47</code> is a Linode VPS hosted in Tokyo, Japan.</li> <li>SOGo repo: <code>SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'</code></li>
</ul> </ul>
</blockquote> </blockquote>
<pre><code># cd /root/iRedMail-x.y.z/ <pre><code># cd /root/iRedMail-x.y.z/

View File

@ -17,7 +17,6 @@
<li><a href="#summary">Summary</a></li> <li><a href="#summary">Summary</a></li>
<li><a href="#system-requirements">System Requirements</a></li> <li><a href="#system-requirements">System Requirements</a></li>
<li><a href="#preparations">Preparations</a><ul> <li><a href="#preparations">Preparations</a><ul>
<li><a href="#set-a-proper-hostname-and-ip-address-for-jail-server">Set a proper hostname and IP address for Jail server</a></li>
<li><a href="#install-sysutilsezjail-and-add-required-settings">Install sysutils/ezjail and add required settings</a></li> <li><a href="#install-sysutilsezjail-and-add-required-settings">Install sysutils/ezjail and add required settings</a></li>
<li><a href="#create-jail">Create Jail</a></li> <li><a href="#create-jail">Create Jail</a></li>
</ul> </ul>
@ -28,6 +27,11 @@
<li><a href="#important-things-you-must-know-after-installation">Important things you MUST know after installation</a></li> <li><a href="#important-things-you-must-know-after-installation">Important things you MUST know after installation</a></li>
<li><a href="#access-webmail-and-other-web-applications">Access webmail and other web applications</a></li> <li><a href="#access-webmail-and-other-web-applications">Access webmail and other web applications</a></li>
<li><a href="#get-technical-support">Get technical support</a></li> <li><a href="#get-technical-support">Get technical support</a></li>
<li><a href="#some-tips-for-freebsd-jail">Some Tips for FreeBSD Jail</a><ul>
<li><a href="#allow-ping-in-jail">Allow ping in Jail</a></li>
<li><a href="#share-usrportsdistfiles-with-jail">Share /usr/ports/distfiles with Jail</a></li>
</ul>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -36,43 +40,29 @@
<ul> <ul>
<li>This tutorial describes how to create a FreeBSD Jail with ezjail, then <li>This tutorial describes how to create a FreeBSD Jail with ezjail, then
install the latest iRedMail in Jail.</li> install the latest iRedMail in Jail.</li>
<li>We use hostname <code>mx.example.com</code> and IP address <code>172.16.122.244</code> for our Jail server.</li> <li>We use hostname <code>mx.example.com</code> and IP address <code>172.16.244.254</code> for our Jail server.</li>
</ul> </ul>
<p>Notes:</p> <p>Notes:</p>
<ul> <ul>
<li>This tutorial was tested with FreeBSD 9 and the latest ports tree, but it <li>This tutorial was tested with FreeBSD 10 and the latest ports tree, but it
should work on FreeBSD 8 and 10 too.</li> should work on FreeBSD 9 and other releases.</li>
<li>All backends available in iRedMail (OpenLDAP, MySQL/MariaDB, PostgreSQL) were <li>All backends available in iRedMail (OpenLDAP, MySQL/MariaDB, PostgreSQL) were
tested, work like a charm. :)</li> tested, work like a charm. :)</li>
<li>For more details about ezjail, please check FreeBSD Handbook:
<a href="https://www.freebsd.org/doc/handbook/jails-ezjail.html">Managing Jails with ezjail</a>.</li>
</ul> </ul>
<h2 id="system-requirements">System Requirements</h2> <h2 id="system-requirements">System Requirements</h2>
<p><strong>IMPORTANT WARNING</strong>: iRedMail is designed to be deployed on a FRESH server system, <p><strong>IMPORTANT WARNING</strong>: iRedMail is designed to be deployed on a FRESH server system,
which means your server does <strong>NOT</strong> have mail related components installed, which means your server does <strong>NOT</strong> have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected.</p> and it may not be working as expected.</p>
<ul> <ul>
<li>The latest stable release of iRedMail. You can download it here: http://www.iredmail.org/download.html</li> <li>The latest stable release of iRedMail. You can download it here: http://www.iredmail.org/download.html</li>
<li>Port <code>sysutils/ezjail</code> for FreeBSD.</li> <li>Port <code>sysutils/ezjail</code> for FreeBSD.</li>
</ul> </ul>
<h2 id="preparations">Preparations</h2> <h2 id="preparations">Preparations</h2>
<h3 id="set-a-proper-hostname-and-ip-address-for-jail-server">Set a proper hostname and IP address for Jail server</h3>
<p>We use hostname <code>mx.example.com</code> and internal IP address <code>172.16.122.244</code> for
example. We created an alias IP address on network interface <code>em0</code>, so we have
below setting in <code>/etc/rc.conf</code> for this IP address like below:</p>
<pre><code># Part of file: /etc/rc.conf
ifconfig_em0_alias0=&quot;inet 172.16.122.244 netmask 255.255.255.0&quot;
# Settings for our Jail: mx.example.com.
jail_mx_example_com_hostname=&quot;mx.example.com&quot;
jail_mx_example_com_ip=&quot;172.16.122.244&quot;
# Required by PostgreSQL, otherwise initializing database will fail.
jail_mx_example_com_parameters='allow.sysvipc=1'
</code></pre>
<h3 id="install-sysutilsezjail-and-add-required-settings">Install sysutils/ezjail and add required settings</h3> <h3 id="install-sysutilsezjail-and-add-required-settings">Install sysutils/ezjail and add required settings</h3>
<ul> <ul>
<li>Install ezjail with ports tree:</li> <li>Install ezjail with ports tree:</li>
@ -82,22 +72,12 @@ jail_mx_example_com_parameters='allow.sysvipc=1'
</code></pre> </code></pre>
<ul> <ul>
<li>Enable Jail by adding below setting in <code>/etc/rc.conf</code>:</li> <li>Enable ezjail service by appending below line in <code>/etc/rc.conf</code>:</li>
</ul> </ul>
<pre><code># Part of file: /etc/rc.conf <pre><code># Start ezjail while system start up
# Start ezjail while system start up
ezjail_enable=&quot;YES&quot; ezjail_enable=&quot;YES&quot;
</code></pre> </code></pre>
<ul>
<li>[OPTIONAL] Allow to use <code>ping</code> command inside Jail by adding below line in
<code>/etc/sysctl.conf</code>:</li>
</ul>
<pre><code># Part of file: /etc/sysctl.conf
security.jail.allow_raw_sockets=1
</code></pre>
<ul> <ul>
<li>Rebooting system is required after changing <code>/etc/rc.conf</code>.</li> <li>Rebooting system is required after changing <code>/etc/rc.conf</code>.</li>
</ul> </ul>
@ -106,44 +86,28 @@ security.jail.allow_raw_sockets=1
<h3 id="create-jail">Create Jail</h3> <h3 id="create-jail">Create Jail</h3>
<ul> <ul>
<li>After server reboot, create the base jail that all jails we created later will use:</li> <li>After server reboot, populate the Jail with FreeBSD-RELEASE</li>
</ul> </ul>
<pre><code># ezjail-admin install -p <pre><code># ezjail-admin install -p
</code></pre> </code></pre>
<ul>
<li>Create Jail for domain name <code>mx.example.com</code>, bound to internal IP address
<code>172.16.122.244</code>. All files are placed under <code>/jails/mx.example.com</code>:</li>
</ul>
<pre><code># ezjail-admin create -r /jails/mx.example.com mx.example.com 172.16.122.244
</code></pre>
<ul>
<li>Set hostname of Jail in <code>/jails/mx.example.com/etc/rc.conf</code>:</li>
</ul>
<pre><code># File: /jails/mx.example.com/etc/rc.conf
hostname=&quot;mx.example.com&quot;
</code></pre>
<ul> <ul>
<li> <li>
<p>[OPTIONAL] Share /usr/ports/distfiles/ with Jail by adding below line in <p>Create Jail</p>
<code>/etc/fstab.mx_example_com</code>:</p>
<ul> <ul>
<li>NOTE: Jail will set ports tree directory to <code>/var/ports</code> instead of <li>hostname <code>mx.example.com</code></li>
<code>/usr/ports</code> in <code>/jails/mx.example.com/etc/make.conf</code>, you can either <li>bound IP address <code>172.16.244.254</code> to network interface <code>em0</code></li>
use this default setting or change it to <code>/usr/ports</code>.</li> <li>Jail is placed under <code>/jails/mx.example.com</code></li>
</ul> </ul>
</li> </li>
</ul> </ul>
<pre><code># Part of file: /etc/fstab.mx_example.com <pre><code># ezjail-admin create -r /jails/mx.example.com mx.example.com 'em0|172.16.244.254'
/usr/ports/distfiles /jails/mx.example.com/basejail/usr/ports/distfiles nullfs rw 0 0
</code></pre> </code></pre>
<ul> <ul>
<li>Start Jail.</li> <li>Start Jail.</li>
</ul> </ul>
<pre><code># /usr/local/etc/rc.d/ezjail restart <pre><code># service ezjail restart
</code></pre> </code></pre>
<ul> <ul>
@ -152,7 +116,7 @@ hostname=&quot;mx.example.com&quot;
<pre><code># ezjail-admin list <pre><code># ezjail-admin list
STA JID IP Hostname Root Directory STA JID IP Hostname Root Directory
--- ---- ---------------- --------------------------------- ------------------------ --- ---- ---------------- --------------------------------- ------------------------
DS 1 172.16.122.244 mx.example.com /jails/mx.example.com DS 1 172.16.244.254 mx.example.com /jails/mx.example.com
</code></pre> </code></pre>
<h2 id="install-iredmail">Install iRedMail</h2> <h2 id="install-iredmail">Install iRedMail</h2>
@ -164,30 +128,36 @@ DS 1 172.16.122.244 mx.example.com /jails/mx.example.co
<li>In Jail, update <code>/etc/resolv.conf</code> with valid DNS server address(es). For example:</li> <li>In Jail, update <code>/etc/resolv.conf</code> with valid DNS server address(es). For example:</li>
</ul> </ul>
<pre><code># File: /etc/resolv.conf <pre><code># File: /etc/resolv.conf
nameserver 172.16.122.2 nameserver 172.16.244.2
</code></pre> </code></pre>
<ul> <ul>
<li>In Jail, install binary package <code>bash-static</code>, it's required by iRedMail.</li> <li>In Jail, install binary package <code>bash-static</code>, it's required by iRedMail.</li>
</ul> </ul>
<pre><code># pkg_add -r bash-static <pre><code># -- For FreeBSD 9 or earlier releases --
# pkg_add -r bash-static
# -- For FreeBSD 10 or later releases --
# pkg install bash-static
</code></pre> </code></pre>
<h2 id="start-iredmail-installer">Start iRedMail installer</h2> <h2 id="start-iredmail-installer">Start iRedMail installer</h2>
<p>It's now ready to start iRedMail installer inside Jail, it will ask you several simple <p>It's now ready to start iRedMail installer inside Jail, it will ask you several simple
questions, that's all required to setup a full-featured mail server.</p> questions, that's all required to setup a full-featured mail server.</p>
<blockquote> <blockquote>
<p>For Chinese users: Our domain name <code>iredmail.org</code> is blocked in mainland <p><strong>Note to Chinese users</strong>:</p>
China since Jun 04, 2011, please run below command with a nearest mirror <p>Our domain name <code>iredmail.org</code> is blocked in mainland
site. For example: <code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code>.</p> China since Jun 04, 2011, please run command below to finish the installation:</p>
<p><code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code></p>
<p>Additional variables are:</p>
<ul> <ul>
<li><code>http://42.159.241.31</code> is a mirror in mainland China. recommended.</li> <li>EPEL repo: <code>IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'</code></li>
<li><code>http://106.187.51.47</code> is a Linode VPS hosted in Tokyo, Japan.</li> <li>SOGo repo: <code>SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'</code></li>
</ul> </ul>
</blockquote> </blockquote>
<pre><code># bash # &lt;- start bash shell, REQUIRED <pre><code># bash # &lt;- start bash shell, REQUIRED
# cd /root/iRedMail/ # cd /root/iRedMail/
# LOCAL_ADDRESS='172.16.122.244' bash iRedMail.sh # LOCAL_ADDRESS='172.16.244.254' bash iRedMail.sh
</code></pre> </code></pre>
<h2 id="screenshots-of-installation">Screenshots of installation:</h2> <h2 id="screenshots-of-installation">Screenshots of installation:</h2>
@ -301,7 +271,37 @@ hostname or IP address.</p>
<h2 id="get-technical-support">Get technical support</h2> <h2 id="get-technical-support">Get technical support</h2>
<p>Please post all issues, feedbacks, feature requests, suggestions in our <a href="http://www.iredmail.org/forum/">online <p>Please post all issues, feedbacks, feature requests, suggestions in our <a href="http://www.iredmail.org/forum/">online
support forum</a>, it's more responsible than you support forum</a>, it's more responsible than you
expected.</p><p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script> expected.</p>
<h2 id="some-tips-for-freebsd-jail">Some Tips for FreeBSD Jail</h2>
<h3 id="allow-ping-in-jail">Allow <code>ping</code> in Jail</h3>
<ul>
<li>Appending below line in <code>/etc/sysctl.conf</code> to allow to use <code>ping</code> command
inside Jail:</li>
</ul>
<pre><code>security.jail.allow_raw_sockets=1
</code></pre>
<ul>
<li>Update <code>/usr/local/etc/ezjail/mx_example_com</code> to allow <code>ping</code> inside Jail:</li>
</ul>
<pre><code>export jail_mx_example_com_parameters=&quot;allow.raw_sockets=1&quot;
</code></pre>
<h3 id="share-usrportsdistfiles-with-jail">Share <code>/usr/ports/distfiles</code> with Jail</h3>
<p>To share <code>/usr/ports/distfiles/</code> with Jail, please append below line in
<code>/etc/fstab.mx_example_com</code>:</p>
<blockquote>
<p>Jail will set ports tree directory to <code>/var/ports</code> instead of
<code>/usr/ports</code> in <code>/jails/mx.example.com/etc/make.conf</code> by default, you can
either use this default setting or change it to <code>/usr/ports</code>.</p>
</blockquote>
<pre><code># Part of file: /etc/fstab.mx_example.com
/usr/ports/distfiles /jails/mx.example.com/basejail/var/ports/distfiles nullfs rw 0 0
</code></pre>
<p>Create directory <code>/usr/jails/basejail/var/ports/distfiles</code>:</p>
<pre><code># mkdir /usr/jails/basejail/var/ports/distfiles
</code></pre><p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

View File

@ -35,7 +35,7 @@
which means your server does <strong>NOT</strong> have mail related components installed, which means your server does <strong>NOT</strong> have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected.</p> and it may not be working as expected.</p>
<p>To install iRedMail on OpenBSD, you need:</p> <p>To install iRedMail on OpenBSD, you need:</p>
<ul> <ul>
@ -143,12 +143,14 @@ near you on OpenBSD web site:
<p>It's now ready to start iRedMail installer, it will ask you several simple <p>It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server.</p> questions, that's all required to setup a full-featured mail server.</p>
<blockquote> <blockquote>
<p>For Chinese users: Our domain name <code>iredmail.org</code> is blocked in mainland <p><strong>Note to Chinese users</strong>:</p>
China since Jun 04, 2011, please run below command with a nearest mirror <p>Our domain name <code>iredmail.org</code> is blocked in mainland
site. For example: <code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code>.</p> China since Jun 04, 2011, please run command below to finish the installation:</p>
<p><code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code></p>
<p>Additional variables are:</p>
<ul> <ul>
<li><code>http://42.159.241.31</code> is a mirror in mainland China. recommended.</li> <li>EPEL repo: <code>IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel'</code></li>
<li><code>http://106.187.51.47</code> is a Linode VPS hosted in Tokyo, Japan.</li> <li>SOGo repo: <code>SOGO_PKG_MIRROR='http://42.159.241.31/SOGo'</code></li>
</ul> </ul>
</blockquote> </blockquote>
<pre><code># cd /root/iRedMail-x.y.z/ <pre><code># cd /root/iRedMail-x.y.z/

View File

@ -36,7 +36,7 @@
which means your server does <strong>NOT</strong> have mail related components installed, which means your server does <strong>NOT</strong> have mail related components installed,
e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install e.g. MySQL, OpenLDAP, Postfix, Dovecot, Amavisd, etc. iRedMail will install
and configure them for you automatically. Otherwise it may override your and configure them for you automatically. Otherwise it may override your
existing files/configurations althought it will backup files before modifing, existing files/configurations althought it will backup files before modifying,
and it may not be working as expected.</p> and it may not be working as expected.</p>
<p>To install iRedMail on RHEL or CentOS Linux, you need:</p> <p>To install iRedMail on RHEL or CentOS Linux, you need:</p>
<ul> <ul>
@ -137,7 +137,7 @@ used by iRedMail team to build the binary packages are available
<p>It's now ready to start iRedMail installer, it will ask you several simple <p>It's now ready to start iRedMail installer, it will ask you several simple
questions, that's all required to setup a full-featured mail server.</p> questions, that's all required to setup a full-featured mail server.</p>
<blockquote> <blockquote>
<p><strong>For Chinese users</strong>:</p> <p><strong>Note to Chinese users</strong>:</p>
<p>Our domain name <code>iredmail.org</code> is blocked in mainland <p>Our domain name <code>iredmail.org</code> is blocked in mainland
China since Jun 04, 2011, please run command below to finish the installation:</p> China since Jun 04, 2011, please run command below to finish the installation:</p>
<p><code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code></p> <p><code>IREDMAIL_MIRROR='http://42.159.241.31' bash iRedMail.sh</code></p>