Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2686,"date":"2019-12-08T10:53:49","date_gmt":"2019-12-08T10:53:49","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2686"},"modified":"2019-12-08T10:53:49","modified_gmt":"2019-12-08T10:53:49","slug":"build-your-own-pkg-repository-with-poudriere","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/build-your-own-pkg-repository-with-poudriere\/","title":{"rendered":"Build Your Own Pkg-Repository With Poudriere"},"content":{"rendered":"

Since version 9.2, FreeBSD has introduced a new tool to replace the old pkg_*-commands –\u00a0pkg<\/code>, also known as\u00a0pkgng<\/code>. It’s very similar to Debian’s\u00a0apt<\/code>\u00a0or Fedora’s\u00a0yum<\/code>\u00a0but has some very cool features. One of those is the possibility to easily use your own, private repository of packages.<\/p>\n

Why would you want to do that? The official pkg-repositories are built out of FreeBSD’s ports tree with a very limited set of options. For example, the official package for PHP lacks support for MySQL. Another reason might be that you want to have two repositories, one with X11 enabled – for your desktop – and one with X11 disabled – for your servers. There are a lot of options and possibilities, and this tutorial will show you how to build your own repository with\u00a0Poudriere<\/strong>, a tool for mass-building packages.<\/p>\n

I assume that you have a fresh VPS with FreeBSD 10 x64 installed. First of all, you need the ports-tree on your system:<\/p>\n

cd \/usr\r\nportsnap fetch extract\r\n<\/code><\/pre>\n

Then, you need to install Poudriere from source (The default options are fine!):<\/p>\n

cd \/usr\/ports\/ports-mgmt\/poudriere\r\nmake install clean\r\n<\/code><\/pre>\n

Next, create a basic configuration file:<\/p>\n

cp \/usr\/local\/etc\/poudriere.conf.sample \/usr\/local\/etc\/poudriere.conf\r\n<\/code><\/pre>\n

… and edit it according to your needs. The following is a good start:<\/p>\n

FREEBSD_HOST=http:\/\/ftp.freebsd.org\r\nRESOLV_CONF=\/etc\/resolv.conf\r\nBASEFS=\/usr\/local\/poudriere\r\nPOUDRIERE_DATA=$\/data\r\nUSE_PORTLINT=no\r\nUSE_TMPFS=yes\r\nDISTFILES_CACHE=\/usr\/ports\/distfiles\r\nCHECK_CHANGED_DEPS=yes\r\n# Edit this according to your VPS' CPU.\r\nPARALLEL_JOBS=1\r\nNOLINUX=yes\r\n<\/code><\/pre>\n

Instead of using the regular portstree of your system, Poudriere uses its own copy. You must obtain it with the following command:<\/p>\n

poudriere ports -c\r\n<\/code><\/pre>\n

Now, create a jail for the builder to run within:<\/p>\n

poudriere jail -c -j testjail -v 10.0-RELEASE -a amd64\r\n<\/code><\/pre>\n

Before you can start to build packages, you will actually have to tell Poudriere\u00a0what<\/strong>\u00a0it should build. Open up your favorite text editor and add some packages:<\/p>\n

www\/firefox\r\nim\/pidgin\r\nsysutils\/tmux\r\neditors\/vim\r\n<\/code><\/pre>\n

… and save the file under\u00a0\/usr\/local\/etc\/buildlist<\/code>. If you don’t want the default options, then you can configure the options for each package in that file. This is done by issuing the following command:<\/p>\n

poudriere options -cf \/usr\/local\/etc\/buildlist\r\n<\/code><\/pre>\n

Otherwise, you can start building:<\/p>\n

poudriere bulk -f \/usr\/local\/etc\/buildlist -j testjail\r\n<\/code><\/pre>\n

The amount of time this operation takes will vary based on the CPU speed of your VPS. After the process has finished, your fresh packages can be found, sorted by build-jail, in\u00a0\/usr\/local\/poudriere\/data\/packages\/<\/code>.<\/p>\n

Now, you need a webserver to actually serve those packages to your other machines. I chose Nginx since it’s efficient and lightweight. Install it via ports (The default options are fine!):<\/p>\n

cd \/usr\/ports\/www\/nginx\r\nmake install clean\r\n<\/code><\/pre>\n

After the installation process is done, you need to configure Nginx to serve the packages directory. To do that, edit\u00a0\/usr\/local\/etc\/nginx\/nginx.conf<\/code>\u00a0with your favorite text editor:<\/p>\n

server {\r\n    listen       80;\r\n    server_name  localhost;\r\n    root \/usr\/local\/poudriere\/data\/packages\/testjail-default;\r\n    location \/ {\r\n            autoindex on;\r\n    }\r\n}\r\n<\/code><\/pre>\n

Finally, make sure the webserver starts at boot:<\/p>\n

echo \"nginx_enable=YES\" >> \/etc\/rc.conf\r\n<\/code><\/pre>\n

… and start the server:<\/p>\n

\/usr\/local\/etc\/rc.d\/nginx start\r\n<\/code><\/pre>\n

The possibilities with Poudriere are huge. You can learn more about Poudriere by reading the manpage entry. If you plan on using a setup like this in a production environment, it would be in your best interest to also read about package signing, and to consider securing the connection to your webserver with TLS. But for now, you are ready to rock!<\/p>\n

To activate the repository on the client, run these commands on the client machine:<\/p>\n

mkdir -p \/usr\/local\/etc\/repos\r\nvi \/usr\/local\/etc\/repos\/myrepo.conf\r\n<\/code><\/pre>\n

Populate\u00a0myrepo.conf<\/code>\u00a0with the following content. You can use any name for this file, providing that it has the\u00a0.conf<\/code>\u00a0suffix.<\/p>\n

poudriere: {\r\n  url: \"http:\/\/yoururl\"\r\n  mirror_type: \"http\",\r\n  enabled: yes\r\n}\r\n<\/code><\/pre>\n

Next, update the package database with the command:<\/p>\n

pkg update\r\n<\/code><\/pre>\n

You can now install packages out of your new repository!<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[109,230],"manual_kb_tag":[398],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2686"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2686"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2686\/revisions"}],"predecessor-version":[{"id":2687,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2686\/revisions\/2687"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2686"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2686"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}