Changes

Jump to: navigation, search

LELK-AN-001: Package installation using opkg

9,688 bytes added, 11:09, 12 December 2017
Created page with "==Introduction== Thanks to the <b>opkg</b> packet manager installed on Yocto built root file system, Lizard module allows to install new packages (if available). This task ca..."
==Introduction==
Thanks to the <b>opkg</b> packet manager installed on Yocto built root file system, Lizard module allows to install new packages (if available).

This task can be performed using DAVE Yocto pre-built package server available at the <code>http://yocto.dave.eu</code> address.

== Installing packages on target ==

To use <code>opkg</code> at runtime first of all you need to enable the network interface with <code>DNS</code> configuration for accessing external http servers.

An example of network interface configuration for Internet access is described here below. Configuration can be done directly on serial console with the following commands:

<pre class="board-terminal">
root@sbc-lynx:~# ifconfig eth0 192.168.0.94
root@sbc-lynx:~# route add default gw 192.168.0.254
root@sbc-lynx:~# echo "nameserver 8.8.8.8" > /etc/resolv.conf
</pre>

where ''192.168.0.254'' is the <code>gateway</code> address and ''8.8.8.8'' is the <code>DNS server</code> (in this case Google's one).

Once the network interface is configured, the DAVE's Yocto Lizard package server can be accessed for package downloading:

root@lizard:~# wget http://yocto.dave.eu/suce/cortexa8hf-vfp-neon-2.6.37.2/<i>pack_name</i>


Where:
* <code>cortexa8hf-vfp-neon-2.6.37.2</code> is the package directory
* <code>http://yocto.dave.eu/suce</code> is the URL of the webserver

For example:

'''
<pre class="board-terminal">
root@lizard:~# wget http://yocto.dave.eu/suce/cortexa8hf-vfp-neon-2.6.37.2/openssh-sftp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh-sftp_6.1p1-r 100% |*******************************| 46000 0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/suce/cortexa8hf-vfp-neon-2.6.37.2/openssh-keygen_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Connecting to yocto.dave.eu (79.143.179.155:80)0_cortexa8hf-vfp-neon-2.6.37.2.ipk
openssh-keygen_6.1p1 100% |*******************************| 79936 0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/suce/cortexa8hf-vfp-neon-2.6.37.2/openssh-sshd_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh-sshd_6.1p1-r 100% |*******************************| 188k 0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/suce/cortexa8hf-vfp-neon-2.6.37.2/openssh-ssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh-ssh_6.1p1-r0 100% |*******************************| 161k 0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/suce/cortexa8hf-vfp-neon-2.6.37.2/openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh_6.1p1-r0-ara 100% |*******************************| 890 0:00:00 ETA
root@lizard:~#
</pre>


After the required packages have been download, you need to install them using opkg:

<pre class="board-terminal">
root@lizard:~# opkg
opkg must have one sub-command argument
usage: opkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
update Update list of available packages
upgrade Upgrade installed packages
install <pkgs> Install package(s)
configure <pkgs> Configure unpacked package(s)
remove <pkgs|regexp> Remove package(s)
flag <flag> <pkgs> Flag package(s)
<flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)

Informational Commands:
list List available packages
list-installed List installed packages
list-upgradable List installed and upgradable packages
list-changed-conffiles List user modified configuration files
files <pkg> List files belonging to <pkg>
search <file|regexp> List package providing <file>
info [pkg|regexp] Display all info for <pkg>
status [pkg|regexp] Display all status for <pkg>
download <pkg> Download <pkg> to current directory
compare-versions <v1> <op> <v2>
compare versions using <= < > >= = << >>
print-architecture List installable package architectures
depends [-A] [pkgname|pat]+
whatdepends [-A] [pkgname|pat]+
whatdependsrec [-A] [pkgname|pat]+
whatrecommends[-A] [pkgname|pat]+
whatsuggests[-A] [pkgname|pat]+
whatprovides [-A] [pkgname|pat]+
whatconflicts [-A] [pkgname|pat]+
whatreplaces [-A] [pkgname|pat]+

Options:
-A Query all packages not just those installed
-V[<level>] Set verbosity level to <level>.
--verbosity[=<level>] Verbosity levels:
0 errors only
1 normal messages (default)
2 informative messages
3 debug
4 debug level 2
-f <conf_file> Use <conf_file> as the opkg configuration file
--conf <conf_file>
--cache <directory> Use a package cache
-d <dest_name> Use <dest_name> as the the root directory for
--dest <dest_name> package installation, removal, upgrading.
<dest_name> should be a defined dest name from
the configuration file, (but can also be a
directory name in a pinch).
-o <dir> Use <dir> as the root directory for
--offline-root <dir> offline installation of packages.
--add-arch <arch>:<prio> Register architecture with given priority
--add-dest <name>:<path> Register destination with given path
--prefer-arch-to-version Use the architecture priority package rather
than the higher version one if more
than one candidate is found.

Force Options:
--force-depends Install/remove despite failed dependencies
--force-maintainer Overwrite preexisting config files
--force-reinstall Reinstall package(s)
--force-overwrite Overwrite files from other package(s)
--force-downgrade Allow opkg to downgrade packages
--force-space Disable free space checks
--force-postinstall Run postinstall scripts even in offline mode
--force-remove Remove package even if prerm script fails
--noaction No action -- test only
--download-only No action -- download only
--nodeps Do not follow dependencies
--force-removal-of-dependent-packages
Remove package and all dependencies
--autoremove Remove packages that were installed
automatically to satisfy dependencies
-t Specify tmp-dir.
--tmp-dir Specify tmp-dir.

regexp could be something like 'pkgname*' '*file*' or similar
e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'
root@lizard:~#
</pre>

For example, for the <code>openssh</code> pakcges reviously downloaded, you can install the packages on the target with the following command:

<pre>
root@lizard:~# opkg install openssh-keygen_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-keygen (6.1p1-r0-arago0) to root...go0_cortexa8hf-vfp-neon-2.6
Configuring openssh-keygen.
root@lizard:~# opkg install openssh-scp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-scp (6.1p1-r0-arago0) to root...
Configuring openssh-scp.
update-alternatives: Linking //usr/bin/scp to /usr/bin/scp.openssh
root@lizard:~# opkg install openssh-sftp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-sftp (6.1p1-r0-arago0) to root...
Configuring openssh-sftp.
root@lizard:~# opkg install openssh-ssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-ssh (6.1p1-r0-arago0) to root...
Configuring openssh-ssh.
update-alternatives: Linking //usr/bin/ssh to /usr/bin/ssh.openssh
root@lizard:~# opkg install openssh-sshd_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-sshd (6.1p1-r0-arago0) to root...
Running useradd commands...
Note: username sshd already exists, not re-creating it
Configuring openssh-sshd.
Adding system startup for /etc/init.d/sshd.
Starting OpenBSD Secure Shell server: sshd
done.
root@lizard:~# opkg install openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh (6.1p1-r0-arago0) to root...
Configuring openssh.
root@lizard:~#
</pre>

Once the system is restarted, the new openssh package will be activated using the installed scripts. Fro checking is the daemon is running, simply:

<pre class="board-terminal">
root@lizard:~# ps | grep ssh
660 root 3916 S /usr/sbin/sshd
747 root 3964 S {sshd} sshd: root@pts/0
754 root 1780 S grep ssh
root@lizard:~#
</pre>


The package dependencies will NOT be resolved automatically.

== Installed packages ==

To see which packages are installed, it is possibile to use the <code>list-installed</code> option:

<pre class="board-terminal">
root@lizard:~# opkg list-installed | grep openssh
openssh - 6.1p1-r0-arago0
openssh-keygen - 6.1p1-r0-arago0
openssh-scp - 6.1p1-r0-arago0
openssh-sftp - 6.1p1-r0-arago0
openssh-ssh - 6.1p1-r0-arago0
openssh-sshd - 6.1p1-r0-arago0
root@lizard:~#
</pre>

Navigation menu