Table of Contents
- 1. Add cdrom to repository list with apt-cdrom
- 2. Few packages in ubuntu-16.04-desktop-amd64.iso
- 3. Create DVD which has custom deb packages
1 Add cdrom to repository list with apt-cdrom
Mount cdrom to /media/cdrom.
$ sudo mount -t iso9660 /dev/cdrom /media/cdrommount: /dev/sr0 is write-protected, mounting read-only
Add cdrom to repository list with apt-cdrom.
$ sudo apt-cdrom -m -d /media/cdrom addUsing CD-ROM mount point /media/cdrom/Identifying… [1a235e539972579c22a0bec9a077f7c3-2]Scanning disc for index files…Found 4 package indexes, 0 source indexes, 0 translation indexes and 1 signaturesThis disc is called:’Ubuntu 16.04 LTS _Xenial Xerus_ – Release amd64 (20160420.1)’Copying package lists…gpgv: Signature made Thu 21 Apr 2016 07:29:18 AM JST using DSA key ID FBB75451gpgv: Good signature from “Ubuntu CD Image Automatic Signing Key <[email protected]>”Reading Package Indexes… DoneWriting new source listSource list entries for this disc are:deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ – Release amd64 (20160420.1)]/ xenial main restrictedRepeat this process for the rest of the CDs in your set.
The apt-cdrom changes /etc/apt/sources.list. For removing cdrom from repository list, remove “deb cdrom:” statement in /etc/apt/sources.list.
$ diff -uprN /etc/apt/sources.list{.org,}— /etc/apt/sources.list.org 2016-08-12 10:50:26.281895047 +0900+++ /etc/apt/sources.list 2016-08-12 10:50:42.603934453 +0900@@ -2,6 +2,7 @@ # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution.+deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ – Release amd64 (20160420.1)]/ xenial main restricted deb http://jp.archive.ubuntu.com/ubuntu/ xenial main restricted deb-src http://jp.archive.ubuntu.com/ubuntu/ xenial main restricted@@ -51,3 +52,4 @@ deb http://security.ubuntu.com/ubuntu xe deb-src http://security.ubuntu.com/ubuntu xenial-security universe deb http://security.ubuntu.com/ubuntu xenial-security multiverse deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse+
2 Few packages in ubuntu-16.04-desktop-amd64.iso
ubuntu-16.04-desktop-amd64.iso has only 24 packages. ubuntu-16.04-desktop-amd64.iso is LiveDVD. For installing, copy root filesystem of LiveDVD to storage and install 24 packages to storage.
$ grep ^Package: /var/lib/apt/lists/Ubuntu*Packages | awk ‘{ print $2 }’b43-fwcutterdkmslibc6-i386grub-efigrub-efi-amd64grub-efi-amd64-bingrub-efi-amd64-signedgrublupin-supportmouseemusetserialshimshim-signedoem-configoem-config-gtkoem-config-slideshow-ubuntuuser-setupwvdiallibuniconf4.6libwvstreams4.6-baselibwvstreams4.6-extrasbcmwl-kernel-sourceintel-microcodeiucode-tool
ubuntu-16.04-server-amd64.iso has 1244 packages. But it has no desktop environment packages.
$ grep ^Package: /var/lib/apt/lists/Ubuntu*Packages | awk ‘{ print $2}’accountsservicelibaccountsservice0acctacllibacl1acpidadduseraideaide-commonpython3-alabasterlibasound2libasound2-dataalsa-utilsamavisd-newanacronlibjs-angularjsapache2apache2-binapache2-dataapache2-doc<snip>
3 Create DVD which has custom deb packages
This article will create DVD which has desktop environment packages. And this will add DVD to repository list.
3.1 Download deb packages
Download deb packages of ubuntu-desktop and dependencies with this script.
$ sudo apt install -y apt-rdepends$ mkdir deb$ cd deb$ ../download-deb-package.sh ubuntu-desktop$ cd ..
3.2 Create GPG key
When creating GPG key, the following message will be output and console will be hung.
Not enough random bytes available. Please do some other work to give
For avoid this hung, update /dev/urandom with rng-tools.
$ sudo apt install -y rng-tools$ sudo rngd -r /dev/urandom
Create gpg config file.
$ cat <<EOF > gpg.txtKey-Type: RSASubkey-Type: RSAName-Real: hiroom2Expire-Date: 0%pubring public.key%secring signing.key%commitEOF
Create GPG key with gpg batch mode, and import GPG key.
$ gpg –batch –gen-key gpg.txt$ gpg –import public.key signing.key
3.3 Create repository
Install reprepro which creates repository with apt.
$ sudo apt install -y reprepro
Get subkey value for GPG key of repository.
$ dir=`pwd`$ subkey=`gpg –list-keys –keyring ${dir}/public.key –no-default-keyring | grep sub | awk ‘{ print $2 }’ | awk -F’/’ ‘{ print $2 }’`
Create iso directory and store reprepro config file to there.
$ mkdir iso$ cd iso$ mkdir conf$ cat <<EOF > conf/distributionsCodename: xenialArchitectures: amd64Components: mainSignWith: ${subkey}EOF
Create repository with reprepro.
$ reprepro includedeb xenial ~/deb/*.deb
Copy GPG public key to iso directory.
$ cp ../public.key .
3.4 Create DVD
Create iso image with genisoimage. Please burn iso image to DVD media.
$ genisoimage -J -R -V “Ubuntu 16.04 repo” -o ubuntu-16.04-repo.iso iso
3.5 Add cdrom to repository list
Insert DVD media and mount cdrom to /media/cdrom.
$ sudo mount /dev/cdrom /media/cdrom
Add GPG key with apt-key.
$ sudo apt-key add /media/cdrom/public.key
Add cdrom to repository list with apt-cdrom. Because the database has no entry of this DVD, input repository name “Ubuntu 16.04 repo”.
$ echo “Ubuntu 16.04 repo” | sudo apt-cdrom -m -d /media/cdrom addUsing CD-ROM mount point /media/cdrom/Identifying… [24043ba8f9dff07baf00246e9de86642-2]Scanning disc for index files…Found 1 package indexes, 0 source indexes, 0 translation indexes and 0 signaturesPlease provide a name for this Disc, such as ‘Debian 5.0.3 Disk 1’:Name: ‘Ubuntu 16.04 repo’This disc is called:’Ubuntu 16.04 repo’Reading Package Indexes… DoneWriting new source listSource list entries for this disc are:deb cdrom:[Ubuntu 16.04 repo]/ xenial mainRepeat this process for the rest of the CDs in your set.
Now you can install deb packages from DVD.
$ sudo apt update -y$ sudo apt install -y ubuntu-desktop