UpgradeRemineDebianSqueeze6 » History » Version 1

Maxim Volkov, 2014-05-13 09:04

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 1 Maxim Volkov
cd /usr/share/redmine
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 1 Maxim Volkov
Edit /usr/share/redmine/config/configuration.yml and setup the secret_token. Email config now is here also, so you can copy old settings from /etc/redmine/default/email.yml. 
70 1 Maxim Volkov
71 1 Maxim Volkov
_You'll need to add this to smtp_settings group for this delivery method to work on Squeeze:_
72 1 Maxim Volkov
73 1 Maxim Volkov
<pre>
74 1 Maxim Volkov
enable_starttls_auto: false
75 1 Maxim Volkov
</pre>
76 1 Maxim Volkov
77 1 Maxim Volkov
6. Install:
78 1 Maxim Volkov
79 1 Maxim Volkov
<pre>
80 1 Maxim Volkov
bundle install --without development test postgresql
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 1 Maxim Volkov
_Without this rake will crash on startup. 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 1 Maxim Volkov
9. Upgrade database and clean cache:
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
</pre> 
103 1 Maxim Volkov
104 1 Maxim Volkov
10. Drop caches:
105 1 Maxim Volkov
106 1 Maxim Volkov
<pre>
107 1 Maxim Volkov
rake tmp:cache:clear
108 1 Maxim Volkov
rake tmp:sessions:clear
109 1 Maxim Volkov
</pre> 
110 1 Maxim Volkov
111 1 Maxim Volkov
11. Bring back the attachments:
112 1 Maxim Volkov
113 1 Maxim Volkov
<pre>
114 1 Maxim Volkov
cp -R /root/redmine/files/* /usr/share/redmine/files/
115 1 Maxim Volkov
</pre>
116 1 Maxim Volkov
117 1 Maxim Volkov
12. Change directory owner:
118 1 Maxim Volkov
119 1 Maxim Volkov
<pre>
120 1 Maxim Volkov
chown -R www-data /usr/share/redmine
121 1 Maxim Volkov
</pre>
122 1 Maxim Volkov
123 1 Maxim Volkov
_Without this redmine will crash on /settings page._
124 1 Maxim Volkov
125 1 Maxim Volkov
126 1 Maxim Volkov
13. Restart webserver and enjoy.