openSUSE:SUSE Studio 通用操作指南

跳转到:导航搜索

通用操作指南说明

  • 在本节中,我们解释的是不针对任何模板或目标,而是针对所有模板的操作指南。
  • 您会发现其中大部分与 firstboot 脚本相关。

如何解压缩/提取下载的设备

为了减少带宽和下载时间,所有设备都以 gzip tarball 格式 (.tar.gz) 压缩。

Unix/Linux/Mac 用户

用户可以使用内置系统工具解包 .tar.gz 文件。例如,KDE 和 GNOME 中包含的 ArkFile Roller 等图形应用程序。或者,您可以使用以下命令在控制台终端中提取 .tar.gz 文件

$ tar xf <FILE_NAME>

例如,假设您下载了LAMP_Server.i686-1.0.0.vmx.tar.gz您可以执行以下命令进行提取:

$ tar xvf LAMP_Server.i686-1.0.0.vmx.tar.gz 
LAMP_Server-1.0.0/
LAMP_Server-1.0.0/LAMP_Server.i686-1.0.0.vmdk
LAMP_Server-1.0.0/LAMP_Server.i686-1.0.0.vmx

Windows 用户

用户需要安装第三方实用程序,例如 WinZip、WinRAR7-Zip(免费软件)。

这些工具具有文件资源管理器集成和图形用户界面,但它们无法一步解压缩 .tar.gz 文件 - 您需要先进行 gzip 解压缩,然后再进行 tar 提取。

注意:如果在 tar 提取过程中收到“损坏的归档文件”错误消息,即使归档文件的 MD5 校验和匹配,则可能是 tar 文件包含大于 8 GB 的文件。您需要 WinRAR 3.9 及以上版本,或 7-zip 9.16 beta 及以上版本。LibArchive/BSD tar 也可以工作。

我们建议使用 LibArchive/BSD tar(免费软件)。它只有命令行界面,但易于使用

$ bsdtar.exe -xf <FILE_NAME>

例如,假设您下载了LAMP_Server.i686-1.0.0.vmx.tar.gz以下是分步指南

  1. 下载并安装 LibArchive:http://downloads.sourceforge.net/gnuwin32/libarchive-2.4.12-1-setup.exe
  2. 将 LibArchive 路径(默认值为C:\Program Files\GnuWin32\bin)添加到您的 系统 %PATH% 变量
  3. 通过在命令终端中执行以下命令来解压缩 tarball
$ bsdtar.exe -xf LAMP_Server.i686-1.0.0.vmx.tar.gz

文件将被解包到LAMP_Server-1.0.0目录。

注意:旧版 Windows 文件系统(如 FAT32)有几个限制,特别是缺乏稀疏文件支持(某些构建格式(如 Xen)需要)以及最大文件大小为 4 GB。

首次登录

  • 使用 susestudio opensuse 默认 root 密码 linux
         username: root or tux
         password: linux 
  • 您可以在 susestudio 的配置页面 'susestudio.com/appliance/edit/NNNN#tab-configuration' 中更改此密码

首次启动时安装专有驱动程序

  • 编写一个脚本,使用 lspci 和 grep 命令来查看您拥有的硬件,然后使用 zypper 来添加仓库并安装所需的 rpm。将此脚本上传到叠加部分,并将其添加到 firstboot 部分。(参见 如何运行 firstboot 脚本)。

如何运行本地脚本

  • 如果您希望您的脚本在每次启动时运行,您有两种选择。一种是在“配置”选项卡上的“脚本”选项中使用;另一种是编写您自己的服务。
  • 通过使用“脚本”选项,您的脚本将在任何服务之前运行。如果这是您想要的,请选中“在设备启动时运行脚本”选项并编写您的脚本。
  • 如果想要在其他服务之后运行脚本,请创建您自己的服务。为此,复制 /etc/init.d/skeleton 文件并根据您的需要进行调整。将 required_start 设置为 $ALL,以便在所有其他服务之后运行。然后,将此文件上传到叠加部分,并在“firstboot 部分”中添加“insserv script_name”行(参见 如何运行 firstboot 脚本)。

如何运行 firstboot 脚本

  • 与“如何运行本地脚本”类似,firstboot 脚本可以在任何服务之前或之后运行。对于第一个选项,请使用“配置”选项卡上的“脚本”选项。您会看到一个查找 /etc/init.d/suse_studio_firstboot 文件的 if 部分。将您的命令放在那里。
  • 对于第二个选项,请像在“如何运行本地脚本”中一样操作,并创建您自己的服务。在此服务的末尾添加“insserv script_name -r”行,以便在 firstboot 后将其删除。

