一直有这样一个有趣的想法:可不可以定制一个Linux系统,实现效果是开机启动后直接打开指定的一个网页并且全屏显示,类似现在有许多服务性单位的营业厅中或者医院自助服务台使用了的设备,但是我大致接触操作过的系统应该都是基于Windows系统+开机启动项做的,有的甚至还能长按触摸屏出来鼠标右键菜单.倒还真是没见过有用Linux做底层的.扒出来一篇2014年的文章,描述了基于Ubuntu 14.04实现上述效果,还没做实验,先贴出来,头一次做翻译,不准确的地方还望大家指正.

原文链接:https://thepcspy.com/read/building-a-kiosk-computer-ubuntu-1404-chrome/

下面的翻译我都会以段落为单位进行,先是原文,然后是译文.开始吧~

Single-purpose kiosk computing might seem scary and industrial but thanks to cheap hardware and Ubuntu, it’s an increasingly popular idea. I’m going to show you how and it’s only going to take a few minutes to get to something usable.

单功能用途的展厅电脑[注:kiosk愿意是报亭,我自己瞎改的叫法]看上去都比较具有工业感的牛逼气息,不过感谢廉价的硬件和Ubuntu,现在这种应用已经是越来越火爆了.现在我就来带你装逼带你飞.

搞出来的就是这样的大屏触摸设备效果

Hopefully we’ll do better than the image on the right.

希望我们能搞的比想象中要好.

We’re going to be running a very light stack of X, Openbox and the Google Chrome web browser to load a specified website. The website could be local files on the kiosk or remote. It could be interactive or just an advertising roll. Of course you could load any standalone application. XBMC for a media centre, Steam for a gaming machine, Xibo or Concerto for digital signage. The possibilities are endless.

我们接下来要运行一个轻量的X服务,使用Openbox桌面环境以及Google Chrome浏览器来加载指定的一个网站.这个网站可以是本地的或者互联网上的.整套系统搞下来可以做成交互式的或者仅仅作为滚动广告屏.当然你也可以加载任何本地的应用程序.XBMC(注:这货现在叫Kodi,是一个开源的媒体播放器)或者媒体中心,做成游戏机,Xibo(注:这货是个电子引导标示系统)或者Concerto(注:这货貌似是用在医疗和教育领域的一套系统,标示不太清楚)

The whole thing takes less than 2GB of disk space and can run on 512MB of RAM.

全套系统只需要2G的硬盘和512M内存就可以跑起来哟.

Update: If you’ve already installed, read this companion tutorial if you want to convert an existing Ubuntu Desktop install to a kiosk.

更新:这是另外一篇文章教你怎么把已经装好的Ubuntu桌面系统修改成单功能用途(先不管了)

Step 1: Installing Ubuntu Server

第一步:安装Ubuntu Server

I’m picking the Server flavour of Ubuntu for this. It’s all the nuts-and-bolts of regular Ubuntu without installing a load of flabby graphical applications that we’re never ever going to use.

为毛要用Ubuntu Server呢?因为这个发行版里面没有乱七八糟的其他程序包之类的,相当于最小化使用Ubuntu底层服务的一个内核,方便后面按需定制.

It’s free for download. I would suggest 64bit if your hardware supports it and I’m going with the latest LTS (14.04 at the time of writing). Sidebar: If you’ve never tested your kiosk’s hardware in Ubuntu before it might be worth download the Desktop Live USB, burning it and checking everything works.

这里推荐使用64位LTS(LongTermSupport长期更新支持版本)的Ubuntu,当然这篇文章有点老了,当时最新版的还是14.04,理论上现在最新版的也是一样的套路,推荐从http://mirrors.163.com上下载,然后用UltraISO或者rufus制作系统U盘,这里不啰嗦了

Just follow the installation instructions. Burn it to a USB stick, boot the kiosk to it and go through. I just accepted the defaults and when asked:

按照Ubuntu的安装说明从U盘引导启动

  • Set my username to user and set an hard-to-guess, strong password.
  • 设置用户名为user,再设置个复杂到你自己都记不住的密码(手动滑稽)
  • Enabled automatic updates
  • 启用自动更新
  • At the end when tasksel ran, opted to install the SSH server task so I could SSH in from a client that supported copy and paste!
  • 最后当tasksel运行的时候(这个貌似不太明白),选择安装并启用SSH服务,这样就可以远程管理了(废话,当然要开SSH了)

