RPM Packaging for Sysadmins

Slides:



Advertisements
Similar presentations
Downloading & Installing Software Chapter 13. Maintaining the System Yum Pirut BitTiorrent Rpm Keeping Software Up To Date Up2date Red Hat Network Wget.
Advertisements

Module 10 – Linux Installations. Wikipedia: Red Hat Package Manager or RPM Package Manager (RPM) is a package management system. The name RPM variously.
Linux Operations and Administration
V Avon High School Tech Crew Agenda Old Business –Delete Files New Business –Week 9 Topics: Coming up: –Yearbook Picture: Feb 7 12:20PM.
Dustin Harman VM Workshop 2015 RPM Basics. What is RPM? Red Hat Package Manager Native package manager on RHEL, Fedora, SUSE, some Mandriva RPM/SRPM files.
Package Management How to use rpms. Topics The Problem of Software Installation Package Management Systems Using RPM Finding RPMs Building RPMs.
October, Scientific Linux INFN/Trieste B.Gobbo – Compass R.Gomezel - T.Macorini - L.Strizzolo INFN - Trieste.
 To explain the importance of software configuration management (CM)  To describe key CM activities namely CM planning, change management, version management.
A Practical Guide to Fedora and Red Hat Enterprise Linux Unit 8: Installing Software in Linux Chapter 13: Downloading and Installing Software By Fred R.
Wordpress with Mina Automated Deployment Solution Jonathan Gravato DIG 4104c.
GLite build and integration system Building and Packaging Robert HARAKALY
EMI is partially funded by the European Commission under Grant Agreement RI SA2 – Development Tools Andres Abad Rodriguez SA2.4 Tools Activity Leader.
Separate distribution of the analysis code (and more) P. Hristov 19/03/2014.
Installing Applications in FreeBSD lctseng. Computer Center, CS, NCTU 2 Before we start  Permission issue root: the super user Like administrator in.
SCD Monthly Projects Meeting 2014 Scientific Linux Update Rennie Scott January 14, 2014.
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses. ©Copyright Network Development Group Module 01 Introduction.
Introduction to System Administration. System Administration  System Administration  Duties of System Administrator  Types of Administrators/Users.
EGEE-III INFSO-RI Enabling Grids for E-sciencE EGEE and gLite are registered trademarks Towards an Information System Product Team.
Operated by Los Alamos National Security, LLC for NNSA U N C L A S S I F I E D Slide 1 Institutional Install of Red Hat Enterprise Linux From One CD In.
Tito Miroslav Suchý Red Hat
Luke Macken [ bodhi ]. ● History of Fedora updates ● bodhi ● goals ● features ● architecture ● using ● testing/qa ● hacking ● future ideas [ overview.
Linux Kernel Security (SELinux vs AppArmor vs Grsecurity)
Getting Started in RPM Packaging Izhar Firdaus / KageSenshi Contributor Fedora Project
The firmware-tools project Matt Domsch Michael Brown.
Into Fedora RPM packages Lubomir Rintel Presented by Fedora Package Maintainer Creative Commons Attribution-ShareAlike license applies. Packaging Gems.
Perl in RPM-Land Dave Cross Magnum Solutions Ltd YAPC::Europe 15 th August 2008.
1 April 2, Software Packaging and Releasing Best Practices William Cohen NCSU CSC 591W April 2, 2008.
Workshop: Advanced Packaging
Automating Xen Virtual Machine Deployment Kris Buytaert
An Introduction to. Where did Fedora come from? Boxed set every 6 months == Failed business model [
Karsten Wade Sr. Developer Community Mgr, Red Hat.
RPM101: A gentle intro to creating your own packages Richard Keech Red Hat Asia-Pacific.
WebYaST Remote Web Based System Management
Building Good RPM Packages
New Tools Used by the Scientific Linux Team
Cross-Distribution Packaging Made Easy OSDC 2011, Canberra
Chuan-kai Lin Drake Diedrich Google Inc.
Open-O Integration Project Introduction
Abstract After a SIG has been approved, one of the next steps is to get products out to users. During this talk, Niels will explain how the Storage SIG.
WordPress Introduction
Configuration Management
Installation of MySQL Objectives Contents Practical Summary
CIT 470: Advanced Network and System Administration
Build process of ovirt-node and the plugins
How to make good RPM Packages
How to open source your Puppet configuration
COP 4343 Unix System Administration
Where we are, where we’re goin’
Provisioning with custom builds and Kickstart
The Use of AMET and Automated Scripts for Model Evaluation
Packaging Example All Hands Meeting, Padova,
COMP Introduction to Operating Systems Project 1 – Installing CentOS
Overview – SOE PatchTT December 2013.
Workshop: Building Good Fedora Packages
Spacewalk and Koji at Fermilab
Ruby, Rails, GUIs, and More
June 2011 David Front Weizmann Institute
More Scripting & Chapter 11
Team Foundation Server – Build-Deploy-Test Workflow
DHCP, DNS, Client Connection, Assignment 1 1.3
University of Texas Rio Grande Valley Systems Administration CSCI 6175
Tanner Lovelace Triangle Linux Users Group 11/Jan/2003
IS3440 Linux Security Unit 8 Software Management
Overview Unit testing Building Version control.
Your code is not just…your code
Perl in RPM-Land Dave Cross Magnum Solutions Ltd YAPC::Europe
Section 1: Linux Basics and SLES9 Installation
PyWBEM Python WBEM Client: Overview #2
Your code is not just…your code
Module 02 Operating Systems
Presentation transcript:

RPM Packaging for Sysadmins David Nalley @ke4qqq on twitter/identi.ca david@cloudstack.org david.nalley@fedoraproject.org New presentation available at: http://ke4qqq.fedorapeople.org/p4sa.pdf The non-code portions of this presentation are licensed under a Creative Commons, Attribution, Share Alike 3.0, unported license. Why are you here?? I have given this presentation to people inherently interested in distributions, but not to sysadmins What breakup of distributions/OS Solaris?? Deb? RPM??

# whoami Recovering sysadmin F/LOSS community guy Packager for Fedora Work for an ISV who packages software

Schedule Spend first hour or so getting through slides This is designed to be interactive – please don't bore others by making them listen only to me – ask questions!, interact! Break – OM NOMs Spend 15 or so minutes getting access to VMs in 'the cloud' Spend the rest of the class doing some hands on work with packages.

OS-specific or distro-specific installable container for software define: package OS-specific or distro-specific installable container for software

Why should sysadmins care? SO WHAT?

Why should sysadmins care? Automation – packaging makes decisions ahead of time

Why should sysadmins care? Automation – packaging makes decisions ahead of time Anyone still doing: tar -zxvf foo.tar.gz cd foo ./configure make make install

Why should sysadmins care Repeatability Using packages means that you will get the same behavior and files in the same location on subsequent installs

Why should sysadmins care? Documentation: Packages are documentation – provided you keep the original work. Building a package is far better than maintaining installation instructions.

Why should sysadmins care? Easier customization Need to deploy a package with different compiler options? Need to patch the source for some cool new option?

Why should sysadmins care? Security: No compilers on hosts Running your own package repository means you can ensure that every host with a given package will get updates.

Why should sysadmins care Single source of truth for software (think Ruby gems, Python PyPi, Perl CPAN, PHP Pear)

Sysadmins should package F/LOSS for: fame peer review experience Packaging for F/LOSS Sysadmins should package F/LOSS for: fame peer review experience

Packaging is really a snapshot of being a sysadmin Automating Configuration Documenting Doing things right the first time

Examples Learning by reading a book/website takes days or weeks Hopefully learning by seeing examples from someone else will be faster Longum iter est per preaecepta, breve et efficax per exempla!

Red Hat Package Manager Used by RHEL, SLES, Fedora, and a few others RPM Red Hat Package Manager Used by RHEL, SLES, Fedora, and a few others

Resources Maximum RPM: http://www.rpm.org/max-rpm/ Build Service at openSuSE: http://en.opensuse.org/Build_Service IBM DeveloperWorks – good generic docs http://docs.fedoraproject.org/drafts/rpm-guide-en/ http://www.vim.org/scripts/script.php?script_id=98

Setting up your environment Fedora: yum install fedora-packager SLES/openSuSE: yast -i osc RHEL: yum install rpmbuild (or rpm-build) Even within RPM changes there are some rather large differences. For instance, openSuSE handles changelog differently, and places it in a separate file. Fedora now uses sha-256, while RHEL uses MD5.

Setting up your environment /usr/lib/rpm/macros rpmdev-tree mkdir -p ~/rpmbuild/SRPMS ~rpmbuild/RPMS \ ~/rpmbuild/SPECS ~rpmbuild/SOURCE \ ~/rpmbuild/BUILD ~/rpmbuild/BUILDROOT

spec files – heart of rpm building spec files are the instruction manual for the build process.

rpmbuild rpmlint mock koji Novell's Open Build Service Tools rpmbuild rpmlint mock koji Novell's Open Build Service mock – creates chroot, installs requirements and builds koji – uses mock to build, but does it for mulitple environments (EL4, EL5, F11, F12, etc). Fedora makes a build server available – must have a fedora account. OBS – provides multiple distro and arch build service – last I checked multiarch support limited.

More tools (imperfect) cpan2rpm rust.sourceforge.net pear make-rpm-spec Foo.tgz gem2rpm python setup.py bdist_rpm –spec-only

Contents of a spec file headers – information about the package scripts – the real work files – identifying ownership and permissions changelog – who changed what when Novell has started moving changelogs out of spec files.

spec file framework Name: Version: Release: 1%{?dist} Summary: Group: License: URL: Source0: BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}- XXXXXX) BuildRequires: Requires: %description

