定制Debian系统支持Mac机型SOP<--绝对原创
一、制作准备阶段平台
1、安装虚拟机Vmware12
2、在虚拟机下安装Ubuntu 16.04.2 LTS (Xenial Xerus) 64-bit x86 .or debian8.8通用
3、下载debian-live-8.8.0-amd64-kde-desktop.iso镜像,在虚拟下安装。
参考路径http://willhaley.com/blog/create-a-custom-debian-live-environment/
二、在debian系统下安装必要的软件
# sudo apt-get install \
debootstrap syslinuxisolinux squashfs-tools \
genisoimage memtest86+ rsync
debootstrap是debian/ubuntu下的一个工具,用来构建一套基本的系统(根文件系统)。生成的目录符合Linux文件系统标准(FHS)。
squashfs-tools 解压 使用squashfs工具创建的 xx.squashfs.img文件
用SYSLINUX或ISOLINUX制作启动U盘或光盘 SYSLINUX/ISOLINUX是专门用来引导可移动介质的轻量级引导程序。
三、创建一个制作镜像的文件
# mkdir $HOME/live_boot
# mkdir -p $HOME/live_boot/image/{live,isolinux}
四、安装debian文件系统
--arch=amd64 \
--variant=buildd \
jessie $HOME/live_boot/chroot http://ftp.us.debian.org/debian
五、chroot进入系统,安装3.16内核.
# chroot $HOME/live_boot/chroot
修改主机名字:
# echo "pansafe" > /etc/hostname
六、查看镜像文件
# apt-cache search linux-image
选择linux-image-3.16.0-4-amd64内核进行安装
apt-get install --no-install-recommends --yes --force-yes \
linux-image-3.16.0-4-amd64 live-boot \
network-manager net-tools wireless-tools wpagui \
tcpdump wget openssh-client \
blackbox xserver-xorg-core xserver-xorg xinit xterm \
pciutils usbutils gparted ntfs-3g hfsprogs rsync dosfstools \
syslinux partclone nano pv \
rtorrent iceweasel chntpw && \
apt-get clean
七、安装软件
linux 桌面环境:http://blog.youkuaiyun.com/sole_cc/article/details/42804355
桌面环境可能仅仅是一个简单的窗口管理器,也可能是一个像 KDE 或者 GNOME这样的完整桌面应用程序套件http://blog.youkuaiyun.com/canbus/article/details/8438089
1)ldxe桌面
# apt-get update
2)自动登入,有时设置了还是不能自动登入,待解决,可以手动添加用户
#passwd root
设置密码!OK!
修改文件lightdm.conf文件
#nano /etc/lightdm/lightdm.conf
添加如下内容
sudo vi /etc/lightdm/lightdm.conf
/*这里不能使用debian的格式,因为llxde是支持ubuntu的格式*/
不遵守的话就是可以登入但是不显示桌面!
[SeatDefaults]
User-session=LXDE
Autologin-guest=false
Autologin-user=root
Autologin-user-timeout=0
Autologin-session=lightdm-autologin
注释:把/root/.profile的 mesg n改为 tty -s && mesg n
因为启动过程中出现错误,这里不打印错误。
安装基本桌面环境(gnome) //可以以选择这个进行安装,待测
浅颜色的不要执行,是另一个桌面系统
#apt-get install xorg gdm3 gnome-shell
让Debian以root自动登录:
1)首先修改gdm3的设定文件(/etc/gdm3/daemon.conf),在[daemon]字段后面追加如下两行:
AutomaticLoginEnable =true //改为true
#AutomaticLogin =root //以root自动登录
如果想等几秒再登录,可以在[daemon]字段后面追加如下内容:
TimedLoginEnable = true
TimedLogin = root
TimedLoginDelay = 5 //延迟5秒登录,可修改
2)最后修改gdm3的自动登录pam文件:
vi /etc/pam.d/gdm-autologin
将auth required pam_succeed_if.so user != root quiet_success注释掉。//在本行前加#,取消Debian不让root登录的限制。
重启系统即可!
3)更新系统时间
# echo “Asia/Shanghai” > /etc/timezone
# ln –sf /usr/share/zoneinfo/Asia/shanghai /etc/localtime
4)启动动画:
sudo apt-get install lightdm* //must be install
5)刷新引导执行命令
# update-initramfs -u
6)中文输入法:
#apt-get install fcitx fcitx-googlepinyin (update-initramfs -u)
八、Debian的中文设置
#aptitude install locales
#dpkg-reconfigure locales
参考路径http://greybeard.iteye.com/blog/1153076
进入选择:
zh_CN GB2312
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
en_US.UF8
#vim /etc/default/locale
设置:LANG=en_US.UTF-8
如果重启X后,发现整个系统的界面显示的还是英文,而使用locale命令检查 系统的locale设置又已经正确的配置为中文。当时遇到的情况就是某些应用的标题等显示为中文,但是工具菜单等显示和文件管理器等都显示成了英文。这 种情况很有可能是因为/etc/enviroment文件里有关语言的环境变量的设置不对。打开/etc/enviroment文件,通常会发现下面两个 字段:
九、如果不能上网可以参考下面的解决方案
# cp /etc/hostsjessieetc/hosts
# cp /etc/resolv.confjessieetc/resolv.conf
# cp /etc/apt/sources.listjessieetc/apt/sources.list
mount none -t sysfs /sys
mount none -t devpts /dev/pts
export HOME=/root
export LC_ALL=C
十、桌面背景、图标
Base目录下没有pcmanfm的配置,只有系统启动后,才会在/root/下生成.config/pcmanfm的配置,这里预先创建目录和文件:
/root/.config/pamanfm/LXDE/desktop-items-0.conf
修改这两个文件用自己的图片代替。
# background=/usr/share/images/desktop-base/login-background.svg 登入界面
# usr/share/images/desktop-base/lines-wallpaper_1920x1080.svg 桌面
十一、打包
#update-initramfs -u
# exit
#mksquashfs chroot image/live/filesystem.squashfs -e boot
10.1)拷贝必要的引导文件
cp chroot/boot/initrd.img-3.16.0-4-amd64 image/live/initrd.img
cp chroot/boot/vmlinuz-3.16.0-4-amd64 image/live/vmlinuz
/************************************************************************************************/
1)问题:debian进桌面时白屏,求帮助
如果是lightdm,修改:
/etc/lightdm/lightdm-gtk-greeter.conf文件
找background=一行,修改成自己需要的图片。比如:
background=/usr/share/images/desktop-base/login-background.svg
如果是gdm3,配置文件在/etc/gdm3下。
问题二:启动时登入白屏;最重要的一步
98 mount --bind /dev chroot/dev
100 mount none -t proc /proc/
101 mount none -t sysfs /sys
102 mount none -t devpts /dev/pts
103 export HOME=/root
104 export LC_ALL=C
105 apt-get update
108 apt-get install plymouth-theme-lubuntu-logo
109 update-initramfs -u
113 cp /etc/lightdm/lightdm.conf ~/live_boot/chroot/lightdm/
ubuntu安装和卸载软件命令
Ubuntu软件安装与删除相关命令
安装软件
命令: apt-get install softname1 softname2 softname3……
卸载软件
命令: apt-get remove softname1 softname2 softname3……
卸载并清除配置
命令: apt-get remove --purge softname1
更新软件信息数据库
命令: apt-get update
进行系统升级
命令: apt-get upgrade
搜索软件包
命令: apt-cache search softname1 softname2 softname3……
Deb软件包相关安装与卸载
安装deb软件包
命令: dpkg -i xxx.deb
删除软件包
命令: dpkg -r xxx.deb
连同配置文件一起删除
命令: dpkg -r --purge xxx.deb
查看软件包信息
命令: dpkg -info xxx.deb
查看文件拷贝详情
命令: dpkg -L xxx.deb
查看系统中已安装软件包信息
命令: dpkg -l
重新配置软件包
命令: dpkg-reconfigure xxx
十二、制作引导EFI程序
从网上下载两个镜像,解压在windows下;解压过后如下图:
镜像一 debian-8.8.0-arm64-netinst
镜像二 debian-live-8.8.0-amd64-lxde-desktop
因为 live 没有efi所以需要net.Iso一起制作
先将netinst镜像里面boot和efi目录全部复制到U盘里,然后依照netinst镜像里boot/grub/grub.cfg的格式,将live镜像里isolinux/live.cfg的内容添加到U盘的boot/grub/grub.cfg上,最后将U盘里install目录名称改为install.amd(为了对应netinst镜像里的install.amd目录)。
用UEFI模式启动U盘时,发现了netinst的GRUB启动菜单,然而live选项已经加上了。选择live选项,系统开始启动了。
注释:
本实验制作的livecd为debian8.6版本!
debian8.6文件为bootx64.efi 8.8 就不是这个了。不然会出错误!
制作好的grub在附录:
if loadfont $prefix/font.pf2 ; then
set gfxmode=800x600
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod gfxterm
insmod png
terminal_output gfxterm
fi
if background_image /isolinux/splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
insmod play
play 480 440 1
set theme=/boot/grub/theme/1
set default=0
set timeout=1
menuentry --hotkey=p 'Pansafe SafeImager' {
set gfxpayload=keep
linux /live/vmlinuz cdrom-detect/try-usb=true boot=live --- quiet
initrd /live/initrd.img
}