After you reboot, you should be looking at a Ubuntu 14.04 LTS ubuntu tty1 login prompt. You can either SSH in (assuming you’re networked and you installed the SSH server task) or just log in.

安装完成并重启后,在本地或者用SSH远程登录进去系统

The installer auto-configures an ethernet connection (if one exists) so I’m going to assume you already have a network connection. If you don’t or want to change to wireless, this is the point where you’d want to use nmcli to add and enable your connection. It’ll go something like this:

系统在安装的时候会自动配置网络连接,要是没搞好的话,用nmcli命令设置(下面命令配置的是wifi)

sudo apt install network-manager
sudo nmcli dev wifi con <SSID> password <password>

Later releases should have nmtui which will make this easier but until then you always have man nmcli :)

新版本的Ubuntu系统中会默认带nmtui命令,是个文本图形化的配置工具,比nmcli好用

Step 2: Install all the things

第二步:安装全家福

We obviously need a bit of extra software to get up and running but we can keep this fairlycompact. We need to install:

全家福里面我们需要以下软件包

  • X (the display server) and some scripts to launch it
  • X(图形显示的服务)以及一些启动脚本
  • A lightweight window manager to enable Chrome to go fullscreen
  • 一个轻量的桌面管理器来让Chrome浏览器全屏启动
  • Google Chrome
  • 就不翻译
  • PulseAudio for sound
  • 需要声音的话还得装PulseAudio

We’ll start by adding the Google-maintained repository for Chrome:

现在先开始装Chrome,添加Google维护的软件源(国内就别考虑用这个方法了,自己想办法搞定)

sudo add-apt-repository 'deb http://dl.google.com/linux/chrome/deb/ stable main'
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

Then update our packages list and install:

更新一下包列表并且安装指定包

sudo apt update
sudo apt install --no-install-recommends xorg openbox google-chrome-stable pulseaudio

If you omit --no-install-recommends you will pull in hundreds of megabytes of extra packages that would normally make life easier but in a kiosk scenario, only serve as bloat.

这里需要注意了啊~注意注意啦!这个参数--no-install-recommends很重要!!!要是漏掉的话,会额外安装好多好多的包包,所以你懂得~按套路来

We also need to make sure your user is in the audio group. This will allow PulseAudio to start up and manage sound for applications. This part is optional and many kiosks won’t need sound but I’ve had a lot of comments about it:

还需要确认一下安装系统的时候创建的那个名字叫user的用户需要添加到audio用户组里面,这样才能启动PulseAudio并且发声,当然这一步也不是必须的,貌似一般也不需要这货带喇叭嗨吧

  sudo usermod -a -G audio $USER

Step 3: Loading the browser on boot

第三步:设置开机自动启动浏览器

I know we’ve only been going for about five minutes but we’re almost done. We just need two little scripts.

啰嗦这么多了,最后就剩下这两个脚本就要任务完成了.

Run sudoedit /opt/kiosk.sh first. This is going to be what loads Chrome once X has started. It also needs to wipe the Chrome profile so that between loads you aren’t persisting stuff. This in incredibly important for kiosk computing because you never want a user to be able to affect the next user. We want them to start with a clean environment every time. Here’s where I’ve got to:

新建一个脚本文件/opt/kiosk.sh用来让系统启动X服务的时候自动运行Chrome,这个脚本还需要干的一个活儿就是自动清理Chrome临时文件,这样不同的用户交叉使用起来不会有隐私泄露什么的(其实无所谓的啦~)

#!/bin/bashxset -dpms
xset s off
openbox-session &
start-pulseaudio-x11while true; dorm -rf ~/.{config,cache}/google-chrome/google-chrome --kiosk --no-first-run  'http://thepcspy.com'
done

When you’re done there, Control+X to exit and run sudo chmod +x /opt/kiosk.sh to make the script executable. Then we can move onto starting X (and loading kiosk.sh).

脚本写好后保存退出,并给这个脚本文件加上可执行权限sudo chmod +x /opt/kiosk.sh,接下来就该搞启动x时候的脚本了

