Difference between revisions of "Packaging madagascar"

From Madagascar
Jump to navigation Jump to search
m (added Fedora Remix logo)
(→‎RPM: Fedora 15 version)
 
(13 intermediate revisions by 2 users not shown)
Line 12: Line 12:
 
</bash>
 
</bash>
  
Log in as <tt>makerpm</tt>. Type: <tt>rpmdev-setuptree</tt> to create the <tt>~/rpmbuild</tt> directory. Place the [http://rsf.svn.sourceforge.net/viewvc/rsf/trunk/admin/m8r-fedora12-x86_64.spec?view=markup spec file] in ~/rpmbuild/SPECS , then cd to that directory and run:
+
Log in as <tt>makerpm</tt>. Type: <tt>rpmdev-setuptree</tt> to create the <tt>~/rpmbuild</tt> directory. Place the [http://rsf.svn.sourceforge.net/viewvc/rsf/trunk/admin/m8r-fedora15.spec?view=markup spec file] in <tt>~/rpmbuild/SPECS</tt> , then cd to that directory and run:
  
 
<bash>
 
<bash>
rpmbuild -ba m8r-fedora12-x86_64.spec
+
rpmbuild -ba m8r-fedora15.spec
 
</bash>
 
</bash>
 +
 +
Then, harvest the RPM from <tt>~/rpmbuild/RPMS/$arch</tt> and the SRPM from <tt>~/rpmbuild/SRPMS/</tt> .
  
 
If you want a log of the entire process, use something like:
 
If you want a log of the entire process, use something like:
  
 
<bash>
 
<bash>
rpmbuild -ba madagascar.spec |& tee ~/log_rpm.asc
+
rpmbuild -ba m8r-fedora15.spec |& tee ~/log_rpm.asc
 
</bash>
 
</bash>
  
Line 39: Line 41:
 
</bash>
 
</bash>
  
Then run it with <tt>mock -r fedora-12-x86_64 rebuild path_to_source_RPM </tt>.
+
Then run it with <tt>mock -r fedora-15-x86_64 rebuild path_to_source_RPM </tt>.
 +
 
 +
The contents of the RPM package can be examined with
 +
 
 +
<bash>
 +
rpm2cpio file.rpm | cpio -ivd
 +
</bash>
  
 
[https://fedoraproject.org/wiki/How_to_create_an_RPM_package Fedora's guide to creating RPM packages] constitutes excellent further reading on the topic of making RPMs.
 
[https://fedoraproject.org/wiki/How_to_create_an_RPM_package Fedora's guide to creating RPM packages] constitutes excellent further reading on the topic of making RPMs.
 +
 
==Creating yum repositories for RPMs==
 
==Creating yum repositories for RPMs==
 
As root:
 
As root:
Line 47: Line 56:
 
yum -y install createrepo
 
yum -y install createrepo
 
</bash>
 
</bash>
Make the repo directory, i.e.  
+
Make the repo directory as a regular user, i.e.  
 
<bash>
 
<bash>
mkdir -p /var/$USER/repo/Fedora/12/{SRPMS,x86_64}
+
mkdir -p /var/$USER/repo/fedora/12/{SRPMS,x86_64}
 
</bash>
 
</bash>
 
You may have RPMs for more architectures, for other versions, for other distros... make directories as needed.
 
You may have RPMs for more architectures, for other versions, for other distros... make directories as needed.
Line 66: Line 75:
 
</bash>
 
</bash>
 
[[Image:Fedora_Remix.png|right]]
 
[[Image:Fedora_Remix.png|right]]
==Creating a Fedora Live CD/DVD==
+
 
 +
==Creating a Fedora Live CD==
 
A Live medium is a CD, DVD or USB drive that contains an entire bootable operating system, often customized to contain certain packages. This allows users to try software without actually installing it on their machines, and demos and classes to be given using the students' own laptops, but not installing anything on them.
 
A Live medium is a CD, DVD or USB drive that contains an entire bootable operating system, often customized to contain certain packages. This allows users to try software without actually installing it on their machines, and demos and classes to be given using the students' own laptops, but not installing anything on them.
  
To create a Live DVD with a minimal version of the Fedora 13 64-bit XFCE desktop and with madagascar and its dependencies, just burn to a DVD [http://reproducibility.org/live/m8rFedoraLive.iso this image].  
+
To create a Live CD with a minimal version of the Fedora 13 64-bit XFCE desktop and with madagascar and its dependencies, just burn to a DVD [http://reproducibility.org/live/m8rFedoraLive.iso this image].  
  
 
This image was created by installing Fedora 13 x86_64 on a machine. The host machine does not have to run the same desktop environment, or have package selection as the Live CD. Then, the commands below were run as root:  
 
This image was created by installing Fedora 13 x86_64 on a machine. The host machine does not have to run the same desktop environment, or have package selection as the Live CD. Then, the commands below were run as root:  
Line 82: Line 92:
 
livecd-creator -f m8rFedoraLive -c fedora-live-m8r.ks  
 
livecd-creator -f m8rFedoraLive -c fedora-live-m8r.ks  
 
</bash>
 
</bash>
The kickstart file (<tt>fedora-live-m8r.ks</tt>) can be found [http://rsf.svn.sourceforge.net/viewvc/rsf/trunk/admin/fedora-live-m8r.ks?view=markup under version control in the SVN repository]. This will create a 767Mib image that has a web browser and code editor installed, as well as the madagascar RPM and its dependencies, but not much else in terms of graphical user applications. Through additional tweaking of the install file, it should be possible to eventually bring the size of the image down to where it can be writtten on a CD instead of a DVD.
+
The kickstart file (<tt>fedora-live-m8r.ks</tt>) can be found [http://rsf.svn.sourceforge.net/viewvc/rsf/trunk/admin/fedora-live-m8r.ks?view=markup under version control in the SVN repository]. This will create a 659Mib image that has a web browser and code editor installed, as well as the madagascar RPM and its dependencies, but not much else in terms of graphical user applications. Through additional tweaking of the install file, it should be possible to eventually bring the size of the image down to where it can be writtten on a CD instead of a DVD.
 +
===Optimal Setup and Usage===
 +
The experience with the LiveCD distributed at the [[Houston_2010|2010 Madagascar School and Workshop]] shows that:
 +
* A CD is better than a DVD, because: (1) some machines have CD drives, but not DVD drives; (2) It reads faster than a DVD usually.
 +
* Users need to be told in advance that a Live CD will be used, so that they bring a laptop that has a CD drive. Some very lightweight notebooks only have an external drive.
 +
* Users should be advised to arrive half an hour before the start of the program to test whether the Live CD works on their machine, and install if necessary. Refreshments (i.e. breakfast) should be provided during this time. Users should be specifically instructed to test the Live CD during this period.
 +
* The first presentation should be a very basic introduction, but requiring a hands-on exercise, so that installation can continue during this time on laptops on which Live CD does not work.
 +
* The Live CD needs to be labeled as such, and have booting instructions on the cover (insert and reboot; if you have a Mac, keep the "c" key pressed while rebooting). Explain briefly what a Live CD is (that the user will be able to run Linux with Madagascar installed, without having to install anything on the hard disk)
 +
* Mac users may need a PC USB mouse instead of their Mac mouse if they want to be able to drag items on the screen with the mouse.
 +
* It was a great idea to accompany the CD with a USB stick containing copies of presentations and pre-made directories for the live examples, including data, so the hands-on exercises could be run on the USB stick. In the future, a tarball with madagascar source code should be added to the memory stick so it can be used to install the package on machines on which the Live CD does not work. Also, if there is enough space on the USB stick, a static copy of the wiki should be provided, so that help is available even without an internet connection.
 +
* The madagascar release used in any such school should be ready and tested for at least a week or two before the event.

Latest revision as of 19:17, 15 July 2011

Fotolia 4803048 XS.jpg

There are many benefits to managing your software through the standard packaging system for your platform. This page is written for the benefit of:

  • future madagascar developers who want to prepare packages for distribution
  • system administrators who need to do their own packaging, such as for the purpose of easy, customized software management over a large number of machines

RPM

To make the RPMs, it is a good idea to first create a user just for this, i.e. makerpm. Then, install dependencies and set up. As root:

<bash> yum -y groupinstall "Development Tools" yum -y install rpmdevtools rpmlint </bash>

Log in as makerpm. Type: rpmdev-setuptree to create the ~/rpmbuild directory. Place the spec file in ~/rpmbuild/SPECS , then cd to that directory and run:

<bash> rpmbuild -ba m8r-fedora15.spec </bash>

Then, harvest the RPM from ~/rpmbuild/RPMS/$arch and the SRPM from ~/rpmbuild/SRPMS/ .

If you want a log of the entire process, use something like:

<bash> rpmbuild -ba m8r-fedora15.spec |& tee ~/log_rpm.asc </bash>

If you want to make other RPM files, you may find useful to run

<bash> rpmlint yourfile.spec </bash>

Some warnings are OK. If you want to debug your experiments, you can comment the contents of the prep, build or clean sections in the spec file. For prep and build, you must have executed it uncommented at least once.

You may be able to QC the build with mock. For this, run as root:

<bash> yum -y install mock useradd -G mock makerpm </bash>

Then run it with mock -r fedora-15-x86_64 rebuild path_to_source_RPM .

The contents of the RPM package can be examined with

<bash> rpm2cpio file.rpm | cpio -ivd </bash>

Fedora's guide to creating RPM packages constitutes excellent further reading on the topic of making RPMs.

Creating yum repositories for RPMs

As root: <bash> yum -y install createrepo </bash> Make the repo directory as a regular user, i.e. <bash> mkdir -p /var/$USER/repo/fedora/12/{SRPMS,x86_64} </bash> You may have RPMs for more architectures, for other versions, for other distros... make directories as needed.

Copy your RPMs in the appropriate directories, then in each directory (in this case, SRPMS and x86_64), run <bash> createrepo . </bash> Tarball the whole repo directory and upload it to your web host, then unpack it there in the desired location.

Create a madagascar.repo file with contents like this one, then instruct the users to copy the file to /etc/yum.repos.d if they want to enable this repository, i.e.: <bash> su cd /etc/yum.repos.d wget http://reproducibility.org/yum/madagascar.repo </bash>

Fedora Remix.png

Creating a Fedora Live CD

A Live medium is a CD, DVD or USB drive that contains an entire bootable operating system, often customized to contain certain packages. This allows users to try software without actually installing it on their machines, and demos and classes to be given using the students' own laptops, but not installing anything on them.

To create a Live CD with a minimal version of the Fedora 13 64-bit XFCE desktop and with madagascar and its dependencies, just burn to a DVD this image.

This image was created by installing Fedora 13 x86_64 on a machine. The host machine does not have to run the same desktop environment, or have package selection as the Live CD. Then, the commands below were run as root: <bash>

  1. Install dependencies:

yum -y install livecd-tools system-config-kickstart spin-kickstarts

  1. Set SELinux to permissive mode:

setenforce 0

  1. Make the Live DVD:

livecd-creator -f m8rFedoraLive -c fedora-live-m8r.ks </bash> The kickstart file (fedora-live-m8r.ks) can be found under version control in the SVN repository. This will create a 659Mib image that has a web browser and code editor installed, as well as the madagascar RPM and its dependencies, but not much else in terms of graphical user applications. Through additional tweaking of the install file, it should be possible to eventually bring the size of the image down to where it can be writtten on a CD instead of a DVD.

Optimal Setup and Usage

The experience with the LiveCD distributed at the 2010 Madagascar School and Workshop shows that:

  • A CD is better than a DVD, because: (1) some machines have CD drives, but not DVD drives; (2) It reads faster than a DVD usually.
  • Users need to be told in advance that a Live CD will be used, so that they bring a laptop that has a CD drive. Some very lightweight notebooks only have an external drive.
  • Users should be advised to arrive half an hour before the start of the program to test whether the Live CD works on their machine, and install if necessary. Refreshments (i.e. breakfast) should be provided during this time. Users should be specifically instructed to test the Live CD during this period.
  • The first presentation should be a very basic introduction, but requiring a hands-on exercise, so that installation can continue during this time on laptops on which Live CD does not work.
  • The Live CD needs to be labeled as such, and have booting instructions on the cover (insert and reboot; if you have a Mac, keep the "c" key pressed while rebooting). Explain briefly what a Live CD is (that the user will be able to run Linux with Madagascar installed, without having to install anything on the hard disk)
  • Mac users may need a PC USB mouse instead of their Mac mouse if they want to be able to drag items on the screen with the mouse.
  • It was a great idea to accompany the CD with a USB stick containing copies of presentations and pre-made directories for the live examples, including data, so the hands-on exercises could be run on the USB stick. In the future, a tarball with madagascar source code should be added to the memory stick so it can be used to install the package on machines on which the Live CD does not work. Also, if there is enough space on the USB stick, a static copy of the wiki should be provided, so that help is available even without an internet connection.
  • The madagascar release used in any such school should be ready and tested for at least a week or two before the event.