📜 ⬆️ ⬇️

CentOS 5 + ISPManager + Redmine

It all started with the fact that I needed Redmine, since this system was discussed at Habré, I will not go into details, I’ll just say that ruby 1.8.6 / 1.8.7, rails 2.3.5 rack 1.0.1 is required to work.

But not everything is as simple as it seems at first glance, if such instructions for Debian can be found in Google without problems and with a shaft, then with CentOS not everything is so rosy, although I still found the instructions a little by searching. The situation was aggravated by the fact that ISPManager was already installed on the host, of course you could put a clean CentOS and not bathe, but since I repeatedly noticed an interest in this configuration on different freelance sites, I decided to figure out how to run everything without disrupting system.

What is available at the entrance:

Everything is installed by default, of the special changes, except that nginx is installed through yum and included in ISPManager.

So, let's begin

First of all, we need to install ruby ​​and of course rails, and here we come across the first problem, the fact is that in the basic CentOS delivery there is only version 1.8.5 which does not satisfy the Redmine system requirements. That's why I went to Google in search of the required version already compiled under CentOS, the only thing I found was a third-party repository with the version I needed, which I did not want to plug in, besides, after a quick acquaintance with it, I discovered that there is only x86 packages that did not suit me. I also stumbled upon the advice to collect Rubies from src.rpm from Fedora 13, this option was also dropped by me. As a result, Google led me to this wonderful haut that I partially used.
Add a repository and install ruby ​​and rails:
[root@example.com]# cd /tmp
[root@example.com tmp]# wget packages.endpoint.com/endpoint-rpmsign.pub
[root@example.com tmp]# rpm --import endpoint-rpmsign.pub
[root@example.com tmp]# wget packages.endpoint.com/rhel/5/os/x86_64/endpoint-repo-1.0-1.x86_64.rpm
[root@example.com tmp]# yum localinstall endpoint-repo-1.0-1.x86_64.rpm
[root@example.com tmp]# yum install ruby-enterprise ruby-enterprise-rubygems
[root@example.com tmp]# gem install -v=2.3.5 rails

And so the ruby ​​and rails of the required version are installed.
Also, you need gem i18n versions below 0.4.0.0, since versions 0.4.0.0 and higher cause problems.
[root@example.com tmp]# gem install -v=0.3.7 i18n

And so everything is almost ready, it remains only to configure ISPManager. I want to note that ISPManager has the ability to use Ruby on Rails right out of the box, which helped a lot as it didn’t have to be done with crutches. Nevertheless, additional gestures all the same from you will be required.
Namely:

With Phusion Passenger ™, everything is relatively simple:
[root@example.com tmp]# gem install passenger
[root@example.com tmp]# yum install gcc-c++ httpd-devel
[root@example.com tmp]# passenger-install-apache2-module

If everything goes as it should at the end of the module building process for apache, you will see:
The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/local/bin/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
Press ENTER to continue.

copy the following to /etc/httpd/conf.d/passenger.conf:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/local/bin/ruby

and restart apache
[root@example.com tmp]# service httpd reload

Also need to install mysql support for ruby
[root@example.com tmp]# yum install mysql-devel.x86_64
[root@example.com tmp]# gem install mysql

')
That's all, RoR is installed and ready to use.
As I said earlier in ISPManager there is support for RoR, but in our case it’s impossible to enable it directly in the panel because the panel will want to install packages from the standard repository, but as we said earlier, they don’t fit, but this is not a problem at all.
As it turned out, RoR simply turns on through the ISPManager configuration . To do this, simply add the line
path rails /usr/local/bin/rails
at the end of the /usr/local/ispmgr/etc/ispmgr.conf file
and restart ISPManager
[root@example.com tmp]# killall ispmgr
After all these manipulations, go to the ISPManager admin area and create a domain for our Redmine.
image
Everything is ready, now you can go directly to the installation of Redmine.
Login with your user via ssh and go to the web root of the newly created domain.
-bash-3.2$ cd www/redmine.example.com

delete the entire contents of the directory
-bash-3.2$ rm -rf ./* ( !!! , )

Downloading Redmine version 1.0.1 (I installed from trunk) and unpack
-bash-3.2$ wget rubyforge.org/frs/download.php/72201/redmine-1.0.1.tar.gz
-bash-3.2$ tar xvzf redmine-1.0.1.tar.gz
-bash-3.2$ mv redmine-1.0.1/* .
-bash-3.2$ rm -rf ./redmine-1.0.1*

I used mysql as a database, as far as I know there are some troubles with the Russian language when using mysql as a database for Redmine, but it was not important for me (they will not be used by Russian speakers). Nothing will prevent you from using PostgreSQL as a bd. It is understood that the database has already been created and you have all the necessary data on hand.
Before starting all the manipulations, it is necessary to freeze the ruby ​​version.
To do this, under the root go to the directory where we downloaded Redmine and do the following
-bash-3.2$ cd /var/www/<isp-username>/data/www/<created.domain.name>
-bash-3.2$ rake VERSION=2.3.5 rails:freeze:gems

This will avoid problems with updates.
You should also fix one line in /var/www/<isp-username>/data/www/<created.domain.name>/vendor/rails/activesupport/lib/active_support/vendor.rb
to replace
gem 'i18n', '>= 0.1.3'b
on
gem 'i18n', '>= 0.1.3', '< 0.4.0'
This is all to avoid the problems associated with i18n.
Ok, now we return to the console of the user, and we copy an example of a config of a DB.
-bash-3.2$ cp config/database.yml.example config/database.yml

We edit the config / database.yml, everything is quite simple there, you drive in the necessary data to connect to the database and the type of database. There will be something like this
production:
adapter: mysql
database: redmine_test
host: localhost
username: redmine_test
password: redmine_test
encoding: utf8

development:
adapter: mysql
database: redmine_test
host: localhost
username: redmine_test
password: redmine_test
encoding: utf8

And directly install Redmine
-bash-3.2$ rake generate_session_store
-bash-3.2$ RAILS_ENV=production rake db:migrate
-bash-3.2$ RAILS_ENV=production rake redmine:load_default_data

That's all, Redmine is installed and ready to use.
image
Do not forget to remove the compiler from the battle server.
Plans to tie another Git for complete happiness.

List of sources used:


Comments and additions are welcome.

Source: https://habr.com/ru/post/104610/


All Articles