Run sudoedit /etc/init/kiosk.conf and this time fill it with:

新建配置文件/etc/init/kiosk.conf,内容如下:

start on (filesystem and stopped udevtrigger)
stop on runlevel [06]console output
emits starting-xrespawnexec sudo -u user startx /etc/X11/Xsession /opt/kiosk.sh --

Replace user with your username. Exit, Control+X, save.

这里最后一行的user应该是系统的用户名(上面安装的时候本来起的用户名就叫user的嘛~不用改了),保存退出

X still needs some root privileges to start. These are locked down by default but we can allow anybody to start an X server by running sudo dpkg-reconfigure x11-common and selecting “Anybody”.

X服务还需要一些root权限来启动,这些权限默认是没有的,执行sudo dpkg-reconfigure x11-common并且选择Anybody来实现允许任何用户都能启动X服务.

After that we should be able to test. Run sudo start kiosk (or reboot) and it should all come up.

现在可以开始测试系统了,执行sudo start kiosk或者直接reboot

One last problem to fix is the amount of garbage it prints to screen on boot. Ideally your users will never see it boot but when it does, it’s probably better that it doesn’t look like the Matrix. A fairly simple fix, just run sudoedit /etc/default/grub and edit so the corresponding lines look like this:

最后一个需要解决的问题是开机启动的时候会显示一大堆垃圾信息,我们显然不想让用户看到这些对吧,要不整的跟看黑客帝国似的,很简单的办法,修改/etc/default/grub,内容如下:

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

Save and exit that and run sudo update-grub before rebooting.

保存并退出后运行sudo update-grub,然后重启

The monitor should remain on indefinitely.

显示器应该不显示启动过程中的那一堆信息了

Final step: The boring things…

最后一步:讨厌~不想翻译了,自己看吧

Technically speaking we’re done; we have a kiosk and we’re probably sipping on a Martini. I know, I know, it’s not even midday, we’re just that good… But there are extra things to consider before we let a grubby member of the public play with this machine:

  • Can users break it? Open keyboard access is generally a no-no. If they need a keyboard, physically disable keys so they only have what they need. I would disable all the F* keys along with Control, Alt, Super… If they have a standard mouse, right click will let them open links in new windows and tabs and OMG this is a nightmare. You need to limit user-input.

  • Can it break itself? Does the website you’re loading have anything that’s going to try and open new windows/tabs/etc? Does it ask for any sort of input that you aren’t allowing users? Perhaps a better question to ask is Can it fix itself? Consider a mechanism for rebooting that doesn’t involve a phone call to you.

  • Is it physically secure? Hide and secure the computer. Lock the BIOS. Ensure no access to USB ports (fill them if you have to). Disable recovery mode. Password protect Grub and make sure it stays hidden (especially with open keyboard access).

  • Is it network secure? SSH is the major ingress vector here so follow some basic tips: so at the very least move it to another port, only allow key-based authentication, install fail2banand make sure fail2ban is telling you about failed logins.

  • What if Chrome is hacked directly? What if somebody exploited Chrome and had command-level access as user? Well first of all, you can try to stop that happening with AppArmor (should still apply) but you might also want to change things around so that the user running X and the browser doesn’t have sudo access. I’d do that by adding a new user and changing the two scripts accordingly.

  • How are you maintaining it? Automatic updates are great but what if that breaks everything? How will you access it in the field to maintain it if (for example) the network dies or there’s a hardware failure? This is aimed more at the digital signage people than simple kiosks but it’s something to consider.

You can mitigate a lot of the security issues by having no live network (just displaying local files) but this obviously comes at the cost of maintenance. There’s no one good answer for that.

