Archive

Archive for March, 2013

Installing gevent from source on Windows

28/03/2013 1 comment

I was trying to install Gevent from source on my windows machine using virtualenv. So lets start from the beggining:


c:\Python27\python.exe virtualenv.py --distribute sandbox_gevent
sandbox_gevent\Scripts\activate
pip install gevent

Problems

 
As usual, problems are waiting to happen.

Downloading/unpacking gevent
Downloading gevent-0.13.8.tar.gz (300kB): 300kB downloaded
Running setup.py egg_info for package gevent
Please provide path to libevent source with --libevent DIR
Complete output from command python setup.py egg_info:
Please provide path to libevent source with --libevent DIR

Fix

libevent is missing so we have to install it. From source 🙂
Download https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz and unpack it. You don’t have to build this, it is only used by gevent in the build process.

Retry

 
pip install gevent --install-option="--libevent path\to\libevent\source"

Problems, again

 
Here it is again.

Downloading/unpacking gevent
Downloading gevent-0.13.8.tar.gz (300kB): 300kB downloaded
Running setup.py egg_info for package gevent
Please provide path to libevent source with --libevent DIR
Complete output from command python setup.py egg_info:
Please provide path to libevent source with --libevent DIR

As it turns out the --install-option switch doesn’t work. Maybe it could be fixed somehow but I found it is easier to install gevent directly from source.

Installation gevent from source

 
First download gevent source and unpack it. And then run this:

cd path\to\gevent\source
python setup.py build --libevent path\to\libevent\source
python setup.py install --libevent path\to\libevent\source

Done 🙂

I have VS2008 installed so if you don’t try to get at least the VC 2008 redistributable and the platform SDK to get the files needed to compile this.

Advertisements

vmWare tools on openSuse 12.3

18/03/2013 1 comment

I was having some problems installing vmWare tools in vmWare Player 5 for the new version of openSuse. It seems some header files are located in the wrong place where the installer of vmWare tools is not looking. The original article about the problems says this should fix the problem:


zypper install kernel-desktop-3.7.10-1.1.1.x86_64
zypper install kernel-desktop-devel-3.7.10-1.1.1.x86_64
mkdir -p /lib/modules/3.7.10-1.1-desktop/build/include/linux
cp /usr/src/linux-3.7.10-1.1-obj/x86_64/desktop/include/generated/uapi/linux/version.h /lib/modules/$(uname -r)/build/include/linux

and then to run the vmware-install.pl script.
It worked like a charm.

Categories: openSuse, vmWare Tags: , ,

Redmine 2.2.3 on openSuse 12.3

I wanted to install the newest Redmine on the last version of openSuse (12.3 – released yesterday). So, here are the steps from the official Redmine site (Installing Redmine).

Getting Redmine

 
You usually get the source from the RubyForge site, so let’s do it.

wget http://rubyforge.org/frs/download.php/76771/redmine-2.2.3.tar.gz

Unpacking it is easy.

tar -xvf redmine-2.2.3.tar.gz

Dependencies installation

 
The documentation states that Redmine needs:

  • ruby 1.8.7, 1.9.2, 1.9.3, jruby-1.6.7
  • Rails 3.2.12
  • RubyGems <= 1.8

From now on re run this as root:

zypper install ruby
zypper install rubygem-rails-3_2

RubyGems will get installed with ruby 1.9.3, as a dependency.
Bundler will get installed with Rails 3.2.12, as a dependency.

The hard part

 
We will try to install the rest of the remaining dependencies using the patented method of useless attempts.

Attempt 1

cd redmine-2.2.3
bundle install --without development test

Error 1:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib64/ruby/include/ruby.h

Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v ‘1.7.7’` succeeds before bundling.

Fix 1: missing ruby development package

zypper install ruby-devel

Attempt 2

bundle install --without development test

Error 2:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb
creating Makefile

make
sh: make: command not found

Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v ‘1.7.7’` succeeds before bundling.

Fix 2: missing make

zypper install make

Attempt 3

bundle install --without development test

Error 3:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb
creating Makefile

