Shared host (Dreamhost)


#1

I am unable to install gems on my dreamhost server since it’s just
shared hosting. I tried unpacking the ferret gem into vendor/ferret, but
to no avail.

Also how would I recompile the C extensions for the new platform?

Any ideas would be greatly appreciated.

Cheers, Simon


#2

Not true. I use dreamhost and I’m able to completely compile my own
setup. Here’s how I do it. The following bash script creates your
own custom ruby environment, in which you can install whatever addons
and gems you want. Then just make sure you have

export PATH="$HOME/extra/bin:$PATH"

in your .bash_profile script and also make sure your ruby scripts
point to $HOME/extra/bin/ruby.


#!/bin/sh

remove old stuff

rm -rf $HOME/extra/bin
rm -rf $HOME/extra/include
rm -rf $HOME/extra/info
rm -rf $HOME/extra/lib
rm -rf $HOME/extra/man
rm -rf $HOME/extra/src
rm -rf $HOME/extra/ssl
mkdir -p $HOME/extra/bin
cp $HOME/extra/binbak/* $HOME/extra/bin

create directory for compiling source code

mkdir -p $HOME/extra/src
cd $HOME/extra/src

download and compile source tarballs

wget http://www.openssl.org/source/openssl-0.9.8a.tar.gz
tar zxvf openssl-0.9.8a.tar.gz
rm -f openssl-0.9.8a.tar.gz
cd openssl-0.9.8a
./config --prefix=$HOME/extra
make
make test
make install
cd …

wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar zxvf fcgi-2.4.0.tar.gz
rm -f fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --prefix=$HOME/extra
make
make install
cd …

wget ftp://ftp.cwru.edu/pub/bash/readline-5.1.tar.gz
tar zxvf readline-5.1.tar.gz
rm -f readline-5.1.tar.gz
cd readline-5.1
./configure --prefix=$HOME/extra
make
make install
cd …

wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz
tar zxvf ruby-1.8.4.tar.gz
rm -f ruby-1.8.4.tar.gz
cd ruby-1.8.4
./configure --prefix=$HOME/extra --with-openssl=$HOME/extra
–with-readline-dir=$HOME/extra
make
make install
cd …

wget http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.7.tar.gz
tar zxvf mysql-ruby-2.7.tar.gz
rm -f mysql-ruby-2.7.tar.gz
cd mysql-ruby-2.7
ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
make

PLACE CUSTOMIZED DATABASE PARAMETERS HERE:

ruby ./test.rb DBHOST DBUSER DBPASS DBNAME DBPORT
make install
cd …

wget http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz
tar zxvf ruby-fcgi-0.8.6.tar.gz
rm -f ruby-fcgi-0.8.6.tar.gz
cd ruby-fcgi-0.8.6
ruby install.rb config
ruby install.rb setup
ruby install.rb install
cd …

wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar zxvf rubygems-0.8.11.tgz
rm -f rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb
cd …

gem install rails --include-dependencies


#3

Carl Y. wrote:

Lots of good stuff.

Nicely done. I’ll try that out when I get home.

Thanks bud.


#4

I think I figured out the issue. My script was being killed for some
reason when I ran it interactively and the ./config didn’t finish
correctly. I pipped the output to a file and ran the script in the
background with &

I’m not sure why this fixed it, but it seems to have so far.


#5

I noticed that Dreamhost actually shut down my script occasionally
while I was running it, probably because it ties up the CPU for
extensive periods of time. I had to keep trying until it completed
successfully. I’m sure this annoys them somewhat, but I don’t have to
set up my environment from scratch very often.

Carl


#6

And what about RoR applications - FCGIs

I have changed shebang location (#!) to my bin/ruby and application
didn’t run at all - webrick starts and runs correctlly, but
dispatch.fcgi - not

Does anybody fixed that case.

Nick


#7

Carl,

When I run make for openssl I get the following errors, any ideas?

Cheers, Simon.

make -f …/Makefile.shared -e
APPNAME=openssl OBJECTS=“openssl.o verify.o asn1pars.o req.o
dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o
crl2p7.o crl.o rsa.o rsautl.o dsa.o dsapa
LIBDEPS=” $LIBRARIES -ldl"
link_app.${shlib_target}
make[2]: Entering directory
/home/.divot/mobiforge/extra/src/openssl-0.9.8a/apps' ( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERM) speed.o(.text+0x764): In functionspeed_main’:
: undefined reference to BF_set_key' speed.o(.text+0x1420): In functionspeed_main’:
: undefined reference to BF_cbc_encrypt' speed.o(.text+0x1fde): In functionspeed_main’:
: undefined reference to BF_options' version.o(.text+0x173): In functionversion_main’:
: undefined reference to BF_options' ../libcrypto.a(e_bf.o)(.text+0x5d): In functionbf_init_key’:
: undefined reference to BF_set_key' ../libcrypto.a(e_bf.o)(.text+0xa4): In functionbf_cbc_cipher’:
: undefined reference to BF_cbc_encrypt' ../libcrypto.a(e_bf.o)(.text+0xfb): In functionbf_cfb64_cipher’:
: undefined reference to BF_cfb64_encrypt' ../libcrypto.a(e_bf.o)(.text+0x154): In functionbf_ecb_cipher’:
: undefined reference to BF_ecb_encrypt' ../libcrypto.a(e_bf.o)(.text+0x1a4): In functionbf_ofb_cipher’:
: undefined reference to BF_ofb64_encrypt' collect2: ld returned 1 exit status make[2]: *** [link_app.] Error 1 make[2]: Leaving directory/home/.divot/mobiforge/extra/src/openssl-0.9.8a/apps’
make[1]: *** [openssl] Error 2
make[1]: Leaving directory
`/home/.divot/mobiforge/extra/src/openssl-0.9.8a/apps’
make: *** [build_apps] Error 1