# how do you change the ports mirror



## baronobeefdip (May 3, 2011)

We are planning on making our own ports server in the lab room. But we don't know how to change where the operating system retrieves them. Our local server might not have a domain name so if it's possible to make the retrieval URL into an ip address instead of a name then that would be great.


----------



## vivek (May 3, 2011)

For *pkg_add* command you set PACKAGEROOT variable using sh / ksh / tcsh as follows:


```
PACKAGEROOT=ftp://ftp3.FreeBSD.org
setenv PACKAGEROOT ftp://lab1.example.ac.in
pkg_add -vr foobar
```

Another option is cvs-supfile and set


```
*default host=cvsup1.us.FreeBSD.org
```

To


```
*default host=lab1.example.ac.in
```

See http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvsup.html


----------



## baronobeefdip (May 4, 2011)

Can an IP address be used along with a share directory or something if we can't get a domain name within the LAN? It's closed off to the rest of the world we have no internet just a bunch of computers interconnected together on a private LAN.

We just found that Samba isn't on the DVD but as far as we know, we can't run any of the commands that come with the samba suite so we don't know if we have it running as an SMB server or not. Is samba really on the DVD Or do we need to install it through ports?


----------



## Lowell (May 4, 2011)

An IP address can be used, although it might be easier to set up a DNS server for your local addresses.  You can NFS-mount the ports tree if you like, which is generally easier than using a Microsoft-style share.  In that case, I would recommend setting WRKDIRPREFIX to build the ports in a local (and not-shared) workspace.


----------



## baronobeefdip (Jun 4, 2011)

What is the file that I change the url for where the machine fetches the packages from after running a port? We're planning on installing the ports with this command.

`# make && make install && make clean`

We want the port that we'll be using to fetch the packages from our local package repository. But just out of curiosity, what is the URL that the port fetches the packages from by default?


----------



## baronobeefdip (Jun 5, 2011)

So can we make our own port ftp server? It's on a closed LAN and we don't have a package server for FreeBSD.


----------



## baronobeefdip (Jun 14, 2011)

This has nothing to do with cvsup (unless that's how FreeBSD gets the packages in the first place).


----------



## schrodinger (Jun 15, 2011)

ports(7)

"MASTER_SITE_OVERRIDE" 

This should be what you are looking for.


----------



## baronobeefdip (Jun 17, 2011)

Okay I did my research and I think that I understand this more clearly. First the make.conf file is the configuration file that has the tag

```
MASTER_SITE_OVERRIDE=ftp.example.com
```
All I have to do is put in the address to the software repository and its directory and I'll be good to go?


----------



## schrodinger (Jun 17, 2011)

You can just use it in the shell's environment or define it in the make.conf. I believe you need to specify the entire path, something like the following:


```
ftp://ftp.ie.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
```


----------



## baronobeefdip (Jun 17, 2011)

schrodinger said:
			
		

> You can just use it in the shell's environment or define it in the make.conf. I believe you need to specify the entire path, something like the following:
> 
> 
> ```
> ...



I know, I was just giving an example. Since we already have our ftp server hooked up and running we just need to upload the packages to it. Then give the BSD boxes the url address to the packages folder. Here's what it might look like:

```
MASTER_SITE_OVERRIDE=//192.168.1.7/FreeBSD
```
The FreeBSD directory on the server will contain all of the packages (without being inside of individual folders like they were on the ftp site). I just downloaded all of them into a single directory but tell me if I needed to organize them like it was on the ftp site. We will get these boxes retrieving these packages soon.


----------



## baronobeefdip (Jun 21, 2011)

I'm just curious but is there a way to change the ftp site it retrieves packages from through sysinstall? I've seen that you can specify a specific url when you choose to install packages from ftp, but my question is if you can make it permanent?


----------



## DutchDaemon (Jun 21, 2011)

Note that ports and packages are not interchangeable when talking about ftp sites. You seem to be changing from one to the other frequently. 

For packages:

pkg_add(1)


```
The environment variable PACKAGEROOT specifies an alternate location for
     pkg_add to fetch from.  The fetch URL is built using this environment
     variable and the automatic directory logic that pkg_add uses when the -r
     option is invoked.  An example setting would be "ftp://ftp3.FreeBSD.org".

     The environment variable PACKAGESITE specifies an alternate location for
     pkg_add to fetch from.  This variable subverts the automatic directory
     logic that pkg_add uses when the -r option is invoked.  Thus it should be
     a complete URL to the remote package file(s).
```

For ports(7):


```
fetch      Fetch all of the files needed to build this port from the
                sites listed in MASTER_SITES and PATCH_SITES.  See FETCH_CMD,
                MASTER_SITE_OVERRIDE and MASTER_SITE_BACKUP.
```

There's not much more to it than that.


----------

