Difference between revisions of "Basic redmine installation"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>Redmine_configuration|Redmine configuration</yambe:breadcrumb> =Basic redmine installation= For basic redmine installation with default set of plugins use f...")
 
m
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<yambe:breadcrumb>Redmine_configuration|Redmine configuration</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Web based tools or applications]] > [[Redmine configuration]] > [[Basic redmine installation]]
=Basic redmine installation=


For basic redmine installation with default set of plugins use following steps:
==Manual installation==
# Use '<tt>yum -y install ruby rubygems mysql mysql-devel</tt>' to install various packages.  
 
# Export proxy using something similar to "<tt>export http_proxy='http://proxy.virtual-labs.ac.in:8080/'</tt>".
For basic redmine installation of redmine 2.6.2 with default set of plugins use following steps:
# Use '<tt>yum -y install ruby rubygems mysql-server mysql-devel ImageMagick gcc ruby-devel ruby-RMagick ImageMagick-devel</tt>' to install various packages.  
# If access to Internet is forced through a proxy server, then configure proxy using something similar to "<tt>export http_proxy='http://&lt;proxy-fqdn&gt;:&lt;proxy-port&gt;/'</tt>".
# Use following commands for install bundler, downloading redmine sources and using bundle for redmine installation
# Use following commands for install bundler, downloading redmine sources and using bundle for redmine installation
#:<pre>
#:<pre>
#::gem install bundler
#::gem install bundler
#::wget http://rubyforge.org/frs/download.php/76771/redmine-2.2.3.tar.gz
#::wget http://www.redmine.org/releases/redmine-2.6.2.tar.gz
#::tar xzf redmine-2.2.3.tar.gz
#::tar xzf redmine-2.6.2.tar.gz
#::cd redmine-2.2.3
#::cd redmine-2.6.2
#::yum -y install ruby-devel gcc
#::bundle install --without postgresql sqlite development test
#::yum -y install ruby-RMagick
#::yum -y install ImageMagick-devel
#::gem install json -v '1.7.7'
#::bundle install
#::bundle install --without postgresql sqlite
#::bundle show
#::bundle show
#:</pre>
#:</pre>
# Install mysql-server and secure mysql installation using '<tt>yum -y install mysql-server</tt>', '<tt>service mysqld start</tt>' and '<tt>/usr/bin/mysql_secure_installation</tt>'
# Start mysql-server and secure mysql installation using '<tt>service mysqld start</tt>' and '<tt>/usr/bin/mysql_secure_installation</tt>'
# Enable mysql to run on start-up using '<tt>chkconfig mysqld on</tt>'
# Create database, username and password for redmine using '<tt>mysql -u root -p</tt>' followed by:
# Create database, username and password for redmine using '<tt>mysql -u root -p</tt>' followed by:
#:<pre>
#:<pre>
Line 33: Line 30:
#::rake generate_secret_token
#::rake generate_secret_token
#::RAILS_ENV=production rake db:migrate
#::RAILS_ENV=production rake db:migrate
#::RAILS_ENV=production rake redmine:load_default_data
#::RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data
#::mkdir public/plugin_assets
#::mkdir -p public/plugin_assets log files tmp/pdf
#::useradd redmine
#::useradd redmine
#::sudo chown -R redmine:redmine files log tmp public/plugin_assets
#::sudo chmod -R 755 files log tmp public/plugin_assets
#::sudo chmod -R 755 files log tmp public/plugin_assets
#::cd ..
#::cd ..
#::mv redmine-2.2.3 /home/redmine
#::mv redmine-2.6.2 /home/redmine
#::chown -R redmine:redmin /home/redmine
#::chown -R redmine:redmine /home/redmine
#:</pre>
#:</pre>
#Now login as redmine user to start the redmine server
#Now login as redmine user to start the redmine server
#:<pre>
#:<pre>
#::su - redmine
#::su - redmine
#::cd redmine-2.2.3
#::cd redmine-2.6.2
#::ruby script/rails server webrick -e production -d
#::ruby script/rails server webrick -e production -d
#:</pre>
#To run redmine on start-up add following line to /etc/rc.d/rc.local file:
#:<pre>
#::runuser -l redmine -c 'cd /home/redmine/redmine-2.6.2; ruby script/rails server webrick -e production -d >run.log 2>&1 &'
#:</pre>
#:</pre>
#Now redmine should be acessible at http://<machine>:3000/  Sign in using admin as username and same admin as password.
#Now redmine should be acessible at http://<machine>:3000/  Sign in using admin as username and same admin as password.
Note that as per http://www.redmine.org/projects/redmine/wiki/RedmineInstall webrick is not suitable for production deployment and other mechanisms such as passenger (mod_rails) should be used
==Automated installation==
For automated installation of redmine2.6.2 using ansible-playbook use:
<pre>
---
  - name: Redmine 2.6 installer
    hosts: redmine
    remote_user: root
    vars:
      redmine_download_url: http://www.redmine.org/releases/redmine-2.6.2.tar.gz
      redmine_download_url_file_sha256_sum: bed25f295ae8d4f438970c7871d62ba2fcf21749f2aaf334441f3ebab6703225
      redmine_user_password: rekall123
      redmine_user_password_hash: $6$Q7jcmX1jjl$7khBB/slfc2fvUQgxa4q0JAI5fKi7mLNuFFUkj59QiLbZQ2PQZ4dwzjxv2WzsSM3WDCEVKbLQwmE/UCR9pjv.0
      redmine_home_folder: /home/redmine/
      mysql_redmine_password: rekall123
      rpmfusion_free_download_url: http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
      rpmfusion_nonfree_download_url: http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
      epel_download_url: http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
      epel_download_path: /root/epel-release-6-8.noarch.rpm
    tasks:
    - name: Create redmine user
      user: name=redmine password={{ redmine_user_password_hash }}
    - name: Download redmine sources
      get_url: url="{{ redmine_download_url }}"  dest="{{ redmine_home_folder }}redmine-2.6.2.tar.gz" force=no sha256sum="{{ redmine_download_url_file_sha256_sum }}" timeout=5
    - name: Extract redmine downloaded sources in /home/redmine
      unarchive: copy=no src="{{ redmine_home_folder }}"/redmine-2.6.2.tar.gz dest="{{ redmine_home_folder }}" creates=/home/redmine/redmine-2.6.2/config.ru
    - name: Download epel RPM
      get_url: url="{{ epel_download_url }}" dest="{{epel_download_path}}" timeout=5
    - name: Install epel RPM
      yum: name="{{epel_download_path}}" state=present
    - name: Install mysql-server, MySQL-python, ruby, rubygems, ImageMagick, ruby-devel, gcc, ruby-RMagick, ImageMagick-devel, mysql-devel
      yum: name={{ item }} state=present
      with_items:
        - mysql-server
        - MySQL-python  #Required for mysql_db etc. ansible modules used below
        - ruby          #Required for ruby which redmine uses
        - rubygems      #Required for installing ruby packages esp bundler
        - ImageMagick    #Required for image manipulation,  This is used by redmine
        - ruby-devel    #For compiling various ruby modules through bundler
        - gcc           
        - ruby-RMagick
        - ImageMagick-devel  #Without this devel packages ruby modules will not compile due to absense of header files
        - mysql-devel       
    - name: Start and Enable mysqld
      service: name={{ item }} state=started enabled=yes
      with_items:
        - mysqld
    - name: Create redmine database in mysql
      mysql_db: name=redmine
 
    - name: Create redmine user and give all permissions on redmine database
      mysql_user: name=redmine password="{{ mysql_redmine_password }}" priv=redmine.*:ALL
    - name: Copy database.yml file to config folder
      copy: src=database.yml dest="{{ redmine_home_folder }}redmine-2.6.2/config" owner=redmine group=redmine
 
    - name: Install bundler using rubygems
      gem: name=bundler state=present user_install=no
    - name: Ask bundler to install all redmine dependencies
      shell: bundle install --without development test postgresql sqlite
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"
#        creates: /home/redmine/redmine-2.6.2/Rakefile
    - name: Generate new key for encoding session data
      shell: rake generate_secret_token
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"
#        creates: /home/redmine/redmine-2.6.2/Rakefile
    - name: Create database schema objects
      shell: RAILS_ENV=production rake db:migrate
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"
#        creates: /home/redmine/redmine-2.6.2/Rakefile
    - name: Insert default configuration data in database
      shell: RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"
    - name: Ensure all redmine user files are owned by redmine user
      file: dest="{{ redmine_home_folder }}" owner=redmine group=redmine recurse=yes
    - name: Create necessary folders for redmine to work
      file: path="{{ redmine_home_folder }}{{ item }}" state=directory owner=redmine group=redmine mode=755
      with_items:
        - files
        - log
        - tmp/pdf
        - public/plugin_assets
    - name: Configure redmine to start on machine start
      lineinfile: dest=/etc/rc.d/rc.local line="runuser -l redmine -c 'cd /home/redmine/redmine-2.6.2; ruby script/rails server webrick -e production -d >run.log 2>&1 &'"
      notify:
        - start redmine
    - name: Print web instructions
      debug: msg="Please visit http://{{ ansible_default_ipv4.address }}:3000 and login using admin:admin credentials"
    handlers:
    - name: start redmine
      shell: runuser -l redmine -c "cd /home/redmine/redmine-2.6.2; ruby script/rails server webrick -e production -d >run.log 2>&1 &"
