Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 1

Umit Uzun, 2009-11-06 17:45

1 1 Umit Uzun
h1. Redmine Installation on Virtual or Normal Ubuntu
2
3
We will install Redmine Project Management System on virtual operation system (Ubuntu) in top down approach. If you follow all instructions correctly you will be installed your Redmine server successfully almost an hour.
4
5
*Installing VirtualBox:*
6
7
1.Download last version of Sun VirtualBox(version 3.0.10 or newer) tool in your system.
8
9
2.Install to your system by following the instructions.
10
11
*Installing Ubuntu on VirtualBox:*
12
13
1.Download last version of Ubuntu(version 9.10 or newer) OS in your system.
14
15
2.After installed VirtualBox on your system you will create a new virtual operating which will be Linux type and Ubuntu subtype. If you don't know anything about VirtualBox and/or its usage please refer to the google.
16
17
3.While installing Ubuntu you should type the related configurations as follows:
18
(These all configurations are optional, you can give any name what you what.)
19
Q: What is your name? A: Redmine Server
20
Q: What name do you want to use to login? A: redmine
21
Q: Choose to password to keep your account safe? A: redmine
22
Q: What is the name of this computer? A: redmine-server
23
Choose “Log in automatically.” radio button.
24
25
4.When you finished up installation all of them open up your new VirtualBox Ubuntu OS and open up terminal(console) screen and  issuing these commands:
26
> sudo apt-get update
27
> sudo apt-get upgrade
28
29
*Configuring VirtualBox:*
30
31
1.If you want to reach your VirtualBox Ubuntu OS from different machine, you have to configure VirtualBox Ubuntu OS's network setting to Bridged Adapter. So you can reach your VirtualBox Ubuntu from internal IP address easily. Because it get's same IP block as you from DHCP easily. I mean your guest and host computer is same IP block as different network client.
32
33
2.If you had assigned a static IP to your Network Consult by giving your static ethernet MAC address, you have to assign unique MAC address your VirtualBox Ubuntu OS by Setting->Network->MAC address initialization box. By this MAC address, you can get static ip easily or you can configure your Ubuntu system to not use DHCP, instead of that you can assign static IP manually.
34
35
*Requirements for Installing Redmine:*
36
37
Ruby on Rails 2.0.2
38
MySQL 4 or higher
39
Optional:
40
SVN binaries (>= 1.3), for repository browsing (must be available in your PATH) 
41
42
*Package Installation and Setup:*
43
44
1.Once you’ve installed the VirtualBox Ubuntu OS and updated it, you need to install a bunch of packages that we will prepare the server for the Redmine installation. So, as root, install the following packages by issuing: 
45
> sudo apt-get install build-essential
46
> sudo apt-get install ssh openssh-server mysql-server phpmyadmin rails rubygems mongrel ruby1.8-dev
47
48
The packages we’re installing above are MySQL, phpMyAdmin, Rails, Ruby Gems, Mongrel and Ruby Dev environment.
49
During the installation of the packages, when MySQL is installed, it will prompt you to	create a password. Make sure you remember it. You will need it later to log in to the 	phpMyAdmin. To make simplicity you can set all passwords to “redmine”.
50
51
2.Create a new directory for Redmine. I put mine in /opt/redmine. And download last version of Redmine in it with wget command line downloader and extract it by issuing:
52
> sudo mkdir /opt/redmine
53
> sudo cd /opt/redmine
54
> sudo wget http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz
55
> tar -xvf redmine-0.8.6.tar.gz
56
57
*Database Setup:*
58
59
1.Now it’s time to create an empty database for Redmine. As you may have noticed, we installed phpMyAdmin earlier. phpMyAdmin will come in handy now. Head over to http://localhost/phpmyadmin. You should be presented with the phpMyAdmin login screen.
60
Type in “root” and the MySQL “password” you created when installing MySQL.
61
62
2.First, click on “Databases” Then, at the bottom of the screen, in the “Create new database” text box create a new database called “redmine” and set “Collation” to “utf8_general_ci”.
63
64
3.Now, go back to the home screen and click on:
65
“Privileges”
66
“Add a new User” 
67
Fill out the “Login Information” boxes. Call your user “redmine”. Make sure you remember password you create here. It will be used when you set up the database connection details in Redmine.
68
In the “Database for user” section, check “Create database with same name and grant all privileges” and click on the “Go” button.
69
70
4.Log out of phpMyAdmin.
71
72
*Redmine Database Connection Configuration:*
73
74
1.It’s time to configure the database connection. If you installed Redmine as I did above, then copy “config/database.yml.example” to “config/database.yml” and edit this file in order to configure your database settings for “production” environment. You’ll find the “database.yml.example” issuing:
75
> sudo cd /opt/redmine/redmine-0.8.6/config
76
77
2.So now, assuming you’re in the “/opt/redmine/redmine-0.8.6/config” directory, issue:
78
> sudo cp database.yml.example database.yml 
79
80
3.Then, open the “database.yml” file, issue:
81
> sudo gedit database.yml
82
… and edit it as in the example for a MySQL database below:
83
84
production:
85
adapter: mysql
86
socket: /var/run/mysqld/mysqld.sock
87
database: redmine
88
host: localhost
89
username: redmine
90
password: [password]
91
92
Then save “database.yml” file and exit to the command prompt.
93
On Ubuntu the “mysql.sock” is located in /var/run/mysqld/mysqld.sock, as noted in the “config” above. 
94
(The standard Redmine installation assumes the socket is located in “/opt/redmine/redmine-0.8.6/tmp/mysqld.sock”.)
95
96
4.Create the database structure, by running the following command under the application root directory(I mean “/opt/redmine/redmine-0.8.6”):
97
> sudo rake db:migrate RAILS_ENV="production" 
98
It will create the necessary tables in the redmine database you created earlier and an 	administrator account.
99
100
5.Insert default configuration data in database, by issuing:
101
> sudo rake redmine:load_default_data RAILS_ENV="production" 
102
(This step is optional but highly recommended, as you can define your own configuration	from scratch. It will load default roles, trackers, statuses, work flows and enumerations. While loading default data command prompt wants to given language selection by you.) 
103
104
*Setting up Permissions:*
105
106
1.The user who runs Redmine must have write permission on the following sub directories: “files”, “log”, “tmp” (create the last one if not present). You probably already have a “tmp” directory in /opt/redmine/redmine-0.8.6, but if you don’t, create one now by issuing:
107
> sudo mkdir /opt/redmine/redmine-0.8.6
108
109
2.If you haven’t created a Redmine user, do it now by issuing:
110
> sudo useradd redmine
111
112
3.Now, assuming you run Redmine with a redmine user, from your /opt/redmine/redmine-0.8.6 directory issue:
113
> sudo chown -R redmine:redmine files log tmp
114
> sudo chmod -R 755 files log tmp
115
116
*Testing the Installation:*
117
118
1.It should all be working now. Test the installation by running the WEBrick web server issue:
119
> sudo cd /opt/redmine/redmine-0.8.6
120
> sudo ruby script/server -e production
121
	
