See http://forum.qnap.com/viewtopic.php?f=32&t=45809
Now I am able to run ruby 1.9.2 and rails 3.1.1 on my QNAP 219P+
It took me 2 days to figure out most of the details to get it running and in the end I had to drop the whole rvm thing since it plain didn't work, but I hardwired the ruby installation and it works for me now.
Things that will be installed:
- Perl 5.8.9 with thread support
Ruby 1.9.2 (latest)
node.js & v8 (needed as javascript interpreters)
rails 3.1.1
As a prerequisite I installed the following ipkg packages:
- Code: Select all
ipkg install scons gawk sed autoconf git bash coreutils findutils libcurl libcurl-dev make configure python svn sqlite nano openssl openssl-dev
I think all of them are needed since Qnap's built in tools are incomplete and produce cryptic configure or compile errors.
(except for nano, which I just use to edit text files)
Just like in my first post create the following links for the compiler tools
- Code: Select all
mkdir -p /home/slug/optware/cs08q1armel/toolchain/arm-2008q1/bin/
cd /home/slug/optware/cs08q1armel/toolchain/arm-2008q1/bin/
ln -s /opt/bin/gcc arm-none-linux-gnueabi-gcc
ln -s /opt/bin/g++ arm-none-linux-gnueabi-g++
Download the needed sources to a directory on one of your disks (where there is enough space) and not into your home directory when you ssh to your NAS.
I have my stuff compiled under /shares/myname/Sources/ (and that is the directory where I cloned all the source repositories or downloaded the tar.gz archives)
- Code: Select all
cd /shares/myname/Sources/
git clone https://github.com/v8/v8.git
cd v8
nano SConstruct
Now find and remove the lines -Wall -Werror because otherwise all warnings will be treated as errors and you won't get far. (and without -Wall the output is more clear)
- Code: Select all
scons mode=release library=shared vfp3=off unalignedaccesses=off armeabi=soft mipsabi=softfloat
This is the most important thing on my NAS because otherwise I would get Segmentation faults when using the library.
This might not be necessary on non-ARM units, but then it is kinda trivial anyway I guess and you don't need that guide.
I then linked the created libraries like in my older post:
- Code: Select all
ln -s /shares/myname/Sources/v8/libv8preparser.so /usr/lib/libv8preparser.so
ln -s /shares/myname/Sources/v8/libv8.so /usr/lib/libv8.so
Further in my Sources directory:
I chose node.js instead of therubyracer, since therubyracer always produced segmentation faults later. Maybe I misconfigured it.
- Code: Select all
git clone https://github.com/joyent/node.git
cd node
./configure --prefix=/opt
As for perl (this is not needed if you compile ruby without rvm)
only perl 5.8.9 works. All other version produce segmentation faults on my NAS during compile.
- Code: Select all
curl -O http://www.cpan.org/src/5.0/perl-5.8.9.tar.gz
tar xfz perl-5.8.9.tar.gz
cd perl-5.8.9
sh Configure -Dusethreads -Dcc=gcc -Dprefix=/opt -de
- Code: Select all
die "No error definitions found"
Then continue:
- Code: Select all
make
make install
So far you should have a working perl and node installation.
check with:
- Code: Select all
perl -V
node
Now there are two different paths to choose.
Either compile ruby yourself, or use rvm to do so.
I tried both, and the compilation process worked fine both times and produced usable ruby 1.9.2 versions.
so you can compile it yourself:
* clone latest source or download source-archive
* cd into new directory
then:
- Code: Select all
autoconf
./configure --prefix=/opt
make
make install
I am not sure if that is all since I never 'installed' my build. Maybe someone who goes this way can fill in some information here. (Probably set up PATH and GEM_HOME?)
For rvm I changed to bash and run the install script from the rvm website
before that though you will want to create ~/.rvmrc and add rvm_path=/opt/rvm to it! That way you don't have your rvm directory in your home, where you would run out of space immediately! You can do this with:
- Code: Select all
echo 'rvm_path=/opt/rvm' >> ~/.rvmrc
I want to point out that rvm never really worked on my system and I only used it to build the latest ruby in the end, since nothing of rvm's functions worked and with some commands produced annoying error output from the Busybox commands. So in the end i deleted /etc/profile.d/rvm.sh and just set up my environment variables
- Code: Select all
export GEM_HOME=/opt/rvm/rubies/ruby-1.9.2-head/lib/ruby/gems/1.9.1
export PATH=/opt/rvm/rubies/ruby-1.9.2-head/bin/:$PATH
Make sure to uninstall the ipkg ruby version, which was giving me trouble with the gem directory.
- Code: Select all
ipkg remove ruby
then I could install the gems:
- Code: Select all
gem install rails
gem install node
gem install execjs
gem install sqlite3 -- --with-sqlite3-lib=/opt/lib
Furthermore there seem to be some incompatibilities and I had to use rack '1.3.3' instead of the latest version with my rails apps (added to Gemfile) to avoid problems.
So in the Gemfile of a new app I add:
- Code: Select all
gem rack, '1.3.3'
gem execjs
gem node
That's it.
I have RoR 3.1.1 and ruby 1.9.2 running on my QNAP 219P+
I am pretty sure I didn't remember all the details and I made many errors in the process, so please comment on anything I might have forgotten or could have done better.
I know, the ruby thing is a bit sketchy in the end, but I kinda hacked it together myself to make it work as well.
Someone should be able to make a qpkg out of this whole thing now
Update:
I managed to get rvm working properly!
now I am stuck at passenger. More specifically with the apache installation and the corresponding files not being found by passenger.
Update 2:
I got passenger to compile and since the build directory from the apache install is not present I tried to build the standalone version with nginx.
This went well(actually not really... I had to modify a C-header to make it compile even, but eventually it worked) up until when I try to start my server where it dies with:
- Code: Select all
*** ERROR ***
Could not start Passenger Nginx core:
nginx: [alert] could not open error log file: open()
"/tmp/passenger-standalone.6059/logs/error.log" failed (2: No such file or
directory)
2011/10/23 22:32:40 [emerg] 6071#0: getgrnam("nobody") failed (2: No such file
or directory)
Stopping web server... done
News