mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-10 22:21:11 +08:00
commit
57f28e2d84
@ -0,0 +1,253 @@
|
||||
在 Kali Linux 中更改 GRUB 背景的 5 种方式
|
||||
============================================================
|
||||
|
||||
这是一个关于如何在 Kali Linux 中更改 GRUB 背景的简单指南(实际上它是 Kali Linux 的
|
||||
GRUB 启动图像)。 Kali 开发团队在这方面做的不多,他们好像太忙了,所以在这篇文章中,我会对 GRUB 解释一二,但是不会冗长到我失去写作的激情。 那么我们开始吧……
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -10](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-10.jpg)
|
||||
][10]
|
||||
|
||||
### 查找 GRUB 设置
|
||||
|
||||
这通常是所有人首先会遇到的一个问题,在哪里设置?有很多方法来查找 GRUB 设置。每个人都可能有自己的方法,但我发现 `update-grub` 是最简单的。如果在 VMWare 或 VirtualBox 中执行 `update-grub`,你将看到如下所示的内容:
|
||||
|
||||
```
|
||||
root@kali:~# update-grub
|
||||
Generating grub configuration file ...
|
||||
Found background image: /usr/share/images/desktop-base/desktop-grub.png
|
||||
Found linux image: /boot/vmlinuz-4.0.0-kali1-amd64
|
||||
Found initrd image: /boot/initrd.img-4.0.0-kali1-amd64
|
||||
No volume groups found
|
||||
done
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
如果您是双系统,或者三系统,那么您将看到 GRUB 以及其他操作系统入口。然而,我们感兴趣的部分是背景图像,这是在我这里看到的(你会看到完全相同的内容):
|
||||
|
||||
```
|
||||
Found background image: /usr/share/images/desktop-base/desktop-grub.png
|
||||
```
|
||||
|
||||
### GRUB 启动图像搜索顺序
|
||||
|
||||
在 grub-2.02 中,对基于 Debian 的系统来说,它将按照以下顺序搜索启动背景:
|
||||
|
||||
1. `/etc/default/grub` 里的 `GRUB_BACKGROUND` 行
|
||||
2. 在 `/boot/grub/` 里找到的第一个图像(如果发现多张,将以字母顺序排序)
|
||||
3. 在 `/usr/share/desktop-base/grub_background.sh` 中指定的
|
||||
4. 在 `/etc/grub.d/05_debian_theme` 里 `WALLPAPER` 行列出的
|
||||
|
||||
现在将此信息留在这里,我们会尽快重新检查它。
|
||||
|
||||
### Kali Linux GRUB 启动图像
|
||||
|
||||
在我使用 Kali Linux 时(因为我喜欢用它做事),会发现 Kali 正在使用这里的背景图像:`/usr/share/images/desktop-base/desktop-grub.png`
|
||||
|
||||
为了确定,我们来检查一下这个 `.png` 文件的属性。
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# ls -l /usr/share/images/desktop-base/desktop-grub.png
|
||||
lrwxrwxrwx 1 root root 30 Oct 8 00:31 /usr/share/images/desktop-base/desktop-grub.png -> /etc/alternatives/desktop-grub
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -1](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-1.jpg)
|
||||
][11]
|
||||
|
||||
什么?它只是 `/etc/alternatives/desktop-grub` 的一个符号链接? 但是 `/etc/alternatives/desktop-grub` 不是图片文件。看来我也要检查一下它的属性。
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# ls -l /etc/alternatives/desktop-grub
|
||||
lrwxrwxrwx 1 root root 44 Oct 8 00:27 /etc/alternatives/desktop-grub -> /usr/share/images/desktop-base/kali-grub.png
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -3](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-3.jpg)
|
||||
][12]
|
||||
|
||||
好吧,真让人费解。 `/etc/alternatives/desktop-grub` 也是一个符号链接,它指向 `/usr/share/images/desktop-base/kali-grub.png`,来自最初同样的文件夹。呃! 无语。 但是现在我们至少可以替换该文件并将其解决。
|
||||
|
||||
在替换之前,我们需要检查 `/usr/share/images/desktop-base/kali-grub.png` 的属性,以确保下载相同类型和大小的文件。
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# file /usr/share/images/desktop-base/kali-grub.png
|
||||
/usr/share/images/desktop-base/kali-grub.png: PNG image data, 640 x 480, 8-bit/color RGB, non-interlaced
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
可以确定这是一个 PNG 图像文件,像素尺寸为 640 x 480。
|
||||
|
||||
### GRUB 背景图像属性
|
||||
|
||||
可以使用 `PNG`, `JPG`/`JPEG` 以及 `TGA` 类型的图像文件作为 GRUB 2 的背景。必须符合以下规范:
|
||||
|
||||
* `JPG`/`JPEG` 图像必须是 `8-bit` (256 色)
|
||||
* 图像应该是非索引的,`RGB`
|
||||
|
||||
默认情况下,如果安装了 `desktop-base` 软件包,符合上述规范的图像将放在 `/usr/share/images/desktop-base/` 目录中。在谷歌上很容易找到类似的文件。我也找了一个。
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# file Downloads/wallpaper-1.png
|
||||
Downloads/wallpaper-1.png: PNG image data, 640 x 480, 8-bit/color RGB, non-interlaced
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -6](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-6.jpg)
|
||||
][13]
|
||||
|
||||
### 方式 1:替换图像
|
||||
|
||||
现在我们只需简单的用新文件将 `/usr/share/images/desktop-base/kali-grub.png` 替换掉。值得注意这是最简单的方法,不需要修改 `grub-config` 文件。 如果你对 GRUB 很熟,建议你简单的修改 GRUB 的默认配置文件,然后执行 `update-grub`。
|
||||
|
||||
像往常一样,我会将原文件重命名为 `kali-grub.png.bkp` 进行备份。
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# mv /usr/share/images/desktop-base/kali-grub.png /usr/share/images/desktop-base/kali-grub.png.bkp
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -4](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-4.jpg)
|
||||
][14]
|
||||
|
||||
现在我们将下载的文件重命名为 `kali-grub.png`。
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# cp Downloads/wallpaper-1.png /usr/share/images/desktop-base/kali-grub.png
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -5](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-5.jpg)
|
||||
][15]
|
||||
|
||||
最后执行命令 `update-grub`:
|
||||
|
||||
```
|
||||
root@kali:~# update-grub
|
||||
Generating grub configuration file ...
|
||||
Found background image: /usr/share/images/desktop-base/desktop-grub.png
|
||||
Found linux image: /boot/vmlinuz-4.0.0-kali1-amd64
|
||||
Found initrd image: /boot/initrd.img-4.0.0-kali1-amd64
|
||||
No volume groups found
|
||||
done
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -7](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-7.jpg)
|
||||
][16]
|
||||
|
||||
下次重新启动你的 Kali Linux 时,你会看到 GRUB 背景变成了你自己的图像(GRUB 启动界面)。
|
||||
|
||||
下面是我现在正在使用的新 GRUB 启动背景。你呢?要不要试试这个办法?
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -9](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-9.jpg)
|
||||
][17]
|
||||
|
||||
这是最简单最安全的办法,最糟的情况也不过是在 GRUB 看到一个蓝色的背景,但你依然可以登录后修复它们。现在如果你有信心,让我们尝试一个改变 GRUB 设置的更好的方法(有点复杂)。后续步骤更加有趣,而且可以在任何使用 GRUB 引导的 Linux 上使用。
|
||||
|
||||
现在回忆一下 GRUB 在哪 4 个地方寻找启动背景图像?再看一遍:
|
||||
|
||||
1. `/etc/default/grub` 里的 `GRUB_BACKGROUND` 行
|
||||
2. 在 `/boot/grub/` 里找到的第一个图像(如果发现多张,将以字母顺序排序)
|
||||
3. 在 `/usr/share/desktop-base/grub_background.sh` 中指定的
|
||||
4. 在 `/etc/grub.d/05_debian_theme` 里 WALLPAPER 行列出的
|
||||
|
||||
那么我们再在 Kali Linux 上(或任意使用 GRUB2 的 Linux系统)试一下新的选择。
|
||||
|
||||
### 方式 2:在 GRUB_BACKGROUND 中定义图像路径
|
||||
|
||||
所以你可以根据上述的查找优先级使用上述任一项,将 GRUB 背景图像改为自己的。以下是我自己系统上 `/etc/default/grub` 的内容。
|
||||
|
||||
```
|
||||
root@kali:~# vi /etc/default/grub
|
||||
```
|
||||
|
||||
按照 `GRUB_BACKGROUND="/root/World-Map.jpg"` 的格式添加一行,其中 World-Map.jpg 是你要作为 GRUB 背景的图像文件。
|
||||
|
||||
```
|
||||
# If you change this file, run 'update-grub' afterwards to update
|
||||
# /boot/grub/grub.cfg.
|
||||
# For full documentation of the options in this file, see:
|
||||
# info -f grub -n 'Simple configuration'
|
||||
|
||||
GRUB_DEFAULT=0
|
||||
GRUB_TIMEOUT=15
|
||||
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
|
||||
GRUB_CMDLINE_LINUX="initrd=/install/gtk/initrd.gz"
|
||||
GRUB_BACKGROUND="/root/World-Map.jpg"
|
||||
```
|
||||
|
||||
一旦使用上述方式完成更改,务必执行 `update-grub` 命令,如下所示。
|
||||
|
||||
```
|
||||
root@kali:~# update-grub
|
||||
Generating grub configuration file ...
|
||||
Found background: /root/World-Map.jpg
|
||||
Found background image: /root/World-Map.jpg
|
||||
Found linux image: /boot/vmlinuz-4.0.0-kali1-amd64
|
||||
Found initrd image: /boot/initrd.img-4.0.0-kali1-amd64
|
||||
No volume groups found
|
||||
done
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
现在重启机器,你会在 GRUB 看到自定义的图像。
|
||||
|
||||
### 方式 3:把图像文件放到 /boot/grub/ 文件夹
|
||||
|
||||
如果没有在 `/etc/default/grub` 文件中指定 `GRUB_BACKGROUND` 项,理论上 GRUB 应当使用在 `/boot/grub/` 文件夹找到的第一个图像文件作为背景。如果 GRUB 在 `/boot/grub/` 找到多个图像文件,它会按字母排序并使用第一个图像文件。
|
||||
|
||||
### 方式 4:在 grub_background.sh 指定图像路径
|
||||
|
||||
如果没有在 `/etc/default/grub` 文件中指定 `GRUB_BACKGROUND` 项,而且 `/boot/grub/` 目录下没有图像文件,GRUB 将会开始在 `/usr/share/desktop-base/grub_background.sh` 文件中指定的图像路径中搜索。Kali Linux 是在这里指定的。每个 Linux 发行版都有自己的特色。
|
||||
|
||||
### 方式 5:在 /etc/grub.d/05\_debian\_theme 文件的 WALLPAPER 一行指定图像
|
||||
|
||||
这是 GRUB 搜寻背景图像的最后一个位置。如果在其他部分都没有找到,它将会在这里查找。
|
||||
|
||||
### 结论
|
||||
|
||||
这篇文章较长,但我想介绍一些基础但很重要的东西。如果你有仔细阅读,你会理解如何在 Kali Linux 上来回跟踪符号链接。当你需要在一些 Linux 系统上查找 GRUB 背景图像的位置时,你会感到得心应手。只要再多阅读一点来理解 GRUB 颜色的工作方式,你就是行家了。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/
|
||||
|
||||
作者:[https://www.blackmoreops.com/][a]
|
||||
译者:[fuowang](https://github.com/fuowang)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/
|
||||
[1]:http://www.facebook.com/sharer.php?u=https://www.blackmoreops.com/?p=5958
|
||||
[2]:https://twitter.com/intent/tweet?text=5+ways+to+change+GRUB+background+in+Kali+Linux%20via%20%40blackmoreops&url=https://www.blackmoreops.com/?p=5958
|
||||
[3]:https://plusone.google.com/_/+1/confirm?hl=en&url=https://www.blackmoreops.com/?p=5958&name=5+ways+to+change+GRUB+background+in+Kali+Linux
|
||||
[4]:https://www.blackmoreops.com/how-to/
|
||||
[5]:https://www.blackmoreops.com/kali-linux/
|
||||
[6]:https://www.blackmoreops.com/kali-linux-2-x-sana/
|
||||
[7]:https://www.blackmoreops.com/administration/
|
||||
[8]:https://www.blackmoreops.com/usability/
|
||||
[9]:https://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/#comments
|
||||
[10]:http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-10.jpg
|
||||
[11]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-1/
|
||||
[12]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-3/
|
||||
[13]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-6/
|
||||
[14]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-4/
|
||||
[15]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-5/
|
||||
[16]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-7/
|
||||
[17]:http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-9.jpg
|
@ -1,18 +1,19 @@
|
||||
使用开源工具探索气候数据的奥秘
|
||||
============================================================[up][1]
|
||||
============================================================
|
||||
|
||||
![Explore climate data with open source tools](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/bus-cloud.png?itok=bdROR1aE "Explore climate data with open source tools")
|
||||
|
||||
图片源自: [Flickr user: theaucitron][2] (CC BY-SA 2.0)
|
||||
|
||||
如今你看地球上的任何地方,都可以看到天气变化的证据,每个月,事实和数据都在向我们诠释一点 —— 全球变暖。
|
||||
如今你看地球上的任何地方,都可以找到天气变化的证据,每个月,无论是事实还是数据都在向我们诠释一点 —— 全球变暖。
|
||||
|
||||
气候学家如是告诫我们,如今的不作为,对于我们的将来可能是致命的。五角大楼的军事战略家[最近警告][3]当选总统的川普,申明如果不对气候变化有所动作,可能会造成威胁国家安全的灾难。愈趋减少的的水供应和微薄的降雨量会导致作物歉收,这将迫使大量的移民逃往世界各地,到那些可以维持他们生计的地方去。
|
||||
气候学家如是告诫我们,如今的不作为,对于我们的将来可能是致命的。五角大楼的军事战略家[最近警告][3]当选总统的川普,向他申明如果不对气候变化有所动作,可能会造成威胁国家安全的灾难。愈趋减少的的水供应和微薄的降雨量会导致作物歉收,这将迫使大量的移民逃往世界各地,到那些可以维持他们生计的地方去。
|
||||
|
||||
遍览 NASA,美国国防部,以及其他机构针对气候的研究成果,我的心中有个疑惑。那就是是否有开源的工具,使对此感兴趣的人们能够自行去探索气候数据的奥秘,并总结出我们自己的结论。我在网上快速的检索了一下,然后找到了[Open Climate Workbench (开源气候工作台)][4],[Apache 软件基金会][5]旗下的一个工程。
|
||||
遍览 NASA、美国国防部,以及其他机构针对气候的研究成果,我的心中有个疑惑。那就是是否有开源的工具,使对此感兴趣的人们能够自行去探索气候数据的奥秘,并总结出我们自己的结论。我在网上快速的检索了一下,然后找到了 [Open Climate Workbench (开源气候工作台)][4],这是 [Apache 软件基金会][5]旗下的一个工程。
|
||||
|
||||
Open Climate Workbench (缩写 OCW) 开发软件,对来自 [<ruby>地球系统网格联盟<rt>Earth System Grid Federation</rt></ruby>][6](缩写 ESGF)、[<ruby>协调区域气候降尺度实验<rt>Coordinated Regional Climate Downscaling Experiment</rt></ruby>][7](缩写 CORDEX)、美国全球变化研究项目的[<ruby>国家气候研究<rt> National Climate Assessment</rt></ruby>][8]、[<ruby>北美区域气候评估计划<rt>North American Regional Climate Assessment Program</rt></ruby>][9],以及 NASA、NOAA 和其他组织或机构的数据进行气候模型评价。
|
||||
Open Climate Workbench (缩写 OCW) 开发该软件,对来自 [<ruby>地球系统网格联盟<rt>Earth System Grid Federation</rt></ruby>][6](缩写 ESGF)、[<ruby>协调区域气候降尺度实验<rt>Coordinated Regional Climate Downscaling Experiment</rt></ruby>][7](缩写 CORDEX)、美国全球变化研究项目的[<ruby>国家气候研究<rt> National Climate Assessment</rt></ruby>][8]、[<ruby>北美区域气候评估计划<rt>North American Regional Climate Assessment Program</rt></ruby>][9],以及 NASA、NOAA 和其他组织或机构的数据进行气候模型评价。
|
||||
|
||||
你可下载 OCW 的 [tar ball][10] 并将它安装到满足以下[条件][11]的 Linux 电脑上。也可以使用 Vagrant 或者 VirtualBox 将 OCW 安装到虚拟机中,详见 OCW 的[虚拟机指南][12]。
|
||||
你可下载 OCW 的 [tar 包][10] 并将它安装到满足其[条件][11]的 Linux 电脑上。也可以使用 Vagrant 或者 VirtualBox 将 OCW 安装到虚拟机中,详见 OCW 的[虚拟机指南][12]。
|
||||
|
||||
个人觉得想要了解 OCW 是如何工作的,最便捷的方式就是到 <ruby>区域气候模式评价系统<rt>Regional Climate Model Evaluation System </rt></ruby> (缩写 RCMES),下载一个[虚拟机镜像][13]。
|
||||
|
@ -1,16 +1,19 @@
|
||||
将另一台 Ubuntu DC 服务器加入到 Samba4 AD DC 实现双域控主机模式 ——(五)
|
||||
Samba 系列(五):将另一台 Ubuntu DC 服务器加入到 Samba4 AD DC 实现双域控主机模式
|
||||
============================================================
|
||||
|
||||
这篇文章将讲解如何使用 **Ubuntu 16.04** 服务器版系统来创建第二台 **Samba4** 域控制器,并将其加入到已创建好的 **Samba AD DC** 林环境中,以便为一些关键的 AD DC 服务提供负载均衡及故障切换功能,尤其是为那些重要的服务,比如 DNS 服务和使用 SAM 数据库的 AD DC LDAP 模式。
|
||||
|
||||
#### 需求
|
||||
|
||||
1、 这篇文章是 **Samba4 AD DC** 系列的第**五**篇,前边几篇如下:
|
||||
这篇文章是 **Samba4 AD DC** 系列的第**五**篇,前边几篇如下:
|
||||
|
||||
[在 Ubuntu16.04 系统上使用 Samba4 软件来创建活动目录架构(一)][1]
|
||||
[在 Linux 命令行下管理 Samba4 AD 架构(二)][2]
|
||||
[使用 Windows 10 系统的 RSAT 工具来管理 Samba4 活动目录架构 (三)][3]
|
||||
[在 Windows 系统下管理 Samba4 AD 域管制器 DNS 和组策略(四)][4]
|
||||
1、[在 Ubuntu16.04 系统上使用 Samba4 软件来创建活动目录架构(一)][1]
|
||||
|
||||
2、[在 Linux 命令行下管理 Samba4 AD 架构(二)][2]
|
||||
|
||||
3、[使用 Windows 10 系统的 RSAT 工具来管理 Samba4 活动目录架构 (三)][3]
|
||||
|
||||
4、[在 Windows 系统下管理 Samba4 AD 域管制器 DNS 和组策略(四)][4]
|
||||
|
||||
### 第一步:为设置 Samba4 进行初始化配置
|
||||
|
||||
@ -24,7 +27,7 @@
|
||||
# hostnamectl set-hostname adc2
|
||||
```
|
||||
|
||||
或者你也可以手动编辑 **/etc/hostname** 文件,在新的一行输入你想设置的主机名。
|
||||
或者你也可以手动编辑 `/etc/hostname` 文件,在新的一行输入你想设置的主机名。
|
||||
|
||||
```
|
||||
# nano /etc/hostname
|
||||
@ -55,11 +58,11 @@ IP_of_main_DC FQDN_of_main_DC short_name_of_main_DC
|
||||
|
||||
*为 Samba4 AD DC 服务器设置主机名*
|
||||
|
||||
3、下一步,打开 **/etc/network/interfaces** 配置文件并设置一个静态 IP 地址,如下图所示:
|
||||
3、下一步,打开 `/etc/network/interfaces` 配置文件并设置一个静态 IP 地址,如下图所示:
|
||||
|
||||
注意 **dns-nameservers** 和 **dns-search** 这两个参数的值。为了使 DNS 解析正常工作,需要把这两个值设置成主 Samba4 AD DC 服务器的 IP 地址和域名。
|
||||
注意 `dns-nameservers` 和 `dns-search` 这两个参数的值。为了使 DNS 解析正常工作,需要把这两个值设置成主 Samba4 AD DC 服务器的 IP 地址和域名。
|
||||
|
||||
重启网卡服务以让修改的配置生效。检查 **/etc/resolv.conf** 文件,确保该网卡上配置的这两个 DNS 的值已更新到这个文件。
|
||||
重启网卡服务以让修改的配置生效。检查 `/etc/resolv.conf` 文件,确保该网卡上配置的这两个 DNS 的值已更新到这个文件。
|
||||
|
||||
```
|
||||
# nano /etc/network/interfaces
|
||||
@ -90,7 +93,7 @@ dns-search tecmint.lan
|
||||
|
||||
*配置 Samba4 AD 服务器的 DNS*
|
||||
|
||||
当你通过简写名称(用于构建 FQDN 名)查询主机名时, **dns-search** 值将会自动把域名添加上。
|
||||
当你通过简写名称(用于构建 FQDN 名)查询主机名时, `dns-search` 值将会自动把域名添加上。
|
||||
|
||||
4、为了测试 DNS 解析是否正常,使用一系列 ping 命令测试,命令后分别为简写名, FQDN 名和域名,如下图所示:
|
||||
|
||||
@ -108,7 +111,7 @@ dns-search tecmint.lan
|
||||
# apt-get install ntpdate
|
||||
```
|
||||
|
||||
6、假设你想手动强制本地服务器与 **samba4 AD DC** 服务器时间同步,使用 **ntpdate** 命令加上主域控服务器的主机名,如下所示:
|
||||
6、假设你想手动强制本地服务器与 **samba4 AD DC** 服务器时间同步,使用 `ntpdate` 命令加上主域控服务器的主机名,如下所示:
|
||||
|
||||
```
|
||||
# ntpdate adc1
|
||||
@ -121,7 +124,7 @@ dns-search tecmint.lan
|
||||
|
||||
### 第 2 步:安装 Samba4 必须的依赖包
|
||||
|
||||
7、为了让 **Ubuntu 16.04** 系统加入到你的域中,你需要通过下面的命令从 Ubuntu 官方软件库中安装 **Samba4 套件, Kerberos** 客户端和其它一些重要的软件包以便将来使用:
|
||||
7、为了让 **Ubuntu 16.04** 系统加入到你的域中,你需要通过下面的命令从 Ubuntu 官方软件库中安装 **Samba4 套件、 Kerberos 客户端** 和其它一些重要的软件包以便将来使用:
|
||||
|
||||
```
|
||||
# apt-get install samba krb5-user krb5-config winbind libpam-winbind libnss-winbind
|
||||
@ -132,7 +135,7 @@ dns-search tecmint.lan
|
||||
|
||||
*在 Ubuntu 系统中安装 Samba4*
|
||||
|
||||
8、在安装的过程中,你需要提供 Kerberos 域名。输入大写的域名然后按 [Enter] 键完成安装过程。
|
||||
8、在安装的过程中,你需要提供 Kerberos 域名。输入大写的域名然后按回车键完成安装过程。
|
||||
|
||||
[
|
||||
![Configure Kerberos Authentication for Samba4](http://www.tecmint.com/wp-content/uploads/2017/01/Configure-Kerberos-Authentication-for-Samba4.png)
|
||||
@ -140,7 +143,7 @@ dns-search tecmint.lan
|
||||
|
||||
*为 Samba4 配置 Kerberos 认证*
|
||||
|
||||
9、所有依赖包安装完成后,通过使用 kinit 命令为域管理员请求一个 Kerberos 票据以验证设置是否正确。使用 klist 命令来列出已授权的 kerberos 票据信息。
|
||||
9、所有依赖包安装完成后,通过使用 `kinit` 命令为域管理员请求一个 Kerberos 票据以验证设置是否正确。使用 `klist` 命令来列出已授权的 kerberos 票据信息。
|
||||
|
||||
```
|
||||
# kinit domain-admin-user@YOUR_DOMAIN.TLD
|
||||
@ -161,7 +164,7 @@ dns-search tecmint.lan
|
||||
# mv /etc/samba/smb.conf /etc/samba/smb.conf.initial
|
||||
```
|
||||
|
||||
11、在准备加入域前,先启动 **samba-ad-dc** 服务,之后使用域管理员账号运行 **samba-tool** 命令将服务器加入到域。
|
||||
11、在准备加入域前,先启动 **samba-ad-dc** 服务,之后使用域管理员账号运行 `samba-tool` 命令将服务器加入到域。
|
||||
|
||||
```
|
||||
# samba-tool domain join your_domain -U "your_domain_admin"
|
||||
@ -170,10 +173,10 @@ dns-search tecmint.lan
|
||||
加入域过程部分截图:
|
||||
|
||||
```
|
||||
# samba-tool domain join tecmint.lan DC -U"tecmint_user"
|
||||
# samba-tool domain join tecmint.lan DC -U "tecmint_user"
|
||||
```
|
||||
|
||||
##### 输出示例
|
||||
输出示例:
|
||||
|
||||
```
|
||||
Finding a writeable DC for domain 'tecmint.lan'
|
||||
@ -242,7 +245,7 @@ Joined domain TECMINT (SID S-1-5-21-715537322-3397311598-55032968) as a DC
|
||||
# nano /etc/samba/smb.conf
|
||||
```
|
||||
|
||||
添加以下内容到 smb.conf 配置文件中。
|
||||
添加以下内容到 `smb.conf` 配置文件中。
|
||||
|
||||
```
|
||||
dns forwarder = 192.168.1.1
|
||||
@ -255,7 +258,7 @@ winbind enum users = yes
|
||||
winbind enum groups = yes
|
||||
```
|
||||
|
||||
使用你自己的 **DNS forwarder IP** 地址替换掉上面地址。 Samba 将会把域权威区之外的所有 DNS 解析查询转发到这个 IP 地址。
|
||||
使用你自己的 **DNS 转发器 IP** 地址替换掉上面 `dns forwarder` 地址。 Samba 将会把域权威区之外的所有 DNS 解析查询转发到这个 IP 地址。
|
||||
|
||||
13、最后,重启 samba 服务以使修改的配置生效,然后执行如下命令来检查活动目录复制功能是否正常。
|
||||
|
||||
@ -270,9 +273,9 @@ winbind enum groups = yes
|
||||
|
||||
*配置 Samba4 DNS*
|
||||
|
||||
14、另外,还需要重命名原来的 /etc 下的 kerberos 配置文件,并使用在加入域的过程中 Samba 生成的新配置文件 krb5.conf 替换它。
|
||||
14、另外,还需要重命名原来的 `/etc `下的 kerberos 配置文件,并使用在加入域的过程中 Samba 生成的新配置文件 krb5.conf 替换它。
|
||||
|
||||
Samba 生成的新配置文件在 /var/lib/samba/private 目录下。使用 Linux 的符号链接将该文件链接到 /etc 目录。
|
||||
Samba 生成的新配置文件在 `/var/lib/samba/private` 目录下。使用 Linux 的符号链接将该文件链接到 `/etc` 目录。
|
||||
|
||||
```
|
||||
# mv /etc/krb6.conf /etc/krb5.conf.initial
|
||||
@ -285,7 +288,7 @@ Samba 生成的新配置文件在 /var/lib/samba/private 目录下。使用 Linu
|
||||
|
||||
*配置 Kerberos*
|
||||
|
||||
15、同样,使用 samba 的 **krb5.conf** 配置文件验证 Kerberos 认证是否正常。通过以下命令来请求一个管理员账号的票据并且列出已缓存的票据信息。
|
||||
15、同样,使用 samba 的 `krb5.conf` 配置文件验证 Kerberos 认证是否正常。通过以下命令来请求一个管理员账号的票据并且列出已缓存的票据信息。
|
||||
|
||||
```
|
||||
# kinit administrator
|
||||
@ -299,7 +302,7 @@ Samba 生成的新配置文件在 /var/lib/samba/private 目录下。使用 Linu
|
||||
|
||||
### 第 4 步:验证其它域服务
|
||||
|
||||
16、你首先要做的一个测试就是验证 **Samba4 DC DNS** 解析服务是否正常。要验证域 DNS 解析情况,使用 host 命令,加上一些重要的 AD DNS 记录,进行域名查询,如下图所示:
|
||||
16、你首先要做的一个测试就是验证 **Samba4 DC DNS** 解析服务是否正常。要验证域 DNS 解析情况,使用 `host` 命令,加上一些重要的 AD DNS 记录,进行域名查询,如下图所示:
|
||||
|
||||
每一次查询,DNS 服务器都应该返回两个 IP 地址。
|
||||
|
||||
@ -322,15 +325,15 @@ Samba 生成的新配置文件在 /var/lib/samba/private 目录下。使用 Linu
|
||||
|
||||
*通过 Windows RSAT 工具来验证 DNS 记录*
|
||||
|
||||
18、下一个验证是检查域 LDAP 复制同步是否正常。使用 **samba-tool** 工具,在第二个域控制器上创建一个账号,然后检查该账号是否自动同步到第一个 Samba4 AD DC 服务器上。
|
||||
18、下一个验证是检查域 LDAP 复制同步是否正常。使用 `samba-tool` 工具,在第二个域控制器上创建一个账号,然后检查该账号是否自动同步到第一个 Samba4 AD DC 服务器上。
|
||||
|
||||
##### On adc2:
|
||||
在 adc2 上:
|
||||
|
||||
```
|
||||
# samba-tool user add test_user
|
||||
```
|
||||
|
||||
##### On adc1:
|
||||
在 adc1 上:
|
||||
|
||||
```
|
||||
# samba-tool user list | grep test_user
|
||||
@ -349,7 +352,7 @@ Samba 生成的新配置文件在 /var/lib/samba/private 目录下。使用 Linu
|
||||
|
||||
19、你也可以从 **Microsoft AD DC** 控制台创建一个账号,然后验证该账号是否都出现在两个域控服务器上。
|
||||
|
||||
默认情况下,这个账号都应该在两个 samba 域控制器上自动创建完成。在 `adc1` 服务器上使用 **wbinfo** 命令查询该账号名。
|
||||
默认情况下,这个账号都应该在两个 samba 域控制器上自动创建完成。在 `adc1` 服务器上使用 `wbinfo` 命令查询该账号名。
|
||||
|
||||
[
|
||||
![Create Account from Microsoft AD UC](http://www.tecmint.com/wp-content/uploads/2017/01/Create-Account-from-Microsoft-AD-UC.png)
|
@ -1,48 +1,48 @@
|
||||
NMAP 常用扫描简介 - 第一部分
|
||||
NMAP 常用扫描简介(一)
|
||||
========================
|
||||
|
||||
我们之前在‘[NMAP 的安装][1]’一文中,列出了 10 种不同的 ZeNMAP 扫描模式(这里将 Profiles 翻译成了模式,不知是否合适)。大多数的模式使用了各种参数。大多数的参数代表了执行不同的扫描模式。这篇文章将介绍其中的四种通用的扫描类型。
|
||||
我们之前在 [NMAP 的安装][1]一文中,列出了 10 种不同的 ZeNMAP 扫描模式。大多数的模式使用了各种参数。各种参数代表了执行不同的扫描模式。这篇文章将介绍其中的四种通用的扫描类型。
|
||||
|
||||
**四种通用扫描类型**
|
||||
### 四种通用扫描类型
|
||||
|
||||
下面列出了最常使用的四种扫描类型:
|
||||
|
||||
1. PING 扫描 (-sP)
|
||||
2. TCP SYN 扫描 (-sS)
|
||||
3. TCP Connect() 扫描 (-sT)
|
||||
4. UDP 扫描 (-sU)
|
||||
1. PING 扫描 (`-sP`)
|
||||
2. TCP SYN 扫描 (`-sS`)
|
||||
3. TCP Connect() 扫描 (`-sT`)
|
||||
4. UDP 扫描 (`-sU`)
|
||||
|
||||
当我们利用 NMAP 来执行扫描的时候,这四种扫描类型是我们需要熟练掌握的。更重要的是需要知道这些命令做了什么并且需要知道这些命令是怎么做的。本文将介绍 PING 扫描和 UDP 扫描。在之后的文中会介绍 TCP 扫描。
|
||||
|
||||
**PING 扫描 (-sP)**
|
||||
### PING 扫描 (-sP)
|
||||
|
||||
某些扫描会造成网络拥塞,然而 Ping 扫描在网络中最多只会产生两个包。当然这两个包不包括可能需要的 DNS 搜索和 ARP 请求。每个被扫描的 IP 最少只需要一个包来完成 Ping 扫描。
|
||||
|
||||
通常 Ping 扫描是用来查看在指定的 IP 地址上是否有在线的主机存在。例如,当我拥有网络连接却联不上一台指定的网络服务器的时候,我就可以使用 PING 来判断这台服务器是否在线。PING 同样也可以用来验证我的当前设备与网络服务器之间的路由是否正常。
|
||||
通常 Ping 扫描是用来查看在指定的 IP 地址上是否有在线的主机存在。例如,当我拥有网络连接却连不上一台指定的网络服务器的时候,我就可以使用 PING 来判断这台服务器是否在线。PING 同样也可以用来验证我的当前设备与网络服务器之间的路由是否正常。
|
||||
|
||||
**注意:** 当我们讨论 TCP/IP 的时候,相关信息在使用 TCP/IP 协议的英特网与局域网(LAN)中都是相当有用的。这些程序都能工作。同样在广域网(WAN)也能工作得相当好。
|
||||
**注意:** 当我们讨论 TCP/IP 的时候,相关信息在使用 TCP/IP 协议的互联网与局域网(LAN)中都是相当有用的。这些程序都能工作。同样在广域网(WAN)也能工作得相当好。
|
||||
|
||||
当参数给出的是一个域名的时候,我们就需要域名解析服务来找到相对应的 IP 地址,这个时候将会生成一些额外的包。例如,当我们执行 ‘ping linuxforum.com’ 的时候,需要首先请求域名(linuxforum.com)的 IP 地址(98.124.199.63)。当我们执行 ‘ping 98.124.199.63’ 的时候 DNS 查询就不需要了。当 MAC 地址未知的时候,就需要发送 ARP 请求来获取指定 IP 地址的 MAC 地址了(这里的指定 IP 地址,未必是目的 IP)。
|
||||
当参数给出的是一个域名的时候,我们就需要域名解析服务来找到相对应的 IP 地址,这个时候将会生成一些额外的包。例如,当我们执行 `ping linuxforum.com` 的时候,需要首先请求域名(linuxforum.com)的 IP 地址(98.124.199.63)。当我们执行 `ping 98.124.199.63` 的时候 DNS 查询就不需要了。当 MAC 地址未知的时候,就需要发送 ARP 请求来获取指定 IP 地址的 MAC 地址了(LCTT 译注:这里的指定 IP 地址,未必是目的 IP)。
|
||||
|
||||
Ping 命令会向指定的 IP 地址发送一个英特网信息控制协议(ICMP)包。这个包是需要响应的 ICMP Echo 请求。当服务器系统在线的状态下我们会得到一个响应包。当两个系统之间存在防火墙的时候,PING 请求包可能会被防火墙丢弃。一些服务器也会被配置成不响应 PING 请求来避免可能发生的死亡之 PING。(现在的操作系统似乎不太可能)
|
||||
Ping 命令会向指定的 IP 地址发送一个英特网信息控制协议(ICMP)包。这个包是需要响应的 ICMP Echo 请求。当服务器系统在线的状态下我们会得到一个响应包。当两个系统之间存在防火墙的时候,PING 请求包可能会被防火墙丢弃。一些服务器也会被配置成不响应 PING 请求来避免可能发生的死亡之 PING。(LCTT 译注:现在的操作系统似乎不太可能)
|
||||
|
||||
**注意:** 死亡之 PING 是一种恶意构造的 PING 包当它被发送到系统的时候,会造成被打开的连接等待一个 rest 包。一旦有一堆这样的恶意请求被系统响应,由于所有的可用连接都已经被打开所以系统将会拒绝所有其它的连接。技术上来说这种状态下的系统就是不可达的。
|
||||
**注意:** 死亡之 PING 是一种恶意构造的 PING 包当它被发送到系统的时候,会造成被打开的连接等待一个 rest 包。一旦有一堆这样的恶意请求被系统响应,由于所有的可用连接都已经被打开,所以系统将会拒绝所有其它的连接。技术上来说这种状态下的系统就是不可达的。
|
||||
|
||||
当系统收到 ICMP Echo 请求后它将会返回一个 ICMP Echo 响应。当源系统收到 ICMP Echo 响应后我们就能知道目的系统是在线可达的。
|
||||
|
||||
使用 NMAP 的时候你可以指定单个 IP 地址也可以指定 某个 IP 地址段。当被指定为 PING 扫描(-sP)的时候,PING 命令将会对每一个 IP 地址执行。
|
||||
使用 NMAP 的时候你可以指定单个 IP 地址也可以指定某个 IP 地址段。当被指定为 PING 扫描(`-sP`)的时候,会对每一个 IP 地址执行 PING 命令。
|
||||
|
||||
在图 1 中你可以看到我执行‘nmap -sP 10.0.0.1-10’命令后的结果。An ARP is sent out, three for each IP Address given to the command. In this case thirty requests went out – two for each of the ten IP Addresses.(这两句话就没有读懂,不清楚具体指的是什么意思,从图2看的话第一句里的三指的是两个 ARP 包和一个 ICMP 包,按照下面一段话的描述的话就是每个 IP 地址会有三个 ARP 请求,但是自己试的时候 Centos6 它发了两个 ARP 请求没获取到 MAC 地址也就就结束了,这里不清楚究竟怎么理解)
|
||||
在图 1 中你可以看到我执行 `nmap -sP 10.0.0.1-10` 命令后的结果。程序会试着联系 IP 地址 10.0.0.1 到 10.0.0.10 之间的每个系统。对每个 IP 地址都要发出三个 ARP 请求。在我们的例子中发出了三十个请求,这 10 个 IP 地址里面有两个有回应。(LCTT 译注:此处原文存疑。)
|
||||
|
||||
![Figure 01.jpg](https://www.linuxforum.com/attachments/figure-01-jpg.105/)
|
||||
![Figure 01](https://www.linuxforum.com/attachments/figure-01-jpg.105/)
|
||||
|
||||
**图 1**
|
||||
*图 1*
|
||||
|
||||
图 2 中展示了利用 Wireshark 抓取的从网络上另一台计算机发出的请求-的确是在 Windows 系统下完成这次抓取的。第一行展示了发出的第一条请求,广播请求的是 10.0.0.2 IP 地址对应 MAC 地址。由于 NMAP 是在 10.0.0.1 这台机器上执行的,因此 10.0.0.1 被略过了。由于本机 IP 地址被略过,我们现在可以说总共只发出了 27 个 ARP 请求。第二行展示了 10.0.0.2 这台机器的 ARP 响应。第三行到第十行是其它八个 IP 地址的 ARP 请求。第十一行是由于没有收到请求系统(10.0.0.1)的反馈所以发送的另一个 ARP 响应。(自己试的话它发送一个请求收到一个响应就结束了,也没有搜到相关的重发响应是否存在的具体说明,不是十分清楚)第十二行是源系统向 10.0.0.2 响应的 ‘SYN’ 和 Sequence 0。(这行感觉更像是三次握手里的首包)第十三行和第十四行的两次 Restart(RST)和 Synchronize(SYN)响应是用来关闭第二行和第十一行所打开的连接的。(这个描述似乎有问题 ARP 请求怎么会需要 TCP 来关闭连接呢,感觉像是第十二行的响应)注意 Sequence ID 是 ‘1’ - 是源 Sequence ID + 1。(这个不理解,不是应该 ACK = seq + 1 的么)第十五行开始就是类似相同的内容。
|
||||
图 2 中展示了网络上另一台计算机利用 Wireshark 抓取的发出的请求——没错,是在 Windows 系统下完成这次抓取的。第一行展示了发出的第一条请求,广播请求的是 IP 地址 10.0.0.2 对应 MAC 地址。由于 NMAP 是在 10.0.0.1 这台机器上执行的,因此 10.0.0.1 被略过了。由于本机 IP 地址被略过,我们现在可以看到总共只发出了 27 个 ARP 请求。第二行展示了 10.0.0.2 这台机器的 ARP 响应。第三行到第十行是其它八个 IP 地址的 ARP 请求。第十一行是由于 10.0.0.2 没有收到请求系统(10.0.0.1)的反馈所以(重新)发送的另一个 ARP 响应。第十二行是源系统向 10.0.0.2 发起的 HTTP 连接的 ‘SYN’ 和 Sequence 0。第十三行和第十四行的两次 Restart(RST)和 Synchronize(SYN)响应是用来关闭(和重发)第十二行所打开的连接的。注意 Sequence ID 是 ‘1’ - 是源 Sequence ID + 1。第十五行开始就是类似相同的内容。(LCTT 译注:此处原文有误,根据情况已经修改。)
|
||||
|
||||
![Figure 02.jpg](https://www.linuxforum.com/attachments/figure-02-jpg.106/)
|
||||
![Figure 02.jpg](https://www.linuxforum.com/attachments/figure-02-jpg.106/)
|
||||
|
||||
**图 2**
|
||||
*图 2*
|
||||
|
||||
回到图 1 中我们可以看到有两台主机在线。其中一台是本机(10.0.0.1)另一台是(10.0.0.2)。整个扫描花费了 14.40 秒。
|
||||
|
||||
@ -50,31 +50,31 @@ PING 扫描是一种用来发现在线主机的快速扫描方式。扫描结果
|
||||
|
||||
一旦你获得了在线系统的列表,你就可以使用 UDP 扫描来查看哪些端口是可能开启了的。
|
||||
|
||||
**UDP 扫描 (-sU)**
|
||||
### UDP 扫描 (-sU)
|
||||
|
||||
现在你已经知道了有那些系统是在线的,你的扫描就可以聚焦在这些 IP 地址之上。在整个网络上执行大量的没有针对性的扫描活动可不是一个好主意。系统管理员可以使用程序来监控网络流量当有大量可以活动发生的时候就会触发警报。
|
||||
现在你已经知道了有那些系统是在线的,你的扫描就可以聚焦在这些 IP 地址之上。在整个网络上执行大量的没有针对性的扫描活动可不是一个好主意,系统管理员可以使用程序来监控网络流量当有大量异常活动发生的时候就会触发警报。
|
||||
|
||||
用户数据报协议(UDP)在发现在线系统的开放端口方面十分有用。由于 UDP 不是一个面向连接的协议,因此是不需要响应的。这种扫描方式可以向指定的端口发送一个 UDP 包。如果目标系统没有回应那么这个端口可能是关闭的也可能是被过滤了的。如果端口是开放状态的那么应该会有一个响应。在大多数的情况下目标系统会返回一个 ICMP 信息说端口不可达。ICMP 信息让 NMAP 知道端口是被关闭了。如果端口是开启的状态那么目标系统应该响应 ICMP 信息来告知 NMAP 端口可达。
|
||||
|
||||
**注意: **只有最前面的1024个常用端口会被扫描。(这里将 1000 改成了1024,因为手册中写的是默认扫描 1 到 1024 端口)在后面的文章中我们会介绍如何进行深度扫描。
|
||||
**注意: **只有最前面的 1024 个常用端口会被扫描。(LCTT 译注:这里将 1000 改成了1024,因为手册中写的是默认扫描 1 到 1024 端口)在后面的文章中我们会介绍如何进行深度扫描。
|
||||
|
||||
由于我知道 10.0.0.2 这个主机是在线的,因此我只会针对这个 IP 地址来执行扫描。扫描过程中总共收发了 3278 个包。‘sudo nmap -sU 10.0.0.2’这个命令的输出结果在图 3 中展现。
|
||||
由于我知道 10.0.0.2 这个主机是在线的,因此我只会针对这个 IP 地址来执行扫描。扫描过程中总共收发了 3278 个包。`sudo nmap -sU 10.0.0.2` 这个命令的输出结果在图 3 中展现。
|
||||
|
||||
![Figure 03.jpg](https://www.linuxforum.com/attachments/figure-03-jpg.107/)
|
||||
![Figure 03.jpg](https://www.linuxforum.com/attachments/figure-03-jpg.107/)
|
||||
|
||||
**图 3**
|
||||
*图 3*
|
||||
|
||||
在这副图中你可以看见端口 137(netbios-ns)被发现是开放的。在图 4 中展示了 Wireshark 抓包的结果。不能看到所有抓取的包,但是可以看到一长串的 UDP 包。
|
||||
|
||||
![Figure 4.jpg](https://www.linuxforum.com/attachments/figure-4-jpg.108/)
|
||||
![Figure 4.jpg](https://www.linuxforum.com/attachments/figure-4-jpg.108/)
|
||||
|
||||
**图 4**
|
||||
*图 4*
|
||||
|
||||
如果我把目标系统上的防火墙关闭之后会发生什么呢?我的结果有那么一点的不同。NMAP 命令的执行结果在图 5 中展示。
|
||||
|
||||
![Figure 05.png](https://www.linuxforum.com/attachments/figure-05-png.109/)
|
||||
![Figure 05.png](https://www.linuxforum.com/attachments/figure-05-png.109/)
|
||||
|
||||
**图 5**
|
||||
*图 5*
|
||||
|
||||
**注意:** 当你执行 UDP 扫描的时候是需要 root 权限的。
|
||||
|
||||
@ -86,7 +86,7 @@ via: https://www.linuxforum.com/threads/nmap-common-scans-part-one.3637/
|
||||
|
||||
作者:[Jarret][a]
|
||||
译者:[wcnnbdk1](https://github.com/wcnnbdk1)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,30 +1,18 @@
|
||||
如何在 CentOS 7 中通过 HHVM 和 Nginx 安装 WordPress
|
||||
========================
|
||||
|
||||
### 导航
|
||||
HHVM (HipHop Virtual Machine) 是一个用于执行以 PHP 和 Hack 语言编写的代码的虚拟环境。它是由 Facebook 开发的,提供了当前 PHP 7 的大多数功能。要在你的服务器上运行 HHVM,你需要使用 FastCGI 来将 HHVM 和 Nginx 或 Apache 衔接起来,或者你也可以使用 HHVM 中的内置 Web 服务器 Proxygen。
|
||||
|
||||
1. [步骤 1 - 配置 SELinux 并添加v EPEL 仓库][1]
|
||||
2. [步骤 2 - 安装 Nginx][2]
|
||||
3. [步骤 3 - 安装并配置 MariaDB][3]
|
||||
4. [步骤 4 - 安装 HHVM][4]
|
||||
5. [步骤 5 - 配置 HHVM][5]
|
||||
6. [步骤 6 - 配置 HHVM 和 Nginx][6]
|
||||
7. [步骤 7 - 通过 HHVM 和 Nginx 创建虚拟主机][7]
|
||||
8. [步骤 8 - 安装 WordPress][8]
|
||||
9. [参考链接][9]
|
||||
|
||||
HHVM (HipHop Virtual Machine) is an open source virtual machine for executing programs written in PHP and Hack language. HHVM has been developed by Facebook, it provides most features of the current PHP 7 version. To run HHVM on your server, you can use a FastCGI to connect HHVM with a Nginx or Apache web server, or you can use the web server built into HHVM called "Proxygen".
|
||||
|
||||
In this tutorial, I will show you how to install WordPress with HHVM and Nginx as web server. I will use CentOS 7 as the operating system, so basic knowledge of CentOS is required.
|
||||
在这篇教程中,我将展示给你如何在 Nginx Web 服务器的 HHVM 上安装 WordPress。这里我使用 CentOS 7 作为操作系统,所以你需要懂一点 CentOS 操作的基础。
|
||||
|
||||
**先决条件**
|
||||
|
||||
* CentOS 7 - 64位
|
||||
* Root 特权
|
||||
* Root 权限
|
||||
|
||||
### 步骤 1 - 配置 SELinux 并添加v EPEL 仓库
|
||||
### 步骤 1 - 配置 SELinux 并添加 EPEL 仓库
|
||||
|
||||
在本教程中,我们将以强制模式来运行 SELinux,所以我们需要在系统上安装一个 SELinux 管理工具。这里我们使用 setools 和 setrobleshoot 来管理 SELinux 的各项配置。
|
||||
在本教程中,我们将使用 SELinux 的强制模式,所以我们需要在系统上安装一个 SELinux 管理工具。这里我们使用 `setools` 和 `setrobleshoot` 来管理 SELinux 的各项配置。
|
||||
|
||||
CentOS 7 已经默认启用 SELinux,我们可以通过以下命令来确认:
|
||||
|
||||
@ -37,13 +25,13 @@ CentOS 7 已经默认启用 SELinux,我们可以通过以下命令来确认:
|
||||
|
||||
如图,你能够看到,SELinux 已经开启了强制模式。
|
||||
|
||||
接下来就是使用 yum 来安装 setools 和 setroubleshoot 了。
|
||||
接下来就是使用 `yum` 来安装 `setools` 和 `setroubleshoot` 了。
|
||||
|
||||
```
|
||||
# yum -y install setroubleshoot setools net-tools
|
||||
```
|
||||
|
||||
安装好这两个后,在安装 EPEL 仓库。
|
||||
安装好这两个后,再安装 EPEL 仓库。
|
||||
|
||||
```
|
||||
# yum -y install epel-release
|
||||
@ -51,22 +39,22 @@ CentOS 7 已经默认启用 SELinux,我们可以通过以下命令来确认:
|
||||
|
||||
### 步骤 2 - 安装 Nginx
|
||||
|
||||
Nginx (发音:engine-x) 是一个高性能、低消耗的轻量级 Web 服务器软件。在 CentOS 中可以使用 yum 命令来安装 Nginx 包。记住用 root 用登录系统哦。
|
||||
Nginx (发音:engine-x) 是一个高性能、低内存消耗的轻量级 Web 服务器软件。在 CentOS 中可以使用 `yum` 命令来安装 Nginx 包。确保你以 root 用户登录系统。
|
||||
|
||||
使用 yum 命令从 CentOS 仓库中安装 nginx。
|
||||
使用 `yum` 命令从 CentOS 仓库中安装 nginx。
|
||||
|
||||
```
|
||||
# yum -y install nginx
|
||||
```
|
||||
|
||||
现在可以使用 systemctl 命令来启动 Nginx,同时将其设置为跟随系统启动。
|
||||
现在可以使用 `systemctl` 命令来启动 Nginx,同时将其设置为跟随系统启动。
|
||||
|
||||
```
|
||||
# systemctl start nginx
|
||||
# systemctl enable nginx
|
||||
```
|
||||
|
||||
为确保 Nginx 已经正确运行于服务器中,在浏览上输入服务器的 IP,或者如下使用 curl 命令检查显示结果。
|
||||
为确保 Nginx 已经正确运行于服务器中,在浏览器上输入服务器的 IP,或者如下使用 `curl` 命令检查显示结果。
|
||||
|
||||
```
|
||||
# curl 192.168.1.110
|
||||
@ -78,7 +66,7 @@ Nginx (发音:engine-x) 是一个高性能、低消耗的轻量级 Web 服务
|
||||
|
||||
### 步骤 3 - 安装并配置 MariaDB
|
||||
|
||||
MariaDB 是由原 MySQL 开发者 Monty Widenius 开发的一款开源数据库软件,它由 MySQL 分支而来,但与 MySQL 的主要用法保持一致。在这一步中,我们要安装 MariaDB 数据库并为之配置好 root 密码,然后在为 WordPress 安装的需要创建一个新的数据库和用户。
|
||||
MariaDB 是由原 MySQL 开发者 Monty Widenius 开发的一款开源数据库软件,它由 MySQL 分支而来,与 MySQL 的主要功能保持一致。在这一步中,我们要安装 MariaDB 数据库并为之配置好 root 密码,然后再为所要安装的 WordPress 创建一个新的数据库和用户。
|
||||
|
||||
安装 mariadb 和 mariadb-server:
|
||||
|
||||
@ -115,7 +103,7 @@ Reload privilege tables now? [Y/n] Y
|
||||
... Success!
|
||||
```
|
||||
|
||||
这样就设置好了 MariaDB 的 root 密码。现在登录到 MariaDB/MySQL shell 并为 WordPress 的安装创建一个新数据库 **"wordpressdb"** 和新用户 **"wpuser"**,密码设置为 **"wpuser@"**。在你的安装设置中要选用一个安全的密码。
|
||||
这样就设置好了 MariaDB 的 root 密码。现在登录到 MariaDB/MySQL shell 并为 WordPress 的安装创建一个新数据库 `wordpressdb` 和新用户 `wpuser`,密码设置为 `wpuser@`。为你的设置选用一个安全的密码。
|
||||
|
||||
登录到 MariaDB/MySQL shell:
|
||||
|
||||
@ -141,9 +129,9 @@ MariaDB [(none)]> \q
|
||||
|
||||
### 步骤 4 - 安装 HHVM
|
||||
|
||||
对于 HHVM,我们需要安装大量的依赖。作为选择,你可以从 GitHub 下载 HHVM 的源码来编译安装,也可以从网络上获取预编译的包进行安装。在本教程中,我使用的是预编译的安装包。
|
||||
对于 HHVM,我们需要安装大量的依赖项。作为选择,你可以从 GitHub 下载 HHVM 的源码来编译安装,也可以从网络上获取预编译的包进行安装。在本教程中,我使用的是预编译的安装包。
|
||||
|
||||
为 HHVM 安装依赖。
|
||||
为 HHVM 安装依赖项:
|
||||
|
||||
```
|
||||
# yum -y install cpp gcc-c++ cmake git psmisc {binutils,boost,jemalloc,numactl}-devel \
|
||||
@ -154,7 +142,7 @@ MariaDB [(none)]> \q
|
||||
> mariadb mariadb-server libc-client make
|
||||
```
|
||||
|
||||
然后是使用 rpm 安装从 [HHVM 预编译包镜像站点][13] 下载的 HHVM 预编译包。
|
||||
然后是使用 `rpm` 安装从 [HHVM 预编译包镜像站点][13] 下载的 HHVM 预编译包。
|
||||
|
||||
```
|
||||
# rpm -Uvh http://mirrors.linuxeye.com/hhvm-repo/7/x86_64/hhvm-3.15.2-1.el7.centos.x86_64.rpm
|
||||
@ -167,7 +155,7 @@ MariaDB [(none)]> \q
|
||||
# hhvm --version
|
||||
```
|
||||
|
||||
为了能使用 PHP 命令,可以把 hhvm 命令设置为 php。这样在 shell 中输入 'php' 命令的时候,你会看到和输入 hhvm 命令一样的结果。
|
||||
为了能使用 PHP 命令,可以把 `hhvm` 命令设置为 `php`。这样在 shell 中输入 `php` 命令的时候,你会看到和输入 `hhvm` 命令一样的结果。
|
||||
|
||||
```
|
||||
# sudo update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
|
||||
@ -178,9 +166,9 @@ MariaDB [(none)]> \q
|
||||
|
||||
### 步骤 5 - 配置 HHVM
|
||||
|
||||
这一步中,我们来配置 HHVM 以系统服务器来运行。我们不通过端口这种常规的方式来运行它,而是选择使用 unix socket 文件的方式,这样运行的更快速一点。
|
||||
这一步中,我们来配置 HHVM 以系统服务来运行。我们不通过端口这种常规的方式来运行它,而是选择使用 unix socket 文件的方式,这样运行的更快速一点。
|
||||
|
||||
进入 systemd 配置目录,并创建一个 hhvm.service 文件。
|
||||
进入 systemd 配置目录,并创建一个 `hhvm.service` 文件。
|
||||
|
||||
```
|
||||
# cd /etc/systemd/system/
|
||||
@ -203,14 +191,14 @@ WantedBy=multi-user.target
|
||||
|
||||
保存文件退出 vim。
|
||||
|
||||
接下来,进入 hhvm 目录并编辑 server.ini 文件。
|
||||
接下来,进入 `hhvm` 目录并编辑 `server.ini` 文件。
|
||||
|
||||
```
|
||||
# cd /etc/hhvm/
|
||||
# vim server.ini
|
||||
```
|
||||
|
||||
将第 7 行 hhvm.server.port 替换为 unix socket,如下:
|
||||
将第 7 行 `hhvm.server.port` 替换为 unix socket,如下:
|
||||
|
||||
```
|
||||
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
|
||||
@ -218,7 +206,7 @@ hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
|
||||
|
||||
保存文件并退出编辑器。
|
||||
|
||||
我们已在 hhvm 服务文件中定义了 hhvm 以 'nginx' 用户身份运行,所以还需要把 socket 文件目录的属主变更为 'nginx'。然后我们还必须在 SELinux 中修改 hhvm 目录内容以便让它可以访问这个 socket 文件。
|
||||
我们已在 hhvm 服务文件中定义了 hhvm 以 `nginx` 用户身份运行,所以还需要把 socket 文件目录的属主变更为 `nginx`。然后我们还必须在 SELinux 中修改 hhvm 目录的权限上下文以便让它可以访问这个 socket 文件。
|
||||
|
||||
```
|
||||
# chown -R nginx:nginx /var/run/hhvm/
|
||||
@ -228,7 +216,7 @@ hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
|
||||
|
||||
服务器重启之后,hhvm 将不能运行,因为没有存储 socket 文件的目录,所有还必须在启动的时候自动创建一个。
|
||||
|
||||
使用 vim 编辑 rc.local 文件。
|
||||
使用 vim 编辑 `rc.local` 文件。
|
||||
|
||||
```
|
||||
# vim /etc/rc.local
|
||||
@ -257,7 +245,7 @@ hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
|
||||
# systemctl enable hhvm
|
||||
```
|
||||
|
||||
要确保无误,使用 netstat 命令验证 hhvm 运行于 socket 文件。
|
||||
要确保无误,使用 `netstat` 命令验证 hhvm 运行于 socket 文件。
|
||||
|
||||
```
|
||||
# netstat -pl | grep hhvm
|
||||
@ -267,16 +255,16 @@ hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
|
||||
|
||||
### 步骤 6 - 配置 HHVM 和 Nginx
|
||||
|
||||
在这个步骤中,我们配置好 HHVM 已让它运行在 Nginx Web 服务中,这需要在 Nginx 目录创建一个 hhvm 的配置文件。
|
||||
在这个步骤中,我们将配置 HHVM 已让它运行在 Nginx Web 服务中,这需要在 Nginx 目录创建一个 hhvm 的配置文件。
|
||||
|
||||
进入 /etc/nginx 目录,创建 a hhvm.conf 文件。
|
||||
进入 `/etc/nginx` 目录,创建 `hhvm.conf` 文件。
|
||||
|
||||
```
|
||||
# cd /etc/nginx/
|
||||
# vim hhvm.conf
|
||||
```
|
||||
|
||||
粘贴一下内容到文件中。
|
||||
粘贴以下内容到文件中。
|
||||
|
||||
```
|
||||
location ~ \.(hh|php)$ {
|
||||
@ -291,13 +279,13 @@ location ~ \.(hh|php)$ {
|
||||
|
||||
然后,保存并退出。
|
||||
|
||||
接下来,编辑 nginx.conf 文件,添加 hhvm 配置文件到 include 行。
|
||||
接下来,编辑 `nginx.conf` 文件,添加 hhvm 配置文件到 `include` 行。
|
||||
|
||||
```
|
||||
# vim nginx.conf
|
||||
```
|
||||
|
||||
添加配置到第 57 行的 server 指令中。
|
||||
添加配置到第 57 行的 `server` 指令中。
|
||||
|
||||
```
|
||||
include /etc/nginx/hhvm.conf;
|
||||
@ -305,7 +293,7 @@ include /etc/nginx/hhvm.conf;
|
||||
|
||||
保存并退出。
|
||||
|
||||
然后修改 SELinux 中关于 hhvm 配置文件的内容。
|
||||
然后修改 SELinux 中关于 hhvm 配置文件的权限上下文。
|
||||
|
||||
```
|
||||
# semanage fcontext -a -t httpd_config_t /etc/nginx/hhvm.conf
|
||||
@ -319,19 +307,19 @@ include /etc/nginx/hhvm.conf;
|
||||
# systemctl restart nginx
|
||||
```
|
||||
|
||||
记住确保没有错误。
|
||||
记住确保测试配置没有错误。
|
||||
|
||||
### 步骤 7 - 通过 HHVM 和 Nginx 创建虚拟主机
|
||||
|
||||
在这一步中能,我们要为 Nginx 和 hhvm 创建一个新的虚拟主机配置文件。这里我使用域名 **"natsume.co"** 来作为例子.你可以使用你主机喜欢的域名,并在配置文件中相应位置以及 WordPress 安装过程中进行替换。
|
||||
在这一步中,我们要为 Nginx 和 hhvm 创建一个新的虚拟主机配置文件。这里我使用域名 `natsume.co` 来作为例子,你可以使用你主机喜欢的域名,并在配置文件中相应位置以及 WordPress 安装过程中进行替换。
|
||||
|
||||
进入 nginx conf.d 目录,我们将在该目录存储虚拟主机文件。
|
||||
进入 nginx 的 `conf.d` 目录,我们将在该目录存储虚拟主机文件。
|
||||
|
||||
```
|
||||
# cd /etc/nginx/conf.d/
|
||||
```
|
||||
|
||||
使用 vim 创建一个名为 "natsume.conf" 的配置文件。
|
||||
使用 vim 创建一个名为 `natsume.conf` 的配置文件。
|
||||
|
||||
```
|
||||
# vim natsume.conf
|
||||
@ -367,15 +355,14 @@ server {
|
||||
|
||||
保存并退出。
|
||||
|
||||
在这给虚拟主机配置文件中,我们定义该域名的 Web 根目录为 "/var/www/hakase"。目前该目录还不存在,所有我们要创建它,并变更属主为 nginx 用户和组。
|
||||
在这个虚拟主机配置文件中,我们定义该域名的 Web 根目录为 `/var/www/hakase`。目前该目录还不存在,所有我们要创建它,并变更属主为 nginx 用户和组。
|
||||
|
||||
```
|
||||
# mkdir -p /var/www/hakase
|
||||
# chown -R nginx:nginx /var/www/hakase
|
||||
```
|
||||
|
||||
|
||||
Next, configure the SELinux context for the file and directory.
|
||||
接下来,为该文件和目录配置 SELinux 上下文。
|
||||
|
||||
```
|
||||
# semanage fcontext -a -t httpd_config_t "/etc/nginx/conf.d(/.*)?"
|
||||
@ -393,28 +380,28 @@ Next, configure the SELinux context for the file and directory.
|
||||
|
||||
在步骤 5 的时候,我们已经为 WordPress 配置好了虚拟主机,现在只需要下载 WordPress 和使用我们在步骤 3 的时候创建的数据库和用户来编辑数据库配置就好了。
|
||||
|
||||
进入 Web 根目录 "/var/www/hakase" 并使用 Wget 命令下载 WordPress:
|
||||
进入 Web 根目录 `/var/www/hakase` 并使用 Wget 命令下载 WordPress:
|
||||
|
||||
```
|
||||
# cd /var/www/hakase
|
||||
# wget wordpress.org/latest.tar.gz
|
||||
```
|
||||
|
||||
解压 "latest.tar.gz" 并将 wordpress 文件夹中所有的文件和目录移动到当前目录:
|
||||
解压 `latest.tar.gz` 并将 `wordpress` 文件夹中所有的文件和目录移动到当前目录:
|
||||
|
||||
```
|
||||
# tar -xzvf latest.tar.gz
|
||||
# mv wordpress/* .
|
||||
```
|
||||
|
||||
下一步,复制一份 "wp-config-sample.php" 并更名为 "wp-config.php",然后使用 vim 进行编辑:
|
||||
下一步,复制一份 `wp-config-sample.php` 并更名为 `wp-config.php`,然后使用 vim 进行编辑:
|
||||
|
||||
```
|
||||
# cp wp-config-sample.php wp-config.php
|
||||
# vim wp-config.php
|
||||
```
|
||||
|
||||
将 DB_NAME 设置为 **"wordpressdb"**、DB_USER 设置为 **"wpuser"** 以及 DB_PASSWORD 设置为 **"wpuser@"**。
|
||||
将 `DB_NAME` 设置为 `wordpressdb`、`DB_USER` 设置为 `wpuser` 以及 `DB_PASSWORD` 设置为 `wpuser@`。
|
||||
|
||||
```
|
||||
define('DB_NAME', 'wordpressdb');
|
||||
@ -427,28 +414,28 @@ define('DB_HOST', 'localhost');
|
||||
|
||||
[![WordPress 配置](https://www.howtoforge.com/images/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/6.png)][16]
|
||||
|
||||
修改关于 WordPress 目录的 SELinux 配置指令。
|
||||
修改关于 WordPress 目录的 SELinux 上下文。
|
||||
|
||||
```
|
||||
# semanage fcontext -a -t httpd_sys_content_t "/var/www/hakase(/.*)?"
|
||||
# restorecon -Rv /var/www/hakase
|
||||
```
|
||||
|
||||
现在打开 Web 浏览器,在地址栏输入你之前为 WordPress 设置的域名,我这里是 "natsume.co"。
|
||||
现在打开 Web 浏览器,在地址栏输入你之前为 WordPress 设置的域名,我这里是 `natsume.co`。
|
||||
|
||||
选择英语并点击 '继续 (Continue)'。
|
||||
选择语言并点击<ruby>继续<rt>Continue</rt></ruby>。
|
||||
|
||||
[![安装 Wordpress - 语言选择](https://www.howtoforge.com/images/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/7.png)][17]
|
||||
|
||||
根据自身要求填写站点标题和描述并点击 "安装 Wordpress (Install Wordpress)"。
|
||||
根据自身要求填写站点标题和描述并点击<ruby>安装 Wordpress<rt>Install Wordpress</rt></ruby>"。
|
||||
|
||||
[![安装 Wordpress - 配置管理员账号和站点标题](https://www.howtoforge.com/images/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/8.png)][18]
|
||||
|
||||
耐心等待安装完成。你会见到如下页面,点击 "登录 (Log In)" 来登录到管理面板。
|
||||
耐心等待安装完成。你会见到如下页面,点击<ruby>登录<rt>Log In</rt></ruby>来登录到管理面板。
|
||||
|
||||
[![安装 Wordpress - 成功安装](https://www.howtoforge.com/images/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/9.png)][19]
|
||||
|
||||
输入你设置的管理员用户账号和密码,在此点击 "登录 (Log In)"。
|
||||
输入你设置的管理员用户账号和密码,在此点击<ruby>登录<rt>Log In</rt></ruby>。
|
||||
|
||||
[![登录到 wordpress 管理面板](https://www.howtoforge.com/images/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/10.png)][20]
|
||||
|
||||
@ -456,7 +443,7 @@ define('DB_HOST', 'localhost');
|
||||
|
||||
[![Wordpress 管理面](https://www.howtoforge.com/images/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/11.png)][21]
|
||||
|
||||
Wordpress 主页。
|
||||
Wordpress 的主页:
|
||||
|
||||
[![Wordpress 默认主页](https://www.howtoforge.com/images/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/12.png)][22]
|
||||
|
||||
@ -464,8 +451,7 @@ Wordpress 主页。
|
||||
|
||||
### 参考链接
|
||||
|
||||
- [https://www.howtoforge.com/tutorial/how-to-install-wordpress-with-hhvm-and-nginx-on-opensuse-leap-42-1/](https://www.howtoforge.com/tutorial/how-to-install-wordpress-with-hhvm-and-nginx-on-opensuse-leap-42-1/)
|
||||
- [https://www.nginx.com/blog/nginx-se-linux-changes-upgrading-rhel-6-6/https://www.nginx.com/blog/nginx-se-linux-changes-upgrading-rhel-6-6/](https://www.nginx.com/blog/nginx-se-linux-changes-upgrading-rhel-6-6/)
|
||||
- https://www.nginx.com/blog/nginx-se-linux-changes-upgrading-rhel-6-6/
|
||||
|
||||
------------------------------------
|
||||
|
||||
@ -477,9 +463,9 @@ Wordpress 主页。
|
||||
|
||||
via: https://www.howtoforge.com/tutorial/how-to-install-wordpress-with-hhvm-and-nginx-on-centos-7/
|
||||
|
||||
作者:[ Muhammad Arul][a]
|
||||
作者:[Muhammad Arul][a]
|
||||
译者:[GHLandy](https://github.com/GHLandy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -2,11 +2,11 @@ Go 语言编译期断言
|
||||
============================================================
|
||||
|
||||
|
||||
这篇文章是关于一个鲜为人知的方法让 Go 在编译期断言。你可能不会使用它,但是了解一下也很有趣。
|
||||
这篇文章是关于一个鲜为人知的让 Go 在编译期断言的方法。你可能不会使用它,但是了解一下也很有趣。
|
||||
|
||||
作为一个热身,这里是一个在 Go 中相当知名的编译时断言:接口满意度检查。
|
||||
作为一个热身,来看一个在 Go 中熟知的编译期断言:接口满意度检查。
|
||||
|
||||
在这段代码([playground][1])中,`var _ =` 行确保类型 `W` 是一个 `stringWriter`,由 [`io.WriteString`][2] 检查。
|
||||
在这段代码([playground][1])中,`var _ =` 行确保类型 `W` 是一个 `stringWriter`,其由 [`io.WriteString`][2] 检查。
|
||||
|
||||
```
|
||||
package main
|
||||
@ -39,13 +39,13 @@ main.go:14: cannot use W literal (type W) as type stringWriter in assignment:
|
||||
|
||||
这是很有用的。对于大多数同时满足 `io.Writer` 和 `stringWriter` 的类型,如果你删除 `WriteString` 方法,一切都会像以前一样继续工作,但性能较差。
|
||||
|
||||
你可以使用编译时断言保护你的代码,而不是试图使用[`testing.T.AllocsPerRun'][3]为性能回归编写一个脆弱的测试。
|
||||
你可以使用编译期断言保护你的代码,而不是试图使用[`testing.T.AllocsPerRun'][3]为性能回归编写一个脆弱的测试。
|
||||
|
||||
这是[一个实际的 io 包中的技术例子][4]。
|
||||
|
||||
* * *
|
||||
|
||||
好的,让我们隐晦一点!
|
||||
好的,让我们低调一点!
|
||||
|
||||
接口满意检查是很棒的。但是如果你想检查一个简单的布尔表达式,如 `1 + 1 == 2` ?
|
||||
|
||||
@ -69,9 +69,9 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
`Hash` 可能是某种抽象的哈希结果。`init` 函数确保它将与[crypto/md5][6]一起工作。如果你改变 `Hash` 为(也就是)`[8]byte`,它会在进程启动时发生混乱。但是,这是一个运行时检查。如果我们想要早点发现怎么办?
|
||||
`Hash` 可能是某种抽象的哈希结果。`init` 函数确保它将与 [crypto/md5][6] 一起工作。如果你改变 `Hash` 为(比如说)`[8]byte`,它会在进程启动时发生崩溃。但是,这是一个运行时检查。如果我们想要早点发现怎么办?
|
||||
|
||||
就是这样。(没有 playground 链接,因为这在 playground 上不起作用。)
|
||||
如下。(没有 playground 链接,因为这在 playground 上不起作用。)
|
||||
|
||||
```
|
||||
package main
|
||||
@ -109,11 +109,11 @@ main.init.1: undefined: "main.hashIsTooSmall"
|
||||
|
||||
`hashIsTooSmall` 是[一个没有函数体的声明][7]。编译器假定别人将提供一个实现,也许是一个汇编程序。
|
||||
|
||||
当编译器可以证明 `len(Hash {})<md5.Size` 时,它消除了 if 语句中的代码。结果,没有人使用函数 `hashIsTooSmall`,所以链接器会消除它。没有其他损害。一旦断言失败,if 语句中的代码将被保留。不会消除 `hashIsTooSmall`。链接器然后注意到没有人提供了函数的实现然后链接失败,并出现错误,这是我们的目标。
|
||||
当编译器可以证明 `len(Hash {})< md5.Size` 时,它消除了 if 语句中的代码。结果,没有人使用函数 `hashIsTooSmall`,所以链接器会消除它。没有其他损害。一旦断言失败,if 语句中的代码将被保留。不会消除 `hashIsTooSmall`。链接器然后注意到没有人提供了函数的实现然后链接失败,并出现错误,这是我们的目标。
|
||||
|
||||
最后一个奇怪的点:为什么是 `import "C"`? go 工具知道在正常的 Go 代码中,所有函数都必须有主体,并指示编译器强制执行。通过切换到 cgo,我们删除该检查。(如果你在上面的代码中运行 `go build -x',而没有添加 `import "C"` 这行,你会看到编译器是用 `-complete` 标志调用的。)另一种方法是添加 `import "C"` 来[向包中添加一个名为 `foo.s` 的空文件][8]。
|
||||
最后一个奇怪的点:为什么是 `import "C"`? go 工具知道在正常的 Go 代码中,所有函数都必须有主体,并指示编译器强制执行。通过切换到 cgo,我们删除该检查。(如果你在上面的代码中运行 `go build -x`,而没有添加 `import "C"` 这行,你会看到编译器是用 `-complete` 标志调用的。)另一种方法是添加 `import "C"` 来[向包中添加一个名为 `foo.s` 的空文件][8]。
|
||||
|
||||
我在[编译器测试套件][9]中只知道这种使用。还有其他[可以发挥想象力的使用][10],但还没有人打扰。
|
||||
我仅见过一次这种技术的使用,是在[编译器测试套件][9]中。还有其他[可以发挥想象力的使用][10],但我还没见到过。
|
||||
|
||||
可能就是这样吧。 :)
|
||||
|
||||
@ -124,7 +124,7 @@ via: http://commaok.xyz/post/compile-time-assertions
|
||||
|
||||
作者:[Josh Bleecher Snyder][a]
|
||||
译者:[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/) 荣誉推出
|
||||
|
@ -1,34 +1,34 @@
|
||||
Windows赢了桌面,而Linux赢得整个世界
|
||||
Windows 赢了桌面,而 Linux 赢得整个世界
|
||||
============================================================
|
||||
拥有最高级的 Linux 桌面系统项目的城市正转回 Windows 阵营,但 Linux 的命运已经不再与 PC 休戚相关。
|
||||
|
||||
> 最坚决推行 Linux 桌面系统项目的城市正在转回 Windows 阵营,但 Linux 的命运已经不再与 PC 休戚相关。
|
||||
|
||||
![munich2.jpg](http://zdnet3.cbsistatic.com/hub/i/r/2017/02/10/9befc3d2-7931-48df-8114-008d23f1941d/resize/770xauto/02ca33958e5288c81a85d3dac546f621/munich2.jpg)
|
||||
|
||||
> 慕尼黑的 Linux 项目只是开源软件故事中的一小部分
|
||||
> 图片: Getty Images/iStockphoto
|
||||
|
||||
在实施从 Windows 系统迁移到 Linux 系统这一项目接近十年之久, 慕尼黑却突然走上了一条戏剧性的转弯。据说是到 2021 年,地方议会就会开始用 [Windows 10][4] 替换运行 LiMux (Ubuntu 的一种自定义版本)的 PC 机。
|
||||
在实施从 Windows 系统迁移到 Linux 系统这一项目接近十年之久后,慕尼黑却突然走上了一条戏剧性的转弯。据说是到 2021 年,该城市的地方议会就会开始用 [Windows 10][4] 替换运行 LiMux (Ubuntu 的一种自定义版本)的 PC 机。
|
||||
|
||||
若是回到 15 或者 20 年前,人们可能会争论什么时候 Linux 将会在桌面上取代 Windows。例如,当 Ubuntu 于 2004 年问世时,它是带着 [终结 Windows 的抱负][5] 而被设计为标准的桌面操作系统的。
|
||||
|
||||
剧透:这一切并没有发生。
|
||||
|
||||
桌面上的 Linux 在今天占有约为 2% 的市场,很多人都认为它复杂晦涩。与此同时,Windows 则稳航无虞,在 PC 市场笑傲群雄,天下十之有九。但商业中总还有些许 Linux 桌面的身影,它仍被需要——尤其是对开发者和数据科学家而言。
|
||||
桌面上的 Linux 在今天占有约为 2% 的市场,很多人都认为它复杂晦涩。与此同时,Windows 则航行无虞,在 PC 市场笑傲群雄,天下十有其九。但在商业领域中总还有些许 Linux 桌面的身影,它仍被需要——尤其是对开发者和数据科学家而言。
|
||||
|
||||
但遗憾的是,它永远也不会成为历史的主流。
|
||||
|
||||
慕尼黑的 Linux 项目因其规模之大,引起了许多人的兴趣。几乎没有哪家大型组织会做出从 Windows 到 Linux 的迁移,一些个别的案例像 [法国宪兵队和都灵市][6] 曾有类似之举。然而,[慕尼黑作为模范][7]:在这一事件上的失败将会大大打击那些仍在 [试图用 Linux 将 Windows 取而代之的信徒们][8]。
|
||||
|
||||
但现实就是如此,绝大多数公司乐于去使用主流的桌面操作系统,因为它具有完整一致、用户友好这种优势。
|
||||
|
||||
但现实就是如此,绝大多数公司乐于去使用主流的桌面操作系统,因为它具有完整性、用户友好这种天然的优势。
|
||||
|
||||
工作人员所抱怨的问题中,有多少是归咎于 Limux 软件以及多少是操作系统无端被责备的,已经不可计数。但重要的是,无论慕尼黑最后何去何从,Linux 的命运都已经脱离了桌面——是的,Linux 在多年前就已经输掉了桌面战争。
|
||||
工作人员所抱怨的问题中,有多少是归咎于 LiMux 软件以及多少是操作系统无端被责备的,已经不可计数。但重要的是,无论慕尼黑最后何去何从,Linux 的命运都已经脱离了桌面 —— 是的,Linux 在多年前就已经输掉了桌面战争。
|
||||
|
||||
但这对 Linux 来说无伤大雅,因为它赢得了智能手机之战,并且在云端和物联网之战上也是捷报连连。
|
||||
|
||||
你的口袋里,有七八成可能装的是一个 Linux 驱动的智能手机(Android 基于 Linux 内核)。你的身边,更是有成千上万 Linux 驱动的设备,虽然这些也许你甚至都没注意到。
|
||||
|
||||
你的口袋里,七八成装的是一个 Linux 驱动的智能手机(Android 基于 Linux 内核)。你的身边,更是有成千上万 Linux 驱动的设备,虽然这些也许你甚至都没注意到。
|
||||
|
||||
[像 Raspberry Pi][9] 这样运行大量不同类型 Linux 的设备,正在创建一个充满热情和活力的开发者社区,并且提供给初创公司一种低成本的驱动新设备的方法。
|
||||
[像树莓派][9]这样运行大量不同类型 Linux 的设备,正在创建一个充满热情和活力的开发者社区,并且提供给初创公司一种低成本的驱动新设备的方法。
|
||||
|
||||
大部分公有云也是以这样或那样的形式在 Linux 上运行的;即便是微软,也已经敞开大门,拥抱开源软件。无论你站在哪一个软件平台的立场,不可否认地,开发者和用户拥有更多丰富的可选项是一件好事,对决策来说,抑或是对创新来说,都是如此。
|
||||
|
||||
@ -36,15 +36,15 @@ Windows赢了桌面,而Linux赢得整个世界
|
||||
|
||||
虽然慕尼黑传奇的曲折变换与 Linux 在桌面上的冒险耐人寻味,但它们却并未给你呈现出一个完整的故事。
|
||||
|
||||
_同意? 还是不同意? 在下面添加你的评论来加入讨论吧!_
|
||||
_同意? 还是不同意? 在下面添加你的评论来加入讨论吧!_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.zdnet.com/article/windows-wins-the-desktop-but-linux-takes-the-world/
|
||||
|
||||
作者:[Steve Ranger ][a]
|
||||
作者:[Steve Ranger][a]
|
||||
译者:[Meditator-hkx](https://github.com/Meditator-hkx)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,98 +1,92 @@
|
||||
LaTeXila 简介 - Linux 下一个多语言 LaTeX 编辑器
|
||||
LaTeXila 简介:Linux 上的一个多语言 LaTeX 编辑器
|
||||
============================================================
|
||||
|
||||
### 在本文中你将看到
|
||||
|
||||
1. [为何选择使用 LaTeX?][1]
|
||||
2. [创建新文档并设定文档的基本结构][2]
|
||||
3. [LaTeXila 简单易用,公式齐全][3]
|
||||
4. [将 .tex 文件转换为 .rtf 文件][4]
|
||||
5. [结论][5]
|
||||
|
||||
LaTeXila 是一个多语言 LaTeX 编辑器,专为那些偏爱 GTK+ 外观的 Linux 用户设计。这个软件简单,但有足够强大,可定制性良好,所以如果你对 LaTeX 感兴趣,那么你就应该尝试一下这个工具。在下面的快速指南中,我将展示如何使用 LaTeXila 并介绍其主要功能。但在开始之前你可能要问:
|
||||
LaTeXila 是一个多语言 LaTeX 编辑器,专为那些偏爱 GTK+ 外观的 Linux 用户设计。这个软件简单,但又足够强大,可定制性良好,所以如果你对 LaTeX 感兴趣,那么你就应该尝试一下这个工具。在下面的快速指南中,我将展示如何使用 LaTeXila 并介绍其主要功能。但在开始之前你可能要问:
|
||||
|
||||
### 为何选择使用 LaTeX?
|
||||
|
||||
假如我想创建一个文本文档,为什么我不使用 LibreOffice 或者 Abiword 这些常规的工具呢?这个问题的答案是相比于常规的文本编辑器,LaTeX 编辑器一般来说都会提供更多功能强大的格式化工具,让你在写作期间专注于文档的内容。LaTeX 是一个文档准备系统,实际上这意味着它简化了大多数常见出版物的处理过程,这些出版物包括书籍或者科学报告,它们通常都包含很多数学公式,多语言排版元素,交叉引用及引文,参考文献等等需要处理的元素。尽管上面的那些元素也可以用 LibreOffice 来处理,但如果要保证最后处理过的文档是高质量的,相比于使用 LibreOffice,使用 LaTeXila 则要相对简单一些。
|
||||
假如我想创建一个文本文档,为什么我不使用 LibreOffice 或者 Abiword 这些常规的工具呢?原因是相比于常规的文本编辑器,LaTeX 编辑器一般来说都会提供更多功能强大的格式化工具,让你在写作期间专注于文档的内容。LaTeX 是一个文档准备系统,目的是简化大多数常见出版物的处理过程,例如书籍或者科学报告,它们通常都包含很多数学公式,多语言排版元素,交叉引用及引文,参考文献等等需要处理的元素。尽管上面的那些元素也可以用 LibreOffice 来处理,使用 LaTeXila 要相对简单一些,同时处理得当的话你最后得到的会是一份高质量的文档。
|
||||
|
||||
### 在一个新文档上开始工作并设定文章结构
|
||||
|
||||
首先,我们需要在 LaTeXila 中创建一个新文件,这个可以通过点击位于左上角的 “新建文件” 图标来实现,接着它将打开一个对话框,让我们选择一个模板从而快速地开始写作。
|
||||
|
||||
[
|
||||
![打开 LaTex 编辑器](https://www.howtoforge.com/images/introduction-to-latexila/pic_1.png)
|
||||
![打开 LaTex 编辑器](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_1.png)
|
||||
][6]
|
||||
|
||||
在这里假设我将写一本书,所以我应该选择书籍模板,像下面的截图那样在相应的括号中添上标题和作者:
|
||||
在这里假设我将写一本书,所以我选择一个书籍模板,像下面的截图那样在相应的括号中添上标题和作者:
|
||||
|
||||
[
|
||||
![打开书籍模板](https://www.howtoforge.com/images/introduction-to-latexila/pic_2.png)
|
||||
![打开书籍模板](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_2.png)
|
||||
][7]
|
||||
|
||||
现在就让我来解释一些关于文章结构的事情。我知道这看起来就像编代码,如若你是一位作家而非程序员,那么像下面那样工作或许很是奇怪,但请先容我讲完,下面我将对此进行解释。
|
||||
现在就让我来解释一些关于文章结构的事情。我知道这看起来就像编代码,如果你是一位作家而非程序员,那么像下面那样工作或许很是奇怪,但请先容我讲完,我将对此进行解释。
|
||||
|
||||
在第一行和第九行之间,我们已经写好了书写整个文档所需的所有基本要素。例如在第一行中,我们可以通过修改“[a4paper,11pt]”来定义纸张和字体的大小,在这个方括号中,我们可以添加更多的选项,选项之间以逗号来分隔。
|
||||
在第一行和第九行之间,我们已经写好了书写整个文档所需的所有基本要素。例如在第一行中,我们可以通过修改 `[a4paper,11pt]` 来定义纸张和字体的大小,在这个方括号中,我们可以添加更多的选项,选项之间以英文逗号来分隔。
|
||||
|
||||
在第二行和第四行之间,我们可以看到一些条目,它们都以“\userpackage”打头,紧接着的是用方括号包裹的选项和用括号包裹的命令。这些命令都是一些增强宏包,LaTeXila 默认已经安装它们到我们的系统上了,并且在大多数模板中都将使用它们。需要特别注意的是字体编码,字符编码和字体的类型。
|
||||
在第二行和第四行之间,我们可以看到一些条目,它们都以 `\userpackage` 打头,紧接着的是用方括号包裹的选项和用括号包裹的命令。这些命令都是一些增强宏包,LaTeXila 默认已经安装它们到我们的系统上了,并且在大多数模板中都将使用它们。需要特别注意的是字体编码,字符编码和字体的类型。
|
||||
|
||||
紧着让我们看看 "\maketitle" 这一行,这里我们可以添加一个单独的标题页,且默认情况下标题的内容将被放置在第一页的顶部。类似的,包含“\tableofcontents”的那行将会自动生成书籍的目录。
|
||||
紧接着让我们看看 `\maketitle` 这一行,这里我们可以添加一个单独的标题页,且默认情况下标题的内容将被放置在第一页的顶部。类似的,包含 `\tableofcontents` 的那行将会自动生成书籍的目录。
|
||||
|
||||
最后,我们可以自己命名章节的名称,这可以通过在“\chapter”后的括号中添加章节名称来实现。第一个章节将会被自动地标记为第一章。你可以在接下来的行中添加内容,一直到下一个以 "\chapter" 开头的新行为止,这些都将是这个章节的内容。新的章节将会被自动地标记为第二章,以此类推。
|
||||
最后,我们可以自己命名章节的名称,这可以通过在 `\chapter` 后的括号中添加章节名称来实现。第一个章节将会被自动地标记为第一章。你可以在接下来的行中添加内容,一直到下一个以 `\chapter` 开头的新行为止,这些都将是这个章节的内容。新的章节将会被自动地标记为第二章,以此类推。
|
||||
|
||||
[
|
||||
![LaTex 的格式](https://www.howtoforge.com/images/introduction-to-latexila/pic_3.png)
|
||||
![LaTex 的格式](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_3.png)
|
||||
][8]
|
||||
|
||||
章节之间还可以用命令“\section”来划分为更小的块,甚至还可以使用“\subsection”来划分为更小的部分。各个小节和章都将被“\tableofcontents”自动检测到,并将使用它们的标题和页码来填充目录的内容。看看下面的截图就可以看到章和小节是如何在你的书中被排版的。
|
||||
章节之间还可以用命令 `\section` 来划分为更小的块,甚至还可以使用 `\subsection` 来划分为更小的部分。各个小节和章都将被 `\tableofcontents` 自动检测到,并将使用它们的标题和页码来填充目录的内容。看看下面的截图就可以看到章和小节是如何在你的书中被排版的。
|
||||
|
||||
[
|
||||
![LaTex 预览](https://www.howtoforge.com/images/introduction-to-latexila/pic_4.png)
|
||||
![LaTex 预览](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_4.png)
|
||||
][9]
|
||||
|
||||
假如你想看看结构的大致布局,你可以将左边的工具栏更换到“结构”选项,并确保所有的内容用缩进隔开了。在工具栏中,你还可以可能控制位于各个小节中的任意数据表格和图片。
|
||||
假如你想浏览结构,你可以将左边的工具栏更换到<ruby>“结构”<rt>Structure</rt></ruby>选项,并确保所有的结构与预期相符。在这里,你还可以控制各小节中的任意数据表格和图片。
|
||||
|
||||
[
|
||||
![LaTex 结构](https://www.howtoforge.com/images/introduction-to-latexila/pic_5.png)
|
||||
![LaTex 结构](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_5.png)
|
||||
][10]
|
||||
|
||||
讲到这里,有人或许想将表格和图片的位置也包含在目录中。要达到此目的,你需要将下面的两行添加到“\tableofcontents” 之后:
|
||||
讲到这里,有人或许想将表格和图片的位置也包含在目录中。要达到此目的,你需要将下面的两行添加到 `\tableofcontents` 之后:
|
||||
|
||||
```
|
||||
\listoffigures
|
||||
\listoftables
|
||||
```
|
||||
|
||||
最后标志着书籍结束的信号是“\end{document}”。所以你的布局应该总是以此为结尾。
|
||||
最后标志着书籍结束的信号是 `\end{document}`。你的布局应该总是以此为结尾。
|
||||
|
||||
### LaTeXila 简单易用,公式齐全
|
||||
|
||||
LaTeX 是一个基于命令的文档生成系统,它与使用的编辑器没有多少关联。这里需要强调的是 LaTeXila 提供了一系列强大的工具,使得在你书写报告或书籍时能够节省一些时间和精力。例如对于 LaTex 命令,它提供了自动补全功能,这个功能将在你每次开始输入命令时被激活。
|
||||
|
||||
[
|
||||
![LaTeX 中的数学公式](https://www.howtoforge.com/images/introduction-to-latexila/pic_6.png)
|
||||
![LaTeX 中的数学公式](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_6.png)
|
||||
][11]
|
||||
|
||||
LaTeXila 还集成有基于 gspell 的拼写检测系统,你可以在最上面的“工具”菜单中设定合适的语言。最上面的工具栏里几乎包含了你要用到的所有按钮。从左到右,你可以完成添加章节,交叉引用,调整字符的大小,格式化被选取的部分,添加无序列表和数学函数等等。这些都可以手动地输入,但通过点击相应按钮来完成或许更加方便。
|
||||
|
||||
对于生成数学公式,结合侧边栏上的工具栏选项,你只需轻轻一点就可以添加相应的数学符号。点击位于左边的侧边栏中“符号”框,你就可以看到相关的符号分类,例如”关系运算符“,”希腊字母“,”算子“等等。下面的截图就是一些符号的示例:
|
||||
对于生成数学公式,结合侧边栏上的工具栏选项,你只需轻轻一点就可以添加相应的数学符号。点击位于左边的侧边栏中<ruby>“符号”<rt>Symbols</rt></ruby>框,你就可以看到相关的符号分类,例如“关系运算符”,“希腊字母”,“运算符”等等。下面的截图就是一些符号的示例:
|
||||
|
||||
[
|
||||
![希腊字母和算子符号](https://www.howtoforge.com/images/introduction-to-latexila/pic_7.png)
|
||||
![希腊字母和算子符号](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_7.png)
|
||||
][12]
|
||||
|
||||
这些符号的图形化列表使得公式和数学表达式的生成犹如在公园中散步那样舒适。
|
||||
|
||||
### 将 .tex 文件转换为 .rtf 文件
|
||||
|
||||
默认情况下,LaTeXila 会将你的文档保存为标准的 `.tex` 文档,而我们可以使用 `.tex` 文档来生成一个”富文本“文档,这些富文本文档可以使用像 LibreOffice 那样的文本编辑器打开。要达到此目的,我们需要安装一个名为 `latex2rtf` 的工具,它在所有的 Linux 发行版本中都可以被获取到。像下面那样在文本所在的目录打开虚拟终端, 并输入 `latex2rtf 文件名称` :
|
||||
默认情况下,LaTeXila 会将你的文档保存为标准的 `.tex` 文档,而我们可以使用 `.tex` 文档来生成一个<ruby>“富文本”<rt>rich text format</rt></ruby>文档,这些富文本文档可以使用像 LibreOffice 那样的文本编辑器打开。要达到此目的,我们需要安装一个名为 `latex2rtf` 的工具,它在所有的 Linux 发行版本中都可以被获取到。在文本所在的目录打开虚拟终端, 并输入 `latex2rtf 文件名称`,如下所示 :
|
||||
|
||||
[
|
||||
![由 LaTeX 文档生成 RTF 文档](https://www.howtoforge.com/images/introduction-to-latexila/pic_8.png)
|
||||
![由 LaTeX 文档生成 RTF 文档](https://www.howtoforge.com/images/introduction-to-latexila/big/pic_8.png)
|
||||
][13]
|
||||
|
||||
当然 LLaTeXila 也提供了它自己的构建工具,这些工具可以在上面的工具栏或者最上面的面板(构建)中看到。但我向你推荐 latex2rtf 是以防在其他的操作系统上出现某些意想不到的问题。
|
||||
当然 LaTeXila 也提供了它自己的构建工具,这些工具可以在上面的工具栏或者最上面的面板(构建)中看到。但我向你推荐 latex2rtf 是以防它们在其他的操作系统上出现某些意想不到的问题,比如在我的系统上就不能正常工作。
|
||||
|
||||
### 结论
|
||||
|
||||
假如上面的介绍激发了你探索 LaTeX 的兴趣,那就再好不过了。我写这篇文章的目的是向新手介绍一款简单易用且适合他们写作的工具。要是 LaTeXila 还带有实时预览的双屏模式的话,它就更加完美了。。。
|
||||
假如上面的介绍激发了你探索 LaTeX 的兴趣,那就再好不过了。我写这篇文章的目的是向新手介绍一款简单易用且适合他们写作的工具。要是 LaTeXila 还带有实时预览的双屏模式的话,它就更加完美了...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -100,7 +94,7 @@ via: https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/
|
||||
|
||||
作者:[Bill Toulas][a]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,39 +1,37 @@
|
||||
如何在 Ubuntu 以及 Debian 中安装 DHCP 服务器
|
||||
============================================================
|
||||
|
||||
动态主机配置协议(DHCP)是一种用于使主机能够从服务器自动分配IP地址和相关的网络配置的网络协议。
|
||||
**动态主机配置协议(DHCP)** 是一种用于使主机能够从服务器自动分配 IP 地址和相关的网络配置的网络协议。
|
||||
|
||||
DHCP 服务器分配给 DHCP 客户端的IP地址处于“租用”状态,租用时间通常取决于客户端计算机可能需要连接的时间或 DHCP 配置的时间。
|
||||
DHCP 服务器分配给 DHCP 客户端的 IP 地址处于“租用”状态,租用时间通常取决于客户端计算机要求连接的时间或 DHCP 服务器配置的时间。
|
||||
|
||||
#### DHCP 如何工作?
|
||||
|
||||
以下是 DHCP 实际工作原理的简要说明:
|
||||
|
||||
* 一旦客户端(配置使用 DHCP)并连接到网络后,它会向 DHCP 服务器发送 DHCPDISCOVER 数据包。
|
||||
* 当 DHCP 服务器收到 DHCPDISCOVER 请求报文后会使用 DHCPOFFER 包进行回复。
|
||||
* 然后客户端获取到 DHCPOFFER 数据包,并向服务器发送一个 DHCPREQUEST 包,表示它已准备好接收 DHCPOFFER 包中提供的网络配置信息。
|
||||
* 最后,DHCP 服务器从客户端收到 DHCPREQUEST 报文后,发送 DHCPACK 报文,表示客户端现在允许使用分配给它的IP地址。
|
||||
* 一旦客户端(配置为使用 DHCP 的机器)连接到网络后,它会向 DHCP 服务器发送 **DHCPDISCOVER** 数据包。
|
||||
* 当 DHCP 服务器收到 **DHCPDISCOVER** 请求报文后会使用 **DHCPOFFER** 包进行回复。
|
||||
* 然后客户端获取到 **DHCPOFFER** 数据包,并向服务器发送一个 **DHCPREQUEST** 包,表示它已准备好接收 **DHCPOFFER** 包中提供的网络配置信息。
|
||||
* 最后,DHCP 服务器从客户端收到 **DHCPREQUEST** 报文后,发送 **DHCPACK** 报文,表示现在允许客户端使用分配给它的 IP 地址。
|
||||
|
||||
在本文中,我们将介绍如何在 Ubuntu/Debian Linux 中设置 DHCP 服务器,我们将使用[ sudo 命令][1]来运行所有命令,以获得 root 用户权限。
|
||||
在本文中,我们将介绍如何在 Ubuntu/Debian Linux 中设置 DHCP 服务器,我们将使用 [sudo 命令][1]来运行所有命令,以获得 root 用户权限。
|
||||
|
||||
### 测试环境设置
|
||||
|
||||
这步我们会使用如下的测试环境。
|
||||
在这步中我们会使用如下的测试环境。
|
||||
|
||||
```
|
||||
DHCP Server - Ubuntu 16.04
|
||||
DHCP Clients - CentOS 7 and Fedora 25
|
||||
```
|
||||
- DHCP Server - Ubuntu 16.04
|
||||
- DHCP Clients - CentOS 7 and Fedora 25
|
||||
|
||||
### 步骤1:在 Ubuntu 中安装 DHCP 服务器
|
||||
### 步骤 1:在 Ubuntu 中安装 DHCP 服务器
|
||||
|
||||
1. 运行下面的命令来安装 DHCP 服务器包,也就是 dhcp3-server。
|
||||
1、 运行下面的命令来安装 DHCP 服务器包,也就是 **dhcp3-server**。
|
||||
|
||||
```
|
||||
$ sudo apt install isc-dhcp-server
|
||||
```
|
||||
|
||||
2. 安装完成后,编辑 /etc/default/isc-dhcp-server 使用 INTERFACES 选项定义 DHCPD 响应 DHCP 请求所使用的接口。
|
||||
2、 安装完成后,编辑 `/etc/default/isc-dhcp-server` 使用 `INTERFACES` 选项定义 DHCPD 响应 DHCP 请求所使用的接口。
|
||||
|
||||
比如,如果你想让 DHCPD 守护进程监听 `eth0`,按如下设置:
|
||||
|
||||
@ -45,14 +43,14 @@ INTERFACES="eth0"
|
||||
|
||||
### 步骤 2:在 Ubuntu 中配置 DHCP 服务器
|
||||
|
||||
3. DHCP 配置的主文件是 `/etc/dhcp/dhcpd.conf`, 你必须填写会发送到客户端的所有网络信息。
|
||||
3、 DHCP 配置的主文件是 `/etc/dhcp/dhcpd.conf`, 你必须填写会发送到客户端的所有网络信息。
|
||||
|
||||
并且 DHCP 配置中定义了两种不同的声明,它们是:
|
||||
|
||||
* parameters - 指定如何执行任务、是否执行任务,还有指定要发送给 DHCP 客户端的网络配置选项。
|
||||
* declarations - 定义网络拓扑、指定客户端、为客户端提供地址,或将一组参数应用于一组声明。
|
||||
* `parameters` - 指定如何执行任务、是否执行任务,还有指定要发送给 DHCP 客户端的网络配置选项。
|
||||
* `declarations` - 定义网络拓扑、指定客户端、为客户端提供地址,或将一组参数应用于一组声明。
|
||||
|
||||
4. 现在打开并修改主文件,定义 DHCP 服务器选项:
|
||||
4、 现在打开并修改主文件,定义 DHCP 服务器选项:
|
||||
|
||||
```
|
||||
$ sudo vi /etc/dhcp/dhcpd.conf
|
||||
@ -68,7 +66,7 @@ max-lease-time 7200;
|
||||
authoritative;
|
||||
```
|
||||
|
||||
5. 现在定义一个子网,这里我们为 192.168.10.0/24 局域网设置 DHCP (使用适用你情况的参数):
|
||||
5、 现在定义一个子网,这里我们为 `192.168.10.0/24` 局域网设置 DHCP (请使用适用你情况的参数):
|
||||
|
||||
```
|
||||
subnet 192.168.10.0 netmask 255.255.255.0 {
|
||||
@ -83,7 +81,7 @@ range 192.168.10.110 192.168.10.200;
|
||||
|
||||
### 步骤 3:在 DHCP 客户端上配置静态地址
|
||||
|
||||
6. 要给特定的客户机分配一个固顶的(静态)的IP,你需要显式将这台机器的 MAC 地址以及静态分配的地址添加到下面这部分。
|
||||
6、 要给特定的客户机分配一个固定的(静态)的 IP,你需要显式将这台机器的 MAC 地址以及静态分配的地址添加到下面这部分。
|
||||
|
||||
```
|
||||
host centos-node {
|
||||
@ -98,7 +96,7 @@ fixed-address 192.168.10.106;
|
||||
|
||||
保存并关闭文件。
|
||||
|
||||
7.接下来,启动 DHCP 服务,并让它下次开机自启动,如下所示:
|
||||
7、 接下来,启动 DHCP 服务,并让它下次开机自启动,如下所示:
|
||||
|
||||
```
|
||||
------------ SystemD ------------
|
||||
@ -109,7 +107,7 @@ $ sudo service isc-dhcp-server.service start
|
||||
$ sudo service isc-dhcp-server.service enable
|
||||
```
|
||||
|
||||
8. 接下来不要忘记允许 DHCP 服务(DHCP 守护进程监听 67 UDP 端口)的防火墙权限:
|
||||
8、 接下来不要忘记允许 DHCP 服务(DHCP 守护进程监听 67 UDP 端口)的防火墙权限:
|
||||
|
||||
```
|
||||
$ sudo ufw allow 67/udp
|
||||
@ -119,7 +117,7 @@ $ sudo ufw show
|
||||
|
||||
### 步骤 4:配置 DHCP 客户端
|
||||
|
||||
9. 此时,你可以将客户端计算机配置为自动从 DHCP 服务器接收 IP 地址。
|
||||
9、 此时,你可以将客户端计算机配置为自动从 DHCP 服务器接收 IP 地址。
|
||||
|
||||
登录到客户端并编辑以太网接口的配置文件(注意接口名称/号码):
|
||||
|
||||
@ -149,9 +147,9 @@ $ sudo service networking restart
|
||||
![Set DHCP Network in Fedora](http://www.tecmint.com/wp-content/uploads/2017/03/Set-DHCP-Network-in-Fedora.png)
|
||||
][3]
|
||||
|
||||
在 Fedora 中设置 DHCP 网络
|
||||
*在 Fedora 中设置 DHCP 网络*
|
||||
|
||||
此时,如果所有设置完成了,你的客户端应该可以自动从 DHCP 服务器接收IP 地址了。
|
||||
此时,如果所有设置完成了,你的客户端应该可以自动从 DHCP 服务器接收 IP 地址了。
|
||||
|
||||
就是这样了!在本篇教程中,我们向你展示了如何在 Ubuntu/Debian 设置 DHCP 服务器。在反馈栏中分享你的想法。如果你正在使用基于 Fedora 的发行版,请阅读如何在 CentOS/RHEL 中设置 DHCP 服务器。
|
||||
|
||||
@ -166,12 +164,12 @@ via: http://www.tecmint.com/install-dhcp-server-in-ubuntu-debian/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/
|
||||
[1]:https://linux.cn/tag-sudo.html
|
||||
[2]:http://www.tecmint.com/set-add-static-ip-address-in-linux/
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2017/03/Set-DHCP-Network-in-Fedora.png
|
||||
[4]:http://www.tecmint.com/author/aaronkili/
|
@ -0,0 +1,65 @@
|
||||
7 ways to discuss legal matters with an open community
|
||||
============================================================
|
||||
|
||||
> Are your organization's lawyers ready to engage an open community? Don't let them make these mistakes.
|
||||
|
||||
|
||||
![7 ways to discuss legal matters with an open community](https://opensource.com/sites/default/files/styles/image-full-size/public/images/law/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=xmtgmowQ "7 ways to discuss legal matters with an open community")
|
||||
>Image by : opensource.com
|
||||
|
||||
Having watched a fair number of people attempt to engage both the [Open Source Initiative's licensing evaluation community][3] and the [Apache Software Foundation's legal affairs committee][4], I'd like to offer some hints and tips for succeeding when it's _your_ turn to conduct a legal discussion with an open community.
|
||||
|
||||
### No proxies
|
||||
|
||||
First and foremost, make sure the person conducting the conversation is both _qualified_ and _empowered_ . Don't send proxies; they simply frustrate the community, who quickly work out that your representative is always playing the second-hand car salesman and going to the back room to ask for a deal. Obviously, legal discussions will involve a team at your company, probably involving product management, engineering and in-house counsel. But the representative needs to be able to hold the conversation themselves and not keep delivering cut paste quotes from anonymous personae behind the curtain.
|
||||
|
||||
### Multilaterality
|
||||
|
||||
An open source community reaches a hard-won consensus on the certainties they need in order to collaborate safely. That consensus gets embodied in their governance and especially in the open source license they use. So when you come with a new proposal, it's not like a normal business deal. Those are bilateral negotiations, trading the freedoms of the two parties to create a peace treaty that's an optimal compromise. In this discussion you are just one of many, many parties, and you need to explain why your proposal is good for everyone. Negotiating multilateral change is inherently slow, so don't come with a deadline. And whatever you do, don't suggest changes to the open source license!
|
||||
|
||||
### Study first
|
||||
|
||||
The existing consensus and process exists for a reason. You should understand the reason for each element, preferably along with the history of how it arose, before suggesting changes to it. That way you can couch your proposals in the context of further evolution, and you can avoid being schooled in community history (something that wastes community bandwidth and reduces your chances of effectiveness). Read back through the mailing list and ask your developer colleagues for history and context.
|
||||
|
||||
### Transparency
|
||||
|
||||
Open source developers use a process of iterative, incremental change. Even if a big change is needed, it will almost always be delivered as a sequence of smaller, well-explained or self-evidently correct changes so that everyone can follow along and buy in to the improvement. The same is true of your proposed change. Don't show up with a new contributor agreement or a modified license and expect everyone to trust that you're experts so it must all be good. You need to provide a "red-line" (the legal document equivalent of a diff), document each change, and provide a justification that admits any community impact and justifies it. If you need a thing to be _just so_ for your own benefit, admit it rather than hoping no one will notice.
|
||||
|
||||
### Humility
|
||||
|
||||
So you are a hot-shot lawyer and you think only programmers use the mailing list. It's clear to you that they'll lack the experience to have a discussion, so you either send a proxy you think is their equal, dumb it all down, or propose having a one-on-one discussion with the community's chosen lawyer. I'm sorry to say that you are so, so wrong on all counts. Since the community's policy is a multilateral consensus, there is a really good chance they know why they settled on what they have now. There will be some people on the list with excellent domain-specific knowledge, likely to be better than yours. And that one-on-one thing is the ultimate insult, like asking if there is an adult you can speak with.
|
||||
|
||||
### Don't back-channel
|
||||
|
||||
There may well be a leadership body of some kind. Maybe you know the boss at the company where the VP Legal works. Perhaps you know the community's General Counsel. While asking for hints on how to navigate the process may be acceptable in some circumstances, trying to conduct a back-channel discussion or negotiation with the expectation of influencing or even determining the outcome can blow back badly. You may eventually be invited for a one-on-one discussion, but you should never demand or expect it.
|
||||
|
||||
### Become a member
|
||||
|
||||
If you do everything right, chances are that the community will respect you for it. Stick around. Build your reputation as a calm, wise contributor. Help others when they show up and make the mistakes you made (or avoided!) As a trusted participant in the "$-legal" mailing list community, you are a real asset to both the project and your employer. Keep contributing and some projects will eventually offer you a role in their governance process.
|
||||
|
||||
_An earlier version of this article [originally appeared][1] at Meshed Insights._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Simon Phipps - Computer industry and open source veteran Simon Phipps started Public Software, a European host for open source projects, and volunteers as a director at The Document Foundation. His posts are sponsored by Patreon patrons - become one if you'd like to see more!
|
||||
|
||||
------------
|
||||
|
||||
via: https://opensource.com/open-organization/17/3/legal-matters-community
|
||||
|
||||
作者:[ Simon Phipps][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/simonphipps
|
||||
[1]:https://meshedinsights.com/2017/02/28/engaging-communities-on-legal-matters-7-tips/
|
||||
[2]:https://opensource.com/open-organization/17/3/legal-matters-community?rate=gSFbyOzBTIipXOdeeL-GVIT1BYoC4f61FKZJ7KRg3d0
|
||||
[3]:https://opensource.org/approval
|
||||
[4]:https://www.apache.org/legal/
|
||||
[5]:https://opensource.com/user/12532/feed
|
||||
[6]:https://opensource.com/open-organization/17/3/legal-matters-community#comments
|
||||
[7]:https://opensource.com/users/simonphipps
|
@ -1,257 +0,0 @@
|
||||
fuowang 翻译中
|
||||
|
||||
5 ways to change GRUB background in Kali Linux
|
||||
============================================================
|
||||
|
||||
|
||||
This is a simple guide on how to change GRUB background in Kali Linux (i.e. it’s actually Kali Linux GRUB splash image). Kali dev team did few things that seems almost too much work, so in this article I will explain one of two things about GRUB and somewhat make this post little unnecessarily long and boring cause I like to write! So here goes …
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -10](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-10.jpg)
|
||||
][10]
|
||||
|
||||
### Finding GRUB settings
|
||||
|
||||
This is usually the first issue everyone faces, where do I look? There’s a many ways to find GRUB settings. Users might have their own opinion but I always found that `update-grub` is the easiest way. If you run `update-grub` in a VMWare/VirtualBox, you will see something like this:
|
||||
|
||||
```
|
||||
root@kali:~# update-grub
|
||||
Generating grub configuration file ...
|
||||
Found background image: /usr/share/images/desktop-base/desktop-grub.png
|
||||
Found linux image: /boot/vmlinuz-4.0.0-kali1-amd64
|
||||
Found initrd image: /boot/initrd.img-4.0.0-kali1-amd64
|
||||
No volume groups found
|
||||
done
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
If you’re using a Dual Boot, Triple Boot then you will see GRUB goes in and finds other OS’es as well. However, the part we’re interested is the background image part, in my case this is what I see (you will see exactly the same thing):
|
||||
|
||||
```
|
||||
Found background image: /usr/share/images/desktop-base/desktop-grub.png
|
||||
```
|
||||
|
||||
### GRUB splash image search order
|
||||
|
||||
In grub-2.02, it will search for the splash image in the following order for a Debian based system:
|
||||
|
||||
1. GRUB_BACKGROUND line in `/etc/default/grub`
|
||||
2. First image found in `/boot/grub/` ( more images found, it will be taken alphanumerically )
|
||||
3. The image specified in `/usr/share/desktop-base/grub_background.sh`
|
||||
4. The file listed in the WALLPAPER line in `/etc/grub.d/05_debian_theme`
|
||||
|
||||
Now hang onto this info and we will soon revisit it.
|
||||
|
||||
### Kali Linux GRUB splash image
|
||||
|
||||
As I use Kali Linux (cause I like do stuff), we found that Kali is using a background image from here: `/usr/share/images/desktop-base/desktop-grub.png`
|
||||
|
||||
Just to be sure, let’s check that `.png` file and it’s properties.
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# ls -l /usr/share/images/desktop-base/desktop-grub.png
|
||||
lrwxrwxrwx 1 root root 30 Oct 8 00:31 /usr/share/images/desktop-base/desktop-grub.png -> /etc/alternatives/desktop-grub
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -1](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-1.jpg)
|
||||
][11]
|
||||
|
||||
What? It’s just a symbolic link to `/etc/alternatives/desktop-grub` file? But `/etc/alternatives/desktop-grub` is not an image file. Looks like I need to check that file and it’s properties as well.
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# ls -l /etc/alternatives/desktop-grub
|
||||
lrwxrwxrwx 1 root root 44 Oct 8 00:27 /etc/alternatives/desktop-grub -> /usr/share/images/desktop-base/kali-grub.png
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -3](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-3.jpg)
|
||||
][12]
|
||||
|
||||
Alright, that’s confusing as! So `/etc/alternatives/desktop-grub` is another symbolic link which points back to
|
||||
`/usr/share/images/desktop-base/kali-grub.png`
|
||||
which is in the same folder we started from. doh! That’s all I can say. But at least now we can just replace that file and get it over with.
|
||||
|
||||
Before we do that we need to check the properties of this file `/usr/share/images/desktop-base/kali-grub.png` and ensure that we will download same type and dimension file.
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# file /usr/share/images/desktop-base/kali-grub.png
|
||||
/usr/share/images/desktop-base/kali-grub.png: PNG image data, 640 x 480, 8-bit/color RGB, non-interlaced
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
So this file is DEFINITELY a PNG image data, 640 x 480 dimension.
|
||||
|
||||
### GRUB background image properties
|
||||
|
||||
GRUB 2 can use `PNG`, `JPG`/`JPEG` and `TGA` images for the background. The image must meet the following specifications:
|
||||
|
||||
* `JPG`/`JPEG` images must be `8-bit` (`256 color`)
|
||||
* Images should be non-indexed, `RGB`
|
||||
|
||||
By default, if `desktop-base` package is installed, images conforming to the above specification will be located in `/usr/share/images/desktop-base/` directory. A quick Google search found similar files. Out of those, I picked one.
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# file Downloads/wallpaper-1.png
|
||||
Downloads/wallpaper-1.png: PNG image data, 640 x 480, 8-bit/color RGB, non-interlaced
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -6](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-6.jpg)
|
||||
][13]
|
||||
|
||||
### Option 1: replace the image
|
||||
|
||||
Now we simply need to replace this `/usr/share/images/desktop-base/kali-grub.png` file with our new file. Note that this is the easiest way without mucking around `grub-config` files. If you are familiar with GRUB, then go ahead and simpy modify GRUB default config and run `update-grub`.
|
||||
|
||||
As usual, I will make a backup of the original file by renaming it to `kali-grub.png.bkp`
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# mv /usr/share/images/desktop-base/kali-grub.png /usr/share/images/desktop-base/kali-grub.png.bkp
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -4](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-4.jpg)
|
||||
][14]
|
||||
|
||||
Now let’s copy our downloaded file and rename that to `kali-grub.png.bkp`.
|
||||
|
||||
```
|
||||
root@kali:~#
|
||||
root@kali:~# cp Downloads/wallpaper-1.png /usr/share/images/desktop-base/kali-grub.png
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -5](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-5.jpg)
|
||||
][15]
|
||||
|
||||
And finally run `update-grub`
|
||||
|
||||
```
|
||||
root@kali:~# update-grub
|
||||
Generating grub configuration file ...
|
||||
Found background image: /usr/share/images/desktop-base/desktop-grub.png
|
||||
Found linux image: /boot/vmlinuz-4.0.0-kali1-amd64
|
||||
Found initrd image: /boot/initrd.img-4.0.0-kali1-amd64
|
||||
No volume groups found
|
||||
done
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -7](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-7.jpg)
|
||||
][16]
|
||||
|
||||
Next time you restart your Kali Linux, you will see your own image as the GRUB background. (GRUB splash image).
|
||||
|
||||
Following is what my new GRUB splash image looks like in Kali Linux now. What about you? Tried this method yet?
|
||||
|
||||
[
|
||||
![Change GRUB background in Kali Linux - blackMORE OPs -9](http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-9.jpg)
|
||||
][17]
|
||||
|
||||
This was the easiest and safest way, if you muck it up the worst, you will see a Blue background in GRUB but will still be able to login and fix things later. Now if you’re confident, lets move to better ways (bit complex) of changing GRUB settings. Next steps are more fun and works with any Linux using GRUB bootloader.
|
||||
|
||||
Now remember those 4 places GRUB looks for a background splash image? Here are those again:
|
||||
|
||||
1. GRUB_BACKGROUND line in `/etc/default/grub`
|
||||
2. First image found in `/boot/grub/` ( more images found, it will be taken alphanumerically )
|
||||
3. The image specified in `/usr/share/desktop-base/grub_background.sh`
|
||||
4. The file listed in the `WALLPAPER` line in `/etc/grub.d/05_debian_theme`
|
||||
|
||||
So lets again try few of these options in Kali Linux (or any Linux using GRUB2).
|
||||
|
||||
### Option 2: Define an image path in GRUB_BACKGROUND
|
||||
|
||||
So you can use any of the above in the order of priority to make GRUB display your own images. The following is the content of `/etc/default/grub` file on my system.
|
||||
|
||||
```
|
||||
root@kali:~# vi /etc/default/grub
|
||||
```
|
||||
|
||||
Add a line similar to this: GRUB_BACKGROUND=”/root/World-Map.jpg” where World-Map.jpg is the image file you want to use as GRUB background.
|
||||
|
||||
```
|
||||
# If you change this file, run 'update-grub' afterwards to update
|
||||
# /boot/grub/grub.cfg.
|
||||
# For full documentation of the options in this file, see:
|
||||
# info -f grub -n 'Simple configuration'
|
||||
|
||||
GRUB_DEFAULT=0
|
||||
GRUB_TIMEOUT=15
|
||||
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
|
||||
GRUB_CMDLINE_LINUX="initrd=/install/gtk/initrd.gz"
|
||||
GRUB_BACKGROUND="/root/World-Map.jpg"
|
||||
```
|
||||
|
||||
Once changes has been done using any of the above methods, make sure you execute `update-grub` command as shown below.
|
||||
|
||||
```
|
||||
root@kali:~# update-grub
|
||||
Generating grub configuration file ...
|
||||
Found background: /root/World-Map.jpg
|
||||
Found background image: /root/World-Map.jpg
|
||||
Found linux image: /boot/vmlinuz-4.0.0-kali1-amd64
|
||||
Found initrd image: /boot/initrd.img-4.0.0-kali1-amd64
|
||||
No volume groups found
|
||||
done
|
||||
root@kali:~#
|
||||
```
|
||||
|
||||
Now, when you boot your machine, you will see the customized image in GRUB.
|
||||
|
||||
### Option 3: Put an image on /boot/grub/ folder
|
||||
|
||||
If nothing is specified in `GRUB_BACKGROUND` in `/etc/default/grub` file, GRUB ideally should pick first image found in `/boot/grub/` folder and use that a its background. If GRUB finds more than one image in /boot/grub/ folder, it will use the first alphanumerically image name.
|
||||
|
||||
### Option 4: Specify an image path in grub_background.sh
|
||||
|
||||
If nothing is specified in `GRUB_BACKGROUND` in `/etc/default/grub` file or there is no image in `/boot/grub/` folder, GRUB will start looking into `/usr/share/desktop-base/grub_background.sh` file and search for the image path specified. For Kali Linux, it was defined in here. Every Linux distro has it’s own take on it.
|
||||
|
||||
### Option 5: Define an image in WALLPAPER line in /etc/grub.d/05_debian_theme file
|
||||
|
||||
This would be that last part GRUB looking for a Background image. It will search here if everything else failed.
|
||||
|
||||
### Conclusion
|
||||
|
||||
This post was long, but I wanted to cover a few important basic things. If you’ve followed it carefully, you will understand how to follow symbolic links back and forth in Kali Linux. You will get a VERY good idea on exactly which places you need to search to find GRUB Background image in any Linux. Just read a bit more to understand how the colors in GRUB works and you’re all set.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/
|
||||
|
||||
作者:[https://www.blackmoreops.com/][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/
|
||||
[1]:http://www.facebook.com/sharer.php?u=https://www.blackmoreops.com/?p=5958
|
||||
[2]:https://twitter.com/intent/tweet?text=5+ways+to+change+GRUB+background+in+Kali+Linux%20via%20%40blackmoreops&url=https://www.blackmoreops.com/?p=5958
|
||||
[3]:https://plusone.google.com/_/+1/confirm?hl=en&url=https://www.blackmoreops.com/?p=5958&name=5+ways+to+change+GRUB+background+in+Kali+Linux
|
||||
[4]:https://www.blackmoreops.com/how-to/
|
||||
[5]:https://www.blackmoreops.com/kali-linux/
|
||||
[6]:https://www.blackmoreops.com/kali-linux-2-x-sana/
|
||||
[7]:https://www.blackmoreops.com/administration/
|
||||
[8]:https://www.blackmoreops.com/usability/
|
||||
[9]:https://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/#comments
|
||||
[10]:http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-10.jpg
|
||||
[11]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-1/
|
||||
[12]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-3/
|
||||
[13]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-6/
|
||||
[14]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-4/
|
||||
[15]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-5/
|
||||
[16]:http://www.blackmoreops.com/2015/11/27/change-grub-background-in-kali-linux/change-grub-background-in-kali-linux-blackmore-ops-7/
|
||||
[17]:http://www.blackmoreops.com/wp-content/uploads/2015/11/Change-GRUB-background-in-Kali-Linux-blackMORE-OPs-9.jpg
|
@ -1,3 +1,6 @@
|
||||
++翻译中
|
||||
+
|
||||
+
|
||||
### Configuring WINE with Winetricks
|
||||
|
||||
Contents
|
||||
|
@ -1,3 +1,5 @@
|
||||
Vic020
|
||||
|
||||
Using the AWS SDK for Go’s Regions and Endpoints Metadata
|
||||
============================================================
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
translating by cycoe
|
||||
|
||||
10 reasons to use Cinnamon as your Linux desktop environment
|
||||
============================================================
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
being translated by zhousiyu325
|
||||
|
||||
An executive's guide to containers
|
||||
============================================================
|
||||
|
||||
|
@ -1,74 +0,0 @@
|
||||
How communities in India support privacy and software freedom
|
||||
============================================================
|
||||
|
||||
![How communities in India support privacy and software freedom](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/people_remote_teams_world.png?itok=wI-GW8zX "How communities in India support privacy and software freedom")
|
||||
Image by : opensource.com
|
||||
|
||||
The free and open source communities in India, particularly Mozilla and Wikimedia communities, are leading two unique global events for better privacy and in support of free software.
|
||||
|
||||
[January Privacy Month][3] is led by the Mozilla community in India to educate the masses about online privacy via both online and offline outreach events. And, [Freedom in Feb][4] is led by the [Centre for Internet and Society][5] to educate content producers like bloggers and photographers on how to donate their content under [open licenses][6].
|
||||
|
||||
### January Privacy Month
|
||||
|
||||
Mozilla's January Privacy Month [began last year][7] to help celebrate the annual [Data Privacy Day][8]. In 2016, this campaign held several in-person and online events that reached [14,339,443 people across 10 countries][9]. "This was possible by sharing 1 privacy tip per day for 31 days throughout the month," says [Ankit Gadgil][10], one of the core organizers. "And this year, we have three focus areas. First of all, we have made this campaign more open and global. Mozilla communities from Brazil, Italy, and Czech Republic are actively participating this year. All essential documents is localized so that we can target more users. Secondly, We are educating participants of offline events about marketing Firefox and other Mozilla products so that the users can have hands-on experience of using these tools that help protect their privacy. The third thing is, we are encouraging everyone that participate an offline event to blog about their learning. For instance, there was a Maker Fest in in the Indian state of Gujarat recently where they used Mozilla products to teach about privacy."
|
||||
|
||||
This year, the campaign continues to engage people at in-person and online events. Follow #PrivacyAware to engage.
|
||||
|
||||
### Security tips
|
||||
|
||||
Mozilla products like Firefox have a security settings—both [in built][11] and in the add-on library that are fully [accessible][12] to disabled people—that help protect user’s privacy and security, are all built collaboratively and are open source.
|
||||
|
||||
[HTTPS Everywhere][13] can be used for [Chrome][14] and [Opera][15] to encrypt user communications so that external websites cannot see user's information. The project is built collaboratively by [The Tor Project][16] and the [Electronic Frontier Foundation][17].
|
||||
|
||||
### Freedom in February
|
||||
|
||||
[Freedom in Feb][18] is an online campaign aimed at educating content creators about [free content][19] and show them how to contribute their work under free licenses.
|
||||
|
||||
**To participate:**
|
||||
|
||||
* The works you will create or publish in February must be licensed under a [free license][1].
|
||||
* Content types include blog posts, other writings, and images.
|
||||
|
||||
Creative works like multimedia, text-based content, art and design, etc. can be licensed under several [Creative Commons licenses][20] (CC), and other types of documents can be licensed under the [GNU Free Documentation Licenses][21] (GFDL). Good examples can be found on Wikipedia, where the content is licensed under both CC and GFDL licenses, allowing people to use, share, remix, and distribute derived work both commercially and non-commercially with attribution. Additionally, there are [free software licenses][22] that allow developers to share their software and software-related documentations.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Subhashish Panigrahi - Subhashish Panigrahi (@subhapa) is the Asia Community Catalyzer at Mozilla's Participation team, and is transitioning from his role as Programme Officer of the Centre for Internet and Society's Access To Knowledge program Earlier with Wikimedia Foundation's India Program, he is an India based educator,
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/17/1/how-communities-india-support-privacy-software-freedom
|
||||
|
||||
作者:[Subhashish Panigrahi][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/psubhashish
|
||||
[1]:https://en.wikipedia.org/wiki/Free_license#Classification_and_licenses
|
||||
[2]:https://opensource.com/article/17/1/how-communities-india-support-privacy-software-freedom?rate=WhGQOnXdk0m1Yq63nNe0wTVBP-75ALKLlrssFW2lCLk
|
||||
[3]:https://wiki.mozilla.org/India/task_force/Policy_and_Advocacy/January_Privacy_Month_Campaign
|
||||
[4]:http://www.freedominfeb.org/
|
||||
[5]:http://cis-india.org/
|
||||
[6]:https://opensource.com/education/16/8/3-copyright-tips-students-and-educators
|
||||
[7]:https://reps.mozilla.org/e/privacy-month-campaign/
|
||||
[8]:https://en.wikipedia.org/wiki/Data_Privacy_Day
|
||||
[9]:http://blog.mozillaindia.org/1611
|
||||
[10]:https://reps.mozilla.org/u/ankitgadgil
|
||||
[11]:https://support.mozilla.org/en-US/products/firefox/protect-your-privacy
|
||||
[12]:https://support.mozilla.org/en-US/kb/advanced-panel-settings-in-firefox
|
||||
[13]:https://www.eff.org/files/https-everywhere-latest.xpi
|
||||
[14]:https://chrome.google.com/webstore/detail/gcbommkclmclpchllfjekcdonpmejbdp
|
||||
[15]:https://addons.opera.com/extensions/details/https-everywhere/
|
||||
[16]:https://www.torproject.org/
|
||||
[17]:https://eff.org/
|
||||
[18]:http://www.freedominfeb.org/
|
||||
[19]:https://en.wikipedia.org/wiki/Free_content
|
||||
[20]:https://creativecommons.org/licenses/
|
||||
[21]:https://en.wikipedia.org/wiki/GNU_Free_Documentation_License
|
||||
[22]:https://www.gnu.org/licenses/license-list.en.html#GPLCompatibleLicenses
|
||||
[23]:https://opensource.com/user/21177/feed
|
||||
[24]:https://opensource.com/users/psubhashish
|
@ -1,212 +0,0 @@
|
||||
Wkhtmltopdf – A Smart Tool to Convert Website HTML Page to PDF in Linux
|
||||
============================================================
|
||||
|
||||
**Wkhtmltopdf** is an open source simple and much effective command-line shell utility that enables user to convert any given **HTML** (**Web Page**) to **PDF** document or an image (**jpg**, **png**, etc).
|
||||
|
||||
Wkhtmltopdf is written in **C++** programming language and distributed under **GNU/GPL** (**General Public License**). It uses **WebKit** rendering layout engine to convert **HTML** pages to** PDF**document without loosing the quality of the pages. Its is really very useful and trustworthy solution for creating and storing snapshots of web pages in real-time.
|
||||
|
||||
### Wkhtmltopdf Features
|
||||
|
||||
1. Open source and cross platform.
|
||||
2. Convert any **HTML** web pages to **PDF** files using **WebKit** engine.
|
||||
3. Options to add headers and footers
|
||||
4. Table of Content (**TOC**) generation option.
|
||||
5. Provides batch mode conversions.
|
||||
6. Support for **PHP** or **Python** via bindings to libwkhtmltox.
|
||||
|
||||
In this article we will show you how to install **Wkhtmltopdf** program under Linux systems using source tarball files.
|
||||
|
||||
### Install Evince (PDF Viewer)
|
||||
|
||||
Let’s install **evince** (a **PDF** reader) program for viewing **PDF** files in Linux systems.
|
||||
|
||||
```
|
||||
$ sudo yum install evince [RHEL/CentOS and Fedora]
|
||||
$ sudo dnf install evince [On Fedora 22+ versions]
|
||||
$ sudo apt-get install evince [On Debian/Ubuntu systems]
|
||||
```
|
||||
|
||||
### Download Wkhtmltopdf Source File
|
||||
|
||||
Download **wkhtmltopdf** source files for your **Linux** architecture using [Wget command][1], or you can also download latest versions (current stable series is **0.12.4**) at [wkhtmltopdf download][2] page.
|
||||
|
||||
##### On 64-bit Linux OS
|
||||
|
||||
```
|
||||
$ wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
|
||||
```
|
||||
|
||||
##### On 32-bit Linux OS
|
||||
|
||||
```
|
||||
$ wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-i386.tar.xz
|
||||
```
|
||||
|
||||
### Install Wkhtmltopdf in Linux
|
||||
|
||||
Extract the files to a current working directory using following [tar command][3].
|
||||
|
||||
```
|
||||
------ On 64-bit Linux OS ------
|
||||
$ sudo tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
|
||||
------ On 32-bit Linux OS ------
|
||||
$ sudo tar -xvzf wkhtmltox-0.12.4_linux-generic-i386.tar.xz
|
||||
```
|
||||
|
||||
Install the **wkhtmltopdf** under **/usr/bin** directory for easy execution of program from any path.
|
||||
|
||||
```
|
||||
$ sudo cp wkhtmltox/bin/wkhtmltopdf /usr/bin/
|
||||
```
|
||||
|
||||
### How to Use Wkhtmltopdf?
|
||||
|
||||
Here we will see how to covert remote **HTML** pages to **PDF** files, verify information, view created files using **evince** program from the **GNOME** Desktop.
|
||||
|
||||
#### Convert Website HTML Page to PDF File
|
||||
|
||||
To convert any website **HTML** web page to **PDF**, run the following example command. It will convert the given webpage to [10-Sudo-Configurations.pdf][4] in current working directory.
|
||||
|
||||
```
|
||||
# wkhtmltopdf http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### Sample Output :
|
||||
|
||||
```
|
||||
Loading pages (1/6)
|
||||
Counting pages (2/6)
|
||||
Resolving links (4/6)
|
||||
Loading headers and footers (5/6)
|
||||
Printing pages (6/6)
|
||||
Done
|
||||
```
|
||||
|
||||
#### View Generated PDF File
|
||||
|
||||
To verify that the file is created, use the following command.
|
||||
|
||||
```
|
||||
$ file 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### Sample Output :
|
||||
|
||||
```
|
||||
10-Sudo-Configurations.pdf: PDF document, version 1.4
|
||||
```
|
||||
|
||||
#### View Information of Generated PDF File
|
||||
|
||||
To view the information of generated file, issue the following command.
|
||||
|
||||
```
|
||||
$ pdfinfo 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### Sample Output :
|
||||
|
||||
```
|
||||
Title: 10 Useful Sudoers Configurations for Setting 'sudo' in Linux
|
||||
Creator: wkhtmltopdf 0.12.4
|
||||
Producer: Qt 4.8.7
|
||||
CreationDate: Sat Jan 28 13:02:58 2017
|
||||
Tagged: no
|
||||
UserProperties: no
|
||||
Suspects: no
|
||||
Form: none
|
||||
JavaScript: no
|
||||
Pages: 13
|
||||
Encrypted: no
|
||||
Page size: 595 x 842 pts (A4)
|
||||
Page rot: 0
|
||||
File size: 697827 bytes
|
||||
Optimized: no
|
||||
PDF version: 1.4
|
||||
```
|
||||
|
||||
#### View Created PDF File
|
||||
|
||||
Take a look at the newly created **PDF** file using **evince** program from the desktop.
|
||||
|
||||
```
|
||||
$ evince 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### Sample Screenshot :
|
||||
|
||||
Looks pretty nice under my Linux Mint 17 box.
|
||||
|
||||
[
|
||||
![View Website Page in PDF](http://www.tecmint.com/wp-content/uploads/2012/10/View-Website-Page-in-PDF.png)
|
||||
][5]
|
||||
|
||||
View Website Page in PDF
|
||||
|
||||
#### Create TOC (Table Of Content) of a Page to PDF
|
||||
|
||||
To create a table of content for a **PDF** file, use the option as **toc**.
|
||||
|
||||
```
|
||||
$ wkhtmltopdf toc http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### Sample Output :
|
||||
|
||||
```
|
||||
Loading pages (1/6)
|
||||
Counting pages (2/6)
|
||||
Loading TOC (3/6)
|
||||
Resolving links (4/6)
|
||||
Loading headers and footers (5/6)
|
||||
Printing pages (6/6)
|
||||
Done
|
||||
```
|
||||
|
||||
To check the **TOC** for the created file, again use evince program.
|
||||
|
||||
```
|
||||
$ evince 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### Sample Screenshot :
|
||||
|
||||
Take a look at the picture below. it looks even more better than the above.
|
||||
|
||||
[
|
||||
![Create Website Page to Table of Contents in PDF](http://www.tecmint.com/wp-content/uploads/2012/10/Create-Website-Page-Table-of-Contents-in-PDF.png)
|
||||
][6]
|
||||
|
||||
Create Website Page to Table of Contents in PDF
|
||||
|
||||
#### Wkhtmltopdf Options and Usage
|
||||
|
||||
For **Wkhtmltopdf** more usage and options, use the following help command. It will display list of all available options that you can use with it.
|
||||
|
||||
```
|
||||
$ wkhtmltopdf --help
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+
|
||||
|
||||
--------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/wkhtmltopdf-convert-website-html-page-to-pdf-linux/
|
||||
|
||||
作者:[Ravi Saive][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/admin/
|
||||
[1]:http://www.tecmint.com/10-wget-command-examples-in-linux/
|
||||
[2]:http://wkhtmltopdf.org/downloads.html
|
||||
[3]:http://www.tecmint.com/18-tar-command-examples-in-linux/
|
||||
[4]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/
|
||||
[5]:http://www.tecmint.com/wp-content/uploads/2012/10/View-Website-Page-in-PDF.png
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2012/10/Create-Website-Page-Table-of-Contents-in-PDF.png
|
@ -1,3 +1,4 @@
|
||||
wcnnbdk1 translating
|
||||
### Basics of network protocol analyzer Wireshark On Linux
|
||||
|
||||
|
||||
|
@ -1,128 +0,0 @@
|
||||
Cathon is translating
|
||||
How to use markers and perform text selection in Vim
|
||||
============================================================
|
||||
|
||||
When using GUI-based text/source code editors, some features are a given, such as selecting text. I mean, most of us won't even consider this a feature anymore. But that's not the case with command line based editors like Vim. Specifically for Vim, when only using keyboard, you'll have to learn certain commands in order to select text the way you want. In this tutorial we will discuss this feature as well as the 'marks' feature of Vim in detail.
|
||||
|
||||
But before we start doing that, it's worth mentioning that all the examples, commands, and instructions mentioned in this tutorial have been tested on Ubuntu 16.04, and the Vim version we've used is 7.4.
|
||||
|
||||
# Text selection options in Vim
|
||||
|
||||
Assuming that you have the basic knowledge about the Vim editor (No? no problem, just head [here][2]), you would be knowing that the 'd' command lets you cut/delete a line. But what if you want to cut, say, 3 lines? Your answer could be: 'repeat the command thrice'. Fine, but what if the requirement is to cut 15 lines? Is running the 'd' command 15 times a practical solution?
|
||||
|
||||
No, it's not. A better solution, in this case, would be to select the lines you want to cut/delete, and then run the 'd' command just once. Here's an example:
|
||||
|
||||
Suppose I want to cut/delete the complete first paragraph of the INTRODUCTION section shown in the screenshot below:
|
||||
|
||||
[
|
||||
![Text edited in VIM](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-example.png)
|
||||
][3]
|
||||
|
||||
So what I'll do is, I'll bring the cursor in the beginning of the first line, and (making sure I am out of Insert mode) type the 'V' (Shift+v) command. This will result in the first line being selected and Vim enabling the Visual Line mode.
|
||||
|
||||
[
|
||||
![Select a line with VIM](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-initiated.png)
|
||||
][4]
|
||||
|
||||
Now, all I have to do is to use the down arrow key to select the whole paragraph.
|
||||
|
||||
[
|
||||
![Select multiple lines with Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-working.png)
|
||||
][5]
|
||||
|
||||
So that's what we wanted, right? Now just press 'd' and the selected paragraph will be cut/deleted. Needless to say, aside from cut/delete, you can perform any other option on the selected text.
|
||||
|
||||
This brings us to another important aspect: not every time we need to delete the complete line or lines; what to do in those cases? What that means is, the solution we just discussed only works when you want to perform operation on complete line(s). What if the requirement is to delete the first three sentences in a paragraph?
|
||||
|
||||
Well, there's a command for this as well - just use 'v' instead of 'V' (without single quotes of course). Following is an example where-in I used 'v' and then selected the first three sentences in the paragraph:
|
||||
|
||||
[
|
||||
![Select the first three sentences in Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-partial-lines.png)
|
||||
][6]
|
||||
|
||||
Moving on, sometimes the data you are dealing with consists of separate columns, and the requirement may be to select a particular column. For example, consider the following screenshot:
|
||||
|
||||
[
|
||||
![Columns in Vom](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-columns.png)
|
||||
][7]
|
||||
|
||||
Suppose the requirement is to only select the name of countries, which mean the second column of the text. So what you can do in this case is, bring your cursor under the first element of the column in question and press Ctrl+v once. Now, using the down arrow key, select the first letter of each country name:
|
||||
|
||||
[
|
||||
![Select the first char of a column](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-column-1.png)
|
||||
][8]
|
||||
|
||||
And then using the right arrow key, select the complete column, or the whole names.
|
||||
|
||||
[
|
||||
![Select a whole column in Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-column-2.png)
|
||||
][9]
|
||||
|
||||
**Tip**: In case you de-selected a block of text for some reason, and now want to again select it, just press 'gv' in the command mode.
|
||||
|
||||
# Using marks
|
||||
|
||||
Sometimes, while working on a large file (say, a source code file or a shell script), you might want to switch to particular location and then come back to the line where you were originally. That's not an issue if the lines in question aren't far away, or you have to do this occasionally.
|
||||
|
||||
But what is it's the other way round - you have to frequently jump between your present location and various far off lines in the file. Well, the solution in that case is to use marks. Just mark your current location, then come back to this location from anywhere in the file by just mentioning the name of the mark.
|
||||
|
||||
To mark a line in vim, use the m command followed by an alphabet that represents the name of the mark (available options are a-z in lowercase). For example, ma. Now, to come back to the mark a, use the 'a command (single quote included).
|
||||
|
||||
**Tip**: You can use apostrophe (`'`) or backtick `(`) depending on whether you want to jump to the beginning of the marked line, or specifically to` the line and column of the mark.
|
||||
|
||||
There can be various other useful applications of Vim markers. For example, you can put a mark on a line, then go to some other line and run the following command:
|
||||
|
||||
```
|
||||
d'[mark-name]
|
||||
```
|
||||
|
||||
to delete everything between your current position and the marked line.
|
||||
|
||||
Moving on, here's an important tid-bid from the Vim's official documentation:
|
||||
|
||||
```
|
||||
Each file has a set of marks identified by lowercase letters (a-z). In addition there is a global set of marks identified by uppercase letters (A-Z) that identify a position within a particular file. For example, you may be editing ten files. Each file could have mark a, but only one file can have mark A.
|
||||
```
|
||||
|
||||
So while we have discussed the basic usage of lowercase alphabets as Vim marks, how and where the uppercase letters are useful. Well, the following excerpt makes it amply clear:
|
||||
|
||||
```
|
||||
Because of their limitations, uppercase marks may at first glance seem less versatile than their lowercase counterpart, but this feature allows them to be used as a quick sort of "file bookmark." For example, open your .vimrc, press mV, and close Vim. The next time you want to edit your .vimrc, just press 'V to open it.
|
||||
```
|
||||
|
||||
And finally, to delete a mark, use the 'delmarks' command. For example:
|
||||
|
||||
```
|
||||
:delmarks a
|
||||
```
|
||||
|
||||
The aforementioned command will delete the mark a from the file. Of course, if you delete a line containing a mark, then that mark is also deleted automatically. For more information on marks, head to the [Vim documentation][11].
|
||||
|
||||
# Conclusion
|
||||
|
||||
As you start using Vim as your primary editor, features like the ones explained in this tutorial become useful tools that save a lot of your time. As you'd agree, there's not much of a learning curve involved with selection and marks features explained here - all that's required is a bit of practice.
|
||||
|
||||
For the complete coverage of Vim-related articles on HowtoForge, head [here][1].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.howtoforge.com/tutorial/how-to-use-markers-and-perform-text-selection-in-vim/
|
||||
|
||||
作者:[Himanshu Arora][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.howtoforge.com/tutorial/how-to-use-markers-and-perform-text-selection-in-vim/
|
||||
[1]:https://www.howtoforge.com/tutorials/shell/
|
||||
[2]:https://www.howtoforge.com/vim-basics
|
||||
[3]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-example.png
|
||||
[4]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-initiated.png
|
||||
[5]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-working.png
|
||||
[6]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-partial-lines.png
|
||||
[7]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-columns.png
|
||||
[8]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-column-1.png
|
||||
[9]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-column-2.png
|
||||
[10]:http://vim.wikia.com/wiki/Vimrc
|
||||
[11]:http://vim.wikia.com/wiki/Using_marks
|
@ -1,62 +0,0 @@
|
||||
Why Go?
|
||||
============================================================
|
||||
|
||||
A few weeks ago I was asked by a friend, “why should I care about Go”? They knew that I was passionate about Go, but wanted to know why I thought _other people_ should care. This article contains three salient reasons why I think Go is an important programming language.
|
||||
|
||||
# Safety
|
||||
|
||||
As individuals, you and I may be perfectly capable of writing a program in C that neither leaks memory or reuses it unsafely. However, with more than [40 years][5] of experience, it is clear that collectively, programmers working in C are unable to reliably do so _en masse_ .
|
||||
|
||||
Despite static code analysis, valgrind, tsan, and `-Werror` being available for a decades, there is scant evidence those tools have achieved widespread acknowledgement, let alone widespread adoption. In aggregate, programmers have shown they simply cannot safely manage their own memory. It’s time to move away from C.
|
||||
|
||||
Go does not rely on the programmer to manage memory directly, instead all memory allocation is managed by the language runtime, initialized before use, and bounds checked when necessary. It’s certainly not the first mainstream language that offered these safety guarantees, Java (1995) is probably a contender for that crown. The point being, the world has no appetite for unsafe programming languages, thus Go is memory safe by default.
|
||||
|
||||
# Developer productivity
|
||||
|
||||
The point at which developer time became more expensive than hardware time was crossed back in the late 1970s. Developer productivity is a sprawling topic but it boils down to this; how much time do you spend doing useful work vs waiting for the compiler or hopelessly lost in a foreign codebase.
|
||||
|
||||
The joke goes that Go was developed while waiting for a [C++ program to compile][6]. Fast compilation is a key feature of Go and a key recruiting tool to attract new developers. While compilation speed remains a [constant battleground][7], it is fair to say that compilations which take minutes in other languages, take seconds in Go.
|
||||
|
||||
More fundamental to the question of developer productivity, Go programmers realise that code is _written to be read_ and so place the [act of reading code above the act of writing it][8]. Go goes so far as to enforce, via tooling and custom, that all code by formatted in a specific style. This removes the friction of learning a project specific language sub-dialect and helps spot mistakes because they just _look incorrect._
|
||||
|
||||
Due to a focus on analysis and mechanical assistance, a growing set of tools that exist to spot common coding errors have been adopted by Go developers in a way that never struck a chord with C programmers—Go developers _want_ tools to help them keep their code clean.
|
||||
|
||||
# Concurrency
|
||||
|
||||
For more than a decade, chip designers have been warning that the [free lunch is over][9]. Hardware parallelism, from the lowliest mobile phone to the most power hungry server, in the form of [more, slower, cpu cores][10], is only available _if_ your language can utilise them. Therefore, concurrency needs to be built into the software we write to run on today’s hardware.
|
||||
|
||||
Go takes a step beyond languages that expose the operating system’s multi-process or multi-threading parallelism models by offering a [lightweight concurrency model based on coroutines][11], or goroutines as they are known in Go. Goroutines allows the programmer to eschew convoluted callback styles while the language runtime makes sure that there will be just enough threads to keep your cores active.
|
||||
|
||||
# The rule of three
|
||||
|
||||
These were my three reasons for recommending Go to my friend; safety, productivity, and concurrency. Individually, there are languages that cover one, possibly two of these domains, but it is the combination of all three that makes Go an excellent choice for mainstream programmers today.
|
||||
|
||||
### Related Posts:
|
||||
|
||||
1. [Why Go and Rust are not competitors][1]
|
||||
2. [Hear me speak about Go performance at OSCON][2]
|
||||
3. [I’m speaking at GopherChina and GopherCon Singapore][3]
|
||||
4. [Stress test your Go packages][4]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://dave.cheney.net/2017/03/20/why-go
|
||||
|
||||
作者:[Dave Cheney][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://dave.cheney.net/
|
||||
[1]:https://dave.cheney.net/2015/07/02/why-go-and-rust-are-not-competitors
|
||||
[2]:https://dave.cheney.net/2015/05/31/hear-me-speak-about-go-performance-at-oscon
|
||||
[3]:https://dave.cheney.net/2017/02/09/im-speaking-at-gopherchina-and-gophercon-singapore
|
||||
[4]:https://dave.cheney.net/2013/06/19/stress-test-your-go-packages
|
||||
[5]:https://en.wikipedia.org/wiki/C_(programming_language)
|
||||
[6]:https://commandcenter.blogspot.com.au/2012/06/less-is-exponentially-more.html
|
||||
[7]:https://dave.cheney.net/2016/11/19/go-1-8-toolchain-improvements
|
||||
[8]:https://twitter.com/rob_pike/status/791326139012620288
|
||||
[9]:http://www.gotw.ca/publications/concurrency-ddj.htm
|
||||
[10]:https://www.technologyreview.com/s/601441/moores-law-is-dead-now-what/
|
||||
[11]:https://blog.golang.org/concurrency-is-not-parallelism
|
@ -0,0 +1,114 @@
|
||||
5 big ways AI is rapidly invading our lives
|
||||
============================================================
|
||||
|
||||
> Let's look at five real ways we're already surrounded by artificial intelligence.
|
||||
|
||||
|
||||
![5 big ways AI is rapidly invading our lives](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/brain-think-ai-intelligence-ccby.png?itok=-EK6Vpz1 "5 big ways AI is rapidly invading our lives")
|
||||
>Image by : opensource.com
|
||||
|
||||
Open source projects [are helping drive][2] artificial intelligence advancements, and we can expect to hear much more about how AI impacts our lives as the technologies mature. Have you considered how AI is changing the world around you already? Let's take a look at our increasingly artificially enhanced universe and consider the bold predictions about our AI-influenced future.
|
||||
|
||||
### 1\. AI influences your purchasing decisions
|
||||
|
||||
A recent story on [VentureBeat][3], "[How AI will help us decipher millennials][4]," caught my eye. I confess that I haven't given much thought to artificial intelligence—nor have I had a hard time deciphering millennials—so I was curious to learn more. As it turns out, the headline was a bit misleading; "How to sell to millennials" would have been a more accurate title.
|
||||
|
||||
According to the article, the millennial generation is a "the demographic segment so coveted that marketing managers from all over the globe are fighting over them." By analyzing online behavior—be it shopping, social media, or other activities—machine learning can help predict behavioral patterns, which can then turn into targeted advertising. The article goes on to explain how the Internet of Things and social media platforms can be mined for data points. "Using machine learning to mine social media data allows companies to determine how millennials talk about its products, what their sentiments are towards a product category, how they respond to competitors’ advertising campaigns, and a multitude of other data that can be used to design targeted advertising campaigns," the article explains. That AI and millennials are the future of marketing is no huge surprise, but Gen Xers and Baby Boomers, you're not off the hook yet.
|
||||
|
||||
>AI is being used to target entire groups—including cities—of people based on behavior changes.AI is being used to target entire groups—including cities—of people based on behavior changes.
|
||||
|
||||
For example, an article on [Raconteur][23], "[How AI will change buyer behaviour][24]," explains that the biggest strength of AI in the online retail industry is its ability to adapt quickly to fluid situations that change customer behavior. Abhinav Aggarwal, chief executive of artificial intelligence startup [Fluid AI][25], says that his company's software was being used by a client to predict customer behavior, and the system noticed a change during a snow storm. "Users who would typically ignore the e-mails or in-app notifications sent in the middle of the day were now opening them as they were stuck at home without much to do. Within an hour the AI system adapted to the new situation and started sending more promotional material during working hours," he explains.
|
||||
|
||||
AI is changing how, why, and when we spend money, but how is it changing the way we earn our paychecks?
|
||||
|
||||
### 2\. AI is changing how we work
|
||||
|
||||
A recent [Fast Company][5] article, "[This is how AI will change your work in 2017][6]," says that job seekers will benefit from artificial intelligence. The author explains that AI will be used to send job seekers alerts for relevant job openings, in addition to updates on salary trends, when you're due for a promotion, and the likelihood that you'll get one.
|
||||
|
||||
Artificial intelligence also will be used by companies to help on-board new talent. "Many new hires get a ton of information during their first couple of days on the job, much of which won't get retained," the article explains. Instead, a bot could "drip information" to a new employee over time as it becomes more relevant.
|
||||
|
||||
On [Inc.][7], "[Businesses Beyond Bias: How AI Will Reshape Hiring Practices][8]" looks at how [SAP SuccessFactors][9], a talent management solutions provider, leverages AI as a job description "bias checker" and to check for bias in employee compensation.
|
||||
|
||||
[Deloitte's 2017 Human Capital Trends Report][10] indicates that AI is motivating organizations to restructure. Fast Company's article "[How AI is changing the way companies are organized][11]" examines the report, which was based on surveys with more than 10,000 HR and business leaders around the world. "Instead of hiring the most qualified person for a specific task, many companies are now putting greater emphasis on cultural fit and adaptability, knowing that individual roles will have to evolve along with the implementation of AI," the article explains. To adapt to changing technologies, organizations are also moving away from top-down structures and to multidisciplinary teams, the article says.
|
||||
|
||||
### 3\. AI is transforming education
|
||||
|
||||
>AI will benefit all the stakeholders of the education ecosystem.
|
||||
|
||||
Education budgets are shrinking, whereas classroom sizes are growing, so leveraging technological advancements can help improve the productivity and efficiency of the education system, and play a role in improving the quality and affordability of education, according to an article on VentureBeat. "[How AI will transform education in 2017][26]" says that this year we'll see AI grading students' written answers, bots answering students' questions, virtual personal assistants tutoring students, and more. "AI will benefit all the stakeholders of the education ecosystem," the article explains. "Students would be able to learn better with instant feedback and guidance, teachers would get rich learning analytics and insights to personalize instruction, parents would see improved career prospects for their children at a reduced cost, schools would be able to scale high-quality education, and governments would be able to provide affordable education to all."
|
||||
|
||||
### 4\. AI is reshaping healthcare
|
||||
|
||||
A February 2017 article on [CB Insights][12] rounded up [106 artificial intelligence startups in healthcare][13], and many of those raised their first equity funding round within the past couple of years. "19 out of the 24 companies under imaging and diagnostics raised their first equity funding round since January 2015," the article says. Other companies on the list include those working on AI for remote patient monitoring, drug discovery, and oncology.
|
||||
|
||||
An article published on March 16 on TechCrunch that looks at [how AI advances are reshaping healthcare][14] explains, "Once a better understanding of human DNA is established, there is an opportunity to go one step further and provide personalized insights to individuals based on their idiosyncratic biological dispositions. This trend is indicative of a new era of 'personalized genetics,' whereby individuals are able to take full control of their health through access to unprecedented information about their own bodies."
|
||||
|
||||
The article goes on to explain that AI and machine learning are lowering the cost and time to discover new drugs. Thanks in part to extensive testing, new drugs can take more than 12 years to enter the market. "ML algorithms can allow computers to 'learn' how to make predictions based on the data they have previously processed or choose (and in some cases, even conduct) what experiments need to be done. Similar types of algorithms also can be used to predict the side effects of specific chemical compounds on humans, speeding up approvals," the article says. In 2015, the article notes, a San Francisco-based startup, [Atomwise][15], completed analysis on two new drugs to reduce Ebola infectivity within one day, instead of taking years.
|
||||
|
||||
>AI is helping with discovering, diagnosing, and managing new diseases.
|
||||
|
||||
Another startup, London-based [BenevolentAI][27], is harnessing AI to look for patterns in scientific literature. "Recently, the company identified two potential chemical compounds that may work on Alzheimer’s, attracting the attention of pharmaceutical companies," the article says.
|
||||
|
||||
In addition to drug discovery, AI is helping with discovering, diagnosing, and managing new diseases. The TechCrunch article explains that, historically, illnesses are diagnosed based on symptoms displayed, but AI is being used to detect disease signatures in the blood, and to develop treatment plans using deep learning insights from analyzing billions of clinical cases. "IBM's Watson is working with Memorial Sloan Kettering in New York to digest reams of data on cancer patients and treatments used over decades to present and suggest treatment options to doctors in dealing with unique cancer cases," the article says.
|
||||
|
||||
### 5\. AI is changing our love lives
|
||||
|
||||
More than 50-million active users across 195 countries swipe through potential mates with [Tinder][16], a dating app launched in 2012\. In a [Forbes Interview podcast][17], Tinder founder and chairman Sean Rad spoke with Steven Bertoni about how artificial intelligence is changing the dating game. In [an article][18] about the interview, Bertoni quotes Rad, who says, "There might be a moment when Tinder is just so good at predicting the few people that you're interested in, and Tinder might do a lot of the leg work in organizing a date, right?" So instead of presenting users with potential partners, the app would make a suggestion for a nearby partner and take it a step further, coordinate schedules, and set up a date.
|
||||
|
||||
>Future generations literally might fall in love with artificial intelligence.
|
||||
|
||||
Are you in love with AI yet? Future generations literally might fall in love with artificial intelligence. An article by Raya Bidshahri on [Singularity Hub][19], "[How AI will redefine love][20]," says that in a few decades we might be arguing that love is not limited by biology.
|
||||
|
||||
"Our technology, powered by Moore's law, is growing at a staggering rate—intelligent devices are becoming more and more integrated to our lives," Bidshahri explains, adding, "Futurist Ray Kurzweil predicts that we will have AI at a human level by 2029, and it will be a billion times more capable than humans by the 2040s. Many predict that one day we will merge with powerful machines, and we ourselves may become artificially intelligent." She argues that it's inevitable in such a world that humans would accept being in love with entirely non-biological beings.
|
||||
|
||||
That might sound a bit freaky, but falling in love with AI is a more optimistic outcome than a future in which robots take over the world. "Programming AI to have the capacity to feel love can allow us to create more compassionate AI and may be the very key to avoiding the AI apocalypse many fear," Bidshahri says.
|
||||
|
||||
This list of big ways AI is invading all areas of our lives barely scrapes the surface of the artificial intelligence bubbling up around us. Which AI innovations are most exciting—or troubling—to you? Let us know about them in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
作者简介:
|
||||
|
||||
Rikki Endsley - Rikki Endsley is a community manager for Opensource.com. In the past, she worked as the community evangelist on the Open Source and Standards (OSAS) team at Red Hat; a freelance tech journalist; community manager for the USENIX Association; associate publisher of Linux Pro Magazine, ADMIN, and Ubuntu User; and as the managing editor of Sys Admin magazine and UnixReview.com. Follow her on Twitter at: @rikkiends.
|
||||
|
||||
|
||||
-------------------
|
||||
|
||||
via: https://opensource.com/article/17/3/5-big-ways-ai-rapidly-invading-our-lives
|
||||
|
||||
作者:[Rikki Endsley ][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/rikki-endsley
|
||||
[1]:https://opensource.com/article/17/3/5-big-ways-ai-rapidly-invading-our-lives?rate=ORfqhKFu9dpA9aFfg-5Za9ZWGcBcx-f0cUlf_VZNeQs
|
||||
[2]:https://www.linux.com/news/open-source-projects-are-transforming-machine-learning-and-ai
|
||||
[3]:https://twitter.com/venturebeat
|
||||
[4]:http://venturebeat.com/2017/03/16/how-ai-will-help-us-decipher-millennials/
|
||||
[5]:https://opensource.com/article/17/3/5-big-ways-ai-rapidly-invading-our-lives
|
||||
[6]:https://www.fastcompany.com/3066620/this-is-how-ai-will-change-your-work-in-2017
|
||||
[7]:https://twitter.com/Inc
|
||||
[8]:http://www.inc.com/bill-carmody/businesses-beyond-bias-how-ai-will-reshape-hiring-practices.html
|
||||
[9]:https://www.successfactors.com/en_us.html
|
||||
[10]:https://dupress.deloitte.com/dup-us-en/focus/human-capital-trends.html?id=us:2el:3pr:dup3575:awa:cons:022817:hct17
|
||||
[11]:https://www.fastcompany.com/3068492/how-ai-is-changing-the-way-companies-are-organized
|
||||
[12]:https://twitter.com/CBinsights
|
||||
[13]:https://www.cbinsights.com/blog/artificial-intelligence-startups-healthcare/
|
||||
[14]:https://techcrunch.com/2017/03/16/advances-in-ai-and-ml-are-reshaping-healthcare/
|
||||
[15]:http://www.atomwise.com/
|
||||
[16]:https://twitter.com/Tinder
|
||||
[17]:https://www.forbes.com/podcasts/the-forbes-interview/#5e962e5624e1
|
||||
[18]:https://www.forbes.com/sites/stevenbertoni/2017/02/14/tinders-sean-rad-on-how-technology-and-artificial-intelligence-will-change-dating/#4180fc2e5b99
|
||||
[19]:https://twitter.com/singularityhub
|
||||
[20]:https://singularityhub.com/2016/08/05/how-ai-will-redefine-love/
|
||||
[21]:https://opensource.com/user/23316/feed
|
||||
[22]:https://opensource.com/article/17/3/5-big-ways-ai-rapidly-invading-our-lives#comments
|
||||
[23]:https://twitter.com/raconteur
|
||||
[24]:https://www.raconteur.net/technology/how-ai-will-change-buyer-behaviour
|
||||
[25]:http://www.fluid.ai/
|
||||
[26]:http://venturebeat.com/2017/02/04/how-ai-will-transform-education-in-2017/
|
||||
[27]:https://twitter.com/benevolent_ai
|
||||
[28]:https://opensource.com/users/rikki-endsley
|
@ -1,3 +1,5 @@
|
||||
GHLandy Translating
|
||||
|
||||
[A formal spec for GitHub Flavored Markdown][8]
|
||||
============================================================
|
||||
|
||||
|
91
sources/tech/20170327 Using vi-mode in your shell.md
Normal file
91
sources/tech/20170327 Using vi-mode in your shell.md
Normal file
@ -0,0 +1,91 @@
|
||||
Using vi-mode in your shell
|
||||
============================================================
|
||||
|
||||
> Get an introduction to using vi-mode for line editing at the command line.
|
||||
|
||||
![Using vi-mode at the command line](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/code_computer_development_programming.png?itok=wMspQJcO "Using vi-mode at the command line")
|
||||
>Image by : opensource.com
|
||||
|
||||
As a participant in the greater open source community, and more specifically as a member of the [Fedora Project][2], I have the opportunity to meet with many people and talk about all kinds of interesting technical topics. One of my favorites is the "command line," or [shell][3], because learning about how people use the shell proficiently can give you an insight into how they think, what kind of workflows they favor, and to some extent what makes them tick. Many developers and systems operators share their "dot files" (a common slang term for their shell's configuration files) publicly out on the Internet, which leads to an interesting collaboration opportunity that allows everyone to learn tips and tricks from seasoned veterans of the command line as well as share common shortcuts and productivity boosters.
|
||||
|
||||
I'll introduce one for you here by showing the shell's vi-mode.
|
||||
|
||||
In the large ecosystem of computing and operating systems, there are [many shells][4]. However, in the Linux world, the de facto standard has become [bash][5] and it is the default shell installed on all major Linux distributions at of the time of this writing. As such, that is the shell I'll be talking about today. Something to note, though, is that bash is also a reasonably popular option on other UNIX-style operating systems, so it's likely not far from your reach (and for you Windows users out there, there's always [cygwin][6]).
|
||||
|
||||
While exploring the shell, the first thing you do is type commands into it and most often get output, like so:
|
||||
|
||||
```
|
||||
$ echo "Hello World!"
|
||||
Hello World!
|
||||
```
|
||||
|
||||
This is common practice and is probably something everyone reading this has done. Something that newcomers and novices alike might not realize is that the default input mode for the [bash][7] shell is [Emacs][8], which means that all line-editing functions you will carry out on commands will use ["Emacs-style" keyboard combinations][9]. (For those interested in the nuts and bolts of things, the function of line-editing is actually carried out by [GNU Readline][10].)
|
||||
|
||||
For example, if you had typed **echo "Hello Wrld!"** and realized that you wanted to quickly jump back one word (space delimited) to fix that typo without having to hold down your left arrow key then you would hit the **Alt+b** keys together and the cursor would jump backward to the **W**.
|
||||
|
||||
```
|
||||
$ echo "Hello Wrld!"
|
||||
^
|
||||
Cursor is here.
|
||||
```
|
||||
|
||||
This was done using only one of the many Emacs keyboard combinations that is offered to the user of the shell. There are many more available for all kinds of things, such as copying text, pasting text, removing text, and using shortcuts to edit text. Using complex keyboard combinations and committing them to memory may seem silly, but they can be extremely powerful when working with longer commands or recalling a command from your shell history yet wanting to edit a couple things before executing the command again.
|
||||
|
||||
While Emacs key bindings are all well and good if you're familiar with the Emacs text editor or otherwise find them convenient to use, there are those who are more comfortable using "vi-style" keyboard bindings because of their time spent in the vi text editor (normally via [vim][11] or [nvim][12] these days). The bash shell (again, via GNU Readline) is able to provide this functionality for us. In order to enable it, you run the command **$ ****set**** -o vi**.
|
||||
|
||||
Just like magic, you're now in vi-mode and can easily line-edit using vi-style key bindings in order to copy text, remove text, and jump around to different positions in the line of text. This isn't much different in terms of capabilities of Emacs-mode but it's _how_ you interact with the shell to perform these actions that changes, which is a powerful option pending your specific preference.
|
||||
|
||||
Let's take a look at the same example as before, but with the context that as soon as you land in vi-mode in your shell you're in INSERT mode, which means you can type commands just you did before but you can now hit the **Esc** key on your keyboard and you'll be in NORMAL mode, which is where you can navigate around freely and make text modifications.
|
||||
|
||||
Looking at the same example as before, if you had typed **echo "Hello Wrld!"** and realized you wanted to jump back one word (again, space delimited) to fix up that typo, then you would hit **Esc** to change from INSERT to NORMAL mode. Then you can type **B** (**Shift+b** for those following along at home), which would move the cursor back much like it did before. (For more information on vi-modes, go [here][13].):
|
||||
|
||||
```
|
||||
$ echo "Hello Wrld!"
|
||||
^
|
||||
Cursor is here.
|
||||
```
|
||||
|
||||
Now, for the vi/vim/nvim users out there this is hopefully a fun "ah ha!" moment when you realize the potential of keeping your tried and true keyboard shortcuts close by at all times and not just while your writing things like code or documentation in your editor. If this is all new to you and you want to learn more, then I might suggest taking a trip to this [interactive vim tutorial][14] and see if the vi style of editing text is something you find useful.
|
||||
|
||||
If you enjoy interacting with your shell in this mode, you can set that persistently by editing the **~/.bashrc** file in your home directory and adding the following line at the bottom.
|
||||
|
||||
**set -o vi**
|
||||
|
||||
For the emacs mode users, hopefully this was a quick and fun look into "the other side" of your shell. At the end of the day I think everyone should use whatever editor and shell line-editing mode that makes them most productive and if that's vi-mode and this article was news to you, then congratulations! Now go forth and be productive.
|
||||
|
||||
Happy hacking...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Adam Miller is a member of the Fedora Engineering team focusing on Fedora Release Engineering tooling. His work includes next-generation build systems, automation, RPM package maintenance, and infrastructure deployment. Adam has completed his Bachelors of Science in Computer Science and Masters of Science in Information Assurance and Security, both from Sam Houston State University. He is a Red Hat Certified Engineer (Cert# 110-008-810), and an active member of the open source community with a running history of contributions to the Fedora Project (FAS account name: maxamillion).
|
||||
|
||||
|
||||
------------------------
|
||||
via: https://opensource.com/article/17/3/fun-vi-mode-your-shell
|
||||
|
||||
作者:[Adam Miller ][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/maxamillion
|
||||
[1]:https://opensource.com/article/17/3/fun-vi-mode-your-shell?rate=5_eAB9UtByHOiZMysPcewU4Zz6hOrLwdcgIpu2Ub4vo
|
||||
[2]:https://getfedora.org/
|
||||
[3]:https://opensource.com/business/16/3/top-linux-shells
|
||||
[4]:https://opensource.com/business/16/3/top-linux-shells
|
||||
[5]:https://tiswww.case.edu/php/chet/bash/bashtop.html
|
||||
[6]:http://cygwin.org/
|
||||
[7]:https://tiswww.case.edu/php/chet/bash/bashtop.html
|
||||
[8]:https://www.gnu.org/software/emacs/
|
||||
[9]:https://en.wikipedia.org/wiki/GNU_Readline#Emacs_keyboard_shortcuts
|
||||
[10]:http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
|
||||
[11]:http://www.vim.org/
|
||||
[12]:https://neovim.io/
|
||||
[13]:https://en.wikibooks.org/wiki/Learning_the_vi_Editor/Vim/Modes
|
||||
[14]:http://www.openvim.com/tutorial.html
|
||||
[15]:https://opensource.com/user/10726/feed
|
||||
[16]:https://opensource.com/article/17/3/fun-vi-mode-your-shell#comments
|
||||
[17]:https://opensource.com/users/maxamillion
|
102
sources/tech/20170330 5 open source RSS feed readers.md
Normal file
102
sources/tech/20170330 5 open source RSS feed readers.md
Normal file
@ -0,0 +1,102 @@
|
||||
5 open source RSS feed readers
|
||||
============================================================
|
||||
|
||||
![RSS feed](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/rss_feed.png?itok=FHLEh-fZ "RSS feed")
|
||||
>Image by : [Rob McDonald][2] on Flickr. Modified by Opensource.com. [CC BY-SA 2.0][3].
|
||||
|
||||
### Do you use an RSS reader regularly?
|
||||
|
||||
<form class="pollanon" action="https://opensource.com/article/17/3/rss-feed-readers" method="post" id="poll-view-voting" accept-charset="UTF-8"><label class="element-invisible" for="edit-choice" style="display: block; clip: rect(1px 1px 1px 1px); overflow: hidden; height: 1px; width: 1px; color: rgb(67, 81, 86); position: absolute !important;">Choices</label><input type="radio" id="edit-choice-7621" name="choice" value="7621" class="form-radio" style="font-size: 16px; margin-top: 0px; max-width: 100%; -webkit-appearance: none; width: 0.8em; height: 0.8em; border-width: 1px; border-style: solid; border-color: rgb(51, 51, 51); border-radius: 50%; vertical-align: middle;"> <label class="option" for="edit-choice-7621" style="display: inline; font-weight: normal; color: rgb(67, 81, 86); margin-left: 0.2em; vertical-align: middle;">Yes.</label><input type="radio" id="edit-choice-7626" name="choice" value="7626" class="form-radio" style="font-size: 16px; margin-top: 0px; max-width: 100%; -webkit-appearance: none; width: 0.8em; height: 0.8em; border-width: 1px; border-style: solid; border-color: rgb(51, 51, 51); border-radius: 50%; vertical-align: middle;"> <label class="option" for="edit-choice-7626" style="display: inline; font-weight: normal; color: rgb(67, 81, 86); margin-left: 0.2em; vertical-align: middle;">No, but I used to.</label><input type="radio" id="edit-choice-7631" name="choice" value="7631" class="form-radio" style="font-size: 16px; margin-top: 0px; max-width: 100%; -webkit-appearance: none; width: 0.8em; height: 0.8em; border-width: 1px; border-style: solid; border-color: rgb(51, 51, 51); border-radius: 50%; vertical-align: middle;"> <label class="option" for="edit-choice-7631" style="display: inline; font-weight: normal; color: rgb(67, 81, 86); margin-left: 0.2em; vertical-align: middle;">No, I never did.</label><input type="submit" id="edit-vote" name="op" value="Vote" class="form-submit" style="font-family: "Swiss 721 SWA", "Helvetica Neue", Helvetica, Arial, "Nimbus Sans L", sans-serif; font-size: 1em; max-width: 100%; line-height: normal; font-style: normal; border-width: 1px; border-style: solid; border-color: rgb(119, 186, 77); color: rgb(255, 255, 255); background: rgb(119, 186, 77); padding: 0.6em 1.9em;"></form>
|
||||
|
||||
When Google Reader was discontinued four years ago, many "technology experts" called it the end of RSS feeds.
|
||||
|
||||
And it's true that for some people, social media and other aggregation tools are filling a need that feed readers for RSS, Atom, and other syndication formats once served. But old technologies never really die just because new technologies come along, particularly if the new technology does not perfectly replicate all of the use cases of the old one. The target audience for a technology might change a bit, and the tools people use to consume the technology might change, too.
|
||||
|
||||
But RSS is no more gone than email, JavaScript, SQL databases, the command line, or any number of other technologies that various people told me more than a decade ago had numbered days. (Is it any wonder that vinyl album sales just hit a [25-year peak][4] last year?) One only has to look at the success of online feed reader site Feedly to understand that there's still definitely a market for RSS readers.
|
||||
|
||||
The truth is, RSS and related feed formats are just more versatile than anything in wide usage that has attempted to replace it. There is no other easy was for me as a consumer to read a wide variety of publications, formatted in a client of my choosing, where I am virtually guaranteed to see every item that is published, while simultaneously not being shown a bunch of articles I have already read. And as a publisher, it's a simple format that most any publishing software I already use will support out of the box, letting me reach more people and easily distribute many types of documents.
|
||||
|
||||
So no, RSS is not dead. Long live RSS! We last looked at [open source RSS reader][5] options in 2013, and it's time for an update. Here are some of my top choices for open source RSS feed readers in 2017, each a little different in its approach.
|
||||
|
||||
### Miniflux
|
||||
|
||||
[Miniflux][6] is an absolutely minimalist web-based RSS reader, but don't confuse its intentionally light approach with laziness on the part of the developers; it is purposefully built to be a simple and efficient design. The philosophy of Miniflux seems to be to keep the application out of the way so that the reader can focus on the content, something many of us can appreciate in a world of bloated web applications.
|
||||
|
||||
But lightweight doesn't mean void of features; its responsive design looks good across any device, and allows for theming, an API interface, multiple languages, bookmark pinning, and more.
|
||||
|
||||
Miniflux's [source code][7] can be found on GitHub under the [GPLv3 Affero][8] license. If you don't want to set up your own self-hosted version, a paid hosting plan is available for $15/year.
|
||||
|
||||
### RSSOwl
|
||||
|
||||
[RSSOwl][9] is a cross-platform desktop feed reader. Written in Java, it is reminiscent of many popular desktop email clients in style and feel. It features powerful filtering and search capabilities, customizable notifications, and labels and bins for sorting your feeds. If you're used to using Thunderbird or other desktop readers for email, you'll feel right at home in RSSOwl.
|
||||
|
||||
You can find the source code for [RSSOwl][10] on GitHub under the [Eclipse Public License][11].
|
||||
|
||||
### Tickr
|
||||
|
||||
[Tickr][12] is a slightly different entry in this mix. It's a Linux desktop client, but it's not your traditional browse-and-read format. Instead, it slides your feed's headlines across a bar on your desktop like a news ticker; it's a great choice for news junkies who want to get the latest from a variety of sources. Clicking on a headline will open it in your browser of choice. It's not a dedicated reading client like the rest of the applications on this list, but if you're more interested in skimming headlines than reading every article, it's a good pick.
|
||||
|
||||
Tickr's source code and binaries can be found on the project's [website][13] under a GPL license.
|
||||
|
||||
### Tiny Tiny RSS
|
||||
|
||||
It would be difficult to build a list of modern RSS readers without including [Tiny Tiny RSS][14]. It's among the most popular self-hosted web-based readers, and it's chocked full of features: OPML import and export, keyboard shortcuts, sharing features, a themeable interface, an infrastructure for plug-ins, filtering capabilities, and lots more.
|
||||
|
||||
Tiny Tiny RSS also hosts an official [Android client][15], for those hoping to read on the go.
|
||||
|
||||
Both the [web][16] and [Android][17] source code for Tiny Tiny RSS can be found on GitLab under a [GPLv3 license][18].
|
||||
|
||||
### Winds
|
||||
|
||||
[Winds][19] is a modern looking self-hosted web feed reader, built on React. It makes use of a hosted machine learning personalization API called Stream, with the intent of helping you find more content that might be of interest to you based on your current interests. An online demo is available so you can [try it out][20] before you download. It's a new project, just a few months old, and so perhaps too soon to evaluate whether it's up to replace my daily feed reader yet, but it's certainly a project I'm watching with interest.
|
||||
|
||||
You can find the [source code][21] for Winds on GitHub under an [MIT][22] license.
|
||||
|
||||
* * *
|
||||
|
||||
These are most definitely not the only options out there. RSS is a relatively easy-to-parse, well-documented format, and so there are many, many different feed readers out there built to suit just about every taste. Here's a [big list][23] of self-hosted open source feed readers you might consider in addition to the ones we listed. We hope you'll share with us what your favorite RSS reader is in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Jason Baker - Jason is passionate about using technology to make the world more open, from software development to bringing sunlight to local governments. Linux desktop enthusiast. Map/geospatial nerd. Raspberry Pi tinkerer. Data analysis and visualization geek. Occasional coder. Cloud nativist. Follow him on Twitter.
|
||||
|
||||
|
||||
--------------
|
||||
|
||||
via: https://opensource.com/article/17/3/rss-feed-readers
|
||||
|
||||
作者:[ Jason Baker][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/jason-baker
|
||||
[1]:https://opensource.com/article/17/3/rss-feed-readers?rate=2sJrLq0K3QPQCznBId7K1Qrt3QAkwhQ435UyP77B5rs
|
||||
[2]:https://www.flickr.com/photos/evokeartdesign/6002000807
|
||||
[3]:https://creativecommons.org/licenses/by/2.0/
|
||||
[4]:https://www.theguardian.com/music/2017/jan/03/record-sales-vinyl-hits-25-year-high-and-outstrips-streaming
|
||||
[5]:https://opensource.com/life/13/6/open-source-rss
|
||||
[6]:https://miniflux.net/
|
||||
[7]:https://github.com/miniflux/miniflux
|
||||
[8]:https://github.com/miniflux/miniflux/blob/master/LICENSE
|
||||
[9]:http://www.rssowl.org/
|
||||
[10]:https://github.com/rssowl/RSSOwl
|
||||
[11]:https://github.com/rssowl/RSSOwl/blob/master/LICENSE
|
||||
[12]:https://www.open-tickr.net/
|
||||
[13]:https://www.open-tickr.net/download.php
|
||||
[14]:https://tt-rss.org/gitlab/fox/tt-rss/wikis/home
|
||||
[15]:https://tt-rss.org/gitlab/fox/tt-rss-android
|
||||
[16]:https://tt-rss.org/gitlab/fox/tt-rss/tree/master
|
||||
[17]:https://tt-rss.org/gitlab/fox/tt-rss-android/tree/master
|
||||
[18]:https://tt-rss.org/gitlab/fox/tt-rss-android/blob/master/COPYING
|
||||
[19]:https://winds.getstream.io/
|
||||
[20]:https://winds.getstream.io/app/getting-started
|
||||
[21]:https://github.com/GetStream/Winds
|
||||
[22]:https://github.com/GetStream/Winds/blob/master/LICENSE.md
|
||||
[23]:https://github.com/Kickball/awesome-selfhosted#feed-readers
|
||||
[24]:https://opensource.com/user/19894/feed
|
||||
[25]:https://opensource.com/article/17/3/rss-feed-readers#comments
|
||||
[26]:https://opensource.com/users/jason-baker
|
@ -0,0 +1,308 @@
|
||||
STUDY RUBY PROGRAMMING WITH OPEN-SOURCE BOOKS
|
||||
============================================================
|
||||
|
||||
### Open Source Ruby Books
|
||||
|
||||
Ruby is a general purpose, scripting, structured, flexible, fully object-oriented programming language developed by Yukihiro “Matz” Matsumoto. It features a fully dynamic type system, which means that the majority of its type checking is performed at run-time rather than at compilation. This stops programmers having to overly worry about integer and string types. Ruby has automatic memory management. The language shares many similar traits with Python, Perl, Lisp, Ada, Eiffel, and Smalltalk.
|
||||
|
||||
Ruby’s popularity was enhanced by the Ruby on Rails framework, a full-stack web framework which has been used to create many popular applications including Basecamp, GitHub, Shopify, Airbnb, Twitch, SoundCloud, Hulu, Zendesk, Square, and Highrise.
|
||||
|
||||
Ruby possesses a high portability running on Linux, Windows, Mac OS X, Cygwin, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, Tru64 UNIX, HP-UX, and many other operating systems. The TIOBE Programming Community index currently ranks Ruby in 12th place.
|
||||
|
||||
This compilation makes 9 strong recommendations. There are books here for beginner, intermediate, and advanced programmers. All of the texts are, of course, released under an open source license.
|
||||
|
||||
This article is part of [OSSBlog’s series of open source programming books][18].
|
||||
|
||||
|
|
||||
![Ruby Best Practices](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/03/RubyBestPractices.jpg?resize=200%2C262&ssl=1)
|
||||
|
|
||||
|
||||
### [Ruby Best Practices][1]
|
||||
|
||||
By Gregory Brown (328 pages)
|
||||
|
||||
Ruby Best Practices is for programmers who want to use Ruby as experienced Rubyists do. Written by the developer of the Ruby project Prawn, this book explains how to design beautiful APIs and domain-specific languages with Ruby, as well as how to work with functional programming ideas and techniques that can simplify your code and make you more productive.
|
||||
|
||||
Ruby Best Practices is much more about how to go about solving problems in Ruby than it is about the exact solution you should use. The book is not targeted at the Ruby beginner, and will be of little use to someone new to programming. The book assumes a reasonable technical understanding of Ruby, and some experience in developing software with it.
|
||||
|
||||
The book is split into two parts, with eight chapters forming its core and three appendixes included as supplementary material.
|
||||
|
||||
This book provides a wealth of information on:
|
||||
|
||||
* Driving Code Through Tests – covers a number testing philosophies and techniques. Use mocks and stubs
|
||||
* Designing Beautiful APIs with special focus on Ruby’s secret powers: Flexible argument processing and code blocks
|
||||
* Mastering the Dynamic Toolkit showing developers how to build flexible interfaces, implementing per-object behaviour, extending and modifying pre-existing code, and building classes and modules programmatically
|
||||
* Text Processing and File Management focusing on regular expressions, working with files, the tempfile standard library, and text-processing strategies
|
||||
* Functional Programming Techniques highlighting modular code organisation, memoization, infinite lists, and higher-order procedures
|
||||
* Understand how and why things can go wrong explaining how to work with logger
|
||||
* Reduce Cultural Barriers by leveraging Ruby’s multilingual capabilities
|
||||
* Skillful Project Maintenance
|
||||
|
||||
The book is open source, released under the Creative Commons NC-SA license.
|
||||
|
||||
|
|
||||
|
|
||||
![I Love Ruby](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/03/LoveRuby.png?resize=200%2C282&ssl=1)
|
||||
|
|
||||
|
||||
### [I Love Ruby][2]
|
||||
|
||||
By Karthikeyan A K (246 pages)
|
||||
|
||||
I Love Ruby explains fundamental concepts and techniques in greater depth than traditional introductions. This approach provides a solid foundation for writing useful, correct, maintainable, and efficient Ruby code.
|
||||
|
||||
Chapters cover:
|
||||
|
||||
* Variables
|
||||
* Strings
|
||||
* Comparison and Logic
|
||||
* Loops
|
||||
* Arrays
|
||||
* Hashes and Symbols
|
||||
* Ranges
|
||||
* Functions
|
||||
* Variable Scope
|
||||
* Classes & Objects
|
||||
* Rdoc
|
||||
* Modules and Mixins
|
||||
* Date and Time
|
||||
* Files
|
||||
* Proc, Lambdas and Blocks
|
||||
* Multi Threading
|
||||
* Exception Handling
|
||||
* Regular Expressions
|
||||
* Gems
|
||||
* Meta Programming
|
||||
|
||||
Permission is granted to copy, distribute and/or modify the book under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation.
|
||||
|
||||
|
|
||||
|
|
||||
![Programming Ruby - The Pragmatic Programmer's Guide](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/03/ProgrammingRuby.jpeg?resize=200%2C248&ssl=1)
|
||||
|
|
||||
|
||||
### [Programming Ruby – The Pragmatic Programmer’s Guide][3]
|
||||
|
||||
By David Thomas, Andrew Hunt (HTML)
|
||||
|
||||
Programming Ruby is a tutorial and reference for the Ruby programming language. Use Ruby, and you will write better code, be more productive, and make programming a more enjoyable experience.
|
||||
|
||||
Topics covered include:
|
||||
|
||||
* Classes, Objects and Variables
|
||||
* Containers, Blocks and Iterators
|
||||
* Standard Types
|
||||
* More about Methods
|
||||
* Expressions
|
||||
* Exceptions, Catch and Throw
|
||||
* Modules
|
||||
* Basic Input and Output
|
||||
* Threads and Processes
|
||||
* When Trouble Strikes
|
||||
* Ruby and its World, the Web, Tk, and Microsoft Windows
|
||||
* Extending Ruby
|
||||
* Reflection, ObjectSpace and Distributed Ruby
|
||||
* Standard Library
|
||||
* Object-Oriented Design Libraries
|
||||
* Network and Web Libraries
|
||||
* Embedded Documentation
|
||||
* Interactive Ruby Shell
|
||||
|
||||
The first edition of this book is released under the Open Publication License, v1.0 or later. An updated Second Edition of this book, covering Ruby 1.8 and including descriptions of all the new libraries is available, but is not released under a freely distributable license.
|
||||
|
||||
|
|
||||
|
|
||||
![Why’s (Poignant) Guide to Ruby](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/03/WhysGuideRuby.jpg?resize=200%2C218&ssl=1)
|
||||
|
|
||||
|
||||
### [Why’s (Poignant) Guide to Ruby][4]
|
||||
|
||||
By why the lucky stiff (176 pages)
|
||||
|
||||
Why’s (poignant) Guide to Ruby is an introductory book to the Ruby programming language. The book includes some wacky humour and goes off-topic on occasions. The book includes jokes that are known within the Ruby community as well as cartoon characters.
|
||||
|
||||
The contents of the book:
|
||||
|
||||
* About this book
|
||||
* Kon’nichi wa, Ruby
|
||||
* A Quick (and Hopefully Painless) Ride Through Ruby (with Cartoon Foxes): basic introduction to central Ruby concepts
|
||||
* Floating Little Leaves of Code: evaluation and values, hashes and lists
|
||||
* Them What Make the Rules and Them What Live the Dream: case/when, while/until, variable scope, blocks, methods, class definitions, class attributes, objects, modules, introspection in IRB, dup, self, rbconfig module
|
||||
* Downtown: metaprogramming, regular expressions
|
||||
* When You Wish Upon a Beard: send method, new methods in existing classes
|
||||
* Heaven’s Harp
|
||||
|
||||
This book is made available under the Creative Commons Attribution-ShareAlike License.
|
||||
|
||||
|
|
||||
|
|
||||
![Ruby Hacking Guide](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/03/RubyHackingGuide.png?resize=200%2C250&ssl=1)
|
||||
|
|
||||
|
||||
### [Ruby Hacking Guide][5]
|
||||
|
||||
By Minero Aoki – translated by Vincent Isambart and Clifford Escobar Caoille (HTML)
|
||||
|
||||
This book has the following goals:
|
||||
|
||||
* To have knowledge of the structure of Ruby
|
||||
* To gain knowledge about language processing systems in general
|
||||
* To acquire skills in reading source code
|
||||
|
||||
This book has four main parts:
|
||||
|
||||
* Objects
|
||||
* Syntactic analysis
|
||||
* Evaluation
|
||||
* Peripheral around the evaluator
|
||||
|
||||
Knowledge about the C language and the basics of object-oriented programming is needed to get the most from the book. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike2.5 license.
|
||||
|
||||
The official support site of the original book is [i.loveruby.net/ja/rhg/][10]
|
||||
|
||||
|
|
||||
|
|
||||
![The Book Of Ruby](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/03/BookRuby.jpg?resize=200%2C270&ssl=1)
|
||||
|
|
||||
|
||||
### [The Book Of Ruby][6]
|
||||
|
||||
By How Collingbourne (425 pages)
|
||||
|
||||
The Book Of Ruby is a free in-depth tutorial to Ruby programming.
|
||||
|
||||
The Book Of Ruby is provided in the form of a PDF document in which each chapter is accompanied by ready-to-run source code for all the examples. There is also an Introduction which explains how to use the source code in Ruby In Steel or any other editor/IDE of your choice plus appendices and an index. It concentrates principally on version 1.8.x of the Ruby language.
|
||||
|
||||
The book is divided up into bite-sized chunks. Each chapter introduces a theme which is subdivided into sub-topics. Each programming topic is accompanied by one or more small self-contained, ready-to-run Ruby programs.
|
||||
|
||||
* Strings, Numbers, Classes, and Objects – getting and putting input, strings and embedded evaluation, numbers, testing a condition: if … then, local and global variables, classes and objects, instance variables, messages, methods and polymorphism, constructors, and inspecting objects
|
||||
* Class Hierarchies, Attributes, and Class Variables – superclasses and subclasses, passing arguments to the superclass, accessor methods, ‘set’ accessors, attribute readers and writers, calling methods of a superclass, and class variables
|
||||
* Strings and Ranges – user-defined string delimiters, backquotes, and more
|
||||
* Arrays and Hashes – shows how to create a list of objects
|
||||
* Loops and Iterators – for loops, blocks, while loops, while modifiers, and until loops
|
||||
* Conditional Statements – If..Then..Else, And..Or..Not, If..Elsif, unless, if and unless modifiers, and case statements
|
||||
* Methods – class methods, class variables, what are class methods for, ruby constructors, singleton methods, singleton classes, overriding methods and more
|
||||
* Passing Arguments and Returning Values – instance methods, class methods, singleton methods, returning values, returning multiple values, default and multiple arguments, assignment and parameter passing, and more
|
||||
* Exception Handling – covers rescue, ensure, else, error numbers, retry, and raise
|
||||
* Blocks, Procs, and Lambdas – explains why they are special to Ruby
|
||||
* Symbols – symbols and strings, symbols and variables, and why symbols should be used
|
||||
* Modules and Mixins
|
||||
* Files and IO – opening and closing files, files and directories, copying files, directory enquiries, a discursion into recursion, and sorting by size
|
||||
* YAML – includes nested sequences, saving YAML data and more
|
||||
* Marshal – offers an alternative way of saving and loading data
|
||||
* Regular Expressions – making matches, match groups, and more
|
||||
* Threads – shows you how to run more than one task at a time
|
||||
* Debugging and Testing – covers the interactive ruby shell (IRB.exe), debugging, and unit testing
|
||||
* Ruby on Rails – goes through a hands-on guide to create a blog
|
||||
* Dynamic Programming – self-modifying programs, eval magic, special types of eval, adding variables and methods, and more
|
||||
|
||||
The book is distributed by SapphireSteel Software – developers of the Ruby In Steel IDE for Visual Studio. Readers may copy or distribute the text and programs of The Book Of Ruby (free edition).
|
||||
|
||||
|
|
||||
|
|
||||
![The Little Book of Ruby](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/03/TheLittleBookRuby.png?resize=200%2C259&ssl=1)
|
||||
|
|
||||
|
||||
### [The Little Book Of Ruby][7]
|
||||
|
||||
By Huw Collingbourne (87 pages)
|
||||
|
||||
The Little Book of Ruby is a step-by-step tutorial to programming in Ruby. It guides the reader through the fundamentals of Ruby. It shares content with The Book of Ruby, but aims to be a simpler guide to the main features of Ruby.
|
||||
|
||||
Chapters cover:
|
||||
|
||||
* Strings and Methods – including embedded evaluation. Details the syntax to Ruby methods
|
||||
* Classes and Objects – explains how to create new types of objects
|
||||
* Class Hierarchies – a class which is a ‘special type ’ of some other class simply ‘inherits’ the features of that other class
|
||||
* Accessors, Attributes, Class Variables – accessor methods, attribute readers and writers, attributes create variables, calling methods of a superclass, and class variables are explored
|
||||
* Arrays – learn how to create a list of objects: arrays including multi-dimensional arrays,
|
||||
* Hashes – create, indexing into a hash, and hash operations are covered
|
||||
* Loops and Iterators – for loops, blocks, while loops, while modifiers, and until loops
|
||||
* Conditional Statements – If..Then..Else, And..Or..Not, If..Elsif, unless, if and unless modifiers, and case statements
|
||||
* Modules and Mixins – including module methods, modules as namespaces, module ‘instance methods’, included modules or ‘mixins’, including modules from files, and pre-defined modules
|
||||
* Saving Files, Moving on..
|
||||
|
||||
This book can be copied and distributed freely as long as the text is not modified and the copyright notice is retained.
|
||||
|
||||
|
|
||||
|
|
||||
![Kestrels, Quirky Birds, and Hopeless Egocentricity](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/03/KestrelsQuirkyBirds.jpeg?resize=200%2C259&ssl=1)
|
||||
|
|
||||
|
||||
### [Kestrels, Quirky Birds, and Hopeless Egocentricity][8]
|
||||
|
||||
By Reg “raganwald” Braithwaite (123 pages)
|
||||
|
||||
Kestrels, Quirky Birds, and Hopeless Egocentricity collects Reg “Raganwald” Braithwaite’s series of essays about Combinatory Logic, Method Combinators, and Ruby Meta-Programing into a convenient e-book.
|
||||
|
||||
The book provides a gentle introduction to Combinatory Logic, applied using the Ruby programming language. Combinatory Logic is a mathematical notation that is powerful enough to handle set theory and issues in computability.
|
||||
|
||||
In this book, the reader meets some of the standard combinators, and for each one the book explores some of its ramifications when writing programs using the Ruby programming language. In Combinatory Logic, combinators combine and alter each other, and the book’s Ruby examples focus on combining and altering Ruby code. From simple examples like the K Combinator and Ruby’s .tap method, the books works up to meta-programming with aspects and recursive combinators.
|
||||
|
||||
The book is published under the MIT license.
|
||||
|
||||
|
|
||||
|
|
||||
![Ruby Programming](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/03/RubyProgrammingWikibooks.png?resize=200%2C285&ssl=1)
|
||||
|
|
||||
|
||||
### [Ruby Programming][9]
|
||||
|
||||
By Wikibooks.org (261 pages)
|
||||
|
||||
Ruby is an interpreted, object-oriented programming language.
|
||||
|
||||
The book is broken down into several sections and is intended to be read sequentially.
|
||||
|
||||
* Getting started – shows users how to install and begin using Ruby in an environment
|
||||
* Basic Ruby – explains the main features of the syntax of Ruby. It covers, amongst other things, strings, encoding, writing methods, classes and objects, and exceptions
|
||||
* Ruby Semantic reference
|
||||
* Built in classes
|
||||
* Available modules covers some of the standard library
|
||||
* Intermediate Ruby covers a selection of slightly more advanced topics
|
||||
|
||||
This book is published under the Creative Commons Attribution-ShareAlike 3.0 Unported license.
|
||||
|
||||
|
|
||||
|
||||
* * *
|
||||
|
||||
In no particular order, I’ll close with useful free-to-download Ruby programming books which are not released under an open source license.
|
||||
|
||||
* [Mr. Neighborly’s Humble Little Ruby Book][11] – an easy to read, easy to follow guide to all things Ruby.
|
||||
* [Introduction to Programming with Ruby][12] – learn the basic foundational building blocks of programming, starting from the very beginning
|
||||
* [Object Oriented Programming with Ruby][13] – learn the basic foundational building blocks of object oriented programming, starting from the very beginning
|
||||
* [Core Ruby Tools][14] – provides a short tour of four core Ruby tools: Gems, Ruby Version Managers, Bundler, and Rake.
|
||||
* [Learn Ruby the Hard Way, 3rd Edition][15] – a simple book designed to start your programming adventures
|
||||
* [Learn to Program][16] – by Chris Pine
|
||||
* [Ruby Essentials][17] – designed to provide a concise and easy to follow guide to learning Ruby.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ossblog.org/study-ruby-programming-with-open-source-books/
|
||||
|
||||
作者:[Steve Emms ][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ossblog.org/author/steve/
|
||||
[1]:https://github.com/practicingruby/rbp-book/tree/gh-pages/pdfs
|
||||
[2]:https://mindaslab.github.io/I-Love-Ruby/
|
||||
[3]:http://ruby-doc.com/docs/ProgrammingRuby/
|
||||
[4]:http://poignant.guide/
|
||||
[5]:http://ruby-hacking-guide.github.io/
|
||||
[6]:http://www.sapphiresteel.com/ruby-programming/The-Book-Of-Ruby.html
|
||||
[7]:http://www.sapphiresteel.com/ruby-programming/The-Book-Of-Ruby.html
|
||||
[8]:https://leanpub.com/combinators
|
||||
[9]:https://en.wikibooks.org/wiki/Ruby_Programming
|
||||
[10]:http://i.loveruby.net/ja/rhg/
|
||||
[11]:http://www.humblelittlerubybook.com/
|
||||
[12]:https://launchschool.com/books/ruby
|
||||
[13]:https://launchschool.com/books/oo_ruby
|
||||
[14]:https://launchschool.com/books/core_ruby_tools
|
||||
[15]:https://learnrubythehardway.org/book/
|
||||
[16]:https://pine.fm/LearnToProgram
|
||||
[17]:http://www.techotopia.com/index.php/Ruby_Essentials
|
||||
[18]:https://www.ossblog.org/opensourcebooks/
|
@ -0,0 +1,74 @@
|
||||
印度社区如何支持隐私和软件自由
|
||||
============================================================
|
||||
|
||||
![How communities in India support privacy and software freedom](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/people_remote_teams_world.png?itok=wI-GW8zX "How communities in India support privacy and software freedom")
|
||||
图片提供: opensource.com
|
||||
|
||||
印度的自由和开源社区,特别是 Mozilla 和 Wikimedia 社区,它们正在引领两个独特的全球性活动,以提高隐私及支持自由软件。
|
||||
|
||||
[1 月份的隐私月][3]是由印度 Mozilla 社区领导,通过在线和线下活动向群众教育网络隐私。而[ 2 月份的自由月][4]是由[互联网与社会中心][5]领导,教育内容创作者如博主和摄影师就如何在[开放许可证][6]下捐赠内容。
|
||||
|
||||
### 1 月隐私月
|
||||
|
||||
从[去年开始][7]的 Mozilla “1 月隐私月”用来帮助庆祝年度[数据隐私日][8]。在 2016 年,该活动举办了几场涉及[全球 10 个国家 14,339,443 人][9]的线下和线上活动。其中一个核心组织者,[Ankit Gadgil][10]这样说到:“每天分享一个隐私提示,持续一个月 31 天是有可能的。今年,我们共有三个重点领域,首先是我们让这个运动更加开放和全球化。巴西、意大利、捷克共和国的 Mozilla 社区今年正在积极参与,所有的必要文件都是本地化的,所以我们可以针对更多的用户。其次,我们在线下活动中教导用户营销 Firefox 以及 Mozilla 的其他产品,以便用户可以亲身体验使用这些工具来帮助保护他们的隐私。第三点,我们鼓励大家参加线下活动并记录他们的学习,例如,最近在印度古吉拉特邦的一个节目中,他们使用 Mozilla 产品来教授隐私。”
|
||||
|
||||
今年的活动继续有线下和线上活动。关注 #PrivacyAware 参加。
|
||||
|
||||
### 安全提示
|
||||
|
||||
像 Firefox 这样的 Mozilla 产品具有安全性设置-同时还有[内建][11]还有附加的对残疾人完全[可用][12]的库-这有助于保护用户的隐私和安全性,这些都是协同构建的并且是开源的。
|
||||
|
||||
[Chrome][14] 和[ Opera][15] 中的 [HTTPS Everywhere][13] 可用于加密用户通信,使外部网站无法查看用户信息。该项目由 [Tor Project][16]以及[电子前沿基金会][17]合作建成。
|
||||
|
||||
### 2 月自由月
|
||||
|
||||
[2 月自由月][18]是一个网络活动,旨在教育内容创作者关于[自由内容][19],并向他们展示如何在自由许可证下作出贡献。
|
||||
|
||||
** 参加规则:**
|
||||
|
||||
* 你在二月份制作或出版的作品必须获得[自由许可证][1]许可。
|
||||
* 内容类型包括博客帖子、其他文字和图像。
|
||||
|
||||
多媒体,基于文本的内容,艺术和设计等创意作品可以通过多个[知识共享许可证][20](CC)进行许可,其他类型的文档可以根据[ GNU 免费文档许可][21](GFDL)许可。Wikipedia 上可以找到很好的例子,其内容根据 CC 和 GFDL 许可证获得许可,允许人们使用、分享、混合和分发衍生用于商业上和非商业性的作品。此外,还有允许开发人员共享他们的软件和软件相关文档的[自由软件许可证][22]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Subhashish Panigrahi - Subhashish Panigrahi(@shhapa)是 Mozilla 参与团队的亚洲社区催化师,并从 Wikimedia 基金会印度计划的早期扮演了互联网及社会知识获取中心项目官的角色,另外他是一名印度教育者,
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/17/1/how-communities-india-support-privacy-software-freedom
|
||||
|
||||
作者:[Subhashish Panigrahi][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/psubhashish
|
||||
[1]:https://en.wikipedia.org/wiki/Free_license#Classification_and_licenses
|
||||
[2]:https://opensource.com/article/17/1/how-communities-india-support-privacy-software-freedom?rate=WhGQOnXdk0m1Yq63nNe0wTVBP-75ALKLlrssFW2lCLk
|
||||
[3]:https://wiki.mozilla.org/India/task_force/Policy_and_Advocacy/January_Privacy_Month_Campaign
|
||||
[4]:http://www.freedominfeb.org/
|
||||
[5]:http://cis-india.org/
|
||||
[6]:https://opensource.com/education/16/8/3-copyright-tips-students-and-educators
|
||||
[7]:https://reps.mozilla.org/e/privacy-month-campaign/
|
||||
[8]:https://en.wikipedia.org/wiki/Data_Privacy_Day
|
||||
[9]:http://blog.mozillaindia.org/1611
|
||||
[10]:https://reps.mozilla.org/u/ankitgadgil
|
||||
[11]:https://support.mozilla.org/en-US/products/firefox/protect-your-privacy
|
||||
[12]:https://support.mozilla.org/en-US/kb/advanced-panel-settings-in-firefox
|
||||
[13]:https://www.eff.org/files/https-everywhere-latest.xpi
|
||||
[14]:https://chrome.google.com/webstore/detail/gcbommkclmclpchllfjekcdonpmejbdp
|
||||
[15]:https://addons.opera.com/extensions/details/https-everywhere/
|
||||
[16]:https://www.torproject.org/
|
||||
[17]:https://eff.org/
|
||||
[18]:http://www.freedominfeb.org/
|
||||
[19]:https://en.wikipedia.org/wiki/Free_content
|
||||
[20]:https://creativecommons.org/licenses/
|
||||
[21]:https://en.wikipedia.org/wiki/GNU_Free_Documentation_License
|
||||
[22]:https://www.gnu.org/licenses/license-list.en.html#GPLCompatibleLicenses
|
||||
[23]:https://opensource.com/user/21177/feed
|
||||
[24]:https://opensource.com/users/psubhashish
|
@ -0,0 +1,212 @@
|
||||
wkhtmltopdf - 一个 Linux 中将网页转成 PDF 的智能工具
|
||||
============================================================
|
||||
|
||||
**wkhtmltopdf**是一个开源、简单而有效的命令行 shell 程序,它可以将任何 **HTML** (**网页**)转换为 **PDF** 文档或图像(**jpg**、**png** 等)。
|
||||
|
||||
wkhtmltopdf 是用 **C++** 编写的,并在 **GNU/GPL** (**通用公共许可证**)下发布。它使用 **WebKit** 渲染引擎将 **HTML** 页面转换为 **PDF** 文档且不会丢失页面的质量。这是一个用于实时创建和存储网页快照的非常有用且可信赖的解决方案。
|
||||
|
||||
### wkhtmltopdf 的功能
|
||||
|
||||
1. 开源并且跨平台。
|
||||
2. 使用 **WebKit** 引擎将任意 **HTML** 网页转换为 **PDF** 文件。
|
||||
3. 添加页眉和页脚的选项
|
||||
4. 目录生成 (**TOC**) 选项。
|
||||
5. 提供批量模式转换。
|
||||
6. 通过绑定 libwkhtmltox 来支持 **PHP** 或 **Python**。
|
||||
|
||||
在本文中,我们将介绍如何在 Linux 系统下使用 tar 包来安装 **wkhtmltopdf**。
|
||||
|
||||
### 安装 Evince (PDF 浏览器)
|
||||
|
||||
让我们在 Linux 系统中安装 **evince** (一个 **PDF** 阅读器)来浏览 **PDF** 文件。
|
||||
|
||||
```
|
||||
$ sudo yum install evince [RHEL/CentOS and Fedora]
|
||||
$ sudo dnf install evince [On Fedora 22+ versions]
|
||||
$ sudo apt-get install evince [On Debian/Ubuntu systems]
|
||||
```
|
||||
|
||||
### 下载 wkhtmltopdf 源码文件
|
||||
|
||||
使用[ wget 命令][1]根据你的 **Linux** 架构来下载 **wkhtmltopdf** 源码文件,或者你也可以在[wkhtmltopdf 下载页][2]下载最新的版本(目前最新的稳定版是 **0.12.4**)
|
||||
|
||||
##### 在 64 位 Linux 系统中
|
||||
|
||||
```
|
||||
$ wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
|
||||
```
|
||||
|
||||
##### 在 32 位 Linux 系统中
|
||||
|
||||
```
|
||||
$ wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-i386.tar.xz
|
||||
```
|
||||
|
||||
### 在 Linux 中安装 wkhtmltopdf
|
||||
|
||||
使用[ tar 命令][3]解压文件到当前目录中。
|
||||
|
||||
```
|
||||
------ On 64-bit Linux OS ------
|
||||
$ sudo tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
|
||||
------ On 32-bit Linux OS ------
|
||||
$ sudo tar -xvzf wkhtmltox-0.12.4_linux-generic-i386.tar.xz
|
||||
```
|
||||
|
||||
为了能从任意路径执行程序,将 **wkhtmltopdf** 安装到 **/usr/bin** 目录下。
|
||||
|
||||
```
|
||||
$ sudo cp wkhtmltox/bin/wkhtmltopdf /usr/bin/
|
||||
```
|
||||
|
||||
### 如何使用 wkhtmltopdf?
|
||||
|
||||
我们会看到如何将远程的 **HTML** 页面转换成 **PDF** 文件、验证信息、使用 **evince** 在 **GNOME** 桌面中浏览创建的文件。
|
||||
|
||||
### 将 HTML 网页转成 PDF 文件
|
||||
|
||||
要将任意 **HTML** 页面转换成 **PDF**,运行下面的命令。它会在当前目录下将页面转换成 [10-Sudo-Configurations.pdf][4]。
|
||||
|
||||
```
|
||||
# wkhtmltopdf http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### 示例输出:
|
||||
|
||||
```
|
||||
Loading pages (1/6)
|
||||
Counting pages (2/6)
|
||||
Resolving links (4/6)
|
||||
Loading headers and footers (5/6)
|
||||
Printing pages (6/6)
|
||||
Done
|
||||
```
|
||||
|
||||
#### 浏览生成的 PDF 文件
|
||||
|
||||
为了验证创建的文件,使用下面的命令。
|
||||
|
||||
```
|
||||
$ file 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### 示例输出:
|
||||
|
||||
```
|
||||
10-Sudo-Configurations.pdf: PDF document, version 1.4
|
||||
```
|
||||
|
||||
#### 浏览生成的 PDF 文件细腻
|
||||
|
||||
要浏览生成的文件信息,运行下面的命令。
|
||||
|
||||
```
|
||||
$ pdfinfo 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### 示例输出
|
||||
|
||||
```
|
||||
Title: 10 Useful Sudoers Configurations for Setting 'sudo' in Linux
|
||||
Creator: wkhtmltopdf 0.12.4
|
||||
Producer: Qt 4.8.7
|
||||
CreationDate: Sat Jan 28 13:02:58 2017
|
||||
Tagged: no
|
||||
UserProperties: no
|
||||
Suspects: no
|
||||
Form: none
|
||||
JavaScript: no
|
||||
Pages: 13
|
||||
Encrypted: no
|
||||
Page size: 595 x 842 pts (A4)
|
||||
Page rot: 0
|
||||
File size: 697827 bytes
|
||||
Optimized: no
|
||||
PDF version: 1.4
|
||||
```
|
||||
|
||||
#### 浏览创建的文件
|
||||
|
||||
在桌面中使用 **evince** 看一眼最新生成的 **PDF** 文件。
|
||||
|
||||
```
|
||||
$ evince 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### 示例截图:
|
||||
|
||||
在我的 Linux Mint 17 中看起来很棒。
|
||||
|
||||
[
|
||||
![View Website Page in PDF](http://www.tecmint.com/wp-content/uploads/2012/10/View-Website-Page-in-PDF.png)
|
||||
][5]
|
||||
|
||||
在 PDF 中浏览网页
|
||||
|
||||
### 将页面的 TOC (Table Of Content 即目录)创建为 PDF
|
||||
|
||||
要创建一个 **PDF** 文件的目录,使用 **toc** 选项。
|
||||
|
||||
```
|
||||
$ wkhtmltopdf toc http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### 示例输出:
|
||||
|
||||
```
|
||||
Loading pages (1/6)
|
||||
Counting pages (2/6)
|
||||
Loading TOC (3/6)
|
||||
Resolving links (4/6)
|
||||
Loading headers and footers (5/6)
|
||||
Printing pages (6/6)
|
||||
Done
|
||||
```
|
||||
|
||||
要检查已创建文件的 **TOC**,再次使用 evince。
|
||||
|
||||
```
|
||||
$ evince 10-Sudo-Configurations.pdf
|
||||
```
|
||||
|
||||
##### 示例截图:
|
||||
|
||||
看一下下面的图。它上看去比上面的更好。
|
||||
|
||||
[
|
||||
![Create Website Page to Table of Contents in PDF](http://www.tecmint.com/wp-content/uploads/2012/10/Create-Website-Page-Table-of-Contents-in-PDF.png)
|
||||
][6]
|
||||
|
||||
在 PDF 中创建网页的目录
|
||||
|
||||
#### wkhtmltopdf 选项及使用
|
||||
|
||||
更多关于 **wkhtmltopdf** 的使用及选项,使用下面的帮助命令。它会显示出所有可用的选项。
|
||||
|
||||
```
|
||||
$ wkhtmltopdf --help
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
我是 Ravi Saive,TecMint 的创建者。一个爱在网上分享的技巧和提示的电脑极客和 Linux 专家。我的大多数服务器运行在名为 Linux 的开源平台上。请在 Twitter、 Facebook 和 Google+ 等上关注我。
|
||||
|
||||
--------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/wkhtmltopdf-convert-website-html-page-to-pdf-linux/
|
||||
|
||||
作者:[Ravi Saive][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/admin/
|
||||
[1]:http://www.tecmint.com/10-wget-command-examples-in-linux/
|
||||
[2]:http://wkhtmltopdf.org/downloads.html
|
||||
[3]:http://www.tecmint.com/18-tar-command-examples-in-linux/
|
||||
[4]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/
|
||||
[5]:http://www.tecmint.com/wp-content/uploads/2012/10/View-Website-Page-in-PDF.png
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2012/10/Create-Website-Page-Table-of-Contents-in-PDF.png
|
@ -1,32 +1,31 @@
|
||||
在 RHEL CentOS & Fedora 安装 Drupal 8
|
||||
在 RHEL,CentOS 及 Fedora 上安装 Drupal 8
|
||||
============================================================
|
||||
|
||||
Drupal 是一个 开源,灵活,高度可拓展和安全的内容管理系统(CMS),使用户轻松的创建一个网站。
|
||||
它可以使用模块拓展使用户转换内容管理为强大的数字解决方案
|
||||
**Drupal** 是一个开源,灵活,高度可拓展和安全的<ruby>内容管理系统<rt>Content Management System</rt></ruby>(CMS),使用户轻松的创建网站。
|
||||
它可以使用模块拓展,使用户将内容管理转换为强大的数字解决方案。
|
||||
|
||||
**Drupal** 运行在诸如 **Apache,IIS,Lighttpd,Cherokee,Nginx** 的 Web 服务器上,后端数据库可以使用 **Mysql,MongoDB,MariaDB,PostgreSQL,MSSQL Server**。
|
||||
|
||||
Drupal 运行在 Web 服务器上, 像 Apache, IIS, Lighttpd, Cherokee, Nginx,
|
||||
后端数据库可以使用 Mysql, MongoDB, MariaDB, PostgreSQL, MSSQL Server
|
||||
|
||||
在这个文章, 我们会展示在 RHEL 7/6 CentOS 7/6 和Fedora 20-25 发行版本使用 LAMP 步骤 如何执行手动安装和配置 Drupal 8
|
||||
在这篇文章中, 我们会展示在 RHEL 7/6,CentOS 7/6 和 Fedora 20-25 发行版本使用 LAMP,如何手动安装和配置 Drupal 8。
|
||||
|
||||
#### Drupal 需求:
|
||||
1. Apache 2.x(推荐)
|
||||
2. PHP 5.5.9 或 更高 (推荐PHP 5.5)
|
||||
3. MYSQL 5.5.3 或 MariaDB 5.5.20 与 PHP 数据对象(PDO)
|
||||
|
||||
1. **Apache 2.x** (推荐)
|
||||
2. **PHP 5.5.9** 或 更高 (推荐 PHP 5.5)
|
||||
3. **MYSQL 5.5.3** 或 **MariaDB 5.5.20** 与 PHP 数据对象(PDO)
|
||||
|
||||
这个步骤,我是使用 `drupal.tecmint.com` 作为网站主机名 和 IP 地址 `192.168.0.104`.
|
||||
这些设置也许在你的环境不同,因此请适当做出更改
|
||||
安装过程中,我使用 `drupal.tecmint.com` 作为网站主机名,IP 地址为 `192.168.0.104`。你的环境也许与这些设置不同,因此请适当做出更改。
|
||||
|
||||
### 第一步: 安装 Apache Web 服务器
|
||||
1. 首先我们从官方仓库开始安装 Apache Web 服务器
|
||||
### 步骤 1: 安装 Apache Web 服务器
|
||||
|
||||
1. 首先我们从官方仓库开始安装 Apache Web 服务器。
|
||||
|
||||
```
|
||||
# yum install httpd
|
||||
```
|
||||
|
||||
2. 安装完成后,服务将会被被禁用,因此我们需要手动启动它,同时让它从下次系统启动时自动启动像这样:
|
||||
2. 安装完成后,服务将会被被禁用,因此我们需要手动启动它,同时让它下次系统启动时自动启动,如下:
|
||||
|
||||
```
|
||||
------------- 通过 SystemD - CentOS/RHEL 7 和 Fedora 22+ -------------------
|
||||
# systemctl start httpd
|
||||
@ -37,7 +36,7 @@ Drupal 运行在 Web 服务器上, 像 Apache, IIS, Lighttpd, Cherokee, Nginx
|
||||
# chkconfig --level 35 httpd on
|
||||
```
|
||||
|
||||
3. 接下来,为了通过 HTTP 和 HTTPS 访问 Apache 服务,我们必须打开 HTTPD 守护进程正在监听的80和443端口,如下所示:
|
||||
3. 接下来,为了允许通过 **HTTP** 和 **HTTPS** 访问 Apache 服务,我们必须打开 **HTTPD** 守护进程正在监听的 **80** 和 **443** 端口,如下所示:
|
||||
|
||||
```
|
||||
------------ 通过 Firewalld - CentOS/RHEL 7 and Fedora 22+ -------------
|
||||
@ -52,22 +51,24 @@ Drupal 运行在 Web 服务器上, 像 Apache, IIS, Lighttpd, Cherokee, Nginx
|
||||
# service iptables restart
|
||||
```
|
||||
|
||||
4. 现在验证 Apache 是否正常工作, 打开浏览器在 URL:http://server_IP` 输入你的服务器 IP 地址使用 HTTP 协议 ` , 默认 Apache 页面外观应该如下面截图所示:
|
||||
4. 现在验证 Apache 是否正常工作, 打开浏览器在地址栏中输入 http://server_IP, 输入你的服务器 IP 地址, 默认 Apache2 页面应出现,如下面截图所示:
|
||||
|
||||
[
|
||||
![Apache 默认页面](https://dn-coding-net-production-pp.qbox.me/a93436ad-59ee-404d-9a28-ebde4446cd6d.png)
|
||||
][1]
|
||||
|
||||
Apache 默认页面
|
||||
*Apache 默认页面*
|
||||
|
||||
### 第二部: 安装 Apache PHP 支持
|
||||
### 步骤 2: 安装 Apache PHP 支持
|
||||
|
||||
5. 接下来 安装 PHP 和 PHP 所需模块.
|
||||
5. 接下来,安装 PHP 和 PHP 所需模块.
|
||||
|
||||
```
|
||||
# yum install php php-mbstring php-gd php-xml php-pear php-fpm php-mysql php-pdo php-opcache
|
||||
```
|
||||
>重要: 假如你想要安装 PHP7., 你需要增加以下仓库:EPEL 和 Webtactic 才可以使用 yum 安装 PHP7.0:
|
||||
|
||||
**重要**: 假如你想要安装 **PHP7**, 你需要增加以下仓库:**EPEL** 和 **Webtactic** 才可以使用 yum 安装 PHP7.0:
|
||||
|
||||
```
|
||||
------------- Install PHP 7 in CentOS/RHEL and Fedora -------------
|
||||
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||
@ -75,29 +76,32 @@ Apache 默认页面
|
||||
# yum install php70w php70w-opcache php70w-mbstring php70w-gd php70w-xml php70w-pear php70w-fpm php70w-mysql php70w-pdo
|
||||
```
|
||||
|
||||
6. 接下来 从浏览器得到关于 PHP 安装和配置完整信息,使用下面命令在 Apache 根文档创建一个 `info.php` 文件
|
||||
6. 接下来,要从浏览器得到关于 PHP 安装和配置完整信息,使用下面命令在 Apache 文档根目录 (/var/www/html) 创建一个 `info.php` 文件。
|
||||
|
||||
```
|
||||
# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
|
||||
```
|
||||
|
||||
然后重启 HTTPD 服务器 ,在浏览器输入 URL `http://server_IP/info.php`
|
||||
然后重启 HTTPD 服务器 ,在浏览器地址栏输入 `http://server_IP/info.php`。
|
||||
|
||||
```
|
||||
# systemctl restart httpd
|
||||
OR
|
||||
或
|
||||
# service httpd restart
|
||||
```
|
||||
|
||||
[
|
||||
![验证 PHP 信息](https://dn-coding-net-production-pp.qbox.me/7dcdb202-ba2e-4b1c-b304-215c5721db03.png)
|
||||
][2]
|
||||
|
||||
验证 PHP 信息
|
||||
*验证 PHP 信息*
|
||||
|
||||
### 步骤 3: 安装和配置 MariaDB 数据库
|
||||
|
||||
7. 对于你的信息, Red Hat Enterprise Linux/CentOS 7.0 从支持 MYSQL 转移到 MariaDB 作为默认数据库管理系统支持
|
||||
7. 请了解, **Red Hat Enterprise Linux/CentOS 7.0** 从支持 **MYSQL** 转为了 **MariaDB** 作为默认数据库管理系统。
|
||||
|
||||
要安装 **MariaDB** 数据库, 你需要添加 [官方 MariaDB 库][3] 到 `/etc/yum.repos.d/MariaDB.repo` 中,如下所示。
|
||||
|
||||
安装 MariaDB 你需要添加以下内容,[official MariaDB repository][3] 到 `/etc/yum.repos.d/MariaDB.repo` 如下所示
|
||||
```
|
||||
[mariadb]
|
||||
name = MariaDB
|
||||
@ -106,13 +110,14 @@ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
|
||||
gpgcheck=1
|
||||
```
|
||||
|
||||
当仓库文件就位你可以像这样安装 MariaDB :
|
||||
当仓库文件准备好后,你可以像这样安装 MariaDB :
|
||||
|
||||
```
|
||||
# yum install mariadb-server mariadb
|
||||
```
|
||||
|
||||
8. 当 MariaDB 数据库安装完成,同时启动数据库的守护进程使它能够在下次启动后自动启动
|
||||
8. 当 MariaDB 数据库安装完成,启动数据库的守护进程,同时使它能够在下次启动后自动启动。
|
||||
|
||||
```
|
||||
------------- 通过 SystemD - CentOS/RHEL 7 and Fedora 22+ -------------
|
||||
# systemctl start mariadb
|
||||
@ -122,7 +127,7 @@ gpgcheck=1
|
||||
# chkconfig --level 35 mysqld on
|
||||
```
|
||||
|
||||
9. 然后运行 `mysql_secure_installation` 脚本去保护数据库(设置 root 密码, 禁用远程登录,移除测试数据库,和移除匿名用户),如下所示:
|
||||
9. 然后运行 `mysql_secure_installation` 脚本去保护数据库(设置 root 密码, 禁用远程登录,移除测试数据库并移除匿名用户),如下所示:
|
||||
|
||||
```
|
||||
# mysql_secure_installation
|
||||
@ -131,25 +136,25 @@ gpgcheck=1
|
||||
![Mysql安全安装](https://dn-coding-net-production-pp.qbox.me/15a20560-ea9f-499b-b155-a310e9aa6a88.png)
|
||||
][4]
|
||||
|
||||
Mysql 安全安装
|
||||
*Mysql 安全安装*
|
||||
|
||||
### 第四步: 在 CentOS 安装和配置 Drupal 8
|
||||
### 步骤 4: 在 CentOS 中安装和配置 Drupal 8
|
||||
|
||||
10. 这里我们使用 [wget 命令][6] [下载最新版本 Drupal][5](i.e 8.2.6),如果你没有安装 wget 和 gzil 包 ,请使用下面命令安装它们:
|
||||
10. 这里我们使用 [wget 命令][6] [下载最新版本 Drupal][5](例如 8.2.6),如果你没有安装 wget 和 gzip 包 ,请使用下面命令安装它们:
|
||||
|
||||
```
|
||||
# yum install wget gzip
|
||||
# wget -c https://ftp.drupal.org/files/projects/drupal-8.2.6.tar.gz
|
||||
```
|
||||
|
||||
11. 之后,[导出压缩文件][7] 和移动 Drupal 目录到 Apache 根目录(`/var/www/html`).
|
||||
11. 之后,[解压 tar 文件][7] 并移动 Drupal 目录到 Apache 文档根目录(`/var/www/html`).
|
||||
|
||||
```
|
||||
# tar -zxvf drupal-8.2.6.tar.gz
|
||||
# mv drupal-8.2.6 /var/www/html/drupal
|
||||
```
|
||||
|
||||
12. 然后从示例设置文件(`/var/www/html/drupal/sites/default`) 目录创建设置文件 `settings.php` , 然后给 Drupal 站点目录设置适当权限,包括子目录和文件,如下所示:
|
||||
12. 然后,依据 `/var/www/html/drupal/sites/default` 目录下的示例设置文件 default.settings.php,创建设置文件 `settings.php`,然后给 Drupal 站点目录设置适当权限,包括子目录和文件,如下所示:
|
||||
|
||||
```
|
||||
# cd /var/www/html/drupal/sites/default/
|
||||
@ -157,142 +162,138 @@ Mysql 安全安装
|
||||
# chown -R apache:apache /var/www/html/drupal/
|
||||
```
|
||||
|
||||
13. 更重要的是在 `/var/www/html/drupal/sites/` 目录设置 SElinux 规则,如下:
|
||||
13. 更重要的是在 `/var/www/html/drupal/sites/` 目录设置 **SElinux** 规则,如下:
|
||||
|
||||
```
|
||||
# chcon -R -t httpd_sys_content_rw_t /var/www/html/drupal/sites/
|
||||
```
|
||||
|
||||
```
|
||||
14. 现在我们必须为 Drupal 站点去创建一个数据库和用户来管理
|
||||
14. 现在我们必须为 Drupal 站点去创建一个数据库和用户来管理。
|
||||
|
||||
```
|
||||
# mysql -u root -p
|
||||
输入数据库密码:
|
||||
```
|
||||
Enter password:
|
||||
MySQL Shell
|
||||
```
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MySQL connection id is 12
|
||||
Server version: 5.1.73 Source distribution
|
||||
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
MySQL [(none)]> create database drupal;
|
||||
**MySQL [(none)]> create database drupal;**
|
||||
Query OK, 1 row affected (0.00 sec)
|
||||
MySQL [(none)]> create user ravi@localhost identified by 'tecmint123';
|
||||
**MySQL [(none)]> create user ravi@localhost identified by 'tecmint123';**
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
MySQL [(none)]> grant all on drupal.* to ravi@localhost;
|
||||
**MySQL [(none)]> grant all on drupal.* to ravi@localhost;**
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
MySQL [(none)]> flush privileges;
|
||||
**MySQL [(none)]> flush privileges;**
|
||||
Query OK, 0 rows affected (0.00 sec)
|
||||
MySQL [(none)]> exit
|
||||
**MySQL [(none)]> exit**
|
||||
Bye
|
||||
```
|
||||
|
||||
15. 最后,在这一点,打开URL: `http://server_IP/drupal/` 开始网站的安装,选择你首选的安装语言然后点击保存以继续
|
||||
15. 最后,打开地址: `http://server_IP/drupal/` 开始网站的安装,选择你首选的安装语言然后点击保存以继续。
|
||||
|
||||
[
|
||||
!Drupal 安装语言](http://www.tecmint.com/wp-content/uploads/2013/07/Drupal-Installation-Language.png)
|
||||
![Drupal 安装语言](http://www.tecmint.com/wp-content/uploads/2013/07/Drupal-Installation-Language.png)
|
||||
][8]
|
||||
|
||||
Drupal 安装语言
|
||||
*Drupal 安装语言*
|
||||
|
||||
|
||||
16. 下一步,选择安装配置文件,选择 Standard(标准) 点击保存继续
|
||||
16. 下一步,选择安装配置文件,选择 Standard(标准),点击保存继续。
|
||||
|
||||
[
|
||||
![Drupal 安装配置文件](http://www.tecmint.com/wp-content/uploads/2013/07/Drupal-Installation-Profile.png)
|
||||
][9]
|
||||
|
||||
Drupal 安装配置文件
|
||||
*Drupal 安装配置文件*
|
||||
|
||||
17. 在进行下一步之前查看并通过需求审查并启用 `Clean URL`
|
||||
17. 在进行下一步之前查看并通过需求审查并启用 `Clean URL`。
|
||||
|
||||
[
|
||||
![验证 Drupal 需求](http://www.tecmint.com/wp-content/uploads/2013/07/Verify-Drupal-Requirements.png)
|
||||
][10]
|
||||
|
||||
验证 Drupal 需求
|
||||
*验证 Drupal 需求*
|
||||
|
||||
现在在你的 Apache 配置下启用 Clean URL Drupal。
|
||||
|
||||
现在在你的 Apache 配置下启用 `Clean URL` Drupal
|
||||
```
|
||||
# vi /etc/httpd/conf/httpd.conf
|
||||
```
|
||||
|
||||
确保设置 `AllowOverride All` 为默认根文档目录如下图所示
|
||||
确保为默认根文档目录 **/var/www/html** 设置 **AllowOverride All**,如下图所示:
|
||||
|
||||
[
|
||||
![在 Drupal 中启用 Clean URL](http://www.tecmint.com/wp-content/uploads/2013/07/Enable-Clean-URL-in-Drupal.png)
|
||||
][11]
|
||||
|
||||
在 Drupal 中启用 Clean URL
|
||||
*在 Drupal 中启用 Clean URL*
|
||||
|
||||
18. 当你为 Drupal 启用 `Clean URL` ,刷新页面从下面界面执行数据库配置,输入 Drupal 站点数据库名,数据库用户和数据库密码.
|
||||
18. 当你为 Drupal 启用 `Clean URL`,刷新页面从下面界面执行数据库配置,输入 Drupal 站点数据库名,数据库用户和数据库密码。
|
||||
|
||||
当填写完所有信息点击保存继续
|
||||
当填写完所有信息点击**保存并继续**。
|
||||
|
||||
[
|
||||
![Drupal 数据库配置](http://www.tecmint.com/wp-content/uploads/2013/07/Drupal-Database-Configuration.png)
|
||||
][12]
|
||||
|
||||
Drupal 数据库配置
|
||||
*Drupal 数据库配置*
|
||||
|
||||
若上述设置正确,Drupal 站点安装应该完成了如下图界面.
|
||||
若上述设置正确,Drupal 站点安装应该完成了,如下图界面。
|
||||
|
||||
[
|
||||
![Drupal 安装](http://www.tecmint.com/wp-content/uploads/2013/07/Drupal-Installation.png)
|
||||
][13]
|
||||
|
||||
Drupal 安装
|
||||
*Drupal 安装*
|
||||
|
||||
19. 接下来配置站点为下面设置值(使用适用你的方案的值):
|
||||
19. 接下来配置站点为下面的设置(使用适用你的情况的值):
|
||||
|
||||
1. 站点名称 – TecMint Drupal Site
|
||||
2. 站点邮箱地址 – admin@tecmint.com
|
||||
3. 用户名 – admin
|
||||
4. 密码 – ##########
|
||||
5. 用户的邮箱地址 – admin@tecmint.com
|
||||
6. 默认国家 – India
|
||||
7. 默认时区 – UTC
|
||||
- **站点名称** – TecMint Drupal Site
|
||||
- **站点邮箱地址** – admin@tecmint.com
|
||||
- **用户名** – admin
|
||||
- **密码** – ##########
|
||||
- **用户的邮箱地址** – admin@tecmint.com
|
||||
- **默认国家** – India
|
||||
- **默认时区** – UTC
|
||||
|
||||
这是适当的值后,点击保存继续去完成站点安装过程!
|
||||
设置适当的值后,点击**保存并继续**完成站点安装过程。
|
||||
|
||||
[
|
||||
![Drupal 站点配置](http://www.tecmint.com/wp-content/uploads/2013/07/Drupal-Site-Configuration.png)
|
||||
][14]
|
||||
|
||||
Drupal 站点配置
|
||||
*Drupal 站点配置*
|
||||
|
||||
20. 下图是显示的是通过 LAMP 成功安装 Drupal 8 站点
|
||||
20. 下图显示的是通过 LAMP 成功安装的 Drupal 8 站点。
|
||||
|
||||
[
|
||||
![Drupal站点面板](http://www.tecmint.com/wp-content/uploads/2013/07/Drupal-Site-Dashboard.png)
|
||||
][15]
|
||||
|
||||
Drupal 站点面板
|
||||
*Drupal 站点面板*
|
||||
|
||||
现在你可以点击增加内容如创建示例网页内容作为一个页面
|
||||
现在你可以点击**增加内容**,创建示例网页内容。
|
||||
|
||||
选项: 有些人使用[MYSQL 命令行管理数据库][16]不舒服,可以从浏览器界面 [安装 PHPMYAdmin 管理数据库][17]
|
||||
选项: 有些人[使用 MYSQL 命令行管理数据库][16]不舒服,可以从浏览器界面 [安装 PHPMYAdmin 管理数据库][17]
|
||||
|
||||
浏览 Drupal 文档 : [https://www.drupal.org/docs/8][18]
|
||||
|
||||
就这样! 在这个文章, 我们展示了在 CentOS 7 上如何去下载,安装和 LAMP 向导以及基本的配置 Drupal 8。 从下面反馈给我们回信就这个教程,或提供给我们一些相关信息
|
||||
就这样! 在这个文章, 我们展示了在 CentOS 7 上如何去下载、安装和使用基本配置来设置 LAMP 以及 Drupal 8。 欢迎就这个教程提供反馈,或提供给我们一些相关信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.
|
||||
Aaron Kili 是 linux 和 F.O.S.S 爱好者,将成为 Linux 系统管理员,Web 开发者,目前是 TecMint 的原创作者,热爱计算机工作,并且坚信知识共享。
|
||||
|
||||
Aaron Kili 是 linux 和 F.O.S.S(Free and Open Source Software ) 爱好者,即将推出的 Linux SysAdmin, Web 开发者, 目前是TecMint的内容创作者,热爱计算机工作,并且坚信知识共享。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/install-drupal-in-centos-rhel-fedora/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
|
||||
译者:[imxieke](https://github.com/imxieke)
|
||||
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
|
@ -0,0 +1,113 @@
|
||||
如何在 Vim 中使用标志和文本选择操作
|
||||
============================================================
|
||||
|
||||
基于图形界面的文本或源代码编辑器,提供了一些诸如文本选择的功能。我是想说,可能大多数人不觉得这是一个功能。不过像 Vim 这种基于命令行的编辑器就不是这样。当你仅使用键盘操作 Vim 的时候,就需要学习特定的命令来选择你想要的文本。在这个教程中,我们将详细讨论文本选择这一功能以及 Vim 中的标志功能。
|
||||
|
||||
在此之前需要说明的是,本教程中所提到的例子、命令和指令都是在 Ubuntu 16.04 的环境下测试的。Vim 的版本是 7.4。
|
||||
|
||||
# Vim 的文本选择功能
|
||||
|
||||
我们假设你已经具备了 Vim 编辑器的基本知识(如果没有,可以先阅读[这篇文章][2])。你应该知道,'d' 命令能够剪切/删除一行内容。如果你想要剪切 3 行的话,可以重复命令 3 次。不过,如果需要剪切 15 行呢?重复 ‘d’ 命令 15 次是个实用的解决方法吗?
|
||||
|
||||
显然不是。这种情况下的最佳方法是,选中你想要剪切/删除的行,再运行 ‘d’ 命令。举个例子:
|
||||
|
||||
假如我想要剪切/删除下面截图中 INTRODUCTION 小节的第一段:
|
||||
|
||||
[![Text edited in VIM](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-example.png)][3]
|
||||
|
||||
那么我的做法是:将光标放在第一行的开始,(确保退出了 Insert 模式)按下 'V'(Shift+v)命令。这时 Vim 会开启视图模式,并选中第一行。
|
||||
|
||||
[![Select a line with VIM](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-initiated.png)][4]
|
||||
|
||||
现在,我可以使用方向键'下',来选中整个段落。
|
||||
|
||||
[![Select multiple lines with Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-working.png)][5]
|
||||
|
||||
这就是我们想要的,对吧!现在只需按 'd'键,就可以剪切/删除选中的段落了。当然,除了剪切/删除,你可以对选中的文本做任何操作。
|
||||
|
||||
这给我们带来了另一个重要的问题:当我们不需要删除整行的时候,该怎么做呢?也就是说,我们刚才讨论的解决方法,仅适用于想要对整行做操作的情况。那么如果我们只想删除段落的前三句话呢?
|
||||
|
||||
其实也有相应的命令 - 只需用 'v' 来代替 'V'(不包括单引号)即可。在下面的例子中,我使用 'v' 来选中段落的前三句话:
|
||||
|
||||
[![Select the first three sentences in Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-partial-lines.png)][6]
|
||||
|
||||
有时候,你需要处理的数据由单独的列组成,你的需求可能是选择特定的一列。考虑下面的截图:
|
||||
|
||||
[![Columns in Vom](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-columns.png)][7]
|
||||
|
||||
假设我们只需选择文本的第二列,即国家的名字。这种情况下,你可以将光标放在这一列的第一个字母上,按 Ctrl+v 一次。然后,按方向键'下',选中每个国家名字的第一个字母:
|
||||
|
||||
[![Select the first char of a column](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-column-1.png)][8]
|
||||
|
||||
然后按方向键'右',选中这一列。
|
||||
|
||||
[![Select a whole column in Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-column-2.png)][9]
|
||||
|
||||
**小窍门**:如果你之前选中了某个文本块,现在想重新选中那个文本块,只需在命令模式下按 'gv' 即可。
|
||||
|
||||
# 使用标志
|
||||
|
||||
有时候,你在处理一个很大的文件(例如源代码文件或者一个 shell 脚本),可能想要切换到一个特定的位置,然后再回到刚才所在的行。如果这两行的位置不远,或者你并不常做这类操作,那么这不是什么问题。
|
||||
|
||||
但是,如果你需要频繁地在当前位置和一些较远的行之间切换,那么最好的方法就是使用标志。你只需标记当前的位置,然后就能够通过标志名,从文件的任意位置回到当前的位置。
|
||||
|
||||
在 Vim 中,我们使用 m 命令紧跟一个字母来标记一行(字母表示标志名,可用小写的 a-z)。例如 ma。然后你可以使用命令 'a (包括左单引号)回到标志为 a 的行。
|
||||
|
||||
**小窍门**:你可以使用单引号来跳转到标志行的第一个字符,或使用反引号来跳转到标志行的特定列。
|
||||
|
||||
Vim 的标志功能还有很多其他的用法。例如,你可以先标记一行,然后将光标移到其他行,运行下面的命令:
|
||||
|
||||
```
|
||||
d'[标志名]
|
||||
```
|
||||
|
||||
来删除当前位置和标志行之间的所有内容。
|
||||
|
||||
在 Vim 官方文档中,有一个重要的内容:
|
||||
|
||||
```
|
||||
每个文件有一些由小写字母(a-z)定义的标志。此外,还存在一些由大写字母(A-Z)定义的全局标志,它们定义了一个特定文件的某个位置。例如,你可能在同时编辑十个文件,每个文件都可以有标志 a,但是只有一个文件能够有标志 A。
|
||||
```
|
||||
|
||||
我们已经讨论了使用小写字母作为 Vim 标志的基本用法,以及它们的便捷之处。下面的这段摘录讲解的足够清晰:
|
||||
|
||||
```
|
||||
由于种种局限性,大写字母标志可能乍一看不如小写字母标志好用,但它可以用作一种快速的文件书签。例如,打开 .vimrc 文件,按下 mV,然后退出。下次再想要编辑 .vimrc 文件的时候,按下 'V 就能够打开它。
|
||||
```
|
||||
|
||||
最后,我们使用 'delmarks' 命令来删除标志。例如:
|
||||
|
||||
```
|
||||
:delmarks a
|
||||
```
|
||||
|
||||
这一命令将从文件中删除一个标志。当然,你也可以删除标志行,这样标志将被自动删除。你可以在 [Vim 文档][11] 中找到关于标志的更多信息。
|
||||
|
||||
# 总结
|
||||
|
||||
当你开始使用 Vim 作为首选编辑器的时候,类似于这篇教程中提到的功能将会是非常有用的工具,能够节省大量的时间。你得承认,这里介绍的文本选择和标志功能几乎不怎么需要学习,所需要的只是一点练习。
|
||||
|
||||
你可以在 [HowtoForge][1] 上找到更多有关 Vim 的文章。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.howtoforge.com/tutorial/how-to-use-markers-and-perform-text-selection-in-vim/
|
||||
|
||||
作者:[Himanshu Arora][a]
|
||||
译者:[Cathon](https://github.com/Cathon)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.howtoforge.com/tutorial/how-to-use-markers-and-perform-text-selection-in-vim/
|
||||
[1]:https://www.howtoforge.com/tutorials/shell/
|
||||
[2]:https://www.howtoforge.com/vim-basics
|
||||
[3]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-example.png
|
||||
[4]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-initiated.png
|
||||
[5]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-working.png
|
||||
[6]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-partial-lines.png
|
||||
[7]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-columns.png
|
||||
[8]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-column-1.png
|
||||
[9]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-column-2.png
|
||||
[10]:http://vim.wikia.com/wiki/Vimrc
|
||||
[11]:http://vim.wikia.com/wiki/Using_marks
|
63
translated/tech/20170320 Why Go.md
Normal file
63
translated/tech/20170320 Why Go.md
Normal file
@ -0,0 +1,63 @@
|
||||
为什么使用 Go 语言?
|
||||
============================================================
|
||||
|
||||
几个星期前,我一个朋友问我:“为什么要关心 Go 语言”? 因为他们知道我热衷于 Go 语言,但他们想知道为什么我认为_其他人_也应该关心。本文包含三个我认为 Go 是重要的编程语言的原因。
|
||||
|
||||
# 安全
|
||||
|
||||
个人而言,你和我或许完全有能力在 C 中编写程序,既不会泄漏内存,也不会不安全地重复使用内存。然而,整体上,即使有超过[ 40 年][5]的经验,用 C 的程序员也无法可靠地这样做。
|
||||
|
||||
尽管静态代码分析、valgrind、tsan 以及 “-Werror” 已经存在了几十年,很少有证据表明这些工具被广泛认可,更不用说广泛采用。总而言之,事实表明,程序员根本无法安全地管理自己的内存。现在是离开 C 的时候了。
|
||||
|
||||
Go 不依赖于程序员直接管理内存,所有内存分配都由语言运行时管理,使用前初始化,必要时检查边界。它肯定不是提供这些安全保障的第一个主流语言,Java(1995)可能是该冠军的竞争者。关键是,世界对不安全的编程语言没有胃口,所以人们默认认为,Go 是内存安全的。
|
||||
|
||||
# 开发人员生产力
|
||||
|
||||
从 20 世纪 70 年代末,开发人员时间变得比硬件时间更昂贵了。开发人员的生产力是一个不断扩展的话题,但它归结为这一点:你花了多少时间做有用的工作,又有多少时间等待编译器或者失望地迷失在外部代码库中。
|
||||
|
||||
有个笑话说 Go 是在等待[ C ++ 程序编译][6]时开发的。快速编译是 Go 的一个重要功能,也是吸引新开发人员的关键工具。虽然编译速度仍然是一个[永久的战场][7],但公平地说,在其他语言中需要几分钟的编译,在 Go 中只需要几秒钟。
|
||||
|
||||
Go 程序员意识到生产力更根本的问题是代码是为了_读而写的_,所以将[代码的阅读行为放在编写之上][8]。Go 通过工具和自定义强制所有代码格式化成特定的样式。这消除了学习项目特定语言子方言时的困难,并有助于发现错误,因为它们_看上去_就是不正确。
|
||||
|
||||
由于专注于分析和机器辅助,Go 开发人员开始采用越来越多的工具来发现常见的编码错误,这种工具从来没有在 C 语言开发者中产生共鸣 - Go 开发人员_希望_工具帮助他们保持代码清洁。
|
||||
|
||||
# 并发性
|
||||
|
||||
十多年来,芯片设计师一直在警告[免费午餐将会结束][9]。从最低端的手机到最耗电的服务器,硬件的并行性以[更多、更慢、堆 cpu 内核][10]的形式出现,只有_当_你的语言可以利用它们才能实现。因此,并发需要内置到我们编写的要在今天的硬件上运行的软件中。
|
||||
|
||||
通过提供一种基于协程的[轻量级并发模型][11],或者是 Go 中已知的 goroutines,Go 超越了那些暴露操作系统的多进程或多线程并行模型的语言。goroutines 允许程序员避开复杂的回调,而语言运行时确保有足够的线程来保持你的内核的活跃。
|
||||
|
||||
# 总结
|
||||
|
||||
我给朋友推荐 Go 有三个原因:安全性、生产力和并发性。有些语言可以涵盖一个也有可能是两个方面,但是这三个方面的结合使得 Go 成为主流程序员的绝佳选择。
|
||||
|
||||
|
||||
## 相关文章:
|
||||
|
||||
1. [为什么 Go 和 Rust 不是竞争对手][1]
|
||||
2. [听听我在 OSCON 上谈 Go 语言性能][2]
|
||||
3. [我在 GopherChina 和 GopherCon Singapore 中的演讲][3]
|
||||
4. [压力测试你 Go 包][4]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://dave.cheney.net/2017/03/20/why-go
|
||||
|
||||
作者:[Dave Cheney][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://dave.cheney.net/
|
||||
[1]:https://dave.cheney.net/2015/07/02/why-go-and-rust-are-not-competitors
|
||||
[2]:https://dave.cheney.net/2015/05/31/hear-me-speak-about-go-performance-at-oscon
|
||||
[3]:https://dave.cheney.net/2017/02/09/im-speaking-at-gopherchina-and-gophercon-singapore
|
||||
[4]:https://dave.cheney.net/2013/06/19/stress-test-your-go-packages
|
||||
[5]:https://en.wikipedia.org/wiki/C_(programming_language)
|
||||
[6]:https://commandcenter.blogspot.com.au/2012/06/less-is-exponentially-more.html
|
||||
[7]:https://dave.cheney.net/2016/11/19/go-1-8-toolchain-improvements
|
||||
[8]:https://twitter.com/rob_pike/status/791326139012620288
|
||||
[9]:http://www.gotw.ca/publications/concurrency-ddj.htm
|
||||
[10]:https://www.technologyreview.com/s/601441/moores-law-is-dead-now-what/
|
||||
[11]:https://blog.golang.org/concurrency-is-not-parallelism
|
@ -7,40 +7,40 @@
|
||||
![How to deploy Kubernetes on the Raspberry Pi ](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/raspberrypi_cartoon.png?itok=sntNdheJ "How to deploy Kubernetes on the Raspberry Pi ")
|
||||
>图片提供: opensource.com
|
||||
|
||||
当我开始对[ARM][6]设备,特别是 Raspberry Pi 感兴趣时,我的第一个项目是一个 OpenVPN 服务器。
|
||||
当我开始对 [ARM][6]设备,特别是 Raspberry Pi 感兴趣时,我的第一个项目是一个 OpenVPN 服务器。
|
||||
|
||||
通过将 Raspberry Pi 作为家庭网络的安全网关,我可以使用我的手机来控制我的桌面,并远程播放 Spotify,打开文档以及一些其他有趣的东西。我在第一个项目中使用了一个现有的教程,因为我害怕自己使用命令行。
|
||||
通过将 Raspberry Pi 作为家庭网络的安全网关,我可以使用我的手机来控制我的桌面,远程播放 Spotify,打开文档以及一些其他有趣的东西。我在第一个项目中使用了一个现有的教程,因为我害怕自己使用命令行。
|
||||
|
||||
更多关于 Raspberry Pi 的:
|
||||
更多关于 Raspberry Pi 的文章:
|
||||
|
||||
* [最新的 Raspberry Pi][1]
|
||||
* [什么是 Raspberry Pi?][2]
|
||||
* [开始使用 Raspberry Pi][3]
|
||||
* [给我们发送你的 Raspberry Pi 项目和教程][4]
|
||||
|
||||
几个月后,这种恐惧消失了。我扩展了我的原始项目,并使用[ Samba 服务器][7]从文件服务器隔离了 OpenVPN 服务器。这是我第一个没有完全按照教程来的项目。不幸的是,在我的 Samba 项目结束后,我意识到我没有记录任何东西,所以我无法复制它。为了重新创建它,我不得不重新参考那些单独的教程,并将它们放在一起。
|
||||
几个月后,这种恐惧消失了。我扩展了我的原始项目,并使用[ Samba 服务器][7]从文件服务器隔离了 OpenVPN 服务器。这是我第一个没有完全按照教程来的项目。不幸的是,在我的 Samba 项目结束后,我意识到我没有记录任何东西,所以我无法复制它。为了重新创建它,我不得不重新参考我曾经用过的那些单独的教程,将项目拼回到一起。
|
||||
|
||||
我学到了关于开发人员工作流程的宝贵经验 - 跟踪你所有的更改。我在本地做了一个小的 git 仓库,并记录了我输入的所有命令。
|
||||
|
||||
### 发现 Kubernetes
|
||||
|
||||
2015 年 5 月,我发现了 Linux 容器和 Kubernetes。我觉得 Kubernetes 很有魅力,我可以使用仍在技术上发展的概念 - 并且我实际上可以用它。平台本身及其所呈现的可能性令人兴奋。直到那时,我刚刚在一块 Raspberry Pi 上运行了一个程序。有了 Kubernetes,我可以做出比以前更高级的配置。
|
||||
2015 年 5 月,我发现了 Linux 容器和 Kubernetes。我觉得 Kubernetes 很有魅力,我可以使用仍在技术上发展的概念 - 并且我实际上可以用它。平台本身及其所呈现的可能性令人兴奋。在此之前,我才刚刚在一块 Raspberry Pi 上运行了一个程序。有了 Kubernetes,我可以做出比以前更高级的配置。
|
||||
|
||||
那时候,Docker(还是 v1.6,如果我记得正确的话)在 ARM 上有一个 bug,这意味着在 Raspberry Pi 上运行 Kubernetes 实际上是不可能的。在早期的 0.x 版本中,Kubernetes 的变化很快。每次我在 AMD64 上找到一篇关于如何设置 Kubernetes 的指南时,它还是一个较旧的版本,并且与我当时使用的完全不兼容。
|
||||
那时候,Docker(v1.6 版本,如果我记得正确的话)在 ARM 上有一个 bug,这意味着在 Raspberry Pi 上运行 Kubernetes 实际上是不可能的。在早期的 0.x 版本中,Kubernetes 的变化很快。每次我在 AMD64 上找到一篇关于如何设置 Kubernetes 的指南时,它针对的还都是一个旧版本,与我当时使用的完全不兼容。
|
||||
|
||||
我用自己的方法在 Raspberry Pi 上创建了一个 Kubernetes 节点,而在 Kubernetes v1.0.1 中,我使用 Docker v1.7.1 [让它工作了][8]。这是完全将 Kubernetes 部署到 ARM 的方法。
|
||||
不管怎样,我用自己的方法在 Raspberry Pi 上创建了一个 Kubernetes 节点,而在 Kubernetes v1.0.1 中,我使用 Docker v1.7.1 [让它工作了][8]。这是第一个将 Kubernetes 全功能部署到 ARM 的方法。
|
||||
|
||||
在 Raspberry Pi 上运行 Kubernetes 的优势在于,由于 ARM 设备非常小巧,因此不会产生大量的功耗。如果程序以正确的方式构建,那么同样可以在 AMD64 上用同样的方法运行程序。有一块小型 IoT 板为教育创造了巨大的机会。用来做演示如在会议中也是非常有用的。使用 Raspberry Pi (通常)比在大型英特尔机器要容易得多。
|
||||
在 Raspberry Pi 上运行 Kubernetes 的优势在于,由于 ARM 设备非常小巧,因此不会产生大量的功耗。如果程序以正确的方式构建,那么同样可以在 AMD64 上用同样的方法运行程序。有一块小型 IoT 板为教育创造了巨大的机会。用它来做演示也很有用,比如你要出差参加一个会议。携带 Raspberry Pi (通常)比拖着大型英特尔机器要容易得多。
|
||||
|
||||
现在符合[我建议][9]的 ARM(32位和64位)的支持已被合并到核心中。ARM 的二进制文件会自动与 Kubernetes 一起发布。虽然我们还没有为 ARM 提供自动化的 CI(持续集成)系统,它可以自动在 PR 合并之前确定在它可在 ARM 上工作,它仍然工作得不错。
|
||||
现在按照[我建议][9]的 ARM(32 位和 64 位)的支持已被合并到核心中。ARM 的二进制文件会自动与 Kubernetes 一起发布。虽然我们还没有为 ARM 提供自动化的 CI(持续集成)系统,在 PR 合并之前会自动确定它可在 ARM 上工作,它仍然工作得不错。
|
||||
|
||||
### Raspberry Pi 上的分布式网络
|
||||
|
||||
我在 [kubeadm][10] 发现了 Weave Net。[Weave Mesh][11]是一个有趣的分布式网络解决方案,因此我开始阅读更多关于它的内容。在 2016 年 12 月,我在 [Weaveworks][12] 收到了第一份合同工作。我是 Weave Net 中 ARM 支持团队的一员。
|
||||
我通过 [kubeadm][10] 发现了 Weave Net。[Weave Mesh][11]是一个有趣的分布式网络解决方案,因此我开始阅读更多关于它的内容。在 2016 年 12 月,我在 [Weaveworks][12] 收到了第一份合同工作。我是 Weave Net 中 ARM 支持团队的一员。
|
||||
|
||||
我很高兴可以在 Raspberry Pi 上运行 Weave Net 的工业案例,比如那些需要更加移动化的工厂。目前,将 Weave Scope 或 Weave Cloud 部署到 Raspberry Pi 可能是不可能的(尽管可以考虑使用其他 ARM 设备),因为我猜这个软件需要更多的内存来运行。理想情况下,随着 Raspberry Pi 升级成了 2GB 内存,我想我可以在它上面运行 Weave Cloud 了。
|
||||
我很高兴可以在 Raspberry Pi 上运行 Weave Net 的工业案例,比如那些需要更加移动化的工厂。目前,将 Weave Scope 或 Weave Cloud 部署到 Raspberry Pi 可能不太现实(尽管可以考虑使用其他 ARM 设备),因为我猜这个软件需要更多的内存才能运行良好。理想情况下,随着 Raspberry Pi 升级到 2GB 内存,我想我可以在它上面运行 Weave Cloud 了。
|
||||
|
||||
在 Weave Net 1.9 中,Weave Net 支持了 ARM。Kubeadm(通常是 Kubernetes)在多个平台上工作。你可以使用 Weave 将 Kubernetes 部署到 ARM,就像在任何 AMD64 设备上一样上安装 Docker、kubeadm、kubectl 和 kubelet。然后在控制面板下初始化主机:
|
||||
在 Weave Net 1.9 中,Weave Net 支持了 ARM。Kubeadm(通常是 Kubernetes)在多个平台上工作。你可以使用 Weave 将 Kubernetes 部署到 ARM,就像在任何 AMD64 设备上一样安装 Docker、kubeadm、kubectl 和 kubelet。然后初始化控制面板组件运行的主机:
|
||||
|
||||
```
|
||||
kubeadm init
|
||||
@ -54,25 +54,25 @@ kubectl apply -f https://git.io/weave-kube
|
||||
|
||||
在此之前在 ARM 上,你只可以用 Flannel 安装一个 pod 网络,但是在 Weave Net 1.9 中已经改变了,它官方支持了 ARM。
|
||||
|
||||
最后,记入你的节点:
|
||||
最后,加入你的节点:
|
||||
|
||||
```
|
||||
kubeadm join --token <token> <master-ip>
|
||||
```
|
||||
|
||||
就是这样了!Kubernetes 已经部署到了 Raspberry Pi 上了。相比 Intel/AMD64,你不用做特别的比较;Weave Net 在 ARM 上也能工作。
|
||||
就是这样了!Kubernetes 已经部署到了 Raspberry Pi 上了。相比在 Intel/AMD64 上运行,你不用做什么特别的事情;Weave Net 在 ARM 上就能工作的很好。
|
||||
|
||||
### Raspberry Pi 社区
|
||||
|
||||
我希望 Raspberry Pi 社区成长起来,并他们的心态传播到世界其他地方。他们在英国和其他国家已经取得了成功,但在芬兰并不是很成功。我希望生态系统能够继续扩展,以让更多的人学习如何部署 Kubernetes 或 Weave 到 ARM 设备上。毕竟,这些是我学到的。通过在 Raspberry Pi 设备上自学,我更好地了解了 ARM 以及其上的软件部署。
|
||||
我希望 Raspberry Pi 社区成长起来,他们的思想传播到世界其他地方。他们在英国和其他国家已经取得了成功,但在芬兰并不是很成功。我希望生态系统能够继续扩展,以让更多的人学习如何部署 Kubernetes 或 Weave 到 ARM 设备上。毕竟,这些是我学到的。通过在 Raspberry Pi 设备上自学,我更好地了解了 ARM 及其上面部署的软件。
|
||||
|
||||
### 最后的思考
|
||||
|
||||
我通过加入用户社区、提出问题和不同程度的测试了解的关于 Raspberry Pi 和 Kubernetes 的一切,。
|
||||
我通过加入用户社区、提出问题和不同程度的测试,在线学习了关于 Raspberry Pi 和 Kubernetes 的一切。
|
||||
|
||||
我是居住在芬兰的说瑞典语的高中生,到目前为止,我从来没有参加过编程或计算机课程。但我仍然能够加入开源社区,因为它对年龄或教育没有限制:你的工作是根据其优点来判断的。
|
||||
我是居住在芬兰的说瑞典语的高中生,到目前为止,我还从来没有参加过编程或计算机课程。但我仍然能够加入开源社区,因为它对年龄或教育没有限制:你的工作是根据其价值来评判的。
|
||||
|
||||
对于任何那些第一次参与开源项目的人而言:深入进去,因为这是完全值得的。你做什么没有任何限制,你将永远不知道开源世界将为你提供哪些机会。这会很有趣,我保证!
|
||||
对于那些第一次要在开源项目中做出贡献感到紧张的人,我想说:深入进去,因为这是完全值得的。你做什么没有任何限制,你将永远不知道开源世界将为你提供哪些机会。这会很有趣,我保证!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -82,11 +82,11 @@ Lucas Käldström - 谢谢你发现我!我是一名来自芬兰的说瑞典语
|
||||
|
||||
------------------
|
||||
|
||||
via: 网址
|
||||
via: https://opensource.com/article/17/3/kubernetes-raspberry-pi
|
||||
|
||||
作者:[ Lucas Käldström][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[jasminepeng](https://github.com/jasminepeng)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
|
84
translated/tech/20170323 3 open source link shorteners.md
Normal file
84
translated/tech/20170323 3 open source link shorteners.md
Normal file
@ -0,0 +1,84 @@
|
||||
3 个开源链接缩短器
|
||||
============================================================
|
||||
|
||||
> 想要构建你自己的 URL 缩短器?这些开源项目使这个变得简单。
|
||||
|
||||
![3 open source link shorteners](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/links.png?itok=AumNmse7 "3 open source link shorteners")
|
||||
>图片提供: [Paul Lewin][2]. Modified by Opensource.com. [CC BY-SA 2.0][3]
|
||||
|
||||
没有人喜欢一个非常长的URL。
|
||||
|
||||
他们很难解析。但有时候,站点的深层目录结构还有最后加上的大量参数使得 URL 开始变得冗长。在 Twitter 添加自己的链接缩短服务之前的那些日子里,一个长的 URL 意味着从推文中消减珍贵的字符。
|
||||
|
||||
如今,因为很多原因,人们开始使用链接缩短器。这样人们可以更容易地输入或记住另一个冗长的网址。它们可以为社交媒体帐户带来一贯的品牌建设。它们可以更轻松地在一组网址中进行分析。它们使得为其他网站频繁变化的 URL 提供统一的入口成为可能。
|
||||
|
||||
URL 缩短器确实有一些挑战。应该为你提供短网址服务也会消失,这使得在点击之前知道链接实际指向哪里也是一个挑战,并且容易受到 [linkrot][4] 的影响。但是尽管面临这些挑战,URL 缩短器不会消失。
|
||||
|
||||
但是,既然已经有这么多免费链接缩短服务,为什么还要自己构建?简而言之:方便控制。虽然有些服务可以让你选择自己的域名来使用,有时候这有关于你会得到定制级别。使用自助式服务,你可以自己决定服务的运行时间、URL 的格式以及决定谁可以访问你的分析。这是你自己拥有并且可以操作的。
|
||||
|
||||
幸运的是,如果你想建立下一个 bit.ly、goo.gl或 ow.ly,你可以有很多开源选项。你可以考虑下面几个。
|
||||
|
||||
### Lessn More
|
||||
|
||||
[Lessn More][5]是一个个人 URL 缩短器,用 PHP 写成,并从一个名为 Buttered URL 的较旧项目 fork 而来,而它又是一个名为 Lessn 的项目的分支衍生而来。Lessn More 能提供你对 URL 缩短器预期的大部分功能:API 和书签支持、自定义 URL 等。还有一些有用的功能比如可以让 Lessn More 使用单词黑名单来避免创建意外不适当的 URL、避免“看着相似”的字符来使 URL 更易读、能够选择是否使用混合大小写的字符等。
|
||||
|
||||
[Lessn More][6] 在 GitHub 上以 3 句版 [BSD][8]许可证公布了 [源代码][7]。
|
||||
|
||||
### Polr
|
||||
|
||||
[Polr][9] 将自己描述为“现代、强大、可靠的URL缩短器”。它具有相当直接但现代化的界面,像我们这里详细介绍的其他选择那样还提供了一个 API 来允许你从其他程序中使用它。在这三个选择中,它在功能上是最轻的,但如果你正在寻找一个简单但功能完整的选择,那么这可能是你不错的选择。下载之前你可以查看[在线演示][10]。
|
||||
|
||||
Polr 的[源代码][11] 在 GitHub 中以 [GPLv2][12] 许可证公布。
|
||||
|
||||
### YOURLS
|
||||
|
||||
[YOURLS][13],“Your Own URL Shortener”(你自己的 URL 缩短器)的缩写,它是我最熟悉的选择。我在个人网站上已经运行了好几年,并且对其功能非常满意。
|
||||
|
||||
它是用 PHP 编写的,YOURLS 是一个有非常丰富功能的选择并且可以很好地开箱即用。你可以将其配置为任何人可公开使用,或只允许某些用户使用它。它支持自定义 URL,拥有书签功能使得很容易共享,它还具有非常强大的内置统计信息,并支持可插拔的架构,以允许其他人添加功能。它还有一个API,可以轻松地用它创建其他程序。
|
||||
|
||||
你可以在 Github 中找到 [MIT许可证][15]下的 YOURLS 的[源代码][14]。
|
||||
|
||||
* * *
|
||||
|
||||
不喜欢这些选择么?看下互联网,你会发现还有其他几个选择:[shuri][16]、[Nimbus][17]、[Lstu][18] 等等。除了这些选择外,构建链接缩短器也是一个很好的第一个编程项目,它可以帮助了解新的语言或 Web 框架。毕竟,它的核心功能非常简单:以 URL 作为输入,并重定向到另一个 URL。除此之外,它取决于你自己想要添加的功能。
|
||||
|
||||
你有我们没有在这里列出的最爱吗?在评论栏中让我们知道你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Jason Baker - Jason 热衷于使用技术使世界更加开放,从软件开发到阳光政府行动。Linux 桌面爱好者、地图/地理空间爱好者、树莓派工匠、数据分析和可视化极客、偶尔的码农、云本土主义者。在 Twitter 上关注他。
|
||||
|
||||
------------
|
||||
|
||||
via: https://opensource.com/article/17/3/url-link-shortener
|
||||
|
||||
作者:[Jason Baker ][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/jason-baker
|
||||
[1]:https://opensource.com/article/17/3/url-link-shortener?rate=5EGysFmjsUsxCc74bffDni4sFxxaIYiGRUG3UPznav8
|
||||
[2]:https://www.flickr.com/photos/digypho/7905320090
|
||||
[3]:https://creativecommons.org/licenses/by/2.0/
|
||||
[4]:https://en.wikipedia.org/wiki/Linkrot
|
||||
[5]:https://lessnmore.net/
|
||||
[6]:https://lessnmore.net/
|
||||
[7]:https://github.com/alanhogan/lessnmore
|
||||
[8]:https://github.com/alanhogan/lessnmore/blob/master/LICENSE.txt
|
||||
[9]:https://project.polr.me/
|
||||
[10]:http://demo.polr.me/
|
||||
[11]:https://github.com/cydrobolt/polr
|
||||
[12]:https://github.com/cydrobolt/polr/blob/master/LICENSE
|
||||
[13]:https://yourls.org/
|
||||
[14]:https://github.com/YOURLS/YOURLS
|
||||
[15]:https://github.com/YOURLS/YOURLS/blob/master/LICENSE.md
|
||||
[16]:https://github.com/pips-/shuri
|
||||
[17]:https://github.com/ethanal/nimbus
|
||||
[18]:https://github.com/ldidry/lstu
|
||||
[19]:https://opensource.com/user/19894/feed
|
||||
[20]:https://opensource.com/article/17/3/url-link-shortener#comments
|
||||
[21]:https://opensource.com/users/jason-baker
|
Loading…
Reference in New Issue
Block a user