122
Once WEBrick has started, point your browser to http://localhost:3000/. Or, if you are using a browser on another computer than what you installed Redmine on, point your browser to http://192.168.1.10:3000/ (if that’s the IP address you gave your Redmine server). You should now see the application welcome page. 
123
124
*Log in:*
125
126
1.Use default administrator account to log in:
127
Login : admin
128
Password : admin
129
130
2.You can go to Admin & Settings to modify application settings.
131
132
*Setting Up Static IP:*
133
134
1.A more easy method for configuring a static IP address is to use your local DHCP server to assign a permanent IP to the VirtualBox OS mac address. That way you will not have to do anything inside VBS. Consult your network administrator. 
135
136
2.Or you should learn configuration parameters as given below, and can configure your system to get static IP address:
137
The desired IP address
138
Network mask and broadcast address
139
Gateway address
140
Your local DNS server address(es)
141
142
*Assigning Host Name and Domain for VirtualBox OS:*
143
144
1.A more easy method for adding your IP address - Host name pair configurations to your DNS server . Consult your network administrator.
145
146
Sendmail Server Configuration:
147
148
1.Before configure the email support of Redmine, we should download sendmail application for Ubuntu, issue:
149
> sudo apt-get install sendmail
150
> sudo sendmailconfig (Answer Yes to all questions which will be asked you)
151
152
2.It’s time to configure the server connection. Copy “config/email.yml.example” to “config/email.yml” and edit this file in order to configure your database settings for “production” environment. You’ll find the “email.yml.example” issue:
153
> sudo cd /opt/redmine/redmine-0.8.6/config
154
155
3.So now, assuming you’re in the “/config” directory, issue:
156
> sudo cp email.yml.example email.yml 
157
158
4.Then, open the “email.yml” file, issue:
159
> sudo gedit email.yml
160
… and edit it as in the example for sendmail configuration below:
161
162
production:
163
delivery_method: :sendmail
164
sendmail_settings:
165
location: /usr/sbin/sendmail
166
arguments: -i -t
167
address: smtp.example.net
168
port: 25
169
domain: example.net
170
authentication: :none
171
user_name: redmine@example.net
172
password: redmine
173
174
Then save “email.yml” file and exit to the command prompt.
175
176
5.It’s time to configure the “environmet.rb” configuration. Open up the “environment.rb” and change “config.action_mailer.perform_deliveries = false” to “config.action_mailer.perform_deliveries = true” then save and close the “environment.rb”.
177
178
*Subversion Installation and Configuration:*
179
180
1.Before configure the subversion support of Redmine, we should download subversion application for Ubuntu, issue:
181
> sudo apt-get install subversion
182
183
2.If your Redmine can't find the “subversion” command you can help to find by issuing:
184
· > sudo cd /opt/redmine/redmine-0.8.6/config
185
· > sudo gedit environment.rb
186
· Add ENV['PATH'] = "#{ENV['PATH']}:/subversion/path" line in it.
187
· Save and close the “environment.rb”
188
189
*Start Application Boot Time:*
190
191
1.To automatically start the application on booting your server you need to modify your “crontab”, issue:
192
> export EDITOR=gedit
193
> crontab -e
194
195
2.Your “crontab” file will be presented. This is the list of programs that start at certain times or at boot. Add the following to the “crontab” (all on one line):
196
@reboot cd /opt/redmine/redmine-0.8.6 ; rm -f log/mongrel.pid ; mongrel_rails start -e production -p 3000 -d
197
198
*Backup:*
199
200
1.Running backups is always a good idea. Redmine backups should include:
201
data (stored in your redmine database) 
202
/usr/bin/mysqldump -u -p | gzip > /path/to/redmine/backup/db/redmine_`date +%y_%m_%d`.gz
203
attachments (stored in the files directory of your Redmine install)
204
rsync -a /path/to/redmine/files /path/to/redmine/backup/files
205
206
2.Or you can use bash shell to automate kind of this operation issue:
207
> sudo cd /opt/redmine/redmine-0.8.6
208
> sudo mkdir backup
209
> sudo mkdir backup/db
210
> sudo mkdir backup/files
211
> sudo gedit backup/runRedmineBackup.bash
212
213
And after opened gedit with “runRedmineBackup.bash” write all commands below:
214
215
#!/bin/bash
216
data=`date -I`
217
mysqldump --user=root --password="redmine" --all-databases | gzip > db/backup-$data.sql.gz
218
cd db
219
ftp -i -n << EOF
220
open ftpserver.example.net
221
user username password
222
bin
223
mput backup-$data.sql.gz
224
bye
225
EOF
226
227
Then save “runRedmineBackup.bash” file and exit to the command prompt. After creation of  runRedmineBackup.bash you can add this bash to run continually between specified periods. Issue:
228
229
> export EDITOR=gedit
230
> crontab -e
231
Add 0 0 * * 0 cd /opt/redmine/redmine-0.8.6/backup ; sh runRedmineBackup.bash commands to crontab to backup database weekly.
232
	
233
To work this bush without any permission problem you have to change all of them modes to maxium permission issue:
234
235
> sudo chmod -R 777 backup
236
> sudo chown -R redmine:redmine backup
237
238
That's all. Now we completely installed Redmine our virtual Ubuntu OS and can reach from any machine at our network easily. Congratulations..!
239
240
*Ümit Uzun
241
06/11/2009*