May 222011
 

Redmine as Debian package:

  • The core package is redmine. Three packages (redmine-*) provide correct dependencies for mysql, pgsql, sqlite.
  • Several configurations are given as working examples in /usr/share/doc/redmine/examples.
  • Explanations of how the configuration is dealt with are given in /usr/share/doc/redmine/README.Debian.gz.
  • There is no per-instance support for plugins, but those dropped to /usr/share/redmine/vendor/plugins.

Manual and Up-To-Date Installation

Install requirements:

apt-get update
apt-get install git-core apache2 rubygems libopenssl-ruby libmysql-ruby libapache2-mod-fcgid libapache2-mod-passenger ruby mysql-server cron libnet-ssh-ruby1.8 python-setuptools
# If you like to use Gant-Charts (an additional ~40 MiB on my headless server):
apt-get install librmagick-ruby1.8
# Enable new apache modules:
a2enmod fcgid
a2enmod passenger
# Install the rails version needed (not the latest 2.3.x rails):
gem install -v=2.3.5 rails
# Link the rake version (that came with rails) to /usr/local/bin (may need to be adjusted to your version of rake):
ln -s /var/lib/gems/1.8/gems/rake-0.9.0/bin/rake /usr/local/bin/rake

Create the database:

DBNAME=redmine_code
DBUSER=redminecode
DBPASSWORD=`pwgen -n1`
cat << EOF | mysql -uroot -p
CREATE DATABASE $DBNAME CHARACTER SET utf8;
CREATE USER '$DBUSER'@'localhost' identified by '$DBPASSWORD';
GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'localhost';
EOF
echo "The database user $DBUSER has been assigned the password $DBPASSWORD. Please remember the password."

Get redmine:

cd /var/lib
git clone https://github.com/edavis10/redmine.git
cd /var/lib/redmine
git checkout -b 1.1.3 1.1.3
# set the configuration
cat << EOF > config/database.yml
production:
  adapter: mysql
  database: $DBNAME
  host: localhost
  username: $DBUSER
  password: $DBPASSWORD
  encoding: utf8
  schema_search_path: public" > config/database.yml
EOF

Initialize the installation:

RAILS_ENV=production rake config/initializers/session_store.rb
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Set up Apache for redmine:

ADMINMAIL=your.address@example.com
DOMAIN=code.example.com
APACHEUSER=code-www
adduser $APACHEUSER
cat << EOF > /etc/apache2/sites-available/$DOMAIN.redmine
<VirtualHost *>
  ServerAdmin $ADMINMAIL
  ServerName  $DOMAIN
  # If suexec-custom or suexec apache module is loaded, you can specify a special user:
  SuexecUserGroup $APACHEUSER $APACHEUSER

  DefaultInitEnv RAILS_ENV production
  DefaultInitEnv GEM_PATH /var/lib/gems/1.8

  DocumentRoot /var/lib/redmine/public
  <Directory /var/lib/redmine/public>
    Options +FollowSymLinks +ExecCGI
    RewriteEngine On
    RewriteRule ^\$ index.html [QSA]
    RewriteRule ^([^.]+)\$ \$1.html [QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)\$ dispatch.fcgi [QSA,L]
    ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
    AllowOverride None
    #AllowOverride all
    Order allow,deny
    allow from all
  </Directory>
  # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
  LogLevel warn

  CustomLog /var/log/apache2/$DOMAIN.access.log combined
  ErrorLog /var/log/apache2/$DOMAIN.error.log

  ServerSignature Off
</VirtualHost>
EOF
a2ensite $DOMAIN.redmine

# Passenger will be run as the owner of config/environment.rb:
chown $APACHEUSER: config/environment.rb
chmod 666 /var/lib/redmine/log/production.log
chown -R $APACHEUSER: files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

/etc/init.d/apache2 reload

You may now log in with username admin and password: admin.

Git integration:

apt-get install libnet-ssh-ruby1.8 python-setuptools gitosis git-daemon-run acl
gem install inifile lockfile net-ssh
# Loop file as repository storage
LOOPFILE=/root/repository-storage
dd if=/dev/zero of=$LOOPFILE bs=1M count=1024
mkfs.ext3 `losetup -j $LOOPFILE | cut -d ':' -f 1` > ~root/repository-storage.about.mkfs.ext3 2>&1
mount -o acl `losetup -j $LOOPFILE | cut -d ':' -f 1` /mnt
mv /srv/* /mnt
umount /mnt
echo "$LOOPFILE    /scr   ext3   defaults,loop,acl    0    0" >> /etc/fstab
mount /srv

echo "ssh-keygen -t dsa" | su gitosis
echo "cat ~gitosis/.ssh/id_dsa.pub | gitosis-init" | su gitosis
sed -i.orig 's:/var/cache:/srv/gitosis:g' /etc/sv/git-daemon/run
sv restart git-daemon
setfacl -m user:$APACHEUSER:r-x,mask:r-x ~gitosis/.ssh
setfacl -m user:$APACHEUSER:r--,mask:r-- ~gitosis/.ssh/id_dsa

cd /var/lib/redmine
# check <https://github.com/xdissent/redmine_gitosis/network> for inspiration which to choose...
script/plugin install git://github.com/xdissent/redmine_gitosis.git
echo "X_DEBIAN_SITEID=default RAILS_ENV=production rake db:migrate:plugins" | su $APACHEUSER
/etc/init.d/apache2 restart

Open your Browser, got to my_domain and login. Go to Administration → Plugins → Configure Redmine Gitosis plugin. * Change localhost to code.example.com. * Change xdissent.com to code.example.com.

Resources

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Related Posts:

  3 Responses to “Redmine on Debian Squeeze”

  1. [...] utilizar Redmine con Apache, para esto tendrás que crear un Virtualhosts, para configurarlo mirar aquí o [...]

  2. Please, review the version of rails, at begining of post, you install 2.3.11, but the step “Initialize the installation” in “RAILS_ENV=production rake config/initializers/session_store.rb” is trying to get the version 2.3.5: “Missing the Rails 2.3.5 gem. Please gem install -v=2.3.5 rails“. Even installing rails 2.3.5 cant go on…

    VA:F [1.9.22_1171]
    Rating: +2 (from 2 votes)

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>