Archive

Posts Tagged ‘package’

Linux Server – Task 4: Creating MetaPackages

Course
Linux palvelimena [Linux server] by Tero Karvinen at Haaga-Helia University of Applied Sciences

Task
Create a metapackage, which installs some software of your choosing, and make sure it passes the lintian check. Create a package repository with reprepro. Package one of your scripts, so that the package installs a new script for the users.

Testing environment
OS: Xubuntu Linux 13.10 “Saucy Salamander” 32-bit (persistent live USB drive)
System: HP EliteBook 2570p Notebook PC

Creating the metapackage
I began by installing equivs via the terminal: $ sudo apt-get install equivs. I then proceeded to create a metapackage in a folder named packages, in my home directory, with $ equivs-control jannes-metatest.cfg. After this I edited the file with $ nano jannes-metatest.cfg to contain only the following:

Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: jannes-metatest
Version: 0.1
Maintainer: Example
Depends: geoip-bin, pidgin
Description: Test MetaPackage
by Janne Varis

This particular package would now install GeoIP and Pidgin, once complete. To complete it, I executed $ equivs-build jannes-metatest.cfg in the terminal. Success. The resulting file: jannes-metatest_0.1_all.deb, located in the previously mentioned packages folder.

Passing lintian and testing
I tested the metapackage in lintian next with $ lintian jannes-metatest_0.1_all.deb. Success. I received no errors. Next I needed to install gdebi with $ sudo apt-get install gdebi-core -y to test my metapackage in use, which I did with $ sudo gdebi -n jannes-metatest_0.1_all.deb. The metapackage worked flawlessly, and GeoIP and Pidgin were installed.

Creating the package repository with reprepro
To begin, I created a folder structure in the public_html folder in my home directory by entering $ mkdir -p repository/conf in the terminal, after having navigated to the public_html folder. I also created a file within the same folder structure with $ nano repository/conf/distributions, in which I entered details about my Xubuntu version, some of them could be printed out by entering $ lsb_release -a in the terminal. My file looked like this:

Codename: saucy
Components: main
Suite: saucy
Architectures: i386 amd64 source

Next I installed reprepro with $ sudo apt-get install reprepro -y. Then I added the latest .deb package that I had made with $ reprepro -VVVV -b public_html/repository includedeb saucy packages/jannes-metatest_0.1_all.deb.

To install the repository to clients, I needed to edit repository.list by entering $ dsudoedit /etc/apt/sources.list.d/repository.list in the terminal. I added the following line and saved the changes:

deb http://127.0.0.1/~xubuntu/repository saucy main

Finally I ran $ sudo apt-get update to update the package list, and then sucessfully installed my own package with $ sudo apt-get install jannes-metatest -y.

Packaging a script
First I created a shell script as I had done previously (located in the packages folder this time). After this was done, I edited jannes-metatest.cfg to include the script (Files line) and the desired installation location, and upped the version number to 0.2:

Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: jannes-metatest
Version: 0.2
Maintainer: Example <example@example.com>
Depends: geoip-bin, pidgin
Files: mystatus /usr/local/bin/
Description: Test MetaPackage
by Janne Varis

Then I repeated the remaining steps, as described earlier in this post, to be able to install the package again and run the the script by entering $ mystatus in the terminal (with any user). Task complete.

References
Karvinen, Tero: Forensic File Recovery with Linux (http://terokarvinen.com/2013/forensic-file-recovery-with-linux)
Karvinen, Tero: Lessons 2014-2-10, Linux palvelimena [Linux server] (http://terokarvinen.com/2013/aikataulu-%E2%80%93-linux-palvelimena-ict4tn003-11-ja-12-kevaalla-2014)

About
This document can be copied and edited according to the GNU General Public License (version 3 or newer). http://www.gnu.org/licenses/gpl.html
Based on a course by Tero Karvinen, http://www.iki.fi/karvinen