From Fedora Project Wiki

m (move note to top)
(remove since 23 is long eol)
(47 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{admon/note | Note | for older method using livecd-tools ('''livecd-creator''') visit https://fedoraproject.org/wiki/How_to_create_and_use_a_Live_CD}}
{{admon/note | Note | If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the [http://docs.fedoraproject.org/install-guide/ install guide] or [http://docs.fedoraproject.org/readme-burning-isos/ burning how-to] for further instructions.}}


{{admon/note | Note | If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the [http://docs.fedoraproject.org/install-guide/ install guide] or [http://docs.fedoraproject.org/readme-burning-isos/ burning how-to] for further instructions.}}


=='''livemedia-creator'''==
=='''livemedia-creator'''==


*Older posts
===Install files===
:https://www.brianlane.com/creating-live-isos-with-livemedia-creator.html
*'''ksflatten is part of pykickstart'''
:https://jbwillia.wordpress.com/2014/10/29/how-to-build-updated-fedora-live-iso-for-yourself/


*Examples in f24 root terminal:
# dnf install mock
===Install files===
# usermod -a -G mock <user>
*'''livemedia-creator and ksflatten are part of lorax'''
 
=== Documentation ===
*Important
: https://rhinstaller.github.io/lorax/livemedia-creator.html


# dnf install lorax virt-install libvirt-daemon-config-network
=== mock ===
You should always do all work in mock, this will allow you to ensure that the compose environment matches the target environment.
Last metadata expiration check: 2:48:39 ago on Sun Jun 19 14:06:08 2016.
Package lorax-23.21-1.fc23.x86_64 is already installed, skipping.
Package libvirt-daemon-config-network-1.2.18.3-1.fc23.x86_64 is already installed, skipping.
--snip--
Downloading Packages:
virt-install-1.3.2-2.fc23.noarch.rpm                                                                                                              219 kB/s |  92 kB    00:00   
--snip--
Installed:
  virt-install.noarch 1.3.2-2.fc23                                                                                                                                               


*Must be done first:
To setup a Fedora 27 x86_64 environment you would run the following
:'''You must be in the same fedora version (f24) first.'''
setenforce 0
=== ksflatten ===
::updated 06/28/2016


  ksflatten
  $ mock -r fedora-27-x86_64 --init
  bash: ksflatten: command not found...
  $ mock -r fedora-27-x86_64 --install lorax-lmc-novirt git vim-minimal pykickstart
Install package 'pykickstart' to provide command 'ksflatten'? [N/y] y


*Link:
If you wanted a different arch or release you would use the correct mock configuration file.
:https://pagure.io/fedora-kickstarts/tree/f24


::alternately: git clone the repo and not get each piece manually
By default there is no network access in mock. Set ''config_opts['rpmbuild_networking']'' to ''True'' if you are using systemd-nspawn.


:Kickstarts need to flattened before use:
$ sudo vi /etc/mock/site-defaults.cfg
:: hit raw tab and '''save-page-as''' to a local directory (/home/(user)/Downloads/pagure/)


:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-live-soas.ks
=== Kickstart files ===
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-live-base.ks
Inside the mock chroot or container, clone the kickstarts git repository. If your system is using SELinux it needs to be set to Permissive mode while running lorax.
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-live-minimization.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-repo.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-repo-not-rawhide.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-repo-rawhide.ks
:https://pagure.io/fedora-kickstarts/blob/f24/f/fedora-soas-packages.ks


*switch root terminal to the local directory with the kickstart files (/home/(user)/Downloads/pagure/)
$ sudo setenforce 0
$ mock -r fedora-27-x86_64 --shell --old-chroot
<mock-chroot> sh-4.3# git clone https://pagure.io/fedora-kickstarts.git


  ksflatten -v, --config fedora-live-soas.ks -o flat-fedora-live-soas.ks --version F24
=== ksflatten ===
change directory into fedora-kickstarts and flatten a kickstart
  <mock-chroot> sh-4.3# cd fedora-kickstarts
<mock-chroot> sh-4.3# ksflatten --config fedora-live-soas.ks -o flat-fedora-live-soas.ks --version F26


  livemedia-creator --ks /home/(user)/Downloads/pagure/flat-fedora-live-soas.ks --logfile /tmp/lmc-logs/livemedia-out.log --no-virt --resultdir /tmp/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-flat-live --iso-only --iso-name Fedora-SoaS-flat-live.iso --releasever 24 --title Fedora-SoaS-flat-live --macboot
===livemedia-creator example===
  <mock-chroot> sh-4.3# livemedia-creator --ks flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-26 --iso-only --iso-name Fedora-SoaS-27-x86_64.iso --releasever 27 --title Fedora-SoaS-live --macboot


=== Make a remix ===
=== Make a remix ===
*edit the bottom of the flat-fedora-live-soas.ks
*edit the bottom of the flat-fedora-live-soas.ks
:that you produce with ksflatten  (above)
:that you produced with ksflatten  (above)
:in this section of the flattened.ks:
:in this section of the flattened.ks:
%packages
%packages
Line 66: Line 53:
:put '''#''' in front of listed program to not install it
:put '''#''' in front of listed program to not install it


====kickstart-docs====
* https://github.com/rhinstaller/pykickstart/blob/master/docs/kickstart-docs.rst


====livemedia-creator terminal output====
:Build takes a long time wait for completion
:Build takes a long time wait for completion
:ends with:
:
[root@localhost pagure]# livemedia-creator --ks /home/(user)/Downloads/pagure/flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-f24 --iso-only --iso-name Fedora-SoaS-f24.iso --releasever 24 --title Fedora-SoaS-live --macboot
/usr/lib64/python3.5/optparse.py:999: PendingDeprecationWarning: The KSOption class is deprecated and will be removed in pykickstart-3.  Use the argparse module instead.
  option = self.option_class(*args, **kwargs)
2016-07-08 11:27:53,350: disk_size = 5122MiB
2016-07-08 11:27:53,351: disk_img = /var/lmc/lmc-disk-7mztqnci.img
2016-07-08 11:27:58,818: Running anaconda.
2016-07-08 11:28:01,751: Processing logs from ('127.0.0.1', 48934)
2016-07-08 11:28:04,776: Starting installer, one moment...
2016-07-08 11:28:04,776: terminal size detection failed, using default width
2016-07-08 11:28:04,776: anaconda 24.13.7-1 for Fedora-soas-Live 24 (pre-release) started.
2016-07-08 11:28:04,776: The 'logging' function is not a part of DNF API and will be removed in the upcoming DNF release. Please use only officially supported API functions. DNF API documentation is available at https://dnf.readthedocs.org/en/latest/api.html.
2016-07-08 11:29:01,131: Starting automated install........................................................
2016-07-08 11:29:01,146: ================================================================================
  ..........clip........
  ..........clip........
  ..........clip........
  ..........clip........
  2016-05-17 16:16:16,110: Disk Image install successful
  2016-07-08 11:50:37,613: Disk Image install successful
  2016-05-17 16:16:16,110: working dir is /var/tmp/lmc-work-rilyz2bm
  2016-07-08 11:50:37,613: working dir is /var/tmp/lmc-work-ey7rlb4p
  2016-05-17 16:27:38,448: Rebuilding initrds
  2016-07-08 12:02:35,166: Rebuilding initrds
  2016-05-17 16:27:38,448: dracut args = ['--xz', '--add', 'livenet dmsquash-live convertfs pollcdrom qemu qemu-net', '--omit', 'plymouth', '--no-hostonly', '--debug', '--no-early-microcode']
  2016-07-08 12:02:35,166: dracut args = ['--xz', '--add', 'livenet dmsquash-live convertfs pollcdrom qemu qemu-net', '--omit', 'plymouth', '--no-hostonly', '--debug', '--no-early-microcode']
  2016-05-17 16:27:38,449: rebuilding boot/initramfs-4.5.3-300.fc24.x86_64.img
  2016-07-08 12:02:35,167: rebuilding boot/initramfs-4.6.3-300.fc24.x86_64.img
  2016-05-17 16:29:15,724: Building boot.iso
  2016-07-08 12:03:57,231: Building boot.iso
  2016-05-17 16:29:15,784: running x86.tmpl
  2016-07-08 12:03:57,328: running x86.tmpl
  2016-05-17 16:29:48,959: Disk image erased
  2016-07-08 12:04:37,262: Disk image erased
  2016-05-17 16:29:49,377: SUMMARY
  2016-07-08 12:04:37,945: SUMMARY
  2016-05-17 16:29:49,377: -------
  2016-07-08 12:04:37,945: -------
  2016-05-17 16:29:49,377: Logs are in /tmp/lmc-logs
  2016-07-08 12:04:37,946: Logs are in /home/(user)/Downloads/pagure
  2016-05-17 16:29:49,377: Results are in /tmp/lmc
  2016-07-08 12:04:37,946: Results are in /var/lmc


===Retrieve finished live.iso===
===Retrieve finished live.iso===
"Results are in /tmp/lmc"
"Results are in /var/lib/mock/<mock config>/root/var/lmc"
*start files application
*start files application
*click on '''Files system'''
*click on '''Files system'''
:open  temp folder
:open  /var folder
:open lmc folder
:open lmc folder
*click on  the '''.....iso''' you just built
*click on  the '''.....iso''' you just built
'''copy to''' (mouse right click) '''Home''' with files application
'''copy to''' (mouse right click) '''Home''' with files application
*Check that it is in Home
*Check that it is in Home
===Clean Up===
===Clean Up===
:delete the instance in /tmp
* delete the instance in /var
:delete the /tmp directory  (cannot run new build unless this is done?)
:delete the /var/lmc directory  (cannot run new build unless this is done?)
* Set SELinux back to Enforcing


  [root@localhost lmc]#  
  [root@localhost pagure]# cd /var
  [root@localhost lmc]# cd ..
  [root@localhost var]# ls
  [root@localhost tmp]# rm -r lmc
account  adm  cache  crash  db  empty  ftp  games  gopher  kerberos  lib  lmc  local  lock  log  mail  nis  opt  preserve  run  spool  tmp  www  yp
  [root@localhost var]# rm -r lmc
  rm: descend into directory 'lmc'? y
  rm: descend into directory 'lmc'? y
  rm: remove regular file 'lmc/Fedora-LUCwks-20160524.iso'? y
  rm: remove regular file 'lmc/Fedora-SoaS-f24.iso'? y
  rm: remove directory 'lmc'? y
  rm: remove directory 'lmc'? y
  [root@localhost tmp]#
  [root@localhost var]# setenforce 1

Revision as of 15:35, 2 March 2018

Note.png
Note
If you simply want to burn a pre-made ISO to a disc, visit http://fedoraproject.org/en/get-fedora to download a LiveCD or LiveDVD, then see the install guide or burning how-to for further instructions.


livemedia-creator

Install files

  • ksflatten is part of pykickstart
# dnf install mock
# usermod -a -G mock <user>

Documentation

  • Important
https://rhinstaller.github.io/lorax/livemedia-creator.html

mock

You should always do all work in mock, this will allow you to ensure that the compose environment matches the target environment.

To setup a Fedora 27 x86_64 environment you would run the following

$ mock -r fedora-27-x86_64 --init
$ mock -r fedora-27-x86_64 --install lorax-lmc-novirt git vim-minimal pykickstart

If you wanted a different arch or release you would use the correct mock configuration file.

By default there is no network access in mock. Set config_opts['rpmbuild_networking'] to True if you are using systemd-nspawn.

$ sudo vi /etc/mock/site-defaults.cfg

Kickstart files

Inside the mock chroot or container, clone the kickstarts git repository. If your system is using SELinux it needs to be set to Permissive mode while running lorax.

$ sudo setenforce 0
$ mock -r fedora-27-x86_64 --shell --old-chroot
<mock-chroot> sh-4.3# git clone https://pagure.io/fedora-kickstarts.git

ksflatten

change directory into fedora-kickstarts and flatten a kickstart

<mock-chroot> sh-4.3# cd fedora-kickstarts
<mock-chroot> sh-4.3# ksflatten --config fedora-live-soas.ks -o flat-fedora-live-soas.ks --version F26

livemedia-creator example

<mock-chroot> sh-4.3# livemedia-creator --ks flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-26 --iso-only --iso-name Fedora-SoaS-27-x86_64.iso --releasever 27 --title Fedora-SoaS-live --macboot

Make a remix

  • edit the bottom of the flat-fedora-live-soas.ks
that you produced with ksflatten (above)
in this section of the flattened.ks:

%packages

add a program (add name)
- delete a program ( put - in front)
put # in front of listed program to not install it

kickstart-docs

livemedia-creator terminal output

Build takes a long time wait for completion
[root@localhost pagure]# livemedia-creator --ks /home/(user)/Downloads/pagure/flat-fedora-live-soas.ks --no-virt --resultdir /var/lmc --project Fedora-soas-Live --make-iso --volid Fedora-SoaS-f24 --iso-only --iso-name Fedora-SoaS-f24.iso --releasever 24 --title Fedora-SoaS-live --macboot
/usr/lib64/python3.5/optparse.py:999: PendingDeprecationWarning: The KSOption class is deprecated and will be removed in pykickstart-3.  Use the argparse module instead.
  option = self.option_class(*args, **kwargs)
2016-07-08 11:27:53,350: disk_size = 5122MiB
2016-07-08 11:27:53,351: disk_img = /var/lmc/lmc-disk-7mztqnci.img
2016-07-08 11:27:58,818: Running anaconda.
2016-07-08 11:28:01,751: Processing logs from ('127.0.0.1', 48934)
2016-07-08 11:28:04,776: Starting installer, one moment...
2016-07-08 11:28:04,776: terminal size detection failed, using default width
2016-07-08 11:28:04,776: anaconda 24.13.7-1 for Fedora-soas-Live 24 (pre-release) started.
2016-07-08 11:28:04,776: The 'logging' function is not a part of DNF API and will be removed in the upcoming DNF release. Please use only officially supported API functions. DNF API documentation is available at https://dnf.readthedocs.org/en/latest/api.html.
2016-07-08 11:29:01,131: Starting automated install........................................................
2016-07-08 11:29:01,146: ================================================================================
..........clip........
..........clip........
2016-07-08 11:50:37,613: Disk Image install successful
2016-07-08 11:50:37,613: working dir is /var/tmp/lmc-work-ey7rlb4p
2016-07-08 12:02:35,166: Rebuilding initrds
2016-07-08 12:02:35,166: dracut args = ['--xz', '--add', 'livenet dmsquash-live convertfs pollcdrom qemu qemu-net', '--omit', 'plymouth', '--no-hostonly', '--debug', '--no-early-microcode']
2016-07-08 12:02:35,167: rebuilding boot/initramfs-4.6.3-300.fc24.x86_64.img
2016-07-08 12:03:57,231: Building boot.iso
2016-07-08 12:03:57,328: running x86.tmpl
2016-07-08 12:04:37,262: Disk image erased
2016-07-08 12:04:37,945: SUMMARY
2016-07-08 12:04:37,945: -------
2016-07-08 12:04:37,946: Logs are in /home/(user)/Downloads/pagure
2016-07-08 12:04:37,946: Results are in /var/lmc

Retrieve finished live.iso

"Results are in /var/lib/mock/<mock config>/root/var/lmc"

  • start files application
  • click on Files system
open /var folder
open lmc folder
  • click on the .....iso you just built

copy to (mouse right click) Home with files application

  • Check that it is in Home

Clean Up

  • delete the instance in /var
delete the /var/lmc directory (cannot run new build unless this is done?)
  • Set SELinux back to Enforcing
[root@localhost pagure]# cd /var
[root@localhost var]# ls
account  adm  cache  crash  db  empty  ftp  games  gopher  kerberos  lib  lmc  local  lock  log  mail  nis  opt  preserve  run  spool  tmp  www  yp
[root@localhost var]# rm -r lmc
rm: descend into directory 'lmc'? y
rm: remove regular file 'lmc/Fedora-SoaS-f24.iso'? y
rm: remove directory 'lmc'? y
[root@localhost var]# setenforce 1