This commit is contained in:
geekpi 2018-12-21 08:57:12 +08:00
commit 8dfd08d662
13 changed files with 615 additions and 618 deletions

View File

@ -0,0 +1,240 @@
我的个人电子邮件系统设置notmuch、mbsync、Postfix 和 dovecot
======
我使用个人电子邮件系统已经相当长的时间了,但是一直没有记录过文档。最近我换了我的笔记本电脑(职业变更导致的变动),我在试图重新创建本地邮件系统时迷茫了。所以这篇文章是一个给自己看的文档,这样我就不用费劲就能再次搭建出来。
### 服务器端
我运行自己的邮件服务器,并使用 Postfix 作为 SMTP 服务器,用 Dovecot 实现 IMAP。我不打算详细介绍如何配置这些设置因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill用 Jonas 自己的话说):
> \<jonas> Redpill 是一个概念:一种设置 Debian hosts 去跨组织协作的方式
>
> \<jonas> 我发展了这个概念,并将其首次用于 Redpill 网中网redpill.dk其中涉及到了我自己的网络jones.dk我的主要客户的网络homebase.dk一个包括 Skolelinux Germanyfree-owl.de的在德国的网络和 Vasudev 的网络copyninja.info
除此之外, 我还有一个 dovecot sieve 过滤,根据邮件的来源,对邮件进行高级分类,将其放到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 `~/dovecot.sieve` 文件中。
再次,我不会详细介绍如何设置这些东西,因为这不是我这个帖子的目标。
### 在我的笔记本电脑上
在我的笔记本电脑上,我已经按照 4 个部分设置
1. 邮件同步:使用 `mbsync` 命令完成
2. 分类:使用 notmuch 完成
3. 阅读:使用 notmuch-emacs 完成
4. 邮件发送:使用作为中继服务器和 SMTP 客户端运行的 Postfix 完成。
### 邮件同步
邮件同步是使用 `mbsync` 工具完成的, 我以前是 OfflineIMAP 的用户,最近切换到 `mbsync`,因为我觉得它比 OfflineIMAP 的配置更轻量、更简单。该命令是由 isync 包提供的。
配置文件是 `~/.mbsyncrc`。下面是我的例子与一些个人设置。
```
IMAPAccount copyninja
Host imap.copyninja.info
User vasudev
PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg"
SSLType IMAPS
SSLVersion TLSv1.2
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPAccount gmail-kamathvasudev
Host imap.gmail.com
User kamathvasudev@gmail.com
PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg"
SSLType IMAPS
SSLVersion TLSv1.2
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore copyninja-remote
Account copyninja
IMAPStore gmail-kamathvasudev-remote
Account gmail-kamathvasudev
MaildirStore copyninja-local
Path ~/Mail/vasudev-copyninja.info/
Inbox ~/Mail/vasudev-copyninja.info/INBOX
MaildirStore gmail-kamathvasudev-local
Path ~/Mail/Gmail-1/
Inbox ~/Mail/Gmail-1/INBOX
Channel copyninja
Master :copyninja-remote:
Slave :copyninja-local:
Patterns *
Create Both
SyncState *
Sync All
Channel gmail-kamathvasudev
Master :gmail-kamathvasudev-remote:
Slave :gmail-kamathvasudev-local:
# Exclude everything under the internal [Gmail] folder, except the interesting folders
Patterns * ![Gmail]*
Create Both
SyncState *
Sync All
```
对上述配置中的一些有趣部分进行一下说明。一个是 PassCmd它允许你提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我使用 gpg 的对称加密,并在我的磁盘上存储密码。这当然是由 Unix ACL 保护安全的。
实际上,我想使用我的公钥来加密文件,但当脚本在后台或通过 systemd 运行时,解锁文件看起来很困难 (或者说几乎不可能)。如果你有更好的建议,我洗耳恭听:-)。
下一个指令部分是 Patterns。这使你可以有选择地同步来自邮件服务器的邮件。这对我来说真的很有帮助可以排除所有的 “[Gmail]/ folders” 垃圾目录。
### 邮件分类
一旦邮件到达你的本地设备,我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步的 Maildir并在 Gnus 中阅读。这种设置相比于设置所有的服务器软件是有点大题小作,但 Gnus 无法很好地应付 Maildir 格式,这是最好的方法。这个设置也有一个缺点,那就是在你快速搜索邮件时,要搜索大量邮件。而这就是 notmuch 的用武之地。
notmuch 允许我轻松索引上千兆字节的邮件档案而找到我需要的东西。我已经创建了一个小脚本,它结合了执行 `mbsync``notmuch`。我使用 dovecot sieve 来基于实际上创建在服务器端的 Maildirs 标记邮件。下面是我的完整 shell 脚本,它执行同步分类和删除垃圾邮件的任务。
```
#!/bin/sh
MBSYNC=$(pgrep mbsync)
NOTMUCH=$(pgrep notmuch)
if [ -n "$MBSYNC" -o -n "$NOTMUCH" ]; then
echo "Already running one instance of mail-sync. Exiting..."
exit 0
fi
echo "Deleting messages tagged as *deleted*"
notmuch search --format=text0 --output=files tag:deleted |xargs -0 --no-run-if-empty rm -v
echo "Moving spam to Spam folder"
notmuch search --format=text0 --output=files tag:Spam and \
to:vasudev@copyninja.info | \
xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur
notmuch search --format=text0 --output=files tag:Spam and
to:vasudev-debian@copyninja.info | \
xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur
MDIR="vasudev-copyninja.info vasudev-debian Gmail-1"
mbsync -Va
notmuch new
for mdir in $MDIR; do
echo "Processing $mdir"
for fdir in $(ls -d /home/vasudev/Mail/$mdir/*); do
if [ $(basename $fdir) != "INBOX" ]; then
echo "Tagging for $(basename $fdir)"
notmuch tag +$(basename $fdir) -inbox -- folder:$mdir/$(basename $fdir)
fi
done
done
```
因此,在运行 `mbsync` 之前我搜索所有标记为“deleted”的邮件并将其从系统中删除。接下来我在我的帐户上查找标记为“Spam”的邮件并将其移动到“Spam”文件夹。你没看错这些邮件逃脱了垃圾邮件过滤器进入到我的收件箱并被我亲自标记为垃圾邮件。
运行 `mbsync` 后,我基于它们的文件夹标记邮件(搜索字符串 `folder:`)。这让我可以很容易地得到一个邮件列表的内容,而不需要记住列表地址。
### 阅读邮件
现在,我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格,所以我花了一些时间写了一个私有层,它将我所有的快捷键和分类集中在一个地方,而不会扰乱我的整个 `.spacemacs` 文件。你可以在 [notmuch-emacs-layer 仓库][1] 找到我的私有层的代码。
### 发送邮件
能阅读邮件这还不够,我们也需要能够回复邮件。而这是最近是我感到迷茫的一个略显棘手的部分,以至于不得不写这篇文章,这样我就不会再忘记了。(当然也不必在网络上参考一些过时的帖子。)
我的系统发送邮件使用 Postfix 作为 SMTP 客户端,使用我自己的 SMTP 服务器作为它的中继主机。中继的问题是,它不能是具有动态 IP 的主机。有两种方法可以允许具有动态 IP 的主机使用中继服务器, 一种是将邮件来源的 IP 地址放入 `my_network` 或第二个使用 SASL 身份验证。
我的首选方法是使用 SASL 身份验证。为此,我首先要为每台机器创建一个单独的账户,它将把邮件中继到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主账户,但 Jonas 给出了可行的按账户的想法)
```
adduser <hostname>_relay
```
这里替换 `<hostname>` 为你的笔记本电脑的名称或任何你正在使用的设备。现在我们需要调整 Postfix 作为中继服务器。因此,在 Postfix 配置中添加以下行:
```
# SASL authentication
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
smtp_sasl_tls_security_options = noanonymous
relayhost = [smtp.copyninja.info]:submission
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
```
因此, 这里的 `relayhost` 是用于将邮件转发到互联网的 Postfix 实例的服务器名称。`submission` 的部分 Postfix 将邮件转发到端口 587安全端口。`smtp_sasl_tls_security_options` 设置为不允许匿名连接。这是必须的,以便中继服务器信任你的移动主机,并同意为你转发邮件。
`/etc/postfix/sasl_passwd` 是你需要存储用于服务器 SASL 身份验证的帐户密码的文件。将以下内容放入其中。
```
[smtp.example.com]:submission user:password
```
用你已放入 `relayhost` 配置的 SMTP 服务器名称替换 `smtp.example.com`。用你创建的 `<hostname>_relay` 用户及其密码替换 `user``passwd`
若要保护 `sasl_passwd` 文件,并为 Postfix 创建它的哈希文件,使用以下命令。
```
chown root:root /etc/postfix/sasl_passwd
chmod 0600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
```
最后一条命令将创建 `/etc/postfix/sasl_passwd.db` 文件,它是你的文件的 `/etc/postfix/sasl_passwd` 的哈希文件,具有相同的所有者和权限。现在重新加载 Postfix并使用 `mail` 命令检查邮件是否从你的系统中发出。
### Bonus 的部分
好吧,因为我有一个脚本创建以上结合了邮件的同步和分类。我继续创建了一个 systemd 计时器,以定期同步后台的邮件。就我而言,每 10 分钟一次。下面是 `mailsync.timer` 文件。
```
[Unit]
Description=Check Mail Every 10 minutes
RefuseManualStart=no
RefuseManualStop=no
[Timer]
Persistent=false
OnBootSec=5min
OnUnitActiveSec=10min
Unit=mailsync.service
[Install]
WantedBy=default.target
```
下面是 mailsync.service 服务,这是 mailsync.timer 执行我们的脚本所需要的。
```
[Unit]
Description=Check Mail
RefuseManualStart=no
RefuseManualStop=yes
[Service]
Type=oneshot
ExecStart=/usr/local/bin/mail-sync
StandardOutput=syslog
StandardError=syslog
```
将这些文件置于 `/etc/systemd/user` 目录下并运行以下代码去开启它们:
```
systemctl enable --user mailsync.timer
systemctl enable --user mailsync.service
systemctl start --user mailsync.timer
```
这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew他审阅了这篇帖子。因此 下一步, 我将尝试使用 afew 改进我的 notmuch 配置,当然还会有一个后续的帖子:-)。
--------------------------------------------------------------------------------
via: https://copyninja.info/blog/email_setup.html
作者:[copyninja][a]
译者:[lixinyuxx](https://github.com/lixinyuxx)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://copyninja.info
[1]:https://source.copyninja.info/notmuch-emacs-layer.git/

View File

@ -1,11 +1,11 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: (geekpi) [#]: translator: (geekpi)
[#]: reviewer: ( ) [#]: reviewer: (wxy)
[#]: publisher: ( ) [#]: publisher: (wxy)
[#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It) [#]: subject: (How To Fix Broken Ubuntu OS Without Reinstalling It)
[#]: via: (https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/) [#]: via: (https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-it/)
[#]: author: (SK https://www.ostechnix.com/author/sk/) [#]: author: (SK https://www.ostechnix.com/author/sk/)
[#]: url: ( ) [#]: url: (https://linux.cn/article-10367-1.html)
如何不重装修复损坏的 Ubuntu 系统 如何不重装修复损坏的 Ubuntu 系统
====== ======
@ -18,29 +18,20 @@
首先,尝试使用 live cd 登录并**在外部驱动器中备份数据**。以防这个方法没用,你仍然可以获取数据并重新安装系统! 首先,尝试使用 live cd 登录并**在外部驱动器中备份数据**。以防这个方法没用,你仍然可以获取数据并重新安装系统!
在登录页上,按下 **CTRL+ALT+F1** 切换到 **tty1**。你可以在[**此处**][1]了解有关在 TTY 之间切换的更多信息。 在登录页上,按下 `CTRL+ALT+F1` 切换到 tty1。你可以在[此处][1]了解有关在 TTY 之间切换的更多信息。
现在,逐个输入以下命令来修复损坏的 Ubuntu Linux。 现在,逐个输入以下命令来修复损坏的 Ubuntu Linux。
``` ```
$ sudo rm /var/lib/apt/lists/lock $ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/lib/dpkg/lock $ sudo rm /var/lib/dpkg/lock
$ sudo rm /var/lib/dpkg/lock-frontend $ sudo rm /var/lib/dpkg/lock-frontend
$ sudo dpkg --configure -a $ sudo dpkg --configure -a
$ sudo apt clean $ sudo apt clean
$ sudo apt update --fix-missing $ sudo apt update --fix-missing
$ sudo apt install -f $ sudo apt install -f
$ sudo dpkg --configure -a $ sudo dpkg --configure -a
$ sudo apt upgrade $ sudo apt upgrade
$ sudo apt dist-upgrade $ sudo apt dist-upgrade
``` ```
@ -52,7 +43,7 @@ $ sudo reboot
你现在可以像往常一样登录到你的 Ubuntu 系统。 你现在可以像往常一样登录到你的 Ubuntu 系统。
我做完这些步骤后,我 Ubuntu 18.04 测试系统中的所有数据都还在,一切都之前的一样。此方法可能不适用于所有人。但是,这个小小的贴士对我有用,并且比重装节省了一些时间。如果你了解其他更好的方法,请在评论区告诉我。我也会在本指南中添加它们。 我做完这些步骤后,我 Ubuntu 18.04 测试系统中的所有数据都还在,一切都之前的一样。此方法可能不适用于所有人。但是,这个小小的技巧对我有用,并且比重装节省了一些时间。如果你了解其他更好的方法,请在评论区告诉我。我也会在本指南中添加它们。
这是这些了。希望这篇文章有用。 这是这些了。希望这篇文章有用。
@ -69,10 +60,10 @@ via: https://www.ostechnix.com/how-to-fix-broken-ubuntu-os-without-reinstalling-
作者:[SK][a] 作者:[SK][a]
选题:[lujun9972][b] 选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi) 译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/ [a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972 [b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/ [1]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/

View File

@ -1,6 +1,6 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: (geekpi) [#]: translator: (geekpi)
[#]: reviewer: ( ) [#]: reviewer: (wxy)
[#]: publisher: ( ) [#]: publisher: ( )
[#]: url: ( ) [#]: url: ( )
[#]: subject: (Patch into The Matrix at the Linux command line) [#]: subject: (Patch into The Matrix at the Linux command line)
@ -9,10 +9,12 @@
在命令行中步入黑客帝国 在命令行中步入黑客帝国
====== ======
使用 cmatrix 重建每个人最喜欢的 20 世纪 90 年代科幻电影中滚动代码的经典外观。
> 使用 cmatrix 重建每个人都喜欢的 20 世纪 90 年代科幻电影中滚动代码的经典外观。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cmatrix.png?itok=YlmbHVPr) ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cmatrix.png?itok=YlmbHVPr)
你发现了今天的命令行玩具日历。如果这是你第一次访问该系列,你可能想知道什么是命令行玩具?它可以是在命令行中任何可以娱乐的东西,可以是一个游戏,一个有趣的工具,或者一个消遣的东西。 这是今天的命令行玩具日历推荐项目。如果这是你第一次访问该系列,你可能想知道什么是命令行玩具?它可以是在命令行中任何可以娱乐的东西,可以是一个游戏,一个有趣的工具,或者一个消遣的东西。
其中一些是经典,有些是全新的(至少对我而言),但我希望你们所有人都能在这个系列中找到你喜欢的东西。 其中一些是经典,有些是全新的(至少对我而言),但我希望你们所有人都能在这个系列中找到你喜欢的东西。
@ -20,17 +22,19 @@
我想起 2019 年将是我青少年时期最喜欢的科幻电影之一[黑客帝国][1]的二十周年纪念日,它当时让我思考了未来将会发生什么。对于像我这样的痴迷计算机小孩来说,这是一个电脑程序员通过利用自己思维的力量崛起并成为虚拟宇宙中的动作英雄的终极故事。 我想起 2019 年将是我青少年时期最喜欢的科幻电影之一[黑客帝国][1]的二十周年纪念日,它当时让我思考了未来将会发生什么。对于像我这样的痴迷计算机小孩来说,这是一个电脑程序员通过利用自己思维的力量崛起并成为虚拟宇宙中的动作英雄的终极故事。
当时,没有一部电影对我来说似乎更具未来感。无论是故事本身,还是迷人的特效。即使意识到它是在二十多年前拍摄的也并没有改变我的想法。 当时,对我来说没有比这部电影更具未来感了。无论是故事本身,还是迷人的特效。即使意识到它是在二十多年前拍摄的也并没有改变我的想法。
今天将它带回我们的命令行玩具,让我们在终端用 **cmatrix** 重建黑客帝国中那向下滚动的代码流。 **cmatrix** 对我来说很容易安装,它在 Fedora 中被打包了,所以安装它只需: 今天将它带回我们的命令行玩具,让我们在终端用 `cmatrix` 重建黑客帝国中那向下滚动的代码流。 `cmatrix` 很容易安装,它在 Fedora 中被打包了,所以安装它只需:
``` ```
$ dnf install cmatrix $ dnf install cmatrix
``` ```
接着,只需在你的终端输入 **cmatrix** 即可运行。 接着,只需在你的终端输入 `cmatrix` 即可运行。
![](https://opensource.com/sites/default/files/uploads/linux-toy-cmatrix-animated.gif) ![](https://opensource.com/sites/default/files/uploads/linux-toy-cmatrix-animated.gif)
你可以在 [GitHub][2] 上找到使用 GPL 许可的 **cmatrix** 的源代码。
你可以在 [GitHub][2] 上找到使用 GPL 许可的 `cmatrix` 的源代码。
你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。评论留言让我知道,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。评论留言让我知道,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。
@ -43,7 +47,7 @@ via: https://opensource.com/article/18/12/linux-toy-cmatrix
作者:[Jason Baker][a] 作者:[Jason Baker][a]
选题:[lujun9972][b] 选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi) 译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -51,4 +55,4 @@ via: https://opensource.com/article/18/12/linux-toy-cmatrix
[b]: https://github.com/lujun9972 [b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/The_Matrix [1]: https://en.wikipedia.org/wiki/The_Matrix
[2]: https://github.com/abishekvashok/cmatrix [2]: https://github.com/abishekvashok/cmatrix
[3]: https://opensource.com/article/18/12/linux-toy-bash-prompt [3]: https://opensource.com/article/18/12/linux-toy-bash-prompt

View File

@ -1,3 +1,5 @@
Translating by wwhio
The Ruby Story The Ruby Story
====== ======
Ruby has always been one of my favorite languages, though Ive sometimes found it hard to express why that is. The best Ive been able to do is this musical analogy: Whereas Python feels to me like punk rock—its simple, predictable, but rigid—Ruby feels like jazz. Ruby gives programmers a radical freedom to express themselves, though that comes at the cost of added complexity and can lead to programmers writing programs that dont make immediate sense to other people. Ruby has always been one of my favorite languages, though Ive sometimes found it hard to express why that is. The best Ive been able to do is this musical analogy: Whereas Python feels to me like punk rock—its simple, predictable, but rigid—Ruby feels like jazz. Ruby gives programmers a radical freedom to express themselves, though that comes at the cost of added complexity and can lead to programmers writing programs that dont make immediate sense to other people.

View File

@ -1,3 +1,4 @@
zjon is translating
7 Best eBook Readers for Linux 7 Best eBook Readers for Linux
====== ======
**Brief:** In this article, we are covering some of the best ebook readers for Linux. These apps give a better reading experience and some will even help in managing your ebooks. **Brief:** In this article, we are covering some of the best ebook readers for Linux. These apps give a better reading experience and some will even help in managing your ebooks.

View File

@ -1,113 +0,0 @@
translating by lixinyuxx
27 open solutions to everything in education
======
![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo)
Openness (from open source software, to open hardware, to open principles) is changing the paradigm of education. So, to celebrate all that's gone on this year, I collected 27 of the best articles published on Opensource.com in 2017 on the subject. I divided them into broad themes, rather than ordering them by popularity. And, if these 27 stories don't satisfy your appetite for information about open source in education, check out our companion article on how [education is leveraging Raspberry Pi and Linux][30].
### Open is better for everyone
1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt reviews David Price's book OPEN, which explores the idea that "open" isn't just a technological shift, rather it's "how we'll work, live, and learn in the future."
2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur points out how to get ahead in the workforce by learning open source. This advice isn't just for programmers; designers, writers, marketers, and other creative professionals are also essential to the success of open source.
3. [A graduate degree could springboard you into an open source job][3]: Citing research that shows that Linux skills lead to higher pay, Joshua Pearce makes the case that open source proficiency and a graduate degree are an unbeatable career combination.
4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger shows us how open practices are creating a more inclusive, agile, and open culture in a Pennsylvania school district. Charlie says it's not just about saving money; the district also gains from "open leadership principles that foster innovation among teachers and students, help to better engage the community, and create a more vibrant and inclusive learning community."
5. [15 ways to empower students with open source tools][5]: I write how open source gives students the freedom to explore, tinker, and learn, whether they're learning basic digital literacy or expanding on those skills with fun projects.
6. [Developer opportunities to code for good][6]: Open source is often the backbone of socially beneficial projects. As Ahn Bui, vice president of Benetech Labs, states in this interview: "Establishing open data standards is an integral step in breaking down data silos. Those open standards will provide the foundation for interoperability and in turn, translate to more organizations building together, often more cost effectively. The ultimate goal is to serve more people at the same cost or even less."
### Open education resources for remixing and reusing
1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis, director of programs for Wiki Ed, discusses how open educational resources (OERs), such as Wiki Ed, are providing high-quality and affordable open source learning resources as classroom teaching tools.
2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green, director of open education for Creative Commons, shares how the face of education is changing in higher education and what Creative Commons is doing to facilitate it.
3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites, community evangelist and chief marketing officer of Open Up Resources, talks about the nonprofit organization's efforts to provide open, standards-aligned curricula for K-12 schools.
4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke, educational technologist at the University of Hawaii at Manoa, says that transitioning to OER in college courses will "empower faculty to take control of what content they teach with, which we expect will result in their saving students money."
5. [How open courses are slashing the cost of higher education][11]: Saylor Academy's director of education Devon Ritter reports how Saylor is building its college credit-eligible courses on openly licensed content, with the goal of making higher education affordable and accessible to more people.
6. [Open educational resources movement gains speed][12]: Alexis Clifton, executive director of the State University of New York OER Services, describes how New York's US$ 8 million investment is spurring growth in open education and making college more affordable.
7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik from Duke University explores OSPRI (Open Source Pedagogy Research and Innovation), a collaboration between Duke and Red Hat that's building a 21st-century, preK-12 learning ecosystem that is open by design.
8. [Perma.cc stops scholarly link rot][14]: Virginia Tech's Phillip Young writes about Perma.cc, a solution to "link rot," which is the high probability that hyperlinks in academic papers will disappear or change over time.
9. [Open education: How students save money by creating open textbooks][15]: OER pioneer Robin DeRosa talks about "the freedom that the openly licensed textbook introduced, and the overarching idea that education and learning should be contextualized in inclusive ecosystems that enhance the public good."
### Open source tools in the classroom
1. [How an open source board game is saving the planet][16]: Joshua Pearce writes about Save the Planet, a board game that empowers students to solve environmental problems while having fun and contributing to the maker community.
2. [A new Android app for teaching kids how to read][17]: Michael Hall talks about Phoenicia, a children's literacy app he developed after his son was diagnosed with autism, the value of coding for good, and why user testing matters more than you think.
3. [8 open source Android apps for education][18]: Joshua Allen Holm challenges us to use our smartphones as learning tools by recommending eight open source apps from the F-Droid repository to try.
4. [3 open source alternatives to MATLAB][19]: Jason Baker's update to his 2016 survey of open source mathematical computing software presents alternatives to MATLAB, the expensive, proprietary solution nearly ubiquitous in mathematics, physical sciences, engineering, and economics.
5. [What does SVG have to do with teaching kids to code?][20] Retired engineer Jay Nick talks about how he uses art as a creative way to introduce students to coding. He volunteers in schools, using Scalable Vector Graphics (SVG) to teach an approach to coding that combines principles of mathematics and art.
6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, who holds a PhD in fine arts from Texas Tech, shares his experience using open source tools in a world ruled by proprietary solutions. Kyle says there's a bias against using open source in disciplines outside of computer science: "Many people think non-technical students can't use Linux, and they make a lot of assumptions about people who use it in their advanced degree programs. … Well, it is possible, and I'm proof."
7. [A list of open source tools for college][22]: Aaron Cocker outlines the open source tools (including presentation, backup, and programming software) he uses while working on his undergraduate degree in computer science.
8. [5 great KDE apps to help you study][23]: Zsolt Szakács offers five KDE applications that help anyone who wants to learn new skills or cultivate existing ones.
### Coding in the classroom
1. [How to get the next generation coding early][24]: Bryson Payne says we need to teach kids to code before high school: By ninth grade 80% of girls and 60% of boys have already self-selected out of a STEM career. But it's not only about jobs and closing the IT skills gap, he suggests. "Teaching a young person to code could be the single most life-changing skill you can give them. And it's not just a career-enhancer. Coding is about problem-solving, it's about creativity, and more importantly, it's about empowerment."
2. [Kids can't code without computers][25]: Patrick Masson introduces the FLOSS Desktops for Kids program, which teaches students at underserved schools to repurpose older computers with open source software, such as Linux, LibreOffice, and GIMP. Not only is the program breathing new life into broken or decommissioned hardware, it's also giving students important skills that may translate into future careers.
3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva offers suggestions for using [Scratch][27] to spark kids' interest in programming, just as LOGO did when he started using it in the 1980s.
4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger describes App Inventor, a programming framework for building Android applications using a visual blocks language (similar to Scratch or [Snap][29]).
Throughout the year we learned that there is an open solution to everything in education, and I expect this theme to continue in 2018 and beyond. Are there open education topics you'd like Opensource.com to cover in the coming year? If so, please share your ideas in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/1/best-open-education
作者:[Don Watkins][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/don-watkins
[1]:https://opensource.com/article/17/7/book-review-open
[2]:https://opensource.com/article/17/8/jump-start-your-career
[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab
[4]:https://opensource.com/article/17/7/open-school-leadership
[5]:https://opensource.com/article/17/7/empower-students-open-source-tools
[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs
[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation
[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons
[9]:https://opensource.com/article/17/1/open-up-resources
[10]:https://opensource.com/article/17/2/interview-education-billy-meinke
[11]:https://opensource.com/article/17/7/college-alternatives
[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton
[13]:https://opensource.com/article/17/3/education-should-be-open-design
[14]:https://opensource.com/article/17/9/stop-link-rot-permacc
[15]:https://opensource.com/article/17/11/creating-open-textbooks
[16]:https://opensource.com/article/17/7/save-planet-board-game
[17]:https://opensource.com/article/17/4/phoenicia-education-software
[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education
[19]:https://opensource.com/alternatives/matlab
[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam
[21]:https://opensource.com/article/17/5/how-linux-higher-education
[22]:https://opensource.com/article/17/6/open-source-tools-university-student
[23]:https://opensource.com/article/17/6/kde-education-software
[24]:https://opensource.com/article/17/8/teach-kid-code-change-life
[25]:https://opensource.com/article/17/9/floss-desktops-kids
[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids
[27]:https://scratch.mit.edu/
[28]:https://opensource.com/article/17/8/app-inventor-android-app-development
[29]:http://snap.berkeley.edu/
[30]:https://opensource.com/article/17/12/best-opensourcecom-linux-and-raspberry-pi-education

View File

@ -1,202 +0,0 @@
Translating by ScarboroughCoral
How to turn on an LED with Fedora IoT
======
![](https://fedoramagazine.org/wp-content/uploads/2018/08/LED-IoT-816x345.jpg)
Do you enjoy running Fedora, containers, and have a Raspberry Pi? What about using all three together to play with LEDs? This article introduces Fedora IoT and shows you how to install a preview image on a Raspberry Pi. Youll also learn how to interact with GPIO in order to light up an LED.
### What is Fedora IoT?
Fedora IoT is one of the current Fedora Project objectives, with a plan to become a full Fedora Edition. The result will be a system that runs on ARM (aarch64 only at the moment) devices such as the Raspberry Pi, as well as on the x86_64 architecture.
![][1]
Fedora IoT is based on OSTree, like [Fedora Silverblue][2] and the former [Atomic Host][3].
### Download and install Fedora IoT
The official Fedora IoT images are coming with the Fedora 29 release. However, in the meantime you can download a [Fedora 28-based image][4] for this experiment.
You have two options to install the system: either flash the SD card using a dd command, or use a fedora-arm-installer tool. The Fedora Wiki offers more information about [setting up a physical device][5] for IoT. Also, remember that you might need to resize the third partition.
Once you insert the SD card into the device, youll need to complete the installation by creating a user. This step requires either a serial connection, or a HDMI display with a keyboard to interact with the device.
When the system is installed and ready, the next step is to configure a network connection. Log in to the system with the user you have just created choose one of the following options:
* If you need to configure your network manually, run a command similar to the following. Remember to use the right addresses for your network:
```
$ nmcli connection add con-name cable ipv4.addresses \
192.168.0.10/24 ipv4.gateway 192.168.0.1 \
connection.autoconnect true ipv4.dns "8.8.8.8,1.1.1.1" \
type ethernet ifname eth0 ipv4.method manual
```
* If theres a DHCP service on your network, run a command like this:
```
$ nmcli con add type ethernet con-name cable ifname eth0
```
### **The GPIO interface in Fedora**
Many tutorials about GPIO on Linux focus on a legacy GPIO sysfis interface. This interface is deprecated, and the upstream Linux kernel community plan to remove it completely, due to security and other issues.
The Fedora kernel is already compiled without this legacy interface, so theres no /sys/class/gpio on the system. This tutorial uses a new character device /dev/gpiochipN provided by the upstream kernel. This is the current way of interacting with GPIO.
To interact with this new device, you need to use a library and a set of command line interface tools. The common command line tools such as echo or cat wont work with this device.
You can install the CLI tools by installing the libgpiod-utils package. A corresponding Python library is provided by the python3-libgpiod package.
### **Creating a container with Podman**
[Podman][6] is a container runtime with a command line interface similar to Docker. The big advantage of Podman is it doesnt run any daemon in the background. Thats especially useful for devices with limited resources. Podman also allows you to start containerized services with systemd unit files. Plus, it has many additional features.
Well create a container in these two steps:
1. Create a layered image containing the required packages.
2. Create a new container starting from our image.
First, create a file Dockerfile with the content below. This tells podman to build an image based on the latest Fedora image available in the registry. Then it updates the system inside and installs some packages:
```
FROM fedora:latest
RUN  dnf -y update
RUN  dnf -y install libgpiod-utils python3-libgpiod
```
You have created a build recipe of a container image based on the latest Fedora with updates, plus packages to interact with GPIO.
Now, run the following command to build your base image:
```
$ sudo podman build --tag fedora:gpiobase -f ./Dockerfile
```
You have just created your custom image with all the bits in place. You can play with this base container images as many times as you want without installing the packages every time you run it.
### Working with Podman
To verify the image is present, run the following command:
```
$ sudo podman images
REPOSITORY                 TAG        IMAGE ID       CREATED          SIZE
localhost/fedora           gpiobase   67a2b2b93b4b   10 minutes ago  488MB
docker.io/library/fedora   latest     c18042d7fac6   2 days ago     300MB
```
Now, start the container and do some actual experiments. Containers are normally isolated and dont have an access to the host system, including the GPIO interface. Therefore, you need to mount it inside while starting the container. To do this, use the device option in the following command:
```
$ sudo podman run -it --name gpioexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash
```
You are now inside the running container. Before you move on, here are some more container commands. For now, exit the container by typing exit or pressing **Ctrl+D**.
To list the the existing containers, including those not currently running, such as the one you just created, run:
```
$ sudo podman container ls -a
CONTAINER ID   IMAGE             COMMAND     CREATED          STATUS                              PORTS   NAMES
64e661d5d4e8   localhost/fedora:gpiobase   /bin/bash 37 seconds ago Exited (0) Less than a second ago           gpioexperiment
```
To create a new container, run this command:
```
$ sudo podman run -it --name newexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash
```
Delete it with the following command:
```
$ sudo podman rm newexperiment
```
### **Turn on an LED**
Now you can use the container you already created. If you exited from the container, start it again with this command:
```
$ sudo podman start -ia gpioexperiment
```
As already discussed, you can use the CLI tools provided by the libgpiod-utils package in Fedora. To list the available GPIO chips, run:
```
$ gpiodetect
gpiochip0 [pinctrl-bcm2835] (54 lines)
```
To get the list of the lines exposed by a specific chip, run:
```
$ gpioinfo gpiochip0
```
Notice theres no correlation between the number of physical pins and the number of lines printed by the previous command. Whats important is the BCM number, as shown on [pinout.xyz][7]. It is not advised to play with the lines that dont have a corresponding BCM number.
Now, connect an LED to the physical pin 40, that is BCM 21. Remember: the shorter leg of the LED (the negative leg, called the cathode) must be connected to a GND pin of the Raspberry Pi with a 330 ohm resistor, and the long leg (the anode) to the physical pin 40.
To turn the LED on, run the following command. It will stay on until you press **Ctrl+C** :
```
$ gpioset --mode=wait gpiochip0 21=1
```
To light it up for a certain period of time, add the -b (run in the background) and -s NUM (how many seconds) parameters, as shown below. For example, to light the LED for 5 seconds, run:
```
$ gpioset -b -s 5 --mode=time gpiochip0 21=1
```
Another useful command is gpioget. It gets the status of a pin (high or low), and can be useful to detect buttons and switches.
![Closeup of LED connection with GPIO][8]
### **Conclusion**
You can also play with LEDs using Python — [there are some examples here][9]. And you can also use the i2c devices inside the container as well. In addition, Podman is not strictly related to this Fedora edition. You can install it on any existing Fedora Edition, or try it on the two new OSTree-based systems in Fedora: [Fedora Silverblue][2] and [Fedora CoreOS][10].
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/turnon-led-fedora-iot/
作者:[Alessio Ciregia][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: http://alciregi.id.fedoraproject.org/
[1]: https://fedoramagazine.org/wp-content/uploads/2018/08/oled-1024x768.png
[2]: https://teamsilverblue.org/
[3]: https://www.projectatomic.io/
[4]: https://kojipkgs.fedoraproject.org/compose/iot/latest-Fedora-IoT-28/compose/IoT/
[5]: https://fedoraproject.org/wiki/InternetOfThings/GettingStarted#Setting_up_a_Physical_Device
[6]: https://github.com/containers/libpod
[7]: https://pinout.xyz/
[8]: https://fedoramagazine.org/wp-content/uploads/2018/08/breadboard-1024x768.png
[9]: https://github.com/brgl/libgpiod/tree/master/bindings/python/examples
[10]: https://coreos.fedoraproject.org/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: ( ) [#]: translator: (geekpi)
[#]: reviewer: ( ) [#]: reviewer: ( )
[#]: publisher: ( ) [#]: publisher: ( )
[#]: url: ( ) [#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: ( ) [#]: translator: (qhwdw)
[#]: reviewer: ( ) [#]: reviewer: ( )
[#]: publisher: ( ) [#]: publisher: ( )
[#]: url: ( ) [#]: url: ( )

View File

@ -7,138 +7,136 @@
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: url: ( ) [#]: url: ( )
Celebrate Christmas In Linux Way With These Wallpapers 使用这些壁纸以 Linux 的方式庆祝圣诞节
====== ======
Its the holiday season and many of you might be celebrating Christmas already. From the team of Its FOSS, I would like to wish you a Merry Christmas and a happy new year. 当前正是假日季节,很多人可能已经在庆祝圣诞节了。我代表 It's FOSS 团队祝你圣诞快乐,新年快乐。
To continue the festive mood, Ill show you some really awesome [Linux wallpapers][1] on Christmas theme. But before we see that, how about a Christmas Tree in Linux terminal. 为了延续节日氛围,我将向你展示一些非常棒的圣诞主题 [Linux壁纸][1]。在呈现这些壁纸之前,先来看一棵 Linux 终端下的圣诞树。
### Display Christmas Tree in Linux Terminal ### 在 Linux 终端下显示圣诞树
<https://giphy.com/embed/xUNda6KphvbpYxL3tm> 圣诞树的效果如 [这个页面](https://giphy.com/embed/xUNda6KphvbpYxL3tm) 所示。
If you want to display an animated Christmas tree in the terminal, you can use the command below: 使用以下命令在终端中显示一棵动画圣诞树:
``` ```
curl https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh | bash curl https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh | bash
``` ```
If you dont want to get it from the internet all the time, you can get the shell script from its GitHub repository, change the permission and run it like a normal shell script. 要是不想一直从互联网上获取这棵圣诞树,也可以从它的 [GitHub 仓库][2] 中获取对应的 shell 脚本,更改权限之后按照运行普通 shell 脚本的方式运行它。
[ChristBASHTree][2] ### 使用 Perl 在 Linux 终端下显示圣诞树
### Display Christmas Tree in Linux terminal using Perl
[![Christmas Tree in Linux terminal by NixCraft][3]][4] [![Christmas Tree in Linux terminal by NixCraft][3]][4]
This trick was originally shared by [NixCraft][5]. Youll need to install a Perl module for this. 这个技巧最初由 [NixCraft][5] 分享,你需要为此安装 Perl 模块。
To be honest, I dont like using Perl modules because uninstalling them is a real pain. So **use this Perl module knowing that youll have to manually remove it**. 说实话,我不喜欢使用 Perl 模块,因为卸载它们真的很痛苦。所以使用这个 Perl 模块时需谨记,你必须手动移除它。
``` ```
perl -MCPAN -e 'install Acme::POE::Tree' perl -MCPAN -e 'install Acme::POE::Tree'
``` ```
You can read the original article [here][5] to know more about it. 你可以阅读 [原文][5] 来了解更多信息。
## Download Linux Christmas Wallpapers ## 下载 Linux 圣诞主题壁纸
All these Linux Christmas wallpapers are created by Mark Riedesel and you can find plenty of other artwork on [his website][6]. 所有这些 Linux 圣诞主题壁纸都是由 Mark Riedesel 制作的,你可以在 [他的网站][6] 上找到很多其他艺术品。
He has been making such wallpapers almost every year since 2002. Quite understandably some of the earliest wallpapers dont have modern aspect ratio. I have put them up in reverse chronological order. 自 2002 年以来,他几乎每年都在制作这样的壁纸。可以理解的是,最早的一些壁纸不具有现代的宽高比。我把它们按时间倒序排列。
One tiny note. The images displayed here are highly compressed so download the wallpapers from the provided link only. 注意一个小地方,这里显示的图片都是高度压缩的,因此你要通过图片下方提供的链接进行下载。
![Christmas Linux Wallpaper][7] ![Christmas Linux Wallpaper][7]
[Download This Wallpaper][8] [下载此壁纸][8]
[![Christmas Linux Wallpapers][9]][10] [![Christmas Linux Wallpapers][9]][10]
[Download This Wallpaper][11] [下载此壁纸][11]
[![Christmas Linux Wallpapers][12]][13] [![Christmas Linux Wallpapers][12]][13]
[Download This Wallpaper][14] [下载此壁纸][14]
[![Christmas Linux Wallpapers][15]][16] [![Christmas Linux Wallpapers][15]][16]
[Download This Wallpaper][17] [下载此壁纸][17]
[![Christmas Linux Wallpapers][18]][19] [![Christmas Linux Wallpapers][18]][19]
[Download This Wallpaper][20] [下载此壁纸][20]
[![Christmas Linux Wallpapers][21]][22] [![Christmas Linux Wallpapers][21]][22]
[Download This Wallpaper][23] [下载此壁纸][23]
[![Christmas Linux Wallpapers][24]][25] [![Christmas Linux Wallpapers][24]][25]
[Download This Wallpaper][26] [下载此壁纸][26]
[![Christmas Linux Wallpapers][27]][28] [![Christmas Linux Wallpapers][27]][28]
[Download This Wallpaper][29] [下载此壁纸][29]
[![Christmas Linux Wallpapers][30]][31] [![Christmas Linux Wallpapers][30]][31]
[Download This Wallpaper][32] [下载此壁纸][32]
[![Christmas Linux Wallpapers][33]][34] [![Christmas Linux Wallpapers][33]][34]
[Download This Wallpaper][35] [下载此壁纸][35]
[![Christmas Linux Wallpapers][36]][37] [![Christmas Linux Wallpapers][36]][37]
[Download This Wallpaper][38] [下载此壁纸][38]
[![Christmas Linux Wallpapers][39]][40] [![Christmas Linux Wallpapers][39]][40]
[Download This Wallpaper][41] [下载此壁纸][41]
[![Christmas Linux Wallpapers][42]][43] [![Christmas Linux Wallpapers][42]][43]
[Download This Wallpaper][44] [下载此壁纸][44]
[![Christmas Linux Wallpapers][45]][46] [![Christmas Linux Wallpapers][45]][46]
[Download This Wallpaper][47] [下载此壁纸][47]
[![Christmas Linux Wallpapers][48]][49] [![Christmas Linux Wallpapers][48]][49]
[Download This Wallpaper][50] [下载此壁纸][50]
### Bonus: Linux Christmas carols ### 福利Linux 圣诞颂歌
Here is a bonus for you. Christmas carols Linuxified for Linux lovers like us. 这是给你的一份福利,给像我们一样的 Linux 爱好者的关于 Linux 的圣诞颂歌。
In [an article on Computer World][51], [Sandra Henry-Stocker][52] shared such Christmas carols. An excerpt: 在 [计算机世界的一篇文章][51] 中,[Sandra Henry-Stocker][52] 分享了这些圣诞颂歌。摘录片段如下:
To the tune of: [Chestnuts Roasting on an Open Fire][53] 这一段用的 [Chestnuts Roasting on an Open Fire][53] 的曲调:
> Running merrily on open source > Running merrily on open source
> With users happy as can be > With users happy as can be
> Were using Linux and getting lots done > Were using Linux and getting lots done
> And happy everything is free > And happy everything is free
To the tune of: [The Twelve Days of Christmas][54] 这一段用的 [The Twelve Days of Christmas][54] 的曲调:
> On my first day with Linux, my admin gave to me a password and a login ID > On my first day with Linux, my admin gave to me a password and a login ID
> On my second day with Linux my admin gave to me two new commands and a password and a login ID > On my second day with Linux my admin gave to me two new commands and a password and a login ID
You can read full carols [here][51]. 在 [这里][51] 阅读完整的颂歌。
Merry Linux to you!! 祝你享受 Linux
-------------------------------------------------------------------------------- ------
via: https://itsfoss.com/christmas-linux-wallpaper/ via: https://itsfoss.com/christmas-linux-wallpaper/
作者:[Abhishek Prakash][a] 作者:[Abhishek Prakash][a]
选题:[lujun9972][b] 选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID) 译者:[jlztan](https://github.com/jlztan)
校对:[校对者ID](https://github.com/校对者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,235 +0,0 @@
我的个人电子邮件系统 - Notmuch mbsyncpostfix and dovecot
======
我使用个人电子邮件系统已经相当长的时间了, 没有文字记录。最近当我换了我的笔记本电脑(职业变更做的变动)我在试图重新创建本地邮件设置时迷茫了。所以这篇文章是一个自己的文档, 这样我就不用费劲就能修正过来。
### 服务器端
我运行自己的邮件服务器, 并使用 Postfix 作为 SMTP 服务器和用 Dovecot 实现 IMAP 。我不打算详细介绍如何配置这些设置, 因为我的设置主要是通过使用 Jonas 为 Redpill 基础架构创建的脚本完成的。什么是 Redpill (用 Jonas 自己的话说)
> <jonas> Redpill 是一个概念 - 一种设置 Debian hosts 去跨组织协作的方式<jonas> 我延申了这个概念, 并将其首次使用 Redpill 去联网 redpill.dk 涉及我自己的网络 (jones.dk) 我的主要客户的网络 (homebase.dk),在德国的一个网络, 包括Skolelinux Germany (free-owl.de) 和 Vasudev 的网络 (copyninja.info)
除此之外, 我还有一个 dovecot sieve 过滤, 根据邮件的来源, 对高级邮件进行分类, 并将其分类到各种文件夹中。所有的规则都存在于每个有邮件地址的账户下的 ~/dovecot.sieve文件中。
再次, 我不详细介绍如何设置这些东西, 因为这不是我这个帖子的目标。
### 在我的笔记本电脑上
在我的笔记本电脑上我已经按照4个部分设置
1. 邮件同步: 使用 mbsync 命令完成
2. 分类: 使用 notmuch 完成
3. 阅读: 使用 notmuch-emacs 完成
4. 邮件发送: 使用作为转接服务器和 SMTP 客户端运行的 postfix 完成。
### 邮件同步
邮件同步是使用 mbsync 工具完成的, 我以前是 OfflineIMAP 的用户,最近切换到 mbsync因为我觉得它比 OfflineIMAP 的配置更轻,更简单。命令是由包 isync 提供的。
配置文件是 ~/.mbsyncrc. 下面是我的例子与一些个人设置。
```
IMAPAccount copyninja
Host imap.copyninja.info
User vasudev
PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg"
SSLType IMAPS
SSLVersion TLSv1.2
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPAccount gmail-kamathvasudev
Host imap.gmail.com
User kamathvasudev@gmail.com
PassCmd "gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ~/path/to/passphrase.txt -d ~/path/to/mailpass.gpg"
SSLType IMAPS
SSLVersion TLSv1.2
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore copyninja-remote
Account copyninja
IMAPStore gmail-kamathvasudev-remote
Account gmail-kamathvasudev
MaildirStore copyninja-local
Path ~/Mail/vasudev-copyninja.info/
Inbox ~/Mail/vasudev-copyninja.info/INBOX
MaildirStore gmail-kamathvasudev-local
Path ~/Mail/Gmail-1/
Inbox ~/Mail/Gmail-1/INBOX
Channel copyninja
Master :copyninja-remote:
Slave :copyninja-local:
Patterns *
Create Both
SyncState *
Sync All
Channel gmail-kamathvasudev
Master :gmail-kamathvasudev-remote:
Slave :gmail-kamathvasudev-local:
# Exclude everything under the internal [Gmail] folder, except the interesting folders
Patterns * ![Gmail]*
Create Both
SyncState *
Sync All
```
对上述配置中的一些有趣部分进行说明。一个是 PassCmd 它允许你提供 shell 命令来获取帐户的密码。这样可以避免在配置文件中填写密码。我在我磁盘上的一些地方使用对称加密 gpg 和存储密码。这当然是由 Unix ACL 保护安全。
实际上, 我想使用我的公钥加密文件, 但当脚本在后台或通过 systemd 运行时, 解锁文件看起来很困难 (或看起来几乎不可能)。如果你有更好的建议, 我洗耳恭听:-)。
下一个指令部分是模式。这使你可以有选择地同步来自邮件服务器的邮件。这对我来说真的很有帮助, 可以排除所有的垃圾 [Gmail]/ folders.
### 邮件分类
一旦邮件在你本地的设备, 我们需要一种方法来轻松地在邮件读取器中读取邮件。我最初的设置使用本地 dovecot 实例提供同步 Maildir 并在 Gnus 中阅读。这种设置相比于设置所有服务器软件是有点大题小作, 但 Gnus 无法很好地应付 maildir 格式, 这是最好的方法。这个设置也有一个缺点, 那就是在你有大量邮件要看的时候快速搜索邮件。这是为数不多的情况。
不多的情况下我想很容易索引通过千兆字节的邮件档案, 并得到我需要的东西。我已经创建了一个小脚本, 它结合了执行 mbsync 和 notmuch 执行语句。我基于 Maildirs 标记邮件, 实际上是创建在服务器端使用 dovecot sieve 。下面是我的完整 shell 脚本, 它正在执行同步分类和删除垃圾邮件的任务。
```
#!/bin/sh
MBSYNC=$(pgrep mbsync)
NOTMUCH=$(pgrep notmuch)
if [ -n "$MBSYNC" -o -n "$NOTMUCH" ]; then
echo "Already running one instance of mail-sync. Exiting..."
exit 0
fi
echo "Deleting messages tagged as *deleted*"
notmuch search --format=text0 --output=files tag:deleted |xargs -0 --no-run-if-empty rm -v
echo "Moving spam to Spam folder"
notmuch search --format=text0 --output=files tag:Spam and \
to:vasudev@copyninja.info | \
xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur
notmuch search --format=text0 --output=files tag:Spam and
to:vasudev-debian@copyninja.info | \
xargs -0 -I {} --no-run-if-empty mv -v {} ~/Mail/vasudev-copyninja.info/Spam/cur
MDIR="vasudev-copyninja.info vasudev-debian Gmail-1"
mbsync -Va
notmuch new
for mdir in $MDIR; do
echo "Processing $mdir"
for fdir in $(ls -d /home/vasudev/Mail/$mdir/*); do
if [ $(basename $fdir) != "INBOX" ]; then
echo "Tagging for $(basename $fdir)"
notmuch tag +$(basename $fdir) -inbox -- folder:$mdir/$(basename $fdir)
fi
done
done
```
因此, 在运行 mbsync 之前, 我搜索所有标记为已删除的邮件, 并将其从系统中删除。接下来, 我在我的帐户上查找标记为 "垃圾邮件" 的邮件, 并将其移动到垃圾邮件文件夹。你做的对,这些邮件逃脱垃圾邮件过滤器进到我的 inbox ,并被我亲自标记为垃圾邮件。
运行 mbsync 后, 我基于他们的文件夹标记邮件 (搜索字符串文件夹:)。这让我可以很容易地得到一个邮件列表的内容, 而不需要记住列表地址。
### 阅读邮件
现在, 我们已经实现同步和分类邮件,是时候来设置阅读部分。我使用 notmuch-emacs 界面来阅读邮件。我使用 emacs 的 Spacemacs 风格, 所以我花了一些时间写下一个私有层private layer它将我所有的快捷键和分类集中在一个地方 不会扰乱我的整个. spacemacs 文件。你可以在 [notmuch-emacs-layer repository][1] 找到我私有层的代码。
### 发送邮件
如果我们能阅读邮件, 我们就需要能够回复邮件, 这还不够。而这是最近是我感到迷茫的一个略显棘手的部分, 不得不写这篇文章, 这样我就不会再忘记了。(当然也不必在网络上引用一些过时的帖子)。
我的设置发送邮件使用 postfix 作为 SMTP 客户端与我自己的 SMTP 服务器作为它的转接主机。转接的问题是, 它不是具有动态 IP 的主机。有几种方法可以允许具有动态 ip 的主机使用转接服务器, 一种是将邮件从其中发源于 my_network 或第二个使用 SASL 身份验证的 IP 地址。
我的首选方法是使用 SASL 身份验证。为此, 我首先要为每台机器创建一个单独的账户, 它将把邮件传递到我的主服务器上。想法是不使用我的主帐户 SASL 进行身份验证。(最初我使用的是主要账户, 但 Jonas 给出了每个可行账户的想法)
```
adduser <hostname>_relay
```
这里替换 <hostname> 与你的笔记本电脑的名称或任何你正在使用的设备。现在我们需要调整 postfix 作为转接服务器。因此, 在 postfix 配置中添加以下行
```
# SASL authentication
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
smtp_sasl_tls_security_options = noanonymous
relayhost = [smtp.copyninja.info]:submission
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
```
因此, 这里的 relayhost 是你的 postfix 实例将用于邮件转发到互联网的服务器名称。submission 的部分 postfix 将邮件转发到端口 587 (安全)。smtp_sasl_tls_security_options 设置为不允许匿名连接。这必须使转接服务器信任你的移动主机, 并同意为你转发邮件。
/etc/postfix/sasl__asswd 是你需要存储用于服务器 SASL 身份验证的帐户密码的文件。将以下内容放入其中。
```
[smtp.example.com]:submission user:password
```
用你的 SMTP 服务器名称替换 smtp.example.com ,你已输入的 relayhost 认证。 用你创建的用户及其密码替换 user with <hostname>_relay 。
若要保护 sasl_passwd 文件, 并创建它的 hash哈希 进行 postfix 使用以下命令。
```
chown root:root /etc/postfix/sasl_passwd
chmod 0600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
```
最后的命令将创建 /etc/postfix/sasl_passwd.db 文件是你的文件的 hash /etc/postfix/sasl_passwd 具有相同的所有者和权限。现在重新加载 postfix 并检查邮件是否使用邮件命令从你的系统中取出。
### Bonus 的部分
好吧, 因为我有一个脚本创建以上结合了邮件的同步和分类。我继续创建了一个 systemd 计时器, 以定期同步后台的邮件。就我而言, 每10分钟一次。下面是 mailsync.timer 文件。
```
[Unit]
Description=Check Mail Every 10 minutes
RefuseManualStart=no
RefuseManualStop=no
[Timer]
Persistent=false
OnBootSec=5min
OnUnitActiveSec=10min
Unit=mailsync.service
[Install]
WantedBy=default.target
```
下面是 mailsync. 服务, 这是邮件同步计时器执行我们的脚本所需要的。
```
[Unit]
Description=Check Mail
RefuseManualStart=no
RefuseManualStop=yes
[Service]
Type=oneshot
ExecStart=/usr/local/bin/mail-sync
StandardOutput=syslog
StandardError=syslog
```
将这些文件置于 /etc/systemd/user 目录下并运行以下代码去开启它们
```
systemctl enable --user mailsync.timer
systemctl enable --user mailsync.service
systemctl start --user mailsync.timer
```
这就是我从系统同步和发送邮件的方式。我从 Jonas Smedegaard 那里了解到了 afew ,他同时阅读了这篇帖子。因此, 下一步, 我将尝试使用 afew 改进我的 notmuch 配置, 当然还会有一个后续的帖子:-)。
--------------------------------------------------------------------------------
via: https://copyninja.info/blog/email_setup.html
作者:[copyninja][a]
译者:[lixinyuxx](https://github.com/lixinyuxx)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://copyninja.info
[1]:https://source.copyninja.info/notmuch-emacs-layer.git/

View File

@ -0,0 +1,110 @@
27个解决教学问题的开放式方法
======
![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo)
开放式理念 (从开源软件到开放硬件, 再到开放原则) 正在改变教育的范式。因此, 为了庆祝今年发生的一切, 我收集了2017年在 Opensource.com 上发表的27篇关于这个主题的最好的文章。我把它们分成明确的主题 而不是按人气来分类。而且, 如果这27个故事不能满足你对教育公开信息的胃口 那就看看我们的合作文章吧 “ [education is leveraging Raspberry Pi and Linux][30]”
### 开放对每个人都有好处
1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt 评价David Price 的书 'OPEN' ,该书探讨了 “开放” 不仅仅是技术转变的观点, 而是 “我们未来将如何工作、生活和学习”。
2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur 指出了如何利用开放式学习在工作群体中脱颖而出。 这个建议不仅仅是针对程序员的, 而是针对程序员的。设计师、作家、营销人员和其他创意专业人士也是开放式成功的关键。
3. [A graduate degree could springboard you into an open source job][3]: 引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。
4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger 向我们展示了开放的做法是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。 Charlie 说, 这不仅仅是为了省钱;该区还受益于 “开放式领导原则, 促进师生创新, 帮助更好地吸引社区, 创造一个更有活力和包容性的学习社区”。
5. [15 ways to empower students with open source tools][5]: 我写开源是如何让学生自由探索、补拙和学习的, 不管他们是在学习基本的数字化素养, 还是通过有趣的项目来扩展这些技能。
6. [Developer opportunities to code for good][6]: 开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样: “建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础, 进而转化为更多的组织共同建设, 往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。”
### 用于再融合和再利用的开放式教育资源
1. [Can academic faculty members teach with Wikipedia?][7] LiAnna DavisWiki Ed 的, 项目总监,讨论开放教育资源 (OERs) ,如 Wiki Ed如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。
2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green是 Creative Common 开放教育主任,分享高等教育中教育面貌是如何变化的, 以及 Creative Common 正在采取哪些措施来促进教育。
3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites是 Open Up Resources 社区的福音传教士和首席营销官, 谈论非营利组织努力为 K-12 学校提供开放的, 标准一致的课程。
4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke Hawaii 大学 Manoa 分校的教育技术专家,他说, 在大学课程中过渡到 ORE 将 “使教师能够控制他们教授的内容, 我们预计这将为他们节省学生的费用。”
5. [How open courses are slashing the cost of higher education][11]: Saylor Academy 的教育主任 Devon Ritter 报告了 Saylor 是如何建立以公开许可内容为基础的大学学分课程, 目的是使更多的人能够负担得起和获得高等教育。
6. [Open educational resources movement gains speed][12]: Alexis CliftonState University of New York 的 OER 服务的执行主任, 描述了纽约800万美元的投资如何刺激开放教育的增长 并使大学更实惠。
7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik 在Duke University 探索 OSPRI (Open Source Pedagogy Research and Innovation开源教育学的研究与创新) 在 Duke 和 Red Hat 的联合合作这是建立一个21世纪的 preK-12 学习生态系统, 是开放的设计。
8. [Perma.cc stops scholarly link rot][14]: Virginia Tech 的 Phillip Young 写关于 Perma.cc “link rot”(链接失效) 的解决方案 很大可能在学术论文中的超链接随着时间的推移而消失或变化。
9. [Open education: How students save money by creating open textbooks][15]: OER 先驱 Robin DeRosa 谈到 “公开许可教科书引入的自由, 以及教育和学习应结合包容性生态系统, 以增强公益的总体理念”。
### 课堂上的开源工具
1. [How an open source board game is saving the planet][16]: Joshua Pearce 写的关于拯救地球的一个棋盘游戏, 使学生能够解决环境问题, 同时有乐趣, 并为制造商社区作出贡献。
2. [A new Android app for teaching kids how to read][17]: Michael Hall 谈到他的儿子 Phoenicia他在儿子被诊断为自闭症后开发的儿童识字应用 为了产生更好的编码价值, 以及为什么用户测试比你想象的更重要。
3. [8 open source Android apps for education][18]: Joshua Allen Holm 通过推荐 F-Droid 存储库中的8个开源应用来尝试 这将挑战我们将智能手机用作学习工具。
4. [3 open source alternatives to MATLAB][19]: Jason Baker's 更新了他2016年的开源数学计算软件调查 提出了 MATLAB 的替代方案, 这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专用解决方案。
5. [What does SVG have to do with teaching kids to code?][20] 退休工程师 Jay Nick 谈论他如何使用艺术作为一种创造性的方式, 向学生介绍编码。他在学校做志愿者, 使用可缩放矢量图形 (SVGScalable Vector Graphics) 教授一种结合数学和艺术原理的编码方法。
6. [5 myths busted: Using open source in higher education][21]: Kyle Conway 在 Texas Tech 拥有美术博士学位分享他在单一解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见, 反对在计算机科学以外的学科中使用开源:“很多人认为非技术专业的学生不能使用 Linux 他们对在高级学位课程中使用 Linux 的人做出了很多假设。...嗯, 这是有可能的, 我就是证明。”
7. [A list of open source tools for college][22]: Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。
8. [5 great KDE apps to help you study][23]: Zsolt Szakács 提供五个 KDE 应用程序, 帮助任何想要学习新技能或培养现有技能的人。
### 在教室编码
1. [How to get the next generation coding early][24]: Bryson Payne 说我们需要教孩子们在高中前编码: 到了九年级, 80% 的女孩和60% 的男孩已经从 STEM 职业中自选。但他建议, 这不仅仅是就业和缩小 IT 技能差距的问题。“教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题, 它是关于创造力, 更重要的是, 它是关于授权。
2. [Kids can't code without computers][25]: Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新设计较旧的计算机。该计划不仅为破旧或退役的硬件注入新的生命, 还为学生提供了重要的技能, 这些技能可能会利于转化为未来的职业。
3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva 提出 [Scratch][27] 的使用建议以激发孩子们对编程的兴趣, 就像 LOGO 在20世纪80年代开始使用它时一样。
4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger 描述应用发明者, 一个编程框架, 用于构建 Android 应用程序使用可视块语言 (类似 Scratch 或者[Snap][29]).
在这一年里, 我们了解到, 教育领域的一切都有一个开放的解决方案, 我预计这一主题将在2018年及以后继续下去。在未来的一年里 你是否希望 Opensource.com 涵盖开放式的教育主题?如果是, 请在评论中分享你的想法。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/1/best-open-education
作者:[Don Watkins][a]
译者:[lixinyuxx](https://github.com/lixinyuxx)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/don-watkins
[1]:https://opensource.com/article/17/7/book-review-open
[2]:https://opensource.com/article/17/8/jump-start-your-career
[3]:https://opensource.com/article/17/1/grad-school-open-source-academic-lab
[4]:https://opensource.com/article/17/7/open-school-leadership
[5]:https://opensource.com/article/17/7/empower-students-open-source-tools
[6]:https://opensource.com/article/17/3/interview-anh-bui-benetech-labs
[7]:https://opensource.com/article/17/1/Wiki-Education-Foundation
[8]:https://opensource.com/article/17/2/future-textbooks-cable-green-creative-commons
[9]:https://opensource.com/article/17/1/open-up-resources
[10]:https://opensource.com/article/17/2/interview-education-billy-meinke
[11]:https://opensource.com/article/17/7/college-alternatives
[12]:https://opensource.com/article/17/10/open-educational-resources-alexis-clifton
[13]:https://opensource.com/article/17/3/education-should-be-open-design
[14]:https://opensource.com/article/17/9/stop-link-rot-permacc
[15]:https://opensource.com/article/17/11/creating-open-textbooks
[16]:https://opensource.com/article/17/7/save-planet-board-game
[17]:https://opensource.com/article/17/4/phoenicia-education-software
[18]:https://opensource.com/article/17/8/8-open-source-android-apps-education
[19]:https://opensource.com/alternatives/matlab
[20]:https://opensource.com/article/17/5/coding-scalable-vector-graphics-make-steam
[21]:https://opensource.com/article/17/5/how-linux-higher-education
[22]:https://opensource.com/article/17/6/open-source-tools-university-student
[23]:https://opensource.com/article/17/6/kde-education-software
[24]:https://opensource.com/article/17/8/teach-kid-code-change-life
[25]:https://opensource.com/article/17/9/floss-desktops-kids
[26]:https://opensource.com/article/17/3/logo-scratch-teach-programming-kids
[27]:https://scratch.mit.edu/
[28]:https://opensource.com/article/17/8/app-inventor-android-app-development
[29]:http://snap.berkeley.edu/

View File

@ -0,0 +1,201 @@
# 如何使用 Fedora IoT 开启 LED 灯
![](https://fedoramagazine.org/wp-content/uploads/2018/08/LED-IoT-816x345.jpg)
你喜欢 Fedora、容器和树莓派吗这三者结合操控 LED 会怎么样?本文介绍的是 Fedora IoT将展示如何在树莓派上安装预览镜像。还将学习如何与 GPIO 交互以开启 LED。
### 什么是 Fedora IoT?
Fedora IoT 是当前 Fedora 项目的目标之一,计划成为一个完整的 Fedora 版本。Fedora IoT 将是一个在ARM目前仅限 aarch64例如树莓派以及 x86_64 架构设备上运行的系统。
![][1]
Fedora IoT 基于 OSTree 开发, 就像[Fedora Silverblue][2] 和以往的 [Atomic Host][3].
### 下载和安装 Fedora IoT
官方 Fedora IoT 镜像将和 Fedora 29 一起发布。但是在此期间你可以下载 [Fedora 28-based 镜像][4] 来进行这个实验。
你有两种方法来安装这个系统:使用 dd 命令闪存SD卡或者使用 fedora-arm-installer 工具。Fedora 的 Wiki 里面提供了更多关于[设置物理设备][5] 的信息来开发 IoT。另外你可能需要调整第三个分区的大小。
把 SD 卡插入到设备并运行,需要创建一个用户来完成安装。这个步骤需要串行连接或带键盘的 HDMI 显示器来与设备进行交互。
当系统安装完成后,下一步就是要设置网络连接。使用你刚才创建的用户登录系统,可以使用下列方式之一完成网络连接设置:
- 如果你需要手动配置你的网络,可能需要执行类似如下命令,需要保证设置正确的网络地址:
```
$ nmcli connection add con-name cable ipv4.addresses \
192.168.0.10/24 ipv4.gateway 192.168.0.1 \
connection.autoconnect true ipv4.dns "8.8.8.8,1.1.1.1" \
type ethernet ifname eth0 ipv4.method manual
```
- 如果你网络上运行着 DHCP 服务,可能需要类似如下命令:
```
$ nmcli con add type ethernet con-name cable ifname eth0
```
### **Fedora 中的 GPIO 接口**
许多关于 Linux 上 GPIO 的教程都关注传统的 GPIO sysfis 接口。这个接口已经不推荐使用了,并且上游 Linux 内核社区由于安全和其他问题的缘故打算完全删除它。
Fedora 已经不将这个传统的接口编译到内核了,因此在系统上没有 /sys/class/gpio 这个文件。此教程使用一个上游内核提供的一个新的字符设备 /dev/gpiochipN 。这是目前和 GPIO 交互的方式。
为了和这个新设备进行交互,你需要使用一个库和一系列命令行界面工具。公共命令行工具比如说 echo 和 cat 在此设备上无法正常工作。
你可以通过安装 libgpiod-utils 包来安装命令行界面工具。python3-libgpiod 包提供了相应的 Python 库。
### **使用 Podman 来创建一个容器**
[Podman][6] 是一个容器运行环境其命令行界面类似于Docker。Podman的一大优势是它不会在后台运行任何守护进程。这对于资源有限的设备尤其有用。Podman 还允许您使用 systemd 单元文件启动容器化服务。此外,它还有许多其他功能。
我们使用如下两步来创建一个容器:
```
1. 创建包含所需包的分层镜像。
2. 使用分层镜像创建一个新容器。
```
首先创建一个 Dockerfile 文件,内容如下。这些内容告诉 podman 基于可使用的最新 Fedora 镜像来构建我们的分层镜像。然后就是更新系统和安装一些软件包:
```
FROM fedora:latest
RUN dnf -y update
RUN dnf -y install libgpiod-utils python3-libgpiod
```
这样你就完成了镜像的生成前的配置工作,这个镜像基于最新的 Fedora而且包含了和 GPIO 交互的软件包。
现在你就可以运行下方命令来构建你的基本镜像了:
```
$ sudo podman build --tag fedora:gpiobase -f ./Dockerfile
```
你已经成功创建了你的自定义镜像。这样以后你就可以不用每次都重新搭建环境了,而是基于你创建的镜像来完成工作。
### 使用 Podman 完成工作
为了确认当前的镜像,可以运行下方命令:
```
$ sudo podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/fedora gpiobase 67a2b2b93b4b 10 minutes ago 488MB
docker.io/library/fedora latest c18042d7fac6 2 days ago 300MB
```
现在,启动容器并进行一些实际的实验。 容器通常是隔离的无法访问主机系统包括GPIO接口。 因此需要在启动容器时将其挂载在容器内。 可以使用以下命令中的 -device 选项来解决:
```
$ sudo podman run -it --name gpioexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash
```
运行之后就进入了正在运行的容器中。 在继续之前,这里有一些容器命令。 输入 exit 或者按下 **Ctrl+D** 来退出容器。
显示所有存在的容器可以运行如下命令:
```
$ sudo podman container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
64e661d5d4e8 localhost/fedora:gpiobase /bin/bash 37 seconds ago Exited (0) Less than a second ago gpioexperiment
```
使用如下命令创建一个新的容器:
```
$ sudo podman run -it --name newexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash
```
如果想删除容器可以使用如下命令:
```
$ sudo podman rm newexperiment
```
### **开启 LED 灯**
现在可以使用已创建的容器。 如果容器已经退出,请使用以下命令再次启动它:
```
$ sudo podman start -ia gpioexperiment
```
如前所述,可以使用 Fedora 中 libgpiod-utils 包提供的 CLI 工具。 要列出可用的 GPIO 芯片可以使用如下命令:
```
$ gpiodetect
gpiochip0 [pinctrl-bcm2835] (54 lines)
```
要获取特定芯片的公开列表,请运行:
```
$ gpioinfo gpiochip0
```
请注意,物理引脚数与前一个命令打印的行数之间没有相关性。 重要的是 BCM 编号,如 [pinout.xyz][7] 所示。 建议不要使用没有相应 BCM 编号的线路。
现在,将 LED 连接到物理引脚40也就是 BCM 21。请记住LED的短腿负极称为阴极必须连接到带有330欧姆电阻的树莓派的 GND 引脚, 并且长腿阳极到物理引脚40。
运行以下命令打开LED。按下 **Ctrl + C ** 关闭:
```
$ gpioset --mode=wait gpiochip0 21=1
```
要点亮一段时间,请添加 -b在后台运行和 -s NUM多少秒参数如下所示。 例如,要点亮 LED 5秒钟运行如下命令
```
$ gpioset -b -s 5 --mode=time gpiochip0 21=1
```
另一个有用的命令是 gpioget。 它可以获得引脚的状态(高或低),可用于检测按钮和开关。
![Closeup of LED connection with GPIO][8]
### **总结**
你也可以使用 Python 操控 LED - [这里有一些例子][9]。 也可以在容器内使用 i2c 设备。 此外Podman 与此 Fedora 版本并不严格相关。 你可以在任何现有的 Fedora Edition 上安装它,或者在 Fedora 中使用两个基于 OSTree 的新系统进行尝试:[Fedora Silverblue][2] 和 [Fedora CoreOS][10]。
------
via: https://fedoramagazine.org/turnon-led-fedora-iot/
作者:[Alessio Ciregia][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[ScarboroughCoral](https://github.com/ScarboroughCoral)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: http://alciregi.id.fedoraproject.org/
[1]: https://fedoramagazine.org/wp-content/uploads/2018/08/oled-1024x768.png
[2]: https://teamsilverblue.org/
[3]: https://www.projectatomic.io/
[4]: https://kojipkgs.fedoraproject.org/compose/iot/latest-Fedora-IoT-28/compose/IoT/
[5]: https://fedoraproject.org/wiki/InternetOfThings/GettingStarted#Setting_up_a_Physical_Device
[6]: https://github.com/containers/libpod
[7]: https://pinout.xyz/
[8]: https://fedoramagazine.org/wp-content/uploads/2018/08/breadboard-1024x768.png
[9]: https://github.com/brgl/libgpiod/tree/master/bindings/python/examples
[10]: https://coreos.fedoraproject.org/