Since version 9.2, FreeBSD has introduced a new tool to replace the old pkg_*-commands –\u00a0 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 Then, you need to install Poudriere from source (The default options are fine!):<\/p>\n Next, create a basic configuration file:<\/p>\n … and edit it according to your needs. The following is a good start:<\/p>\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 Now, create a jail for the builder to run within:<\/p>\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 … and save the file under\u00a0 Otherwise, you can start building:<\/p>\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 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 After the installation process is done, you need to configure Nginx to serve the packages directory. To do that, edit\u00a0 Finally, make sure the webserver starts at boot:<\/p>\n … and start the server:<\/p>\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 Populate\u00a0 Next, update the package database with the command:<\/p>\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}]}}pkg<\/code>, also known as\u00a0
pkgng<\/code>. It’s very similar to Debian’s\u00a0
apt<\/code>\u00a0or Fedora’s\u00a0
yum<\/code>\u00a0but has some very cool features. One of those is the possibility to easily use your own, private repository of packages.<\/p>\n
cd \/usr\r\nportsnap fetch extract\r\n<\/code><\/pre>\n
cd \/usr\/ports\/ports-mgmt\/poudriere\r\nmake install clean\r\n<\/code><\/pre>\n
cp \/usr\/local\/etc\/poudriere.conf.sample \/usr\/local\/etc\/poudriere.conf\r\n<\/code><\/pre>\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
poudriere ports -c\r\n<\/code><\/pre>\n
poudriere jail -c -j testjail -v 10.0-RELEASE -a amd64\r\n<\/code><\/pre>\n
www\/firefox\r\nim\/pidgin\r\nsysutils\/tmux\r\neditors\/vim\r\n<\/code><\/pre>\n
\/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
poudriere bulk -f \/usr\/local\/etc\/buildlist -j testjail\r\n<\/code><\/pre>\n
\/usr\/local\/poudriere\/data\/packages\/<\/code>.<\/p>\n
cd \/usr\/ports\/www\/nginx\r\nmake install clean\r\n<\/code><\/pre>\n
\/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
echo \"nginx_enable=YES\" >> \/etc\/rc.conf\r\n<\/code><\/pre>\n
\/usr\/local\/etc\/rc.d\/nginx start\r\n<\/code><\/pre>\n
mkdir -p \/usr\/local\/etc\/repos\r\nvi \/usr\/local\/etc\/repos\/myrepo.conf\r\n<\/code><\/pre>\n
myrepo.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
pkg update\r\n<\/code><\/pre>\n