UpgradeRemineDebianSqueeze6 » History » Version 2

Maxim Volkov, 2014-05-13 09:07

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 1 Maxim Volkov
6 1 Maxim Volkov
h2. Preparation
7 1 Maxim Volkov
8 1 Maxim Volkov
1. Dump redmine_default database:
9 1 Maxim Volkov
10 1 Maxim Volkov
<pre>
11 1 Maxim Volkov
mysqldump -u redmine -p redmine_default > /root/redmine/db.sql
12 1 Maxim Volkov
</pre>
13 1 Maxim Volkov
14 1 Maxim Volkov
2. Backup attachments folder:
15 1 Maxim Volkov
16 1 Maxim Volkov
<pre>
17 1 Maxim Volkov
cp -R /var/lib/redmine/default/files /root/redmine/files
18 1 Maxim Volkov
</pre>
19 1 Maxim Volkov
20 1 Maxim Volkov
3. Delete redmine:
21 1 Maxim Volkov
22 1 Maxim Volkov
<pre>
23 1 Maxim Volkov
apt-get remove redmine
24 1 Maxim Volkov
</pre>
25 1 Maxim Volkov
26 1 Maxim Volkov
During uninstall choose to keep old database.
27 1 Maxim Volkov
28 1 Maxim Volkov
h2. Setup
29 1 Maxim Volkov
30 1 Maxim Volkov
1. Required packages:
31 1 Maxim Volkov
32 1 Maxim Volkov
<pre>
33 1 Maxim Volkov
apt-get install imagemagick libmagickcore-dev libmagickwand-dev libmysqlclient-dev
34 1 Maxim Volkov
</pre>
35 1 Maxim Volkov
36 1 Maxim Volkov
2. Download Redmine:
37 1 Maxim Volkov
38 1 Maxim Volkov
<pre>
39 1 Maxim Volkov
rm -R /usr/share/redmine
40 2 Maxim Volkov
cd /usr/share
41 1 Maxim Volkov
wget http://www.redmine.org/releases/redmine-2.5.1.tar.gz
42 1 Maxim Volkov
tar -xvf redmine-2.5.1.tar.gz
43 1 Maxim Volkov
ln -s /usr/share/redmine-2.5.1 /usr/share/redmine
44 1 Maxim Volkov
</pre>
45 1 Maxim Volkov
46 1 Maxim Volkov
3. Install bundler:
47 1 Maxim Volkov
48 1 Maxim Volkov
<pre>
49 1 Maxim Volkov
gem install bundler
50 1 Maxim Volkov
</pre>
51 1 Maxim Volkov
52 1 Maxim Volkov
4. Prepare environment:
53 1 Maxim Volkov
54 1 Maxim Volkov
<pre>
55 1 Maxim Volkov
export PATH=$PATH:/var/lib/gems/1.8/bin
56 1 Maxim Volkov
</pre>
57 1 Maxim Volkov
58 1 Maxim Volkov
_Without this you'll get "command not found" for bundle command._
59 1 Maxim Volkov
60 1 Maxim Volkov
5.Configure:
61 1 Maxim Volkov
62 1 Maxim Volkov
<pre>
63 1 Maxim Volkov
cp /usr/share/redmine/config/configuration.yml.example /usr/share/redmine/config/configuration.yml
64 1 Maxim Volkov
cp /etc/redmine/default/database.yml /usr/share/redmine/config/database.yml
65 1 Maxim Volkov
</pre>
66 1 Maxim Volkov
67 1 Maxim Volkov
Edit /usr/share/redmine/config/database.yml and change adapter from mysql to mysql2.
68 1 Maxim Volkov
69 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. 
70 1 Maxim Volkov
71 2 Maxim Volkov
_You'll need to add @enable_starttls_auto: false@ to smtp_settings group for this delivery method to work on Squeeze:_
72 1 Maxim Volkov
73 1 Maxim Volkov
6. Install:
74 1 Maxim Volkov
75 1 Maxim Volkov
<pre>
76 1 Maxim Volkov
bundle install --without development test postgresql
77 1 Maxim Volkov
</pre>
78 1 Maxim Volkov
79 1 Maxim Volkov
7. Edit /usr/share/redmine/Gemfile, change rake version in it to:
80 1 Maxim Volkov
81 1 Maxim Volkov
<pre>
82 1 Maxim Volkov
gem "rake", "0.8.7"
83 1 Maxim Volkov
</pre>
84 1 Maxim Volkov
85 1 Maxim Volkov
_Without this rake will crash on startup. 0.8.7 is the latest compatible version._
86 1 Maxim Volkov
87 1 Maxim Volkov
8. Reconfigure rake:
88 1 Maxim Volkov
89 1 Maxim Volkov
<pre>
90 1 Maxim Volkov
bundle update rake
91 1 Maxim Volkov
</pre>
92 1 Maxim Volkov
93 2 Maxim Volkov
9. Upgrade database and drop caches:
94 1 Maxim Volkov
95 1 Maxim Volkov
<pre>
96 1 Maxim Volkov
rake generate_secret_token
97 1 Maxim Volkov
rake db:migrate RAILS_ENV=production
98 1 Maxim Volkov
rake tmp:cache:clear
99 1 Maxim Volkov
rake tmp:sessions:clear
100 1 Maxim Volkov
</pre> 
101 1 Maxim Volkov
102 2 Maxim Volkov
10. Bring back the attachments:
103 1 Maxim Volkov
104 1 Maxim Volkov
<pre>
105 1 Maxim Volkov
cp -R /root/redmine/files/* /usr/share/redmine/files/
106 1 Maxim Volkov
</pre>
107 1 Maxim Volkov
108 2 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_
109 1 Maxim Volkov
110 2 Maxim Volkov
11. Change directory owner:
111 2 Maxim Volkov
112 1 Maxim Volkov
<pre>
113 1 Maxim Volkov
chown -R www-data /usr/share/redmine
114 1 Maxim Volkov
</pre>
115 1 Maxim Volkov
116 1 Maxim Volkov
_Without this redmine will crash on /settings page._
117 1 Maxim Volkov
118 2 Maxim Volkov
12. Restart webserver and enjoy.