# Changing package repository



## rahulsinner (Apr 20, 2009)

Hi,

How do I change the package repository for pkg_add/portupgrade? I tried defining PACKAGEROOT:


```
$export PACKAGEROOT="ftp://ftp.freebsd.org/pub/FreeBSD/ports/packages/All/"
```

But it still won't listen and spit out following crap:


```
Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.0-release/Latest/kde4.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.0-release/Latest/kde4.tbz' by URL
```

The ftp resources being mentioned does not exist. 

I tried changing /usr/local/etc/pkgtools.conf but continued to get same errors:


```
ENV['PKG_PATH'] = '/All'
  ENV['PACKAGEROOT'] = 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/packages'
```

I read somewhere that pkg_add/portupgrade does some appending to the PACKAGEROOT according to pre-defined rules. The repository I have listed(well, looks like the official repo to me) doesn't follow the naming convention it is searching for.

How do I get it to work?

I am no big fan of ports because it takes enormous amounts of disk space. I alloted 1 GB for ports and compilation(/usr/ports is a symlink to a different file system) and it keeps up filling it. I try to compile a package and it has tens of dependencies. By the time all of them are downloaded  and compiled, the package  I wanted to install won't install because it runs out of disk space.


----------



## tangram (Apr 20, 2009)

Try the PACKAGESITE variable:

```
# setenv  PACKAGESITE [url]ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/7.1-RELEASE/packages/All/[/url]
# pkg_add -r fubar
```

You can add the variable to your .cshrc.


----------



## SirDice (Apr 20, 2009)

rahulsinner said:
			
		

> I am no big fan of ports because it takes enormous amounts of disk space. I alloted 1 GB for ports and compilation(/usr/ports is a symlink to a different file system) and it keeps up filling it. I try to compile a package and it has tens of dependencies. By the time all of them are downloaded  and compiled, the package  I wanted to install won't install because it runs out of disk space.



My /usr/ports is about 4GB and is 97% in use, this includes distfiles but not packages. My build packages are stored separately and is usually somewhere between 600MB and 900MB, depending on what I've build. I've set WRKDIRPREFIX to /tmp/build to keep the clutter out and improve performance somewhat, /tmp is a stripped disk set and is about 6GB. I haven't ran out of disk space yet.

1GB will never cut it. To keep the distfiles in check I regularly run *portsclean -D*, the clutter is removed by a simple *rm -rf /tmp/build/**. Packages are stored separately, I usually mount_nullfs the directory where I store them.


----------



## rahulsinner (Apr 21, 2009)

tangram said:
			
		

> Try the PACKAGESITE variable:
> 
> ```
> # setenv  PACKAGESITE [url]ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/7.1-RELEASE/packages/All/[/url]
> ...



It worked. Is there a way pkg_add can search for packages on the PACKAGESITE. Like I say "pkg_add -r vlc" and it searches  for and installs it. I was thinking something on the lines of other binary package management tools viz. apt-get, yum etc.


----------

