custom-ubuntu-server-iso
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的更多相关文章
- 如何在Ubuntu Server 18.04 LTS中配置静态IP地址
安装Ubuntu Server 18.04后需要分配一个的静态IP地址.先前的LTS版本Ubuntu 16.04使用/etc/network/interfaces文件配置静态IP地址,但是Ubuntu ...
- virtualbox搭建ubuntu server nginx+mysql+tomcat web服务器1 (未完待续)
virtualbox搭建ubuntu server nginx+mysql+tomcat web服务器1 (未完待续) 第一次接触到 linux,不知道linux的确很强大,然后用virtualbox ...
- ubuntu server 12.04U盘安装,提示无法挂载安装光盘或光盘读取数据出错
今天用Ultraiso将Ubuntu server 12.04 刻入U盘中安装系统,中间提示错误:1.检测不到cdrom(即U盘没有挂载上):2.从光盘中读取数据出错.问题如下图所示: 上网搜了下解决 ...
- U盘安装ubuntu server 14.04
U盘安装ubuntu server 14.04 U盘安装ubuntu server 14.04 1.制作启动u盘 2.开始安装 1 将u盘插入主机,重启后从u盘启动 2 选择语言(随便挑,随便选),我 ...
- U盘安装ubuntu server 12.04的问题检测不到CDROM的解决
U盘安装ubuntu server 12.04的问题检测不到CDROM的解决 ========================== 我是u盘安装ubuntu 14 64Bit 也是出现同样的问题 用u ...
- 在虚拟机中安装Ubuntu Server 15.04
学Linux,上红联! 红联Linux门户|Linux通用技术|Linux发行版技术|Linux企业应用|Linux实验室|红联Linux论坛 Linux系统教程 Linux入门 Linux管理 Li ...
- 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 ...
- Ubuntu server 16.04安装,无网卡驱动解决
因为使用一个软件必须要在ubuntu server 16.04上安装,因此先在裸机上安装ubuntu server 16.04,具体信息: 镜像版本:ubuntu-16.04.6-server-amd ...
- VirtualBox下安装Ubuntu Server 16.04
安装环境: Windows:确保磁盘空间足够,一般需要8个G左右. 所需文件: 首先在Ubuntu的官网上下载.iso的镜像文件,链接是:http://www.ubuntu.org.cn/server ...
- ubuntu server 14.04 LTS下搭建LAMP环境之最详细笔记之一U盘安装双系统
前言: 一直在WIN上使用PHP,不喜欢用WAMP,每次都是手动在windows配置环境,偶尔有一次装了小红帽玩了两天,感觉不是很习惯就换了回来,过了没几天见讨论LAMP环境,于是安装了ubuntu的 ...
随机推荐
- python写文件时遇到UnicodeEncodeError: 'gbk' codec can't encode character的解决方式
在window平台,文件的默认编码是gbk, 此时如果写入的字符串的编码是utf-8就会引发这种错误,打开文件的编码必须与字符串的编码一致 with open('content.txt','w',en ...
- 【不知道怎么分类】CF 819B Mister B and PR Shifts
题目内容 洛谷链接 定义一个全排列\(p_i\)的偏移值为\(\sum_{i=1}^{n}|p[i]-i|\). 给你一个全排列,你可以从后面拿\(k\in[0,n-1]\)个数放在前面,使得该全排列 ...
- Gitlab 11.9.1 高可用教程
Gitlab 11.9.1 高可用教程 一. PostgreSQL数据迁移 由于默认Gitlab的安装会内置Postgres数据库,并且没有对外,所以我们需要通过设置对应的Gitlab的配置将其中的数 ...
- 数组列表(ArrayList)
2020-10-20 longzqa@163.com stronglzq [摘要]针对数组容量固定无法扩展的问题,引入数组列表(ArrayList).主要对数组列表的声明及 ...
- APP反编译Xposed-Fdex2脱壳
1.首先手机安装Xposed(app) 2.安装Fdex2(app) 3.打开Fdex2 4.点击要脱壳的app 5.adb pull (点击脱壳app时候弹出的来的路径) 保存本地路径 6.完结-. ...
- 【CF1436B】Prime Square 题解
原题链接 题意简介 要求构造一个由不大于 1e5 的非负数构成的正方形矩阵,矩阵的每个元素不是质数,但每一行.每一列的数字的和都是质数. 思路分析 看到样例二,我们知道数字可以重复. 于是,我们很容易 ...
- 2020-2021-1 20209306 《linux内核原理与分析》第三周作业
目录 一.实验:完成一个简单的时间片轮转多道程序内核代码 二.学习总结 1.堆栈相关的寄存器 2.堆栈操作 3.其他关键寄存器 4.用堆栈来传递函数的参数 5.了解了函数如何传递返回值,堆栈还提供局部 ...
- DiskLruCache和Lrucache缓存bitmap
三级缓存,先在内存Lrucache中查找缓存,没有就去外存DiskLrucache中查找,再没有就下载,Lru不会自动删除,所以要设置最大缓存内存,后台运行Lrucache不会消失,关闭程序Diskl ...
- mysql 事务的日志
事务的日志 1.redo log redo:"重做",记录的是,内存数据页的变化过程 1)作用 在事务ACID过程中,实现的是 "D" 持久化的作用. 2)工作 ...
- DES 实现
原理 加密 置换: IP逆置换: 迭代: PC-1置换: PC-2置换: 子秘钥的生成: 加密函数f: 解密 代码 // C语言实现 #include<stdio.h> #include& ...