</pre>
The script requires database.yml file in local folder with contents similar to:
<pre>
# Default setup is given for MySQL with ruby1.9. If you're running Redmine
# with MySQL and ruby1.8, replace the adapter name with `mysql`.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: "rekall123"
  encoding: utf8
development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: ""
  encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  database: redmine_test
  host: localhost
  username: root
  password: ""
  encoding: utf8
</pre>






<yambe:breadcrumb>Redmine_configuration|Redmine configuration</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Web based tools or applications]] > [[Redmine configuration]] > [[Basic redmine installation]]

Latest revision as of 18:37, 28 July 2022

Home > CentOS > CentOS 6.x > Web based tools or applications > Redmine configuration > Basic redmine installation

Manual installation

For basic redmine installation of redmine 2.6.2 with default set of plugins use following steps:

  1. Use 'yum -y install ruby rubygems mysql-server mysql-devel ImageMagick gcc ruby-devel ruby-RMagick ImageMagick-devel' to install various packages.
  2. If access to Internet is forced through a proxy server, then configure proxy using something similar to "export http_proxy='http://<proxy-fqdn>:<proxy-port>/'".
  3. Use following commands for install bundler, downloading redmine sources and using bundle for redmine installation
    gem install bundler
    wget http://www.redmine.org/releases/redmine-2.6.2.tar.gz
    tar xzf redmine-2.6.2.tar.gz
    cd redmine-2.6.2
    bundle install --without postgresql sqlite development test
    bundle show
  4. Start mysql-server and secure mysql installation using 'service mysqld start' and '/usr/bin/mysql_secure_installation'
  5. Enable mysql to run on start-up using 'chkconfig mysqld on'
  6. Create database, username and password for redmine using 'mysql -u root -p' followed by:
    create database redmine character set utf8;
    create user 'redmine'@'localhost' identified by 'my_password';
    grant all privileges on redmine.* to 'redmine'@'localhost';
    flush privileges
    \q
  7. Configure database, username and password in redmine configuration file using 'cp config/database.yml.example config/database.yml' and then by editing 'config/database.yml' to correct database name, username and password for production
  8. Initialize redmine for running first time using following commands:
    rake generate_secret_token
    RAILS_ENV=production rake db:migrate
    RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data
    mkdir -p public/plugin_assets log files tmp/pdf
    useradd redmine
    sudo chmod -R 755 files log tmp public/plugin_assets
    cd ..
    mv redmine-2.6.2 /home/redmine
    chown -R redmine:redmine /home/redmine
  9. Now login as redmine user to start the redmine server
    su - redmine
    cd redmine-2.6.2
    ruby script/rails server webrick -e production -d
  10. To run redmine on start-up add following line to /etc/rc.d/rc.local file:
    runuser -l redmine -c 'cd /home/redmine/redmine-2.6.2; ruby script/rails server webrick -e production -d >run.log 2>&1 &'
  11. Now redmine should be acessible at http://<machine>:3000/ Sign in using admin as username and same admin as password.

