summaryrefslogtreecommitdiff
path: root/development/install_as_non_root.mdwn
blob: d991f9d697d38e8cb705a4118587023ab1803e57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Developing as non root

Many examples tell you to do things like

    sudo python setup.py install

or

    sudo gem install foo

or

    ./configure --prefix=/
    make install

While this is o.k. if you know what you're doing and you give a crap
about package management risking to break other scripts and tools by
introducint new library versions it is often much better to not install
the libraries into a location where other tools can setp on it
(e.g. /usr/lib, /usr/bin or /usr/local/\*).

## Ruby

Use bundler to pull Gems from [rubygems.org](http://rubygems.org). The *Gemfile*
describes what you want to pull in:

    source 'https://rubygems.org'

    group :development, :test do
      gem 'puppetlabs_spec_helper',  :require => false
      gem 'puppet-lint',             :require => false
      gem 'puppet',                  puppetversion, :require => false
      gem 'rake', '~> 10.1.0',       :require => false
      gem 'rspec-puppet',            :require => false
      gem 'simplecov',               :require => false
    end

With that in place you can run

    sudo apt-get install bundler
    bundle install --path=vendor

and it will fetch the gems and put them into vendor/. No cluttering of
any directories outside your project. You can run commands from that via

	bundle exec <cmd>

e.g.

    bundle exec rake spec

## NodeJS

npm

## GNOME

jhbuild

## Generic C/C++ project

For a limited set of libs you can do:

    PREFIX=$PWD/../installed
    ./configure --prefix=$PREFIX
    make install
    export LD_LIBRARY_PATH=$PREFIX

see e.g. libplanfahr's ./run

## Python

For Python there's virtualenv

    virtualenv newtestenv
    source newtestenv/bin/activate

From there on you can use the new environment already, e.g. install a module into it:

    cd mymodule
    python setup.py install

This would install the module (along with it's dependenies) into you new *testenv*.