Install Redmine 34 on RHEL74 » History » Revision 8
Revision 7 (Christophe de Dinechin, 2018-02-02 12:04) → Revision 8/24 (Christophe de Dinechin, 2018-02-02 12:07)
h1. Install Redmine 3.4 on RHEL7.4 Here is a procedure that worked for me to install Redmine 3.5 on RHEL 7.4. These instructions work as for Feb 1st, 2018. I also chose to install with Postgres 10 to migrate an existing instance, although I believe it works with the default Postgres 9.2. h2. Dependencies Install the required packages. <pre> % sudo yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel </pre> h2. Choice of database Install your database of choice. I've mostly tested with Postgres 10. h3. Postgres 10 You can upgrade to Postgres 10 if you need for example to transfer an existing database. <pre> # More recent Postgres 10 % sudo yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm % sudo yum install -y postgresql10-server postgresql10 postgres-devel % export PATH=/usr/pgsql-10/bin/:$PATH % postgresql-10-setup initdb % sudo systemctl start postgresql-10 % sudo systemctl enable postgresql-10 </pre> Note that the @postgres-devel@ package is still required for the @bundle install@ step below, and I am not sure if that step works with Postgres 10. Like for Postgres 9, you need to add @trust@ for local IPv6 connexions in @/var/lib/pgsql/10/data/pg_hba.conf@: <pre> # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust </pre> Check that you can connect to the database, then create the @redmine@ user and a @redmine@ database: <pre> % sudo su - postgres % export PATH=/usr/pgsql-10/bin/:$PATH % psql postgres=# alter role postgres with encrypted password 'insert-your-postgres-password-here'; postgres=# create user redmine with encrypted password 'insert-your-redmine-password-here'; postgres=# create database redmine with encoding 'UTF-8' owner redmine; </pre> If you get an error related to the encoding (I only had that on Postgres 9): <pre> ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template. </pre> then you should explicitly use @template0@: <pre> postgres=# create database redmine with template=template0 encoding 'UTF-8' owner redmine; </pre> h3. Postgres 9.2.23 Postgres 9.2.23 is what you get directly when installing with @yum@ in RHEL 7.4: <pre> # Default Postgres 9.2.23 % sudo yum -y install postgresql postgresql-server postgresql-devel % postgresql-setup initdb % sudo systemctl start postgresql % sudo systemctl enable postgresql </pre> I have not been able to have Redmine connect to the database without altering @/var/lib/pgsql/data/pg_hba.conf@ to have @trust@ for local IPv6 connnexions: <pre> # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust </pre> I suspect this is wrong, but I don't know how to do it "right", and that's also how it's configured in the Redmine docker containers I looked at. Create user and database like in the previous section. h3. For MySQL / MariaDB Installing and starting the database server <pre> # MariaDB (formerly MySQL) % sudo yum -y install mariadb mariadb-devel % sudo systemctl start mariadb % sudo systemctl enable mariadb </pre> Then you can setup the original database: <pre> % mysql -u root -p MariaDB [(none)]> set password for 'root'@'localhost' = password('insert-your-password-here'); MariaDB [(none)]> create database redmine character set utf8; MariaDB [(none)]> create user 'redmine'@'localhost' identified by 'somepass'; MariaDB [(none)]> grant all privileges on redmine.* to 'redmine'@'localhost'; </pre> Note: The rest of this setup assumes Postgres, will need to be updated with MariaDB instructions as well. h2. Upgrade Ruby The default @ruby@ is 2.0.0p648. If you keep that version, @gem install passenger@ fails. <pre> % sudo yum install -y gcc % cd /usr/local/src % wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.gz % tar xvfz ruby-2.5.0.tar.gz % cd ruby-2.5.0/ % ./configure % make % make install </pre> Verify that you have Ruby 2.5 installed after that: <pre> % ruby -v ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux] </pre> h2. Install passenger and Gem bundler: With Ruby 2.5, we can install Passenger: <pre> % gem install passenger gem install passenger Fetching: rack-2.0.3.gem (100%) Successfully installed rack-2.0.3 Fetching: passenger-5.2.0.gem (100%) Building native extensions. This could take a while... Successfully installed passenger-5.2.0 Parsing documentation for rack-2.0.3 Installing ri documentation for rack-2.0.3 Parsing documentation for passenger-5.2.0 Installing ri documentation for passenger-5.2.0 Done installing documentation for rack, passenger after 53 seconds 2 gems installed </pre> Install Gem bundler: <pre> % gem install bundler Fetching: bundler-1.16.1.gem (100%) Successfully installed bundler-1.16.1 Parsing documentation for bundler-1.16.1 Installing ri documentation for bundler-1.16.1 Done installing documentation for bundler after 5 seconds 1 gem installed </pre> h2. Check out Redmine Check out the version of Redmine you want, here with version 3.4: <pre> % cd /var/www % svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine </pre> Add a @redmine@ user and transfer ownership of the @/var/www/redmine@ files to it: <pre> % useradd redmine % chown -R redmine /var/www/redmine </pre> h2. Database configuration The database configuration for Redmine is in @/var/www/redmine/config/database.yml@. There is a template in that directory which you can edit. <pre> % cd /var/www/redmine/config/ % cp database.yml.example database.yml </pre> Edit @database.yml@ to contain the correct information regarding your installation. For Postgres: <pre> production: adapter: postgresql database: redmine host: localhost username: redmine password: insert-your-password-here </pre> (Note that you always have the choice of running the database in some other host than @localhost@) h2. Install dependencies using the Gem bundler This step will look at the dependencies specified in the @Gemfile@: <pre> % bundle install </pre> You may have a message about YARD recommending you use the following command: <pre> % yard config --gem-install-yri Updated ~/.gemrc: 'gem: --document=yri' </pre> h2. Setup the production environment Update @/var/www/redmine/config/environment.rb@, adding the following statement: <pre> ENV['RAILS_ENV'] ||= 'production' </pre> Generate a secret token: <pre> % RAILS_ENV=production bundle exec rake generate_secret_token </pre> Run the database migration step: <pre> % RAILS_ENV=production bundle exec rake db:migrate </pre> h2. Start the server You can now attempt to run the application: <pre> % sudo su - redmine % cd /var/www/redmine % /usr/local/bin/ruby bin/rails server -b 0.0.0.0 -e production => Booting WEBrick => Rails 4.2.8 application starting in production on http://0.0.0.0:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server [2018-02-01 12:49:02] INFO WEBrick 1.4.2 [2018-02-01 12:49:02] INFO ruby 2.5.0 (2017-12-25) [x86_64-linux] [2018-02-01 12:49:02] INFO WEBrick::HTTPServer#start: pid=21470 port=3000 </pre> Note that you may want to open the firewall for that port using @firewall-config@.