Can we make a perl script to download everything from a mirror and make a mirror?

Yes, technically possible. You don't even have to download everything, just download what you need (and their dependencies). You can generate a catalog for use on your own server using pkg-repo(8).

Can I config an Nginx Server to share this private mirror?

I am not sure whether the pkg(8) tool can access to this private mirror with Nginx.

Here is the plan:
  • Step 1 is to download everthing and make a private mirror wike pkg-repo(8).
  • Step 2 is to share this private mirror with other FreeBSD system by using an Nginx Server.
 
Can I config an Nginx Server to share this private mirror?
Yes, I have my private repository (built with ports-mgmt/poudriere) shared with nginx.

I am not sure whether the pkg(8) tool can access to this private mirror with Nginx.
See pkg.conf(5)
Code:
     For a MIRROR_TYPE of NONE, any of the URL schemes supported by
     libfetch(3) can be used, including: http://, https://, ftp://, or
     file://.  In addition a ssh:// URL scheme is also supported.  Where
     MIRROR_TYPE is SRV, you should use a pkg+http:// or pkg+https:// (etc.)
     URL scheme.  Using an http:// URL implies that the hostname part is a
     simple hostname according to RFC 2616, and is no longer accepted.
It's still mentioned but I do believe ftp:// has been removed, or will be removed sometime in the near future.
 
Yes, I have my private repository (built with ports-mgmt/poudriere) shared with nginx.


See pkg.conf(5)
Code:
     For a MIRROR_TYPE of NONE, any of the URL schemes supported by
     libfetch(3) can be used, including: http://, https://, ftp://, or
     file://.  In addition a ssh:// URL scheme is also supported.  Where
     MIRROR_TYPE is SRV, you should use a pkg+http:// or pkg+https:// (etc.)
     URL scheme.  Using an http:// URL implies that the hostname part is a
     simple hostname according to RFC 2616, and is no longer accepted.
It's still mentioned but I do believe ftp:// has been removed, or will be removed sometime in the near future.

I got enough information. 😄
 
Yes, I have my private repository (built with ports-mgmt/poudriere) shared with nginx.


See pkg.conf(5)
Code:
     For a MIRROR_TYPE of NONE, any of the URL schemes supported by
     libfetch(3) can be used, including: http://, https://, ftp://, or
     file://.  In addition a ssh:// URL scheme is also supported.  Where
     MIRROR_TYPE is SRV, you should use a pkg+http:// or pkg+https:// (etc.)
     URL scheme.  Using an http:// URL implies that the hostname part is a
     simple hostname according to RFC 2616, and is no longer accepted.
It's still mentioned but I do believe ftp:// has been removed, or will be removed sometime in the near future.

One more question, can I do some similar things to create a private mirror to run freebsd-update.

I known freebsd-update may only need to download and update a few files, bu I still hope can make a private mirror to update the base system.
 
One more question, can I do some similar things to create a private mirror to run freebsd-update.

I known freebsd-update may only need to download and update a few files, bu I still hope can make a private mirror to update the base system.
Just use a caching proxy for this.

For nginx:
Code:
    server {
      listen 192.168.x.x:80;
      server_name fbsd-update.example.com;

      root /var/cache/fbsd-update;

      access_log /var/log/nginx/proxy-access.log;

      location / {
        proxy_cache fbsdupdate_cache;
        proxy_cache_lock on;
        proxy_buffering on;
        proxy_http_version 1.1;
        proxy_cache_revalidate  on;
        proxy_cache_valid      200  7d;
        expires max;
        add_header X-Proxy-Cache $upstream_cache_status;

        proxy_pass http://update.freebsd.org;
      }
Then change /etc/freebsd-update.conf and point ServerName to this server.
 
Back
Top