Note that as per http://www.redmine.org/projects/redmine/wiki/RedmineInstall webrick is not suitable for production deployment and other mechanisms such as passenger (mod_rails) should be used


Automated installation

For automated installation of redmine2.6.2 using ansible-playbook use:

---
  - name: Redmine 2.6 installer
    hosts: redmine
    remote_user: root

    vars:
      redmine_download_url: http://www.redmine.org/releases/redmine-2.6.2.tar.gz
      redmine_download_url_file_sha256_sum: bed25f295ae8d4f438970c7871d62ba2fcf21749f2aaf334441f3ebab6703225
      redmine_user_password: rekall123
      redmine_user_password_hash: $6$Q7jcmX1jjl$7khBB/slfc2fvUQgxa4q0JAI5fKi7mLNuFFUkj59QiLbZQ2PQZ4dwzjxv2WzsSM3WDCEVKbLQwmE/UCR9pjv.0
      redmine_home_folder: /home/redmine/
      mysql_redmine_password: rekall123
      rpmfusion_free_download_url: http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
      rpmfusion_nonfree_download_url: http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
      epel_download_url: http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
      epel_download_path: /root/epel-release-6-8.noarch.rpm

    tasks:
    - name: Create redmine user
      user: name=redmine password={{ redmine_user_password_hash }}

    - name: Download redmine sources
      get_url: url="{{ redmine_download_url }}"  dest="{{ redmine_home_folder }}redmine-2.6.2.tar.gz" force=no sha256sum="{{ redmine_download_url_file_sha256_sum }}" timeout=5

    - name: Extract redmine downloaded sources in /home/redmine
      unarchive: copy=no src="{{ redmine_home_folder }}"/redmine-2.6.2.tar.gz dest="{{ redmine_home_folder }}" creates=/home/redmine/redmine-2.6.2/config.ru

    - name: Download epel RPM
      get_url: url="{{ epel_download_url }}" dest="{{epel_download_path}}" timeout=5
 
    - name: Install epel RPM
      yum: name="{{epel_download_path}}" state=present

    - name: Install mysql-server, MySQL-python, ruby, rubygems, ImageMagick, ruby-devel, gcc, ruby-RMagick, ImageMagick-devel, mysql-devel
      yum: name={{ item }} state=present
      with_items:
        - mysql-server
        - MySQL-python   #Required for mysql_db etc. ansible modules used below
        - ruby           #Required for ruby which redmine uses
        - rubygems       #Required for installing ruby packages esp bundler
        - ImageMagick    #Required for image manipulation,  This is used by redmine
        - ruby-devel     #For compiling various ruby modules through bundler
        - gcc             
        - ruby-RMagick 
        - ImageMagick-devel   #Without this devel packages ruby modules will not compile due to absense of header files
        - mysql-devel         

    - name: Start and Enable mysqld
      service: name={{ item }} state=started enabled=yes
      with_items:
        - mysqld

    - name: Create redmine database in mysql
      mysql_db: name=redmine
  
    - name: Create redmine user and give all permissions on redmine database
      mysql_user: name=redmine password="{{ mysql_redmine_password }}" priv=redmine.*:ALL

    - name: Copy database.yml file to config folder
      copy: src=database.yml dest="{{ redmine_home_folder }}redmine-2.6.2/config" owner=redmine group=redmine
  
    - name: Install bundler using rubygems
      gem: name=bundler state=present user_install=no

    - name: Ask bundler to install all redmine dependencies
      shell: bundle install --without development test postgresql sqlite
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"
#        creates: /home/redmine/redmine-2.6.2/Rakefile 

    - name: Generate new key for encoding session data
      shell: rake generate_secret_token
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"
#        creates: /home/redmine/redmine-2.6.2/Rakefile

    - name: Create database schema objects
      shell: RAILS_ENV=production rake db:migrate
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"
#        creates: /home/redmine/redmine-2.6.2/Rakefile

    - name: Insert default configuration data in database
      shell: RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data
      args:
        chdir: "{{ redmine_home_folder }}redmine-2.6.2/"

    - name: Ensure all redmine user files are owned by redmine user
      file: dest="{{ redmine_home_folder }}" owner=redmine group=redmine recurse=yes

    - name: Create necessary folders for redmine to work
      file: path="{{ redmine_home_folder }}{{ item }}" state=directory owner=redmine group=redmine mode=755
      with_items:
        - files
        - log
        - tmp/pdf
        - public/plugin_assets

    - name: Configure redmine to start on machine start
      lineinfile: dest=/etc/rc.d/rc.local line="runuser -l redmine -c 'cd /home/redmine/redmine-2.6.2; ruby script/rails server webrick -e production -d >run.log 2>&1 &'" 
      notify:
        - start redmine

    - name: Print web instructions
      debug: msg="Please visit http://{{ ansible_default_ipv4.address }}:3000 and login using admin:admin credentials"


    handlers:
    - name: start redmine
      shell: runuser -l redmine -c "cd /home/redmine/redmine-2.6.2; ruby script/rails server webrick -e production -d >run.log 2>&1 &"

The script requires database.yml file in local folder with contents similar to:

# Default setup is given for MySQL with ruby1.9. If you're running Redmine
# with MySQL and ruby1.8, replace the adapter name with `mysql`.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: "rekall123"
  encoding: utf8

development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: ""
  encoding: utf8

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  database: redmine_test
  host: localhost
  username: root
  password: ""
  encoding: utf8





Home > CentOS > CentOS 6.x > Web based tools or applications > Redmine configuration > Basic redmine installation