Skip to content

Instantly share code, notes, and snippets.

@wake
Last active April 5, 2017 01:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wake/5432215 to your computer and use it in GitHub Desktop.
Save wake/5432215 to your computer and use it in GitHub Desktop.
Build Redmine 2.3.0 on DigitalOcen CentOS 6.3 x64

Redmine 2.3.0 Installation (DigitalOcen CentOS 6.3 x64)


1. Packages / Dependencies

yum groupinstall "Development Tools" -y
yum install kernel-devel \
  kernel-headers \
  zlib-devel \
  libyaml-devel \
  openssl-devel \
  gdbm-devel \
  readline-devel \
  ncurses-devel \
  libffi-devel \
  git \
  curl \
  openssh-server \
  redis \
  postfix \
  libxml2-devel \
  libxslt-devel \
  perl-Time-HiRes \
  curl-devel \
  libicu-devel \
  nginx \
  ImageMagick ImageMagick-devel \
  mysql mysql-devel mysql-server -y

2. Ruby (1.9.3-p327), Bundler, Rmagick

  1. Download and compile.
  2. Install the bundler, rmagick and thin (for environment register).
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz
cd ruby-1.9.3-p392
./configure
make
sudo make install
sudo gem install bundler
sudo gem install thin
sudo gem install rmagick

If you get

3. Redmine

  1. Download latest version.
  2. Set file system permissions.
mkdir -p /var/www && cd /var/www
wget http://rubyforge.org/frs/download.php/76867/redmine-2.3.0.tar.gz
tar zxvf redmine-2.3.0.tar.gz
rm -rf redmine-2.3.0.tar.gz
mv redmine-2.3.0 redmine
cd /var/www/redmine
mkdir tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets
sudo chown -R nginx:nginx ./

4. Database (MySQL)

  1. Start mysql and set a password for root@localhost.
  2. Connect to MySQL and create a user for Redmine.
  3. Create the database and grant the necessary permissions.
  4. Set redmine database configuration.
service mysqld start
mysqladmin -u root password 'YOUR_PASSWORD'
mysql -u root -p
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
mysql> \q

Try connecting to the new database with the new user

sudo mysql -u redmine -p

Configure redmine, make sure to change "localhost" to the fully-qualified domain name of your host serving GitLab where necessary.

cd /var/www/redmine
cp config/database.yml.example config/database.yml
vi config/database.yml

5. Dependencies installation

  1. Add Thin to Gemfile.
  2. Install dependencies.
  3. Create the tables.
  4. Insert default configuration.
  5. Generate secret token.
  6. Set Thin configuration, init script & log.
  7. Generate session store secret.
cd /var/www/redmine
vi Gemfile.local

Add

gem 'thin'

Then

bundle install --without development test
env RAILS_ENV=production rake db:migrate
env RAILS_ENV=production rake redmine:load_default_data
rake generate_secret_token
thin install
mv /etc/rc.d/thin /etc/init.d/thin
vi /etc/thin/redmine.yml
pid: /var/run/thin/thin.pid
group: nginx
wait: 30
timeout: 30
log: /var/log/thin/thin.log
max_conns: 1024
require: []

environment: production
max_persistent_conns: 512
servers: 4
daemonize: true
user: nginx
socket: /tmp/thin.sock
chdir: /var/www/redmine
vi /etc/logrotate.d/thin
/var/log/thin/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/thin restart >/dev/null
endscript
}

6. Add nginx configurations

vi /etc/nginx/conf.d/proxy.include
proxy_set_header   Host $http_host;
proxy_set_header   X-Real-IP $remote_addr;
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header   X-Forwarded-Proto $scheme;

client_max_body_size       10m;
client_body_buffer_size    128k;

proxy_connect_timeout      90;
proxy_send_timeout         90;
proxy_read_timeout         90;

proxy_buffer_size          4k;
proxy_buffers              4 32k;
proxy_busy_buffers_size    64k;
proxy_temp_file_write_size 64k;
vi /etc/nginx/conf.d/redmine.conf
# Upstream Ruby process cluster for load balancing
upstream thin_cluster {
    server unix:/tmp/thin.0.sock;
    server unix:/tmp/thin.1.sock;
    server unix:/tmp/thin.2.sock;
    server unix:/tmp/thin.3.sock;
}

server {
    listen       your.ip.address.here:80;
    server_name  your.domain.name;

    access_log  /var/log/nginx/redmine-proxy-access;
    error_log   /var/log/nginx/redmine-proxy-error;

    include conf.d/proxy.include;
    root /var/www/redmine/public;
    proxy_redirect off;

    location / {
        try_files $uri/index.html $uri.html $uri @cluster;
    }

    location @cluster {
        proxy_pass http://thin_cluster;
    }
}

Follow here if you want to enable ssl on Nginx.

7. Enjoy

service mysqld start
service thin start
service nginx start

Default account

admin
admin
@s884812
Copy link

s884812 commented Jun 24, 2013

Hello,
when i finish the install, nginx shows me 502 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment