UpgradeRemineDebianSqueeze6 » History » Version 3

Maxim Volkov, 2014-05-13 09:18

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 3 Maxim Volkov
_Without this bundler can't install all Redmine's requrements on Squeeze_
37 3 Maxim Volkov
38 1 Maxim Volkov
2. Download Redmine:
39 1 Maxim Volkov
40 1 Maxim Volkov
<pre>
41 1 Maxim Volkov
rm -R /usr/share/redmine
42 2 Maxim Volkov
cd /usr/share
43 1 Maxim Volkov
wget http://www.redmine.org/releases/redmine-2.5.1.tar.gz
44 1 Maxim Volkov
tar -xvf redmine-2.5.1.tar.gz
45 1 Maxim Volkov
ln -s /usr/share/redmine-2.5.1 /usr/share/redmine
46 1 Maxim Volkov
</pre>
47 1 Maxim Volkov
48 1 Maxim Volkov
3. Install bundler:
49 1 Maxim Volkov
50 1 Maxim Volkov
<pre>
51 1 Maxim Volkov
gem install bundler
52 1 Maxim Volkov
</pre>
53 1 Maxim Volkov
54 1 Maxim Volkov
4. Prepare environment:
55 1 Maxim Volkov
56 1 Maxim Volkov
<pre>
57 1 Maxim Volkov
export PATH=$PATH:/var/lib/gems/1.8/bin
58 1 Maxim Volkov
</pre>
59 1 Maxim Volkov
60 1 Maxim Volkov
_Without this you'll get "command not found" for bundle command._
61 1 Maxim Volkov
62 1 Maxim Volkov
5.Configure:
63 1 Maxim Volkov
64 1 Maxim Volkov
<pre>
65 1 Maxim Volkov
cp /usr/share/redmine/config/configuration.yml.example /usr/share/redmine/config/configuration.yml
66 1 Maxim Volkov
cp /etc/redmine/default/database.yml /usr/share/redmine/config/database.yml
67 1 Maxim Volkov
</pre>
68 1 Maxim Volkov
69 1 Maxim Volkov
Edit /usr/share/redmine/config/database.yml and change adapter from mysql to mysql2.
70 1 Maxim Volkov
71 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. 
72 1 Maxim Volkov
73 2 Maxim Volkov
_You'll need to add @enable_starttls_auto: false@ to smtp_settings group for this delivery method to work on Squeeze:_
74 1 Maxim Volkov
75 1 Maxim Volkov
6. Install:
76 1 Maxim Volkov
77 1 Maxim Volkov
<pre>
78 3 Maxim Volkov
bundle install --without development test
79 1 Maxim Volkov
</pre>
80 1 Maxim Volkov
81 1 Maxim Volkov
7. Edit /usr/share/redmine/Gemfile, change rake version in it to:
82 1 Maxim Volkov
83 1 Maxim Volkov
<pre>
84 1 Maxim Volkov
gem "rake", "0.8.7"
85 1 Maxim Volkov
</pre>
86 1 Maxim Volkov
87 1 Maxim Volkov
_Without this rake will crash on startup. 0.8.7 is the latest compatible version._
88 1 Maxim Volkov
89 1 Maxim Volkov
8. Reconfigure rake:
90 1 Maxim Volkov
91 1 Maxim Volkov
<pre>
92 1 Maxim Volkov
bundle update rake
93 1 Maxim Volkov
</pre>
94 1 Maxim Volkov
95 2 Maxim Volkov
9. Upgrade database and drop caches:
96 1 Maxim Volkov
97 1 Maxim Volkov
<pre>
98 1 Maxim Volkov
rake generate_secret_token
99 1 Maxim Volkov
rake db:migrate RAILS_ENV=production
100 1 Maxim Volkov
rake tmp:cache:clear
101 1 Maxim Volkov
rake tmp:sessions:clear
102 1 Maxim Volkov
</pre> 
103 1 Maxim Volkov
104 2 Maxim Volkov
10. Bring back the attachments:
105 1 Maxim Volkov
106 1 Maxim Volkov
<pre>
107 1 Maxim Volkov
cp -R /root/redmine/files/* /usr/share/redmine/files/
108 1 Maxim Volkov
</pre>
109 1 Maxim Volkov
110 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_
111 1 Maxim Volkov
112 2 Maxim Volkov
11. Change directory owner:
113 2 Maxim Volkov
114 1 Maxim Volkov
<pre>
115 1 Maxim Volkov
chown -R www-data /usr/share/redmine
116 1 Maxim Volkov
</pre>
117 1 Maxim Volkov
118 3 Maxim Volkov
_Without this redmine will crash on /settings page. Some people say it's enough to @chmod -R 777 /usr/share/redmine/tmp@, but it didn't work for me_
119 1 Maxim Volkov
120 2 Maxim Volkov
12. Restart webserver and enjoy.