使用Ubutnu14.04和Chrome打造单功能用途电脑(大屏展示电脑)相关推荐

  1. 使用CentOS 7+lightdm+Openbox+Chromium打造单功能用途电脑(大屏展示电脑)

    接上一篇做的翻译,真特娘的累,还不如直接自己搞了,讲真的一直玩CentOS习惯了,这里我用CentOS 7来搞,全程在VirtualBox里面搞的实验,开始记录一下: 1.安装系统 设置时区.选择最小 ...

  2. 一个炫酷大屏展示页的打造过程

    作者:韩永豪 移动开发部 前端开发工程师 今年的11月初,我们公司参加了「2017年亚洲幼教年会(APEAC)」并取得了很不错的成果.本人有幸负责关于这次展示页的前端开发,特以此文记录开发过程中的关键 ...

  3. ArchLinux+lightdm+Openbox+Chromium定制单功能用途电脑

    前言: 最近折腾Linux上瘾了,上一篇使用CentOS 7+lightdm+Openbox+Chromium打造单功能用途电脑(大屏展示电脑)搞完之后感觉还是受限于CentOS底层设计本身就是当服务 ...

  4. Vue.js 打造酷炫的可视化数据大屏

    可视化技术与 Vue 介绍 实验介绍 在本节实验中,将对可视化技术的应用场景.发展历程进行介绍,让大家对可视化技术有一个基础的概念.随后将介绍如今流行的可视化框架与其之间的优缺点对比.最后介绍 Vue ...

  5. 数据驱动科技赋能,东吴证券打造数据中台“九大能力”

    公司简介 东吴证券股份有限公司作为首家上市的地级市券商,扎根苏州,布局全国,树立"坚持根据地.融入长三角.服务中小微"战略导向,致力于为实体经济增添活力,为美好生活创造价值,建设公 ...

  6. 乐视发布三款第4代超级电视 打造大屏游戏生态

    大公网5月31日讯 乐视今日举办"玩大的"发布会,基于全球独创的开放闭环乐视生态系统,推出三款生态电视--第4代超级电视X55(超4 X55),定价3599元标配价值149元乐视无 ...

  7. 解决Ubuntu14.04安装Chrome浏览器打不开的问题

    解决Ubuntu14.04安装Chrome浏览器打不开的问题 参考文章: (1)解决Ubuntu14.04安装Chrome浏览器打不开的问题 (2)https://www.cnblogs.com/li ...

  8. Ubuntu16.04安装Chrome浏览器及解决root不能打开的问题

    Ubuntu16.04安装Chrome浏览器及解决root不能打开的问题 参考文章: (1)Ubuntu16.04安装Chrome浏览器及解决root不能打开的问题 (2)https://www.cn ...

  9. webstorm+nodejs+JetBrains IDE Support+chrome打造前端开发神器

    #webstorm+nodejs+JetBrains IDE Support+chrome打造前端开发神器 -- 工欲善其事 必先利其器##各工具介绍 `webstorm`是**JetBrains** ...

最新文章

  1. windows程序移植linux
  2. vs调试显示16进制如何调节为10进制
  3. hdu 统计难题(map)
  4. linux单cpu进程能并行吗,linux,cpu_如何知道运行多少个进程最有效率?,linux,cpu,并行,parallel-execution - phpStudy...
  5. perl 处理文件路径的一些模块
  6. Java编程中值得注意的对象引用现象
  7. 中获取文件名不要扩展名_如何批量修改文件名,3s时间够不够
  8. 使用Typescript和React的最佳实践
  9. uushare新增类似美味(del.icio.us)的书签服务
  10. python3新式类_python新式类和旧式类区别
  11. pythonの鉴黄之路(一)——YCbCr简易版鉴黄脚本
  12. uc3842改可调电源教程_36W LED 防水电源
  13. docker server 容器连接sql_docker 容器连接 host的sql server失败
  14. 创业须要恪守“一个常识“
  15. 抖音短视频 产品需求文档
  16. oracle卸载报错,oracle卸载
  17. python存钱挑战_52周拯救挑战赛(python),存钱,Python
  18. PointRCNN: 3D Object Proposal Generation and Detection from Point Cloud【翻译】
  19. 初中计算机 课题研究,初中信息技术课题怎么做
  20. ajax 与form 表单连用 success不执行bug解决

热门文章

  1. 题解 浣花溪公园【图论基本算法及应用】
  2. double和float的精度和取值范围
  3. XL1509-ADJ介绍
  4. quartus仿真9:74161基本功能
  5. 漫画秒懂Elasticsearch原理
  6. 苹果开发者账号官方翻译篇-管理ID标识
  7. python 浮点数判断
  8. emacs elisp教程
  9. speedoffice(Excel)如何对图片进行旋转
  10. 原来华为手机隐藏功能这么使用,按下这个按钮,还能查看wifi密码