make
compiling generator.c
make: gcc: Command not found
make: *** [generator.o] Error 127

Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v ‘1.7.7’` succeeds before bundling.

Fix 3: missing gcc

zypper install gcc

Attempt 4

bundle install --without development test

Error 4:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb
checking for rb_thread_blocking_region()… yes
checking for rb_wait_for_single_fd()… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lmygcc… no
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.9
–with-mysql-config
–without-mysql-config
–with-mysql-dir
–without-mysql-dir
–with-mysql-include
–without-mysql-include=${mysql-dir}/include
–with-mysql-lib
–without-mysql-lib=${mysql-dir}/
–with-mysqlclientlib
–without-mysqlclientlib
–with-mlib
–without-mlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-zlib
–without-zlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-socketlib
–without-socketlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-nsllib
–without-nsllib
–with-mysqlclientlib
–without-mysqlclientlib
–with-mygcclib
–without-mygcclib
–with-mysqlclientlib
–without-mysqlclientlib

Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/mysql2-0.3.11 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v ‘0.3.11’` succeeds before bundling.

Fix 4: missing mysql development

zypper install libmysqlclient-devel

Attempt 5

bundle install --without development test

Error 5:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb
checking for pg_config… no
No pg_config… trying anyway. If building fails, please try again with
–with-pg-config=/path/to/pg_config
checking for libpq-fe.h… no
Can’t find the ‘libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.9
–with-pg
–without-pg
–with-pg-dir
–without-pg-dir
–with-pg-include
–without-pg-include=${pg-dir}/include
–with-pg-lib
–without-pg-lib=${pg-dir}/
–with-pg-config
–without-pg-config
–with-pg_config
–without-pg_config

Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out
An error occurred while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v ‘0.14.1’` succeeds before bundling.

Fix 5: missing postgresql development

zypper install postgresql-devel

Attempt 6

bundle install --without development test

Error 6:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb
checking for Ruby version >= 1.8.5… yes
checking for gcc… yes
checking for Magick-config… no
Can’t install RMagick 2.13.2. Can’t find Magick-config in /sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.9

Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v ‘2.13.2’` succeeds before bundling.

Fix 6: missing ImageMagic development

zypper install libMagick++-devel

Attempt 7

bundle install --without development test

Error 7:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb
checking for sqlite3.h… no
sqlite3.h is missing. Try ‘port install sqlite3 +universal’
or ‘yum install sqlite-devel’ and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.9
–with-sqlite3-dir
–without-sqlite3-dir
–with-sqlite3-include
–without-sqlite3-include=${sqlite3-dir}/include
–with-sqlite3-lib
–without-sqlite3-lib=${sqlite3-dir}/
–enable-local
–disable-local

Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/sqlite3-1.3.7 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v ‘1.3.7’` succeeds before bundling.

Fix 7: missing sqlite development

zypper install sqlite3-devel

Attempt 7

bundle install --without development test

Win!!

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Setup the database

 
Now we have to connect to a database and create a user. I will choose postgresql because I have it already installed.

su - postgres
psql postgres
postgres=# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
postgres=# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

Tweak the pg_hba.conf to allow the redmine user to login. Add the following line before any other definition. Beware that this is only for demonstration purposes and should not be used like this for serious purposes.

host redmine redmine 127.0.0.1/32 trust

Reload the postgresql service as root:

systemctl reload postgresql.service

Configure the database connection creating a redmine-2.2.3/config/database.yml file using the redmine-2.2.3/config/database.yml.example as a template. I used the following configuration:

production:
  adapter: postgresql
  database: redmine
  host: 127.0.0.1
  username: redmine
  password: "my_password"
  encoding: utf8

The password is not needed because we have configured the database to trust the redmine user when connection to the redmine database on the same host.

Session store secret generation

 
As a regular user generate the secret random key used to encrypt cookies

cd redmine-2.2.3
rake generate_secret_token

Creating the tables in the database

 
Now we have to create the tables for Redmine.

RAILS_ENV=production rake db:migrate

Loading the default data

 
Some initial data needs to be inserted into the redmine database.

RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data

File system permissions

 
Some permissions should be given on log, tmp and public/plugin_assets folders.

mkdir tmp tmp/pdf public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

Go go go!!!

 
And we are done 🙂 Run the server and connect on http://localhost:3000. You can use the admin/admin for username/password.

ruby script/rails server webrick -e production

I hope that this at least helped someone to avoid getting stuck with dependency issues installing Redmine.

Categories: openSuse, Redmine Tags: , ,