首次启动时配置图形

  • 如果您想在 firstboot 上配置图形,请编写一个 firstboot 脚本(参见“如何运行 firstboot 脚本”),该脚本启动 sax2。这将配置您的图形硬件。

如何将用户添加到 sudoers

  • 添加 sudo rpm 并将如下所示的自定义 /etc/sudoers 上传到叠加部分

Defaults always_set_home Defaults env_reset

Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE" LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER" Defaults targetpw # 仅与 'Defaults targetpw' 一起使用! root ALL=(ALL) ALL # 警告! 仅与 'Defaults targetpw' 一起使用! root ALL=(ALL) ALL tux ALL=(ALL) NOPASSWD:ALL

如何自定义 yast2-firstboot

  • 如果您想拥有自己的 yast2-firstboot,请将任何内容的文件上传到 /var/lib/YaST2/reconfig_system 并根据您的需要编辑 /etc/yast2-firstboot.xml 文件。确保已安装 yast2-firstboot 包。
  • 如果您只想运行一个模块,您可以在 firstboot 上执行此操作(参见 如何运行 firstboot 脚本)。

如何设置 crontab

  • 将您的自定义 crontab 文件上传到 /etc/cron.daily、/etc/cron.hourly、/etc/cron.weekly、/etc/cron/monthly。检查您是否安装了 crontab rpm。

如何设置自定义防火墙

  • 您有两种选择。要么使用 SuSEfirewall2,要么使用 iptools。
         ** For the first option, edit the /etc/sysconfig/SuSEfirewall2 and the /etc/sysconfig/SuSEfirewall2.d files.
         ** If you prefer the second one, remove the SUSEfirewall2 package, install the iptools one and add a custom iptools script on boot (see How to run local scripts). 

如何添加 autoyast,以便在启动时自动完成某些配置

  • 将 autoyast 配置文件复制到 /var/lib/autoinstall/autoconf/autoconf.xml
  • 创建一个包含“AutoYaST:”的 /etc/install.inf 文件。
  • 在 /var/lib/YaST2/runme_at_boot 创建一个空文件
  • 有关 autoyast 以及如何创建配置文件的更多信息,请访问 AutoYaST 主页

如何添加服务

  • 在 firstboot 上运行“insserv servicename”(参见 如何运行 firstboot 脚本)。
  • 如果您有自己的 systemd 脚本(例如 myscript.service),首先将其上传到 /lib/systemd/system/myscript.service 文件部分,然后在构建结束时选中“在构建结束时运行脚本”,然后将以下内容添加到脚本中。(在 openSUSE 12.1 上测试)

ln -s '/lib/systemd/system/myscript.service '/etc/systemd/system/multi-user.target.wants/myscript.service'

Minimal X (Icewm) 操作指南

  • 这些操作指南特定于 minimal X 模板。它们基本上侧重于创建类似 KIOSK 的应用程序。实现这些目标有不同的方法,以及控制窗口大小的不同方法。由于 Minimal X 具有 Icewm 窗口管理器,其中大部分与此窗口管理器相关。

如何在没有窗口管理器的情况下实现 KIOSK 应用程序

  • 在某些情况下,您可能不想使用任何窗口管理器。这些情况包括当您的应用程序可以全屏并且是单个窗口应用程序时。您可以通过编辑 /etc/inittab 文件和用户 home 目录中的 .bashrc 文件来执行此操作。

/etc/inittab

# The default runlevel is defined here
id:3:initdefault:

# First script to be executed, if not booting in emergency (-b) mode
si::bootwait:/etc/init.d/boot

# /etc/init.d/rc takes care of runlevel handling
#
# runlevel 0  is  System halt   (Do not use this for initdefault!)
# runlevel 1  is  Single user mode
# runlevel 2  is  Local multiuser without remote network (e.g. NFS)
# runlevel 3  is  Full multiuser with network
# runlevel 4  is  Not used
# runlevel 5  is  Full multiuser with network and xdm
# runlevel 6  is  System reboot (Do not use this for initdefault!)
#
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
#l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6 

# what to do in single-user mode
ls:S:wait:/etc/init.d/rc S
~~:S:respawn:/sbin/sulogin

# what to do when CTRL-ALT-DEL is pressed
ca::ctrlaltdel:/sbin/shutdown -r -t 4 now

# special keyboard request (Alt-UpArrow)
# look into the kbd-0.90 docs for this
kb::kbrequest:/bin/echo "Keyboard Request -- edit /etc/inittab to let this work." 

