1 ====================== |
|
2 Upgrading to vmm 0.6.x |
|
3 ====================== |
|
4 This document describes the procedure to upgrade a vmm-0.5.2 installation |
|
5 to version 0.6.x |
|
6 |
|
7 If you still have installed vmm-0.4/vmm-0.4-r41 you have to proceed this |
|
8 step first: |
|
9 |
|
10 ‣ :doc:`0.4.x-0.5` |
|
11 |
|
12 Upgrading from vmm-0.5.2 |
|
13 ------------------------ |
|
14 |
|
15 Stop Postfix and Dovecot |
|
16 ^^^^^^^^^^^^^^^^^^^^^^^^ |
|
17 Before updating your database layout you have to stop Postfix and Dovecot. |
|
18 |
|
19 .. code-block:: console |
|
20 |
|
21 root@host:~# /etc/init.d/postfix stop |
|
22 Stopping Postfix Mail Transport Agent: postfix. |
|
23 root@host:~# /etc/init.d/dovecot stop |
|
24 Stopping IMAP/POP3 mail server: dovecot. |
|
25 |
|
26 Create a database backup |
|
27 ^^^^^^^^^^^^^^^^^^^^^^^^ |
|
28 It is always wise to back up your database from time to time. |
|
29 Particularly with regard to an impending structure modification. |
|
30 |
|
31 |
|
32 Example: Backing up the `mailsys` database with pg_dump_. |
|
33 |
|
34 .. code-block:: console |
|
35 |
|
36 user@host:~$ pg_dump -h localhost -U vmm -W mailsys > mailsys-0.5.2.sql |
|
37 |
|
38 Database update |
|
39 ^^^^^^^^^^^^^^^ |
|
40 Connect as your `vmm` database user to your database. |
|
41 |
|
42 .. code-block:: console |
|
43 |
|
44 user@host:~$ psql mailsys vmm -W -h localhost |
|
45 |
|
46 In the PostgreSQL interactive terminal you have to run one of the following |
|
47 commands to perform the update. |
|
48 |
|
49 Dovecot v1.2.x/v2.0.x/v2.1.x |
|
50 """""""""""""""""""""""""""" |
|
51 .. code-block:: postgresql-console |
|
52 |
|
53 mailsys=> \i /path/to/vmm-0.6.2/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql |
|
54 mailsys=> \q |
|
55 |
|
56 Dovecot v1.0.x/v1.1.x |
|
57 """"""""""""""""""""" |
|
58 .. code-block:: postgresql-console |
|
59 |
|
60 mailsys=> \i /path/to/vmm-0.6.2/pgsql/update_tables_0.5.x-0.6.pgsql |
|
61 mailsys=> \q |
|
62 |
|
63 .. _set-database-permissions: |
|
64 |
|
65 Set database permissions |
|
66 ^^^^^^^^^^^^^^^^^^^^^^^^ |
|
67 .. include:: ../pgsql_set_permissionspermissions.rst |
|
68 |
|
69 Start Dovecot and Postfix again |
|
70 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
71 |
|
72 .. warning:: All the views (*dovecot_…* and *postfix_…*) have been |
|
73 replaced by database functions. |
|
74 So you have to adjust all your ``postfix/pgsql-*.cf`` files and also your |
|
75 ``/etc/dovecot/dovecot-sql.conf`` or ``/etc/dovecot/dovecot-sql.conf.ext``. |
|
76 |
|
77 See the `vmm-0.6.2/postfix/pgsql-*.cf` files and |
|
78 :ref:`Dovecot configuration <dovecot-sql-conf-ext>`/`dovecot-sql.conf.ext` |
|
79 or :ref:`Dovecot configuration <dovecot-sql-conf>`/`dovecot-sql-conf`. |
|
80 |
|
81 After a successfully update start Dovecot and Postfix again. |
|
82 |
|
83 .. code-block:: console |
|
84 |
|
85 root@host:~# /etc/init.d/dovecot start |
|
86 Starting IMAP/POP3 mail server: dovecot. |
|
87 root@host:~# /etc/init.d/postfix start |
|
88 Starting Postfix Mail Transport Agent: postfix. |
|
89 |
|
90 Upgrade vmm |
|
91 ^^^^^^^^^^^ |
|
92 Finally execute the :file:`upgrade.sh` script. |
|
93 This will install the new code and also update your :file:`vmm.cfg`. |
|
94 |
|
95 .. code-block:: console |
|
96 |
|
97 root@host:~# cd /path/to/vmm-0.6.2 |
|
98 root@host:/path/to/vmm-0.6.2# ./upgrade.sh |
|
99 Please have a look at your configuration: /usr/local/etc/vmm.cfg |
|
100 This are your Modified/Renamed/New settings: |
|
101 R account.delete_directory = false |
|
102 R account.directory_mode = 448 |
|
103 R account.disk_usage = false |
|
104 R domain.delete_directory = false |
|
105 R domain.directory_mode = 504 |
|
106 R domain.force_deletion = false |
|
107 R domain.imap = true |
|
108 R domain.pop3 = true |
|
109 R domain.sieve = true |
|
110 R domain.smtp = true |
|
111 R domain.transport = dovecot: |
|
112 R mailbox.folders = Drafts:Sent:Templates:Trash |
|
113 R mailbox.root = Maildir |
|
114 R misc.base_directory = /srv/mail |
|
115 M misc.dovecot_version = 2.1.7 |
|
116 R misc.dovecot_version = 2.1.7 |
|
117 R misc.password_scheme = PLAIN |
|
118 |
|
119 Removed section "config" with option "done" (obsolte) |
|
120 |
|
121 Removed option "gid_mail" from section "misc" (obsolte) |
|
122 |
|
123 |
|
124 Upgrading from vmm-0.6.0 |
|
125 ------------------------ |
|
126 |
|
127 Database fixes |
|
128 ^^^^^^^^^^^^^^ |
|
129 Due to an error in :ref:`usertransport`'s argument parsing, it is possible |
|
130 that some users' transport-ID points to the erroneous transport *domain*. |
|
131 To fix that error in your database, execute the following SQL statement: |
|
132 |
|
133 .. code-block:: psql |
|
134 |
|
135 UPDATE users SET tid = NULL |
|
136 WHERE tid = (SELECT tid FROM transport WHERE transport = 'domain'); |
|
137 |
|
138 If you are using Dovecot < v.1.2.0, you have to replace the database |
|
139 function *dovecotpassword()*. |
|
140 The *service_set.ssid* was selected unconditionally. |
|
141 This may cause an empty result, which will make logins impossible. |
|
142 To replace the function execute the following SQL statement: |
|
143 |
|
144 .. code-block:: psql |
|
145 |
|
146 CREATE OR REPLACE FUNCTION dovecotpassword( |
|
147 IN localpart varchar, IN the_domain varchar) RETURNS SETOF dovecotpassword |
|
148 AS $$ |
|
149 DECLARE |
|
150 record dovecotpassword; |
|
151 userid varchar(320) := localpart || '@' || the_domain; |
|
152 BEGIN |
|
153 FOR record IN |
|
154 SELECT userid, passwd, smtp, pop3, imap, managesieve |
|
155 FROM users, service_set, domain_data |
|
156 WHERE users.gid = (SELECT gid |
|
157 FROM domain_name |
|
158 WHERE domainname = the_domain) |
|
159 AND local_part = localpart |
|
160 AND users.gid = domain_data.gid |
|
161 AND CASE WHEN |
|
162 users.ssid IS NOT NULL |
|
163 THEN |
|
164 service_set.ssid = users.ssid |
|
165 ELSE |
|
166 service_set.ssid = domain_data.ssid |
|
167 END |
|
168 LOOP |
|
169 RETURN NEXT record; |
|
170 END LOOP; |
|
171 RETURN; |
|
172 END; |
|
173 $$ LANGUAGE plpgsql STABLE |
|
174 RETURNS NULL ON NULL INPUT |
|
175 EXTERNAL SECURITY INVOKER; |
|
176 |
|
177 Upgrade vmm |
|
178 ^^^^^^^^^^^ |
|
179 Execute the :file:`upgrade.sh`, in order to install the updated code. |
|
180 |
|
181 Upgrading from vmm-0.6.1 |
|
182 ------------------------ |
|
183 If you have already installed vmm-6.0.1, simply execute the |
|
184 :file:`upgrade.sh` script. |
|
185 |
|
186 Upgrade to Dovecot ≧ v1.2.beta2 |
|
187 ------------------------------- |
|
188 When you are upgrading your old Dovecot (< v.1.2.beta2) to a newer version, |
|
189 ≧ v1.2.beta2, you also have to update the database layout. |
|
190 After you have backed up your database, you have to apply the changes from |
|
191 the file :file:`dovecot_update_v1.2+.pgsql` to your database. |
|
192 (The file is currently only available from hg: |
|
193 `dovecot_update_v1.2+.pgsql <http://hg.localdomain.org/vmm/raw-file/bb23693e5fc9/pgsql/dovecot_update_v1.2%2B.pgsql>`_) |
|
194 |
|
195 Connect as your `vmm` database user to your database. |
|
196 |
|
197 .. code-block:: console |
|
198 |
|
199 user@host:~$ psql mailsys vmm -W -h localhost |
|
200 |
|
201 Then do the database update: |
|
202 |
|
203 .. code-block:: postgresql-console |
|
204 |
|
205 mailsys=> \i /path/to/dovecot_update_v1.2+.pgsql |
|
206 mailsys=> \q |
|
207 |
|
208 Finally :ref:`set-database-permissions`. |
|
209 |
|
210 .. include:: ../ext_references.rst |
|