Remastering the Ubuntu Desktop ISO is easy considering the existing graphical tools but did you ever wanted to build your custom Ubuntu Server Edition ISO ?

Preparing the Environment

You’ll need a clean copy of the Ubuntu Server ISO that you want to customize. Since 10.04 is the latest Ubuntu version I will write down my examples using it but everything should work pretty much unchanged for older or newer versions.

After you have you have the original iso image downloaded, make a copy it’s contents so we can later apply our patching there.

cd /home/rgavril/Work

mkdir original-iso custom-iso
mount -o loop ./ubuntu-10.04-server-i386.iso ./original-iso cp -r ./original-iso/* ./custom-iso/
cp -r ./original-iso/.disk/ ./custom-iso/ umount ./original-iso/

Adding a Boot Menu Option

For start let’s add a option to the cd boot menu. You’ll need to modify isolinux/text.cfg and insert the next lines between default install and label install:

label custom
menu label ^Install Custom Ubuntu Server
kernel /install/vmlinuz
append file=/cdrom/preseed/ubuntu-custom.seed initrd=/install/initrd.gz quiet ks=cdrom:/isolinux/ks-custom.cfg --

This newly added block is very similar to the label install one. The two important additions being the file and ks boot options that I will later explain.

If you want to make your menu option the default one, you only need to change the default install to default custom or whatever you used as a label.

Kickstart-ing

KickStart is a unattended installation method developed by Red Hat and later adopted and adapted by Debian and Ubuntu. To keep it short, the Ubuntu installer can read an external file and figure out how to configure the system (create partitions, set timezones and keyboard layouts ..) without asking the user.

There’s no need to write everything using a text editor as we have a powerful tool to create such configuration files:

apt-get install system-config-kickstart ksconfig

After creating your ks.cfg file, you will need to move it on the custom-iso/ at the path specified in text.cfg. That’s the location where the ubuntu installer will look for it.

cp ks.cfg custom-iso/isolinux/ks-custom.cfg

Preseeding Packages

The installer in not the only one that may present questions to the user. When installed, some package rely on the user to explicitly set different parameters.

Preseeding is the action of setting, in advance, this kind of package parameters. It’s a very powerful method that you can use even for replacing kickstart. In this article, I’ll use it as a addition to kickstart as is more harder to tune the ubuntu installer, mostly because it lacks a gui.

The params can be set trough a configuration file specified by the file in text.cfg. I recommend starting with the existing preseed file from the original cd:

cp custom-iso/preseed/ubuntu-server.seed custom-iso/preseed/ubuntu-custom.seed

Using debconf-get-selections from the debconf-utils package you can look over a running ubuntu system to figure out what parameters you can tune. For example here are the possible configuration settings for the openssh-server together with their values :

root@xps1330:~/work# debconf-get-selections | grep openssh
openssh-server ssh/vulnerable_host_keys note
openssh-server ssh/use_old_init_script boolean true
openssh-server ssh/encrypted_host_key_but_no_keygen note
openssh-server ssh/disable_cr_auth boolean false

Adding Extra Packages

Ubuntu’s ksconfig utility does’n provide a way to select extra packages as the Package Selection is not working. In order to specify what extra packages you want to install you’ll need to modify the kickstart configuration file by hand.

vim custom-iso/isolinux/ks-custom.cfg

Depending on the extra packages that you want to install by default, add some similar lines to the end of the file :

%packages
openssh-server
asterisk
asterisk-mysql

Offline Installation

When having additional packages installed by default, there’s a big chance are that those particular packages may not be on the default iso. If you have an active internet connection during the install, the packages will be automatically fetched from the online repositories. But if you’re internet connection is not working, the install process will fail. In order to prevent the problem and create a offline installable cd, you’ll need to perform some extra steps.

You’ll need to downloading and copying the extra debs and all their dependencies on your iso. Please note that in doing so you may increase the iso size a lot and be forced to use a dvd.

It’s very hard to figure out what debs are missing from your iso. In order to make a list of needed debs I use the following steps:

On a virtual machine, install a ubuntu server using the original cd image.

Boot the newly installed ubuntu server, make sure the cd is mountable and cdrom directive is available in sources.list

Do an apt-get install of the extra packages that I want to have installed by default

Make a backup of the debs located in /var/cache/apt/archives as this are the missing ones that need to be on the iso

Considering that you downloaded the extra packages, and that they are located in the extradebs/ directory within the current folder. You will need to copy them on the cd and create a repository by running this commands:

mkdir -p custom-iso/dists/stable/extras/binary-i386
mkdir -p custom-iso/pool/extras/ cp ./extradebs/*.deb custom-iso/pool/extras/ pushd custom-iso
apt-ftparchive packages ./pool/extras/ > dists/stable/extras/binary-i386/Packages
gzip -c ./dists/stable/extras/binary-i386/Packages | tee ./dists/stable/extras/binary-i386/Packages.gz > /dev/null
popd

Generating the new ISO

All you need to do now is build you new iso and give it a test drive to see how it works:

mkisofs -J -l -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -z -iso-level 4 -c isolinux/isolinux.cat -o ./ubuntu-10.04-custom-i386.iso custom-iso/

custom-ubuntu-server-iso的更多相关文章

  1. 如何在Ubuntu Server 18.04 LTS中配置静态IP地址

    安装Ubuntu Server 18.04后需要分配一个的静态IP地址.先前的LTS版本Ubuntu 16.04使用/etc/network/interfaces文件配置静态IP地址,但是Ubuntu ...

  2. virtualbox搭建ubuntu server nginx+mysql+tomcat web服务器1 (未完待续)

    virtualbox搭建ubuntu server nginx+mysql+tomcat web服务器1 (未完待续) 第一次接触到 linux,不知道linux的确很强大,然后用virtualbox ...

  3. ubuntu server 12.04U盘安装,提示无法挂载安装光盘或光盘读取数据出错

    今天用Ultraiso将Ubuntu server 12.04 刻入U盘中安装系统,中间提示错误:1.检测不到cdrom(即U盘没有挂载上):2.从光盘中读取数据出错.问题如下图所示: 上网搜了下解决 ...

  4. U盘安装ubuntu server 14.04

    U盘安装ubuntu server 14.04 U盘安装ubuntu server 14.04 1.制作启动u盘 2.开始安装 1 将u盘插入主机,重启后从u盘启动 2 选择语言(随便挑,随便选),我 ...

  5. U盘安装ubuntu server 12.04的问题检测不到CDROM的解决

    U盘安装ubuntu server 12.04的问题检测不到CDROM的解决 ========================== 我是u盘安装ubuntu 14 64Bit 也是出现同样的问题 用u ...

  6. 在虚拟机中安装Ubuntu Server 15.04

    学Linux,上红联! 红联Linux门户|Linux通用技术|Linux发行版技术|Linux企业应用|Linux实验室|红联Linux论坛 Linux系统教程 Linux入门 Linux管理 Li ...

  7. u盘安装ubuntu server 14.04 以及No CD-ROM drive was detected 错误

    u盘安装ubuntu server 14.04 1:下载ubuntu server14的 iso镜像文件 2:下载 UltraISO U盘镜像制作工具 : 3:使用Ultra iOS 将下载好的 is ...

  8. Ubuntu server 16.04安装,无网卡驱动解决

    因为使用一个软件必须要在ubuntu server 16.04上安装,因此先在裸机上安装ubuntu server 16.04,具体信息: 镜像版本:ubuntu-16.04.6-server-amd ...

  9. VirtualBox下安装Ubuntu Server 16.04

    安装环境: Windows:确保磁盘空间足够,一般需要8个G左右. 所需文件: 首先在Ubuntu的官网上下载.iso的镜像文件,链接是:http://www.ubuntu.org.cn/server ...

  10. ubuntu server 14.04 LTS下搭建LAMP环境之最详细笔记之一U盘安装双系统

    前言: 一直在WIN上使用PHP,不喜欢用WAMP,每次都是手动在windows配置环境,偶尔有一次装了小红帽玩了两天,感觉不是很习惯就换了回来,过了没几天见讨论LAMP环境,于是安装了ubuntu的 ...

随机推荐

  1. spring boot:spring security实现oauth2+jwt管理认证授权及oauth2返回结果格式化(spring boot 2.3.3)

    一,为什么oauth2要整合jwt? 1,OAuth2的token技术有一个最大的问题是不携带用户信息,所以资源服务器不能进行本地验证, 以致每次对于资源的访问,资源服务器都需要向认证服务器的toke ...

  2. spring boot:用spring security加强druid的安全(druid 1.1.22 / spring boot 2.3.3)

    一,druid的安全保障有哪些环节要注意? 1,druid ui的访问要有ip地址限制 2,用户必须要有相应的权限才能访问druid 3,关闭重置功能 说明:stat-view-servlet.url ...

  3. Codeforces Round #676 (Div. 2) A - D个人题解(E题待补)

    1421A. XORwice 题目链接:Click Here // Author : RioTian // Time : 20/10/18 #include <bits/stdc++.h> ...

  4. C# 面试前的准备_基础知识点的回顾_03

    1.HTTP中Post和Get区别 这忒简单了吧,大家是不是感觉到兴奋了,长舒一口气了,终于出现了一个可以聊上10分钟的问题了. 根据HTTP规范,Get用于信息获取,而且应该是安全的和幂等的. 参数 ...

  5. CentOS8安装本地mail工具-mailx-12.5-29.el8.x86_64

    概述 服务器需要发告警邮件 查找是否已安装 [root@C8-1 ~]# type mail -bash: type: mail: not found [root@C8-1 ~]# which mai ...

  6. Asp.Net Core如何根据数据库自动生成实体类

    通过引用Nuget包添加实体类 运行 Install-Package Microsoft.EntityFrameworkCore.SqlServer 运行 Install-Package Micros ...

  7. 类型“DbContext”在未引用的程序集中定义。必须添加对程序及“EntityFramework,Version=6.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”的引用。using语句中使用的类型必须可隐式转换为”System.IDisposable

    其他层引用Model层的ef模型时会发生这个错误 解决方法: 在你要使用EF模型的层下点击添加引用 然后点击浏览   找到Model层文件下的bin>debug文件   引用这两个dll文件 如 ...

  8. Python ( 学习 基础篇第一部 )

    目录 注释 注释的分类 注释的注意点 变量 变量的概念 变量的声明 变量的命名 变量的交换 变量的缓存机制 常量 进制 进制的转换 原码 反码 补码 六大数据类型 Number 的四大类 字符串 st ...

  9. redis client原理分析

    代码库地址:https://github.com/garyburd/redigo 1:连接池 2:发送命令 3:解析结果 1:连接池 连接池结构体如下: type Pool struct { // D ...

  10. Pytest里面的测试用例怎么进行前置准备和后置清理操作?

    Pytest处理前置后置有两种方式可以处理. 第一种是通过setup和teardown这样的方法去处理: 第二种是通过fixture来实现的.首先先定义fixture,然后在调用.定义fixture, ...