Package Managers

Preview:

DESCRIPTION

Package Managers. What are they and why we use them. Thoughts of an admin. Installing software is painful Installing a lot of software is extremely painful Installing a lot of software on a lot of machines is HELL. 舉例 - LOL. 天賦、符文 道具. Before Packages. Install from source - PowerPoint PPT Presentation

Citation preview

Package ManagersWhat are they and why we use them

Thoughts of an adminInstalling software is painfulInstalling a lot of software is

extremely painfulInstalling a lot of software on a

lot of machines is HELL

舉例 - LOL天賦、符文道具

Before PackagesInstall from sourceTime consumingVarying configuration

Improvement 1Copy the binariesSetup scripts?Version?Dependencies?

Package - BasicArchiveBinariesSupporting filesSetup script

Package – ImprovementVersioning

◦1.0.x◦1.1.x◦…

Upgrades!

Package - DependenciesProgram A requires library B to

workIf library C is available, program

A will work better/faster!

Example – Call of DutyRequires: DirectXWorks better with: PhysX

Package ManagersLow Level

Unpacking packagesRun configuration scriptsDependency checks…

Package ManagersHigh Level Usage

Fetch from remote repositoriesSearchInstall additional packages to

meet dependenciesHandle complex upgrades

Package RepositoryCollection of packagesMaintained by distributionMultiple package versionsPackage index

Package ManagersRPM Based DEB Based

Low level RPM DpkgHigh level YUM, up2date, … APT

DEBIAN DPKG & APTFocus on

Types of PackagesBinary PackageMeta PackageVirtual Package

Binary PackageNormal packageSource is availableArchitecture

◦Dependent Compiled binary files

◦Independent Scripts Documents Data files

Meta PackageDepends on other packages onlyRename

◦git-core -> gitDefault version

◦gcc -> gcc-4.6◦Python -> python2.7

Can be creative!

Virtual PackageDoes not really existNames common functionalityOther binary packages “provide”

a virtual packagec-compiler is provided by

◦gcc◦gcc-4.6◦clang

Commonly Used Commandsapt-getapt-cacheaptitude

◦Frontend to the first 2 commands

Search for a packageapt-cache search ^vim$

Search pattern

State flags

Search PatternsPatterns are regular expressionsAptitude supports complex

patterns◦See reference

Search requires guessing◦Just like Googling◦Keywords

DifferencesAptitude and apt-cache have

slighty different search behavior◦Aptitude looks at package name only◦Apt-cache looks at description as

well

State Flagsi Installedc Removedp Purgedv Virtual packageB Broken dependenciesu UnpackedC Half-configuredH Half-installed

Try it!You want to install a web server.

What do you look for?What should you actually install?

Looking at a packageWeb interface

◦http://packages.debian.orgCLI

◦apt-cache show XXX◦aptitude show XXX

Debian Control FileTry it now!

Package InfoNameStateVersionPrioritySectionMaintainerArchitectureDependenciesDescription

Package Info - Stateinstallednot installedremoved…

Package Info - VersionVim: 2:7.3.547-6

2: -> Epoch7.3.547 -> Upstream version-6 -> Debian package revision

Package Info - PriorityRequiredImportantStandardOptionalExtra

Package Info - DependenciesDependsRecommendsSuggestsConflictsReplacesBreaksProvidesSyntax:

http://www.debian.org/doc/debian-policy/ch-relationships.html

Installing / Removingapt-get install XXXaptitude install XXX

remove/purgehold/unholdupgradedist-upgrade

remove vs. purgeRemove keeps config files in

systemPurge = Remove + delete config

files

hold/unholdKeep a package at a specific

state/version unless explicitly request otherwise

upgrade vs. dist-upgradeupgrade only updates currently

installed packagesdist-upgrade will do anything to

satisfy all new dependencies

Try it!Install a web serverThen remove itSee that config files are still thereThen purge it

MAKING A PACKAGE

Why?CustomizeSoftware not packaged yet

◦Become a maintainer?Build your own

Making your first packageBasic structure

◦package/XXX Files you want to package

◦package/DEBIAN/control Debian control file

◦package/DEBIAN/xxx Package scripts, other control files

dpkg-deb –b package

Homework – Build a meta package

Name: nasa-hwShould always install

◦gcc >= 1:4.7◦make > 3.80

Should not install when◦clang is installed

Maintainer: Your ID <your email>Use your judgment for other fields

◦Read the documents!Submit control file

Too simple?Debian related source code

◦source/debian/rules◦source/debian/control◦source/debian/changelog◦source/debian/…

Guidelines for packagingDebian 新維護人員手冊

◦http://www.debian.org/doc/manuals/maint-guide/

Get other package sources and see how other people do it◦apt-get source XXX

Packages for packagingbuild-essentialdpkg-devdebhelperCDBSdh_makelintian

build-essentialMeta package that depends on

essential tools for packagingYou need to install additional

tools/libraries◦debhelper, cdbs, …◦lib*-dev

dpkg-devBasic tools for package

developmentdpkg-buildpackage

DebhelperCollection of commands to assist

packagingWraps complex steps

◦Splitting files between different packages

◦Generating shared library dependencies

◦Generate and sign binary packages◦…

CDBSCommon Debian Build SystemClass based systemSupports different build systems

◦make, ant, cmake, …http://www.slideshare.net/peterei

sentraut/the-common-debian-build-system-cdbs

dh_makePrepare source code for

packagingAlways uses debhelperSupports CDBS

lintianCheck packages for errors

Steps to packaging1. Get source code2. Unpack3. dh_make4. Install build dependencies5. Check control file6. Check installation paths7. Build package

◦ dpkg-buildpackage –b8. Check package contents, debug if

nessecary◦ dpkg-deb –c xxx.deb

Packaging Tutorialhttp://www.debian.org/doc/manu

als/maint-guide/first.en.html

Try if you wantLast semester’s homework

◦Very hardBuild a package of “Omnitty”

◦http://omnitty.sourceforge.net/You will also need to build a

package for “ROTE”◦http://omnitty.sourceforge.net/

Build it, install it, and try it out

TipsPackages you can look at

◦libevent◦screen◦tmux◦make

HOMEWORK RECAP

nasa-hw meta packageUpload control file to CEIBAStart sooner! You need to do

research to finish this assignment.