# what to do when power fails/returns
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
#pn::powerfail:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop

# for ARGO UPS
sh:12345:powerfail:/sbin/shutdown -h now THE POWER IS FAILING

# getty-programs for the normal runlevels
# «id»:«runlevels»:«action»:«process»
# The "id" field  MUST be the same as the last
# characters of the device (after "tty").

1:2345:respawn:/sbin/mingetty --autologin tux --delay 1 tty1   # <<------CHANGED LINE--

3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
#
#S0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt102
#cons:1235:respawn:/sbin/smart_agetty -L 38400 console

#
#  Note: Do not use tty7 in runlevel 3, this virtual line
#  is occupied by the programm xdm.
#

#  This is for the package xdmsc, after installing and
#  and configuration you should remove the comment character
#  from the following line:
#7:3:respawn:+/etc/init.d/rx tty7


# modem getty.
# mo:235:respawn:/usr/sbin/mgetty -s 38400 modem

# fax getty (hylafax)
# mo:35:respawn:/usr/lib/fax/faxgetty /dev/modem

# vbox (voice box) getty
# I6:35:respawn:/usr/sbin/vboxgetty -d /dev/ttyI6
# I7:35:respawn:/usr/sbin/vboxgetty -d /dev/ttyI7

# end of /etc/inittab

/home/tux/.bashrc

while true do WINDOWMANAGER=/home/tux/bin/start.sh startx done

如何使用窗口管理器实现 KIOSK 应用程序

  • 在某些情况下,您可能需要一个窗口管理器。然后,您所要做的就是在配置部分选择运行级别 5,并在 tux 用户中添加一个自动启动程序。这将覆盖 tux 用户的 .xinitrc 文件。
  • 如果您希望该自动启动程序对所有用户生效,请将生成的 /home/tux/.xinitrc 复制到 /etc/skeleton/.xinitrc 文件。

如何以全屏模式启动应用程序

  • 某些应用程序可能无法以全屏模式启动。控制这种行为的一种方法是在 .xinitrc 中使用 icewm-ctrl 实用程序(参见 如何使用窗口管理器实现 KIOSK 应用程序)。为此,icewm-ctrl 实用程序需要窗口 ID。
  • 以下是如何使用 gbrainy 应用程序实现此目标的示例

gbrainy & while [ `wmctrl -l | grep gbrainy | wc -l` != '1' ]; do echo "waiting for gbrainy" » /tmp/start.sh.log ;done wmctrl -r gbrainy -b toggle,fullscreen echo "done" »» /tmp/start.sh.log

如何自定义 icewm 任务栏和窗口

  • Icewm 可以进行高度自定义。其中一项自定义包括任务栏。您还可以自定义每个窗口的大小和设计。您可以将所需的文件添加到 tux 用户的 .icewm 目录中来为 tux 用户自定义。如果您希望这适用于所有用户,请将此目录复制到 /etc/skeleton/ 目录。
  • 最简单的方法是使用 icewm 控制面板应用程序来创建这些文件。为此,将 icewmcp rpm 添加到您的设备中。然后构建它并运行它。打开一个 xterm 并运行 icewmcp 并自定义您的 icewm。之后,将 .icewm 复制到叠加部分。

如何为 JeOS 和 Server 模板添加 X

  • 为了使 X 在 JeOS 和基于 Server 的模板上运行,您必须将几个软件包添加到您的设备中

- xorg-x11-server - sax3 - xorg-x11-driver-video - xorg-x11-driver-input - xorg-x11-fonts-core (或 xorg-x11-fonts)

  • 然后转到配置选项卡部分,在启动下选择 5:图形登录。
  • 注意:默认情况下,您将拥有 IceWM 作为窗口管理器!

Pango Bugfix

好吧,现在,如果您说方块字,那太好了,但对于普通人来说,这有点不太好

12_gibberish_pango.png

这是一个已知的 pango 错误(我们希望他们能尽快修复),并且可以轻松修复。我们将只需要重新生成 pango 的模块列表,我们将再次使用 Studio 来修复。让我们打开配置选项卡并单击脚本

13_buildscript.png

Studio 允许用户在构建完成后或可选地在设备的每次启动时运行 bash 脚本。由于这是一次性修复,我们将选择前者选项,并添加 pango-querymodules-64 > /etc/pango/pango64.modules 到构建脚本。如果您从 32 位设备开始,请添加 pango-querymodules > /etc/pango/pango.modules。

14_done.png