4,085 bytes added,
10:53, 14 October 2016 {{InfoBoxTop}}
{{AppliesToAxel}}
{{AppliesToAxelEsatta}}
{{AppliesToAxelLite}}
{{InfoBoxBottom}}
==History==
{| class="wikitable" border="1"
!Version
!Date
!XELK version
!Notes
|-
|1.0.0
|October 2016
|[[Axel_Embedded_Linux_Kit_(XELK)#XELK_software_components|2.2.0]]
|First release
|-
|}
== Introduction ==
This application note details:
* how to use a package manager with Yocto
* how to deploy your own package manager server
== Yocto Package Manager ==
The default XELK packaging system is RPM <ref name="RPM-Wikipedia">https://en.wikipedia.org/wiki/RPM_Package_Manager</ref>, which can be uses with SMART <ref name="smart-project">https://labix.org/smart</ref><ref name="smart-yocto">https://www.yoctoproject.org/blogs/khem/2013/get-smart-smart-package-manager</ref><ref name="man-smart">https://linux.die.net/man/8/smart</ref> to install a package, with all its dependencies, from a remote repository.
To use smart, you need to be sure that the image is build with runtime package management support:
<pre>
IMAGE_FEATURES += "package-management"
</pre>
This is already enabled in default XELK images.
== Building packages and feeds ==
After bootstrapping the [[Yocto BSP (XELK)|XELK Yocto environment]] and build the packages you want to publish, you can create the package feeds with:
<pre>
bitbake package-index
</pre>
The files to deploy on server are inside <code>$BUILD_DIR/tmp/deploy/rpm</code>
User can also build ''all'' the recipe inside the configured layer with:
<pre>
bitbake -k world
</pre>
Please note that, due the fact that some packages may fail to build, the ''-k'' switch is needed to tell bitbake continue even in case of failure.
== Configuring the webserver ==
Here we give an example in how to configure the Apache webserver on a Ubuntu 14.04 LTS distribution to serve Yocto packages. We assume that you already configure the Ubuntu networking properly and that you already install Apache with its dependencies
* Create a new virtualhost by entering the following text inside, for example, <code>/etc/apache2/sites-available/myyocto</code>
<pre>
<VirtualHost *:80>
ServerName myyocto.example.com
ServerAdmin admin@example.com
DocumentRoot /var/www/yocto
<Directory /var/www/yocto>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Options +Indexes
</Directory>
ErrorLog ${APACHE_LOG_DIR}/yocto-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/yocto-access.log combined
</VirtualHost>
</pre>
* enable the virtualhost
<pre>
sudo a2ensite yocto
</pre>
* apply the changes to Apache
<pre>
sudo service apache2 restart
</pre>
* copy the feeds and packages into the webserver directory, e.g. via ftp or scp
<pre>
scp -r $BUILD_DIR/tmp/deploy/rpm user@myyocto.example.com:/var/www/yocto
</pre>
== Installing packages on target ==
To use <code>smart</code> at runtime first of all you need to enable a channel, which commonly is a remote webserver that provide packages feed and the binary packages itself, like the one we configured in the previous section.
On the target just run the following command:
<pre>
smart channel --add xelk-2.2.0-cortexa9hf type=rpm-md baseurl=http://myyocto.example.com/xelk-2.2.0/cortexa9hf_vfp_neon
</pre>
Where:
* <code>xelk-2.2.0-cortexa9hf</code> is the name of the channel
* <code>http://myyocto.example.com/xelk-2.2.0/cortexa9hf_vfp_neon</code> is the URL of the webserver
You can also add a ''local'' directory, for example mounted via NFS directly on target, with the following command:
<pre>
smart channel --add local type=rpm-dir name=localrpms manual=true priority=1 path=/opt/rpms -y
</pre>
After you configure the channel and/or update packages feed on server, you need to update smart database:
<pre>
smart update
</pre>
Finally you can install the packages (and all its dependencies) on the target with the following command:
<pre>
smart install PACKAGE_NAME
</pre>
E.g.
<pre>
smart install emacs
</pre>
== References ==
{{reflist}}