HowTo Install Redmine 12x + Mercurial on Ubuntu lucid server » History » Version 13
Dimitry Profus, 2011-09-18 05:44
| 1 | 1 | Dimitry Profus | h1. How to install Redmine on Ubuntu lucid server |
|---|---|---|---|
| 2 | |||
| 3 | {{toc}} |
||
| 4 | |||
| 5 | 10 | Dimitry Profus | h2. Redmine Installation |
| 6 | 1 | Dimitry Profus | |
| 7 | # Install the LAMP stack |
||
| 8 | <pre> |
||
| 9 | $ sudo tasksel install lamp-server |
||
| 10 | </pre> |
||
| 11 | # Install the required packages |
||
| 12 | <pre> |
||
| 13 | 5 | Dimitry Profus | $ sudo apt-get install build-essential llibmysqlclient15-dev ibdigest-sha1-perl libgemplugin-ruby libgemplugin-ruby1.8 libruby-extras libruby1.8-extras rails rake ruby rubygems rubygems1.8 ruby1.8-dev subversion libopenssl-ruby1.8 |
| 14 | 1 | Dimitry Profus | </pre> |
| 15 | # Install the required Ruby gems |
||
| 16 | <pre> |
||
| 17 | $ sudo gem install rails -v=2.3.11 --no-ri --no-rdoc |
||
| 18 | 4 | Dimitry Profus | $ sudo gem install rake -v=0.8.7 --no-ri --no-rdoc |
| 19 | 5 | Dimitry Profus | $ sudo gem uninstall rake -v=0.9.2 |
| 20 | 4 | Dimitry Profus | $ sudo gem install i18n -v=0.4.2 --no-ri --no-rdoc |
| 21 | $ sudo gem install mysql --no-ri --no-rdoc |
||
| 22 | 1 | Dimitry Profus | </pre> |
| 23 | 5 | Dimitry Profus | # Download Redmine into /user/share/redmine directory |
| 24 | 1 | Dimitry Profus | <pre> |
| 25 | 5 | Dimitry Profus | $ sudo svn co http://redmine.rubyforge.org/svn/branches/1.2-stable /usr/share/redmine |
| 26 | 1 | Dimitry Profus | </pre> |
| 27 | # Create an empty MySQL database and accompanying user named redmine for example. |
||
| 28 | <pre> |
||
| 29 | 5 | Dimitry Profus | $ mysql -u root -p |
| 30 | (enter the mysql root user password) |
||
| 31 | 1 | Dimitry Profus | > create database redmine character set utf8; |
| 32 | > create user 'redmine'@'localhost' identified by '[password]'; |
||
| 33 | > grant all privileges on redmine.* to 'redmine'@'localhost' identified by '[password]'; |
||
| 34 | </pre> |
||
| 35 | # Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment. |
||
| 36 | <pre> |
||
| 37 | 5 | Dimitry Profus | $ sudo cp /usr/share/redmine/config/database.yml.example /usr/share/redmine/config/database.yml |
| 38 | 1 | Dimitry Profus | |
| 39 | 5 | Dimitry Profus | $ sudo nano /usr/share/redmine/config/database.yml |
| 40 | 1 | Dimitry Profus | |
| 41 | Modify to the following and save (ctrl+x) |
||
| 42 | |||
| 43 | production: |
||
| 44 | adapter: mysql |
||
| 45 | socket: /var/run/mysqld/mysqld.sock |
||
| 46 | database: redmine |
||
| 47 | host: localhost |
||
| 48 | username: redmine |
||
| 49 | password: [password] |
||
| 50 | 5 | Dimitry Profus | encoding: utf8 |
| 51 | 1 | Dimitry Profus | </pre> |
| 52 | 5 | Dimitry Profus | # Generate a session store secret. |
| 53 | <pre> |
||
| 54 | 6 | Dimitry Profus | $ cd /usr/share/redmine |
| 55 | |||
| 56 | 5 | Dimitry Profus | $ sudo rake generate_session_store |
| 57 | </pre> |
||
| 58 | 1 | Dimitry Profus | # Create the database structure, by running the following command under the application root directory: |
| 59 | <pre> |
||
| 60 | 5 | Dimitry Profus | $ cd /usr/share/redmine |
| 61 | 1 | Dimitry Profus | |
| 62 | $ sudo rake db:migrate RAILS_ENV="production" |
||
| 63 | </pre> |
||
| 64 | # Insert default configuration data in database, by running the following command: |
||
| 65 | <pre> |
||
| 66 | $ sudo RAILS_ENV=production rake redmine:load_default_data |
||
| 67 | </pre> |
||
| 68 | # Setting up permissions |
||
| 69 | <pre> |
||
| 70 | 5 | Dimitry Profus | $ cd /usr/share/redmine |
| 71 | 1 | Dimitry Profus | $ sudo chown -R www-data:www-data files log tmp public/plugin_assets |
| 72 | $ sudo chmod -R 755 files log tmp public/plugin_assets |
||
| 73 | </pre> |
||
| 74 | 9 | Dimitry Profus | # Test using the webrick web server |
| 75 | <pre> |
||
| 76 | $ cd /usr/share/redmine |
||
| 77 | |||
| 78 | $ ruby script/server webrick -e production |
||
| 79 | |||
| 80 | Point your web browser at http://[my server ip]:3000 |
||
| 81 | |||
| 82 | You should now see the application welcome page. |
||
| 83 | </pre> |
||
| 84 | |||
| 85 | 1 | Dimitry Profus | |
| 86 | 5 | Dimitry Profus | h2. Apache Integration |
| 87 | 1 | Dimitry Profus | |
| 88 | # Install the required packages |
||
| 89 | <pre> |
||
| 90 | $ sudo apt-get install libapache2-mod-passenger libapache-dbi-perl libapache2-mod-perl2 libapache2-svn |
||
| 91 | </pre> |
||
| 92 | # Add a symbolic link to the public redmine web directory |
||
| 93 | <pre> |
||
| 94 | $ sudo ln -s /usr/share/redmine/public /var/www/redmine |
||
| 95 | </pre> |
||
| 96 | # Configure Passanger to run as www-data |
||
| 97 | <pre> |
||
| 98 | $ sudo nano /etc/apache2/mods-available/passenger.conf |
||
| 99 | |||
| 100 | Add the follow line and save (ctrl+x) |
||
| 101 | |||
| 102 | PassengerDefaultUser www-data |
||
| 103 | </pre> |
||
| 104 | # Create a new Apache site file |
||
| 105 | <pre> |
||
| 106 | $ sudo nano /etc/apache2/sites-available/redmine |
||
| 107 | </pre> |
||
| 108 | Add the following lines and save (ctrl+x) |
||
| 109 | <pre> |
||
| 110 | <VirtualHost *:80> |
||
| 111 | ServerAdmin webmaster@localhost |
||
| 112 | DocumentRoot /var/www |
||
| 113 | ServerName myservername |
||
| 114 | |||
| 115 | RewriteEngine on |
||
| 116 | RewriteRule ^/$ /redmine [R] |
||
| 117 | |||
| 118 | <Directory /var/www/redmine> |
||
| 119 | RailsBaseURI /redmine |
||
| 120 | PassengerResolveSymlinksInDocumentRoot on |
||
| 121 | </Directory> |
||
| 122 | |||
| 123 | ErrorLog /var/log/apache2/error.log |
||
| 124 | |||
| 125 | # Possible values include: debug, info, notice, warn, error, crit, |
||
| 126 | # alert, emerg. |
||
| 127 | LogLevel warn |
||
| 128 | |||
| 129 | CustomLog /var/log/apache2/access.log combined |
||
| 130 | </VirtualHost> |
||
| 131 | </pre> |
||
| 132 | For SSL add the following text instead |
||
| 133 | <pre> |
||
| 134 | <VirtualHost *:443> |
||
| 135 | ServerAdmin webmaster@localhost |
||
| 136 | DocumentRoot /var/www |
||
| 137 | ServerName myservername |
||
| 138 | |||
| 139 | SSLEngine On |
||
| 140 | SSLCertificateFile /etc/apache2/ssl/redmine.pem |
||
| 141 | |||
| 142 | RewriteEngine on |
||
| 143 | RewriteRule ^/$ /redmine [R] |
||
| 144 | |||
| 145 | <Directory /var/www/redmine> |
||
| 146 | RailsBaseURI /redmine |
||
| 147 | PassengerResolveSymlinksInDocumentRoot on |
||
| 148 | </Directory> |
||
| 149 | |||
| 150 | ErrorLog /var/log/apache2/error.log |
||
| 151 | |||
| 152 | # Possible values include: debug, info, notice, warn, error, crit, |
||
| 153 | # alert, emerg. |
||
| 154 | LogLevel warn |
||
| 155 | |||
| 156 | CustomLog /var/log/apache2/access.log combined |
||
| 157 | </VirtualHost> |
||
| 158 | </pre> |
||
| 159 | # Enable the Redmine website |
||
| 160 | <pre> |
||
| 161 | $ sudo a2dissite default |
||
| 162 | $ sudo a2ensite redmine |
||
| 163 | </pre> |
||
| 164 | # Enable the Passenger and Rewite modules and restart Apache |
||
| 165 | <pre> |
||
| 166 | $ sudo a2enmod passenger |
||
| 167 | $ sudo a2enmod rewrite |
||
| 168 | $ sudo /etc/init.d/apache2 restart |
||
| 169 | 3 | Dimitry Profus | </pre> |
| 170 | # Test the setup |
||
| 171 | <pre> |
||
| 172 | Open up your favorite web browser and goto |
||
| 173 | |||
| 174 | http://[my site or ip]/redmine |
||
| 175 | </pre> |
||
| 176 | 1 | Dimitry Profus | |
| 177 | 5 | Dimitry Profus | h2. Mercurial Integration |
| 178 | 1 | Dimitry Profus | |
| 179 | # Install the latest Mercurial release |
||
| 180 | <pre> |
||
| 181 | 7 | Dimitry Profus | $ sudo apt-get install python-software-properties |
| 182 | 1 | Dimitry Profus | $ sudo add-apt-repository ppa:mercurial-ppa/releases |
| 183 | $ sudo apt-get update |
||
| 184 | $ sudo apt-get install mercurial |
||
| 185 | </pre> |
||
| 186 | # Create the hg web directory |
||
| 187 | <pre> |
||
| 188 | $ sudo mkdir -p /var/www/hg/repos |
||
| 189 | </pre> |
||
| 190 | # Create the web cgi script file |
||
| 191 | <pre> |
||
| 192 | $ sudo nano /var/www/hg/hgwebdir.cgi |
||
| 193 | |||
| 194 | Add the following and save |
||
| 195 | |||
| 196 | #!/usr/bin/env python |
||
| 197 | # |
||
| 198 | from mercurial import demandimport; demandimport.enable() |
||
| 199 | from mercurial.hgweb.hgwebdir_mod import hgwebdir |
||
| 200 | import mercurial.hgweb.wsgicgi as wsgicgi |
||
| 201 | application = hgwebdir('hgweb.config') |
||
| 202 | wsgicgi.launch(application) |
||
| 203 | </pre> |
||
| 204 | # Create the cgi web config file |
||
| 205 | <pre> |
||
| 206 | $ sudo nano /var/www/hg/hgweb.config |
||
| 207 | |||
| 208 | Add the following and save |
||
| 209 | |||
| 210 | 8 | Dimitry Profus | [paths] |
| 211 | /=/var/www/hg/repos/** |
||
| 212 | 1 | Dimitry Profus | |
| 213 | 8 | Dimitry Profus | [web] |
| 214 | allow_push = * |
||
| 215 | push_ssl = false |
||
| 216 | allowbz2 = yes |
||
| 217 | allowgz = yes |
||
| 218 | allowzip = yes |
||
| 219 | 1 | Dimitry Profus | </pre> |
| 220 | # Setup permissions |
||
| 221 | <pre> |
||
| 222 | $ sudo chown -R www-data:www-data /var/www/hg |
||
| 223 | $ sudo chmod gu+x /var/www/hg/hgwebdir.cgi |
||
| 224 | </pre> |
||
| 225 | 12 | Dimitry Profus | # Create a Apache config file |
| 226 | 1 | Dimitry Profus | <pre> |
| 227 | $ sudo nano /etc/apache2/conf.d/hg.config |
||
| 228 | |||
| 229 | Add the following and save |
||
| 230 | |||
| 231 | 11 | Dimitry Profus | PerlLoadModule Apache::Redmine |
| 232 | ScriptAlias /hg "/var/www/hg/hgwebdir.cgi" |
||
| 233 | <Location /hg > |
||
| 234 | AuthType Basic |
||
| 235 | AuthName "Mercurial" |
||
| 236 | Require valid-user |
||
| 237 | 1 | Dimitry Profus | |
| 238 | 11 | Dimitry Profus | #Redmine auth |
| 239 | PerlAccessHandler Apache::Authn::Redmine::access_handler |
||
| 240 | PerlAuthenHandler Apache::Authn::Redmine::authen_handler |
||
| 241 | RedmineDSN "DBI:mysql:database=redmine;host=localhost" |
||
| 242 | RedmineDbUser "redmine" |
||
| 243 | RedmineDbPass "password" |
||
| 244 | </Location> |
||
| 245 | 1 | Dimitry Profus | </pre> |
| 246 | # Add a symbolic link to Redmine.pm |
||
| 247 | <pre> |
||
| 248 | 5 | Dimitry Profus | $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm |
| 249 | $ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/Redmine.pm |
||
| 250 | 1 | Dimitry Profus | </pre> |
| 251 | # Enable the required Apache modules and restart Apache |
||
| 252 | <pre> |
||
| 253 | $ sudo a2enmod perl |
||
| 254 | $ sudo /etc/init.d/apache2 restart |
||
| 255 | </pre> |
||
| 256 | 8 | Dimitry Profus | # Create a new test repository and project in Redmine |
| 257 | 1 | Dimitry Profus | <pre> |
| 258 | $ sudo hg init /var/www/hg/repos/test |
||
| 259 | 8 | Dimitry Profus | $ sudo chown -R www-data:www-data /var/www/hg/repos/test |
| 260 | |||
| 261 | Create a new project with and identifier 'test' |
||
| 262 | |||
| 263 | In the project Settings > Repository set |
||
| 264 | SCM: Mercurial |
||
| 265 | Path to repository: /var/www/hg/repos/test |
||
| 266 | Press the 'Create' button |
||
| 267 | |||
| 268 | Goto to the Repository tab of the test project |
||
| 269 | 1 | Dimitry Profus | </pre> |
| 270 | # View the test repository in the web browser |
||
| 271 | <pre> |
||
| 272 | > http://[my site name]/hg/test |
||
| 273 | </pre> |
||
| 274 | |||
| 275 | 10 | Dimitry Profus | h2. Email Integration |
| 276 | 1 | Dimitry Profus | |
| 277 | # Install and configure Sendmail |
||
| 278 | <pre> |
||
| 279 | $ sudo apt-get install sendmail |
||
| 280 | $ sudo sendmailconfig |
||
| 281 | |||
| 282 | (Answer Yes to all questions which you will be asked) |
||
| 283 | </pre> |
||
| 284 | # Update the Redmine configuration file |
||
| 285 | <pre> |
||
| 286 | 5 | Dimitry Profus | $ sudo nano /usr/share/redmine/config/configuration.yml |
| 287 | 1 | Dimitry Profus | |
| 288 | Add the following text and save |
||
| 289 | |||
| 290 | production: |
||
| 291 | email_delivery: |
||
| 292 | delivery_method: :sendmail |
||
| 293 | </pre> |