Hodžův blog

15 Bře

HowTo Install Latest Redmine on Debian 6 (Squeeze, Ruby-on-Rails, Apache2 Passenger)

This is a short .bash_history manual…

First install fresh Debian Squueze from businesscard (when selecting packages uncheck ALL).

Correct hostname:
# vi /etc/hostname
server.example.com


# hostname -F /etc/hostname
# exit

Edit hosts file (delete all IPv6 entries):
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost localdomain
1.2.3.4 server.example.com server

Install ssh server and best editor ;-):
# aptitude -y install ssh fail2ban vim-nox

Set default system editor (select /usr/bin/vim.nox):
# update-alternatives --config editor

Add contrib and non-free repositories:
# perl -i -pe 's/main/main contrib non-free/;' /etc/apt/sources.list
# aptitude update
# aptitude full-upgrade

Disable IPv6 globally:
# echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
# /sbin/sysctl -p /etc/sysctl.conf

Remove unwanted packages:
# /etc/init.d/mpt-statusd stop
# aptitude -y purge mpt-status

Fix Locales and Time Zone:
# dpkg-reconfigure locales
# dpkg-reconfigure tzdata

Install NTP server:
# aptitude -y install ntpdate
# ntpdate tik.cesnet.cz
# aptitude install ntp

# vi /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
restrict -4 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1

# /etc/init.d/ntp restart
# ntpq -p

Install Postfix mail server:
# apt-get -y install postfix bsd-mailx

# vi /etc/postfix/main.cf
inet_interfaces = all
inet_protocols = all
mynetworks_style = host
mynetworks = 127.0.0.0/8
myhostname = server.example.com
mydomain = example.com
myorigin = $mydomain
smtpd_banner = $myhostname ESMTP
mydestination = localhost, localdomain, localhost.localdomain
append_dot_mydomain = no
append_at_myorigin = yes
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
biff = no
recipient_delimiter = +
mailbox_size_limit = 0
mailbox_command = procmail -a "$EXTENSION"
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_helo_hostname
smtpd_sender_restrictions = reject_non_fqdn_sender,
reject_unknown_sender_domain,
permit_mynetworks,
permit_sasl_authenticated
smtpd_recipient_restrictions = reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_unlisted_recipient,
permit
smtpd_data_restrictions = reject_multi_recipient_bounce,
reject_unauth_pipelining

Restart mail server:
# /etc/init.d/postfix restart

Send test email:
# echo "Test message" | mailx example@example.com

Install MySQL server:
# aptitude install mysql-server mysql-client libmysqlclient-dev

Fine tunnig MySQL server:
# mysql_secure_installation

Create MySQL database and user for Redmine:
mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost';
quit

Install Ruby & unnecessary tools:
# aptitude install ruby libruby libopenssl-ruby libpgsql-ruby rubygems apache2 libapache2-mod-passenger subversion
# cd /var/www/
# svn co http://redmine.rubyforge.org/svn/branches/1.3-stable redmine
# cd redmine/
# cp config/database.yml.example config/database.yml

Configure redmine database:
# vi config/database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
encoding: utf8

Install Rails & populate database & fix permission:
# gem install rails -v 2.3.14
# gem install rake -v 0.8.7
# gem uninstall rake -v 0.9.2.2
# gem install i18n
# gem install mysql
# gem install rdoc
# RAILS_ENV=production /var/lib/gems/1.8/bin/rake config/initializers/session_store.rb
# /var/lib/gems/1.8/bin/rake generate_session_store
# RAILS_ENV=production /var/lib/gems/1.8/bin/rake db:migrate
# RAILS_ENV=production /var/lib/gems/1.8/bin/rake redmine:load_default_data
# cd /var/www/redmine
# chown -R www-data:www-data ./*
# chmod -R 755 files log tmp public/plugin_assets

Configure Apache Web server:
# vi /etc/apache2/sites-available/default
ServerName example.com
Serveralias www.example.com
ServerAdmin example@example.com
DocumentRoot /var/www/redmine/public
PassengerDefaultUser www-data
RailsEnv production
RailsBaseURI /redmine
SetEnv X_DEBIAN_SITEID "default"
Order allow,deny
Allow from all
AllowOverride all
Options -MultiViews

Fine tunning Apache:
# perl -i -pe 's/TraceEnable Off/#TraceEnable Off/;' /etc/apache2/conf.d/security
# perl -i -pe 's/#TraceEnable On/TraceEnable On/;' /etc/apache2/conf.d/security
# perl -i -pe 's/ServerSignature On/#ServerSignature On/;' /etc/apache2/conf.d/security
# perl -i -pe 's/#ServerSignature Off/ServerSignature Off/;' /etc/apache2/conf.d/security
# perl -i -pe 's/ServerTokens OS/#ServerTokens OS/;' /etc/apache2/conf.d/security
# perl -i -pe 's/#ServerTokens Minimal/ServerTokens Minimal/;' /etc/apache2/conf.d/security

# /etc/init.d/apache2 restart

That’s all folks…

4 komentáře to “HowTo Install Latest Redmine on Debian 6 (Squeeze, Ruby-on-Rails, Apache2 Passenger)”

  1. 1
    Niels Says:

    Hi, when i overwrite the postfix configuration, and restart postfix i get the following error:

    root@source:/# /etc/init.d/postfix restart
    Stopping Postfix Mail Transport Agent: postfixpostfix: fatal: /etc/postfix/main.cf, line 20: missing ‚=‘ after attribute name: „permit_sasl_authenticated,“
    failed!

    Kind regards
    Niels

  2. 2
    admin Says:

    Problem is only in WordPress text output. Use this right formated config file.

  3. 3
    Ivonig Says:

    Hi,
    the line must contain :
    smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname

    after permit network don’t return to the ligne

  4. 4
    pilgrims Says:

    The line with official Subversion repository is:

    svn co http://svn.redmine.org/redmine redmine

Leave a Reply

Hodžův blog is is proudly powered by Wordpress and the Magellan Theme