spec file framework %prep %setup -q %build %configure make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT %clean %files %defattr(-,root,root,-) %doc %changelog

Building the spec file %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: zapplet Version: 0.1 Release: 4%{dist} Summary: Zenoss Tray Applet Group: Applications/Communications License: GPLv2+ URL: http://zapplet.sourceforge.net Source0: http://downloads.sourceforge.net/zapplet/zapplet- %{version}.tar.gz Source1: http://ke4qqq.fedorapeople.org/zapplet/README.fedora BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root- %(%{__id_u} -n) BuildRequires: python python-setuptools-devel desktop-file-utils Requires: pygtk2 BuildArch: noarch %description Zapplet is a tray applet for monitoring aspects of Zenoss from the desktop.

Building the spec file %prep %setup -q -n zapplet-%{version} cp %{SOURCE1} ./README.fedora %build CFLAGS="%{optflags}" %{__python} setup.py build %install rm -rf %{buildroot} %{__python} setup.py install -O1 --skip-build --root %{buildroot} desktop-file-install --add-category="Network" -- dir=%{buildroot}%{_datadir}/applications zapplet.desktop rm -rf %{buildroot}%{_sysconfdir}/xdg/autostart/zapplet.desktop

Building the spec file %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{python_sitelib}/* %{_bindir}/%{name} %{_datadir}/applications/zapplet.desktop %doc README.fedora %changelog * Mon Jan 19 2009 David Nalley <david@gnsa.us> 0.1-4 - Made changes suggested by ianweller to fix cvs issues * Sun Dec 28 2008 David Nalley <david@gnsa.us> 0.1-3 - Made changes suggested by Brian Pepple * Sat Dec 27 2008 David Nalley <david@gnsa.us> 0.1-2 - Making corrections suggested by Fabian Affolter * Sun Dec 14 2008 David Nalley <david@gnsa.us> 0.1-1 - Initial packaging efforts

rpmbuild -ba /path/to/zapplet.spec Building rpmbuild -ba /path/to/zapplet.spec

rpmlint and other checks rpmlint /path/to/zapplet.spec rpmlint /path/to/zapplet-0.1-4.src.rpm rpmlint /path/to/zapplet-0.1-4.noarch.rpm And you are going to install and test it first, right?

Example 1 - php-gettext Simple No real compilation Places files in correct place Heavily commented http://ke4qqq.fedorapeople.org/php-gettext.spec

Example 2 - sheepdog Requires compilation Relatively heavy dependencies http://ke4qqq.fedorapeople.org/sheepdog.spec

Example 3 - rubygem-logging Simple – created by external tool Requires registration with additional 'package' manager Similiar things needed for CPAN, Pear, etc. http://ke4qqq.fedorapeople.org/rubygem-logging.spec

Questions and contacts reminders Email: david.nalley@fedoraproject.org david@cloudstack.org IRC: ke4qqq on irc.freenode.net Twitter/identi.ca: @ke4qqq Blog: http://ke4qqq.wordpress.com