# Installling packages/ports as user



## codesweat (Apr 14, 2010)

Hello,

I have ran into the problem of not being able to install packages as a user. I don't want to install them as root because A. I shouldn't have to, and B. It fills up my root partition to quickly. I am pretty new so be patient. How do I add packages/compile ports with the user so it will go on the users partition, or the correct directory if multiuser. I am sure it has something to do with permissions.

Brian


----------



## miniqq (Apr 14, 2010)

Yes

```
cd /usr/ports/xxx/
chown -R user:user yyy
cd yyy
make install PREFIX=/home/user/install 
/home/user/install/bin/yyy.execute ..............
```
But it's not suggest !

The exactly you need is PREFIX .


----------



## codesweat (Apr 14, 2010)

Hello,

Just to make sure I have this right. I go to /usr/ports/(whatever port directory i want) then chown -R user:user (my username here?) well I lied i'm not sure I understand. I am new so please explain a little further. 

Brian


----------



## phoenix (Apr 14, 2010)

You don't want to start chown-ing directories willy-nilly under /usr/ports.

Instead, you want to set WRKDIRPREFIX to a directory owned by the user, something like $HOME/portbuild

Then, when you build ports, it will all be done underneath $HOME/portbuild/usr/ports/<category>/<portdir>/work/

However, be sure to set PREFIX on the make command line, to compile and install the app correctly.


```
$ cd $HOME
$ mkdir $HOME/portbuild
$ export WRKDIRPREFIX=$HOME/portbuild
$ cd /usr/ports/somecat/someapp
$ make PREFIX=$HOME/apps install clean
```

*HOWEVER*, this won't actually work, as there is only 1 installed package database, /var/db/pkg.  And non-root users don't have write permission here.  Nor does the database support multiple installs of the same app.


----------



## sixtydoses (Apr 14, 2010)

*+1* on WRKDIRPREFIX and PREFIX usage, but anyway, installing ports/packages as root really shouldn't fill up your /.


----------



## DutchDaemon (Apr 14, 2010)

Yeah, how does this "fill up your root partition"? Ports are installed under /usr/local and some meta stuff under /var/db. And you can always use security/sudo (even password-less) to make it a 'user-like' process.


----------



## SirDice (Apr 14, 2010)

codesweat said:
			
		

> I have ran into the problem of not being able to install packages as a user. I don't want to install them as root because A. I shouldn't have to,


What makes you think you don't need root to install packages?


----------



## codesweat (Apr 14, 2010)

Hey guys,

I thought you could put in the root password for things that needed root access. I guess I was wrong. I will put more space for the root partition and that should fix the problem. I have 70 g of space and did auto when partitioning. It only gave me 500 something MB for the root partition. Ill just add more.

Brian


----------



## cajunman4life (Apr 14, 2010)

codesweat said:
			
		

> Hey guys,
> 
> I thought you could put in the root password for things that needed root access. I guess I was wrong. I will put more space for the root partition and that should fix the problem. I have 70 g of space and did auto when partitioning. It only gave me 500 something MB for the root partition. Ill just add more.
> 
> Brian



Do you have a separate /usr partition? That's where your apps are being installed, not in /.

Also, try installing security/sudo. It allows you to run commands as root without using su.


----------



## sixtydoses (Apr 14, 2010)

codesweat said:
			
		

> Hey guys,
> 
> I thought you could put in the root password for things that needed root access. I guess I was wrong. I will put more space for the root partition and that should fix the problem. I have 70 g of space and did auto when partitioning. It only gave me 500 something MB for the root partition. Ill just add more.
> 
> Brian



You install as root, but run as user. Some applications will require you to run as root such as apache, but most, don't. And 500MB is enough for / (should be).


----------

