UpgradeRemineDebianSqueeze6 » History » Version 4

Maxim Volkov, 2014-05-14 09:19

1 1 Maxim Volkov
h1. Upgrading Redmine 1.0.1 to 2.5.1 on Debian Squeeze (from repo to standalone mode)
2 1 Maxim Volkov
3 1 Maxim Volkov
Debain Squeeze has Redmine 1.0.1 in it's repositories. If you want to install latest 2.x branch, you need to switch from package to standalone setup. Here is a step-by-step howto guide.
4 1 Maxim Volkov
5 4 Maxim Volkov
We will remove the package, place new binaries at the same folder and upgrade database. There also some squeeze-specific workarounds.
6 1 Maxim Volkov
7 1 Maxim Volkov
h2. Preparation
8 1 Maxim Volkov
9 1 Maxim Volkov
1. Dump redmine_default database:
10 1 Maxim Volkov
11 1 Maxim Volkov
<pre>
12 1 Maxim Volkov
mysqldump -u redmine -p redmine_default > /root/redmine/db.sql
13 1 Maxim Volkov
</pre>
14 1 Maxim Volkov
15 1 Maxim Volkov
2. Backup attachments folder:
16 1 Maxim Volkov
17 1 Maxim Volkov
<pre>
18 1 Maxim Volkov
cp -R /var/lib/redmine/default/files /root/redmine/files
19 1 Maxim Volkov
</pre>
20 1 Maxim Volkov
21 1 Maxim Volkov
3. Delete redmine:
22 1 Maxim Volkov
23 1 Maxim Volkov
<pre>
24 1 Maxim Volkov
apt-get remove redmine
25 1 Maxim Volkov
</pre>
26 1 Maxim Volkov
27 4 Maxim Volkov
*During uninstall choose to keep old database.*
28 1 Maxim Volkov
29 1 Maxim Volkov
h2. Setup
30 1 Maxim Volkov
31 1 Maxim Volkov
1. Required packages:
32 1 Maxim Volkov
33 1 Maxim Volkov
<pre>
34 1 Maxim Volkov
apt-get install imagemagick libmagickcore-dev libmagickwand-dev libmysqlclient-dev
35 1 Maxim Volkov
</pre>
36 1 Maxim Volkov
37 4 Maxim Volkov
_Fix for: missing requirements for bundler_
38 3 Maxim Volkov
39 4 Maxim Volkov
2. Delete old Redmine, download new Redmine instead:
40 1 Maxim Volkov
41 1 Maxim Volkov
<pre>
42 1 Maxim Volkov
rm -R /usr/share/redmine
43 2 Maxim Volkov
cd /usr/share
44 1 Maxim Volkov
wget http://www.redmine.org/releases/redmine-2.5.1.tar.gz
45 1 Maxim Volkov
tar -xvf redmine-2.5.1.tar.gz
46 1 Maxim Volkov
ln -s /usr/share/redmine-2.5.1 /usr/share/redmine
47 4 Maxim Volkov
cd /usr/share/redmine
48 1 Maxim Volkov
</pre>
49 1 Maxim Volkov
50 1 Maxim Volkov
3. Install bundler:
51 1 Maxim Volkov
52 1 Maxim Volkov
<pre>
53 1 Maxim Volkov
gem install bundler
54 1 Maxim Volkov
</pre>
55 1 Maxim Volkov
56 1 Maxim Volkov
4. Prepare environment:
57 1 Maxim Volkov
58 1 Maxim Volkov
<pre>
59 1 Maxim Volkov
export PATH=$PATH:/var/lib/gems/1.8/bin
60 1 Maxim Volkov
</pre>
61 1 Maxim Volkov
62 4 Maxim Volkov
_Fix for: "command not found" for bundle command_
63 1 Maxim Volkov
64 1 Maxim Volkov
5.Configure:
65 1 Maxim Volkov
66 1 Maxim Volkov
<pre>
67 1 Maxim Volkov
cp /usr/share/redmine/config/configuration.yml.example /usr/share/redmine/config/configuration.yml
68 1 Maxim Volkov
cp /etc/redmine/default/database.yml /usr/share/redmine/config/database.yml
69 1 Maxim Volkov
</pre>
70 1 Maxim Volkov
71 1 Maxim Volkov
Edit /usr/share/redmine/config/database.yml and change adapter from mysql to mysql2.
72 1 Maxim Volkov
73 2 Maxim Volkov
Edit /usr/share/redmine/config/configuration.yml and setup the secret_token. Email config is also here now, so you can copy old settings from /etc/redmine/default/email.yml here by hand. 
74 1 Maxim Volkov
75 4 Maxim Volkov
_You'll need to add @enable_starttls_auto: false@ to smtp_settings group for this delivery method to work on Squeeze_
76 1 Maxim Volkov
77 1 Maxim Volkov
6. Install:
78 1 Maxim Volkov
79 1 Maxim Volkov
<pre>
80 3 Maxim Volkov
bundle install --without development test
81 1 Maxim Volkov
</pre>
82 1 Maxim Volkov
83 1 Maxim Volkov
7. Edit /usr/share/redmine/Gemfile, change rake version in it to:
84 1 Maxim Volkov
85 1 Maxim Volkov
<pre>
86 1 Maxim Volkov
gem "rake", "0.8.7"
87 1 Maxim Volkov
</pre>
88 1 Maxim Volkov
89 4 Maxim Volkov
_Fix for: rake crash on start-up. 0.8.7 is the latest compatible version._
90 1 Maxim Volkov
91 1 Maxim Volkov
8. Reconfigure rake:
92 1 Maxim Volkov
93 1 Maxim Volkov
<pre>
94 1 Maxim Volkov
bundle update rake
95 1 Maxim Volkov
</pre>
96 1 Maxim Volkov
97 2 Maxim Volkov
9. Upgrade database and drop caches:
98 1 Maxim Volkov
99 1 Maxim Volkov
<pre>
100 1 Maxim Volkov
rake generate_secret_token
101 1 Maxim Volkov
rake db:migrate RAILS_ENV=production
102 1 Maxim Volkov
rake tmp:cache:clear
103 1 Maxim Volkov
rake tmp:sessions:clear
104 1 Maxim Volkov
</pre> 
105 1 Maxim Volkov
106 2 Maxim Volkov
10. Bring back the attachments:
107 1 Maxim Volkov
108 1 Maxim Volkov
<pre>
109 1 Maxim Volkov
cp -R /root/redmine/files/* /usr/share/redmine/files/
110 1 Maxim Volkov
</pre>
111 1 Maxim Volkov
112 1 Maxim Volkov
_There are other ways to do this. For example, you can create a symlink from /usr/share/redmine/files to /var/lib/redmine/default/files and keep using previous location_
113 1 Maxim Volkov
114 1 Maxim Volkov
11. Change directory owner:
115 2 Maxim Volkov
116 1 Maxim Volkov
<pre>
117 1 Maxim Volkov
chown -R www-data /usr/share/redmine
118 1 Maxim Volkov
</pre>
119 1 Maxim Volkov
120 4 Maxim Volkov
_Fix for: 500 error on administrative pages. Some people say it's enough to @chmod -R 777 /usr/share/redmine/tmp@, but it didn't work for me_
121 1 Maxim Volkov
122 4 Maxim Volkov
12. Restart web-server and enjoy.