diff --git a/published/20160917 A Web Crawler With asyncio Coroutines.md b/published/20160917 A Web Crawler With asyncio Coroutines.md new file mode 100644 index 0000000000..a18cdd49af --- /dev/null +++ b/published/20160917 A Web Crawler With asyncio Coroutines.md @@ -0,0 +1,1105 @@ +一个使用 asyncio 协程的网络爬虫 +=== + +本文作者: + +A. Jesse Jiryu Davis 是纽约 MongoDB 的工程师。他编写了异步 MongoDB Python 驱动程序 Motor,也是 MongoDB C 驱动程序的开发领袖和 PyMongo 团队成员。 他也为 asyncio 和 Tornado 做了贡献,在 http://emptysqua.re 上写作。 + +Guido van Rossum 是主流编程语言 Python 的创造者,Python 社区称他为 BDFL (仁慈的终生大独裁者 (Benevolent Dictator For Life))——这是一个来自 Monty Python 短剧的称号。他的主页是 http://www.python.org/~guido/ 。 + +### 介绍 + +经典的计算机科学强调高效的算法,尽可能快地完成计算。但是很多网络程序的时间并不是消耗在计算上,而是在等待许多慢速的连接或者低频事件的发生。这些程序暴露出一个新的挑战:如何高效的等待大量网络事件。一个现代的解决方案是异步 I/O。 + +这一章我们将实现一个简单的网络爬虫。这个爬虫只是一个原型式的异步应用,因为它等待许多响应而只做少量的计算。一次爬的网页越多,它就能越快的完成任务。如果它为每个动态的请求启动一个线程的话,随着并发请求数量的增加,它会在耗尽套接字之前,耗尽内存或者线程相关的资源。使用异步 I/O 可以避免这个的问题。 + +我们将分三个阶段展示这个例子。首先,我们会实现一个事件循环并用这个事件循环和回调来勾画出一只网络爬虫。它很有效,但是当把它扩展成更复杂的问题时,就会导致无法管理的混乱代码。然后,由于 Python 的协程不仅有效而且可扩展,我们将用 Python 的生成器函数实现一个简单的协程。在最后一个阶段,我们将使用 Python 标准库“asyncio”中功能完整的协程, 并通过异步队列完成这个网络爬虫。(在 [PyCon 2013](http://pyvideo.org/video/1667/keynote) 上,Guido 介绍了标准的 asyncio 库,当时称之为“Tulip”。) + +### 任务 + +网络爬虫寻找并下载一个网站上的所有网页,也许还会把它们存档,为它们建立索引。从根 URL 开始,它获取每个网页,解析出没有遇到过的链接加到队列中。当网页没有未见到过的链接并且队列为空时,它便停止运行。 + +我们可以通过同时下载大量的网页来加快这一过程。当爬虫发现新的链接,它使用一个新的套接字并行的处理这个新链接,解析响应,添加新链接到队列。当并发很大时,可能会导致性能下降,所以我们会限制并发的数量,在队列保留那些未处理的链接,直到一些正在执行的任务完成。 + +### 传统方式 + +怎么使一个爬虫并发?传统的做法是创建一个线程池,每个线程使用一个套接字在一段时间内负责一个网页的下载。比如,下载 xkcd.com 网站的一个网页: + +```python +def fetch(url): + sock = socket.socket() + sock.connect(('xkcd.com', 80)) + request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(url) + sock.send(request.encode('ascii')) + response = b'' + chunk = sock.recv(4096) + while chunk: + response += chunk + chunk = sock.recv(4096) + + # Page is now downloaded. + links = parse_links(response) + q.add(links) +``` + +套接字操作默认是阻塞的:当一个线程调用一个类似 `connect` 和 `recv` 方法时,它会阻塞,直到操作完成。(即使是 `send` 也能被阻塞,比如接收端在接受外发消息时缓慢而系统的外发数据缓存已经满了的情况下)因此,为了同一时间内下载多个网页,我们需要很多线程。一个复杂的应用会通过线程池保持空闲的线程来分摊创建线程的开销。同样的做法也适用于套接字,使用连接池。 + +到目前为止,使用线程的是成本昂贵的,操作系统对一个进程、一个用户、一台机器能使用线程做了不同的硬性限制。在 作者 Jesse 的系统中,一个 Python 线程需要 50K 的内存,开启上万个线程就会失败。每个线程的开销和系统的限制就是这种方式的瓶颈所在。 + +在 Dan Kegel 那一篇很有影响力的文章“[The C10K problem](http://www.kegel.com/c10k.html)”中,它提出了多线程方式在 I/O 并发上的局限性。他在开始写道, + +> 网络服务器到了要同时处理成千上万的客户的时代了,你不这样认为么?毕竟,现在网络规模很大了。 + +Kegel 在 1999 年创造出“C10K”这个术语。一万个连接在今天看来还是可接受的,但是问题依然存在,只不过大小不同。回到那时候,对于 C10K 问题,每个连接启一个线程是不切实际的。现在这个限制已经成指数级增长。确实,我们的玩具网络爬虫使用线程也可以工作的很好。但是,对于有着千万级连接的大规模应用来说,限制依然存在:它会消耗掉所有线程,即使套接字还够用。那么我们该如何解决这个问题? + +### 异步 + +异步 I/O 框架在一个线程中完成并发操作。让我们看看这是怎么做到的。 + +异步框架使用*非阻塞*套接字。异步爬虫中,我们在发起到服务器的连接前把套接字设为非阻塞: + +```python +sock = socket.socket() +sock.setblocking(False) +try: + sock.connect(('xkcd.com', 80)) +except BlockingIOError: + pass +``` + +对一个非阻塞套接字调用 `connect` 方法会立即抛出异常,即使它可以正常工作。这个异常复现了底层 C 语言函数令人厌烦的行为,它把 `errno` 设置为 `EINPROGRESS`,告诉你操作已经开始。 + +现在我们的爬虫需要一种知道连接何时建立的方法,这样它才能发送 HTTP 请求。我们可以简单地使用循环来重试: + +```python +request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(url) +encoded = request.encode('ascii') + +while True: + try: + sock.send(encoded) + break # Done. + except OSError as e: + pass + +print('sent') +``` + +这种方法不仅消耗 CPU,也不能有效的等待*多个*套接字。在远古时代,BSD Unix 的解决方法是 `select`,这是一个 C 函数,它在一个或一组非阻塞套接字上等待事件发生。现在,互联网应用大量连接的需求,导致 `select` 被 `poll` 所代替,在 BSD 上的实现是 `kqueue` ,在 Linux 上是 `epoll`。它们的 API 和 `select` 相似,但在大数量的连接中也能有较好的性能。 + +Python 3.4 的 `DefaultSelector` 会使用你系统上最好的 `select` 类函数。要注册一个网络 I/O 事件的提醒,我们会创建一个非阻塞套接字,并使用默认 selector 注册它。 + +```python +from selectors import DefaultSelector, EVENT_WRITE + +selector = DefaultSelector() + +sock = socket.socket() +sock.setblocking(False) +try: + sock.connect(('xkcd.com', 80)) +except BlockingIOError: + pass + +def connected(): + selector.unregister(sock.fileno()) + print('connected!') + +selector.register(sock.fileno(), EVENT_WRITE, connected) +``` + +我们不理会这个伪造的错误,调用 `selector.register`,传递套接字文件描述符和一个表示我们想要监听什么事件的常量表达式。为了当连接建立时收到提醒,我们使用 `EVENT_WRITE` :它表示什么时候这个套接字可写。我们还传递了一个 Python 函数 `connected`,当对应事件发生时被调用。这样的函数被称为*回调*。 + +在一个循环中,selector 接收到 I/O 提醒时我们处理它们。 + +```python +def loop(): + while True: + events = selector.select() + for event_key, event_mask in events: + callback = event_key.data + callback() +``` + +`connected` 回调函数被保存在 `event_key.data` 中,一旦这个非阻塞套接字建立连接,它就会被取出来执行。 + +不像我们前面那个快速轮转的循环,这里的 `select` 调用会暂停,等待下一个 I/O 事件,接着执行等待这些事件的回调函数。没有完成的操作会保持挂起,直到进到下一个事件循环时执行。 + +到目前为止我们展现了什么?我们展示了如何开始一个 I/O 操作和当操作准备好时调用回调函数。异步*框架*,它在单线程中执行并发操作,其建立在两个功能之上,非阻塞套接字和事件循环。 + +我们这里达成了“并发性(concurrency)”,但不是传统意义上的“并行性(parallelism)”。也就是说,我们构建了一个可以进行重叠 I/O 的微小系统,它可以在其它操作还在进行的时候就开始一个新的操作。它实际上并没有利用多核来并行执行计算。这个系统是用于解决 I/O 密集(I/O-bound)问题的,而不是解决 CPU 密集(CPU-bound)问题的。(Python 的全局解释器锁禁止在一个进程中以任何方式并行执行 Python 代码。在 Python 中并行化 CPU 密集的算法需要多个进程,或者以将该代码移植为 C 语言并行版本。但是这是另外一个话题了。) + +所以,我们的事件循环在并发 I/O 上是有效的,因为它并不用为每个连接拨付线程资源。但是在我们开始前,我们需要澄清一个常见的误解:异步比多线程快。通常并不是这样的,事实上,在 Python 中,在处理少量非常活跃的连接时,像我们这样的事件循环是慢于多线程的。在运行时环境中是没有全局解释器锁的,在同样的负载下线程会执行的更好。异步 I/O 真正适用于事件很少、有许多缓慢或睡眠的连接的应用程序。(Jesse 在“[什么是异步,它如何工作,什么时候该用它?](http://pyvideo.org/video/2565/what-is-async-how-does-it-work-and-when-should)”一文中指出了异步所适用和不适用的场景。Mike Bayer 在“[异步 Python 和数据库](http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/)”一文中比较了不同负载情况下异步 I/O 和多线程的不同。) + +### 回调 + +用我们刚刚建立的异步框架,怎么才能完成一个网络爬虫?即使是一个简单的网页下载程序也是很难写的。 + +首先,我们有一个尚未获取的 URL 集合,和一个已经解析过的 URL 集合。 + +```python +urls_todo = set(['/']) +seen_urls = set(['/']) +``` + +`seen_urls` 集合包括 `urls_todo` 和已经完成的 URL。用根 URL `/` 初始化它们。 + +获取一个网页需要一系列的回调。在套接字连接建立时会触发 `connected` 回调,它向服务器发送一个 GET 请求。但是它要等待响应,所以我们需要注册另一个回调函数;当该回调被调用,它仍然不能读取到完整的请求时,就会再一次注册回调,如此反复。 + +让我们把这些回调放在一个 `Fetcher` 对象中,它需要一个 URL,一个套接字,还需要一个地方保存返回的字节: + +```python +class Fetcher: + def __init__(self, url): + self.response = b'' # Empty array of bytes. + self.url = url + self.sock = None +``` + +我们的入口点在 `Fetcher.fetch`: + +```python + # Method on Fetcher class. + def fetch(self): + self.sock = socket.socket() + self.sock.setblocking(False) + try: + self.sock.connect(('xkcd.com', 80)) + except BlockingIOError: + pass + + # Register next callback. + selector.register(self.sock.fileno(), + EVENT_WRITE, + self.connected) +``` + +`fetch` 方法从连接一个套接字开始。但是要注意这个方法在连接建立前就返回了。它必须将控制返回到事件循环中等待连接建立。为了理解为什么要这样做,假设我们程序的整体结构如下: + +```python +# Begin fetching http://xkcd.com/353/ +fetcher = Fetcher('/353/') +fetcher.fetch() + +while True: + events = selector.select() + for event_key, event_mask in events: + callback = event_key.data + callback(event_key, event_mask) +``` + +当调用 `select` 函数后,所有的事件提醒才会在事件循环中处理,所以 `fetch` 必须把控制权交给事件循环,这样我们的程序才能知道什么时候连接已建立,接着循环调用 `connected` 回调,它已经在上面的 `fetch` 方法中注册过。 + +这里是我们的 `connected` 方法的实现: + +```python + # Method on Fetcher class. + def connected(self, key, mask): + print('connected!') + selector.unregister(key.fd) + request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(self.url) + self.sock.send(request.encode('ascii')) + + # Register the next callback. + selector.register(key.fd, + EVENT_READ, + self.read_response) +``` + +这个方法发送一个 GET 请求。一个真正的应用会检查 `send` 的返回值,以防所有的信息没能一次发送出去。但是我们的请求很小,应用也不复杂。它只是简单的调用 `send`,然后等待响应。当然,它必须注册另一个回调并把控制权交给事件循环。接下来也是最后一个回调函数 `read_response`,它处理服务器的响应: + +```python + # Method on Fetcher class. + def read_response(self, key, mask): + global stopped + + chunk = self.sock.recv(4096) # 4k chunk size. + if chunk: + self.response += chunk + else: + selector.unregister(key.fd) # Done reading. + links = self.parse_links() + + # Python set-logic: + for link in links.difference(seen_urls): + urls_todo.add(link) + Fetcher(link).fetch() # <- New Fetcher. + + seen_urls.update(links) + urls_todo.remove(self.url) + if not urls_todo: + stopped = True +``` + +这个回调在每次 `selector` 发现套接字*可读*时被调用,可读有两种情况:套接字接受到数据或它被关闭。 + +这个回调函数从套接字读取 4K 数据。如果不到 4k,那么有多少读多少。如果比 4K 多,`chunk` 中只包 4K 数据并且这个套接字保持可读,这样在事件循环的下一个周期,会再次回到这个回调函数。当响应完成时,服务器关闭这个套接字,`chunk` 为空。 + +这里没有展示的 `parse_links` 方法,它返回一个 URL 集合。我们为每个新的 URL 启动一个 fetcher。注意一个使用异步回调方式编程的好处:我们不需要为共享数据加锁,比如我们往 `seen_urls` 增加新链接时。这是一种非抢占式的多任务,它不会在我们代码中的任意一个地方被打断。 + +我们增加了一个全局变量 `stopped`,用它来控制这个循环: + +```python +stopped = False + +def loop(): + while not stopped: + events = selector.select() + for event_key, event_mask in events: + callback = event_key.data + callback() +``` + +一旦所有的网页被下载下来,fetcher 停止这个事件循环,程序退出。 + +这个例子让异步编程的一个问题明显的暴露出来:意大利面代码。 + +我们需要某种方式来表达一系列的计算和 I/O 操作,并且能够调度多个这样的系列操作让它们并发的执行。但是,没有线程你不能把这一系列操作写在一个函数中:当函数开始一个 I/O 操作,它明确的把未来所需的状态保存下来,然后返回。你需要考虑如何写这个状态保存的代码。 + +让我们来解释下这到底是什么意思。先来看一下在线程中使用通常的阻塞套接字来获取一个网页时是多么简单。 + +```python +# Blocking version. +def fetch(url): + sock = socket.socket() + sock.connect(('xkcd.com', 80)) + request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(url) + sock.send(request.encode('ascii')) + response = b'' + chunk = sock.recv(4096) + while chunk: + response += chunk + chunk = sock.recv(4096) + + # Page is now downloaded. + links = parse_links(response) + q.add(links) +``` + +在一个套接字操作和下一个操作之间这个函数到底记住了什么状态?它有一个套接字,一个 URL 和一个可增长的 `response`。运行在线程中的函数使用编程语言的基本功能来在栈中的局部变量保存这些临时状态。这样的函数也有一个“continuation”——它会在 I/O 结束后执行这些代码。运行时环境通过线程的指令指针来记住这个 continuation。你不必考虑怎么在 I/O 操作后恢复局部变量和这个 continuation。语言本身的特性帮你解决。 + +但是用一个基于回调的异步框架时,这些语言特性不能提供一点帮助。当等待 I/O 操作时,一个函数必须明确的保存它的状态,因为它会在 I/O 操作完成之前返回并清除栈帧。在我们基于回调的例子中,作为局部变量的替代,我们把 `sock` 和 `response` 作为 Fetcher 实例 `self` 的属性来存储。而作为指令指针的替代,它通过注册 `connected` 和 `read_response` 回调来保存它的 continuation。随着应用功能的增长,我们需要手动保存的回调的复杂性也会增加。如此繁复的记账式工作会让编码者感到头痛。 + +更糟糕的是,当我们的回调函数抛出异常会发生什么?假设我们没有写好 `parse_links` 方法,它在解析 HTML 时抛出异常: + +``` +Traceback (most recent call last): + File "loop-with-callbacks.py", line 111, in + loop() + File "loop-with-callbacks.py", line 106, in loop + callback(event_key, event_mask) + File "loop-with-callbacks.py", line 51, in read_response + links = self.parse_links() + File "loop-with-callbacks.py", line 67, in parse_links + raise Exception('parse error') +Exception: parse error +``` + +这个堆栈回溯只能显示出事件循环调用了一个回调。我们不知道是什么导致了这个错误。这条链的两边都被破坏:不知道从哪来也不知到哪去。这种丢失上下文的现象被称为“堆栈撕裂(stack ripping)”,经常会导致无法分析原因。它还会阻止我们为回调链设置异常处理,即那种用“try / except”块封装函数调用及其调用树。(对于这个问题的更复杂的解决方案,参见 http://www.tornadoweb.org/en/stable/stack_context.html ) + +所以,除了关于多线程和异步哪个更高效的长期争议之外,还有一个关于这两者之间的争论:谁更容易跪了。如果在同步上出现失误,线程更容易出现数据竞争的问题,而回调因为"堆栈撕裂(stack ripping)"问题而非常难于调试。 + +### 协程 + +还记得我们对你许下的承诺么?我们可以写出这样的异步代码,它既有回调方式的高效,也有多线程代码的简洁。这个结合是同过一种称为协程(coroutine)的模式来实现的。使用 Python3.4 标准库 asyncio 和一个叫“aiohttp”的包,在协程中获取一个网页是非常直接的( `@asyncio.coroutine` 修饰符并非魔法。事实上,如果它修饰的是一个生成器函数,并且没有设置 `PYTHONASYNCIODEBUG` 环境变量的话,这个修饰符基本上没啥用。它只是为了框架的其它部分方便,设置了一个属性 `_is_coroutine` 而已。也可以直接使用 asyncio 和裸生成器,而没有 `@asyncio.coroutine` 修饰符): + +```python + @asyncio.coroutine + def fetch(self, url): + response = yield from self.session.get(url) + body = yield from response.read() +``` + +它也是可扩展的。在作者 Jesse 的系统上,与每个线程 50k 内存相比,一个 Python 协程只需要 3k 内存。Python 很容易就可以启动上千个协程。 + +协程的概念可以追溯到计算机科学的远古时代,它很简单,一个可以暂停和恢复的子过程。线程是被操作系统控制的抢占式多任务,而协程的多任务是可合作的,它们自己选择什么时候暂停去执行下一个协程。 + +有很多协程的实现。甚至在 Python 中也有几种。Python 3.4 标准库 asyncio 中的协程是建立在生成器之上的,这是一个 Future 类和“yield from”语句。从 Python 3.5 开始,协程变成了语言本身的特性([“PEP 492 Coroutines with async and await syntax”](https://www.python.org/dev/peps/pep-0492/) 中描述了 Python 3.5 内置的协程)。然而,理解 Python 3.4 中这个通过语言原有功能实现的协程,是我们处理 Python 3.5 中原生协程的基础。 + +要解释 Python 3.4 中基于生成器的协程,我们需要深入生成器的方方面面,以及它们是如何在 asyncio 中用作协程的。我很高兴就此写点东西,想必你也希望继续读下去。我们解释了基于生成器的协程之后,就会在我们的异步网络爬虫中使用它们。 + +### 生成器如何工作 + +在你理解生成器之前,你需要知道普通的 Python 函数是怎么工作的。正常情况下,当一个函数调用一个子过程,这个被调用函数获得控制权,直到它返回或者有异常发生,才把控制权交给调用者: + +```python +>>> def foo(): +... bar() +... +>>> def bar(): +... pass +``` + +标准的 Python 解释器是用 C 语言写的。一个 Python 函数被调用所对应的 C 函数是 `PyEval_EvalFrameEx`。它获得一个 Python 栈帧结构并在这个栈帧的上下文中执行 Python 字节码。这里是 `foo` 函数的字节码: + +```python +>>> import dis +>>> dis.dis(foo) + 2 0 LOAD_GLOBAL 0 (bar) + 3 CALL_FUNCTION 0 (0 positional, 0 keyword pair) + 6 POP_TOP + 7 LOAD_CONST 0 (None) + 10 RETURN_VALUE +``` + +`foo` 函数在它栈中加载 `bar` 函数并调用它,然后把 `bar` 的返回值从栈中弹出,加载 `None` 值到堆栈并返回。 + +当 `PyEval_EvalFrameEx` 遇到 `CALL_FUNCTION` 字节码时,它会创建一个新的栈帧,并用这个栈帧递归的调用 `PyEval_EvalFrameEx` 来执行 `bar` 函数。 + +非常重要的一点是,Python 的栈帧在堆中分配!Python 解释器是一个标准的 C 程序,所以它的栈帧是正常的栈帧。但是 Python 的栈帧是在堆中处理。这意味着 Python 栈帧在函数调用结束后依然可以存在。我们在 `bar` 函数中保存当前的栈帧,交互式的看看这种现象: + +```python +>>> import inspect +>>> frame = None +>>> def foo(): +... bar() +... +>>> def bar(): +... global frame +... frame = inspect.currentframe() +... +>>> foo() +>>> # The frame was executing the code for 'bar'. +>>> frame.f_code.co_name +'bar' +>>> # Its back pointer refers to the frame for 'foo'. +>>> caller_frame = frame.f_back +>>> caller_frame.f_code.co_name +'foo' +``` + +![Figure 5.1 - Function Calls](http://aosabook.org/en/500L/crawler-images/function-calls.png) + +现在该说 Python 生成器了,它使用同样构件——代码对象和栈帧——去完成一个不可思议的任务。 + +这是一个生成器函数: + +```python +>>> def gen_fn(): +... result = yield 1 +... print('result of yield: {}'.format(result)) +... result2 = yield 2 +... print('result of 2nd yield: {}'.format(result2)) +... return 'done' +... +``` + +在 Python 把 `gen_fn` 编译成字节码的过程中,一旦它看到 `yield` 语句就知道这是一个生成器函数而不是普通的函数。它就会设置一个标志来记住这个事实: + +```python +>>> # The generator flag is bit position 5. +>>> generator_bit = 1 << 5 +>>> bool(gen_fn.__code__.co_flags & generator_bit) +True +``` + +当你调用一个生成器函数,Python 看到这个标志,就不会实际运行它而是创建一个生成器: + +```python +>>> gen = gen_fn() +>>> type(gen) + +``` + +Python 生成器封装了一个栈帧和函数体代码的引用: + +```python +>>> gen.gi_code.co_name +'gen_fn' +``` + +所有通过调用 `gen_fn` 的生成器指向同一段代码,但都有各自的栈帧。这些栈帧不再任何一个C函数栈中,而是在堆空间中等待被使用: + +![Figure 5.2 - Generators](http://aosabook.org/en/500L/crawler-images/generator.png) + +栈帧中有一个指向“最后执行指令”的指针。初始化为 -1,意味着它没开始运行: + +```python +>>> gen.gi_frame.f_lasti +-1 +``` + +当我们调用 `send` 时,生成器一直运行到第一个 `yield` 语句处停止,并且 `send` 返回 1,因为这是 `gen` 传递给 `yield` 表达式的值。 + +```python +>>> gen.send(None) +1 +``` + +现在,生成器的指令指针是 3,所编译的Python 字节码一共有 56 个字节: + +```python +>>> gen.gi_frame.f_lasti +3 +>>> len(gen.gi_code.co_code) +56 +``` + +这个生成器可以在任何时候、任何函数中恢复运行,因为它的栈帧并不在真正的栈中,而是堆中。在调用链中它的位置也是不固定的,它不必遵循普通函数先进后出的顺序。它像云一样自由。 + +我们可以传递一个值 `hello` 给生成器,它会成为 `yield` 语句的结果,并且生成器会继续运行到第二个 `yield` 语句处。 + +```python +>>> gen.send('hello') +result of yield: hello +2 +``` + +现在栈帧中包含局部变量 `result`: + +```python +>>> gen.gi_frame.f_locals +{'result': 'hello'} +``` + +其它从 `gen_fn` 创建的生成器有着它自己的栈帧和局部变量。 + +当我们再一次调用 `send`,生成器继续从第二个 `yield` 开始运行,以抛出一个特殊的 `StopIteration` 异常为结束。 + +```python +>>> gen.send('goodbye') +result of 2nd yield: goodbye +Traceback (most recent call last): + File "", line 1, in +StopIteration: done +``` + +这个异常有一个值 `"done"`,它就是生成器的返回值。 + +### 使用生成器构建协程 + +所以生成器可以暂停,可以给它一个值让它恢复,并且它还有一个返回值。这些特性看起来很适合去建立一个不使用那种乱糟糟的意面似的回调异步编程模型。我们想创造一个这样的“协程”:一个在程序中可以和其他过程合作调度的过程。我们的协程将会是标准库 `asyncio` 中协程的一个简化版本,我们将使用生成器,futures 和 `yield from` 语句。 + +首先,我们需要一种方法去代表协程所需要等待的 future 事件。一个简化的版本是: + +```python +class Future: + def __init__(self): + self.result = None + self._callbacks = [] + + def add_done_callback(self, fn): + self._callbacks.append(fn) + + def set_result(self, result): + self.result = result + for fn in self._callbacks: + fn(self) +``` + +一个 future 初始化为“未解决的”,它通过调用 `set_result` 来“解决”。(这个 future 缺少很多东西,比如说,当这个 future 解决后,生成(yield)的协程应该马上恢复而不是暂停,但是在我们的代码中却不没有这样做。参见 asyncio 的 Future 类以了解其完整实现。) + +让我们用 future 和协程来改写我们的 fetcher。我们之前用回调写的 `fetch` 如下: + +```python +class Fetcher: + def fetch(self): + self.sock = socket.socket() + self.sock.setblocking(False) + try: + self.sock.connect(('xkcd.com', 80)) + except BlockingIOError: + pass + selector.register(self.sock.fileno(), + EVENT_WRITE, + self.connected) + + def connected(self, key, mask): + print('connected!') + # And so on.... +``` + +`fetch` 方法开始连接一个套接字,然后注册 `connected` 回调函数,它会在套接字建立连接后调用。现在我们使用协程把这两步合并: + +```python + def fetch(self): + sock = socket.socket() + sock.setblocking(False) + try: + sock.connect(('xkcd.com', 80)) + except BlockingIOError: + pass + + f = Future() + + def on_connected(): + f.set_result(None) + + selector.register(sock.fileno(), + EVENT_WRITE, + on_connected) + yield f + selector.unregister(sock.fileno()) + print('connected!') +``` + +现在,`fetch` 是一个生成器,因为它有一个 `yield` 语句。我们创建一个未决的 future,然后 yield 它,暂停 `fetch` 直到套接字连接建立。内联函数 `on_connected` 解决这个 future。 + +但是当 future 被解决,谁来恢复这个生成器?我们需要一个协程*驱动器*。让我们叫它 “task”: + +```python +class Task: + def __init__(self, coro): + self.coro = coro + f = Future() + f.set_result(None) + self.step(f) + + def step(self, future): + try: + next_future = self.coro.send(future.result) + except StopIteration: + return + + next_future.add_done_callback(self.step) + +# Begin fetching http://xkcd.com/353/ +fetcher = Fetcher('/353/') +Task(fetcher.fetch()) + +loop() +``` + +task 通过传递一个 None 值给 `fetch` 来启动它。`fetch` 运行到它 yeild 出一个 future,这个 future 被作为 `next_future` 而捕获。当套接字连接建立,事件循环运行回调函数 `on_connected`,这里 future 被解决,`step` 被调用,`fetch` 恢复运行。 + +### 用 yield from 重构协程 + +一旦套接字连接建立,我们就可以发送 HTTP GET 请求,然后读取服务器响应。不再需要哪些分散在各处的回调函数,我们把它们放在同一个生成器函数中: + +```python + def fetch(self): + # ... connection logic from above, then: + sock.send(request.encode('ascii')) + + while True: + f = Future() + + def on_readable(): + f.set_result(sock.recv(4096)) + + selector.register(sock.fileno(), + EVENT_READ, + on_readable) + chunk = yield f + selector.unregister(sock.fileno()) + if chunk: + self.response += chunk + else: + # Done reading. + break +``` + +从套接字中读取所有信息的代码看起来很通用。我们能不把它从 `fetch` 中提取成一个子过程?现在该 Python 3 热捧的 `yield from` 登场了。它能让一个生成器*委派*另一个生成器。 + +让我们先回到原来那个简单的生成器例子: + +```python +>>> def gen_fn(): +... result = yield 1 +... print('result of yield: {}'.format(result)) +... result2 = yield 2 +... print('result of 2nd yield: {}'.format(result2)) +... return 'done' +... +``` + +为了从其他生成器调用这个生成器,我们使用 `yield from` 委派它: + +```python +>>> # Generator function: +>>> def caller_fn(): +... gen = gen_fn() +... rv = yield from gen +... print('return value of yield-from: {}' +... .format(rv)) +... +>>> # Make a generator from the +>>> # generator function. +>>> caller = caller_fn() +``` + +这个 `caller` 生成器的行为的和它委派的生成器 `gen` 表现的完全一致: + +```python +>>> caller.send(None) +1 +>>> caller.gi_frame.f_lasti +15 +>>> caller.send('hello') +result of yield: hello +2 +>>> caller.gi_frame.f_lasti # Hasn't advanced. +15 +>>> caller.send('goodbye') +result of 2nd yield: goodbye +return value of yield-from: done +Traceback (most recent call last): + File "", line 1, in +StopIteration +``` + +当 `caller` 自 `gen` 生成(`yield`),`caller` 就不再前进。注意到 `caller` 的指令指针保持15不变,就是 `yield from` 的地方,即使内部的生成器 `gen` 从一个 yield 语句运行到下一个 yield,它始终不变。(事实上,这就是“yield from”在 CPython 中工作的具体方式。函数会在执行每个语句之前提升其指令指针。但是在外部生成器执行“yield from”后,它会将其指令指针减一,以保持其固定在“yield form”语句上。然后其生成其 caller。这个循环不断重复,直到内部生成器抛出 StopIteration,这里指向外部生成器最终允许它自己进行到下一条指令的地方。)从 `caller` 外部来看,我们无法分辨 yield 出的值是来自 `caller` 还是它委派的生成器。而从 `gen` 内部来看,我们也不能分辨传给它的值是来自 `caller` 还是 `caller` 的外面。`yield from` 语句是一个光滑的管道,值通过它进出 `gen`,一直到 `gen` 结束。 + +协程可以用 `yield from` 把工作委派给子协程,并接收子协程的返回值。注意到上面的 `caller` 打印出“return value of yield-from: done”。当 `gen` 完成后,它的返回值成为 `caller` 中 `yield from` 语句的值。 + +```python + rv = yield from gen +``` + +前面我们批评过基于回调的异步编程模式,其中最大的不满是关于 “堆栈撕裂(stack ripping)”:当一个回调抛出异常,它的堆栈回溯通常是毫无用处的。它只显示出事件循环运行了它,而没有说为什么。那么协程怎么样? + +```python +>>> def gen_fn(): +... raise Exception('my error') +>>> caller = caller_fn() +>>> caller.send(None) +Traceback (most recent call last): + File "", line 1, in + File "", line 3, in caller_fn + File "", line 2, in gen_fn +Exception: my error +``` + +这还是非常有用的,当异常抛出时,堆栈回溯显示出 `caller_fn` 委派了 `gen_fn`。令人更欣慰的是,你可以在一次异常处理器中封装这个调用到一个子过程中,像正常函数一样: + +```python +>>> def gen_fn(): +... yield 1 +... raise Exception('uh oh') +... +>>> def caller_fn(): +... try: +... yield from gen_fn() +... except Exception as exc: +... print('caught {}'.format(exc)) +... +>>> caller = caller_fn() +>>> caller.send(None) +1 +>>> caller.send('hello') +caught uh oh +``` + +所以我们可以像提取子过程一样提取子协程。让我们从 fetcher 中提取一些有用的子协程。我们先写一个可以读一块数据的协程 `read`: + +```python +def read(sock): + f = Future() + + def on_readable(): + f.set_result(sock.recv(4096)) + + selector.register(sock.fileno(), EVENT_READ, on_readable) + chunk = yield f # Read one chunk. + selector.unregister(sock.fileno()) + return chunk +``` + +在 `read` 的基础上,`read_all` 协程读取整个信息: + +```python +def read_all(sock): + response = [] + # Read whole response. + chunk = yield from read(sock) + while chunk: + response.append(chunk) + chunk = yield from read(sock) + + return b''.join(response) +``` + +如果你换个角度看,抛开 `yield form` 语句的话,它们就像在做阻塞 I/O 的普通函数一样。但是事实上,`read` 和 `read_all` 都是协程。`yield from` `read` 暂停 `read_all` 直到 I/O 操作完成。当 `read_all` 暂停时,asyncio 的事件循环正在做其它的工作并等待其他的 I/O 操作。`read` 在下次循环中当事件就绪,完成 I/O 操作时,`read_all` 恢复运行。 + +最终,`fetch` 调用了 `read_all`: + +```python +class Fetcher: + def fetch(self): + # ... connection logic from above, then: + sock.send(request.encode('ascii')) + self.response = yield from read_all(sock) +``` + +神奇的是,Task 类不需要做任何改变,它像以前一样驱动外部的 `fetch` 协程: + +```python +Task(fetcher.fetch()) +loop() +``` + +当 `read` yield 一个 future 时,task 从 `yield from` 管道中接收它,就像这个 future 直接从 `fetch` yield 一样。当循环解决一个 future 时,task 把它的结果送给 `fetch`,通过管道,`read` 接受到这个值,这完全就像 task 直接驱动 `read` 一样: + +![Figure 5.3 - Yield From](http://aosabook.org/en/500L/crawler-images/yield-from.png) + +为了完善我们的协程实现,我们再做点打磨:当等待一个 future 时,我们的代码使用 yield;而当委派一个子协程时,使用 yield from。不管是不是协程,我们总是使用 yield form 会更精炼一些。协程并不需要在意它在等待的东西是什么类型。 + +在 Python 中,我们从生成器和迭代器的高度相似中获得了好处,将生成器进化成 caller,迭代器也可以同样获得好处。所以,我们可以通过特殊的实现方式来迭代我们的 Future 类: + +```python + # Method on Future class. + def __iter__(self): + # Tell Task to resume me here. + yield self + return self.result +``` + +future 的 `__iter__` 方法是一个 yield 它自身的一个协程。当我们将代码替换如下时: + +```python +# f is a Future. +yield f +``` + +以及……: + +```python +# f is a Future. +yield from f +``` + +……结果是一样的!驱动 Task 从它的调用 `send` 中接收 future,并当 future 解决后,它发回新的结果给该协程。 + +在每个地方都使用 `yield from` 的好处是什么?为什么比用 `field` 等待 future 并用 `yield from` 委派子协程更好?之所以更好的原因是,一个方法可以自由地改变其实行而不影响到其调用者:它可以是一个当 future 解决后返回一个值的普通方法,也可以是一个包含 `yield from` 语句并返回一个值的协程。无论是哪种情况,调用者仅需要 `yield from` 该方法以等待结果就行。 + +亲爱的读者,我们已经完成了对 asyncio 协程探索。我们深入观察了生成器的机制,实现了简单的 future 和 task。我们指出协程是如何利用两个世界的优点:比线程高效、比回调清晰的并发 I/O。当然真正的 asyncio 比我们这个简化版本要复杂的多。真正的框架需要处理zero-copy I/0、公平调度、异常处理和其他大量特性。 + +使用 asyncio 编写协程代码比你现在看到的要简单的多。在前面的代码中,我们从基本原理去实现协程,所以你看到了回调,task 和 future,甚至非阻塞套接字和 `select` 调用。但是当用 asyncio 编写应用,这些都不会出现在你的代码中。我们承诺过,你可以像这样下载一个网页: + +```python + @asyncio.coroutine + def fetch(self, url): + response = yield from self.session.get(url) + body = yield from response.read() +``` + +对我们的探索还满意么?回到我们原始的任务:使用 asyncio 写一个网络爬虫。 + +### 使用协程 + +我们将从描述爬虫如何工作开始。现在是时候用 asynio 去实现它了。 + +我们的爬虫从获取第一个网页开始,解析出链接并把它们加到队列中。此后它开始傲游整个网站,并发地获取网页。但是由于客户端和服务端的负载限制,我们希望有一个最大数目的运行的 worker,不能再多。任何时候一个 worker 完成一个网页的获取,它应该立即从队列中取出下一个链接。我们会遇到没有那么多事干的时候,所以一些 worker 必须能够暂停。一旦又有 worker 获取一个有很多链接的网页,队列会突增,暂停的 worker 立马被唤醒干活。最后,当任务完成后我们的程序必须马上退出。 + +假如你的 worker 是线程,怎样去描述你的爬虫算法?我们可以使用 Python 标准库中的[同步队列](https://docs.python.org/3/library/queue.html)。每次有新的一项加入,队列增加它的 “tasks” 计数器。线程 worker 完成一个任务后调用 `task_done`。主线程阻塞在 `Queue.join`,直到“tasks”计数器与 `task_done` 调用次数相匹配,然后退出。 + +协程通过 asyncio 队列,使用和线程一样的模式来实现!首先我们[导入它](https://docs.python.org/3/library/asyncio-sync.html): + +```python +try: + from asyncio import JoinableQueue as Queue +except ImportError: + # In Python 3.5, asyncio.JoinableQueue is + # merged into Queue. + from asyncio import Queue +``` + +我们把 worker 的共享状态收集在一个 crawler 类中,主要的逻辑写在 `crawl` 方法中。我们在一个协程中启动 `crawl`,运行 asyncio 的事件循环直到 `crawl` 完成: + +```python +loop = asyncio.get_event_loop() + +crawler = crawling.Crawler('http://xkcd.com', + max_redirect=10) + +loop.run_until_complete(crawler.crawl()) +``` + +crawler 用一个根 URL 和最大重定向数 `max_redirect` 来初始化,它把 `(URL, max_redirect)` 序对放入队列中。(为什么要这样做,请看下文) + +```python +class Crawler: + def __init__(self, root_url, max_redirect): + self.max_tasks = 10 + self.max_redirect = max_redirect + self.q = Queue() + self.seen_urls = set() + + # aiohttp's ClientSession does connection pooling and + # HTTP keep-alives for us. + self.session = aiohttp.ClientSession(loop=loop) + + # Put (URL, max_redirect) in the queue. + self.q.put((root_url, self.max_redirect)) +``` + +现在队列中未完成的任务数是 1。回到我们的主程序,启动事件循环和 `crawl` 方法: + +```python +loop.run_until_complete(crawler.crawl()) +``` +`crawl` 协程把 worker 们赶起来干活。它像一个主线程:阻塞在 `join` 上直到所有任务完成,同时 worker 们在后台运行。 + +```python + @asyncio.coroutine + def crawl(self): + """Run the crawler until all work is done.""" + workers = [asyncio.Task(self.work()) + for _ in range(self.max_tasks)] + + # When all work is done, exit. + yield from self.q.join() + for w in workers: + w.cancel() +``` + +如果 worker 是线程,可能我们不会一次把它们全部创建出来。为了避免创建线程的昂贵代价,通常一个线程池会按需增长。但是协程很廉价,我们可以直接把他们全部创建出来。 + +怎么关闭这个 `crawler` 很有趣。当 `join` 完成,worker 存活但是被暂停:他们等待更多的 URL,所以主协程要在退出之前清除它们。否则 Python 解释器关闭并调用所有对象的析构函数时,活着的 worker 会哭喊到: + +``` +ERROR:asyncio:Task was destroyed but it is pending! +``` + +`cancel` 又是如何工作的呢?生成器还有一个我们还没介绍的特点。你可以从外部抛一个异常给它: + + +```python +>>> gen = gen_fn() +>>> gen.send(None) # Start the generator as usual. +1 +>>> gen.throw(Exception('error')) +Traceback (most recent call last): + File "", line 3, in + File "", line 2, in gen_fn +Exception: error +``` + +生成器被 `throw` 恢复,但是它现在抛出一个异常。如过生成器的调用堆栈中没有捕获异常的代码,这个异常被传递到顶层。所以注销一个协程: + +```python + # Method of Task class. + def cancel(self): + self.coro.throw(CancelledError) +``` + +任何时候生成器暂停,在某些 `yield from` 语句它恢复并且抛出一个异常。我们在 task 的 `step` 方法中处理注销。 + +```python + # Method of Task class. + def step(self, future): + try: + next_future = self.coro.send(future.result) + except CancelledError: + self.cancelled = True + return + except StopIteration: + return + + next_future.add_done_callback(self.step) +``` + +现在 task 知道它被注销了,所以当它被销毁时,它不再抱怨。 + +一旦 `crawl` 注销了 worker,它就退出。同时事件循环看见这个协程结束了(我们后面会见到的),也就退出。 + +```python +loop.run_until_complete(crawler.crawl()) +``` + +`crawl` 方法包含了所有主协程需要做的事。而 worker 则完成从队列中获取 URL、获取网页、解析它们得到新的链接。每个 worker 独立地运行 `work` 协程: + +```python + @asyncio.coroutine + def work(self): + while True: + url, max_redirect = yield from self.q.get() + + # Download page and add new links to self.q. + yield from self.fetch(url, max_redirect) + self.q.task_done() +``` + +Python 看见这段代码包含 `yield from` 语句,就把它编译成生成器函数。所以在 `crawl` 方法中,我们调用了 10 次 `self.work`,但并没有真正执行,它仅仅创建了 10 个指向这段代码的生成器对象并把它们包装成 Task 对象。task 接收每个生成器所 yield 的 future,通过调用 `send` 方法,当 future 解决时,用 future 的结果做为 `send` 的参数,来驱动它。由于生成器有自己的栈帧,它们可以独立运行,带有独立的局部变量和指令指针。 + +worker 使用队列来协调其小伙伴。它这样等待新的 URL: + +```python + url, max_redirect = yield from self.q.get() +``` + +队列的 `get` 方法自身也是一个协程,它一直暂停到有新的 URL 进入队列,然后恢复并返回该条目。 + +碰巧,这也是当主协程注销 worker 时,最后 crawl 停止,worker 协程暂停的地方。从协程的角度,`yield from` 抛出`CancelledError` 结束了它在循环中的最后旅程。 + +worker 获取一个网页,解析链接,把新的链接放入队列中,接着调用`task_done`减小计数器。最终一个worker遇到一个没有新链接的网页,并且队列里也没有任务,这次`task_done`的调用使计数器减为0,而`crawl`正阻塞在`join`方法上,现在它就可以结束了。 + +我们承诺过要解释为什么队列中要使用序对,像这样: + +```python +# URL to fetch, and the number of redirects left. +('http://xkcd.com/353', 10) +``` + +新的 URL 的重定向次数是10。获取一个特别的 URL 会重定向一个新的位置。我们减小重定向次数,并把新的 URL 放入队列中。 + +```python +# URL with a trailing slash. Nine redirects left. +('http://xkcd.com/353/', 9) +``` + +我们使用的 `aiohttp` 默认会跟踪重定向并返回最终结果。但是,我们告诉它不要这样做,爬虫自己来处理重定向,以便它可以合并那些目的相同的重定向路径:如果我们已经在 `self.seen_urls` 看到一个 URL,说明它已经从其他的地方走过这条路了。 + +![Figure 5.4 - Redirects](http://aosabook.org/en/500L/crawler-images/redirects.png) + +crawler 获取“foo”并发现它重定向到了“baz”,所以它会加“baz”到队列和 `seen_urls` 中。如果它获取的下一个页面“bar” 也重定向到“baz”,fetcher 不会再次将 “baz”加入到队列中。如果该响应是一个页面,而不是一个重定向,`fetch` 会解析它的链接,并把新链接放到队列中。 + +```python + @asyncio.coroutine + def fetch(self, url, max_redirect): + # Handle redirects ourselves. + response = yield from self.session.get( + url, allow_redirects=False) + + try: + if is_redirect(response): + if max_redirect > 0: + next_url = response.headers['location'] + if next_url in self.seen_urls: + # We have been down this path before. + return + + # Remember we have seen this URL. + self.seen_urls.add(next_url) + + # Follow the redirect. One less redirect remains. + self.q.put_nowait((next_url, max_redirect - 1)) + else: + links = yield from self.parse_links(response) + # Python set-logic: + for link in links.difference(self.seen_urls): + self.q.put_nowait((link, self.max_redirect)) + self.seen_urls.update(links) + finally: + # Return connection to pool. + yield from response.release() +``` + +如果这是多进程代码,就有可能遇到讨厌的竞争条件。比如,一个 worker 检查一个链接是否在 `seen_urls` 中,如果没有它就把这个链接加到队列中并把它放到 `seen_urls` 中。如果它在这两步操作之间被中断,而另一个 worker 解析到相同的链接,发现它并没有出现在 `seen_urls` 中就把它加入队列中。这(至少)导致同样的链接在队列中出现两次,做了重复的工作和错误的统计。 + +然而,一个协程只在 `yield from` 时才会被中断。这是协程比多线程少遇到竞争条件的关键。多线程必须获得锁来明确的进入一个临界区,否则它就是可中断的。而 Python 的协程默认是不会被中断的,只有它明确 yield 时才主动放弃控制权。 + +我们不再需要在用回调方式时用的 fetcher 类了。这个类只是不高效回调的一个变通方法:在等待 I/O 时,它需要一个存储状态的地方,因为局部变量并不能在函数调用间保留。倒是 `fetch` 协程可以像普通函数一样用局部变量保存它的状态,所以我们不再需要一个类。 + +当 `fetch` 完成对服务器响应的处理,它返回到它的调用者 `work`。`work` 方法对队列调用 `task_done`,接着从队列中取出一个要获取的 URL。 + +当 `fetch` 把新的链接放入队列中,它增加未完成的任务计数器,并停留在主协程,主协程在等待 `q.join`,处于暂停状态。而当没有新的链接并且这是队列中最后一个 URL 时,当 `work 调用 `task_done`,任务计数器变为 0,主协程从 `join` 中退出。 + +与 worker 和主协程一起工作的队列代码像这样(实际的 `asyncio.Queue` 实现在 Future 所展示的地方使用 `asyncio.Event` 。不同之处在于 Event 是可以重置的,而 Future 不能从已解决返回变成待决。) + +```python +class Queue: + def __init__(self): + self._join_future = Future() + self._unfinished_tasks = 0 + # ... other initialization ... + + def put_nowait(self, item): + self._unfinished_tasks += 1 + # ... store the item ... + + def task_done(self): + self._unfinished_tasks -= 1 + if self._unfinished_tasks == 0: + self._join_future.set_result(None) + + @asyncio.coroutine + def join(self): + if self._unfinished_tasks > 0: + yield from self._join_future +``` + +主协程 `crawl` yield from `join`。所以当最后一个 worker 把计数器减为 0,它告诉 `crawl` 恢复运行并结束。 + +旅程快要结束了。我们的程序从 `crawl` 调用开始: + +```python +loop.run_until_complete(self.crawler.crawl()) +``` + +程序如何结束?因为 `crawl` 是一个生成器函数,调用它返回一个生成器。为了驱动它,asyncio 把它包装成一个 task: + +```python +class EventLoop: + def run_until_complete(self, coro): + """Run until the coroutine is done.""" + task = Task(coro) + task.add_done_callback(stop_callback) + try: + self.run_forever() + except StopError: + pass + +class StopError(BaseException): + """Raised to stop the event loop.""" + +def stop_callback(future): + raise StopError +``` + +当这个任务完成,它抛出 `StopError`,事件循环把这个异常当作正常退出的信号。 + +但是,task 的 `add_done_callbock` 和 `result` 方法又是什么呢?你可能认为 task 就像一个 future,不错,你的直觉是对的。我们必须承认一个向你隐藏的细节,task 是 future。 + +```python +class Task(Future): + """A coroutine wrapped in a Future.""" +``` + +通常,一个 future 被别人调用 `set_result` 解决。但是 task,当协程结束时,它自己解决自己。记得我们解释过当 Python 生成器返回时,它抛出一个特殊的 `StopIteration` 异常: + +```python + # Method of class Task. + def step(self, future): + try: + next_future = self.coro.send(future.result) + except CancelledError: + self.cancelled = True + return + except StopIteration as exc: + + # Task resolves itself with coro's return + # value. + self.set_result(exc.value) + return + + next_future.add_done_callback(self.step) +``` + +所以当事件循环调用 `task.add_done_callback(stop_callback)`,它就准备被这个 task 停止。在看一次`run_until_complete`: + +```python + # Method of event loop. + def run_until_complete(self, coro): + task = Task(coro) + task.add_done_callback(stop_callback) + try: + self.run_forever() + except StopError: + pass +``` + +当 task 捕获 `StopIteration` 并解决自己,这个回调从循环中抛出 `StopError`。循环结束,调用栈回到`run_until_complete`。我们的程序结束。 + +### 总结 + +现代的程序越来越多是 I/O 密集型而不是 CPU 密集型。对于这样的程序,Python 的线程在两个方面不合适:全局解释器锁阻止真正的并行计算,并且抢占切换也导致他们更容易出现竞争。异步通常是正确的选择。但是随着基于回调的异步代码增加,它会变得非常混乱。协程是一个更整洁的替代者。它们自然地重构成子过程,有健全的异常处理和栈追溯。 + +如果我们换个角度看 `yield from` 语句,一个协程看起来像一个传统的做阻塞 I/O 的线程。甚至我们可以采用经典的多线程模式编程,不需要重新发明。因此,与回调相比,协程更适合有经验的多线程的编码者。 + +但是当我们睁开眼睛关注 `yield from` 语句,我们能看到协程放弃控制权、允许其它人运行的标志点。不像多线程,协程展示出我们的代码哪里可以被中断哪里不能。在 Glyph Lefkowitz 富有启发性的文章“[Unyielding](https://glyph.twistedmatrix.com/2014/02/unyielding.html)”:“线程让局部推理变得困难,然而局部推理可能是软件开发中最重要的事”。然而,明确的 yield,让“通过过程本身而不是整个系统理解它的行为(和因此、正确性)”成为可能。 + +这章写于 Python 和异步的复兴时期。你刚学到的基于生成器的的协程,在 2014 年发布在 Python 3.4 的 asyncio 模块中。2015 年 9 月,Python 3.5 发布,协程成为语言的一部分。这个原生的协程通过“async def”来声明, 使用“await”而不是“yield from”委托一个协程或者等待 Future。 + +除了这些优点,核心的思想不变。Python 新的原生协程与生成器只是在语法上不同,工作原理非常相似。事实上,在 Python 解释器中它们共用同一个实现方法。Task、Future 和事件循环在 asynico 中扮演着同样的角色。 + +你已经知道 asyncio 协程是如何工作的了,现在你可以忘记大部分的细节。这些机制隐藏在一个整洁的接口下。但是你对这基本原理的理解能让你在现代异步环境下正确而高效的编写代码。 + +-------------------------------------- +via: http://aosabook.org/en/500L/pages/a-web-crawler-with-asyncio-coroutines.html + +作者:A. Jesse Jiryu Davis , Guido van Rossum +译者:[qingyunha](https://github.com/qingyunha) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/20161018 Suspend to Idle.md b/published/20161018 Suspend to Idle.md new file mode 100644 index 0000000000..62a9f9b81c --- /dev/null +++ b/published/20161018 Suspend to Idle.md @@ -0,0 +1,146 @@ +浅述内核中“挂起到空闲”的实现 +=============== + +### 简介 + +Linux 内核提供了多种睡眠状态,各个状态通过设置系统中的不同部件进入低耗电模式来节约能源。目前总共有四种睡眠状态,分别是:挂起到空闲(suspend to idle)、加电待机(power-on standby(standby))、挂起到内存(suspend to ram)和挂起到磁盘(suspend to disk)。这些状态分别对应 ACPI 的 4 种状态:S0,S1,S3 和 S4。挂起到空闲(suspend to idle)是纯软件实现的,用于将 CPU 维持在尽可能深的 idle 状态。加电待机(power-on standby(standby))则使设备处于低功耗状态,并且关闭所有非引导 CPU。挂起到内存(suspend to ram)就更进一步,关闭所有 CPU 并且设置 RAM 进入自刷新模式。挂起到磁盘(suspend to disk)则是最省功耗的模式,关闭尽可能多的系统,包括关闭内存。然后内存中的内容会被写到硬盘,待唤醒计算机的时候将硬盘中的内容重新恢复到内存中。 + +这篇博文主要介绍挂起到空闲(suspend to idle)的实现。如上所说,它主要通过软件实现。一般平台的挂起过程包括冻结用户空间并将外围设备调至低耗电模式。但是,系统并不是直接关闭和热插拔掉 CPU,而是静静地强制将 CPU 进入空闲(idle)状态。随着外围设备进入了低耗电模式,除了唤醒相关的中断外不应有其他中断产生。唤醒中断包括那些设置用于唤醒系统的计时器(比如 RTC,普通计时器等)、或者电源开关、USB 和其它外围设备等。 + +在冻结过程中,当系统进入空闲状态时会调用一个特殊的 cpu 空闲函数。这个 `enter_freeze()` 函数可以和调用使 cpu 空闲的 `enter()` 函数一样简单,也可以复杂得多。该函数复杂的程度由将 SoC 置为低耗电模式的条件和方法决定。 + +### 先决条件 + +#### `platform_suspend_ops` + +一般情况,为了支持 S2I,系统必须实现 `platform_suspend_ops` 并提供最低限度的挂起支持。这意味着至少要完成 `platform_suspend_ops` 中的 `valid()` 函数。如果挂起到空闲(suspend to idle)和挂起到内存(suspend to ram)都要支持,valid 函数中应使用 `suspend_valid_only_mem`。 + +不过,最近内核增加了对 S2I 的自动支持。Sudeep Holla 提出了一个变更,可以让系统不需要满足 `platform_suspend_ops` 条件也能提供 S2I 支持。这个补丁已经被接收并将合并在 4.9 版本中,该补丁可从这里获取: [https://lkml.org/lkml/2016/8/19/474][1]。 + +如果定义了 `suspend_ops`,那么可以通过查看 `/sys/power/state` 文件得知系统具体支持哪些挂起状态。如下操作: + +``` +# cat /sys/power/state +freeze mem +``` + +这个示例的结果显示该平台支持 S0(挂起到空闲(suspend to idle))和 S3(挂起到内存(suspend to ram))。按 Sudeep 的变更,那些没有实现 `platform_suspend_ops` 的平台将只显示 freeze 状态。 + +#### 唤醒中断 + +一旦系统处于某种睡眠状态,系统必须要接收某个唤醒事件才能恢复系统。这些唤醒事件一般由系统的设备产生。因此一定要确保这些设备驱动使用唤醒中断,并且将自身配置为接收唤醒中断后产生唤醒事件。如果没有正确识别唤醒设备,系统收到中断后会继续保持睡眠状态而不会恢复。 + +一旦设备正确实现了唤醒接口的调用,就可用来生成唤醒事件。请确保 DT 文件正确配置了唤醒源。下面是一个配置唤醒源示例,该文件来自(`arch/arm/boot/dst/am335x-evm.dts`): + +``` + gpio_keys: volume_keys@0 { + compatible = “gpio-keys”; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + switch@9 { + label = “volume-up”; + linux,code = <115>; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + wakeup-source; + }; + + switch@10 { + label = “volume-down”; + linux,code = <114>; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + wakeup-source; + }; + }; +``` +如上所示,有两个 gpio 键被配置为唤醒源,在系统挂起期间,其中任何一个键被按下都会产生一个唤醒事件。 + +可替代 DT 文件配置的另一个唤醒源配置就是设备驱动,如果设备驱动自身在代码里面配置了唤醒支持,那么就会使用该默认唤醒配置。 + +### 实施 + +#### 冻结功能 + +如果系统希望能够充分使用挂起到空闲(suspend to idle),那么应该在 CPU 空闲驱动代码中定义 `enter_freeze()` 函数。`enter_freeze()` 与 `enter()` 的函数原型略有不同。因此,不能将 `enter()` 同时指定给 `enter` 和 `enter_freeze`。至少,系统会直接调用 `enter()`。如果没有定义 `enter_freeze()`,系统会挂起,但是不会触发那些只有当 `enter_freeze()` 定义了才会触发的函数,比如 `tick_freeze()` 和 `stop_critical_timing()` 都不会发生。这会导致计时器中断唤醒系统,但不会导致系统恢复,因为系统处理完中断后会继续挂起。 + +在挂起过程中,中断越少越好(最好一个也没有)。 + +下图显示了能耗和时间的对比。图中的两个尖刺分别是挂起和恢复。挂起前后的能耗尖刺是系统退出空闲态进行记录操作,进程调度,计时器处理等。因延迟的缘故,系统进入更深层次空闲状态需要花费一段时间。 + + ![blog-picture-one](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-one-1024x767.png) + +*能耗使用时序图* + +下图为 ftrace 抓取的 4 核 CPU 在系统挂起和恢复操作之前、之中和之后的活动。可以看到,在挂起期间,没有请求或者中断被处理。 + +![blog-picture-2](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-2-1024x577.png) + +*Ftrace 抓取的挂起/恢复活动图* + +#### 空闲状态 + +你必须确定哪个空闲状态支持冻结。在冻结期间,电源相关代码会决定用哪个空闲状态来实现冻结。这个过程是通过在每个空闲状态中查找谁定义了 `enter_freeze()` 来决定的。CPU 空闲驱动代码或者 SoC 挂起相关代码必须确定哪种空闲状态实现冻结操作,并通过给每个 CPU 的可应用空闲状态指定冻结功能来进行配置。 + +例如, Qualcomm 会在平台挂起代码的挂起初始化函数处定义 `enter_freeze` 函数。这个工作是在 CPU 空闲驱动已经初始化后进行,以便所有结构已经定义就位。 + +#### 挂起/恢复相关驱动支持 + +你可能会在第一次成功挂起操作后碰到驱动相关的 bug。很多驱动开发者没有精力完全测试挂起和恢复相关的代码。你甚至可能会发现挂起操作并没有多少工作可做,因为 `pm_runtime` 已经做了你要做的挂起相关的一切工作。由于用户空间已经被冻结,设备此时已经处于休眠状态并且 `pm_runtime` 已经被禁止。 + +### 测试相关 + +测试挂起到空闲(suspend to idle)可以手动进行,也可以使用脚本/进程等实现自动挂起、自动睡眠,或者使用像 Android 中的 `wakelock` 来让系统挂起。如果手动测试,下面的操作会将系统冻结。 + +``` +/ # echo freeze > /sys/power/state +[ 142.580832] PM: Syncing filesystems … done. +[ 142.583977] Freezing user space processes … (elapsed 0.001 seconds) done. +[ 142.591164] Double checking all user space processes after OOM killer disable… (elapsed 0.000 seconds) +[ 142.600444] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done. +[ 142.608073] Suspending console(s) (use no_console_suspend to debug) +[ 142.708787] mmc1: Reset 0x1 never completed. +[ 142.710608] msm_otg 78d9000.phy: USB in low power mode +[ 142.711379] PM: suspend of devices complete after 102.883 msecs +[ 142.712162] PM: late suspend of devices complete after 0.773 msecs +[ 142.712607] PM: noirq suspend of devices complete after 0.438 msecs +< system suspended > +…. +< wake irq triggered > +[ 147.700522] PM: noirq resume of devices complete after 0.216 msecs +[ 147.701004] PM: early resume of devices complete after 0.353 msecs +[ 147.701636] msm_otg 78d9000.phy: USB exited from low power mode +[ 147.704492] PM: resume of devices complete after 3.479 msecs +[ 147.835599] Restarting tasks … done. +/ # +``` + +在上面的例子中,需要注意 MMC 驱动的操作占了 102.883ms 中的 100ms。有些设备驱动在挂起的时候有很多工作要做,比如将数据刷出到硬盘,或者其他耗时的操作等。 + +如果系统定义了冻结(freeze),那么系统将尝试挂起操作,如果没有冻结功能,那么你会看到下面的提示: + +``` +/ # echo freeze > /sys/power/state +sh: write error: Invalid argument +/ # +``` + +### 未来的发展 + +目前在 ARM 平台上的挂起到空闲(suspend to idle)有两方面的工作需要做。第一方面工作在前面 `platform_suspend_ops` 小节中提到过,是总允许接受冻结状态以及合并到 4.9 版本内核中的工作。另一方面工作是冻结功能的支持。 + +如果你希望设备有更好的响应及表现,那么应该继续完善冻结功能的实现。然而,由于很多 SoC 会使用 ARM 的 CPU 空闲驱动,这使得 ARM 的 CPU 空闲驱动完善它自己的通用冻结功能的工作更有意义了。而事实上,ARM 正在尝试添加此通用支持。如果 SoC 供应商希望实现他们自己的 CPU 空闲驱动或者需要在进入更深层次的冻结休眠状态时提供额外的支持,那么只有实现自己的冻结功能。 + + +-------------------------------------------------------------------------------- + +via: http://www.linaro.org/blog/suspend-to-idle/ + +作者:[Andy Gross][a] +译者:[beyondworld](https://github.com/beyondworld) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linaro.org/author/andygross/ +[1]:https://lkml.org/lkml/2016/8/19/474 diff --git a/translated/tech/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md b/published/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md similarity index 64% rename from translated/tech/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md rename to published/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md index 9013125450..635e32f0f3 100644 --- a/translated/tech/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md +++ b/published/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md @@ -1,58 +1,59 @@ -Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4 +Samba 系列(四):在 Windows 下管理 Samba4 AD 域管制器 DNS 和组策略 ============================================================ -在 Windows 系统下管理 Samba4 AD 域管制器 DNS 和组策略(四) -接着前一篇教程写的关于[使用 Windows 10 系统的 RSAT 工具来管理 Samba4 活动目录架构][4],在这篇文章中我们将学习如何使用微软 DNS 管理器远程管理我们的 Samba AD 域控制器的 DNS 服务器,如何创建 DNS 记录,如何创建反向查找区域以及如何通过组策略管理工具来创建域策略。 +接着前一篇教程写的关于[使用 Windows 10 的 RSAT 工具来管理 Samba4 活动目录架构][4],在这篇文章中我们将学习如何使用微软 DNS 管理器远程管理我们的 Samba AD 域控制器的 DNS 服务器,如何创建 DNS 记录,如何创建反向查找区域以及如何通过组策略管理工具来创建域策略。 -#### 需求 +#### 要求 -1、 [在 Ubuntu16.04 系统上使用 Samba4 软件来创建活动目录架构(一)][1] -2、 [在 Linux 命令行下管理 Samba4 AD 架构(二)][2] -3、 [使用 Windows 10 系统的 RSAT 工具来管理 Samba4 活动目录架构 (三)][3] +1、 [在 Ubuntu 16.04 系统上使用 Samba4 软件来创建活动目录架构(一)][1] + +2、 [在 Linux 命令行下管理 Samba4 AD 架构(二)][2] + +3、 [使用 Windows 10 的 RSAT 工具来管理 Samba4 活动目录架构 (三)][3] ### 第 1 步:管理 Samba DNS 服务器 -Samba4 AD DC 使用内部的 DNS 解析模块,该模块在初始化域提供的过程中被创建完成(如果 BIND9 DLZ 模块未特定使用的情况下)。 +Samba4 AD DC 使用内部的 DNS 解析器模块,该模块在初始化域提供的过程中创建(如果 BIND9 DLZ 模块未指定使用的情况下)。 -Samba4 内部的 DNS 域模块支持 AD 域控制器所必须的基本功能。有两种方式来管理域 DNS 服务器,直接在命令行下通过 samba-tool 接口来管理,或者使用已加入域的微软工作站中的 RSAT DNS 管理器远程进行管理。 +Samba4 内部的 DNS 模块支持 AD 域控制器所必须的基本功能。有两种方式来管理域 DNS 服务器,直接在命令行下通过 samba-tool 接口来管理,或者使用已加入域的微软工作站中的 RSAT DNS 管理器远程进行管理。 在这篇文章中,我们使用第二种方式来进行管理,因为这种方式很直观,也不容易出错。 1、要使用 RSAT 工具来管理域控制器上的 DNS 服务器,在 Windows 机器上,打开控制面板 -> 系统和安全 -> 管理工具,然后运行 DNS 管理器工具。 -当打开这个工具时,它会询问你将要连接到哪台正在运行的 DNS 服务器。选择使用下面的计算机,输入域名(IP 地址或 FQDN 地址都可以使用),勾选‘现在连接到指定计算机’,然后单击 OK 按钮以开启 Samba DNS 服务。 +当打开这个工具时,它会询问你将要连接到哪台正在运行的 DNS 服务器。选择“使用下面的计算机”,输入域名(IP 地址或 FQDN 地址都可以使用),勾选“现在连接到指定计算机”,然后单击 OK 按钮以开启 Samba DNS 服务。 [ ![Connect Samba4 DNS on Windows](http://www.tecmint.com/wp-content/uploads/2016/12/Connect-Samba4-DNS-on-Windows.png) ][5] -在 Windows 系统上连接 Samba4 DNS 服务器 +*在 Windows 系统上连接 Samba4 DNS 服务器* -2、为了添加一条 DNS 记录(比如我们添加一条指向 LAN 网关的记录 ‘A'),打开 DNS 管理器,找到域正向查找区,在右侧单击右键选择新的主机(’A‘ 或 ’AAA‘)。 +2、为了添加一条 DNS 记录(比如我们添加一条指向 LAN 网关的 A 记录),打开 DNS 管理器,找到域正向查找区,在右侧单击右键选择新的主机(A 或 AAAA)。 [ ![Add DNS A Record on Windows](http://www.tecmint.com/wp-content/uploads/2016/12/Add-DNS-A-Record.png) ][6] -在 Windows 下添加一条 DNS 记录 +*在 Windows 下添加一条 DNS 记录* -3、在打开的新主机窗口界面,输入 DNS 服务器的主机名和 IP 地址。 DNS 管理器工具会自动填写完成 FQDN 地址。填写完成后,点击添加主机按钮,之后会弹出一个新的窗口提示你 DNS A 记录已经创建完成。 +3、在打开的新主机窗口界面,输入 DNS 服务器的主机名和 IP 地址。 DNS 管理器工具会自动填写完成 FQDN 地址。填写完成后,点击“添加主机”按钮,之后会弹出一个新的窗口提示你 DNS A 记录已经创建完成。 -确保你添加的 DNS A 记录是你们网络中的资源[已配置静态 IP][7]。不要为那些从 DHCP 服务器自动获取 IP 地址或者经常变换 IP 地址的主机添加 DNS A 记录。 +确保仅为你的网络中[已配置静态 IP][7]的资源(设备)添加 DNS A 记录。不要为那些从 DHCP 服务器自动获取 IP 地址或者经常变换 IP 地址的主机添加 DNS A 记录。 [ ![Configure Samba Host on Windows](http://www.tecmint.com/wp-content/uploads/2016/12/Configure-Samba-Host-on-Windows.png) ][8] -在 Windows 系统下配置 Samba 主机 +*在 Windows 系统下配置 Samba 主机* -要更新一条 DNS 记录只需要双击那条记录,然后输入更改原因即可。要删除一条记录时,只需要在这条记录上单击右键,选择从菜单删除即可。 +要更新一条 DNS 记录只需要双击那条记录,然后输入更改即可。要删除一条记录时,只需要在这条记录上单击右键,选择从菜单删除即可。 -同样的方式,你也可以为你的域添加其它类型的 DNS 记录,比如说 CNAME 记录(也称为 DNS 别名记录),MX 记录(在邮件服务器上非常有用)或者其它类型的记录(SPE、TXT、SRVetc类型)。 +同样的方式,你也可以为你的域添加其它类型的 DNS 记录,比如说 CNAME 记录(也称为 DNS 别名记录),MX 记录(在邮件服务器上非常有用)或者其它类型的记录(SPE、TXT、SRV 等类型)。 ### 第 2 步:创建反向查找区域 -默认情况下, Samba4 AD DC 不会自动为你的域添加一个反向查找区域和 PTR 记录,因为这些类型的记录对于域控制器的正常工作来说是无关紧要的。 +默认情况下,Samba4 AD DC 不会自动为你的域添加一个反向查找区域和 PTR 记录,因为这些类型的记录对于域控制器的正常工作来说是无关紧要的。 相反,DNS 反向区和 PTR 记录在一些重要的网络服务中显得非常有用,比如邮件服务,因为这些类型的记录可以用于验证客户端请求服务的身份。 @@ -64,56 +65,56 @@ Samba4 内部的 DNS 域模块支持 AD 域控制器所必须的基本功能。 ![Create Reverse Lookup DNS Zone](http://www.tecmint.com/wp-content/uploads/2016/12/Create-Reverse-Lookup-DNS-Zone.png) ][9] -创建 DNS 反向查找区域 +*创建 DNS 反向查找区域* -5、下一步,单击下一步按钮,然后从区域类型向导中选择主区域。 +5、下一步,单击下一步按钮,然后从区域类型向导中选择主区域(Primary)。 [ ![Select DNS Zone Type](http://www.tecmint.com/wp-content/uploads/2016/12/Select-DNS-Zone-Type.png) ][10] -选择 DNS 区域类型 +*选择 DNS 区域类型* -6、下一步,在 AD 区域复制范围中选择复制到该域里运行在域控制器上的所有的 DNS 服务器,选择 IPv4 反向查找区域然后单击下一步继续。 +6、下一步,在 “AD 区域复制范围”中选择复制到该域里运行在域控制器上的所有的 DNS 服务器,选择 “IPv4 反向查找区域”然后单击下一步继续。 [ ![Select DNS for Samba Domain Controller](http://www.tecmint.com/wp-content/uploads/2016/12/Select-DNS-for-Samba-Domain-Controller.png) ][11] -为 Samba 域控制器选择 DNS 服务器 +*为 Samba 域控制器选择 DNS 服务器* [ ![Add Reverse Lookup Zone Name](http://www.tecmint.com/wp-content/uploads/2016/12/Add-Reverse-Lookup-Zone-Name.png) ][12] -添加反向查找区域名 +*添加反向查找区域名* 7、下一步,在网络ID 框中输入你的 LAN IP 地址,然后单击下一步继续。 -资源在这个区域内添加的所有 PTR 记录仅指向 192.168.1.0/24 网络段。如果你想要为一个不在该网段中的服务器创建一个 PTR 记录(比如邮件服务器位于 10.0.0.0/24 这个网段的时候),那么你还得为那个网段创建一个新的反向查找区域。 +在这个区域内添加的所有资源(设备)的 PTR 记录仅能指向 192.168.1.0/24 网络段。如果你想要为一个不在该网段中的服务器创建一个 PTR 记录(比如邮件服务器位于 10.0.0.0/24 这个网段的时候),那么你还得为那个网段创建一个新的反向查找区域。 [ ![Add IP Address of Reverse Lookup DNS Zone](http://www.tecmint.com/wp-content/uploads/2016/12/Add-IP-Address-of-Reverse-DNS-Zone.png) ][13] -添加 DNS 反向查找区域的 IP 地址 +*添加 DNS 反向查找区域的 IP 地址* -8、在下一个截图中选择仅允许安全的动态更新,单击下一步继续,最后单击完成按钮以完成反向查找区域的创建。 +8、在下一个截图中选择“仅允许安全的动态更新”,单击下一步继续,最后单击完成按钮以完成反向查找区域的创建。 [ ![Enable Secure Dynamic Updates](http://www.tecmint.com/wp-content/uploads/2016/12/Enable-Secure-Dynamic-Updates.png) ][14] -启用安全动态更新 +*启用安全动态更新* [ ![New DNS Zone Summary](http://www.tecmint.com/wp-content/uploads/2016/12/New-DNS-Zone-Summary.png) ][15] -新 DNS 区域概述 +*新 DNS 区域概览* 9、此时,你已经为你的域环境创建完成了一个有效的 DNS 反向查找区域。为了在这个区域中添加一个 PTR 记录,在右侧右键单击,选择为网络资源创建一个 PTR 记录。 -这个时候,我们已经为网关创建了一个指向。为了测试这条记录对于客户端是否添加正确和工作正常,打开命令行提示符执行 nslookup 查询资源名,再执行另外一条命令查询 IP 地址。 +这个时候,我们已经为网关创建了一个指向。为了测试这条记录对于客户端是否添加正确和工作正常,打开命令行提示符执行 `nslookup` 查询资源名,再执行另外一条命令查询 IP 地址。 两个查询都应该为你的 DNS 资源返回正确的结果。 @@ -121,19 +122,21 @@ Samba4 内部的 DNS 域模块支持 AD 域控制器所必须的基本功能。 nslookup gate.tecmint.lan nslookup 192.168.1.1 ping gate -``` +``` + [ ![Add DNS PTR Record and Query PTR](http://www.tecmint.com/wp-content/uploads/2016/12/Add-DNS-PTR-Record-and-Query.png) ][16] -添加及查询 PTR 记录 +*添加及查询 PTR 记录* + ### 第 3 步:管理域控制策略 10、域控制器最重要的作用就是集中控制系统资源及安全。使用域控制器的域组策略功能很容易实现这些类型的任务。 遗憾的是,在 Samba 域控制器上唯一用来编辑或管理组策略的方法是通过微软的 RSAT GPM 工具。 -在下面的实例中,我们将看到通过组策略来实现在 Samba 域环境中为域用户创建一种交互式的登录方式是多么的简单。 +在下面的实例中,我们将看到通过组策略来实现在 Samba 域环境中为域用户创建一种交互式的登录提示是多么的简单。 要访问组策略控制台,打开控制面板 -> 系统和安全 -> 管理工具,然后打开组策略管理控制台。 @@ -143,9 +146,9 @@ ping gate ![Manage Samba Domain Group Policy](http://www.tecmint.com/wp-content/uploads/2016/12/Manage-Samba-Domain-Group-Policy.png) ][17] -管理 Samba 域组策略 +*管理 Samba 域组策略* -11、在组策略管理编辑器窗口中,进入到电脑配置 -> 组策略 -> Windows 设置 -> 安全设置 -> 本地策略 -> 安全选项,你将在右侧看到一个新的选项列表。 +11、在组策略管理编辑器窗口中,进入到计算机配置 -> 组策略 -> Windows 设置 -> 安全设置 -> 本地策略 -> 安全选项,你将在右侧看到一个新的选项列表。 在右侧查询并编辑你的定制化设置,参考下图中的两条设置内容。 @@ -153,7 +156,7 @@ ping gate ![Configure Samba Domain Group Policy](http://www.tecmint.com/wp-content/uploads/2016/12/Configure-Samba-Domain-Group-Policy.png) ][18] -配置 Samba 域组策略 +*配置 Samba 域组策略* 12、这两个条目编辑完成后,关闭所有窗口,打开 CMD 窗口,执行以下命令来强制应用组策略。 @@ -164,14 +167,15 @@ gpupdate /force ![Update Samba Domain Group Policy](http://www.tecmint.com/wp-content/uploads/2016/12/Update-Samba-Domain-Group-Policy.png) ][19] -更新 Samba 域组策略 +*更新 Samba 域组策略* + +13、最后,重启你的电脑,当你准备登录进入系统的时候,你就会看到登录提示生效了。 -13、最后,重启你的电脑,当你准备登录进入系统的时候,你就会看到登录提示生效了。 [ ![Samba4 AD Domain Controller Logon Banner](http://www.tecmint.com/wp-content/uploads/2016/12/Samba4-Domain-Controller-User-Login.png) ][20] -Samba4 AD 域控制器登录提示 +*Samba4 AD 域控制器登录提示* 就写到这里吧!组策略是一个操作起来很繁琐和很谨慎的主题,在管理系统的过程中你得非常的小心。还有,注意你设置的组策略不会以任何方式应用到已加入域的 Linux 系统中。 @@ -184,17 +188,17 @@ Samba4 AD 域控制器登录提示 via: http://www.tecmint.com/manage-samba4-dns-group-policy-from-windows/ -作者:[Matei Cezar ][a] +作者:[Matei Cezar][a] 译者:[rusking](https://github.com/rusking) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/cezarmatei/ -[1]:http://www.tecmint.com/install-samba4-active-directory-ubuntu/ -[2]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/ -[3]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/ -[4]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/ +[1]:https://linux.cn/article-8065-1.html +[2]:https://linux.cn/article-8070-1.html +[3]:https://linux.cn/article-8097-1.html +[4]:https://linux.cn/article-8097-1.html [5]:http://www.tecmint.com/wp-content/uploads/2016/12/Connect-Samba4-DNS-on-Windows.png [6]:http://www.tecmint.com/wp-content/uploads/2016/12/Add-DNS-A-Record.png [7]:http://www.tecmint.com/set-add-static-ip-address-in-linux/ diff --git a/published/20170116 Terrible Ideas in Git.md b/published/20170116 Terrible Ideas in Git.md new file mode 100644 index 0000000000..ff4e171f13 --- /dev/null +++ b/published/20170116 Terrible Ideas in Git.md @@ -0,0 +1,36 @@ +Git 中的那些可怕的事 +============================================================ + + +![Corey Quinn](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/corey-quinn-lcna.png) + +在 LinuxCon 北美会议上 FutureAdvisor 的 Corey Quinn 说:“Git 的确让你可以做一些超级强大的事。‘强大’,在这次讲演中,这是一种说你愚蠢的委婉说法”。在使用 Git 时,谁没有经历让你感觉自己像个傻子的时刻?当然,Git 是很棒的,每个人都在使用它,你可以用几个基本命令完成你的大部分工作。但它也有一些强大的功能,让我们觉得我们不知道我们在做什么。 + +但这真的对我们来说不公平。没有人会知道一切,每个人知道的都不同。Quinn 提醒我们:“在我许多讲演的问答部分,人们有时举手说:“嗯,我有一个傻问题。” 你看到人们在那里说:“是啊!这是一个非常愚蠢的问题”。但是当他们得到答案时,那些这么说的人也正在低头记笔记。 + +![Git](https://www.linux.com/sites/lcom/files/styles/floated_images/public/heffalump-git-corey-quinn_0.png) + +Quinn 在演讲的开始做了一些有趣的演示,演示了一些你可以用 Git 做到的可怕的事情,例如变基主干然后进行强制推送来搞乱整个项目、胡乱输入一些命令让 git 吐槽、提交大型二进制文件等。然后他演示了如何使这些可怕的事情不怎么可怕,如更加明智地管理大型二进制文件。“你可以提交大型二进制文件,你可以在 Git 中暴力提交,如果你需要存储大的二进制文件,这里有两个工具会可以加速载入,一个是 git-annex,这是由 Debian 开发人员 Joey Hess 开发的,而 git-lfs 是由 GitHub 支持的。” + +你经常同样地错误输入么?例如,当你想要 `git status` 时却输入 `git stitis`?Quinn 有一个方案:“Git 有内置的别名支持,所以你可以将相对较长、复杂的东西命名为一个短的 Git 命令。” 此外,你还可以使用 shell 别名。 + +Quinn 说:“我们都听说过变基主干然后强制推送这样的搞笑恶作剧,它会改变版本历史,突然发生的事情让所有人都措手不及,每个人都被卷入了这种混乱当中。一群鲸鱼被称为“pod”,一群乌鸦中被称为“谋杀”,一群开发者被称为“合并冲突”……更严重的是,如果有人干了这种事情,你有几个选择。包括从备份中恢复主干,还原提交;或者把责任人从屋顶上尖叫着扔下去。或者,采取一定的预防措施并使用一个并不知名的 Git 功能称为分支保护。启用分支保护后,无法删除或强制推送分支,并且在接受前,拉取请求(pull request)必须至少有一个审核。” + +Quinn 演示了几个更奇妙的有用的工具,使 Git 更高效和万无一失,如 mr、vcsh 和定制的 shell 提示。你可以在下面看到完整的视频,了解更多有趣的事情。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/event/LinuxCon-Europe/2016/terrible-ideas-git-0 + +作者:[CARLA SCHRODER][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Bestony](https://github.com/Bestony) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/cschroder +[1]:https://www.linux.com/licenses/category/used-permission +[2]:https://www.linux.com/licenses/category/linux-foundation +[3]:https://www.linux.com/files/images/heffalump-git-corey-quinnpng-0 +[4]:https://www.linux.com/files/images/corey-quinn-lcnapng +[5]:http://events.linuxfoundation.org/events/linuxcon-north-america diff --git a/translated/tech/20170116 Use Docker remotely on Atomic Host.md b/published/20170116 Use Docker remotely on Atomic Host.md similarity index 61% rename from translated/tech/20170116 Use Docker remotely on Atomic Host.md rename to published/20170116 Use Docker remotely on Atomic Host.md index 114aa07bd9..580271019b 100644 --- a/translated/tech/20170116 Use Docker remotely on Atomic Host.md +++ b/published/20170116 Use Docker remotely on Atomic Host.md @@ -1,21 +1,21 @@ -[远程在 Atomic 主机上使用 Docker][1] ---------------------- +在 Atomic 主机上远程使用 Docker +========== - ![remote-atomic-docker](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/remote-atomic-docker-945x400.jpg) +![remote-atomic-docker](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/remote-atomic-docker-945x400.jpg) -来自 [Atomic 项目][2] 的 Atomic 主机是一个基于轻量级容器的操作系统,它可以运行 Linux 容器。它已被优化为用作云环境的容器运行时系统。例如,它可以托管 Docker 守护进程和容器。有时,你可能需要在该主机上运行 docker 命令,并从其他地方管理服务器。本文介绍如何远程访问 Fedora Atomic 主机上的[Docker][3]守护进程,[你可以在这里下载到它][4]。整个过程由[Ansible][5]自动完成 - 在涉及到自动化的一切上,这是一个伟大的工具。 +来自 [Atomic 项目][2] 的 Atomic 主机是一个轻量级的容器基于的操作系统,它可以运行 Linux 容器。它已被优化为用作云环境的容器运行时系统。例如,它可以托管 Docker 守护进程和容器。有时,你可能需要在该主机上运行 docker 命令,并从其他地方管理服务器。本文介绍如何远程访问 Fedora Atomic 主机([你可以在这里下载到它][4])上的 [Docker][3] 守护进程。整个过程由 [Ansible][5] 自动完成 - 在涉及到自动化的一切上,这真是一个伟大的工具! -### 一份安全笔记 +### 安全备忘录 -由于我们通过网络连接,所以我们使用[TLS][6]保护 Docker 守护进程。此过程需要客户端证书和服务器证书。OpenSSL 包用于创建用于建立 TLS 连接的证书密钥。这里,Atomic 主机运行守护程序,我们的本地的 [Fedora Workstation][7] 充当客户端。 +由于我们通过网络连接,所以我们使用 [TLS][6] 保护 Docker 守护进程。此过程需要客户端证书和服务器证书。OpenSSL 包用于创建用于建立 TLS 连接的证书密钥。这里,Atomic 主机运行守护程序,我们的本地的 [Fedora Workstation][7] 充当客户端。 -在你按照这些步骤进行之前,请注意,_任何_在客户端上可以访问 TLS 证书的进程在服务器上具有**完全根访问权限。** 因此,客户端可以在服务器上做任何它想做的事情。因此,我们需要仅向可信任的特定客户端主机授予证书访问权限。你应该将客户端证书仅复制到完全由你控制的客户端主机。即使在这种情况下,客户端机器的安全也至关重要。 +在你按照这些步骤进行之前,请注意,_任何_在客户端上可以访问 TLS 证书的进程在服务器上具有**完全的 root 访问权限**。 因此,客户端可以在服务器上做任何它想做的事情。我们需要仅向可信任的特定客户端主机授予证书访问权限。你应该将客户端证书仅复制到完全由你控制的客户端主机。但即使在这种情况下,客户端机器的安全也至关重要。 -但是,此方法只是远程访问守护程序的一种方法。编排工具通常提供更安全的控制。下面的简单方法适用于个人实验,但可能不适合开放式网络。 +不过,此方法只是远程访问守护程序的一种方法。编排工具通常提供更安全的控制。下面的简单方法适用于个人实验,可能不适合开放式网络。 ### 获取 Ansible role -[Chris Houseknecht][8] 写了一个 Ansible role,它会创造所需的所有证书。这样,你不需要手动运行 _openssl_ 命令了。 这些在[ Ansible role 仓库][9]中提供。将它克隆到你当前的工作主机。 +[Chris Houseknecht][8] 写了一个 Ansible role,它会创造所需的所有证书。这样,你不需要手动运行 `openssl` 命令了。 这些在 [Ansible role 仓库][9]中提供。将它克隆到你当前的工作主机。 ``` $ mkdir docker-remote-access @@ -25,7 +25,7 @@ $ git clone https://github.com/ansible/role-secure-docker-daemon.git ### 创建配置文件 -接下来,你必须创建 Ansible 配置文件、inventory 和 playbook 文件以设置客户端和守护进程。以下说明在 Atomic 主机上创建客户端和服务器证书。然后,获取客户端证书到本地。最后,它们会配置守护进程以及客户端,使它们能彼此交互。 +接下来,你必须创建 Ansible 配置文件、清单(inventory)和剧本(playbook)文件以设置客户端和守护进程。以下说明在 Atomic 主机上创建客户端和服务器证书。然后,获取客户端证书到本地。最后,它们会配置守护进程以及客户端,使它们能彼此交互。 这里是你需要的目录结构。如下所示,创建下面的每个文件。 @@ -38,29 +38,34 @@ docker-remote-access/ └── role-secure-docker-daemon ``` -### _ansible.cfg_ +`ansible.cfg`: ``` - $ vim ansible.cfg +$ vim ansible.cfg +``` +``` [defaults] inventory=inventory ``` -### _inventory_ +清单文件(`inventory`): ``` - $ vim inventory +$ vim inventory +``` +``` [daemonhost] 'IP_OF_ATOMIC_HOST' ansible_ssh_private_key_file='PRIVATE_KEY_FILE' ``` -将 inventory 中的 _IP_OF_ATOMIC_HOST_ 替换为 Atomic 主机的 IP。将 _PRIVATE_KEY_FILE_ 替换为本地系统上的 SSH 私钥文件的位置。 +将清单文件(`inventory`) 中的 `IP_OF_ATOMIC_HOST` 替换为 Atomic 主机的 IP。将 `PRIVATE_KEY_FILE` 替换为本地系统上的 SSH 私钥文件的位置。 -### _remote-access.yml_ +剧本文件(`remote-access.yml`): ``` $ vim remote-access.yml ---- +``` +``` - name: Docker Client Set up hosts: daemonhost gather_facts: no @@ -130,7 +135,7 @@ $ vim remote-access.yml ### 访问 Atomic 主机 -现在运行 Ansible playbook: +现在运行 Ansible 剧本: ``` $ ansible-playbook remote-access.yml @@ -138,9 +143,9 @@ $ ansible-playbook remote-access.yml 确保 tcp 端口 2376 在你的 Atomic 主机上打开了。如果你在使用 Openstack,请在安全规则中添加 TCP 端口 2376。 如果你使用 AWS,请将其添加到你的安全组。 -现在,在你的工作站上作为普通用户运行的 _docker_ 命令与 Atomic 主机的守护进程通信了,并在那里执行命令。你不需要手动 _ssh_ 或在 Atomic 主机上发出命令。这允许你远程、轻松、安全地启动容器化应用程序。 +现在,在你的工作站上作为普通用户运行的 `docker` 命令与 Atomic 主机的守护进程通信,并在那里执行命令。你不需要手动 `ssh` 或在 Atomic 主机上发出命令。这可以让你远程、轻松、安全地启动容器化应用程序。 -如果你想克隆 playbook 和配置文件,这里有[一个可用的 git 仓库][10]。 +如果你想克隆 Ansible 剧本和配置文件,这里是 [git 仓库][10]。 [ ![docker-daemon](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/docker-daemon.jpg) @@ -152,7 +157,7 @@ via: https://fedoramagazine.org/use-docker-remotely-atomic-host/ 作者:[Trishna Guha][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/) 荣誉推出 diff --git a/published/20170118 Do I need to provide access to source code under the AGPLv3 license.md b/published/20170118 Do I need to provide access to source code under the AGPLv3 license.md new file mode 100644 index 0000000000..ae25c2986e --- /dev/null +++ b/published/20170118 Do I need to provide access to source code under the AGPLv3 license.md @@ -0,0 +1,37 @@ +我需要在 AGPLv3 许可证下提供源码么? +============================================================ + + ![Do I need to provide access to source code under the AGPLv3 license?](https://opensource.com/sites/default/files/styles/image-full-size/public/images/law/LAW_PatentSpotlight_520x292_cm.png.png?itok=bCn-kMx2 "Do I need to provide access to source code under the AGPLv3 license?") + +图片提供:opensource.com + +[GNU Affero 通用公共许可证版本 3][1](AGPLv3)是与 GPLv3 几乎相同的左版(copyleft)许可证。两个许可证具有相同的公共版权范围,但在一个重要方面有重大差异。 AGPLv3 的第 13 节规定了 GPLv2 或 GPLv3 中不存在的附加条件: + +> 在本许可证的其它条款之外,如果你修改了程序,你必须把你修改的版本,给你的那些使用计算机网络远程(如果你的版本支持此类交互)与之交互的用户,明确提供一个通过一些标准或者常规的复制手段,从网络服务器上免费获得与你所修改的版本相匹配的源码的机会。 + +这个“通过计算机网络远程交互”的范围主要被认为是 SaaS 部署的情形,尽管其实际上读起来的意思超乎了惯例的 SaaS 部署情形。其目标是解决在用户在使用像 Web Services 这样的功能时,其代码没有公开的常规 GPL 协议所暴露出的漏洞。因此,该协议的第 13 节,在 GPLv2 第 3 节以及 GPLv3 和 AGPLv3 第 6 节中包含的目标代码分发的触发要求之外,提供了额外的源代码公开的要求。 + +常常被误解的是,AGPLv3 第 13 节中的源代码分发要求仅在 AGPLv3 软件已被“你”(例如,提供网络服务的实体)修改的地方才触发。我的理解是,只要“你”不修改 AGPLv3 的代码,许可证就不应该被理解为需要按照第 13 节规定的方式访问相应的源码。如我所见,尽管即使公开许可证中不要求公开的源代码也是一个好主意,但在 AGPL 下许多未修改以及标准部署的软件模块根本不会触发第 13 节。 + +如何解释 AGPL 的条款和条件,包括 AGPL 软件是否已被修改,可能需要根据具体情况的事实和细节进行法律层面的分析。 + +-------------------------------------------------------------------------------- + +作者简介: + +![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/kaufman-picture.jpg?itok=FPIizDR-) + +Jeffrey R. Kaufman 是全球领先的开源软件解决方案提供商 Red Hat 公司的开源 IP 律师。Jeffrey 也是托马斯·杰斐逊法学院的兼职教授。在入职 Red Hat 之前,Jeffrey 曾经担任高通公司的专利顾问,向首席科学家办公室提供开源顾问。Jeffrey 在 RFID、条形码、图像处理和打印技术方面拥有多项专利。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/1/providing-corresponding-source-agplv3-license + +作者:[Jeffrey Robert Kaufman][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Bestony](https://github.com/Bestony) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jkaufman +[1]:https://www.gnu.org/licenses/agpl-3.0-standalone.html diff --git a/published/20170118 Why Linux Installers Need to Add Security Features.md b/published/20170118 Why Linux Installers Need to Add Security Features.md new file mode 100644 index 0000000000..bb67bc515b --- /dev/null +++ b/published/20170118 Why Linux Installers Need to Add Security Features.md @@ -0,0 +1,71 @@ +为何 Linux 安装器需要添加安全功能 +============================================================ + +> 由于安全问题越来越严重,Linux 发行版需要在安装程序中突出显示基本安全选项,而不是让用户稍后手动添加这些选项。 + +十二年前,Linux 发行版努力使安装变得简单。在 Ubuntu 和 Fedora 的引领下,它们很早就实现了这一目标。现在,随着对安全性越来越关注,它们需要稍微转变下方向,并在安装程序中突出显示基本安全选项,而不是让用户稍后手动添加这些选项。 + +当然,即便是在最好的情况下,说服用户来设置安全功能都是困难的。太多用户甚至不愿意添加如非特权用户帐户或密码这样简单的功能,他们显然更喜欢用重装或者以每小时 80 美元的价格咨询专家来减少风险。 + +然而,即便一般用户不会专门注意安全,但他也可能会在安装过程中注意。他们可能永远不会再想到它,但也许在安装过程中,当他们的注意力集中时,特别是如果有可见的在线帮助来解释其好处时,他们可能被说服选择一个复选框。 + +这种转变也并不伟大。许多安装程序已经提供了自动登录的选择 - 这对于不包含个人数据的安装来说或许是可以接受的功能,但更可能会被那些觉得登录不方便的用户使用。同样感谢 Ubuntu,它选择加密文件系统 - 至少在主目录中是这样 - 它已经成为许多安装程序的标准。我真正建议的也是这样的。 + +此外,外部安装程序如 Firefox 已经无缝合并了隐私浏览,而 [Signal Private Messenger][8] 则是一个可替代标准 的 Android 手机和联系人的应用程序。 + +这些建议远不算激进。它只需要意志和想象力来实现它。 + +### Linux 安全第一步 + +应该将什么类型的安全功能添加到安装程序呢? + +首先是防火墙。有许多图形界面程序可以设置防火墙。尽管十七年的经验,但是就像拜伦对柯尔律治的形而上的思想的讨论一样,我有时还是希望有人能来解释一下。 + +尽管出于好意,大多数防火墙工具对 iptables 的处理看起来都很直接。有一个现在已经停止维护的加固系统 [Bastille Linux][9] 可以用于安装一个基本的防火墙,我看不出为什么其他发行版做不到同样的事情。 + +一些工具可以用于安装后处理,并且对于安装器而言可以毫无困难地添加使用。例如,对于 [Grub 2][10],这个大多数发行版使用的引导管理器包含了基本密码保护。诚然,密码可以通过 Live CD 绕过,但它仍然在包括远程登录在内的日常情况下提供一定程度的保护。 + +类似地,一个类似于 [pwgen][11] 的密码生成器也可以添加到安装程序设置帐户的环节。这些工具强制可接受密码的长度、以及它们的大小写字母、数字和特殊字符的组合。它们许多都可以为你生成密码,有些甚至可以使生成的密码可拼读,以便你记住密码。 + +还有些工具也可以添加到安装过程的这个部分。例如,安装程序可以请求定期备份的计划,并添加一个计划任务和一个类似 [kbackup][12] 的简单的备份工具。 + +那么加密电子邮件怎么办?如今最流行的邮件阅读器包括了加密邮件的能力,但是设置和使用加密需要用户采取额外的设置,这使常见的任务复杂化,以至于用户会忽略它。然而,看看 Signal 在手机上的加密有多么简单,很显然,在笔记本电脑和工作站上加密会更容易。大多数发行版可能都喜欢对等加密,而不喜欢 Signal 那样的集中式服务器,但像 [Ring][13] 这样的程序可以提供这种功能。 + +无论在安装程序中添加了什么功能,也许这些预防措施也可以扩展到生产力软件,如 LibreOffice。大多数安全工作都集中在电子邮件、网络浏览和聊天中,但文字处理程序和电子表格及其宏语言,是一个明显的恶意软件感染的来源和隐私关注点。除了像 [Qubes OS][14] 或 [Subgraph][15] 这样的几个例外之外,很少有人努力将生产力软件纳入其安全预防措施 - 这可能会留下一个安全漏洞空缺。 + +### 适应现代 + +当然,在意安全的用户也许会采取一些安全的方法,这样的用户可以为自己负责。 + +我关心的是那些不太了解安全或不太愿意自己做修补的用户。我们越来越需要易于使用的安全性,并且亟待解决。 + +这些例子只是开始。所需要的工具大多数已经存在,只是需要以这样的方式来实现它们,使得用户不能忽略它们,并且能够不用懂什么就可以使用它们。可能实现所有这些只需要一个人月而已,包括原型、UI 设计和测试等等。 + +然而,在添加这些功能前,大多数主流的 Linux 发行版几乎不能说是关注到了安全性。毕竟,如果用户从不使用它们,那怎么会是好工具? + +-------------------------------------------------------------------------------- + +via: http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html + +作者:[Bruce Byfield][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Bestony](https://github.com/Bestony), [wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.datamation.com/author/Bruce-Byfield-6030.html +[1]:http://www.datamation.com/feedback/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html +[2]:http://www.datamation.com/author/Bruce-Byfield-6030.html +[3]:http://www.datamation.com/e-mail/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html +[4]:http://www.datamation.com/print/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html +[5]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html#comment_form +[6]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html# +[7]:http://www.datamation.com/author/Bruce-Byfield-6030.html +[8]:https://whispersystems.org/ +[9]:http://bastille-linux.sourceforge.net/ +[10]:https://help.ubuntu.com/community/Grub2/Passwords +[11]:http://pwgen-win.sourceforge.net/downloads.html +[12]:http://kbackup.sourceforge.net/ +[13]:https://savannah.gnu.org/projects/ring/ +[14]:https://www.qubes-os.org/ +[15]:https://subgraph.com/sgos/ diff --git a/published/20170119 Get to know Tuleap for project management.md b/published/20170119 Get to know Tuleap for project management.md new file mode 100644 index 0000000000..114618b6d8 --- /dev/null +++ b/published/20170119 Get to know Tuleap for project management.md @@ -0,0 +1,77 @@ +将 Tuleap 用于软件项目管理 +============================================================ + +> Tuleap 正在被 Eclipse 基金会使用,用来取代 Bugzilla + + ![Get to know Tuleap for project management](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=kOixOaEU "Get to know Tuleap for project management") + +图片提供:opensource.com + +Tuleap 是一个独特的开源项目管理工具,目前发展势头很好,现在,每个月它会出一个大版本。它还被列在 [2015 年五大开源项目管理工具][1]和 [2016 年十一个名列前茅项目管理工具][2]中。 + +Manuel Vacelet 是开发 Tuleap 项目的 Enalean 公司的联合创始人和 CTO,他说:“Tuleap 是一个完整用于托管软件项目的 GPLv2 平台,它提供了一个集中化的平台,在这里,团队可以找到他们所需的所有工具,追踪他们软件项目的生命周期。他们可以找到项目管理(Scrum、看板、瀑布、混合等等)、源码控制(git 和 svn)和代码审查(pull 请求和 gerrit)、持续集成、问题跟踪、wiki 和文档等的支持。” + +在这次采访中,我会和 Manuel 讨论如何开始使用它,以及如何以开源方式管理 Tuleap。 + +**Nitish Tiwari(以下简称 NT): 为什么 Tuleap 项目很重要? ** + +**Manuel Vacelet(以下简称 MV):** Tuleap 很重要是因为我们坚信一个成功的(软件)项目必须涉及所有利益相关者:开发人员、项目经理、QA、客户和用户。 + +很久以前,我还是一个 SourceForge 衍生项目的实习生(当时 SourceForge 还是一个自由开源项目),几年后它变成了 Tuleap。 我的第一个贡献是将 PhpWiki 集成到该工具中(不要告诉任何人,代码写的很糟)。 + +现在,我很高兴作为首席技术官和产品负责人在 Enalean 工作,该公司是 Tuleap 项目的主要贡献公司。 + +**NT:让我们聊聊技术方面。** + +**MV:** Tuleap 核心系统是基于 LAMP 并且架构于 CentOS 之上。如今的开发栈是 AngularJS (v1)、REST 后端(PHP)、基于 NodeJS 的实时推送服务器。但如果你想成为一名 Tuleap 全栈开发人员,你还将需要接触 bash、Perl、Python、Docker、Make 等等。 + +说到技术方面,需要重点强调的 Tuleap 的一个显著特征是它的可扩展性。一个运行在单服务器上的 Tuleap 单一实例、并且没有复杂的 IT 架构,可以处理超过 10000 人的访问。 + +**NT:给我们说下该项目的用户和社区。有谁参与?他们如何使用这个工具?** + +**MV:** 用户非常多样化。从使用 Tuleap 跟踪他们的项目进度并管理他们的源代码的小型初创公司,到非常大的公司,如法国电信运营商 Orange,它为超过 17000 用户部署了它,并托管了 5000 个项目。 + +许多用户依靠 Tuleap 来促进敏捷项目并跟踪其进度。开发人员和客户共享同一个工作区。客户不需要学习如何使用 GitHub,也不需要开发人员做额外的工作,就可以将其工作转换到“客户可访问”平台。 + +今年,Tuleap 被 [Eclipse 基金会][3]所使用,取代了 Bugzilla。 + +印度电子信息技术部使用 Tuleap 创建了印度政府开放电子政务的开放式协作开发平台。 + +Tuleap 有多种不同的使用方式和配置。有些人使用它作为 Drupal 客户门户网站的后端; 它们通过 REST API 插入到 Tuleap 中以管理 bug 和服务请求。 + +甚至一些建筑师也使用它来管理他们的工作进度和 AutoCAD 文件。 + +**NT:Tuleap 是否做了一些特别的事,使社区更安全,更多样化?** + +**MV:** 我们还没有创建“行为准则”;本社区非常平和而欢迎新人,但我们有计划这样做。Tuleap 的开发人员和贡献者来自不同的国家(例如加拿大、突尼斯、法国)。而且 35% 的活跃开发者和贡献者是女性。 + +**NT:由社区提议的 Tuleap 功能的百分比是多少?** + +**MV:** 几乎 100% 的功能是由社区驱动的。 + +这是 Enalean 的关键挑战之一:找到一种商业模式,使我们能以正确的方式做开源软件。对我们来说,“开放核心”模式(其中应用程序的核心是开放的,但有趣和有用的部分是封闭源的)不是正确的方法,因为你最终还是要依赖闭源。因此,我们发明了 [OpenRoadmap][4],这种方式是我们从社区和最终用户那里收集需求,并找公司来为此买单。 + + +-------------------------------------------------------------------------------- + +作者简介: + +![](https://opensource.com/sites/default/files/styles/profile_pictures/public/nitish-crop.png?itok=h4PaLDQq) + +Nitish 是一名专业的软件开发人员并对开源有热情。作为一本基于 Linux 的杂志的技术作者,他会尝试新的开源工具。他喜欢阅读和探索任何开源相关的事情。在他的空闲时间,他喜欢读励志书。他目前正在构建 DevUp - 一个让开发人员以真正的方式连接所有工具和拥抱 DevOps 的平台。你可以在 Twitter 上关注他 @tiwari_nitish。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/1/interview-Tuleap-project + +作者:[Nitish Tiwari][a] +译者:[geekpi](https://github.com/geeki) +校对:[jamsinepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/tiwarinitish86 +[1]:https://opensource.com/business/15/1/top-project-management-tools-2015 +[2]:https://opensource.com/business/16/3/top-project-management-tools-2016 +[3]:http://www.eclipse.org/ +[4]:https://blog.enalean.com/enalean-open-roadmap-how-it-works/ diff --git a/published/20170119 Long-term Embedded Linux Maintenance Made Easier.md b/published/20170119 Long-term Embedded Linux Maintenance Made Easier.md new file mode 100644 index 0000000000..b78fd0ea8e --- /dev/null +++ b/published/20170119 Long-term Embedded Linux Maintenance Made Easier.md @@ -0,0 +1,54 @@ +长期维护嵌入式 Linux 内核变得容易 +============================================================ + + ![Jan Lübbe ](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jan-lubbe-elc.png?itok=6G5lADKu "Jan Lübbe ") + +*Pengutronix 内核黑客 Jan Lübbe 总结了嵌入式 Linux 中正在不断增长的安全威胁,并在这次欧洲嵌入式 Linux 会议上概述了一个计划,以保持长期设备的安全和功能完整。* [Linux 基金会][1] + +安全漏洞只发生在 Windows 上的好日子正在快速过去。恶意软件黑客和拒绝服务老手们正在越来越多地瞄准过时的嵌入式 Linux 设备,因此在 10 月的[欧洲嵌入式 Linux 会议Embedded Linux Conference Europe][3](ELCE)上的几个演讲的主题就与修复 Linux 安全漏洞相关。 + +最值得去听的讲演之一是 [Pengutronix][4] 内核黑客 Jan Lübbe 的《长期维护或管理(或免管理)嵌入式系统 10 年以上》。在总结嵌入式 Linux 中不断增长的安全威胁后,Lübbe 制定了一项计划,以确保长期设备的安全和功能完整。 Lübbe 说:“我们需要迁移到更新、更稳定的内核,并进行持续维护以修复关键漏洞。我们需要做上游更新和自动化流程,并建立一个可持续的工作流程。我们没有理由让系统中仍留有过时的软件。” + +随着 Linux 设备变得越来越老,传统的生命周期过程已经不再适用。 Lübbe 说:“通常,你会从 SoC 供应商或主线上获取内核、构建系统,并添加到用户空间。你可以定制和添加程序,并做一些测试。但是,在此之后有 15 年的维护阶段,你最好期望平台不会发生变化、不会想要添加新的功能、不需要实施管理调整。” + +所有这些变化,越来越多地导致你的系统暴露出新的错误,并需要大量更新以才能与上游软件保持同步。 Lübbe 说:“在内核中发生导致问题的错误并不总是无意的”。对于去年在 Allwinner 内核中发现的[后门][5],他又补充说:“这些供应商的内核从来不会执行主线内核社区的审查流程”。 + +Lübbe 继续说:“你不能认为你的供应商一直没问题。也许只有一两个工程师查看过后门代码这块。如果补丁发布在 Linux 内核邮件列表上,就不会有这种事,因为总会有人注意到。硬件供应商不关心安全或维护,也许你会在一两年后得到更新,但是即使这样,他们从一个固定版本开始开发,到他们发布稳定的版本通常需要几年的时间。如果你在这个基础上再开始开发,可能又过了半年,这就更过时了。” + +越来越多的嵌入式开发人员在长期稳定Long Term Stable(LTS)内核上构建长期产品。但这并不意味着没事了。Lübbe 说:“一个产品发布后,人们经常不再遵循稳定的发行链,也不再应用安全补丁。这样你会得到两个最糟糕的结果:过时的内核和没有安全性。你失去了多人测试的好处。” + +Lübbe 指出,使用像 Red Hat 这样的面向服务器的发行版的 Pengutronix 客户经常由于快速的定制、需要系统管理员干预的部署和升级系统而遇到问题。 + +“更新对一些东西有用,特别是在 x86 上,但每个项目基本上是自己建立基础设施来更新到新版本。” + +许多开发人员选择把向后移植作为更新长期产品的解决方案。Lübbe 说:“开始时很容易,但是一旦你不处于项目的维护范围,他们就不会告诉你所使用的版本是否受到一个 bug 的影响,因此很难判断一个修复是否相关。于是你不停打补丁和更新,而 bug 也在不断累积,而这些你必须自己维护,因为其他人不使用这些补丁。使用开源软件的好处就丢失了。” + +### 跟随上游项目 + +Lübbe 认为,最好的解决方案是跟踪由上游项目维护的版本。“我们主要关注基于主线内核的开发,所以我们在产品和主流内核及其他上游项目之间尽可能没有差别。长期系统在主线内核上得到很好的支持。大多数不使用 3D 图形的系统只需要很少的补丁。较新的内核版本还有很多[新的强化功能][6],这些可以减少漏洞的影响。 + +跟随主线发展对许多开发人员来说似乎令人畏惧,但是如果从一开始就这样,然后坚持下去,就会相对容易一些,Lübbe 说:“你需要为系统上做的一切制定流程。你总需要知道什么软件正在运行,这在使用良好的构建系统时会更容易。每个软件版本应定义完整的系统,以便你可以更新相关的一切。如果你不知道那里有什么,你就不能解决它。你也需要一个自动测试和自动部署更新。” + +为了“减少更新周期”,Lübbe 建议在开始开发时使用最新的 Linux 内核,并且在进入测试时才转到稳定的内核。之后,他建议每年将系统中的所有软件(包括内核、构建系统、用户空间、glibc 和组件(如 OpenSSL))更新为当年上游项目支持的版本。 + +Lübbe 说:“得到更新并不意味着你需要部署。如果没有看到安全漏洞,你可以把补丁放在一边,需要时它再用就行。” + +最后,Lübbe 建议每个月查看发布公告,并且每周检查 CVE 和主线列表上的安全公告。你只需要问自己“该安全公告是否影响到了你”。他补充说:“如果你的内核足够新,就没有太多的工作。你不会希望通过在新闻中看到你的设备才获得有关你的产品的反馈。” + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/event/ELCE/2017/long-term-embedded-linux-maintenance-made-easier + +作者:[ERIC BROWN][a] +译者:[geekpi](https://github.com/geekpi) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/ericstephenbrown +[1]:https://www.linux.com/licenses/category/linux-foundation +[2]:https://www.linux.com/files/images/jan-lubbe-elcpng +[3]:http://events.linuxfoundation.org/events/archive/2016/embedded-linux-conference-europe +[4]:http://www.pengutronix.de/index_en.html +[5]:http://arstechnica.com/security/2016/05/chinese-arm-vendor-left-developer-backdoor-in-kernel-for-android-pi-devices/ +[6]:https://www.linux.com/news/event/ELCE/2017hardening-kernel-protect-against-attackers diff --git a/published/20170120 How to write web apps in R with Shiny.md b/published/20170120 How to write web apps in R with Shiny.md new file mode 100644 index 0000000000..4505678b6a --- /dev/null +++ b/published/20170120 How to write web apps in R with Shiny.md @@ -0,0 +1,66 @@ +如何用 R 语言的 Shiny 库编写 web 程序 +============================================================ + ![How to write web apps in R with Shiny](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUSINESS_lightbulbs.png?itok=70w-2-Ta "How to write web apps in R with Shiny") + +图片提供: opensource.com + +我这个月在写一些更加长的文章,所以你们可以在几周后再来看看。本月,我想简要地提下我自己一直在玩的一个很棒的 R 库。 + +我的一个亲密朋友最近在用 R 编写东西。我一直都对它很感兴趣,也一直在试图挤时间,学习更多关于 R 的知识以及可用它做的事情。探索 R 的超强数字处理能力对我而言有些困难,因为我并不如我朋友那样有一个数学头脑。我进展有点慢,但我一直试图将它与我在其他领域的经验联系起来,我甚至开始考虑非常简单的 web 程序。 + +[Shiny][1] 是一个来自 RStudio 的工具包,它让创建 web 程序变得更容易。它能从 R 控制台轻松安装,只需要一行,就可以加载好最新的稳定版本来使用。这里有一个很棒的[教程][2],它可以在前面课程基础上,带着你理解应用架设的概念。 Shiny 的授权是 GPLv3,源代码可以在 [GitHub][3] 上获得。 + +这是一个用 Shiny 写的简单的小 web 程序: + +``` +library(shiny) + +server <- function(input, output, session) { + observe({ + myText <- paste("Value above is: ", input$textIn) + updateTextInput(session, "textOut", value=myText) + }) +} + +ui <- basicPage( + h3("My very own sample application!"), + textInput("textIn", "Input goes here, please."), + textInput("textOut", "Results will be printed in this box") +) + +shinyApp(ui = ui, server = server) +``` + +当你在输入框中输入文字时,它会被复制到输出框中提示语后。这并没有什么奇特的,但它向你展示了一个 Shiny 程序的基本结构。“server”部分允许你处理所有后端工作,如计算、数据库检索或程序需要发生的任何其他操作。“ui”部分定义了接口,它可以根据需要变得简单或复杂。 + +包括在 Shiny 中的 [Bootstrap][4] 有了大量样式和主题,所以在学习了一点后,就能用 R 创建大量功能丰富的 web 程序。使用附加包可以将功能扩展到更高级的 JavaScript 程序、模板等。 + +有几种方式处理 Shiny 的后端工作。如果你只是在本地运行你的程序,加载库就能做到。对于想要发布到网络上的程序,你可以在 [RStudio 的 Shiny 网站][5]上共享它们,运行开源版本的 Shiny 服务器,或通过按年订阅服务从 RStudio 处购买 Shiny Server Pro。 + +经验丰富的 R 大牛可能已经知道 Shiny 了;它已经存在大约几年了。对于像我这样来自一个完全不同的编程语言,并且希望学习一点 R 的人来说,它是相当有帮助的。 + +-------------------------------------------------------------------------------- + + +作者简介: + +![](https://opensource.com/sites/default/files/styles/profile_pictures/public/ruth1_avi.jpg?itok=I_EE7NmY) + +D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前在休斯敦的 cPanel 任 Perl 开发人员,他也作为首席员工效力于双猫公司。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/1/writing-new-web-apps-shiny + +作者:[D Ruth Bavousett][a] +译者:[geekpi](https://github.com/geekpi) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/druthb +[1]:http://shiny.rstudio.com/ +[2]:http://shiny.rstudio.com/tutorial +[3]:https://github.com/studio/shiny +[4]:http://getbootstrap.com/ +[5]:http://shinyapps.io/ diff --git a/published/20151121 5 Things I Dislike and Love About GNULinux.md b/published/201702/20151121 5 Things I Dislike and Love About GNULinux.md similarity index 100% rename from published/20151121 5 Things I Dislike and Love About GNULinux.md rename to published/201702/20151121 5 Things I Dislike and Love About GNULinux.md diff --git a/published/20151227 Installing Obtaining and Making GTK Themes.md b/published/201702/20151227 Installing Obtaining and Making GTK Themes.md similarity index 100% rename from published/20151227 Installing Obtaining and Making GTK Themes.md rename to published/201702/20151227 Installing Obtaining and Making GTK Themes.md diff --git a/published/20160425 What is SRE.md b/published/201702/20160425 What is SRE.md similarity index 100% rename from published/20160425 What is SRE.md rename to published/201702/20160425 What is SRE.md diff --git a/published/20160510 What is Docker.md b/published/201702/20160510 What is Docker.md similarity index 100% rename from published/20160510 What is Docker.md rename to published/201702/20160510 What is Docker.md diff --git a/published/20160707 6 Best JavaScript Frameworks to Learn In 2016.md b/published/201702/20160707 6 Best JavaScript Frameworks to Learn In 2016.md similarity index 100% rename from published/20160707 6 Best JavaScript Frameworks to Learn In 2016.md rename to published/201702/20160707 6 Best JavaScript Frameworks to Learn In 2016.md diff --git a/published/20160908 How to reset the root password in RHEL7CentOS7Scientific Linux 7- based systems.md b/published/201702/20160908 How to reset the root password in RHEL7CentOS7Scientific Linux 7- based systems.md similarity index 100% rename from published/20160908 How to reset the root password in RHEL7CentOS7Scientific Linux 7- based systems.md rename to published/201702/20160908 How to reset the root password in RHEL7CentOS7Scientific Linux 7- based systems.md diff --git a/published/20161103 Perl and the birth of the dynamic web.md b/published/201702/20161103 Perl and the birth of the dynamic web.md similarity index 100% rename from published/20161103 Perl and the birth of the dynamic web.md rename to published/201702/20161103 Perl and the birth of the dynamic web.md diff --git a/published/20161111 How to increase screen resolution on XenServer 7 GUI Virtual Machine.md b/published/201702/20161111 How to increase screen resolution on XenServer 7 GUI Virtual Machine.md similarity index 100% rename from published/20161111 How to increase screen resolution on XenServer 7 GUI Virtual Machine.md rename to published/201702/20161111 How to increase screen resolution on XenServer 7 GUI Virtual Machine.md diff --git a/published/20161128 Mir is not only about Unity8.md b/published/201702/20161128 Mir is not only about Unity8.md similarity index 100% rename from published/20161128 Mir is not only about Unity8.md rename to published/201702/20161128 Mir is not only about Unity8.md diff --git a/published/20161210 How to Setup Linux RAID 1 Device on RHEL.md b/published/201702/20161210 How to Setup Linux RAID 1 Device on RHEL.md similarity index 100% rename from published/20161210 How to Setup Linux RAID 1 Device on RHEL.md rename to published/201702/20161210 How to Setup Linux RAID 1 Device on RHEL.md diff --git a/published/20161226 Top 10 open source projects of 2016.md b/published/201702/20161226 Top 10 open source projects of 2016.md similarity index 100% rename from published/20161226 Top 10 open source projects of 2016.md rename to published/201702/20161226 Top 10 open source projects of 2016.md diff --git a/published/20161227 2017 is the year that front-end developers should go back and master the basics.md b/published/201702/20161227 2017 is the year that front-end developers should go back and master the basics.md similarity index 100% rename from published/20161227 2017 is the year that front-end developers should go back and master the basics.md rename to published/201702/20161227 2017 is the year that front-end developers should go back and master the basics.md diff --git a/published/20161227 The Dos and Donts of Writing Test cases in Android.md b/published/201702/20161227 The Dos and Donts of Writing Test cases in Android.md similarity index 100% rename from published/20161227 The Dos and Donts of Writing Test cases in Android.md rename to published/201702/20161227 The Dos and Donts of Writing Test cases in Android.md diff --git a/published/20161229 5 Most Promising New Linux Distributions to Look Forward in 2017.md b/published/201702/20161229 5 Most Promising New Linux Distributions to Look Forward in 2017.md similarity index 100% rename from published/20161229 5 Most Promising New Linux Distributions to Look Forward in 2017.md rename to published/201702/20161229 5 Most Promising New Linux Distributions to Look Forward in 2017.md diff --git a/published/20161230 Simple way for unattended bulk user creation in Linux.md b/published/201702/20161230 Simple way for unattended bulk user creation in Linux.md similarity index 100% rename from published/20161230 Simple way for unattended bulk user creation in Linux.md rename to published/201702/20161230 Simple way for unattended bulk user creation in Linux.md diff --git a/published/201702/20170103 5 things to watch in Go programming in 2017.md b/published/201702/20170103 5 things to watch in Go programming in 2017.md new file mode 100644 index 0000000000..43a8607c1b --- /dev/null +++ b/published/201702/20170103 5 things to watch in Go programming in 2017.md @@ -0,0 +1,106 @@ +2017 年 Go 语言编程的五大关注点 +============================================================ + +### 今年像动态插件,Serverless Go 以及 HTTP/2 这些创新对你的开发意味着什么? + +Go 1.8 刚刚发布,它有几个新功能,包括: + +* [HTTP/2 Push][1] +* [HTTP 服务器平滑关闭][2] +* [插件][3] +* [缺省 GOPATH][4] + +这些新功能的影响力取决于你和开发团队如何使用 Go。 自从 Go 1.0 于 2012 年发布以来,其简单性、并发性和内置支持使其保持[普及度][9]不断增长,所以对“Go 擅长什么”的答案一直在增长。 + +这里我会提供一些想法,包括新到来的版本及 Go 世界最近其它吸引我的地方。这不是一个详尽的列表,所以请[让我知道][10]你认为在 2017 年 Go 还会发生哪些重要的事。 + +### Go 的超级可部署性 + 插件 = 容器、任何东西? + +[1.8 版本][11]已经发布,我已经与其中几个人交谈过添加动态插件会如何影响像容器之类的事物,动态插件是为了加载在编译时不是程序一部分的共享库的代码。 动态插件使容器中的高并发微服务变得更加简单。 你可以轻松地以外部进程的方式加载插件,同时具备在容器中微服务的所有好处:保护你的主进程不会崩溃,并且没有任何东西会搞乱你的内存空间。 对插件的动态支持应该是在 Go 中使用容器的福音。 + +*关于专家现场 Go 培训,请注册 [ Go Beyond the Basics][12]。* + +### 跨平台支持仍在吸引开发人员 + +在 Go 开源之后的 7 年里,它已被全球采用。[Daniel Whitenack][13] 是一名数据科学家和工程师,他为 Jupyter 维护 Go 内核,告诉我最近他[在西伯利亚做数据科学和 Go 语言培训][14],(是的,在西伯利亚!数据科学和 Go - 之后再细讲一下...)并 “很惊讶地看到那里 Go 社区是如此活跃和积极。” 人们继续在项目中采取 Go 的另一个很大的原因是交叉编译,对此,几个 Go 专家解释说[这在 Go 1.5 版本中变得更容易了][15]。来自其他语言(如 Python)的开发人员应该发现,在没有 VM 的目标平台上,能够为多个操作系统构建捆绑的、可部署的应用程序是在 Go 中工作的关键。 + +在 1.8 版本中对跨平台的支持,再加上[提升了 15% 的编译速度][16],你就可以看到为什么 Go 是初创公司最喜欢的语言。 + +*有兴趣了解 Go 的基础知识吗?查看 [Go 基础学习路径][17] 让 O’Reilly 专家来带你开始。* + +### Go 解释器在开发中;再见 Read-Eval-Print-Loop + +有一些聪明的家伙正在做一个 [Go 解释器][18],我一定会持续关注它。如你所知的那样,有几个 Read-Eval-Print-Loop(REPL)的解决方案可以用来评估表达式,以确保代码如你预期的工作,但那些方法通常意味着容忍一些不便,或需要费力从几个方案中找到一个适合你的用例的。有一个健壮、一致的解释器就太好了,一旦我了解到更多消息,我会告诉你们。 + +*在开发中使用 Go 复杂特性?观看 O'Reilly 的视频训练 [中级 Go ][19]*。 + +### Go 的 serverless - 会是什么样子? + +是的,现在围绕 serverless 架构(功能即服务(FaaS))有很多炒作。但有时候也有些捉摸不定的地方,那么关于 Go 的 serverless 发生了什么?我们能在今年看到一个 Go 语言原生支持的 serverless 服务么? + +AWS Lambda 是最知名的 serverless 提供商,不过 Google 最近也推出了 [Google Cloud Functions][20]。这两个 FaaS 解决方案使你可以在无须管理服务器的情况下运行代码,你的代码存储在别人为你管理的服务器集群上,并且仅在触发事件调用它时运行。AWS Lambda 目前支持 JavaScript、Python 和 Java,还可以启动 Go、Ruby 和 bash 进程。 Google Cloud Functions 只支持 JavaScript,但很可能不久将支持 Java 和 Python。许多物联网设备已经使用 serverless 方案,随着 Go 越来越多地被创业公司采用,serverless 似乎是一个可能的增长点,所以我在关注这些 serverless 解决方案中 Go 的开发情况。 + +已经有[几个框架][25]可以支持 AWS Lambdas: + +* [λ Gordon][5] - 使用 CloudFormation 创建、连接及部署 AWS Lambdas +* [Apex][6] - 构建、部署及管理 AWS Lambda 函数 +* [Sparta][7] - AWS Lambda 微服务的 Go 框架 + +还有一个 AWS Lambda 替代品支持 Go: + +* [Iron.io][8]:建立在 Docker 和 Go 之上;语言未知;支持 Golang、Python、Ruby、PHP 和 .NET + +*有关 serverless 架构的更多信息,请观看 Mike Roberts 在旧金山 O'Reilly 软件架构会议上的演讲主题:[_serverless介绍_][22]。* + +### 数据科学中的 Go + +我在本文开头暗示了这一点:也许令人惊讶的是很多人都在使用 Go 进行数据科学和机器学习。关于它是否适合还有一些争论,但基于像 [Gopher 学院之 2016 年终][23]那样的年度文章中,你会注意到 30 篇文章中至少有 4 篇是关于机器学习或分布式数据处理,它们正在像我们走来。 + +我之前关于 Go 的易部署性的观点可能是数据科学家使用 Go 的一个关键原因:他们可以更轻松地在易读而可用于生产环境的应用程序中向他人展示数据模型。与此相结合的是 Go 的广泛使用(正如我前面提到的,它正变得越来越流行!),而且有数据专家创建“可用并且与其它程序配合”的程序。任何使用 Go 构建的应用数据科学家会在公司其他部分使用相同的语言,或者至少它非常适合现代架构。 + +*更多关于 Go 的数据科学,Daniel Whitenack 写了一个很好的概述,解释了如何使用它: [Data Science Gophers][24]。* + +-------------------------------------------------------------------------------- + +作者简介: + +![](https://cdn-images-1.medium.com/fit/c/60/60/1*MFGykrfk6_HjkJzePBtaMw.png) + +O'Reilly Media 的监督编辑,与编辑团队合作,涵盖各种各样的编程主题。 + +-------------------------------------------------------------------------------- + +via: https://medium.com/@sconant/5-things-to-watch-in-go-programming-in-2017-39cd7a7e58e3#.8t4to5jr1 + +作者:[Susan Conant][a] +译者:[geekpi](https://github.com/geekpi) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://medium.com/@sconant?source=footer_card +[1]:https://golang.org/doc/go1.8#h2push +[2]:https://golang.org/doc/go1.8#http_shutdown +[3]:https://golang.org/doc/go1.8#plugin +[4]:https://golang.org/doc/go1.8#gopath +[5]:https://github.com/jorgebastida/gordon +[6]:https://github.com/apex/apex +[7]:http://gosparta.io/ +[8]:https://www.iron.io/ +[9]:https://github.com/golang/go/wiki/GoUsers +[10]:https://twitter.com/SuConant +[11]:https://golang.org/doc/go1.8 +[12]:https://www.safaribooksonline.com/live-training/courses/go-beyond-the-basics/0636920065357/ +[13]:https://www.oreilly.com/people/1ea0c-daniel-whitenack +[14]:https://devfest.gdg.org.ru/en/ +[15]:https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba44ec#.7s7sxmc4h +[16]:https://golang.org/doc/go1.8#compiler +[17]:http://shop.oreilly.com/category/learning-path/go-fundamentals.do +[18]:https://github.com/go-interpreter +[19]:http://shop.oreilly.com/product/0636920047513.do +[20]:https://cloud.google.com/functions/docs/ +[21]:https://github.com/SerifAndSemaphore/go-serverless-list +[22]:https://www.safaribooksonline.com/library/view/oreilly-software-architecture/9781491976142/video288473.html?utm_source=oreilly&utm_medium=newsite&utm_campaign=5-things-to-watch-in-go-programming-body-text-cta +[23]:https://blog.gopheracademy.com/series/advent-2016/ +[24]:https://www.oreilly.com/ideas/data-science-gophers +[25]:https://github.com/SerifAndSemaphore/go-serverless-list diff --git a/published/20170104 How to change the Linux IO scheduler to fit your needs.md b/published/201702/20170104 How to change the Linux IO scheduler to fit your needs.md similarity index 100% rename from published/20170104 How to change the Linux IO scheduler to fit your needs.md rename to published/201702/20170104 How to change the Linux IO scheduler to fit your needs.md diff --git a/published/20170105 OpenSSL For Apache and Dovecot part 1.md b/published/201702/20170105 OpenSSL For Apache and Dovecot part 1.md similarity index 100% rename from published/20170105 OpenSSL For Apache and Dovecot part 1.md rename to published/201702/20170105 OpenSSL For Apache and Dovecot part 1.md diff --git a/published/20170106 12 Useful Commands For Filtering Text for Effective File Operations in Linux.md b/published/201702/20170106 12 Useful Commands For Filtering Text for Effective File Operations in Linux.md similarity index 100% rename from published/20170106 12 Useful Commands For Filtering Text for Effective File Operations in Linux.md rename to published/201702/20170106 12 Useful Commands For Filtering Text for Effective File Operations in Linux.md diff --git a/published/20170107 Block Ads on All Your Devices at Home with Pi-hole and an Orange Pi.md b/published/201702/20170107 Block Ads on All Your Devices at Home with Pi-hole and an Orange Pi.md similarity index 100% rename from published/20170107 Block Ads on All Your Devices at Home with Pi-hole and an Orange Pi.md rename to published/201702/20170107 Block Ads on All Your Devices at Home with Pi-hole and an Orange Pi.md diff --git a/published/20170107 Check your Local and Public IP address.md b/published/201702/20170107 Check your Local and Public IP address.md similarity index 100% rename from published/20170107 Check your Local and Public IP address.md rename to published/201702/20170107 Check your Local and Public IP address.md diff --git a/published/20170109 4 open source alternatives to Trello that you can self-host.md b/published/201702/20170109 4 open source alternatives to Trello that you can self-host.md similarity index 100% rename from published/20170109 4 open source alternatives to Trello that you can self-host.md rename to published/201702/20170109 4 open source alternatives to Trello that you can self-host.md diff --git a/published/20170109 How to get started as an open source programmer .md b/published/201702/20170109 How to get started as an open source programmer .md similarity index 100% rename from published/20170109 How to get started as an open source programmer .md rename to published/201702/20170109 How to get started as an open source programmer .md diff --git a/published/20170109 Troubleshooting tips for the 5 most common Linux issues.md b/published/201702/20170109 Troubleshooting tips for the 5 most common Linux issues.md similarity index 100% rename from published/20170109 Troubleshooting tips for the 5 most common Linux issues.md rename to published/201702/20170109 Troubleshooting tips for the 5 most common Linux issues.md diff --git a/published/20170111 How to Keep Hackers out of Your Linux Machine Part 1 Top Two Security Tips.md b/published/201702/20170111 How to Keep Hackers out of Your Linux Machine Part 1 Top Two Security Tips.md similarity index 100% rename from published/20170111 How to Keep Hackers out of Your Linux Machine Part 1 Top Two Security Tips.md rename to published/201702/20170111 How to Keep Hackers out of Your Linux Machine Part 1 Top Two Security Tips.md diff --git a/translated/tech/20170112 How to Install Nextcloud with Nginx and PHP7-FPM on CentOS 7.md b/published/201702/20170112 How to Install Nextcloud with Nginx and PHP7-FPM on CentOS 7.md similarity index 82% rename from translated/tech/20170112 How to Install Nextcloud with Nginx and PHP7-FPM on CentOS 7.md rename to published/201702/20170112 How to Install Nextcloud with Nginx and PHP7-FPM on CentOS 7.md index 2db77a9178..d13c1f21b9 100644 --- a/translated/tech/20170112 How to Install Nextcloud with Nginx and PHP7-FPM on CentOS 7.md +++ b/published/201702/20170112 How to Install Nextcloud with Nginx and PHP7-FPM on CentOS 7.md @@ -1,21 +1,9 @@ 如何在 CentOS 7 中使用 Nginx 和 PHP7-FPM 安装 Nextcloud ========================== -### 导航 +Nextcloud 是一款自由 (开源) 的类 Dropbox 软件,由 ownCloud 分支演化形成。它使用 PHP 和 JavaScript 编写,支持多种数据库系统,比如 MySQL/MariaDB、PostgreSQL、Oracle 数据库和 SQLite。它可以使你的桌面系统和云服务器中的文件保持同步,Nextcloud 为 Windows、Linux、Mac、安卓以及苹果手机都提供了客户端支持。Nextcloud 并非只是 Dropbox 的克隆,它还提供了很多附加特性,如日历、联系人、计划任务以及流媒体 Ampache。 -1. [步骤 1 - 在 CentOS 7 中安装 Nginx 和 PHP7-FPM][1] -2. [步骤 2 - 配置 PHP7-FPM][2] -3. [步骤 3 - 安装和配置 MariaDB][3] -4. [步骤 4 - 为 Nextcloud 生成一个自签名 SSL 证书][4] -5. [步骤 5 - 下载和安装 Nextcloud][5] -6. [步骤 6 - 在 Nginx 中为 Nextcloud 配置虚拟主机][6] -7. [步骤 7 - 为 Nextcloud 配置 SELinux 和 FirewallD 规则][7] -8. [步骤 8 - Nextcloud 安装][8] -9. [参考链接][9] - -Nextcloud 是一款自由 (开源) 的类 Dropbox 软件,由 ownCloud 分支演化形成。它使用 PHP 和 JavaScript 编写,支持多种数据库系统,比如 MySQL/MariaDB、PostgreSQL、Oracle 数据库和 SQLite。为了让你的桌面系统和云服务器中的文件能够保持同步,Nextcloud 为 Windows、Linux、Mac、安卓以及苹果手机都提供了客户端支持。Nextcloud 并非只是 Dropbox 的克隆,他还提供了很多附加特性,如日历、联系人、计划任务以及流媒体 Ampache。 - -在这片文章中,我将向你展示如何在 CentOS 7 服务器中安装和配置最新版本的 Nextcloud 10。我会通过 Nginx 和 PHP7-FPM 来运行 Nextcloud,同时使用 MariaDB 做为数据库系统。 +在这篇文章中,我将向你展示如何在 CentOS 7 服务器中安装和配置最新版本的 Nextcloud 10。我会通过 Nginx 和 PHP7-FPM 来运行 Nextcloud,同时使用 MariaDB 做为数据库系统。 **先决条件** @@ -58,17 +46,17 @@ php -v [![查看 PHP 版本号](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/1.png)][10] -### 步骤 2 - Configure PHP7-FPM +### 步骤 2 - 配置 PHP7-FPM -在这一个步骤中,我们将配置 php-fpm 与 Nginx 协同运行。Php7-fpm 将使用 nginx 用户来运行,并监听 9000 端口。 +在这一个步骤中,我们将配置 php-fpm 与 Nginx 协同运行。Php7-fpm 将使用 `nginx` 用户来运行,并监听 `9000` 端口。 -使用 vim 编辑 默认的 php7-fpm 配置文件。 +使用 vim 编辑默认的 php7-fpm 配置文件。 ``` vim /etc/php-fpm.d/www.conf ``` -在第 8 行和第 10行,user 和 group 赋值为 '**nginx**'. +在第 8 行和第 10行,`user` 和 `group` 赋值为 `nginx`。 ``` user = nginx @@ -81,7 +69,7 @@ group = nginx listen = 127.0.0.1:9000 ``` -去注释第 366-370 行,启用 php-fpm 的系统环境变量。 +取消第 366-370 行的注释,启用 php-fpm 的系统环境变量。 ``` env[HOSTNAME] = $HOSTNAME @@ -93,7 +81,7 @@ env[TEMP] = /tmp 保存文件并退出 vim 编辑器。 -下一步,就是在 '/var/lib/' 目录下创建一个新的文件夹 session,并将其拥有者变更为 'nginx' 用户。 +下一步,就是在 `/var/lib/` 目录下创建一个新的文件夹 `session`,并将其拥有者变更为 `nginx` 用户。 ``` mkdir -p /var/lib/php/session @@ -116,7 +104,7 @@ PHP7-FPM 配置完成 ### 步骤 3 - 安装和配置 MariaDB -我这里使用 MariaDB 作为 Nextcloud 的数据库。可以直接使用 yum 命令从 CentOS 默认远程仓库中安装 mariadb-server 包。 +我这里使用 MariaDB 作为 Nextcloud 的数据库。可以直接使用 `yum` 命令从 CentOS 默认远程仓库中安装 `mariadb-server` 包。 ``` yum -y install mariadb mariadb-server @@ -135,7 +123,7 @@ systemctl enable mariadb mysql_secure_installation ``` -键入 'Y' ,然后设置MariaDB 的 root 密码。 +键入 `Y` ,然后设置 MariaDB 的 root 密码。 ``` Set root password? [Y/n] Y @@ -148,13 +136,13 @@ Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y ``` -这样就设置好了密码,现在登录到 mysql shell 并为 Nextcloud 创建一个新的数据库和用户。这里我创建名为 '**nextcloud_db**' 的数据库以及名为 '**nextclouduser**' 的用户,用户密码为 '**nextclouduser@**'。当然了,在创建的时候你要需用一个更安全的密码。 +这样就设置好了密码,现在登录到 mysql shell 并为 Nextcloud 创建一个新的数据库和用户。这里我创建名为 `nextcloud_db` 的数据库以及名为 `nextclouduser` 的用户,用户密码为 `nextclouduser@`。当然了,要给你自己的系统选用一个更安全的密码。 ``` mysql -u root -p ``` -输入密码即可登录 mysql shell。 +输入 MariaDB 的 root 密码,即可登录 mysql shell。 输入以下 mysql 查询语句来创建新的数据库和用户。 @@ -167,11 +155,11 @@ flush privileges; [![为 Nextcloud 创建一个新的数据库和用户](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/3.png)][12] -nextcloud_db 数据库和 'nextclouduser' 用户创建完成 +`nextcloud_db` 数据库和 `nextclouduser` 数据库用户创建完成 ### 步骤 4 - 为 Nextcloud 生成一个自签名 SSL 证书 -在教程中,我会让客户端以 https 连接来运行 Nextcloud。你可以使用诸如 let's encrypt 等免费 SSL 证书,或者是自己创建 自签名 (self signed) SSL 证书。这里我使用 OpenSSL 来创建自己的自签名 SSL 证书。 +在教程中,我会让客户端以 https 连接来运行 Nextcloud。你可以使用诸如 let's encrypt 等免费 SSL 证书,或者是自己创建自签名 (self signed) SSL 证书。这里我使用 OpenSSL 来创建自己的自签名 SSL 证书。 为 SSL 文件创建新目录: @@ -179,13 +167,13 @@ nextcloud_db 数据库和 'nextclouduser' 用户创建完成 mkdir -p /etc/nginx/cert/ ``` -如下,使用 openssl 生成一个新的 SSL 证书。 +如下,使用 `openssl` 生成一个新的 SSL 证书。 ``` openssl req -new -x509 -days 365 -nodes -out /etc/nginx/cert/nextcloud.crt -keyout /etc/nginx/cert/nextcloud.key ``` -最后使用 'chmod' 命令将所有证书文件的权限设置为 '600'。 +最后使用 `chmod` 命令将所有证书文件的权限设置为 `600`。 ``` chmod 700 /etc/nginx/cert @@ -196,34 +184,34 @@ chmod 600 /etc/nginx/cert/* ### 步骤 5 - 下载和安装 Nextcloud -我直接使用 wget 命令下载 Nextcloud 到服务器上,因此需要先行安装 wget。此外,还需要安装 unzip 来进行解压。使用 'yum' 命令来安装这两个程序。 +我直接使用 `wget` 命令下载 Nextcloud 到服务器上,因此需要先行安装 `wget`。此外,还需要安装 `unzip` 来进行解压。使用 `yum` 命令来安装这两个程序。 ``` yum -y install wget unzip ``` -先进入 /tmp 目录,然后使用 wget 从官网下载最新的 Nextcloud 10。 +先进入 `/tmp` 目录,然后使用 `wget` 从官网下载最新的 Nextcloud 10。 ``` cd /tmp wget https://download.nextcloud.com/server/releases/nextcloud-10.0.2.zip ``` -解压 Nextcloud,并将其移动到 '/usr/share/nginx/html/' 目录。 +解压 Nextcloud,并将其移动到 `/usr/share/nginx/html/` 目录。 ``` unzip nextcloud-10.0.2.zip mv nextcloud/ /usr/share/nginx/html/ ``` -下一步,转到 Nginx web 根目录为 Nextcloud 创建一个 'data' 文件夹。 +下一步,转到 Nginx 的 web 根目录为 Nextcloud 创建一个 `data` 文件夹。 ``` cd /usr/share/nginx/html/ mkdir -p nextcloud/data/ ``` -变更 'nextcloud' 目录的拥有者为 'nginx' 用户和组。 +变更 `nextcloud` 目录的拥有者为 `nginx` 用户和组。 ``` chown nginx:nginx -R nextcloud/ @@ -231,7 +219,7 @@ chown nginx:nginx -R nextcloud/ ### 步骤 6 - 在 Nginx 中为 Nextcloud 配置虚拟主机 -在步骤 5 我们已经下载好了 Nextcloud 源码,并配置好了让它运行于 Nginx 服务器中,但我们还需要为它配置一个虚拟主机。在 Nginx 的 'conf.d' 目录下创建一个新的虚拟主机配置文件 'nextcloud.conf'。 +在步骤 5 我们已经下载好了 Nextcloud 源码,并配置好了让它运行于 Nginx 服务器中,但我们还需要为它配置一个虚拟主机。在 Nginx 的 `conf.d` 目录下创建一个新的虚拟主机配置文件 `nextcloud.conf`。 ``` cd /etc/nginx/conf.d/ @@ -388,7 +376,7 @@ systemctl restart nginx yum -y install policycoreutils-python ``` -然后以 root 用户来运行一下命令,以便让 Nextcloud 运行于 SELinux 环境之下。如果你是用的其他名称的目录,记得将 'nextcloud' 替换掉哦。 +然后以 root 用户来运行以下命令,以便让 Nextcloud 运行于 SELinux 环境之下。如果你是用的其他名称的目录,记得将 `nextcloud` 替换掉。 ``` semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/nextcloud/data(/.*)?' @@ -410,7 +398,7 @@ systemctl start firewalld systemctl enable firewalld ``` -现在使用 firewall-cmd 命令来开启command http 和 https 端口,然后重新加载 firewall。 +现在使用 `firewall-cmd` 命令来开启 http 和 https 端口,然后重新加载防火墙。 ``` firewall-cmd --permanent --add-service=http @@ -420,17 +408,17 @@ firewall-cmd --reload [![为 Nextcloud 配置 FirewallD 规则](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/6.png)][15] -至此,服务器配置完成 +至此,服务器配置完成。 ### 步骤 8 - Nextcloud 安装 -打开你的 Web 浏览器,输入你为 Nextcloud 设置的域名,我这里设置为 cloud.nextcloud.co,然后会重定向到安全性更好的 https 连接。 +打开你的 Web 浏览器,输入你为 Nextcloud 设置的域名,我这里设置为 `cloud.nextcloud.co`,然后会重定向到安全性更好的 https 连接。 设置你的管理员用户名和密码,然后输入数据验证信息,点击 '**完成安装 (Finish Setup)**'。 [![Nextcloud 安装](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/7.png)][16] -Nextcloud 管理面板 (文件挂了) 大致如下: +Nextcloud 管理面板大致如下: [![Nextcloud 管理面板](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/8.png)][17] @@ -438,7 +426,7 @@ Nextcloud 用户设置: [![Nextcloud 用户设置](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/9.png)][18] -管理设置 +管理设置: [![管理设置](https://www.howtoforge.com/images/how-to-install-nextcloud-with-nginx-and-php-fpm-on-centos-7/10.png)][19] @@ -460,7 +448,7 @@ via: https://www.howtoforge.com/tutorial/how-to-install-nextcloud-with-nginx-and 作者:[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/) 荣誉推出 diff --git a/published/20170112 OpenSSL For Apache and Dovecot Part 2.md b/published/201702/20170112 OpenSSL For Apache and Dovecot Part 2.md similarity index 100% rename from published/20170112 OpenSSL For Apache and Dovecot Part 2.md rename to published/201702/20170112 OpenSSL For Apache and Dovecot Part 2.md diff --git a/published/20170113 How to Encrypt Your Hard Disk in Ubuntu.md b/published/201702/20170113 How to Encrypt Your Hard Disk in Ubuntu.md similarity index 100% rename from published/20170113 How to Encrypt Your Hard Disk in Ubuntu.md rename to published/201702/20170113 How to Encrypt Your Hard Disk in Ubuntu.md diff --git a/published/20170113 How to install a Ceph Storage Cluster on Ubuntu 16.04.md b/published/201702/20170113 How to install a Ceph Storage Cluster on Ubuntu 16.04.md similarity index 100% rename from published/20170113 How to install a Ceph Storage Cluster on Ubuntu 16.04.md rename to published/201702/20170113 How to install a Ceph Storage Cluster on Ubuntu 16.04.md diff --git a/published/20170114 Build your own wiki on Ubuntu with DokuWiki.md b/published/201702/20170114 Build your own wiki on Ubuntu with DokuWiki.md similarity index 100% rename from published/20170114 Build your own wiki on Ubuntu with DokuWiki.md rename to published/201702/20170114 Build your own wiki on Ubuntu with DokuWiki.md diff --git a/published/20170116 5 Essential Tips for Securing Your WordPress Sites.md b/published/201702/20170116 5 Essential Tips for Securing Your WordPress Sites.md similarity index 100% rename from published/20170116 5 Essential Tips for Securing Your WordPress Sites.md rename to published/201702/20170116 5 Essential Tips for Securing Your WordPress Sites.md diff --git a/published/20170116 Getting started with shell scripting.md b/published/201702/20170116 Getting started with shell scripting.md similarity index 100% rename from published/20170116 Getting started with shell scripting.md rename to published/201702/20170116 Getting started with shell scripting.md diff --git a/published/20170116 How to debug C programs in Linux using gdb.md b/published/201702/20170116 How to debug C programs in Linux using gdb.md similarity index 100% rename from published/20170116 How to debug C programs in Linux using gdb.md rename to published/201702/20170116 How to debug C programs in Linux using gdb.md diff --git a/published/20170117 5 of the Best Places to Find DEBs Packages for Debian-Based Linux Distros.md b/published/201702/20170117 5 of the Best Places to Find DEBs Packages for Debian-Based Linux Distros.md similarity index 100% rename from published/20170117 5 of the Best Places to Find DEBs Packages for Debian-Based Linux Distros.md rename to published/201702/20170117 5 of the Best Places to Find DEBs Packages for Debian-Based Linux Distros.md diff --git a/published/20170118 Improve your sleep by using Redshift on Fedora.md b/published/201702/20170118 Improve your sleep by using Redshift on Fedora.md similarity index 100% rename from published/20170118 Improve your sleep by using Redshift on Fedora.md rename to published/201702/20170118 Improve your sleep by using Redshift on Fedora.md diff --git a/published/20170119 How to get started contributing to Mozilla.md b/published/201702/20170119 How to get started contributing to Mozilla.md similarity index 100% rename from published/20170119 How to get started contributing to Mozilla.md rename to published/201702/20170119 How to get started contributing to Mozilla.md diff --git a/published/201702/20170120 Getting Started with Bitbucket for Version Control.md b/published/201702/20170120 Getting Started with Bitbucket for Version Control.md new file mode 100644 index 0000000000..a60e42e2b9 --- /dev/null +++ b/published/201702/20170120 Getting Started with Bitbucket for Version Control.md @@ -0,0 +1,125 @@ +Bitbucket 版本控制入门指南 +============================================================ + + ![](https://www.blogmint.com/frontendUtil/openPage?page=blog-post-read&oId=c41aba944ad4408095c09ccabc1921ec&uId=1a715d24df2f49c0be2acf7d7409ffbb&count=1&image=one-pixel.png) + +在互联网成为一个巨大的、世界性的现象之前,开发团队常常被限制在一个小的物理空间内。如果公司没有资金支持的话,与世界另一方的人合作是一个非常昂贵或几乎不可能的梦想。 + +幸运的是,情况不再是这样了。互联网诞生了基于网络的解决方案,允许公司组成合作团体,包括彼此相距数千英里的人。 + +自从 2008 年首次推出以来,[Bitbucket][1] 已成为使用 **Mercurial** 或 **Git** 版本控制系统(**VCS**)的开发人员团队中越来越受欢迎的选择。 + +它既提供免费帐户,带有不限数量的私人存储库(每个账户最多 5 个用户),也提供多种付费计划,允许每个帐户有更多用户。此外,标记为“公开”的仓库对可以编辑或读取其内容的人数没有限制。 + +### 注册 Bitbucket + +要使用 **Bitbucket**,你需要建立一个免费帐户。要这样做,请进入 [https://bitbucket.org/][2], 然后单击免费开始Get started for free按钮。 + +首先,你需要输入有效的电子邮件地址,然后点击**继续**。 你的电子邮件帐户将被验证,如果一切正常,你将被提示输入所需的密码。完成后,再次点击 **继续**,然后检查你的电子邮件**收件箱**,以确认你的帐户是否已创建: + +[ + ![Bitbucket Singup](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Singup.png) +][3] + +*Bitbucket 注册* + +验证电子邮件地址后,系统会要求你确定**用户名**。 然后将创建你的帐户,你将会进入 **Bitbucket** 面板,在那里开始创建团队、项目和仓库: + +[ + ![Bitbucket Dashboard](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Dashboard.png) +][4] + +*Bitbucket 面板* + +如你所见,你可以在几分钟内注册 **Bitbucket**。**Atlassian** 的人简化了这个过程,以便你可以把你的时间真正用在 **Bitbucket** 上 - 我们下面会进一步讲。 + +### 使用 Bitbucket + +让我们浏览下注册 **Bitbucket** 之后必须要做的事情。它们都在顶部菜单中: + +[ + ![Explore Bitbucket Features](http://www.tecmint.com/wp-content/uploads/2017/01/Explore-Bitbucket-Features.png) +][5] + +*探索 Bitbucket 功能* + +#### 1). 创建一个团队,通过允许多个 Bitbucket 用户共享一个账号计划的方式鼓励协作。 + +这将允许他们轻松管理团队拥有的仓库。要创建团队,请输入**团队名称**,并确保团队标识不存在。接下来,输入你要添加到群组的人员的电子邮件地址,并指明是否要将其设为**管理员**。最后,单击**创建**: + +[ + ![Bitbucket - Create a Team](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-Team.png) +][6] + +*Bitbucket – 创建一个团队* + +#### 2) 创建或导入一个仓库 + +如果你已经使用基于 Git 的解决方案,你可以轻松地将你的仓库导入 **Bitbucket**。否则,你可以从头创建一个。让我们看看在每种情况下你需要做什么。 + +要创建新的仓库,请单击仓库Repositories菜单中的创建仓库Create repository选项。为新仓库和要分组到的项目选择一个名称。接下来,指明是否要将其设置为 private 并指定类型(Git 或 Mercurial)。最后,单击**创建仓库**: + +[ + ![Bitbucket - Create a New Repository](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-New-Repository.png) +][7] + +*Bitbucket – 创建一个新仓库* + +要导入已有仓库,请从**仓库**下拉菜单中选择**导入Import**仓库。要开始导入,请指定源,输入 URL 和所需的登录凭据(如果需要)。 + +最后,选择新的仓库设置,然后单击**导入**仓库。忽略有关在指定 **URL** 处找不到仓库的警告,因为它是虚拟的,仅用于演示目的: + +[ + ![Bitbucket - Import Existing Code](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Import-Existing-Code.png) +][8] + +*Bitbucket – 导入已有代码* + +就是这样,很简单吧。 + +### 在 Bitbucket 中使用仓库 + +创建一个新仓库或者导入一个仓库后,它会在面板上展示出来。这时就能执行一些常规操作,如克隆、创建分支、pull request、提交修改、添加 **README** 文件等等: + +[ + ![Bitbucket - Repository Overview](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Repository-Overview.png) +][9] + +*Bitbucket – 仓库概览* + +如果想了解如何用仓库工作,或者想要提升你的 git 技能,可以参考 [Bitbucket 官方文档][10]。 + +##### 总结 + +如你所见,不管你是版本管理的新手还是老手,**Bitbucket** 都能使管理变得更简单。如果你对本文有任何疑问或评论,请不要犹豫让我们知道。我们期待听到你的声音! + +-------------------------------------------------------------------------------- + +作者简介: + +![](http://1.gravatar.com/avatar/7badddbc53297b2e8ed7011cf45df0c0?s=256&d=blank&r=g) + +我是 Ravi Saive,TecMint 的原创作者。一个喜爱在互联网上分享技巧和提示的计算机 geek 和 Linux 老手。我的大多数服务运行在 Linux 开源平台上。请在 Twitter、Facebook、Google+ 上关注我。 + +-------------------------------------------------------------------------------- + + +via: http://www.tecmint.com/bitbucket-for-version-control/ + +作者:[Ravi Saive][a] +译者:[geekpi](https://github.com/geekpi) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/admin/ +[1]:http://bit.ly/2ieExnS +[2]:http://bit.ly/2ioJISt +[3]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Singup.png +[4]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Dashboard.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Explore-Bitbucket-Features.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-Team.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-New-Repository.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Import-Existing-Code.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Repository-Overview.png +[10]:https://confluence.atlassian.com/bitbucket/bitbucket-cloud-documentation-home-221448814.html diff --git a/published/20170120 Install Latest Thunderbird Email Client in Linux Systems.md b/published/201702/20170120 Install Latest Thunderbird Email Client in Linux Systems.md similarity index 100% rename from published/20170120 Install Latest Thunderbird Email Client in Linux Systems.md rename to published/201702/20170120 Install Latest Thunderbird Email Client in Linux Systems.md diff --git a/published/20170121 How to install Google Chrome Browser on Kali Linux.md b/published/201702/20170121 How to install Google Chrome Browser on Kali Linux.md similarity index 100% rename from published/20170121 How to install Google Chrome Browser on Kali Linux.md rename to published/201702/20170121 How to install Google Chrome Browser on Kali Linux.md diff --git a/published/20170121 How to install SSH secure shell service on Kali Linux.md b/published/201702/20170121 How to install SSH secure shell service on Kali Linux.md similarity index 100% rename from published/20170121 How to install SSH secure shell service on Kali Linux.md rename to published/201702/20170121 How to install SSH secure shell service on Kali Linux.md diff --git a/published/20170122 Ultimate guide to configure logrotate utility.md b/published/201702/20170122 Ultimate guide to configure logrotate utility.md similarity index 100% rename from published/20170122 Ultimate guide to configure logrotate utility.md rename to published/201702/20170122 Ultimate guide to configure logrotate utility.md diff --git a/published/20170123 How to Hide Apache Version Number and Other Sensitive Info.md b/published/201702/20170123 How to Hide Apache Version Number and Other Sensitive Info.md similarity index 100% rename from published/20170123 How to Hide Apache Version Number and Other Sensitive Info.md rename to published/201702/20170123 How to Hide Apache Version Number and Other Sensitive Info.md diff --git a/published/20170124 How to Hide PHP Version Number in HTTP Header.md b/published/201702/20170124 How to Hide PHP Version Number in HTTP Header.md similarity index 100% rename from published/20170124 How to Hide PHP Version Number in HTTP Header.md rename to published/201702/20170124 How to Hide PHP Version Number in HTTP Header.md diff --git a/published/20170125 How to Run sudo Command Without Entering a Password in Linux.md b/published/201702/20170125 How to Run sudo Command Without Entering a Password in Linux.md similarity index 100% rename from published/20170125 How to Run sudo Command Without Entering a Password in Linux.md rename to published/201702/20170125 How to Run sudo Command Without Entering a Password in Linux.md diff --git a/published/20170125 Solid state drives in Linux Enabling TRIM for SSDs.md b/published/201702/20170125 Solid state drives in Linux Enabling TRIM for SSDs.md similarity index 100% rename from published/20170125 Solid state drives in Linux Enabling TRIM for SSDs.md rename to published/201702/20170125 Solid state drives in Linux Enabling TRIM for SSDs.md diff --git a/published/20170126 Disable Apache Web Directory Listing Using .htaccess File.md b/published/201702/20170126 Disable Apache Web Directory Listing Using .htaccess File.md similarity index 100% rename from published/20170126 Disable Apache Web Directory Listing Using .htaccess File.md rename to published/201702/20170126 Disable Apache Web Directory Listing Using .htaccess File.md diff --git a/published/201702/20170126 Using rsync to back up your Linux system.md b/published/201702/20170126 Using rsync to back up your Linux system.md new file mode 100644 index 0000000000..00caeca519 --- /dev/null +++ b/published/201702/20170126 Using rsync to back up your Linux system.md @@ -0,0 +1,126 @@ +使用 rsync 来备份 Linux 系统 +============================================================ + +> 探索 rsync 在备份方案中的作用。 + +![Using rsync to back up your Linux system](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/hard_drives.png?itok=yZWyaSO6 "Using rsync to back up your Linux system") + +Image credits : [WIlliam][2][ Warby][3]. Modified by [Jason Baker][4]. Creative Commons [BY-SA 2.0][5]. + +在系统管理员的工作中备份无疑是一个重要的部分。当没有完整备份或者良好规划的备份和实施时,就可能或早或晚不可挽回地丢失重要的数据。 + +所有公司,无论大小,都运营在数据之上。考虑到丢失业务数据造成的经济和业务损失,从最小的个人公司到最大的跨国企业,没有一个公司能在丢失大部分数据以后得以幸存。你的办公室可以通过保险赔偿重建,但是你的数据就不可能再恢复了。 + +这里提到的丢失是指数据的完全损坏。而不是指数据被偷走,那是另一种灾难。我这里说的是数据被完全摧毁。 + +即使你只是个人用户而不是一个企业,备份你自己的数据也是非常重要的,我有二十年来的个人财务数据和我现在已经关闭的企业的数据,以及大量的电子发票。也包括近年来我创作的大量不同类型的文档、报告和数据报表。我不想失去任何这些数据。 + +所以备份是我数据长期安全的必要保障。 + +### 备份软件选择 + +有许多软件可以执行备份。大多数 Linux 发行版提供至少一种开源的备份软件。同时也有许多商业备份软件,但是这些都不符合我的需求,所以我决定使用基础的 Linux 工具来进行备份。 + +在我为 Open Source Yearbook 写的文章, [最佳搭档之 2015:tar 和 ssh][6] 中,我说明了昂贵的商业备份软件在设计实施可行的备份计划中并不是必要的。 + +从去年开始我尝试了另一种选择, [rsync][7] 命令,它有许多我已经从中受益的有趣特性。我的主要需求是所创建的备份,用户不需要解压备份压缩包就能定位和恢复文件,以便节约创建备份的时间。 + +这篇文章的目的只是为了说明 rsync 在我的备份方案中的作用。并不是 rsync 的全部能力或者它的各种适用场景的概览。 + +### rsync 命令 + +Andrew Tridgell 和 Paul Mackerras 编写了 rsync ,首次发布于 1996 年。它的目标是向另一台电脑同步文件。你注意到了他们为什么取这个名字了吗(remotely synchronize)?它是大多数发行版都提供的开源软件。 + +rsync 能够用于同步两个目录或目录树,无论它们是在同一个计算机上还是不同的计算机上,而且不仅如此,它还能做到更多。它创建或者更新的目录与源目录完全一样。新的目录不是以 tar 或 zip 等打包存储,而是普通的目录和文件,常见的 Linux 工具都能轻松访问,而这正是我所需要的。 + +rsync 的最重要的特性之一是它处理源目录被修改的已有文件的方式。它使用分块校验来比较源文件和目标文件,而不是从源把整个文件复制过去。如果两个文件所有块的校验和都相同,那么就不用传输数据。否则只有被改变的块被传输。这样节约了远程同步消耗的大量时间和带宽。比如,我第一次使用 rsync 脚本来把我所有的主机备份到一个外接的大型 usb 硬盘上需要三个小时,因为所有的数据都需要传输过去。而接下来的备份需要的时间就只是 3 到 8 分钟,这取决于上次备份以来创建和改变了多少文件。我使用 `time` 命令来记录实际花费的时间。昨天晚上,我只花了三分钟来从六个远程系统和本地工作站备份大概 750 Gb 数据。实际上只有在白天改变的几百 Mb 数据需要备份。 + +下面的命令可以用来同步两个目录及其任意子目录的内容。也就是说,在新目录的内容和源目录同步完之后,它们的内容完全一样。 + +``` +rsync -aH sourcedir targetdir +``` + +`-a` 选项表示归档模式,它会保持权限、所有关系和符号(软)链接。`-H` 选项用来保持硬链接。注意源目录和目标目录都可以在远程主机上。 + +假设昨天我们使用 rsync 同步了两个目录。今天我们想再同步一次,但是我们从源目录删除了一些文件。rsync 默认只复制新的和改变过的文件到新目录里,而不去改变新目录里被我们删除的文件,但是如果你想让那些在源目录里被删除的文件在新目录里也被删除,那么你可以加上 `--delete` 选项来删除。 + +另一个有趣的选项,也是我个人最喜欢的选项是 `--link-dest`,因为它极大地增加了 rsync 的能力和灵活性。`--link-dest` 使每日备份只花费很少的额外空间和很短的时间。 + +用这个选项指定前一天的备份目录,以及今天的备份目录,然后 rsync 会创建今天的新备份目录,并将昨天备份目录里的每一个文件在今天的备份目录中创建硬链接。现在我们在今天的备份目录中有一大堆指向昨天备份的硬链接。文件没有被重复创建,而是创建了一些硬链接。对于[硬链接][8],在 Wikipedia 中有非常详细的描述。而在用昨天的备份目录文件的硬链接创建了今天的备份之后,rsync 和平常一样进行备份,如果在文件中检测到了变化,就不会做硬链接,而是从昨天的备份目录里做一个文件的副本,再把源文件中变化的部分复制过去。(LCTT 译注:此处疑似原文表述不清,参见 `generator.c` 的 `try_dests_reg` 函数先根据 `match_level` 选择复制或者硬链接,而不是创建硬链接后再判断 `match_level`) + +现在我们的命令类似于下面这样。 + +``` +rsync -aH --delete --link-dest=yesterdaystargetdir sourcedir todaystargetdir +``` + +你也可能想要排除一些不想要备份的目录或者文件。那么就可以使用 `--exclude` 选项。用这个选项加上你想排除文件或目录的模式。你可以用下面的新命令来排除浏览器的缓存。 + +``` +rsync -aH --delete --exclude Cache --link-dest=yesterdaystargetdir sourcedir todaystargetdir +``` + +注意:你想排除的每一个文件的模式前面都分别需要加上 `--exclude` 选项。 + +rsync 可以同步远程主机,无论是作为同步源头还是目标。再举一个例子,我们假设想要把名为 remote1 的远程主机的目录同步到本地。因为 ssh 作为与远程主机交换数据的默认协议,我一直使用 ssh 选项。现在命令类似于下面这样。 + +``` +rsync -aH -e ssh --delete --exclude Cache --link-dest=yesterdaystargetdir remote1:sourcedir todaystargetdir +``` + +这就是我的 rsync 备份命令的最终版本。 + +你可以依靠 rsync 的大量选项来定制你的同步过程。大多数情况而言,我刚刚描述的简单命令就足以胜任我的个人需要。你可以阅读 rsync 丰富的文档来了解它的其他能力。 + +### 部署备份 + +我的备份自动运行因为—“万物皆可自动化”。我写了一个 BASH 脚本使用 rsync 创建每天的备份。包括确保备份介质被挂载,生成每天的备份目录的名字,以及在备份介质中创建合适的目录结构,最后执行真正的备份再卸载备份介质。 + +我用 cron 每天早晨执行脚本确保我永远不会忘记备份。 + +我的脚本 rsbu 和配置文件 rsbu.conf 可以在 https://github.com/opensourceway/rsync-backup-script 上获取。 + +### 恢复测试 + +所有没有经过测试的备份计划都不完整的。你可以通过测试恢复某个文件或者整个目录,以确保备份在照常工作并且可以通过它来在数据全部丢失后恢复。我见过太多备份由于种种理由失败,以及由于缺乏测试忽略的问题导致宝贵的数据被丢失。 + +选择一个文件恢复到比如 `/tmp` 的测试目录,这样你就不会覆盖任何备份后被更新的文件。验证文件的内容是否是你预期的。恢复用 rsync 备份的文件仅仅只是找到你的备份文件然后把它复制到你想恢复的地方去那样简单。 + +我有几次不得不恢复我的个人文件,偶尔是整个目录。大多数是自己意外删除了文件或者目录。有几次是因为硬盘崩溃。这些备份迟早会派上用场。 + +### 最后一步 + +但仅仅创建备份并不能拯救你的业务,你需要定期的地创建备份,使最近的一次备份储存在另一台远程机器上,如果有可能,放在另外一个建筑物中或几英里之外。这样可以确保大规模的灾难不会摧毁你的所有备份。 + +对于小型企业的一个合理选择是在可移动介质上做每日备份,晚上把最新的备份带回家里,第二天早上把更早的备份带到办公室。你就会有几个轮流的拷贝。甚至可以把最新的备份带到银行并放到你的保管箱里,然后带回之前的备份。 + +-------------------------------------------------------------------------------- + +作者简介: + +David Both - 他居住在北卡罗来纳州的罗列,是 Linux 和开源提倡者。他已经从事 IT 行业 40 多年。在 IBM 教授了二十多年 OS/2。在 IBM 的时候,他在 1981 年为最初的 IBM 个人电脑编写了第一门培训课程。他为红帽教授 RHCE 课程,并曾在世通公司、思科、北卡罗来纳州政府工作。他使用 Linux 和开源软件已经有二十年左右了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/1/rsync-backup-linux + +作者:[David Both][a] +译者:[trnhoe](https://github.com/trnhoe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/dboth +[1]:https://opensource.com/article/17/1/rsync-backup-linux?rate=xmBjzZgqTu6p-Dw2gXy5cq43KHcSNs4-nisv_jnUgbw +[2]:https://www.flickr.com/photos/wwarby/11644168395 +[3]:https://www.flickr.com/photos/wwarby/11644168395 +[4]:https://opensource.com/users/jason-baker +[5]:https://creativecommons.org/licenses/by/2.0/ +[6]:https://opensource.com/business/15/12/best-couple-2015-tar-and-ssh +[7]:https://en.wikipedia.org/wiki/Rsync +[8]:https://en.wikipedia.org/wiki/Hard_link +[9]:https://github.com/opensourceway/rsync-backup-script +[10]:https://opensource.com/user/14106/feed +[11]:https://opensource.com/article/17/1/rsync-backup-linux#comments +[12]:https://opensource.com/users/dboth diff --git a/published/20170130 4 ways to improve your security online right now.md b/published/201702/20170130 4 ways to improve your security online right now.md similarity index 100% rename from published/20170130 4 ways to improve your security online right now.md rename to published/201702/20170130 4 ways to improve your security online right now.md diff --git a/published/20170130 5 Reasons To Install Linux Today.md b/published/201702/20170130 5 Reasons To Install Linux Today.md similarity index 100% rename from published/20170130 5 Reasons To Install Linux Today.md rename to published/201702/20170130 5 Reasons To Install Linux Today.md diff --git a/published/20170131 5 DevOps Tools for Logging and Monitoring.md b/published/201702/20170131 5 DevOps Tools for Logging and Monitoring.md similarity index 100% rename from published/20170131 5 DevOps Tools for Logging and Monitoring.md rename to published/201702/20170131 5 DevOps Tools for Logging and Monitoring.md diff --git a/published/20170131 5 new guides for working with OpenStack.md b/published/201702/20170131 5 new guides for working with OpenStack.md similarity index 100% rename from published/20170131 5 new guides for working with OpenStack.md rename to published/201702/20170131 5 new guides for working with OpenStack.md diff --git a/published/20170131 Getting Started with MySQL Clusters as a Service.md b/published/201702/20170131 Getting Started with MySQL Clusters as a Service.md similarity index 100% rename from published/20170131 Getting Started with MySQL Clusters as a Service.md rename to published/201702/20170131 Getting Started with MySQL Clusters as a Service.md diff --git a/published/20170201 How to Create a Shared Directory for All Users in Linux.md b/published/201702/20170201 How to Create a Shared Directory for All Users in Linux.md similarity index 100% rename from published/20170201 How to Create a Shared Directory for All Users in Linux.md rename to published/201702/20170201 How to Create a Shared Directory for All Users in Linux.md diff --git a/published/20170202 3 desktop wikis to help organize information.md b/published/201702/20170202 3 desktop wikis to help organize information.md similarity index 100% rename from published/20170202 3 desktop wikis to help organize information.md rename to published/201702/20170202 3 desktop wikis to help organize information.md diff --git a/published/20170205 Arch Linux vs. Solus vs. openSUSE Tumbleweed: Your Favorite Rolling Distro Is.md b/published/201702/20170205 Arch Linux vs. Solus vs. openSUSE Tumbleweed: Your Favorite Rolling Distro Is.md similarity index 100% rename from published/20170205 Arch Linux vs. Solus vs. openSUSE Tumbleweed: Your Favorite Rolling Distro Is.md rename to published/201702/20170205 Arch Linux vs. Solus vs. openSUSE Tumbleweed: Your Favorite Rolling Distro Is.md diff --git a/published/20170205 How to Activate the Global Menu in Kde Plasma 5.9.md b/published/201702/20170205 How to Activate the Global Menu in Kde Plasma 5.9.md similarity index 100% rename from published/20170205 How to Activate the Global Menu in Kde Plasma 5.9.md rename to published/201702/20170205 How to Activate the Global Menu in Kde Plasma 5.9.md diff --git a/published/20170206 How to Check Remote Ports are Reachable Using nc Command.md b/published/201702/20170206 How to Check Remote Ports are Reachable Using nc Command.md similarity index 100% rename from published/20170206 How to Check Remote Ports are Reachable Using nc Command.md rename to published/201702/20170206 How to Check Remote Ports are Reachable Using nc Command.md diff --git a/published/20170207 CloudStats – Best Server Monitoring Tool for SaaS Businesses and Everyone Else.md b/published/201702/20170207 CloudStats – Best Server Monitoring Tool for SaaS Businesses and Everyone Else.md similarity index 100% rename from published/20170207 CloudStats – Best Server Monitoring Tool for SaaS Businesses and Everyone Else.md rename to published/201702/20170207 CloudStats – Best Server Monitoring Tool for SaaS Businesses and Everyone Else.md diff --git a/published/20170207 How To hack windows with Kali Linux.md b/published/201702/20170207 How To hack windows with Kali Linux.md similarity index 100% rename from published/20170207 How To hack windows with Kali Linux.md rename to published/201702/20170207 How To hack windows with Kali Linux.md diff --git a/published/20170207 Vim Editor Modes Explained.md b/published/201702/20170207 Vim Editor Modes Explained.md similarity index 100% rename from published/20170207 Vim Editor Modes Explained.md rename to published/201702/20170207 Vim Editor Modes Explained.md diff --git a/published/20170208 5 security tips for shared and public computers.md b/published/201702/20170208 5 security tips for shared and public computers.md similarity index 100% rename from published/20170208 5 security tips for shared and public computers.md rename to published/201702/20170208 5 security tips for shared and public computers.md diff --git a/published/20170208 rtop – An Interactive Tool to Monitor Remote Linux Server Over SSH.md b/published/201702/20170208 rtop – An Interactive Tool to Monitor Remote Linux Server Over SSH.md similarity index 100% rename from published/20170208 rtop – An Interactive Tool to Monitor Remote Linux Server Over SSH.md rename to published/201702/20170208 rtop – An Interactive Tool to Monitor Remote Linux Server Over SSH.md diff --git a/translated/tech/20170209 CoreFreq – A Powerful CPU Monitoring Tool for Linux Systems.md b/published/201702/20170209 CoreFreq – A Powerful CPU Monitoring Tool for Linux Systems.md similarity index 62% rename from translated/tech/20170209 CoreFreq – A Powerful CPU Monitoring Tool for Linux Systems.md rename to published/201702/20170209 CoreFreq – A Powerful CPU Monitoring Tool for Linux Systems.md index 986ca207db..662e36ff67 100644 --- a/translated/tech/20170209 CoreFreq – A Powerful CPU Monitoring Tool for Linux Systems.md +++ b/published/201702/20170209 CoreFreq – A Powerful CPU Monitoring Tool for Linux Systems.md @@ -1,35 +1,35 @@ -CoreFreq - 一款强大的 Linux 下监控 CPU 的工具 +CoreFreq:一款强大的监控 CPU 的专业工具 ============================================================ -CoreFreq 是一个用于英特尔64位处理器的[ CPU 监控程序][1],并且支持Atom、Core2、Nehalem、SandyBridge 及以上、还有 AMD 0F 家族。 +CoreFreq 是一个用于英特尔 64 位处理器的 [CPU 监控程序][1],并且支持 Atom、Core2、Nehalem、SandyBridge 及以上、还有 AMD 0F 家族。 -它的核心建立在内核模块上,帮助从每个 CPU 核心检索内部性能计数器,并且与收集数据的守护进程一起工作,并用一个小型控制台客户端链接到守护程序并显示收集的数据。 +它的核心建立在内核模块上,用于从每个 CPU 核心检索内部性能计数器,并且与收集数据的守护进程一起工作,一个小型控制台客户端连接到该守护程序并显示收集的数据。 [ ![CoreFreq CPU Monitoring](http://www.tecmint.com/wp-content/uploads/2017/02/CoreFreq-CPU-Monitoring.gif) ][2] -它提供了以高精度重新捕获 CPU 数据的基础工作: +它提供了高精度的重新捕获 CPU 数据的基础工作: -1. 核心频率和比率; SpeedStep(EIST)、Turbo Boost、超线程(HTT)以及基本时钟。 -2. 性能计数器结合时间戳计数器(TSC)、未分配的核心循环(UCC)、未赋值的引用循环(URC)。 -3. 每周期或每秒的指令数、IPS、IPC 或 CPI。 -4. CPU C 的状态 C0 C1 C3 C6 C7 - C1E - C1、C3 的自动/降级。 -5. 带有 Tjunction Max 的 DTS 温度、热监测 TM1、TM2 的状态。 -6. 包括用于自举的高速缓存和应用程序 CPU 拓扑图。 -7. 处理器特性、品牌、架构字符串。 +1. 核心频率和比率;SpeedStep(EIST)、Turbo Boost、超线程(HTT)以及基本时钟(Base Clock)。 +2. 性能计数器结合时间戳计数器(Time Stamp Counter)(TSC)、非停机核心周期(Unhalted Core Cycles)(UCC)、非停机引用周期(Unhalted Reference Cycles)(URC)。 +3. 每周期或每秒的指令数:IPS、IPC 或 CPI。 +4. CPU C 状态: C0 C1 C3 C6 C7 - C1E - C1、C3 的自动/非降级(UnDemotion)。 +5. 带有 Tjunction Max 的 DTS 温度、热监测(Thermal Monitoring) TM1、TM2 状态。 +6. 包括用于自举的高速缓存和应用程序 CPU 拓扑图。 +7. 处理器特性、品牌、架构字符串。 -注意:此工具更适用于专家 Linux 用户和经验丰富的系统管理员,但新手用户可以逐步学习如何使用它。 +注意:此工具更适用于 Linux 专家用户和经验丰富的系统管理员,但新手用户可以逐步学习如何使用它。 #### CoreFreq 如何工作 -它通过调用一个 Linux 内核模块,然后使用: +它通过调用一个 Linux 内核模块实现,它使用了: -1. 汇编代码保持性能计数器的读数尽可能接近。 -2. 每个 CPU 影响 slab 数据内存加上高分辨率定时器。 -3. 可以暂停/恢复和 CPU 热插拔。 -4. 使用共享内存来保护内核免受来自用户空间程序的损害。 -5. 使用原子同步的线程来消除互斥和死锁。 +1. 汇编代码保持尽可能接近性能计数器读数。 +2. 按每个 CPU 影响的 slab 数据内存加上高分辨率定时器。 +3. 支持 CPU 暂停/恢复和 CPU 热插拔。 +4. 使用共享内存来保护内核免受来自用户空间程序的损害。 +5. 使用原子级同步的线程来消除互斥和死锁。 ### 如何在 Linux 中安装 CoreFreq @@ -48,11 +48,12 @@ $ git clone https://github.com/cyring/CoreFreq.git $ cd CoreFreq $ make ``` + [ ![Build CoreFreq Program](http://www.tecmint.com/wp-content/uploads/2017/02/make-corefreq.png) ][3] -构建 CoreFreq 程序 +*构建 CoreFreq 程序* 注意:Arch Linux 用户可以从 AUR 中安装 [corefreq-git][4]。 @@ -68,19 +69,20 @@ $ sudo ./corefreqd ``` $ ./corefreq-cli ``` + [ ![CoreFreq Linux CPU Monitoring](http://www.tecmint.com/wp-content/uploads/2017/02/CoreFreq-Linux-CPU-Monitoring.gif) ][5] -CoreFreq Linux CPU 监控 +*CoreFreq Linux CPU 监控* 在上面的界面中,你可以使用这些快捷键: -1. 使用 `F2` 显示屏幕顶部显示的使用菜单。 -2. 使用 `右` 和 `左` 箭头移动菜单选项卡。 -3. 使用 `上`和 `下` 箭头选择菜单项,然后单击[Enter]。 -4. 使用 `F4` 关闭程序。 -5. 使用 `h` 打开快速参考。 +1. 使用 `F2` 显示屏幕顶部显示的使用菜单。 +2. 使用 `右` 和 `左` 箭头移动菜单选项卡。 +3. 使用 `上`和 `下` 箭头选择菜单项,然后单击回车。 +4. 使用 `F4` 关闭程序。 +5. 使用 `h` 打开快速参考。 要查看所有的使用选项,请输入以下命令: @@ -88,7 +90,7 @@ CoreFreq Linux CPU 监控 $ ./corefreq-cli -h ``` -CoreFreq 选项 +CoreFreq 选项: ``` CoreFreq. Copyright (C) 2015-2017 CYRIL INGENIERIE @@ -135,9 +137,9 @@ $ ./corefreq-cli -i $ ./corefreq-cli -c ``` -有关更多信息和用法,请访问 CoreFreq Github 仓库:[https://github.com/cyring/CoreFreq][6] +有关更多信息和用法,请访问 CoreFreq 的 Github 仓库:[https://github.com/cyring/CoreFreq][6] 。 -在本文中,我们回顾了一个强大的 CPU 监控工具,这对于 Linux 专家或经验丰富的系统管理员来说可能比新手用户更有用。 +在本文中,我们评估了一个强大的 CPU 监控工具,这对于 Linux 专家或经验丰富的系统管理员来说可能比新手用户更有用。 通过下面的评论栏与我们分享你对这个工具或任何相关的想法。 @@ -153,7 +155,7 @@ via: http://www.tecmint.com/corefreq-linux-cpu-monitoring-tool/ 作者:[Aaron Kili][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/) 荣誉推出 diff --git a/published/20170210 Basic screen command usage and examples.md b/published/201702/20170210 Basic screen command usage and examples.md similarity index 100% rename from published/20170210 Basic screen command usage and examples.md rename to published/201702/20170210 Basic screen command usage and examples.md diff --git a/published/201702/20170210 WD My Passport Wireless Linux Hacks.md b/published/201702/20170210 WD My Passport Wireless Linux Hacks.md new file mode 100644 index 0000000000..b88d3daf1b --- /dev/null +++ b/published/201702/20170210 WD My Passport Wireless Linux Hacks.md @@ -0,0 +1,56 @@ +对西部数据 My Passport Wireless 移动存储进行 Linux 魔改 +============================================================ + +虽然 WD My Passport Wireless 本身就是一个相当有用的设备,但它有一个轻量级但完整的 Linux 发行版提供支持的事实意味着其功能可以进一步扩展。例如,在设备上部署 [rclone][3],这样你可以将存储在磁盘上的照片和 RAW 文件备份到任何支持的云存储服务中。 + +在开始之前,你需要将设备连接到 Wi-Fi 网络并启用 SSH(以便你可以通过 SSH 访问底层 Linux 系统)。要将 WD My Passport Wireless 连接到当前的 Wi-Fi 网络中,请为设备供电并连接到从常规 Linux 计算机创建的无线热点。打开浏览器,进入 [http://mypassport.local][1],然后登录到设备的 web 界面。切换到 Wi-Fi 一栏,并连接到现有的本地 Wi-Fi 网络。然后切换到管理员部分并启用 SSH 访问。 + + ![wd-mypassport-wireless-admin](https://scribblesandsnaps.files.wordpress.com/2017/02/wd-mypassport-wireless-admin.png?w=605) + +在你的 Linux 机器上,打开终端并使用 `ssh root@mypassport.local` 连接到设备。 + +使用下面的命令部署 rclone: + +``` +curl -O http://downloads.rclone.org/rclone-current-linux-arm.zip +unzip rclone-current-linux-arm.zip +cd rclone-*-linux-arm +cp rclone /usr/sbin/ +chown root:root /usr/sbin/rclone +chmod 755 /usr/sbin/rclone +mkdir -p /usr/local/share/man/man1 +sudo cp rclone.1 /usr/local/share/man/man1/ +sudo mandb +``` + +完成后运行 `rclone config` 命令。由于在无外接显示器的机器上配置 rclone,请按照[远程设置][4]页面上的说明进行操作。你可以在 [Linux Photography][5] 这本书中找到有关配置和使用 rclone 的详细信息。 + +你也可以将 WD My Passport Wireless 用到其他实际用途。由于设备附带了 Python,因此你可以在设备上运行脚本和基于 Python 的 web 应用程序。例如,你可以部署简单的 [What’s in My Bag][6] 程序来跟踪你的照相设备。 + +``` +curl -LOk https://github.com/dmpop/wimb/archive/master.zip +unzip master.zip +mv wimb-master/ wimb +cd wimb +curl -LOk https://github.com/bottlepy/bottle/raw/master/bottle.py +``` + +运行 `./wimb.py` 启动应用,并在浏览器中打开 [http://mypassport:8080/wimb][2] 访问并使用程序。 + +-------------------------------------------------------------------------------- + +via: https://scribblesandsnaps.com/2017/02/10/wd-my-passport-wireless-linux-hacks/ + +作者:[Dmitri Popov][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://scribblesandsnaps.com/author/dmpop/ +[1]:http://mypassport.local/ +[2]:http://mypassport:8080/wimb +[3]:http://rclone.org/ +[4]:http://rclone.org/remote_setup/ +[5]:https://gumroad.com/l/linux-photography +[6]:https://github.com/dmpop/wimb diff --git a/published/20170211 Lets Chat Windows vs. Linux.md b/published/201702/20170211 Lets Chat Windows vs. Linux.md similarity index 100% rename from published/20170211 Lets Chat Windows vs. Linux.md rename to published/201702/20170211 Lets Chat Windows vs. Linux.md diff --git a/published/20170211 Who Is Root Why Does Root Exist.md b/published/201702/20170211 Who Is Root Why Does Root Exist.md similarity index 100% rename from published/20170211 Who Is Root Why Does Root Exist.md rename to published/201702/20170211 Who Is Root Why Does Root Exist.md diff --git a/published/20170212 How to Build Your Own Wiki with XWiki on CentOS.md b/published/201702/20170212 How to Build Your Own Wiki with XWiki on CentOS.md similarity index 100% rename from published/20170212 How to Build Your Own Wiki with XWiki on CentOS.md rename to published/201702/20170212 How to Build Your Own Wiki with XWiki on CentOS.md diff --git a/published/20170213 How To Hide Files And Folders in File Manager Without Renaming.md b/published/201702/20170213 How To Hide Files And Folders in File Manager Without Renaming.md similarity index 100% rename from published/20170213 How To Hide Files And Folders in File Manager Without Renaming.md rename to published/201702/20170213 How To Hide Files And Folders in File Manager Without Renaming.md diff --git a/translated/tech/20170213 How to Back Up Your Android Data with ADB on Ubuntu.md b/published/201702/20170213 How to Back Up Your Android Data with ADB on Ubuntu.md similarity index 53% rename from translated/tech/20170213 How to Back Up Your Android Data with ADB on Ubuntu.md rename to published/201702/20170213 How to Back Up Your Android Data with ADB on Ubuntu.md index 6c818862d0..995ccc5e73 100644 --- a/translated/tech/20170213 How to Back Up Your Android Data with ADB on Ubuntu.md +++ b/published/201702/20170213 How to Back Up Your Android Data with ADB on Ubuntu.md @@ -1,22 +1,17 @@ -如何在 Ubuntu 上使用 ADB 备份你的 Android 数据 +如何在 Ubuntu 上使用 ADB 备份 Android 数据 ============================================================ - ![](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/02/android-backup-ubuntu.jpg "How to Back Up Your Android Data with ADB on Ubuntus") +备份 Android 系统上的应用数据、文本信息等等是非常乏味的,有时还很昂贵。电子市场的许多应用都承诺可以备份数据,但效果不佳或者需要付昂贵费用。你是否知道有一种更好的方法可以来做这件事,并且在你的电脑上就可以完成? +Android 自带一套开发工具。有许多种开发工具,但人们最为感兴趣的项目是 ADB(或者叫做 Android 调试桥 Android Debug Bridge)。它允许用户通过命令行直接访问任何 Android 设备。有了这个工具,一切皆有可能 - 包括备份整个 Android 设备。在这篇文章中,将讨论如何在 Ubuntu 系统上完成这件事。 -备份 Android 系统上的应用数据、文本信息和收藏是非常乏味的,有时还要花费很大的代价。电子市场的许多应用都承诺可以备份数据但却效果不佳或者需要付大量费用。你是否知道有一种更好的方法可以来做这件事,并且在你的电脑上就可以完成? - -[广告来自谷歌][9] - -Android 自带一套开发工具。有许多种开发工具,但人们最为感兴趣、最有名的项目是 ADB(或者叫做 Android 调试桥)。它允许用户直接通过命令行访问任何 Android 设备。有了这个工具,一切皆有可能 - 包括备份整个 Android 设备。在这篇文章中,将讨论如何在 Ubuntu 系统上完成这件事。 - -**注**:这篇教程是针对 Ubuntu Linux 系统的。但是, ADB 在 Windows 系统和 Mac 上也是可用的,也可以在这些平台上对 Android 数据进行备份。[下载针对 Windows 和 Mac 的 ADB 版本][10] +**注**:这篇教程是针对 Ubuntu Linux 系统的。不过, ADB 在 Windows 系统和 Mac 上也是可用的,也可以在这些平台上对 Android 数据进行备份。[下载针对 Windows 和 Mac 的 ADB 版本。][10] ### 安装 ADB 并启用 USB 调试 -打开一个终端窗口然后输入下面的命令来安装 ADB,它将与 Android 进行会话。 +打开一个终端窗口,然后输入下面的命令来安装 ADB,它将与 Android 进行会话。 ``` sudo apt install adb @@ -24,11 +19,11 @@ sudo apt install adb ![adb-install-adb-ubuntu](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/02/adb-install-adb-ubuntu.jpg "adb-install-adb-ubuntu") -在系统上安装好 ADB 工具以后,调试需要在 Android 内部启动。首先打开 Android 的设置区域。然后一直滚动到底部找到“关于手机”并点击。这将打开“电话状态页”。在这一页面上再次滚动到底部,找到“版本号”并点击七次。从而启动“开发者模式”。 +在系统上安装好 ADB 工具以后,需要在 Android 内部启动调试。首先打开 Android 的设置Settings区域。然后一直滚动到底部找到“关于手机About Phone”并点击。这将打开“电话状态Phone status”页。在这一页面上再次滚动到底部,找到“版本号Build number”并点击七次,从而启动开发者模式。 ![adb-about-phone](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/02/adb-about-phone.jpg "adb-about-phone") -为了进入开发者设置,按设备上的返回键返回上一页面。在“设置”中将会出现一个新的选项:“开发者选项”。点击“开发者选项”进入开发者设置区域。滚动页面直到看到 “Android 调试”(或它的一些其他名称),点击它,从而启用设置。 +为了进入开发者设置Developer Settings,按设备上的返回键返回上一页面。在“设置”中将会出现一个新的选项:“开发者选项Developer options”。点击它进入开发者设置区域。滚动页面直到看到 “Android 调试Android debugging”(或它的一些其他名称),点击它启用设置。 ### 备份 @@ -38,11 +33,11 @@ sudo apt install adb adb start-server ``` -这将启动 ADB 服务器。通过运行这个命令,会很快解锁 Android 设备,因为 ADB 将强制出现一个确认窗口,必须选择继续。 +这将启动 ADB 服务器。运行这个命令时,要快速解锁 Android 设备,因为 ADB 将强制出现一个确认窗口,必须选择接受后才可继续。 ![adb-all-usb-debugging](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/02/adb-all-usb-debugging.jpg "adb-all-usb-debugging") -要启动备份进程,打开终端然后执行下面的备份命令。该命令将读取 Android 上的文本信息以及其他应用数据,然后存入加密文件中。 +要启动备份进程,打开终端,然后执行下面的备份命令。该命令将读取 Android 上的文本信息以及其他应用数据,然后存入加密文件中。 ``` adb backup -apk -shared -all -f backup-file.adb @@ -50,7 +45,7 @@ adb backup -apk -shared -all -f backup-file.adb ![adb-full-backup](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/02/adb-full-backup.jpg "adb-full-backup") -当运行备份命令时,会在 Android 启动备份进程前提示用户查看 Android 并设置加密文件的密码。请输入一个强大、容易记住的密码。然后,点击“备份我的数据”按钮。备份过程将会花费一定时间。备份完成以后,在目录 “/home/username/” 中会出现一个叫做 “backup-file.adb” 的文件。 +当运行备份命令时,Android 会在启动备份进程前提示用户查看 Android 并设置加密文件的密码。请输入一个强壮而容易记住的密码。然后,点击“备份我的数据”按钮。备份过程将会花费一定时间。备份完成以后,在目录 `/home/username/` 中会出现一个叫做 `backup-file.adb` 的文件。 ### 恢复备份 @@ -63,11 +58,11 @@ adb restore backup-file.adb ![adb-full-restore](https://maketecheasier-2d0f.kxcdn.com/assets/uploads/2017/02/adb-full-restore.jpg "adb-full-restore") -再次转到 Android, 因为 ADB 将提示用户输入密码。这次,不是创建一个密码,而是需要输入之前创建的那个密码。在点击 “恢复我的数据” 以后,恢复进程就开始了。耐心点,因为这可能需要一定时间。 +再次转到 Android, 因为 ADB 将提示用户输入密码。这次,不是创建一个密码,而是需要输入之前创建的那个密码。在点击 “恢复我的数据restore my data” 以后,恢复进程就开始了。耐心点,因为这可能需要一定时间。 ### 结论 -没有多少 Android 用户知道这样备份数据,但是 ADB 的确很强大。利用它甚至可以获得对一个设备的 root 访问。事实上,利用这个工具还可以做很多的事情,因此需要更多的文章来讨论它。 +没有多少 Android 用户知道这样备份数据,但是 ADB 的确很强大。利用它甚至可以获得对设备的 root 访问。事实上,利用这个工具还可以做很多的事情,需要更多的文章来讨论它。 你还知道 ADB 可以用来干什么吗?请在下面的评论区告知我们! diff --git a/published/201702/20170216 Tips To Improve Ubuntu Speed.md b/published/201702/20170216 Tips To Improve Ubuntu Speed.md new file mode 100644 index 0000000000..8411489f88 --- /dev/null +++ b/published/201702/20170216 Tips To Improve Ubuntu Speed.md @@ -0,0 +1,94 @@ +加速老旧 Ubuntu 系统的技巧 +============ + +[ + ![Tips To Improve Ubuntu Speed](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/tips-to-improve-ubuntu-speed_orig.jpg) +][2] + +你的 Ubuntu 系统可以运行得如此顺畅,以至于你会奇怪为什么没有早一些从那些桌面加载很慢的操作系统(比如 Windows)转过来。Ubuntu 在大多数现代化的机器上都能够很顺畅的运行,一些更老的机器使用 Ubuntu 系统的一些变种版本,比如 Lubuntu、Xubuntu 和 [Ubuntu MATE][6],同样给人留下了深刻印象。极少的情况下,你对 Ubuntu 桌面的使用体验会越来越糟。如果非常不走运,你的 Ubuntu 系统并没有像你所希望的那样运行顺畅,那么你可以做一些事情来提高系统性能和响应速度。 + +不过首先我们来看一看为什么电脑会运行得很慢?下面是我列举的一些原因: + +1. 电脑陈旧 +2. 安装了太多的应用 +3. 系统里的一些东西坏了 +4. 还有更多的原因... + +现在让我们来看一些改善这个问题的技巧。 + +### 1、 交换值Swappiness + +如果你的系统有一个交换分区,那么这个技巧对你是最适合的(注:交换分区不建议为固态驱动器,因为这样会缩短驱动器的使用寿命)。交换分区可以帮助系统,特别是内存容量较低的系统,来管理系统内存。将数据写入交换分区(硬盘)比写入内存要慢一些,所以你可以通过减少 `swappiness` 值来限制数据写入交换分区的频率。默认情况下, Ubuntu 的 `swappiness` 值是 60%, 所以你可以通过下面的命令将它减至 10%: +``` +sudo bash -c "echo 'vm.swappiness = 10' >> /etc/sysctl.conf" +``` +### 2、 停止索引 + +索引的目的是加快搜索结果,但另一方面,索引会导致较老配置的系统出现一些问题。为了停止索引,输入下面的命令来移除索引工具: + +``` +sudo apt-get purge apt-xapian-index +``` + +### 3、 管理启动应用startup applications + +启动应用会对系统性能造成很大的影响。当你安装一些应用以后,这些应用会添加启动项,从而当你启动系统的时候它们也跟着启动,但你可以移除这些应用以提高系统性能。通过在 Unity 窗口搜索打开 “启动应用”。绝大多数自启动选项都会被隐藏,所以在终端输入下面的命令使它们可见然后你就可以停止某些 “启动应用”了: + +``` +sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/\*.desktop +``` +[ + ![ubuntu startup application](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/ubuntu-startup-application_orig.jpg) +][3] + +### 4、 尝试预载入 + +预载入(`preload`) 是一个守护进程/后台服务,它可以监控系统上使用的应用程序,它会将所需要的二进制库在其需要加载到内存前就预先载入,以便应用程序启动得更快。在终端输入下面的命令安装预载入: + +``` +sudo apt-get install preload +``` + +### 5、 选择更加轻量型的应用 + +你在 Ubuntu 桌面上使用什么应用程序呢?有更轻量的替代品吗?如果有,就替换成它们——如果它们也能满足你的需求的话。 LibreOffice 能够给你最好的办公体验,但是它的替代品,比如 Abiword 能够很大程度的改善系统性能。 + +### 6、 切换到一个更加轻量型的桌面环境 + +你在 Ubuntu 系统上使用的桌面环境是 Unity 或 KDE 吗?这些桌面环境对系统的要求很高。相反,你可以在当前桌面环境之外同时安装一个 LxQt 或者 XFCE 环境,然后切换到它们。或者,你也可以换到 Ubuntu 的不同变种版本,比如 Lubuntu 或 Xubuntu ,从而享受更快的体验。 + +### 7、 清理系统垃圾 + +尽管 Ubuntu 系统不会变得像 Windows 系统那么慢,但它还是会变慢。清除系统里不需要的文件可以改善系统性能。尝试使用 Ubuntu Tweak 工具中的 Janitor 工具来清理系统。还有一个 Bleachbit 工具也可用来清理系统。 + +同时请阅读 - [Bleachbit - CCleaner 的一个替代品][1] + +### 8、 尝试重新安装 + +有时,一些东西可能坏了,清理垃圾或者使用上面提到的大多数技巧都没用。这时,你唯一的选择就是备份文件,然后尝试重新安装。 + +### 9、 升级硬件 + +我列表上的最后一个技巧是升级硬件。在绝大多数情况下,这是可以的。如果可以这样做,那将极大的提高系统性能。你可以增加已安装的内存, 从传统磁盘切换到固态驱动器或者升级你的处理器,特别是如果你在台式电脑上运行 Ubuntu 系统,这将极大提高系统性能。 + +### 结论 + +我希望这些技巧能够陪伴你走很长的一段路,让你的 Ubuntu 桌面以一个**令人印象深刻的速度**运行。注意,你不需要尝试所有的技巧,只需要找到一个适合你的情况的技巧,然后观察系统响应如何变化。你还知道其他提高 Ubuntu 系统性能的技巧吗?请在评论里分享给我们。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed + +作者:[linuxandubuntu.com][a] +译者:[ucasFL](https://github.com/ucasFL) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed +[1]:http://www.linuxandubuntu.com/home/bleachbit-an-alternative-to-ccleaner-on-linux +[2]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed +[3]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/ubuntu-startup-application_orig.jpg +[4]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed +[5]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed#comments +[6]:http://www.linuxandubuntu.com/home/linuxandubuntu-distro-review-of-the-week-ubuntu-mate-1610 diff --git a/translated/tech/20170217 How to Enable HTTP2 in Nginx on Ubuntu and CentOS.md b/published/201702/20170217 How to Enable HTTP2 in Nginx on Ubuntu and CentOS.md similarity index 53% rename from translated/tech/20170217 How to Enable HTTP2 in Nginx on Ubuntu and CentOS.md rename to published/201702/20170217 How to Enable HTTP2 in Nginx on Ubuntu and CentOS.md index 0a031c16bf..a96163238f 100644 --- a/translated/tech/20170217 How to Enable HTTP2 in Nginx on Ubuntu and CentOS.md +++ b/published/201702/20170217 How to Enable HTTP2 in Nginx on Ubuntu and CentOS.md @@ -1,29 +1,29 @@ -如何在Ubuntu和CentOS上启用Nginx的HTTP/2协议 +如何在 Ubuntu 和 CentOS 上启用 Nginx 的 HTTP/2 协议支持 === - ![](https://www.rosehosting.com/blog/wp-content/uploads/2017/02/enable-http2-nginx.jpg) +![](https://www.rosehosting.com/blog/wp-content/uploads/2017/02/enable-http2-nginx.jpg) -HTTP/2是HTTP网络协议的主要修订版本,它专注于HTTP协议的性能改进。HTTP/2协议的目标是减少延迟,并且允许在Web浏览器和服务器之间发起多个并发请求,因此Web应用程序会更快。在本篇教程中,我们将像你展示如何在安装有Ubuntu或CentOS作为操作系统的Linux VPS上使用开启Nginx的HTTP/2协议。如果你使用Apache,你可以查看我们的另一篇教程:[如何在Ubuntu上开启Apache的HTTP/2协议][6]。 +HTTP/2 是 HTTP 网络协议的主要修订版本,其专注于 HTTP 协议的性能改进。HTTP/2 协议的目标是减少延迟,并且允许在 Web 浏览器和服务器之间的一个连接上并行发起多个请求,因此 Web 应用程序会更快。在本篇教程中,我们将像你展示如何在安装有 Ubuntu 或 CentOS 作为操作系统的 Linux VPS 上使用开启 Nginx 的 HTTP/2 协议。如果你使用 Apache,你可以查看我们的另一篇教程:[如何在 Ubuntu 上开启 Apache 的 HTTP/2 协议][6]。 ### 必备条件 -为了能够按照本篇教程最终在服务器上启用HTTP/2协议,你需要先安装好 [Nginx][7] 。并且确保功能正常而且配置没有错误。你可以使用下面的命令来检查一下: +为了能够按照本篇教程最终在服务器上启用 HTTP/2 协议,你需要先安装好 [Nginx][7] 。并且确保功能正常而且配置没有错误。你可以使用下面的命令来检查一下: ``` sudo nginx -t ``` -此外,你需要有服务器的root访问权限,或者至少有一个具有sudo权限的非root系统用户,以便你在修改Nginx配置文件的时候不会出现权限问题。最后你需要有一个[域名][8]和一个颁发给这个域名的有效的[SSL证书][9]。 +此外,你需要有服务器的 root 访问权限,或者至少有一个具有 sudo 权限的非 root 系统用户,以便你在修改 Nginx 配置文件的时候不会出现权限问题。最后你需要有一个[域名][8]和一个颁发给这个域名的有效的 [SSL 证书][9]。 -### 在Ubuntu上开启Nginx的HTTP/2协议 +### 在 Ubuntu 上开启 Nginx 的 HTTP/2 协议 -为了在[Ubuntu VPS][10]上开启Nginx的HTTP/2协议,你需要编辑默认的Nginx的服务块,我们使用的是 `nano`,你可以使用你自己的文本编辑器。 +为了在 [Ubuntu VPS][10] 上开启 Nginx 的 HTTP/2 协议,你需要编辑默认的 Nginx 的服务(`server`)块,我们使用的是 `nano`,你可以使用你自己的文本编辑器。 ``` sudo nano /etc/nginx/sites-available/default ``` -增加下面的服务块: +增加下面的服务块: ``` server { @@ -47,39 +47,39 @@ server { } ``` -确保 `domain.com` 被你真正的域名替换掉了。 此外,应正确设置文档根目录,还有SSL证书和密钥的路径。 +确保 `domain.com` 替换成你真正的域名。 此外,应正确设置文档根(`root`)目录,还有 SSL 证书和密钥的路径。 -当你编辑完成这个服务块之后,需要保存并关闭文件。使用以下命令检查Nginx配置是否有错误: +当你编辑完成这个服务块之后,需要保存并关闭文件。使用以下命令检查 Nginx 配置是否有错误: ``` sudo nginx -t ``` -为了刚刚的改变生效,需要重启Nginx: +为了刚刚的改变生效,需要重启 Nginx: ``` sudo systemctl restart nginx.service ``` -如果你想为另一个域名开启HTTP/2协议,你可以查看我们的博客[如何在Ubuntu和CentOS上设置Nginx服务块][11]。 +如果你想为另一个域名开启 HTTP/2 协议,你可以查看我们的博客[如何在 Ubuntu 和 CentOS 上设置 Nginx 服务块][11]。 -### 在CentOS上开启Nginx的HTTP/2协议 +### 在 CentOS 上开启 Nginx 的 HTTP/2 协议 -为了在[CentOS VPS][12] 开启Nginx的HTTP/2协议,你需要按照Ubuntu上完全相同的步骤做。唯一的不同点是Nginx块文件的位置。为了在CentOS上编辑默认的Nginx服务块,你需要进入`/etc/nginx/conf.d` 这个文件夹。 +为了在 [CentOS VPS][12] 开启 Nginx 的 HTTP/2 协议,你需要按照 Ubuntu 上完全相同的步骤做。唯一的不同点是 Nginx 块文件的位置。为了在 CentOS 上编辑默认的 Nginx 服务块,你需要进入 `/etc/nginx/conf.d` 这个文件夹。 ``` # nano /etc/nginx/conf.d/default.conf ``` -再次检查配置是否有错误,保存并关闭文件,然后使用以下命令重新启动Nginx服务: +再次检查配置是否有错误,保存并关闭文件,然后使用以下命令重新启动 Nginx 服务: ``` # systemctl restart nginx.service ``` -为了检测Nginx的HTTP/2协议是否开启成功,你可以使用一些[在线HTTP/2检测工具][13]。 +为了检测 Nginx 的 HTTP/2 协议是否开启成功,你可以使用一些[在线 HTTP/2 检测工具][13]。 -当然如果你使用我们的[Linux VPS主机][14]服务,在这种情况下你可以简易地要求我们的专家级的Linux管理员帮助你在你的服务器上启用Nginx的HTTP/2协议。他们提供7×24小时的服务,并且会很快关注的你要求。 +当然如果你使用我们的 [Linux VPS 主机][14]服务,在这种情况下你可以简易地要求我们的专家级的 Linux 管理员帮助你在你的服务器上启用 Nginx 的 HTTP/2 协议。他们提供 7×24 小时的服务,并且会很快关注的你要求。 PS:如果你喜欢这篇文章,请使用下面的按钮分享给你社交网络上的朋友们,或者发表一下评论。谢谢。 @@ -89,7 +89,7 @@ via: https://www.rosehosting.com/blog/how-to-enable-http2-in-nginx-on-ubuntu-and 作者:[rosehosting.com][a] 译者:[Flowsnow](https://github.com/Flowsnow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201702/20170217 How to Use Yum History to Find Out Installed or Removed Packages Info.md b/published/201702/20170217 How to Use Yum History to Find Out Installed or Removed Packages Info.md new file mode 100644 index 0000000000..38efe99f51 --- /dev/null +++ b/published/201702/20170217 How to Use Yum History to Find Out Installed or Removed Packages Info.md @@ -0,0 +1,191 @@ +使用 Yum 历史查找已安装或已删除的软件包信息 +============================================================ + +[Yum][1] 是 RHEL/CentOS 的一个基于 rpm 的交互式高级包管理器,用户可以用它来安装新的软件包、卸载或清除旧的/不需要的软件包。它可以[自动运行系统更新][2],并执行依赖分析,对已安装的或可用的软件包进行查询等等。 + +在本文中,我们将解释如何查看 Yum 事务的历史记录,以便于了解有关安装的软件包以及从系统中所卸载/清除软件包的信息。 + +**推荐阅读:** [20 条关于 Linux 软件包管理的 Yum 命令][3] + +以下是一些如何使用 Yum 历史命令的示例。 + +### 查看完整的 Yum 历史 + +要查看 Yum 事务完整的历史记录,我们可以运行以下命令,然后将显示:事务 ID、执行特定操作的用户、操作发生的日期和时间、实际操作以及任何错误的附加信息与操作: + +``` +# yum history +``` + +[![查看 Yum 历史](http://www.tecmint.com/wp-content/uploads/2017/02/View-Yum-History.png)][4] + +### 使用 Yum 查找软件包信息 + +`history` 的子命令:`info`/`list`/`summary` 可以将事务 ID 或包名作为参数。此外,`list` 子命令可以加上特殊的参数,`all` 表示所有的事务。 + +运行以下命令查看先前的历史: + +``` +# yum history list all +``` + +并且,你可以使用下面的 `info` 命令查看涉及指定软件包的事务详情,例如 `httpd`: + +``` +# yum history info httpd +``` + +[![Yum - 查找软件包信息](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Package-Info.png)][5] + +发出以下命令可以获得包含 `httpd` 软件包的事务的摘要: + +``` +# yum history summary httpd +``` + +[![Yum - 查找软件包的摘要](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Summary-of-Package.png)][6] + +还可以使用事务的 ID 来查找,以下命令会显示 ID 为 `15` 的事务的详情。 + +``` +# yum history info 15 +``` + +[![Yum - 使用 ID 查找软件包信息](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Info-Using-ID.png)][7] + +### 使用 yum history 查找软件包事务信息 + +有一些用于打印某个或多个软件包事务详情的子命令。我们可以使用 `package-list` 或 `package_info` 查看关于 `httpd` 的更多信息,例如: + +``` +# yum history package-list httpd +或 +# yum history package-info httpd +``` + +[![Yum - 查找软件包事务信息](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Transaction-Info.png)][8] + +要得到多个软件包的记录,我们可以运行: + +``` +# yum history package-list httpd epel-release +或 +# yum history packages-list httpd epel-release +``` + +[![Yum - 查找多个软件包的信息](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Multiple-Package-Info.png)][9] + +### 使用 Yum 回滚软件包 + +此外,还有一些 `history` 的子命令可以让我们撤销/重做/回滚事务。 + +1. `undo` - 会撤销一个指定的事务。 +2. `redo` - 重复一次指定的事务。 +3. `rollback` - 撤销指定事务之后的所有事务。 + +它们采用单个事务 id 或关键字 `last` 和从最后一个事务开始的偏移量。 + +例如,假设我们已经做了 60 个事务,`last` 是指事务 60,`last-4` 指向事务 56。 + +**推荐阅读:** [怎样使用 `yum-utils` 来维护以及加速 Yum][10] + +以上子命令是如下工作的:如果我们有 5 个事务——V,W,X,Y 和 Z,其中分别是安装各个软件包的。 + +``` +# yum history undo 2 #将删除软件包 W +# yum history redo 2 #将重新安装软件包 W +# yum history rollback 2 #将删除软件包 X、 Y 和 Z +``` + +在下面的示例中,事务 2 是一个更新操作,如下所示,以下 `redo` 命令将重复事务 2 直到所有软件包到更新到当前时间的最新版本: + +``` +# yum history | grep -w "2" +``` + +[![Yum - 查找软件包事务的 ID](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Yum-Package-Transaction-ID.png)][11] + +``` +# yum history redo 2 +``` + +[![用 Yum 重新更新软件包](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Redo-Package-Update.png)][12] + +`redo` 子命令同样可以在我们指定事务之前加上一些可选的参数: + +1. `force-reinstall` - 重新安装所有在此事务中安装的软件包(通过 `yum install`、`upgrade` 或 `downgrade`)。 +2. `force-remove` - 移除所有已经更新或回滚的软件包。 + +``` +# yum history redo force-reinstall 16 +``` + +[![Yum - 强制安装软件包](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Force-Install-Package.png)][13] + +### 查找 Yum 历史数据库和来源信息 + +这些子命令为我们提供有关历史记录数据库和其它信息来源的信息: + +1. `addon-info` - 提供更多的信息来源。 +2. `stats` - 显示当前历史数据库的统计信息。 +3. `sync` - 使我们能够更改为所有已安装软件包存储的 `rpmdb`/`yumdb` 数据。 + +看一下以下的命令的子命令实际上是怎样工作的: + +``` +# yum history addon-info +# yum history stats +# yum history sync +``` + +使用 `new` 子命令设置新的历史文件: + +``` +# yum history new +``` + +我们可以在 yum 手册页找到关于 Yum `history` 命令和其它几个命令的完整信息: + +``` +# man yum +``` + +**推荐阅读:** [4 个使用 Yum 禁用/锁定某些软件包更新的方法][14] + +就是这么多了。在本篇指南中,我们介绍了各种 Yum `history` 命令,以查看 Yum 事务的详细信息。 + +-------------------------------------------------------------------------------- + +作者简介: + +Aaron Kili 是 Linux 和 F.O.S.S 的爱好者,目前任 TecMint 的作者,志向是一名 Linux 系统管理员、web 开发者。他喜欢用电脑工作,并热衷于分享知识。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/view-yum-history-to-find-packages-info/ + +作者:[Aaron Kili][a] +译者:[OneNewLife](https://github.com/OneNewLife) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[2]:http://www.tecmint.com/auto-install-security-patches-updates-on-centos-rhel/ +[3]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[4]:http://www.tecmint.com/wp-content/uploads/2017/02/View-Yum-History.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Package-Info.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Summary-of-Package.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Info-Using-ID.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Transaction-Info.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Multiple-Package-Info.png +[10]:http://www.tecmint.com/linux-yum-package-management-with-yum-utils/ +[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Yum-Package-Transaction-ID.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Redo-Package-Update.png +[13]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Force-Install-Package.png +[14]:http://www.tecmint.com/yum-lock-disable-blacklist-certain-package-update-version/ +[15]:http://www.tecmint.com/author/aaronkili/ +[16]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[17]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/published/201702/20170223 Sending Email via PHP in CentOS 7 using Sendmail.md b/published/201702/20170223 Sending Email via PHP in CentOS 7 using Sendmail.md new file mode 100644 index 0000000000..3525288f32 --- /dev/null +++ b/published/201702/20170223 Sending Email via PHP in CentOS 7 using Sendmail.md @@ -0,0 +1,76 @@ +在 CentOS 7 中使用 Sendmail 通过 PHP 发送邮件 +============================================================ + +![sendmail logo](http://fasterland.net/wp-content/uploads/2017/02/sendmail-logo-750x450.png) + +如果你运行了一个 web 服务器或者一台 VPS ,你可能需要在你的 PHP 程序中发送邮件。 + +同样,如果你正在运行一个 WordPress 博客,或者你正在使用任何类型的 CMS ,你允许你的访问者通过联系表单向你发送电子邮件(例如使用 WordPress 的*[Contact Form 7][3] 插件),你可能需要安装一个名为 [sendmail][4] 的简单的程序到你的 web 服务器上。 + +> Sendmail 是一个通用的互联网电子邮件投递工具,支持多种邮件传输和传递方法,包括用于通过 Internet 进行电子邮件传输的简单邮件传输协议(SMTP)。[来自 Wikipedia][5]。 + +Sendmail 可以通过你的发行版的软件包管理器安装。 + +以下是在 CentOS 7 上安装 Sendmail 的说明。 + +### 安装 + +要在 CentOS 7 中安装 CentOS 7 ,运行下面的命令: + +``` +# yum install sendmail +``` + +### 允许服务器可以发送邮件 + +如果在 CentOS 7 中使用了 SELinux, 你需要使用下面的命令允许 sendmail 发送邮件: + +``` +# setsebool -P httpd_can_sendmail=on +``` + +### 使用 PHP 发送一封测试邮件 + +使用这个命令进入 php 交互 shell 中: + +``` +php -a +``` + + +在交互 shell 中,粘贴下面的代码: + +``` +mail ('user@receiver.com', "Test email", "Test email from the Internet", null, "-f user@sender.com"); +``` + +不要忘记将 `user@receiver.com` 和 `user@sender.com` 分别替换为你的收件地址和发件地址。 + +### 浏览 sendmail 日志 + +要监控邮件日志,你可以使用这个命令: + +``` +tail /var/log/maillog +``` + + +在服务器上安装 sendmail 完成后,你可以允许你的用户通过联系栏通过邮件联系你了。 + +-------------------------------------------------------------------------------- + +via: http://fasterland.net/sending-email-via-php-centos-7-using-sendmail.html + +作者:[Francesco Mondello][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://fasterland.net/ +[1]:http://fasterland.net/author/faster3ck +[2]:http://fasterland.net/ +[3]:https://wordpress.org/plugins/contact-form-7/ +[4]:http://www.sendmail.com/sm/open_source/ +[5]:https://en.wikipedia.org/wiki/Sendmail +[6]:http://fasterland.net/category/server-admin diff --git a/published/20170204 How to Configure Network Between Guest VM and Host in Oracle VirtualBox.md b/published/20170204 How to Configure Network Between Guest VM and Host in Oracle VirtualBox.md new file mode 100644 index 0000000000..47b0f71f05 --- /dev/null +++ b/published/20170204 How to Configure Network Between Guest VM and Host in Oracle VirtualBox.md @@ -0,0 +1,245 @@ +如何配置 VirtualBox 中的客户机与宿主机之间的网络连接 +============================================================ + +当你在 [VirtualBox 虚拟机软件][2] 中安装了各种操作系统时,你可能需要实现宿主机与虚拟机之间的相互访问。 + +在这篇文章中,我们将会以最简单明了的方式来说明如何配置客户机与 Linux 宿主机的网络,以实现两者相互访问或者让客户机连接到外网。(LCTT 译注:客户机指 Oracle VirtualBox 虚拟机软件中安装的操作系统,如本文中用到的 CentOS 7 和 Ubuntu 16.10 。宿主机就是你自己的笔记本电脑或台式机,注意这篇文章中作者的宿主机上安装的操作系统是 Linux Mint 18 ,而不是我们平时使用的 Windows 系统。) + +本文测试环境: +1、宿主机操作系统—— Linux Mint 18 +2、客户机操作系统—— CentOS 7 和 Ubuntu 16.10 + +#### 要求 + +1、宿主机上安装的 [Oracle VirtualBox 虚拟机][1] 能正常使用。 +2、你得事先在 Oracle virtualBox 虚拟机软件中安装好客户机操作系统,比如 Ubuntu、Fedora、CentOS、 Linux Mint 或者其它的 Linux 系统也行。 +3、在你配置网络前,请先关闭客户机。 + +为了让宿主机和客户机能够互相联通,这两个机器的默认网卡 IP 必须设置在同一网段,你可以为客户机添加多达 4 块网卡。 + +默认网卡(网卡 1)通常用于使用 NAT 连接方式连接到宿主机进行上网。 + +重要提示:通常总是设置第一块网卡与宿主机通信,第二块网卡连接到外网。 + +### 为客户机和宿主机创建网卡 + +在下面的 VirtualBox 管理器界面,创建客户机和宿主机之间的通信网卡。 + +打开文件->首选项配置,或者使用组合键 `Ctrl + G` : + +[ + ![Virtualbox Preferences Window](http://www.tecmint.com/wp-content/uploads/2017/02/Virtualbox-Preferences-Window.png) +][3] + +*Virtualbox 首选项界面* + +在下图中有两个选项,单击并选择仅主机( Host-only )网络。然后使用右侧的 `+` 按钮来添加一个新的仅主机网络。 + +[ + ![Set Guest Network](http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Network.png) +][4] + +*设置客户机网络* + +这样就创建好了一个名为 vboxnet0 的新的仅主机模式网卡。 + +如果你愿意,你可以使用中间的 `-` 按钮来删除这个网卡,你可以单击编辑按钮来查看这个网卡的详细配置信息。 + +你也可以根据自己的实际环境修改配置信息,比如网络地址,子网掩码等等。 + +注意:下图中的 IPv4 地址就是你的宿主机的 IP 地址。 + +[ + ![Host Network Details](http://www.tecmint.com/wp-content/uploads/2017/02/Host-Network-Details.png) +][6] + +*宿主机网络信息* + +下图中,如果你想让客户机使用动态 IP 地址,你可以通过配置 DHCP 服务来完成(在使用前请确保启用 DHCP )。但是我建议你为客户机配置一个静态 IP 地址。 + +在下面的设置所有网络界面单击 OK 按钮来保存修改的配置。 + +[ + ![Set Guest Static IP aAddress](http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Static-IP-Address.png) +][7] + +*为客户机设置静态 IP 地址* + +#### 配置客户机网络设置 + +注意:你可以根据下面的步骤来为任何需要与宿主机通信的客户机添加网卡。 + +回到 VirtualBox 管理器界面,选择客户机,比如  Ubuntu 16.10 Server 或者 CentOS 7 ,然后单击设置菜单。 + +[ + ![Configure VM Settings](http://www.tecmint.com/wp-content/uploads/2017/02/Configure-VM-Settings.png) +][8] + +*配置客户机网络设置* + +#### 配置客户机网卡以连接到宿主机 + +从下图的界面中选择网络选项。然后配置第一块网卡( 网卡 1 )的信息如下: + +1、勾选选项:“启用网卡”来开启该网卡。 +2、在连接方式选项:选择仅主机( Host-only )网络。 +3、然后选择网卡名称:vboxnet0 + +如下图所示,单击 OK 来保存设置: + +[ + ![Enable Network Adapter for Guest VM](http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-Guest-VM.png) +][9] + +*启用客户机网络* + +#### 配置客户机网卡连接外网 + +之后添加第二块网卡(网卡 2 )来让客户机连接到宿主机进行上网。使用下面的设置: + +1、勾选选项:“启用网络连接”来激活这块网卡。 +2、在连接方式选项:选择 NAT 方式。 + +[ + ![Enable Network Adapter for VM](http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-VM.png) +][10] + +为客户机启用网络连接 + +#### 为客户机设置静态 IP 地址 + +启动客户机,登录系统并[配置静态 IP 地址][11]。在客户机上执行下面的命令来查看所有网卡配置信息,然后分配一个 IP 地址: + +``` +$ ip add +``` +[ + ![Configure Static IP Address for VM](http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Static-IP-Address-for-VM.png) +][12] + +*为客户机配置静态 IP 地址* + +从上面的截图中可以看出客户机已启用了三块网卡: + +1、`lo` ——回环网络接口 +2、`enp0s3` (网卡 1)—— 前一步我们配置的连接方式为仅主机( Host-Only)模式并且已启用 DHCP 的网卡,之后我们又配置成了静态 IP 地址。 +3、`enp0s8` (网卡 2)—— 用于连接到外网。该网卡默认情况下使用 DHCP 来动态获取 IP 地址。 + +##### 在 Debian/Ubuntu/Linux Mint 系统下的配置 + +重要提示: 这里我使用的是 Ubuntu 16.10 Server , IP 地址为 192.168.56.5 。 + +使用你喜欢的编辑器及管理员账号打开 `/etc/network/interfaces` 配置文件: + +``` +$ sudo vi /etc/network/interfaces +``` + +修改网卡 enp0s3 的配置信息如下(根据你的实际环境进行修改): + +``` +auto enp0s3 +iface enp0s3 inet static +address 192.168.56.5 +network 192.168.56.0 +netmask 255.255.255.0 +gateway 192.168.56.1 +dns-nameservers 8.8.8.8 192.168.56.1 +``` + +保存并退出。 + +然后使用下面的命令来重启网络服务: + +``` +$ sudo systemctl restart networking +``` + +或者,正常重启系统,然后检查网络配置是否为新的 IP 地址: + +``` +$ ip add +``` + +#####在 RHEL/CentOS/Fedora 系统下的配置 + +重要提示: 这里我使用的是 CentOS 7 系统, IP 地址为: 192.168.56.10 。 + +使用管理员帐号及你喜欢的编辑器打开 enp0s3 (仅主机网络)的网卡配置文件 `/etc/sysconfig/network-scripts/ifcfg-enp0s3` : + +``` +$ sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 +``` + +创建或修改配置文件信息如下(根据你实际的环境进行修改): + +``` +BOOTPROTO=static +ONBOOT=yes +IPADDR=192.168.56.10 +NETWORK=192.168.56.0 +NETMASK=255.255.255.0 +GATEWAY=192.168.56.1 +DNS=8.8.8.8 192.168.56.1 +NM_CONTROLLED=no #use this file not network manager to manage interface +``` + +保存并退出。然后使用下面的命令重启网络服务(也可以重启系统): + +``` +$ sudo systemctl restart network.service +``` + +检查修改的配置地信息是否生效: + +``` +$ ip add +``` + +#### 在宿主机上使用 SSH 工具来管理客户机 + +在宿主机上使用 SSH 工具来管理你的客户机。在下面的实例中,我将使用 SSH 工具连接到 CentOS 7 服务器(192.168.56.10): + +``` +$ ssh tecmint@192.168.56.10 +$ who +``` +[ + ![Connect Guest VM using SSH](http://www.tecmint.com/wp-content/uploads/2017/02/Connect-Guest-VM-using-SSH.png) +][13] + +*使用 SSH 工具连接客户机* + +就写到这里吧!在这篇文章中,我们用简单易懂的方法讲述了如何在宿主机与客户机之间设置网络连接方式。请在下面的评论区跟大家分享下你的想法。 + +-------------------------------------------------------------------------------- + +作者简介: + +Aaron Kili 是一名 Linux 和 F.O.S.S 爱好者,即将从事 Linux 系统管理员和网页开发工作,他日前是 TecMint 技术网站的原创作者,非常喜欢使用电脑工作,坚信分享知识是一种美德。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/network-between-guest-vm-and-host-virtualbox/ + +作者:[Aaron Kili][a] +译者:[rusking](https://github.com/rusking) +校对:[Bestony](https://github.com/Bestony) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/install-virtualbox-on-redhat-centos-fedora/ +[2]:http://www.tecmint.com/install-virtualbox-on-redhat-centos-fedora/ +[3]:http://www.tecmint.com/wp-content/uploads/2017/02/Virtualbox-Preferences-Window.png +[4]:http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Network.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/02/Virtualbox-Preferences-Window-1.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Host-Network-Details.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Static-IP-Address.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-VM-Settings.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-Guest-VM.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-VM.png +[11]:http://www.tecmint.com/set-add-static-ip-address-in-linux/ +[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Static-IP-Address-for-VM.png +[13]:http://www.tecmint.com/wp-content/uploads/2017/02/Connect-Guest-VM-using-SSH.png diff --git a/published/20170213 A beginners guide to understanding sudo on Ubuntu.md b/published/20170213 A beginners guide to understanding sudo on Ubuntu.md new file mode 100644 index 0000000000..2c67da1011 --- /dev/null +++ b/published/20170213 A beginners guide to understanding sudo on Ubuntu.md @@ -0,0 +1,215 @@ +sudo 入门指南 +============================================================ + +你在使用 Linux 命令行时曾经得到过“拒绝访问(Permission denied)”的错误提示吗?这可能是因为你正在尝试执行一个需要 root 权限的操作。例如,下面的截图展示了当我尝试复制一个二进制文件到一个系统目录时产生的错误。 + +[ + ![shell 的拒绝访问](https://www.howtoforge.com/images/sudo-beginners-guide/perm-denied-error.png) +][11] + +那么该怎么解决这个错误?很简单,使用 `sudo` 命令。 + +[ + ![用 sudo 运行命令](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-example.png) +][12] + +用户运行此命令后会被提示输入他们(**自己**)的登录密码。一旦输入了正确的密码,操作将会成功执行。 + +毫无疑问,`sudo` 是任何在 Linux 上使用命令行的人都必须知道的命令。但是,为了更负责、更有效地使用该命令,你还是要知道一些相关(及深入)的细节。这正是我们将会在这篇文章中讨论的。 + +*在我们继续之前,值得提一下的是,这篇文章所提到的所有命令指示都已经在 Ubuntu 14.04 LTS 下的 4.3.11 版 Bash 下通过测试。* + +### 什么是 sudo + +正如你们大部分人所知道的,`sudo` 用来执行需要提升权限(通常是作为 root 用户)的命令。在这篇文章之前的简介部分已经讨论过这样的一个例子。然而,如果你想的话,你能用 `sudo` 以其它(非 root )用户运行命令。 + +这是由工具提供的 `-u` 命令行选项所实现的。举个例子,如下例所展示的那样,我(`himanshu`)尝试将一个在其他用户(`howtoforge`)的 Home 目录中的文件重命名,但是得到一个“访问拒绝”的错误。然后我加上 `sudo -u howtoforge` 后用同样的“mv”命令,命令成功执行了: + +[ + ![什么是 sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-switch-user.png) +][13] + +### 任何人都能用 sudo 吗? + +不是。一个用户要能使用 `sudo` ,应该在 `/etc/sudoers` 文件里有一条跟该用户相关的信息。下述摘自 Ubuntu 网站的一段能讲得更清楚: + +> `/etc/sudoers` 文件控制了谁能以哪个用户的身份在哪个机器上运行什么命令,还可以控制特别的情况,例如对于特定的命令是否需要输入密码。这个文件由别名aliases(基本变量)和用户标识user specifications(控制谁能运行什么命令)组成。 + +如果你正在使用 Ubuntu,让一个用户能运行 `sudo` 命令很容易:你所需要做的就是把账户类型改成管理员administrator。这可直接在 系统设置System Settings -> 用户账户 User Accounts里完成。 + + +[ + ![sudo 用户](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-accounts.png) +][14] + +首先解锁该窗口: + +[ + ![unlocking window](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-unlock.png) +][15] + +然后选择你想改变用户类型的用户,然后将类型改成管理员administrator。 + +[ + ![choose sudo accounts](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-admin-account.png) +][16] + +然而,如果你不使用 Ubuntu,或者你的发行版没有提供这个特性,你可以手动编辑 `/etc/sudoers` 文件来实现此改变。要在文件中添加这样的一行: + + +``` +[user] ALL=(ALL:ALL) ALL +``` + +无需赘言,`[user]` 应该用你想提升 sudo 权限的用户的用户名所代替。在这里值得提到的一件重要的事情是,官方建议通过 `visudo` 命令编辑该文件 —— 你需要做的就是运行下述命令: + +``` +sudo visudo +``` + +为了说清究竟是怎么一回事,这里有段从 `visudo` 手册里的摘要: + +> `visudo` 以安全的模式编辑 `sudoers` 文件。`visudo` 锁定 `sudoers` 文件以防多个编辑同时进行,提供基本的检查(sanity checks)和语法错误检查。如果 `sudoers` 文件现在正在被编辑,你将会收到一个信息提示稍后再试。 + +关于 visudo 的更多信息,前往[这里][17]。 + +### 什么是 sudo 会话 + +如果你经常使用 `sudo` 命令,你肯定注意到过当你成功输入一次密码后,可以不用输入密码再运行几次 `sudo` 命令。但是一段时间后,`sudo` 命令会再次要求你的密码。 + +这种现象跟运行 `sudo` 命令数目无关,跟时间有关。是的,`sudo` 默认在输入一次密码后 15 分钟内不会再次要求密码。15 分钟后,你会再次被要求输入密码。 + +然而,如果你想的话,你能改变这种现象。用以下命令打开 `/etc/sudoers` 文件: + +``` +sudo visudo +``` + +找到这一行: + +``` +Defaults env_reset +``` + +[ + ![env_reset](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-time-default.png) +][18] + +然后在这行最后添加以下变量: + +``` +Defaults env_reset,timestamp_timeout=[new-value] +``` + +`[new-value]` 为想要 `sudo` 会话持续的时间数。例如,设数值为 40。 + +[ + ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) +][19] + +如果你希望每次使用 `sudo` 命令时都要求输入密码,你可以把这个变量赋值为 0 。想要 `sudo` 会话永远不过时,应赋值为 -1。 + +注意将 `timestamp_timeout` 的值赋为 “-1” 是强烈不推荐的。 + +### sudo 密码 + +你可能注意过,当 `sudo` 要求输入密码然后你开始输入时,不会显示任何东西 —— 甚至连常规的星号都没有。虽然这不是什么大问题,不过一些用户就是希望显示星号。 + +好消息是那有可能也很容易做到。所有你需要做的就是在 `/etc/sudoers` 文件里将下述的行: + +``` +Defaults env_reset +``` + +改成 + +``` +Defaults env_reset,pwfeedback +``` + +然后保存文件。 + +现在,无论什么时候输入 `sudo` 密码,星号都会显示。 + +[ + ![hide the sudo password](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-password.png) +][20] + +### 一些重要的 sudo 命令行参数 + +除了 `-u` 命令行参数(我们已经在这篇教程的开始部分讨论过了),还有其他重要的 `sudo` 命令行参数值得注意。在这部分,我们将会讨论其中一些。 + +#### -k 参数 + +考虑下这种情况:输入密码后你刚刚运行了几个 `sudo` 驱动的命令。现在,如你所知,sudo 会话默认保持 15 分钟。假设在这会话期间,你需要让某些人访问你的终端,但你不想让他们可以使用 `sudo` ,你将会怎么做? + +还好,有 `-k` 命令行参数允许用户取消 `sudo` 权限。这是 `sudo` 帮助页面(man page)对此的解释: + +> `-k`, `--reset-timestamp` + +> 不带任何命令使用时,撤销用户缓存的凭据。换句话讲,下一次使用 `sudo` 将会要求输入密码。使用这个参数不需要密码,也可以放到一个 `.logout` 文件中来撤销 sudo 权限。 + +> 当与一个命令,或者一个可能需要密码的操作一起用时,这个参数将会导致 `sudo` 忽略用户缓存的凭据。结果是 `sudo` 要求输入密码(如果这是被安全策略所要求的),而且不会更新用户缓存的凭据。 + + +#### -s 参数 + +有时你的工作要求你运行一堆需要 root 权限的命令,你不想每次都输入密码。你也不想通过改变 `/etc/sudoers` 文件调整 `sudo` 会话的过期时限。 + +这种情况下,你可以用 `sudo` 的 `-s` 参数。这是 `sudo` 帮助页面(man page)对此的解释: + +> `-s`, `--shell` + +> 如果设置了 SHELL 环境变量或者调用用户的密码数据库指定了 shell,就运行该 shell 。如果指定了命令,命令将会通过 shell 的 `-c` 参数将命令传递给该 shell 执行。如果没有指定命令,会执行一个交互式 shell。 + +所以,基本上这命令参数做的是: + +* 启动一个新的 shell - 至于是哪一个 shell,参照 SHELL 环境变量赋值。如果 `$SHELL` 是空的,将会用 `/etc/passwd` 中定义的 shell。 + +* 如果你用 `-s` 参数传递了一个命令名(例如 `sudo -s whoami`),实际执行的是 `sudo /bin/bash -c whoami`。 + +* 如果你没有尝试执行其他命令(也就是说,你只是要运行 `sudo -s`),你将会得到一个有 root 权限的交互式的 shell。 + +请记住,`-s` 命令行参数给你一个有 root 权限的 shell,但那不是 root 环境 —— 还是执行的你自己的 `.bashrc` 。例如,在 `sudo -s` 运行的新 shell 里,执行 `whoami` 命令仍会返回你的用户名,而非 root 。 + +#### -i 参数 + +`-i` 参数跟我们讨论过的 `-s` 参数相像。然而,还是有点区别。一个重要的区别是 `-i` 给你的是 root 环境,意味着你的(用户的)`.bashrc` 被忽略。这就像没有显式地用 root 登录也能成为 root 。此外,你也不用输入 root 用户密码。 + +**重要**:请注意 `su` 命令也能让你切换用户(默认切换到 root )。这个命令需要你输入 root 密码。为了避免这一点,你可以使用 `sudo` 执行它(`sudo su`),这样你只需要输入你的登录密码。然而,`su` 和 `sudo su` 有隐含的区别 —— 要了解它们,以及它们和 `sudo -i` 的区别,请看[这里][10] 。 + +### 总结 + +我希望现在你至少知道了 `sudo` 的基本知识,以及如何调整 `sudo` 的默认行为。请按我们解释过的那样去尝试调整 `/etc/sudoers` 。同时也浏览一下论坛讨论来更深入了解 `sudo` 命令。 + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ + +作者:[Himanshu Arora][a] +译者:[ypingcn](https://ypingcn.github.io/wiki/lctt) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ +[1]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-k-option +[2]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-s-option +[3]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-i-option +[4]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-sudo +[5]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#can-any-user-use-sudo +[6]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-a-sudo-session +[7]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-sudo-password +[8]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#some-important-sudo-command-line-options +[9]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#conclusion +[10]: http://unix.stackexchange.com/questions/98531/difference-between-sudo-i-and-sudo-su +[11]: https://www.howtoforge.com/images/sudo-beginners-guide/big/perm-denied-error.png +[12]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-example.png +[13]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-switch-user.png +[14]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-accounts.png +[15]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-unlock.png +[16]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-admin-account.png +[17]: https://www.sudo.ws/man/1.8.17/visudo.man.html +[18]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-time-default.png +[19]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-timeout.png +[20]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-password.png diff --git a/published/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/published/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md new file mode 100644 index 0000000000..b64f50a151 --- /dev/null +++ b/published/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md @@ -0,0 +1,46 @@ +哪个 Linux 系统最适合玩游戏? +============================================================ + +> 告诉我们哪个 Linux 发型版对游戏支持的最好 + +在过去几个月中,出于游戏目的,我们尝试了多种 GNU/Linux 发行版,我们得出的结论是没有专为 Linux 游戏设计的完美的操作系统。 + +我们都知道,游戏世界分成 Nvidia 和 AMD 两个阵营。现在,如果你使用的是 Nvidia 显卡,即使是五年前的一块显卡,也可以在大多数基于 Linux 的操作系统上使用,因为 Nvidia 差不多为其所有的 GPU 都提供了最新的视频驱动程序。 + +当然,这意味着如果你有一块 Nvidia GPU,在大多数 GNU/Linux 发行版上你不会有什么大问题。至少与游戏中的图形或其他性能问题无关,这种问题将严重影响你的游戏体验。 + +### AMD Radeon 用户最好的游戏发行版 + +如果你使用 AMD Radeon GPU,事情会是完全不同的。我们都知道,AMD 的专有显卡驱动程序仍然需要大量的工作来兼容最新的 GNU/Linux 发行版本。所有的 AMD GPU ,即便是在最新的 X.Org 服务端和 Linux 内核版本上都是这样。 + +目前,AMDGPU-PRO 视频驱动程序只能在 Ubuntu 16.04 LTS、CentOS 6.8/7.3、Red Hat Enterprise Linux 6.8/7.3、SUSE Linux Enterprise Desktop 和 Server 12 SP2 上运行。除了 Ubuntu 16.04 LTS 之外,我们不知道为什么 AMD 为所有这些面向服务器和企业级的操作系统提供支持。 + +我们不相信有 Linux 玩家会在这些系统上面玩游戏。[最新的 AMDGPU-PRO 更新][1]终于支持了 HD 7xxx 和 8xxx 系列的 AMD Radeon GPU,但是如果我们不想使用 Ubuntu 16.04 LTS 呢? + +另外,我们有 Mesa 3D 图形库,这在大多数发行版上都有。Mesa 图形栈为我们的 AMD GPU 提供了功能强大的开源 Radeon 和 AMDGPU 驱动程序,但是为了享受最好的游戏体验,你还需要拥有最新的 X.Org 服务端和 Linux 内核。 + +并不是所有的 Linux 操作系统都附带最新的 Mesa(13.0)、X.Org 服务端(1.19)和 Linux 内核(4.9)版本,它们支持较旧的 AMD GPU。有些系统只有其中一两种技术,但我们这些都需要,而且内核需要编译进 AMD Radeon Southern Islands 和 Sea Island 驱动来支持 AMDGPU。 + +我们发现整个情况相当令人沮丧,至少对于一些使用 AMD Radeon 老式显卡的玩家来说是这样的。现在,我们发现,使用 AMD Radeon HD 8xxx GPU 的最佳游戏体验只能通过使用 Git 获取到的 Mesa 17 以及 Linux 内核 4.10 RC 来实现。 + +所以我们现在请求你 - 如果你找到了玩游戏的完美的 GNU/Linux 发行版,无论你使用的是 AMD Radeon 还是 Nvidia GPU,但我们最感兴趣的是那些使用 AMD GPU 的玩家,请告知我们你使用的是什么发行版,设置是什么,能不能玩最新的游戏,或者有无体验问题。谢谢! + +-------------------------------------------------------------------------------- + +via: http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml + +作者:[Marius Nestor][a] +译者:[geekpi](https://github.com/geekpi) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/marius-nestor +[1]:http://news.softpedia.com/news/amdgpu-pro-16-60-linux-driver-finally-adds-amd-radeon-hd-7xxx-8xxx-support-512280.shtml +[2]:http://news.softpedia.com/editors/browse/marius-nestor +[3]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# +[4]:https://share.flipboard.com/bookmarklet/popout?v=2&title=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml&t=1487038258&utm_campaign=widgets&utm_medium=web&utm_source=flipit&utm_content=news.softpedia.com +[5]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# +[6]:http://twitter.com/intent/tweet?related=softpedia&via=mariusnestor&text=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml +[7]:https://plus.google.com/share?url=http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml +[8]:https://twitter.com/intent/follow?screen_name=mariusnestor diff --git a/published/20170215 Generate random data for your applications with Elizabeth.md b/published/20170215 Generate random data for your applications with Elizabeth.md new file mode 100644 index 0000000000..0888f912ba --- /dev/null +++ b/published/20170215 Generate random data for your applications with Elizabeth.md @@ -0,0 +1,94 @@ +使用 Elizabeth 为应用生成随机样本数据 +============================================================ + +![Generate random data for your applications with Elizabeth](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28 "Generate random data for your applications with Elizabeth") + +图片提供 : Opensource.com + + > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.  + +不,我的文章没有被 [Lorem ipsum][2] 生成器劫持(LCTT 译注:Lorem ipsum,中文又称“乱数假文”,只是一段用来测试排版效果的占位文字,没有实际的含义)。作为本月的 Nooks&Crannies 专栏文章,我发现了一个有趣的小 Python 库,以帮助开发人员为其应用程序生成随机数据。它被称为 [Elizabeth][3]。 + +它由 Líkið Geimfari 编写,并在 MIT 许可证下发行,Elizabeth 以 21 个不同本地化信息提供了 18 种数据提供器,可用于生成随机信息(LCTT 译注:不仅是随机数),包括姓名和个人特征、地址、文本数据、交通信息、网络和 Internet 社交媒体数据、数字等等。安装它需要 [Python 3.2][4] 或更高版本,您可以使用 `pip` 或从 `git` 仓库安装它。 + +在我的测试机上,我在一个全新安装的 [Debian][5] Jessie 上使用 pip 来安装它,要做的就是 `apt-get install python3-pip`,它将安装 Python 和所需的依赖项。然后 `pip install elizabeth`,之后就安装好了。 + +只是为好玩,让我们在 Python 的交互式解释器中为一个人生成一些随机数据: + +``` +>>> from elizabeth import Personal +>>> p=Personal('en') +>>> p.full_name(gender="male") +'Elvis Herring' +>>> p.blood_type() +'B+' +>>> p.credit_card_expiration_date() +'09/17' +>>> p.email(gender='male') +'jessie7517@gmail.com' +>>> p.favorite_music_genre() +'Ambient' +>>> p.identifier(mask='13064########') +'1306420450944' +>>> p.sexual_orientation() +'Heterosexual' +>>> p.work_experience() +39 +>>> p.occupation() +'Senior System Designer' +>>> +``` + +在代码中使用它就像创建一个对象那样,然后调用要你需要填充数据的对应方法。 + +Elizabeth 内置了 18 种不同的生成工具,添加新的生成器并不困难;你只需要定义从 JSON 值集合中获取数据的例程。以下是一些随机文本字符串生成,再次打开解释器: + +``` +>>> from elizabeth import Text +>>> t=Text('en') +>>> t.swear_word() +'Rat-fink' +>>> t.quote() +'Let them eat cake.' +>>> t.words(quantity=20) +['securities', 'keeps', 'accessibility', 'barbara', 'represent', 'hentai', 'flower', 'keys', 'rpm', 'queen', 'kingdom', 'posted', 'wearing', 'attend', 'stack', 'interface', 'quite', 'elementary', 'broadcast', 'holland'] +>>> t.sentence() +'She spent her earliest years reading classic literature, and writing poetry.' +``` + +使用 Elizabeth 填充 [SQLite][6] 或其它你可能需要用于开发或测试的数据库并不困难。其介绍文档给出了使用 [Flask][7] 这个轻量级 web 框架的一个医疗应用程序示例。 + +我对 Elizabeth 印象很深刻 - 它超快、轻量级、易于扩展,它的社区虽然小,但是很活跃。截至本文写作时,项目已有 25 名贡献者,并且提交的问题处理迅速。Elizabeth 的[完整文档][8]至少对于美国英语而言易于阅读和遵循,并提供了广泛的 API 参考。 + +我曾尝试通过修改链接来查找该文档是否有其他语言,但没有成功。因为其 API 在非英语区域中是不同的,所以记录这些变化将对用户非常有帮助。公平地说,通过阅读其代码并找出可用的方法并不难,即使你的 Python 功力并不深厚。对我来说,另一个明显的缺陷是缺乏阿拉伯语或希伯来语区域测试数据。这些是著名的从右到左的语言,对于试图使其应用程序国际化的开发者来说,适当地处理这些语言是一个主要的障碍。像 Elizabeth 这种在此方面可以协助的工具是值得拥有的。 + +对于那些在应用中需要随机样本数据的开发员而言,Elizabeth 是一个有价值的工具,而对于那些试图创建真正多语言、本地化应用程序的开发者来说,它可能是一个宝藏。 + +-------------------------------------------------------------------------------- + +作者简介: + +D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她在解决图书馆需求上有大量的经验,她自 2008 年以来一直是 Koha 开源图书馆自动化套件的贡献者。Ruth 目前在休斯敦的 cPanel 任 Perl 开发人员,她也作为首席员工效力于双猫公司。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/2/elizabeth-python-library + +作者:[D Ruth Bavousett][a] +译者:[geekpi](https://github.com/geekpi) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/druthb +[1]:https://opensource.com/article/17/2/elizabeth-python-library?rate=kuXZVuHCdEv_hrxRnK1YQctlsTJeFJLcVx3Nf2VIW38 +[2]:https://en.wikipedia.org/wiki/Lorem_ipsum +[3]:https://github.com/lk-geimfari/elizabeth +[4]:https://www.python.org/ +[5]:https://www.debian.org/ +[6]:https://sqlite.org/ +[7]:https://flask.pocoo.org/ +[8]:http://elizabeth.readthedocs.io/en/latest/index.html +[9]:https://opensource.com/user/36051/feed +[10]:https://opensource.com/article/17/2/elizabeth-python-library#comments +[11]:https://opensource.com/users/druthb diff --git a/published/20170215 openSUSE on Raspberry Pi 3.md b/published/20170215 openSUSE on Raspberry Pi 3.md new file mode 100644 index 0000000000..b90aeba0ec --- /dev/null +++ b/published/20170215 openSUSE on Raspberry Pi 3.md @@ -0,0 +1,87 @@ +在树莓派 3 上运行 openSUSE:简单几步搭建一个实用系统 +================= + +本文由 SUSE 文档团队的技术作者 Dmitri Popov 撰写。 + +在[树莓派 3][3]上部署 [openSUSE][2] 系统不是很复杂,不过这儿有一些小技巧教你更好地完成这个过程。 + +首先,你将会有一些版本可供选择。如果你打算使用树莓派 3 作为一个普通主机,那么带有图形界面的 openSUSE 将是你最好的选择。有几种不同的图形环境可供选择:[X11][4]、[Enlightenment][5]、[Xfce][6] 或是 [LXQT][7]。openSUSE 还有一个 JeOS 版本能够提供最基础的系统,可以把树莓派 3 作为一个无显示器的服务器使用。更好的选择还有 openSUSE 的 [Leap][8] 或 [Tumbleweed][9] 版本。 + +![](https://www.suse.com/communities/blog/files/2017/02/j5dkkbtepng-dmitri-popov-450x300.jpg) + +首先你需要从 [https://en.opensuse.org/HCL:Raspberry_Pi3][10] 下载所需的 openSUSE 镜像,然后制作一张可启动的 microSD 卡。虽然可以使用命令行工具将下载好的镜像写入 microSD 卡,但 [Etcher][11] 可以使这个过程更轻松安全。从该项目网站上获取该程序,解压下载的 .zip 文件,并使用以下命令把得到的 .AppImage 文件设置为可执行: + +``` +chmod +x Etcher-x.x.x-linux-x64.AppImage +``` + +将 microSD 卡插入电脑,双击运行 Etcher 软件,选择下载好的 .raw.xz 镜像文件,点击 **Flash!** 按钮。然后将显示器和键盘连接到树莓派 3,插入 microSD 卡,启动树莓派。第一次启动时,openSUSE 会自动扩展文件系统以充分利用 microSD 卡上的剩余空间。这时你将看到以下信息: + +``` +GPT data structures destroyed! You may now partition the disk using fdisk or other utilities +GPT 数据结构被破坏!您需要使用 fdisk 或其它工具对磁盘分区。 +``` + +不用担心,稍等两分钟,openSUSE 将继续正常启动。当看到提示时,输入默认用户名 `root` 和默认密码 `linux` 登录系统。 + +如果你选择在树莓派 3 上部署 JeOS 版本,第一次启动时你不会看到屏幕上有任何输出。也就是说,屏幕会一直保持空白,直到系统完成对文件系统的扩展。你可以通过配置内核参数来显示输出,不过没有必要做这麻烦事。只需稍等片刻,你就能看到命令行提示。 + +由于 openSUSE 已经启用并且配置了 SSH 服务,所以启动树莓派时你可以不用显示器。这样的话,你就需要使用网卡接口将树莓派连接到网络中。给树莓派足够的时间来启动和扩展系统后,你就能够从同一网络中的其他主机,使用 `ssh root@linux.local` 命令,通过 SSH 服务连接树莓派。 + +默认情况下你将以 `root` 用户登录系统,所以创建一个普通用户是个不错的主意。你可以使用 YaST 配置工具轻松完成这件事。运行 `yast2` 命令,选择 **安全与用户**Security and Users -> **用户与用户组管理User and Group Management** 选项,就可以创建新用户了。你还可以选择 **系统System** -> **在线升级Online Update**选项来更新系统。完成之后,退出 YaST ,重启树莓派,然后使用新创建的用户登录系统。 + +一切搞定,不过还有一个重要的系统组件不能正常工作,那就是无线接口。当然,这个问题也可以轻松解决。首先使用以下命令安装 nano 文本编辑器: + +``` +sudo zypper in nano +``` + +然后运行以下命令修改 `raspberrypi_modules.conf` 文件: + +``` +sudo nano/etc/dracut.conf.d/raspberrypi_modules.conf +``` + +删除文件第一行的 `sdhci_iproc` ,再取消最后一行的注释。运行以下命令保存修改: + +``` +mkinitrd -f +``` + +最后,重启树莓派。 + +![](https://www.suse.com/communities/blog/files/2017/02/figure1-raspi-450x329.png) + +再次运行 YaST ,在**系统System** -> **网络设置Network Settings**区域,你应该能在网络接口列表中看到 `BCM43430 WLAN Card` 项。选择这一项,点击 **编辑Edit** 按钮。开启**动态地址分配Dynamic Address DHCP**选项,点击**下一步**,选择你想要连接的无线网络,配置所需的连接设置。点击**下一步**和**确定**保存设置。重启树莓派,它应该就能连接上特定的 Wi-Fi 网络了。 + +至此,你就完成了树莓派上的系统部署。 + +-------------------------------------------------------------------------------- + +via: https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/ + +作者:[chabowski][a] +译者:[Cathon](https://github.com/Cathon) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.suse.com/communities/blog/author/chabowski/ +[1]:https://www.suse.com/communities/blog/author/chabowski/ +[2]:https://www.opensuse.org/ +[3]:https://www.raspberrypi.org/ +[4]:https://www.x.org/wiki/ +[5]:https://www.enlightenment.org/ +[6]:https://www.xfce.org/ +[7]:http://lxqt.org/ +[8]:https://www.opensuse.org/#Leap +[9]:https://www.opensuse.org/#Tumbleweed +[10]:https://en.opensuse.org/HCL:Raspberry_Pi3 +[11]:https://etcher.io/ +[12]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# +[13]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# +[14]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# +[15]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# +[16]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# +[17]:http://www.printfriendly.com/print?url=https%3A%2F%2Fwww.suse.com%2Fcommunities%2Fblog%2Fopensuse-raspberry-pi-3-zero-functional-system-easy-steps%2F +[18]:http://www.printfriendly.com/print?url=https%3A%2F%2Fwww.suse.com%2Fcommunities%2Fblog%2Fopensuse-raspberry-pi-3-zero-functional-system-easy-steps%2F diff --git a/published/20170216 MASTER Cpp PROGRAMMING WITH OPEN-SOURCE BOOKS.md b/published/20170216 MASTER Cpp PROGRAMMING WITH OPEN-SOURCE BOOKS.md new file mode 100644 index 0000000000..b64e89c6bc --- /dev/null +++ b/published/20170216 MASTER Cpp PROGRAMMING WITH OPEN-SOURCE BOOKS.md @@ -0,0 +1,231 @@ +借助开源书籍掌握 C++ 编程 +============== + +书籍是非常主观和私人的财产,编程书籍也不例外。但是不管 C++ 编程书籍的风格、关注点或者节奏如何,好书总可以带领读者走过一段引人入胜的旅程,揭示编程语言的能力,还能向读者描绘如何使用编程语言来实现各种事物。 + +分享是一种美德,我精心挑选了九本值得一读的优质 C++ 书籍,这些书籍均基于开源协议发布。在这之前,我会给出一份 C++ 的简短介绍。 + +C++ 是由 Bjarne Stroustrup 设计,初次发布于 1983 年。它是一种静态类型、格式自由、多重范式、可移植、编译式的通用编程语言。它被认为是中级语言,同时包含有高级与初级编程语言的特性。C++ 设计用于实现系统级与应用的编程,它拓展了 C 编程语言,因此其名字中的使用了自增运算符 ++。 + +C++ 仍是一种流行的编程语言。例如,它被广泛应用于嵌入式系统、银行以及通讯业。它作为 C 的超集保留了 C 标志性的简洁与高效,同时提供强类型检查、多重继承、数据抽象、异常处理操作符重载、泛型编程,以及面向对象编程等功能。C++ 不仅影响了 C 语言的发展,同时也影响到了包括 C#、Java 在内的许多其他编程语言。 + +### 《Boost C++ 类库(The Boost C++ Libraries)》 + +![The Boost C++ Libraries](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/BoostC.jpeg?resize=200%2C245&ssl=1) + +作者 Boris Schäling (570页) + +《[Boost C++ 类库(The Boost C++ Libraries)][3]》被认为在 C++ 世界中极其重要并有深远影响。书中这些可移植的库提供对多种任务和结构体的支持,包括多线程、容器、字符串和文本处理、迭代器、线性代数、伪随机数产生、元程序设计模板、并发程序设计、数据结构、图像处理、正则表达式和单元测试。Boost 可以在几乎所有现代操作系统上工作,包括 Linux 和 Windows 及其衍生,并且支持绝大多数现代编译器。 + +这本书介绍了 72 个 Boost 库,提供了广泛并且实用的功能。它们能够帮助程序员更轻松的管理内存和处理字符串。这些库提供多种容器以及其它数据结构来拓展标准库。使用这些库可以轻松实现平台无关的网络应用程序。 + +本书是一颗值得添加到各类收藏中的明珠。430 份源代码例子生动形象地阐释了这些库的功能。 + +本书前面的章节审视了内存管理、字符串处理、容器、数据结构、算法、通信、文件与流以及时间。后续章节进一步探索了函数式编程、并行编程和泛型编程。以对语言拓展、错误与数字处理、应用程序库、设计模式以及其他库的大部分内容。 + +本书采用[知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议](http://creativecommons.org/licenses/by-nc-nd/4.0/)进行许可。如果你喜欢实体书,可以在亚马逊上购买纸质书,也可选择如 kindle、E-book 和 PD F格式的电子书。 + +### 《C++ 注释(C++ Annotations)》 + +![C++ Annotations]( +https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/CAnnotations.png?resize=470%2C663&ssl=1) + +作者 Frank B. Brokken (1029页) + +《[C++ 注释(C++ Annotations)][4]》提供了关于 C++ 编程语言的一份全面的教程。它可以被当做一门 C++ 课程的教材。本书面向已掌握 C 语言或其他类 C 语法知识的使用者。 + +本书主要章节有: + +* 命名空间 +* 字符串——C 提供的是最基础的字符串支持 +* I/O 流库——提供了一个基于类概念的输入/输出库 +* 类——C 提供了两种结构化不同类型数据的方法。C 语言的结构体包含多种类型的数据成员,而 C 语言的共用体(union)同样可以定义不同类型的数据成员。本章介绍的类,也是一种结构体但是它的内容对外部世界来说是默认不可访问的。 +* 静态数据和函数 +* 内存管理——审视 C++ 中能够操作内存分配的操作符 +* 异常——允许 C++ 程序执行受控的非本地返回命令,避免了使用 longjmp(非局部跳转)和 setjmp(激活非局部跳转)函数的缺陷。 +* 操作符重载——介绍通用的操作符重载 +* 抽象容器 +* 继承——派生的另外一个特性。 本章演示基类指针可能被用来指向派生类的对象。 +* 多态——继承的一种特殊形态 +* 友元机制——介绍 friend 关键词以及它的使用原则 +* 成员指针——定义成员指针及其用法,静态成员指针,指针长度 +* 嵌套类——当嵌套类与其外围类有概念上的紧密联系时会被使用 +* 标准模板库(STL)——包含容器、通用算法、迭代器、函数对象、分配器、适配器和数据结构的通用库。这些算法使用的数据结构都是抽象意义的,因此算法实际上可以使用任何数据类型。 +* 泛型算法——涵盖标准模板库中的泛型算法 +* 函数模板——探索模板独特的句法。介绍模板类型参数与模板非类型参数和函数模板等概念并且提供模板的多个案例。 +* 类模板——讨论构建与使用类模板 +* 进阶模板用法——一份简短的模板元编程主要特性与模板的微妙关系的介绍 + +本书有HTML、PDF、PostScript 和 txt 版本。它可以自由分发,基于 GNU GPL 协议发布。 + + +### 《通过 C++ 和 Qt4 了解设计模式(An Introduction to Design Patterns in C++ with Qt 4)》 + +![Introduction to Design Patterns in C++ with Qt 4, An](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/DesignPatternsQt4.jpeg?resize=200%2C264&ssl=1) + +作者 Alan Ezust, Paul Ezust (656页) + +《[通过 C++ 和 Qt4 了解设计模式(An Introduction to Design Patterns in C++ with Qt 4)][5]》从介绍 C++ 基础知识、面向对象概念、UML(统一建模语言)和核心 Qt 类开始。进而转向更高级的编程概念如 Qt modules 和设计模式。最后严密地印证了重要的 C++ 特性。其中涵盖了非常优秀的对函数、继承和多态的讲解。 + +本书不需要具备任何 C 或者 C++ 编程经验前提,并且被设计为普适用途。它也为教学工作者准备了 Qt 案例、练习、答案以及课程 PPT。 + +本书是 Bruce Perens 开源系列中的一部分。所有在此系列中的书籍都是基于 Open Publication License V1.0 及其后版本发布的。 + +### 《像计算机科学家一样思考:C++(How to Think Like a Computer Scientist: C++)》 + +![How to Think Like a Computer Scientist: C++](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/ComputerScientistC.jpg?resize=200%2C250&ssl=1) + +作者 Allen B. Downey (191页) + +《[像计算机科学家一样思考:C++(How to Think Like a Computer Scientist: C++)][6]》是使用 C++ 编程语言进行软件设计的一本简洁友好的介绍性书籍。本书的目的是通过讲解最基础的概念并且以读者容易接受的节奏逐步增加新内容来把没有编程经验的读者培养成为未来的开发者。 + +本书提供的有价值的内容包括: + +* 变量、表达式和语句 +* 函数 +* 条件语句与递归 +* 丰富的函数 +* 迭代 +* 字符串 +* 向量 +* 成员函数 +* 对象的向量 +* 向量的对象 +* 类与不变量 +* 文件输入输出和 apmatrixes + +本书是一本在[知识共享署名-非商业性使用-3.0 未本地化版本](https://creativecommons.org/licenses/by-nc/3.0/)协议下发布的免费书籍。 + +### 《C++ Qt3 图形界面编程(C++ GUI Programming with Qt 3)》 + +![C++ GUI Programming with Qt 3](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/02/CQt3.jpeg?resize=200%2C262&ssl=1) + +作者 Jasmin Blanchette, Mark Summerfield (464 页) + +最新发布的 Qt 稳定版本是 5.8,而《[C++ Qt3 图形界面编程(C++ GUI Programming with Qt 3)][7]》指导读者如何使用 Qt3 编写 GUI 程序,Qt3 最近一次更新是 2004 年,但是本书仍然有大部分内容对 Qt4 和 Qt5 有效。 + +本书不是一本面向初学者的书,需要读者对 C++ 有基本的理解。 + +本书向读者介绍了使用 Qt 进行 GUI 应用编程所有的概念和需要的练习。本书不仅详尽的讲述了核心内容,而且也提供了一些特别的和高阶的学习材料。 + +本书是 Bruce Perens 开源系列中的一部分。所有在此系列中的书籍都是基于 Open Publication License V1.0及之后版本发布的。 + + +### 《开放数据结构(C++ 版)(Open Data Structures (in C++))》 + + ![Open Data Structures (in C++)](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/OpenDataStructures.jpg?resize=200%2C300&ssl=1) + + 作者 Pat Morin (336页) + +《[开放数据结构(C++ 版)(Open Data Structures (in C++))][1]》教导读者设计和分析基础数据结构以及如何使用 C++ 实现。 它涵盖了对如下数据结构的分析和实现:序列(列表)、队列、优先队列、无序字典、有序字典以及图。作者的意图在于向大学计算机科学的学生提供一条学习数据结构的免费的途径,但是并不打算成为介绍 C++ 编程语言或者 C++ 标准模板库的一本书。不过它可以帮助程序员理解标准模板库的数据结构是如何实现的以及这种实现为何如此高效。 + +章节内容覆盖了基于数组的列表、链表、分级链表、哈希表、二叉树(又包含了随机二叉搜索树、替罪羊树、红黑树)。之后的章节还包括堆、排序算法(比较、计数和基数排序)、图、整数的数据结构和外部存储器搜索。 + +本书基于[知识共享署名](http://creativecommons.org/licenses/by/4.0/) 协议发布。免费的 HTML、PDF 均已发布,本书的 LaTeX 版本,Java/C++/Python 源代码都可以从 GitHub 下载。也有纸质书版本可供购买。本书已被翻译为斯罗维尼亚语和土耳其语。 + + +### 《使用 wxWidgets 进行跨平台 GUI 编程(Cross-Platform GUI Programming with wxWidgets)》 + +![Cross-Platform GUI Programming with wxWidgets](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/wxWidgets.jpeg?resize=200%2C264&ssl=1) + +作者 Julian Smart,Kevin Hock和Stefan CsomorBrifll (744 页) + +wxWidgets 是一个流行的 C++ 库,可供开发者使用单一的代码基础为 Windosw、Mac OS、Linux 和其他平台创建应用。它支持非常广泛的图形处理库。 + +这本书《[使用 wxWidgets 进行跨平台 GUI 编程(Cross-Platform GUI Programming with wxWidgets)][8]》从简单的介绍和起步章节开始,主要内容包括: + +* 事件处理 +* 窗口基础 +* 画图 +* 输入事件处理 +* 使用 sizers 进行窗口布局 +* 使用标准对话框 +* 创建自定义对话框 +* 图像编程 +* 剪贴板与拖放动作 +* 高阶窗口类 +* 文件和数据流 +* 内存管理,调试和错误检查 +* 编写国际化应用 +* 编写多线程应用 +* wxSocket 编程 +* 处理文档和视图 +* 日臻完美你的应用 + +本书是 Bruce Perens 开源系列中的一部分。所有在此系列中的书籍都是基于 Open Publication License V1.0及其后版本发布的。 + + +### 《Rook 的 C++ 指南(The Rook’s Guide to C++)》 + +![The Rook's Guide to C++](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/02/RooksGuide.jpg?resize=200%2C300&ssl=1) + +作者 Jeremy Hansen (160页) + +《[Rook 的 C++ 指南(The Rook’s Guide to C++)][2]》的章节中包含变量、常量、输入输出、数据类型和转换、条件判断语句(if、else 和 else if、switch 语句)、字符串、循环、数组、块、函数和作用域。之后的章节主要集中解决问题和定位问题,包括预处理器、高等代数、文件输入输出、指针、动态数据、类和抽象、分离编译和标准模板库。 + +本书大部分都是由 25 位 Norwich 大学的学生于一个黑客马拉松周末写成。当然不敢说毫无缺点,但还是一本相当不错的书。它被基于[知识共享署名-非商业性使用-相同方式共享 3.0 未本地化版本](https://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh)协议发布。同时在亚马逊也有本书的纸质版可供购买。 + + +### 《GCC 简介(An Introduction to GCC)》 + +![An Introduction to GCC](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/01/IntroductionGCC.png?resize=200%2C300&ssl=1) + +作者 Brian Gough (144页) + +《[GCC 简介(An Introduction to GCC)][9]》介绍了 GCC,同时介绍了 GNU C 和 C++ 编译器:gcc 和 g++,均属于 GNU 编译器集合(GCC)。 + +本书解释了如何单独使用编译器。作者通过数年对邮件列表中发表的问题的观察,撰写本书带领读者直接接触 GCC 最重要的部分。 + +章节简介: + +* 介绍 +* 编译一个 C 程序——描述了如何使用 gcc 编译 C 程序。程序可能是由单独文件或者多个文件编译而成,也可能使用系统库和头文件。 +* 编译选项——描述gcc中可以使用的编译器中常用的选项。这些选项可以修改本地库和包含文件的搜索路径,配置额外的 warning 和调试信息,预处理器宏指令和 C 方言。 +* 使用预处理——描述了属于 GCC 包内的 GNU C 预处理 cpp 程序的用途。预处理将宏定义在源代码被编译前展开。预处理会在 GCC 编译 C 或者 C++ 程序时自动被调用。 +* 以调试为目的编译——提供 -g 选项使目标文件和可执行文件中存储额外的调试信息。当出现错误时,这些调试信息允许从特定的机器指令回溯到源代码中相应的行。 +* 优化编译——GCC 是一个优化编译器。它提供了大量的选项来使其生成的可执行文件的速度得到提升,并尽量减小可执行文件的大小。 +* 编译一个 C++ 程序——描述了如何使用 GCC 来编译以 C++ 编写的程序,以及针对这门语言特定的命令行选项。 +* 平台相关的选项——描述了一些通用平台上可用的选项,如 Intel 和 AMD x86 选项、x86 拓展选项、x86 64 位处理器选项、DEC Alpha 选项、SPARC 选项、POWER/powerPC 选项、复合架构支持以及浮点相关问题。 +* 问题定位——GCC 提供了几项帮助和诊断选项来帮助用户在编译过程中定位问题。 +* 编译器相关工具——介绍了大量能够用于和 GCC 组合使用的工具。包括:用来创建库的 GNU 压缩器 ar,以及 GNU 性能和覆盖测试工具:gprof 和 gcov。 +* 编译器如何工作——描述了关于 GCC 如何将源代码转换为可执行程序的更多细节。编译是一个涉及到多种工具的多级过程,包括 GNU 编译器自身(通过 gcc 或者 g++ 前端)、GNU 汇编器 as 以及 GNU 链接器 ld。编译过程中一个完整的工具集合被称之为工具链。 +* 检查编译后的文件——描述了多种有用的工具来检查可执行文件和目标文件的内容。 +* 常见错误消息——描述了 gcc 和 g++ 产生的最常见的错误和警告信息。每一个案例都伴随着错误和警告产生的原因,相应的例子和可能解决问题的建议。 +* 获得帮助——如果读者碰到了本书中未能涵盖的问题,还有多种参考手册更详细的描述了 GCC 和编程语言相关的主题。 + +本书是基于 GNU Free Documentation 协议出版的。 + +此外还有一些 C++ 书籍可以免费下载,但是那些并不是基于开源协议发布的,或者作者没有指定一个协议。这类书籍包括: + +- [Thinking in C++,第二版,卷一、卷二][14] – 作者 Bruce Eckel (卷二作者增加了 Chuck Allison) +- [C++ In Action:Industrial Strength Programming][15]– 作者 Bartosz Milewski + +最后,我对刚入门的 C++ 新手的建议一定是 [编程原理与体验(C++ 版)(Programming — Principles and Practice Using C++) (第二版)][16]。普遍认为这是最合适的入门书籍,由 C++ 的创始人书写,物超所值。 + +-------------------------------------------------------------------------------- + +via: https://www.ossblog.org/master-c-programming-with-open-source-books/ + +作者:[Steve Emms][a] +译者:[xiaow6](https://github.com/xiaow6) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.ossblog.org/author/steve/ +[1]:http://opendatastructures.org/ods-cpp/ +[2]:https://rooksguide.org/ +[3]:https://theboostcpplibraries.com/ +[4]:http://www.icce.rug.nl/documents/cplusplus/ +[5]:http://www.informit.com/store/introduction-to-design-patterns-in-c-plus-plus-with-9780131879058 +[6]:http://greenteapress.com/thinkcpp/index.html +[7]:http://www.informit.com/store/c-plus-plus-gui-programming-with-qt-3-9780131240728 +[8]:http://www.informit.com/store/cross-platform-gui-programming-with-wxwidgets-9780131473812 +[9]:http://www.network-theory.co.uk/docs/gccintro/ +[10]:https://www.ossblog.org/author/steve/ +[11]:https://www.ossblog.org/master-c-programming-with-open-source-books/#comments +[12]:https://www.ossblog.org/category/books/ +[13]:https://www.ossblog.org/category/programming/ +[14]:http://mindview.net/Books/TICPP/ThinkingInCPP2e.html +[15]:http://www.relisoft.com/book/ +[16]:http://stroustrup.com/Programming/ \ No newline at end of file diff --git a/published/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md b/published/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md new file mode 100644 index 0000000000..d9d2fca8f6 --- /dev/null +++ b/published/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md @@ -0,0 +1,185 @@ +如何在 Ubuntu 上用 Yocto 创建你自己的 Linux 发行版 +======================================== + +### 本文内容 + +本文主要聚焦在如何使用 Yocto 在 Ubuntu 上创建一个最小化的 Linux 发行版。Yocto 项目在嵌入式 Linux 的世界非常著名,这是因为它用起来非常灵活、方便。Yocto 的目标是为嵌入式软硬件开发商创建自己的 Linux 发行版。本文我们将会创建一个可以运行在 QEMU 上的最小化的 Linux,并且在 QEMU 上实际运行。 + +### 开发机的基本条件 + +* 最少 4-6 GB 内存 +* 最新版的 Ubuntu 系统(本文使用了 16.04 LTS) +* 磁盘剩余空间至少 60-80 GB +* 在创建 Linux 发行版之前先安装下面的软件包 +* 下载最新的 Yocto(Poky 是其最小开发环境)稳定分支 + +``` +apt-get update +``` +``` +apt-get install wget git-core unzip make gcc g++ build-essential subversion sed autoconf automake texi2html texinfo coreutils diffstat python-pysqlite2 docbook-utils libsdl1.2-dev libxml-parser-perl libgl1-mesa-dev libglu1-mesa-dev xsltproc desktop-file-utils chrpath groff libtool xterm gawk fop +``` + +![Install prerequisites for Yocto](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/1-pre_requisite_packages-1.png) + +如下所示,开发环境要安装的软件包将近 1GB 大小。 + + ![Install the development packages](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/2-pre_requisite_packages-2.png) + +在这个教程中,系统上克隆的是 poky 的 `morty` 稳定分支。 + +``` + git clone -b morty git://git.yoctoproject.org/poky.git +``` + +![install poky](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/download_morty_of_yocto.png) + +进入 `poky` 目录,然后运行下面的命令为 Yocto 开发环境设置(设置/导出)一些环境变量。 + +``` +source oe-init-build-env +``` + +如下所示,在运行了 open embedded (oe) 的构建环境脚本之后,终端里的路径会自动切换到 `build` 目录,以便进行之后行发行版的的配置和构建。 + + ![Prepare OE build environment](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/source_environment_script.png) + +上面的截屏展示了在 `conf` 目录下创建的文件 `local.conf`。这是 Yocto 用来设置目标机器细节和 SDK 的目标架构的配置文件。 + +如下所示,这里设置的目标机器是 `qemux86-64`。 + + ![Set the target machine type](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/selected_target.png) + +如下面截图所示,在 `local.conf` 中取消下面参数的注释符号。 + +``` +DL_DIR ?= "${TOPDIR}/downloads" +``` + +![Configure local.conf file](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/uncheck_Download_parameters.png) + +``` +SSTATE_DIR ?= "${TOPDIR}/sstate-cache" +``` + +![Set SSTATE_DIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/uncheck_sstate_parametes.png) + +``` +TMPDIR ?= "${TOPDIR}/tmp" +``` + +![Set TMPDIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/tempdir_uncheck_paramerter.png) + +``` +PACKAGE_CLASSES ?= "package_rpm" +SDKMACHINE ?= "i686" +``` + +![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/sdk_and_package_selection.png) + +如下所示,在 `local.conf` 中为基于 Yocto 的 Linux 设置空密码和后续的一些参数。否则的话用户就不能登录进新的发行版。 + +``` +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" +``` + +![Set debug-tweaks option](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/extra-features_for_blank_password.png) + +我们并不准备使用任何图形化工具来创建 Linux OS,比如 `toaster` (`hob` 已经不再支持了)。 + +### Yocto 编译构建过程 + +现在运行下面的 `bitbake` 工具命令开始为选定的目标机器下载和编译软件包。 + +``` +bitbake core-image-minimal +``` + +![Start bitbake](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/bitbake_coreimageminimal.png) + +**非常重要的是要在普通 Linux 用户下运行上面的命令,而不是使用 root 用户**。如下面截图所示,当你在 root 用户下运行 bitbake 命令会产生下面所示的错误。 + +![Do not run bitbake as root](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/dont_user_as_a_root.png) + +再一次运行导出环境变量的脚本(`oe-init-build-env`),重新执行相同的命令来启动下载和编译过程。 + +![rerun commands](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/runniing_bitbake_again-normal_user.png) + +如下所示,构建脚本组件的第一步工作是解析配置(`recipe`)。 + +![Parse the build recipes](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/parsing-receipe.png) + +下面的截图展示了构建脚本的解析过程。同时也显示了用来构建你的新的基于 yocto 的发行版的构建系统的细节。 + +![Building proceeds](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/output_of_parsing.png) + +在下载了 SDK 和必要的库之后,下一步工作是下载并编译软件包。如下截图展示了为构建新发行版而执行的任务。这一步将会执行 2-3 小时,因为首先要下载需要的软件包,然后还要为新的 Linux 发行版编译这些软件包。 + +![Compilation will take several hours](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/task_list.png) + +下面的截图表明了任务列表执行完毕。 + + ![](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/downloaded-all_packages_and_compiled.png) + +为目标机器类型 `qemux86-64` 编译好的新镜像位于 `build/tmp/deploy/images/qemux86-64`: + +![Build complete](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/new_linux_compiled_under_qemux86_64.png) + +如下所示,上面的命令如果运行在 `Putty` 上会产生一个错误。 + +![command error in putty](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/error_on_putty.png) + +通过 `rdp` 在 Ubuntu 平台上再次运行上面的命令。 + +![Command works fine in rdp](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/runqemu_command.png) + +为运行新的基于 Yocto 的 Linux 发行版的 qemu 打开一个新屏幕。 + +![Open Quemu emulator](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/new_linux_inside_the_qemu_.png) + +下面展示了新发行版的登录界面,同时也显示了使用的 yocto 项目的版本号。默认的用户名是 `root` ,密码为空。 + + ![Linux distribution started](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/reference_distro.png) + +最后使用 `root` 用户名和空密码登录新发行版。如下截图所示,在这个最小版本的 Linux 上运行了基本的命令(`data` 、 `ifconfig` 和 `uname`)。 + + ![Test the Linux distribution](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/inside_new_linux_distro_running_on_qemu_3.png) + +本文的目标是理解使用 Yocto 创建新的 Linux 发行版的过程。 + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-create-your-own-linux-distribution-with-yocto-on-ubuntu/ + +作者:[Ahmad][a] +译者:[Ezio](https://github.com/oska874) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/how-to-create-your-own-linux-distribution-with-yocto-on-ubuntu/ +[1]:https://www.howtoforge.com/tutorial/how-to-create-your-own-linux-distribution-with-yocto-on-ubuntu/#prerequisites-for-the-development-machinenbsp +[2]:https://www.howtoforge.com/tutorial/how-to-create-your-own-linux-distribution-with-yocto-on-ubuntu/#yocto-compilation-and-building-process +[3]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/1-pre_requisite_packages-1.png +[4]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/2-pre_requisite_packages-2.png +[5]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/download_morty_of_yocto.png +[6]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/source_environment_script.png +[7]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/selected_target.png +[8]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/uncheck_Download_parameters.png +[9]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/uncheck_sstate_parametes.png +[10]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/tempdir_uncheck_paramerter.png +[11]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/sdk_and_package_selection.png +[12]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/extra-features_for_blank_password.png +[13]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/bitbake_coreimageminimal.png +[14]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/dont_user_as_a_root.png +[15]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/runniing_bitbake_again-normal_user.png +[16]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/parsing-receipe.png +[17]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/output_of_parsing.png +[18]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/task_list.png +[19]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/downloaded-all_packages_and_compiled.png +[20]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/new_linux_compiled_under_qemux86_64.png +[21]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/error_on_putty.png +[22]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/runqemu_command.png +[23]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/new_linux_inside_the_qemu_.png +[24]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/reference_distro.png +[25]:https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/inside_new_linux_distro_running_on_qemu_3.png diff --git a/published/20170225 How to Upload or Download Files-Directories Using sFTP in Linux.md b/published/20170225 How to Upload or Download Files-Directories Using sFTP in Linux.md new file mode 100644 index 0000000000..d9a62b90f0 --- /dev/null +++ b/published/20170225 How to Upload or Download Files-Directories Using sFTP in Linux.md @@ -0,0 +1,116 @@ +如何在 Linux 中使用 sFTP 上传或下载文件/文件夹 +============================================================ + +[sFTP(安全文件传输程序)][1]是一种安全的交互式文件传输程序,其工作方式与 FTP(文件传输协议)类似。 然而,sFTP 比 FTP 更安全;它通过加密 SSH 传输处理所有操作。 + +它可以配置使用几个有用的 SSH 功能,如[公钥认证][2]和压缩。 它连接并登录到指定的远程机器,然后切换到交互式命令模式,在该模式下用户可以执行各种命令。 + +在本文中,我们将向你展示如何使用 sFTP 上传/下载整个目录(包括其子目录和子文件)。 + +### 如何在 Linux 中使用 sFTP 传输文件/文件夹 + +默认情况下,SFTP 协议采用和 SSH 传输协议一样的方式建立到远程服务器的安全连接。虽然,用户验证使用类似于 SSH 默认设置的密码方式,但是,建议[创建和使用 SSH 无密码登录][3],以简化和更安全地连接到远程主机。 + +要连接到远程 sftp 服务器,如下建立一个安全 SSH 连接并创建 SFTP 会话: + +``` +$ sftp tecmint@192.168.56.10 +``` + +登录到远程主机后,你可以如下运行交互式的 sFTP 命令: + +``` +sftp> ls #list directory +sftp> pwd #print working directory on remote host +sftp> lpwd #print working directory on local host +sftp> mkdir uploads #create a new directory +``` +[ + ![Run sFTP Commands on Remote Linux](http://www.tecmint.com/wp-content/uploads/2017/02/Run-sFTP-Commands-on-Remote-Linux.png) +][4] + +* Linux 主机上运行 sFTP 命令* + +#### 如何使用 sFTP 上传文件夹 + +要将整个目录上传到远程 Linux 主机中,请使用 `put` 命令。但是,如果目录名称不存在于远程主机上的工作目录中,你将收到错误,如下面的屏幕截图所示。 + +因此,首先在远程主机上创建一个具有相同名称的目录,然后从本地主机上传它,`-r` 参数允许拷贝子目录和子文件: + +``` +sftp> put -r Tecmint.com-articles +sftp> mkdir Tecmint.com-articles +sftp> put -r Tecmint.com-articles +``` + +[ + ![Upload Directory using SFTP](http://www.tecmint.com/wp-content/uploads/2017/02/Upload-Directory-using-SFTP.png) +][5] + +*使用 sFTP 上传文件夹* + +要保留修改时间、访问时间以及被传输的文件的模式,请使用 `-p` 标志。 + +``` +sftp> put -pr Tecmint.com-articles +``` + +#### 如何使用 sFTP 下载文件夹 + +要从远程 Linux 主机下载整个 fstools-0.0 文件夹到本机中,如下所示使用 get 命令带上 `-r` 标志: + +``` +sftp> get -r fstools-0.0 +``` +[ + ![Download Directory using sFTP](http://www.tecmint.com/wp-content/uploads/2017/02/Download-Directory-using-sFTP.png) +][6] + +*使用 sFTP 下载目录* + +如果文件夹已经下载完成了,接着查看本机的工作目录。 + +要退出 sFTP shell,输入: + +``` +sftp> bye +或者 +sftp> exit +``` + +此外,阅读这篇 [sFTP 命令和使用技巧][7]。 + +请注意,为了防止用户访问远程主机上的整个文件系统,出于安全原因,你可以使用 chroot Jail [将 sFTP 用户限制到其主目录][8]中。 + +就是这样了!在本文中,我们向你展示了如何使用 sFTP 上传/下载整个目录。使用下面的评论栏向我们提供你对本文/主题的看法。 + +-------------------------------------------------------------------------------- + + +作者简介: + +Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux 系统管理员和网络开发人员,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/sftp-upload-download-directory-in-linux/ + +作者:[Aaron Kili][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/sftp-command-examples/ +[2]:https://linux.cn/article-6901-1.html +[3]:https://linux.cn/article-6901-1.html +[4]:http://www.tecmint.com/wp-content/uploads/2017/02/Run-sFTP-Commands-on-Remote-Linux.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/02/Upload-Directory-using-SFTP.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Download-Directory-using-sFTP.png +[7]:http://www.tecmint.com/sftp-command-examples/ +[8]:http://www.tecmint.com/restrict-sftp-user-home-directories-using-chroot/ +[9]:http://www.tecmint.com/author/aaronkili/ +[10]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[11]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/translated/tech/LXD/Part 10 - LXD 2.0--LXD and Juju.md b/published/LXD/Part 10 - LXD 2.0--LXD and Juju.md similarity index 78% rename from translated/tech/LXD/Part 10 - LXD 2.0--LXD and Juju.md rename to published/LXD/Part 10 - LXD 2.0--LXD and Juju.md index 969374da74..bfaf180bcb 100644 --- a/translated/tech/LXD/Part 10 - LXD 2.0--LXD and Juju.md +++ b/published/LXD/Part 10 - LXD 2.0--LXD and Juju.md @@ -1,26 +1,25 @@ -LXD 2.0 系列(十):LXD和Juju +LXD 2.0 系列(十):LXD 和 Juju ====================================== 这是 [LXD 2.0 系列介绍文章][1]的第十篇。 - ![LXD logo](https://linuxcontainers.org/static/img/containers.png) +![LXD logo](https://linuxcontainers.org/static/img/containers.png) -介绍 -============================================================ +### 介绍 -Juju是Canonical的服务建模和部署工具。 它支持非常广泛的云提供商,使您能够轻松地在任何云上部署任何您想要的服务。 +Juju 是 Canonical 的服务建模和部署工具。 它支持非常广泛的云服务提供商,使您能够轻松地在任何云上部署任何您想要的服务。 -此外,Juju 2.0还支持LXD,既适用于本地部署,也适合开发,并且可以在云实例或物理机上共同协作。 +此外,Juju 2.0 还支持 LXD,既适用于本地部署,也适合开发,并且可以在云实例或物理机上共同协作。 本篇文章将关注本地使用,通过一个没有任何Juju经验的LXD用户来体验。 -# 要求 +### 要求 -本篇文章假设你已经安装了LXD 2.0并且配置完毕(看前面的文章),并且是在Ubuntu 16.04 LTS上运行的。 +本篇文章假设你已经安装了 LXD 2.0 并且配置完毕(看前面的文章),并且是在 Ubuntu 16.04 LTS 上运行的。 -# 设置 Juju +### 设置 Juju -第一件事是在Ubuntu 16.04上安装Juju 2.0。这个很简单: +第一件事是在 Ubuntu 16.04 上安装 Juju 2.0。这个很简单: ``` stgraber@dakara:~$ sudo apt install juju @@ -52,7 +51,7 @@ Setting up juju-2.0 (2.0~beta7-0ubuntu1.16.04.1) ... Setting up juju (2.0~beta7-0ubuntu1.16.04.1) ... ``` -安装完成后,我们可以使用LXD启动一个新的“控制器”。这意味着Juju不会修改你主机上的任何东西,它会在LXD容器中安装它的管理服务。 +安装完成后,我们可以使用 LXD 启动一个新的“控制器”。这意味着 Juju 不会修改你主机上的任何东西,它会在 LXD 容器中安装它的管理服务。 现在我们创建一个“test”控制器: @@ -86,7 +85,7 @@ Waiting for API to become available: upgrade in progress (upgrade in progress) Bootstrap complete, local.test now available. ``` -这会花费一点时间,这时你可以看到一个正在运行的一个新的LXD容器: +这会花费一点时间,这时你可以看到一个正在运行的一个新的 LXD 容器: ``` stgraber@dakara:~$ lxc list juju- @@ -97,7 +96,7 @@ stgraber@dakara:~$ lxc list juju- +-----------------------------------------------------+---------+----------------------+------+------------+-----------+ ``` -在Juju这边,你可以确认它有响应,并且还没有服务运行: +在 Juju 这边,你可以确认它是有响应的,并且还没有服务运行: ``` stgraber@dakara:~$ juju status @@ -111,7 +110,7 @@ ID WORKLOAD-STATUS JUJU-STATUS VERSION MACHINE PORTS PUBLIC-ADDRESS MESSAGE ID STATE DNS INS-ID SERIES AZ ``` -你也可以在浏览器中访问Juju的GUI界面: +你也可以在浏览器中访问 Juju 的 GUI 界面: ``` stgraber@dakara:~$ juju gui @@ -120,13 +119,13 @@ If it does not open, open this URL: https://10.178.150.72:17070/gui/97fa390d-96ad-44df-8b59-e15fdcfc636b/ ``` - ![Juju web UI](https://www.stgraber.org/wp-content/uploads/2016/06/juju-gui.png) +![Juju web UI](https://www.stgraber.org/wp-content/uploads/2016/06/juju-gui.png) -尽管我更倾向使用命令行,因此我会在接下来使用。 +不过我更倾向使用命令行,因此我会在接下来使用。 -# 部署一个minecraft服务 +### 部署一个 minecraft 服务 -让我们先来一个简单的,部署在一个容器中使用一个Juju单元的服务。 +让我们先来一个简单的,部署在一个容器中使用一个 Juju 单元的服务。 ``` stgraber@dakara:~$ juju deploy cs:trusty/minecraft @@ -134,7 +133,7 @@ Added charm "cs:trusty/minecraft-3" to the model. Deploying charm "cs:trusty/minecraft-3" with the charm series "trusty". ``` -返回会很快,然而这不意味着服务已经启动并运行了。你应该使用“juju status”来查看: +命令返回会很快,然而这不意味着服务已经启动并运行了。你应该使用 `juju status` 来查看: ``` stgraber@dakara:~$ juju status @@ -152,7 +151,7 @@ ID STATE DNS INS-ID SERIES AZ ``` -我们可以看到它正在忙于在刚刚创建的LXD容器中安装java。 +我们可以看到它正在忙于在刚刚创建的 LXD 容器中安装 java。 ``` stgraber@dakara:~$ lxc list juju- @@ -182,7 +181,7 @@ ID STATE DNS INS-ID SERIES AZ 1 started 10.178.150.74 juju-97fa390d-96ad-44df-8b59-e15fdcfc636b-machine-1 trusty ``` -这时你就可以启动你的Minecraft客户端了,它指向10.178.150.74,端口是25565。现在可以在新的minecraft服务器上玩了! +这时你就可以启动你的 Minecraft 客户端了,将其指向 10.178.150.74,端口是 25565。现在可以在新的 minecraft 服务器上玩了! 当你不再需要它,只需运行: @@ -192,13 +191,13 @@ stgraber@dakara:~$ juju destroy-service minecraft 只要等待几秒就好了。 -# 部署一个更复杂的web应用 +### 部署一个更复杂的 web 应用 -Juju的主要工作是建模复杂的服务,并以可扩展的方式部署它们。 +Juju 的主要工作是建模复杂的服务,并以可扩展的方式部署它们。 -为了更好地展示,让我们部署一个Juju “组合”。 这个组合是由网站,API,数据库,静态Web服务器和反向代理组成的基本Web服务。 +为了更好地展示,让我们部署一个 Juju “组合”。 这个组合是由网站,API,数据库,静态 Web 服务器和反向代理组成的基本 Web 服务。 -所以这将扩展到4个互联的LXD容器。 +所以这将扩展到 4 个互联的 LXD 容器。 ``` stgraber@dakara:~$ juju deploy cs:~charmers/bundle/web-infrastructure-in-a-box @@ -228,7 +227,7 @@ added nginx-proxy/0 unit to new machine deployment of bundle "cs:~charmers/bundle/web-infrastructure-in-a-box-10" completed ``` -几秒后,你会看到LXD容器在运行了: +几秒后,你会看到 LXD 容器在运行了: ``` stgraber@dakara:~$ lxc list juju- @@ -283,15 +282,15 @@ ID STATE DNS INS-ID SERIES AZ 5 started 10.178.150.214 juju-97fa390d-96ad-44df-8b59-e15fdcfc636b-machine-5 trusty ``` -这时你就可以在80端口访问http://10.178.150.214,并且会看到一个Juju学院页面。 +这时你就可以在 80 端口访问 http://10.178.150.214,并且会看到一个 Juju 学院页面。 [ ![Juju Academy web service](https://www.stgraber.org/wp-content/uploads/2016/06/juju-academy.png) ][2] -# 清理所有东西 +### 清理所有东西 -如果你不需要Juju创建的容器并且不在乎下次需要再次启动,最简单的方法是: +如果你不需要 Juju 创建的容器并且不在乎下次需要再次启动,最简单的方法是: ``` stgraber@dakara:~$ juju destroy-controller test --destroy-all-models @@ -328,24 +327,36 @@ stgraber@dakara:~$ lxc list juju- +------+-------+------+------+------+-----------+ ``` -# 总结 +### 总结 -Juju 2.0内置的LXD支持使得可以用一种非常干净的方式来测试各种服务。 +Juju 2.0 内置的 LXD 支持使得可以用一种非常干净的方式来测试各种服务。 -在Juju charm store中有很多预制的“组合”可以用来部署,甚至可以用多个“charm”来组合你想要的架构。 +在 Juju charm store 中有很多预制的“组合”可以用来部署,甚至可以用多个“charm”来组合你想要的架构。 -Juju与LXD是一个完美的解决方案,从一个小的Web服务到大规模的基础设施都可以简单开发,这些都在你自己的机器上,并且不会在你的系统上造成混乱! +Juju 与 LXD 是一个完美的解决方案,从一个小的 Web 服务到大规模的基础设施都可以简单开发,这些都在你自己的机器上,并且不会在你的系统上造成混乱! + +### 额外信息 + +Juju 网站: http://www.ubuntu.com/cloud/juju +Juju charm store : https://jujucharms.com + +LXD 的主站在: https://linuxcontainers.org/lxd +LXD 的 GitHub 仓库: https://github.com/lxc/lxd +LXD 的邮件列表: https://lists.linuxcontainers.org +LXD 的 IRC 频道: #lxcontainers on irc.freenode.net +如果你不想或者不能在你的机器上安装 LXD ,你可以在 web 上试试[在线版的 LXD](https://linuxcontainers.org/lxd/try-it)。 -------------------------------------------------------------------------- -作者简介:我是Stéphane Graber。我是LXC和LXD项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical有限公司担任LXD的技术主管。 + +作者简介:我是 Stéphane Graber。我是 LXC 和 LXD 项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical 有限公司担任 LXD 的技术主管。 -------------------------------------------------------------------------------- via: https://www.stgraber.org/2016/06/06/lxd-2-0-lxd-and-juju-1012/ -作者:[ Stéphane Graber][a] +作者:[Stéphane Graber][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/) 荣誉推出 diff --git a/published/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md b/published/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md new file mode 100644 index 0000000000..95a65fa44d --- /dev/null +++ b/published/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md @@ -0,0 +1,147 @@ +LXD 2.0 系列(十一):LXD 和 OpenStack +====================================== + +这是 [LXD 2.0 系列介绍文章][1]的第十一篇。 + +![LXD logo](https://linuxcontainers.org/static/img/containers.png) + +### 介绍 + +首先对这次的延期抱歉。为了让一切正常我花了很长时间。我第一次尝试是使用 devstack 时遇到了一些必须解决问题。 然而即使这样,我还是不能够使网络正常。 + +我终于放弃了 devstack,并使用用户友好的 Juju 尝试使用 “conjure-up” 部署完整的 Ubuntu OpenStack。它终于工作了! + +下面是如何运行一个完整的 OpenStack,使用 LXD 容器而不是 VM,并在 LXD 容器中运行所有这些(嵌套的!)。 + +### 要求 + +这篇文章假设你有一个可以工作的 LXD 设置,提供容器网络访问,并且你有一个非常强大的 CPU,大约 50GB 给容器空间和至少 16G B的内存。 + +记住,我们在这里运行一个完整的 OpenStack,这东西不是很轻量! + +### 设置容器 + +OpenStack 由大量不同做不同事情的组件组成。 一些需要一些额外的特权,为了可以使设置更简单,我们将使用特权容器。 + +我们将配置支持嵌套的容器,预加载所有需要的内核模块,并允许它访问 `/dev/mem`(显然是需要的)。 + +请注意,这意味着 LXD 容器的大部分安全特性对该容器被禁用。 然而由 OpenStack 自身产生的容器将是无特权的,并且可以正常使用 LXD 的安全特性。 + +``` +lxc launch ubuntu:16.04 openstack -c security.privileged=true -c security.nesting=true -c "linux.kernel_modules=iptable_nat, ip6table_nat, ebtables, openvswitch" +lxc config device add openstack mem unix-char path=/dev/mem +``` + +LXD 中有一个小 bug,它会尝试加载已经加载到主机上的内核模块。这已在LXD 2.5中得到修复,并将在LXD 2.0.6 中修复,但在此之前,可以使用以下方法: + +``` +lxc exec openstack -- ln -s /bin/true /usr/local/bin/modprobe +``` + +我们需要加几条 PPA 并安装 conjure-up,它是我们用来安装 OpenStack 的部署工具。 + +``` +lxc exec openstack -- apt-add-repository ppa:conjure-up/next -y +lxc exec openstack -- apt-add-repository ppa:juju/stable -y +lxc exec openstack -- apt update +lxc exec openstack -- apt dist-upgrade -y +lxc exec openstack -- apt install conjure-up -y +``` + +最后一步是在容器内部配置 LXD 网络。 + +所有问题都选择默认,除了: + +* 使用 `dir` 存储后端( `zfs` 不在嵌套容器中用) +* 不要配置 IPv6 网络(conjure-up/juju 不太兼容它) + +``` +lxc exec openstack -- lxd init +``` + +现在配置完容器了,现在我们部署 OpenStack! + +### 用 conjure-up 部署 OpenStack + +如先前提到的,我们用 conjure-up 部署 OpenStack。 + +这是一个很棒的用户友好的可以与 Juju 交互来部署复杂服务的工具。 + +首先: + +``` +lxc exec openstack -- sudo -u ubuntu -i conjure-up +``` + +* 选择 “OpenStack with NovaLXD” +* 选择 “localhost” 作为部署目标(使用 LXD) +* 点击 “Deploy all remaining applications” + +接下来会部署 OpenStack。整个过程会花费一个多小时,这取决于你运行的机器。你将看到所有服务会被分配一个容器,然后部署并最终互连。 + +![Conjure-Up deploying OpenStack](https://www.stgraber.org/wp-content/uploads/2016/10/conjure-up.png) + +部署完成后会显示一个安装完成的界面。它会导入一些初始镜像、设置 SSH 权限、配置网络最后会显示面板的 IP 地址。 + +### 访问面板并生成一个容器 + +面板运行在一个容器中,因此你不能直接从浏览器中访问。 + +最简单的方法是设置一条 NAT 规则: + +``` +lxc exec openstack -- iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to +``` + +其中 `` 是 conjure-up 在安装结束时给你的面板 IP 地址。 + +你现在可以获取 “openstack” 容器的 IP 地址(来自 `lxc info openstack`),并将浏览器指向:http://\/horizon 。 + +第一次加载可能需要几分钟。 一旦显示了登录界面,输入默认登录名和密码(admin/openstack),你就会看到OpenStack的欢迎面板! + +![oslxd-dashboard](https://www.stgraber.org/wp-content/uploads/2016/10/oslxd-dashboard.png) + +现在可以选择左边的 “Project” 选项卡,进入 “Instances” 页面。 要启动一个使用 nova-lxd 的新实例,点击 “Launch instance”,选择你想要的镜像,网络等,接着你的实例就产生了。 + +一旦它运行后,你可以为它分配一个浮动 IP,它将允许你从你的 “openstack” 容器中访问你的实例。 + +### 总结 + +OpenStack 是一个非常复杂的软件,你也不会想在家里或在单个服务器上运行它。 但是,不管怎样在你的机器上包含这些服务在一个容器中都是非常有趣的。 + +conjure-up 是部署这种复杂软件的一个很好的工具,背后使用 Juju 驱动部署,为每个单独的服务使用 LXD 容器,最后是实例本身。 + +它也是少数几个容器嵌套多层并实际上有意义的情况之一! + +### 额外信息 + +conjure-up 网站: http://conjure-up.io + +Juju 网站: http://www.ubuntu.com/cloud/juju + +LXD 的主站在: https://linuxcontainers.org/lxd + +LXD 的 GitHub 仓库: https://github.com/lxc/lxd + +LXD 的邮件列表: https://lists.linuxcontainers.org + +LXD 的 IRC 频道: #lxcontainers on irc.freenode.net + +如果你不想或者不能在你的机器上安装 LXD ,你可以在 web 上试试在线版的 LXD。 + +-------------------------------------------------------------------------- + +作者简介:我是Stéphane Graber。我是LXC和LXD项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical有限公司担任LXD的技术主管。 + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/10/26/lxd-2-0-lxd-and-openstack-1112/ + +作者:[Stéphane Graber][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.stgraber.org/author/stgraber/ +[1]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ diff --git a/translated/tech/LXD/Part 7 - LXD 2.0--Docker in LXD.md b/published/LXD/Part 7 - LXD 2.0--Docker in LXD.md similarity index 54% rename from translated/tech/LXD/Part 7 - LXD 2.0--Docker in LXD.md rename to published/LXD/Part 7 - LXD 2.0--Docker in LXD.md index 831332b836..ffce0fb762 100644 --- a/translated/tech/LXD/Part 7 - LXD 2.0--Docker in LXD.md +++ b/published/LXD/Part 7 - LXD 2.0--Docker in LXD.md @@ -1,42 +1,42 @@ -LXD 2.0 系列(七):LXD中的Docker +LXD 2.0 系列(七):LXD 中的 Docker ====================================== 这是 [LXD 2.0 系列介绍文章][0]的第七篇。 ![](https://linuxcontainers.org/static/img/containers.png) -### 为什么在LXD中运行Docker +### 为什么在 LXD 中运行 Docker -正如我在[系列的第一篇][1]中简要介绍的,LXD的重点是系统容器。也就是我们在容器中运行一个完全未经修改的Linux发行版。LXD的所有意图和目的不在乎容器中的负载。它只是设置容器命名空间和安全策略,然后生成/sbin/init,接着等待容器停止。 +正如我在[系列的第一篇][1]中简要介绍的,LXD 的重点是系统容器,也就是我们在容器中运行一个完全未经修改的 Linux 发行版。LXD 的所有意图和目的并不在乎容器中的负载是什么。它只是设置容器命名空间和安全策略,然后运行 `/sbin/init` 来生成容器,接着等待容器停止。 -应用程序容器,例如由Docker或Rkt实现的应用程序容器是非常不同的,因为它们用于分发应用程序,通常在它们内部运行单个主进程,并且比LXD容器生命期更短暂。 +应用程序容器,例如由 Docker 或 Rkt 所实现的应用程序容器是非常不同的,因为它们用于分发应用程序,通常在它们内部运行单个主进程,并且比 LXD 容器生命期更短暂。 -这两种容器类型不是相互排斥的,我们的确看到使用Docker容器来分发应用程序的价值。这就是为什么我们在过去一年努力工作以便让LXD中运行Docker成为可能。 +这两种容器类型不是相互排斥的,我们的确看到使用 Docker 容器来分发应用程序的价值。这就是为什么我们在过去一年中努力工作以便让 LXD 中运行 Docker 成为可能。 -这意味着,使用Ubuntu 16.04和LXD 2.0,您可以为用户创建容器,然后可以像正常的Ubuntu系统一样连接到这些容器,然后运行Docker来安装他们想要的服务和应用程序。 +这意味着,使用 Ubuntu 16.04 和 LXD 2.0,您可以为用户创建容器,然后可以像正常的 Ubuntu 系统一样连接到这些容器,然后运行 Docker 来安装他们想要的服务和应用程序。 ### 要求 -要让它正常工作要做很多事情,Ubuntu 16.04上已经包含了这些: +要让它正常工作要做很多事情,Ubuntu 16.04 上已经包含了这些: -- 支持CGroup命名空间的内核(4.4 Ubuntu或4.6 mainline) -- 使用LXC 2.0和LXCFS 2.0的LXD 2.0 -- 一个自定义版本的Docker(或一个用我们提交的所有补丁构建的) -- Docker镜像,当用户命名空间限制时,或者使父LXD容器成为特权容器(security.privileged = true) +- 支持 CGroup 命名空间的内核(4.4 Ubuntu 或 4.6 主线内核) +- 使用 LXC 2.0 和 LXCFS 2.0 的 LXD 2.0 +- 一个自定义版本的 Docker(或一个用我们提交的所有补丁构建的) +- Docker 镜像,其受限于用户命名空间限制,或者使父 LXD 容器成为特权容器(`security.privileged = true`) -### 运行一个基础的Docker负载 +### 运行一个基础的 Docker 载荷 -说完这些,让我们开始运行Docker容器! +说完这些,让我们开始运行 Docker 容器! -首先你可以用下面的命令得到一个Ubuntu 16.04的容器: +首先你可以用下面的命令得到一个 Ubuntu 16.04 的容器: ``` lxc launch ubuntu-daily:16.04 docker -p default -p docker ``` -“-p default -p docker”表示LXD将“default”和“docker”配置文件应用于容器。默认配置文件包含基本网络配置,而docker配置文件告诉LXD加载几个必需的内核模块并为容器设置一些挂载。 docker配置文件还允许容器嵌套。 +`-p default -p docker` 表示 LXD 将 `default` 和 `docker` 配置文件应用于容器。`default` 配置文件包含基本网络配置,而 `docker` 配置文件告诉 LXD 加载几个必需的内核模块并为容器设置一些挂载。 `docker` 配置文件还支持容器嵌套。 -现在让我们确保容器是最新的并安装docker: +现在让我们确保容器是最新的并安装 docker: ``` lxc exec docker -- apt update @@ -44,8 +44,9 @@ lxc exec docker -- apt dist-upgrade -y lxc exec docker -- apt install docker.io -y ``` -就是这样!你已经安装并运行了一个Docker容器。 -现在让我们用两个Docker容器开启一个基础的web服务: +就是这样!你已经安装并运行了一个 Docker 容器。 + +现在让我们用两个 Docker 容器开启一个基础的 web 服务: ``` stgraber@dakara:~$ lxc exec docker -- docker run --detach --name app carinamarina/hello-world-app @@ -87,7 +88,7 @@ Status: Downloaded newer image for carinamarina/hello-world-web:latest d7b8963401482337329faf487d5274465536eebe76f5b33c89622b92477a670f ``` -现在这两个Docker容器已经运行了,我们可以得到LXD容器的IP地址,并且访问它的服务了! +现在这两个 Docker 容器已经运行了,我们可以得到 LXD 容器的 IP 地址,并且访问它的服务了! ``` stgraber@dakara:~$ lxc list @@ -104,13 +105,13 @@ The linked container said... "Hello World!" ### 总结 -就是这样了!在LXD容器中运行Docker容器真的很简单。 +就是这样了!在 LXD 容器中运行 Docker 容器真的很简单。 -现在正如我前面提到的,并不是所有的Docker镜像都会像我的示例一样,这通常是因为LXD提供了额外的限制,特别是用户命名空间。 +现在正如我前面提到的,并不是所有的 Docker 镜像都会像我的示例一样,这通常是因为 LXD 带来了额外的限制,特别是用户命名空间。 -只有Docker的overlayfs存储驱动在这种模式下工作。该存储驱动有一组自己的限制,这可以进一步限制在该环境中可以有多少镜像工作。 +在这种模式下只有 Docker 的 overlayfs 存储驱动可以工作。该存储驱动有一组自己的限制,这进一步限制了在该环境中可以有多少镜像工作。 -如果您的负载无法正常工作,并且您信任LXD容器中的用户,你可以试下: +如果您的负载无法正常工作,并且您信任该 LXD 容器中的用户,你可以试下: ``` lxc config set docker security.privileged true @@ -119,7 +120,7 @@ lxc restart docker 这将取消激活用户命名空间,并以特权模式运行容器。 -但是请注意,在这种模式下,容器内的root与主机上的root是相同的uid。现在有许多已知的方法让用户脱离容器,并获得主机上的root权限,所以你应该只有在信任你的LXD容器中的用户可以具有主机上的root权限才这样做。 +但是请注意,在这种模式下,容器内的 root 与主机上的 root 是相同的 uid。现在有许多已知的方法让用户脱离容器,并获得主机上的 root 权限,所以你应该只有在信任你的 LXD 容器中的用户可以具有主机上的 root 权限才这样做。 ### 额外信息 @@ -138,11 +139,11 @@ via: https://www.stgraber.org/2016/04/13/lxd-2-0-docker-in-lxd-712/ 作者:[Stéphane Graber][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/) 荣誉推出 [a]: https://www.stgraber.org/author/stgraber/ [0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ -[1]: https://www.stgraber.org/2016/03/11/lxd-2-0-introduction-to-lxd-112/ +[1]: https://linux.cn/article-7618-1.html [2]: https://linuxcontainers.org/lxd/try-it/ diff --git a/translated/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md b/published/LXD/Part 8 - LXD 2.0--LXD in LXD.md similarity index 64% rename from translated/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md rename to published/LXD/Part 8 - LXD 2.0--LXD in LXD.md index 82a25368a8..9c3c7a44f1 100644 --- a/translated/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md +++ b/published/LXD/Part 8 - LXD 2.0--LXD in LXD.md @@ -1,4 +1,4 @@ -LXD 2.0 系列(八):LXD中的LXD +LXD 2.0 系列(八):LXD 中的 LXD ====================================== 这是 [LXD 2.0 系列介绍文章][0]的第八篇。 @@ -7,35 +7,35 @@ LXD 2.0 系列(八):LXD中的LXD ### 介绍 -在上一篇文章中,我介绍了如何运行[LXD中的Docker][1],这是一个很好的方式来访问由Docker提供的应用程序组合,同时Docker还运行在LXD提供的安全环境中。 +在上一篇文章中,我介绍了如何[在 LXD 中运行 Docker][1],这是一个访问由 Docker 提供的应用程序组合的很好方式,同时 Docker 还运行在 LXD 提供的安全环境中。 -我提到的一个情况是为你的用户提供一个LXD容器,然后让他们使用他们的容器来运行Docker。那么,如果他们自己想使用LXD在其容器中运行其他Linux发行版,或者甚至运行容器允许另一组人来访问Linux系统? +我提到的一个情况是为你的用户提供一个 LXD 容器,然后让他们使用他们的容器来运行 Docker。那么,如果他们自己想要在其容器中使用 LXD 运行其他 Linux 发行版,或者甚至允许另一组人来访问运行在他们的容器中的 Linux 系统呢? -原来LXD使得用户运行嵌套容器变得非常简单。 +原来 LXD 使得用户运行嵌套容器变得非常简单。 -### 嵌套LXD +### 嵌套 LXD -最简单的情况可以使用Ubuntu 16.04镜像来展示。 Ubuntu 16.04云镜像预装了LXD。守护进程本身没有运行,因为它是套接字激活的,所以它不使用任何资源,直到你真正使用它。 +最简单的情况可以使用 Ubuntu 16.04 镜像来展示。 Ubuntu 16.04 云镜像预装了 LXD。守护进程本身没有运行,因为它是由套接字激活的,所以它不使用任何资源,直到你真正使用它。 -让我们启动一个启用了嵌套的Ubuntu 16.04容器: +让我们启动一个启用了嵌套的 Ubuntu 16.04 容器: ``` lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true ``` -你也可以在一个存在的容器上设置security.nesting: +你也可以在一个已有的容器上设置 `security.nesting`: ``` lxc config set security.nesting true ``` -或者对所有的容器使用一个配置文件: +或者对所有的容器使用一个指定的配置文件: ``` lxc profile set security.nesting true ``` -容器启动后,你可以从容器内部得到一个shell,配置LXD并生成一个容器: +容器启动后,你可以从容器内部得到一个 shell,配置 LXD 并生成一个容器: ``` stgraber@dakara:~$ lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true @@ -79,20 +79,19 @@ root@c1:~# lxc list root@c1:~# ``` -就是这样简单 +就是这样简单。 ### 在线演示服务器 -因为这篇文章很短,我想我会花一点时间谈论我们运行中的[演示服务器][2]。我们今天早些时候刚刚达到了10000个会话! +因为这篇文章很短,我想我会花一点时间谈论我们运行中的[演示服务器][2]。我们今天早些时候刚刚达到了 10000 个会话! -这个服务器基本上只是一个运行在一个相当强大的虚拟机上的正常的LXD,一个小型的守护进程实现我们的网站使用的REST API。 +这个服务器基本上只是一个运行在一个相当强大的虚拟机上的正常的 LXD,一个小型的守护进程实现了我们的网站所使用的 REST API。 -当你接受服务条款时,将为你创建一个新的LXD容器,并启用security.nesting,如上所述,接着你就像使用“lxc exec”时一样连接到了那个容器,除了我们使用websockets和javascript来做这些。 +当你接受服务条款时,将为你创建一个新的 LXD 容器,并启用 `security.nesting`,如上所述。接着你就像使用 `lxc exec` 时一样连接到了那个容器,除了我们使用 websockets 和 javascript 来做这些。 -你在此环境中创建的容器都是嵌套的LXD容器。 -如果你想,你可以进一步地嵌套。 +你在此环境中创建的容器都是嵌套的 LXD 容器。如果你想,你可以进一步地嵌套。 -我们全范围地使用了[LXD资源限制][3],以防止一个用户的行为影响其他用户,并仔细监控服务器的任何滥用迹象。 +我们全范围地使用了 [LXD 资源限制][3],以防止一个用户的行为影响其他用户,并仔细监控服务器的任何滥用迹象。 如果你想运行自己的类似的服务器,你可以获取我们的网站和守护进程的代码: @@ -118,12 +117,12 @@ via: https://www.stgraber.org/2016/04/14/lxd-2-0-lxd-in-lxd-812/ 作者:[Stéphane Graber][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/) 荣誉推出 [a]: https://www.stgraber.org/author/stgraber/ [0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ -[1]: https://www.stgraber.org/2016/04/13/lxd-2-0-docker-in-lxd-712/ +[1]: https://linux.cn/article-8235-1.html [2]: https://linuxcontainers.org/lxd/try-it/ [3]: https://www.stgraber.org/2016/03/26/lxd-2-0-resource-control-412/ diff --git a/translated/tech/LXD/Part 9 - LXD 2.0--Live migration.md b/published/LXD/Part 9 - LXD 2.0--Live migration.md similarity index 72% rename from translated/tech/LXD/Part 9 - LXD 2.0--Live migration.md rename to published/LXD/Part 9 - LXD 2.0--Live migration.md index afbbd8bd24..df0fae0d05 100644 --- a/translated/tech/LXD/Part 9 - LXD 2.0--Live migration.md +++ b/published/LXD/Part 9 - LXD 2.0--Live migration.md @@ -7,26 +7,26 @@ LXD 2.0 系列(九):实时迁移 ### 介绍 -LXD 2.0中的有一个尽管是实验性质的但非常令人兴奋的功能,那就是支持容器检查点和恢复。 +LXD 2.0 中的有一个尽管是实验性质的但非常令人兴奋的功能,那就是支持容器检查点和恢复。 -简单地说,检查点/恢复意味着正在运行的容器状态可以被序列化到磁盘,然后在与容器状态快照相同的主机上或者在等同于实时迁移的另一主机上恢复。 +简单地说,检查点/恢复意味着正在运行的容器状态可以被序列化到磁盘,要么可以作为同一主机上的有状态快照,要么放到另一主机上相当于实时迁移。 ### 要求 -要访问容器实时迁移和有状态快照,你需要以下条件: +要使用容器实时迁移和有状态快照,你需要以下条件: -- 一个最近的Linux内核,4.4或更高版本。 -- CRIU 2.0,可能有一些cherry-pick的提交,具体取决于你确切的内核配置。 -- 直接在主机上运行LXD。 不能在容器嵌套下使用这些功能。 -- 对于迁移,目标机器必须至少实现源的指令集,目标内核必须至少提供与源相同的系统调用,并且在源上挂载的任何内核文件系统也必须可挂载到目标主机上。 +- 一个非常新的 Linux 内核,4.4 或更高版本。 +- CRIU 2.0,可能需要一些 cherry-pick 的提交,具体取决于你确切的内核配置。 +- 直接在主机上运行 LXD。 不能在容器嵌套下使用这些功能。 +- 对于迁移,目标主机必须至少实现源主机的指令集,目标主机内核必须至少提供与源主机相同的系统调用,并且在源主机上挂载的任何内核文件系统也必须可挂载到目标主机上。 -Ubuntu 16.04 LTS已经提供了所有需要的依赖,在这种情况下,您只需要安装CRIU本身: +Ubuntu 16.04 LTS 已经提供了所有需要的依赖,在这种情况下,您只需要安装 CRIU 本身: ``` apt install criu ``` -### 使用CRIU +### 使用 CRIU #### 有状态快照 @@ -46,7 +46,7 @@ stgraber@dakara:~$ lxc info c1 | grep second second (taken at 2016/04/25 19:36 UTC) (stateful) ``` -这意味着所有容器运行时状态都被序列化到磁盘并且作为了快照的一部分。就像你还原无状态快照那样还原一个有状态快照: +这意味着所有容器运行时状态都被序列化到磁盘并且作为了快照的一部分。可以像你还原无状态快照那样还原一个有状态快照: ``` stgraber@dakara:~$ lxc restore c1 second @@ -55,7 +55,7 @@ stgraber@dakara:~$ #### 有状态快照的停止/启动 -比方说你想要升级内核或者其他类似的维护。与其等待所有的容器启动,你可以: +比方说你由于升级内核或者其他类似的维护而需要重启机器。与其等待重启后启动所有的容器,你可以: ``` stgraber@dakara:~$ lxc stop c1 --stateful @@ -266,38 +266,37 @@ stgraber@dakara:~$ lxc list s-tollana: ### 限制 -正如我之前说的,容器的检查点/恢复还是非常新的功能,我们还在努力地开发这个功能、修复问题已知问题。我们确实需要更多的人来尝试这个功能,并给我们反馈,但我不建议在生产中使用这个功能。 +正如我之前说的,容器的检查点/恢复还是非常新的功能,我们还在努力地开发这个功能、修复已知的问题。我们确实需要更多的人来尝试这个功能,并给我们反馈,但我不建议在生产中使用这个功能。 -我们跟踪的问题列表在[Launchpad上][1]。 +我们跟踪的问题列表在 [Launchpad上][1]。 -我们期望在Ubuntu 16.04上有一个基本的带有几个服务的Ubuntu容器能够与CRIU一起工作。然而在更复杂的容器、使用设备传递、复杂的网络服务或特殊的存储配置可能会失败。 +我们估计在带有 CRIU 的 Ubuntu 16.04 上带有几个服务的基本的 Ubuntu 容器能够正常工作。然而在更复杂的容器、使用了设备直通、复杂的网络服务或特殊的存储配置下可能会失败。 -只要有可能,CRIU会在转储时失败,而不是在恢复时。在这种情况下,源容器将继续运行,快照或迁移将会失败,并生成一个日志文件用于调试。 +要是有问题,CRIU 会尽可能地在转储时失败,而不是在恢复时。在这种情况下,源容器将继续运行,快照或迁移将会失败,并生成一个日志文件用于调试。 -在极少数情况下,CRIU无法恢复容器,在这种情况下,源容器仍然存在但将被停止,并且必须手动重新启动。 +在极少数情况下,CRIU 无法恢复容器,在这种情况下,源容器仍然存在但将被停止,并且必须手动重新启动。 -### 发送bug报告 +### 发送 bug 报告 -我们正在跟踪Launchpad上关于CRIU Ubuntu软件包的检查点/恢复相关的错误。大多数修复bug工作是在上游的CRIU或Linux内核上,但是这种方式我们更容易跟踪。 +我们正在跟踪 Launchpad 上关于 CRIU Ubuntu 软件包的检查点/恢复相关的错误。大多数修复 bug 工作是在上游的 CRIU 或 Linux 内核上进行,但是这种方式我们更容易跟踪。 -要提交新的bug报告,请看这里。 +要提交新的 bug 报告,请看这里。 请务必包括: -你运行的命令和显示给你的错误消息 +- 你运行的命令和显示给你的错误消息 +- `lxc info` 的输出(*) +- `lxc info `的输出 +- `lxc config show -expanded ` 的输出 +- `dmesg`(*)的输出 +- `/proc/self/mountinfo` 的输出(*) +- `lxc exec - cat /proc/self/mountinfo` 的输出 +- `uname -a`(*)的输出 +- `/var/log/lxd.log`(*)的内容 +- `/etc/default/lxd-bridge`(*)的内容 +- `/var/log/lxd//` 的 tarball(*) -- “lxc info”的输出(*) -- “lxc info ”的输出 -- “lxc config show -expanded ”的输出 -- “dmesg”(*)的输出 -- “/proc/self/mountinfo”的输出(*) -- “lxc exec - cat /proc/self/mountinfo”的输出 -- “uname -a”(*)的输出 -- /var/log/lxd.log(*)的内容 -- /etc/default/lxd-bridge(*)的内容 -- /var/log/lxd// 的tarball(*) - -如果报告迁移错误,而不是状态快照或有状态停止错误,请将上面所有含有(*)标记的源与目标主机的信息发来。 +如果报告迁移错误,而不是状态快照或有状态停止的错误,请将上面所有含有(*)标记的源与目标主机的信息发来。 ### 额外信息 @@ -314,11 +313,11 @@ LXD 的 IRC 频道: #lxcontainers on irc.freenode.net -------------------------------------------------------------------------------- -via: https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/ +via: https://stgraber.org/2016/04/25/lxd-2-0-live-migration-912/ 作者:[Stéphane Graber][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/) 荣誉推出 diff --git a/published/The history of Android/16 - The history of Android.md b/published/The history of Android/16 - The history of Android.md new file mode 100644 index 0000000000..1be1dea4cc --- /dev/null +++ b/published/The history of Android/16 - The history of Android.md @@ -0,0 +1,69 @@ +安卓编年史 +================================================================================ +### 安卓 3.0 蜂巢—平板和设计复兴 ### + +尽管姜饼中做了许多改变,安卓仍然是移动世界里的丑小鸭。相比于 iPhone,它的优雅程度和设计完全抬不起头。另一方面来说,为数不多的能与 iOS 的美学智慧相当的操作系统之一是 Palm 的 WebOS。WebOS 有着优秀的整体设计,创新的功能,而且被寄予期望能够从和 iPhone 的长期竞争中拯救公司。 + +尽管如此,一年之后,Palm 资金链断裂。Palm 公司未曾看到 iPhone 的到来,到 WebOS 就绪的时候已经太晚了。2010 年 4 月,惠普花费 10 亿美元收购了 Palm。尽管惠普收购了一个拥有优秀用户界面的产品,但界面的首席设计师,Matias Duarte,并没有加入惠普公司。2010 年 5 月,就在惠普接手 Palm 之前,Duarte 加入了谷歌。惠普买下了面包,但谷歌雇佣了它的烘培师。 + +![第一部蜂巢设备,摩托罗拉 Xoom 10英寸平板。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/Motorola-XOOM-MZ604.jpg) + +*第一部蜂巢设备,摩托罗拉 Xoom 10英寸平板。* + +在谷歌,Duarte 被任命为安卓用户体验主管。这是第一次有人公开掌管安卓的外观。尽管 Matias 在安卓 2.2 发布时就来到了谷歌,第一个真正受他影响的安卓版本是 3.0 蜂巢(Honeycomb),它在 2011 年 2 月发布。 + +按谷歌自己的说法,蜂巢是匆忙问世的。10 个月前,苹果发布了 iPad,让平板变得更加现代,谷歌希望能够尽快做出回应。蜂巢就是那个回应,一个运行在 10 英寸触摸屏上的安卓版本。悲伤的是,将这个系统推向市场是如此优先的事项,以至于边边角角都被砍去了以节省时间。 + +新系统只用于平板——手机不能升级到蜂巢,这加大了谷歌让系统运行在差异巨大的不同尺寸屏幕上的难度。但是,仅支持平板而不支持手机也使得蜂巢源码没有泄露。之前的安卓版本是开源的,这使得黑客社区能够将其最新版本移植到所有的不同设备之上。谷歌不希望应用开发者在支持不完美的蜂巢手机移植版本时感到压力,所以谷歌将源码留在自己手中,并且严格控制能够拥有蜂巢的设备。匆忙的开发还导致了软件问题。在发布时,蜂巢不是特别稳定,SD 卡不能工作,Adobe Flash——安卓最大的特色之一——还不被支持。 + +[摩托罗拉 Xoom][1] 是为数不多的拥有蜂巢的设备之一,它是这个新系统的旗舰产品。Xoom 是一个 10 英寸,16:9 的平板,拥有 1GB 内存和 1GHz Tegra 2 双核处理器。尽管是由谷歌直接控制更新的新版安卓发布设备,它并没有被叫做“Nexus”。对此最可能的原因是谷歌对它没有足够的信心称其为旗舰。 + +尽管如此,蜂巢是安卓的一个里程碑。在一个体验设计师的主管之下,整个安卓用户界面被重构,绝大多数奇怪的应用设计都得到改进。安卓的默认应用终于看起来像整体的一部分,不同的界面有着相似的布局和主题。然而重新设计安卓会是一个跨越了多个版本的项目——蜂巢只是将安卓塑造成型的开始。这第一稿为未来版本的安卓将如何运作奠定了基础,但它也用了过多的科幻主题,谷歌将花费接下来的数个版本来淡化它。 + +![蜂巢和姜饼的主屏幕。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/homeskreen.png) + +*蜂巢和姜饼的主屏幕。 +[Ron Amadeo供图]* + +姜饼只是在它的光子壁纸上试验了科幻外观,蜂巢整个系统的以电子为灵感的主题让它充满科幻意味。所有东西都是黑色的,如果你需要对比色,你可以从一些不同色调的蓝色中挑选。所有蓝色的东西还有“光晕”效果,让整个系统看起来像是外星科技创造的。默认背景是个六边形的全息方阵(一个蜂巢!明白了吗?),看起来像是一艘飞船上的传送阵的地板。 + +蜂巢最重要的变化是增加了系统栏。摩托罗拉 Xoom 除了电源和音量键之外没有配备实体按键,所以蜂巢添加了一个大黑色底栏到屏幕底部,用于放置导航按键。这意味着默认安卓界面不再需要特别的实体按键。在这之前,安卓没有实体的返回、菜单和 Home 键就不能正常工作。现在,软件提供了所有必需的按钮,任何带有触摸屏的设备都能够运行安卓。 + +新软件按键带来的最大的好处是灵活性。新的应用指南表明应用不再必需实体菜单按键,需要用到的时候,蜂巢会自动检测并添加四个按钮到系统栏让应用正常工作。另一个软件按键的灵活属性是它们可以改变设备的屏幕方向。除了电源和音量键之外,Xoom 的方向实际上不是那么重要。从用户的角度来看,系统栏始终处于设备的“底部”。代价是系统栏明显占据了一些屏幕空间。为了在10英寸平板上节省空间,状态栏被合并到了系统栏中。所有的常用状态指示放在了右侧——有电源、连接状态、时间还有通知图标。 + +主屏幕的整个布局都改变了,用户界面部件放在了设备的四个角落。屏幕底部左侧放置着之前讨论过的导航按键,右侧用于状态指示和通知,顶部左侧显示的是文本搜索和语音搜索,右侧有应用抽屉和添加小部件的按钮。 + +![新锁屏界面和最近应用界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/lockscreen-and-recent.png) + +*新锁屏界面和最近应用界面。 +[Ron Amadeo供图]* + +(因为 Xoom 是一部 [较重] 的 10 英寸,16:9 平板设备,这意味着它主要是横屏使用。虽然大部分应用还支持竖屏模式,但是到目前为止,由于我们的版式限制,我们大部分使用的是竖屏模式的截图。请记住蜂巢的截图来自于 10 英寸的平板,而姜饼的截图来自 3.7 英寸的手机。二者所展现的信息密度是不能直接比较的。) + +解锁界面——从菜单按钮到旋转式拨号盘再到滑动解锁——移除了解锁步骤的任何精度要求,它采用了一个环状解锁盘。从中间向任意方向向外滑动就能解锁设备。就像旋转式解锁,这种解锁方式更加符合人体工程学,而不用强迫你的手指完美地遵循一条笔直的解锁路径。 + +第二张图中略缩图条带是由新增的“最近应用”按钮打开的界面,现在处在返回键和 Home 键旁边。不像姜饼中长按 Home 键显示一组最近应用的图标,蜂巢在屏幕上显示应用图标和略缩图,使得在任务间切换变得更加方便。“最近应用”的灵感明显来自于 Duarte 在 WebOS 中的“卡片式”多任务管理,其使用全屏略缩图来切换任务。这个设计提供和 WebOS 的任务切换一样的易识别体验,但更小的略缩图允许更多的应用一次性显示在屏幕上。 + +尽管最近应用的实现看起来和你现在的设备很像,这个版本实际上是非常早期的。这个列表不能滚动,这意味着竖屏下只能显示七个应用,横屏下只能显示五个。任何超出范围的应用会从列表中去除。而且你也不能通过滑动略缩图来关闭应用——这只是个静态的列表。 + +从这里我们可以看到电子灵感影响的完整主题效果:略缩图的周围有蓝色的轮廓以及神秘的光晕。这张截图还展示软件按键的好处——上下文。返回按钮可以关闭略缩图列表,所以这里的箭头指向下方,而不是通常的样子。 + +---------- + +![Ron Amadeo](https://cdn.arstechnica.net/wp-content/uploads/2016/05/r.amadeo-45843.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2016/10/building-android-a-40000-word-history-of-googles-mobile-os/16/ + +译者:[alim0x](https://github.com/alim0x) 校对:[Bestony](https://github.com/Bestony) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2011/03/ars-reviews-the-motorola-xoom/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/sources/talk/20161202 Reactive programming vs. Reactive systems.md b/sources/talk/20161202 Reactive programming vs. Reactive systems.md index 58b3387349..19bf7ccb1e 100644 --- a/sources/talk/20161202 Reactive programming vs. Reactive systems.md +++ b/sources/talk/20161202 Reactive programming vs. Reactive systems.md @@ -1,3 +1,5 @@ +translating by XLCYun + Reactive programming vs. Reactive systems ============================================================ diff --git a/sources/talk/20170117 Arch Linux on a Lenovo Yoga 900.md b/sources/talk/20170117 Arch Linux on a Lenovo Yoga 900.md deleted file mode 100644 index 3cb48897dc..0000000000 --- a/sources/talk/20170117 Arch Linux on a Lenovo Yoga 900.md +++ /dev/null @@ -1,311 +0,0 @@ -#rusking translating -# Arch Linux on a Lenovo Yoga 900 - -_Warning: this is about 5,500 words with plenty of interesting links, so wait till you’ve got something to drink and some time._ - -After 3 years running Arch Linux on a [Lenovo Yoga 2][2], I decided to upgrade to a Yoga 900: - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-1.jpg) - -_Lenovo Yoga 900 [Amazon special][1] for $925 – 8GB RAM, 256GB SSD, 3200×1800, Intel Skylake 3.2GHz + Iris Graphics_ - -Dell charges $1650 for a [similar XPS 13][3] albeit with the next generation of Intel chip. The current model of Yoga is the 910, and that laptop costs $1300\. However, I didn’t even consider it because they screwed the pooch on the keyboard. Lots of reviews start with the color and feel of the materials on the outside, but I’m going to start on the keyboard layout. - -### Keyboard - - -The Yoga 2 Pro and the Yoga 900 have the same design. It is inferior in several ways compared to the traditional and well-regarded IBM Thinkpad keyboards, but not the worst keyboard out there and I got used to it over the 3 years. Unfortunately, Lenovo made things worse in the 910. - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-2.png) -_Yoga 2 and Yoga 900 keyboard layout _ - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-3.png) -_Yoga 910 keyboard_ - -The problem with the 910 keyboard is that the right-shift key is in the wrong place, and impossible to reach without moving your hand. It is in a different position than every keyboard I’ve ever used going back to 9th grade typing class on the IBM Selectric. I’d expect such a mistake from a company like Asus or Dell, not a company with the legacy of building typewriters that generations of Americans learned and worked on. - -Every year the Yoga team has made changes to the layout. Imagine if every year in the 20th century, IBM had changed the layout of their typewriters, and then bragged about the “[efficiency][4]” gains. The company wouldn’t even be around today! - -I probably could get used to the Yoga 910 page up / page down overloaded with arrow keys, and some of the other changes, but the shift-key is a deal breaker and I’d rather not bother with the others. - -There are many ways for Lenovo to truly improve their keyboard, such as making the volume-up key not so close to application-close. And re-thinking whether they really need an easy way to (accidentally) turn off the screen given there is already a way to dim it. And figuring out how to put in an overloaded number pad. Does Lenovo think only businesses deal with numbers? - -The 910 keyboard has so many changes, they might not ever go back to their old layouts again. I’m hoping this hardware will last me years. I’d rather have a great keyboard than a computer 10 times faster. - -I see in the Yoga 910 reviews on the Lenovo website that some people are returning the computer because of the keyboard. Lenovo should have a policy: if an employee wanted to make an alteration to the keyboard, they should have to write down a **very ****good** reason, and then sacrifice one of their fingers in solidarity with the pain it will cause customers. A rule like that would decrease this needless churn. Lenovo went through a lot of work make the Yoga 910, but f*cked it up with the input mechanism. - -### Overall - -The Yoga 2 was generally fast enough for everything I needed to do. An SSD is nice for various reasons, but it is almost overkill on Arch. People who only use Windows might not realize how bloated it is: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-4.png) - -In the late 90’s, you’d get a new computer every few years because the processors were doubling in speed every 18 months, and the software was doubling in size frequently as well. Things are very different now. The new Yoga is 30% faster than my Yoga 2 running integer benchmarks. This is a 3.2 GHz machine whereas the old one maxed out at 2.6 GHz so most of the difference is the faster frequency. - -Haswell was introduced in 2013, and Skylake was introduced in 2015 so two years of advancement is the other part of the improvements. The big benefit of the new processor is that it is built in 14nm instead of 22nm which means less heat and longer battery life. My old Yoga 2 battery was still giving me about 3.5 hours of battery life with moderate brightness, but this should give me 7. - -The Yoga 2 hinge is starting to weaken and fall apart, and there is no way to tighten it, only to try to find one on the Internet or mail it to Lenovo: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-5.png) - -The hinge on Yogas is designed to let you lay the device flat, and even fold it back as a tablet, but I found it a heavy and awkward and so never bothered. I’m just happy if I’ll be able to open and close it daily for years. - -The Yoga 900 hinge is a more solid watchband design and should last longer: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-6-1.jpg) - -The only very minor downside is that if you shake it, it sounds like you’ve got broken parts rattling around inside, which usually is something to be worried about for electronics! However, it’s just a false alarm of the 800 pieces sliding. - -The Yoga 2 Pro was overall a quite well-built device, but if I hold it in one hand with the screen open, it sags a bit, and sometimes the keyboard backlight goes out. Both Yogas are thin and light, but the 900 feels more solid. - -### Clickpad - -The biggest problem with the Yoga 2 was the Synaptics Clickpad it used. It actually wasn’t the hardware, it was the driver, which is basically unmaintained, and of course had some bugs. It’s a shame because Synaptics could easily afford one engineer to help maintain a few thousand lines of code. They actually wrote another driver, they just never released it freely so it could be included with the kernel. - -However, a new library called [Libinput][5] was created, and they support Clickpads and things work well out of the box now. The best thing about Libinput is that they fixed the bug where if you have your left finger touching in the mouse-click area, it will now register pointer movements by your right finger. It’s hard to believe, but that basic functionality was broken for many years with Synaptics hardware on Linux. - -The Clickpad hardware was still working fine, but it didn’t give any audible click sound anymore. That actually isn’t a problem, but it did make me wonder if it was going to wear out at some point. The old Thinkpads had multiple left and right mouse buttons, so if one broke, you could use the other while you ordered a new part, but since there’s only one button here, there is no backup except to plug a mouse in. (Lenovo expects you to mail in the computer to get a new mouse.) - -### Kernel Support - -When I bought the Haswell laptop, the hardware design was brand new, so I ran into a lot of Linux driver problems initially that took months to resolve. In this generation, Skylake crashing bugs were still being fixed [8 months after the architecture was introduced,][6] but now it appears they’ve all been resolved. And even when those were fixed, there were still problems with [power management support,][7] but today these also appear to be improved. The laptop will settle into the lower power C6-C10 states if nothing is going on. (This is verifiable with **powertop**.) - -The power management features are important not only for battery life, but because these very small circuits eventually wear out because of something known as [electromigration][8]. Intel even warns that: “Long term reliability cannot be assured unless all the Low-Power Idle States are enabled.” By running in lower power mode, and therefore using the circuits less, they will last longer. - -Linux’s Haswell support is very reliable now, but it was definitely flakey for a long time. I wrote about some of the issues at the beginning and after the first year, but I can say finally that things are great for Haswell and Skylake. - -### Lenovo BIOS Linux Incompatibility - -Before I could install Linux on the Yoga 900, I had to flash a new BIOS in Windows. In fact, I had to install 2 BIOSes. The latest Yoga 900 BIOS didn’t [include][9] the necessary fix I needed, so after scratching my head for a while I eventually discovered and [installed][10] a separate “Linux-only” BIOS update, which also says that Windows is no longer supported by Lenovo: “Are we not [merciful][11]?” - -As people who followed the Linux news are aware, the Yoga 900 and certain other recent models of Lenovo laptops were impossible to install Linux on, because it couldn’t even [detect the hard drive][12]. Lenovo’s first reply was that the laptops didn’t work on Linux because it uses a [new RAID controller mode][13]. However, RAID is meant for multiple disks, and this laptop only has one hard drive, and there isn’t even room to install another. - -Here’s some more of Lenovo’s [official explanation][14]: - -> “To support our Yoga products and our industry-leading 360-hinge design in the best way possible we have used a storage controller mode that is unfortunately not supported by Linux and as a result, does not allow Linux to be installed.” - -I found it funny that the reason for their different storage controller is because of their hinge! It would be like a car company saying they had to change their rims because of their new radio. - -This turned into a controversy thanks to the efforts of [Baron][15][H][16][K][17] on Reddit who wrote about it, provided information to the media, and contacted his local Attorney General in Illinois. Searching for “[Lenovo Yoga ][18][L][19][inux compatibility][20]” turns up 300,000 results. Lenovo could be criminally liable for selling a “general purpose” PC that didn’t let you install your own operating system. The default OS is meaningless on a machine that is truly mine. - -Hackers got involved, and they eventually discovered via playing with the UEFI settings, that the machine still supported the AHCI controller mode, it was just disabled. In short, Lenovo took away Linux compatibility for no good purpose. Because of all the information people learned, if this case had ever gone to court, Lenovo would have gotten their ass handed to them. - -Fortunately, all the news got their attention, and they eventually updated the BIOS. I type this on a Yoga 900 running Linux, so we should celebrate this victory. Let’s hope they learn a lesson, but I’m not optimistic. They ought to offer you an option to choose the operating system for your machine. They would have found this bug long before any customers did. I’d wait an extra week to get a custom computer. They could also do a better job setting up the partitions and letting people customize lots of things, and grabbing all the latest software, rather than using a generic old image which needs lots of updates. - -Some people like Lenovo said it was Linux’s fault for not supporting this new RAID driver mode. However, AHCI is a very popular standard, and the Linux kernel team rejected Intel’s code for this hardware as “[too ugly to live][21]”! The team also asked Intel for a specification describing the device’s behavior, but wasn’t given this information. - -### Heat Dissipation - -The Yoga 2 could get hot when pushing the CPUs hard. I charred the bottom of the plastic case while compiling LibreOffice on a blanket, which was an eyesore and made me look like a homeless programmer. I tried a metal brush and some turpentine to get the worst of it off, but it didn’t really improve the situation: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2015/04/20150327_135649-2.jpg) - -This new computer has a metal case which shouldn’t get discolored, and Skylake definitely runs cooler than Haswell. It also seems to do better job of pushing heat out sideways through the hinge, instead of down which could easily be obstructed. - -One of the annoying things about the Yoga 2 over time is that the fan blades had collected dust over the years, but it sounded like sand! It was uneven and distracting and made it much louder. I did take the laptop apart and vacuum everything, but the blades are hidden. I’d have to replace the fans. They don’t run on the Yoga 2 for typical tasks of word processing and web browsing, but when they do spin up it’s annoying if I’m not wearing headphones. - -The Yoga 900 fans are higher pitch, but it is just a smooth whir and not distracting. The Yoga 900 fans seem to run all the time, but at a low speed that is quiet. The sound of my refrigerator and air filter are louder unless the fans crank up under load, and even then it is not a big deal. - -### Graphics - -The Yoga 2 had a great screen, but it also had widely reported issues because the yellow looked like orange. However, everything looked so crisp and all the other colors looked fine. The Yoga 900 screen has fixed the yellow issue. It’s not true 4K, being only 3200×1800, but the pixels are smaller than 4K on a 15.6” monitor, so that it looks very sharp. - -When I first got the Yoga 2, Haswell was still a new chipset, so I saw various Intel graphics display glitches which went away within a couple of months. However, I eventually discovered a memory leak that could crash Linux, and this bug was in there for years. - -My computer ran out of RAM a number of times skipping through video in VLC (shift + arrow). The memory didn’t show up as in use by VLC, but my computer ran out of RAM, so clearly it was kernel memory. Eventually I setup a swap file which gave more time, but even then a couple of times it filled up when I wasn’t keeping track. Eventually the bug disappeared, and Linux is very stable right now, but it was there for years. - -Everyone says Intel has the best Linux drivers, but they seem like a skunkworks project inside Microsoft. The driver developers working on Linux at Intel are good, there just aren’t enough of them. They should be perfecting the drivers before they release the hardware! Intel produced [1][22][13][23] [processors][24] as part of Skylake, with subtle feature differences. That sounds like a lot, but they released 256 chips during the [Haswell generation][25], so maybe things are getting more focused. I was told 10 years ago by an Intel employee that they invested 1% into Linux compared to Windows, and today that still seems to be true. - -The only performance issue I ran into with the Yoga 2 was that it couldn’t play 4K video reliably. It would often show screen glitches, or just do around 5 frames per second: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/VlcGlitch.jpg) - -The Yoga 2 would even sometimes struggle playing 1920×1080 video, which it was supposed to be able to handle at 60fps. Part of this is probably because I always have other applications like Firefox and LibreOffice running. - -The Skylake processor is spec’ed to do 4K video at 60 fps for H.264, VP9, and other codecs. In fact, the processor has a lot of hardware accelerated [multimedia][26][capabilities][27]. I tried out hardware encoding of H264 with **ffmpeg** and found it was 4 times faster while using just 1 CPU. It’s cool to see this feature. Unfortunately, it is a little annoying to setup because you have to use a number of additional command line parameters: - -“**-threads 1 -vaapi_device /dev/dri/renderD128 -vcodec h264_vaapi -vf format=’nv12|vaapi,hwupload’**” - -I tried to find a way to have **ffmpeg** remember these for me so I wouldn’t have to type it in every time, but couldn’t. I can’t just pass those in automatically either, as other things need to go before and after. I also discovered that it won’t resize video while using the hardware, and will just ignore the request, so only sometimes can it be used. It would be really great if **ffmpeg** could figure this out automatically. There is a lot of unused hardware because users don’t know or can’t be bothered. Unfortunately [it’s kind of a mess][28] for video encoding and decoding as there are multiple APIs for Linux and Windows. - -Skylake does a much better job playing 4K video, but it will still glitch sometimes and briefly drop down to 10 fps. I think part of it is X. I tried playing 4K videos in Wayland, and it was smoother, so I’m hopeful. It is great to see that the OpenGL support has improved. On this hardware, Intel supports version 4.5 which is the latest version from 2014. - -My Yoga 900 (-13ISK2) is actually a revised version of the original offering with an Iris 540 graphics co-processor which is supposed to be [faster][29] than the stock 520 because of 24 more shader units. However, it can only play SuperTuxKart with moderate settings running 1600×900 at 20 fps, so I wouldn’t say it’s anything to brag about yet. Speaking of which, the game has improved tremendously over the years and is beautiful now: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Screenshot-from-2017-01-10-17-03-57.png) - -There is an Intel team in China working on [enabling][30] support OpenCL using the graphics card. However, I don’t see any mention of people using it in Blender yet, so I wonder the status and whether it is just demoware. Intel’s OpenCL support has been missing for so long, people doing serious work with Blender already use NVidia or AMD cards, and even when Intel finally writes the code, there’s not much testing or interest. - -One thing that was surprising to me is that I did some experiments on another machine, and found that a quad-core processor is faster than the NVidia 960M for ray-tracing with the Cycles engine. Apparently the 640 CUDA cores aren’t enough to beat 4 Intel CPUs on that task. Newer processors have 2000+ cores and those provide faster performance. - -### HiDPI - -The situation has gotten better for Linux on these high-res screens over the last 3 years, but it still has a ways to go. The good news is that Gnome is almost perfect with HiDPI in current versions. Firefox generally looks great if you set the **layout.css.devPixelsPerPx** to 2\. However because this 13.3” screen’s pixels are so small, I also install a No-Squint Plus plugin and have it render everything at 120% to make it a bit easier to read. - -I was happy to help LibreOffice look better on these screens with [some patches][31] that were shipped in April, 2014, and the work has continued since. The biggest issue remaining is that LibreOffice is still doubling toolbar icons. A number of themes have SVG icons, but they aren’t packaged and shipped with the product. SVGs are much slower to load compared to PNGs and need to be cached. [Tomaž Vajngerl has done some more work][32] in this area, but it hasn’t released yet. Even so, LibreOffice looks better than many other Linux apps which don’t have recognizable icons. - -Applications are generally improving with regards to detecting and being usable on high-res screens, but even some of the most popular such as Gimp and Audacity and Inkscape are still hard to use. I installed a large custom theme for Gimp, but all the icons are different so even though they are bigger, it takes time to recognize them. - -The unfortunate thing about Linux’s 1.5% marketshare is that these sorts of issues don’t get much priority. Many codebases are moving to GTK 3, but in Audacity’s case, it seems to be [stalled][33]. I talked in my first review about a long tail of applications that will need improvements but 3 years later, even some of the most popular apps still need work. - -### SSD - -The old hard drive was doing fine because of the various optimizations I did, especially to Firefox. I also kept in mind that the **/tmp** directory had automatically been setup as a RAM drive, and so I would usually save downloads there first. Sometimes I’d find a 500 MB video I want to grab a short 20 MB clip from, or convert to another format, so by doing it in /tmp I saved a lot of writes. It is more work, and possibly unnecessary, but it’s faster to work in RAM. - -I had written to each cell 25 times over the 3 years, which meant the drive could last for 350 years. The vast majority of the writes were for Arch updates. It gets new LibreOffice builds every month, and a new “stable” kernel release every week. It was great to be up to date all the time, but it did cost 100 times more writes compared to running Debian stable. However, given that each component has their own release cycle, it was necessary. - -The new Samsung drive diagnostics don’t tell the number of times it has written to each cell. In fact, I can’t even find out what cell type it is and how many writes it is specified to handle. I believe the “Percentage Used” value will me the age of the drive, but perhaps it relates only to the number of spare cells. I haven’t found any documentation so I can only guess: - -||| -|--|--| -| **Model Number:** | **SAMSUNG MZVLV256HCHP-000L2** | -| **Firmware Updates (0x06):** | **3 Slots** | -| **Available Spare:** | **100%** | -| **Available Spare Threshold:** | **10%** | -| **Percentage Used:** | **0%** | -| ****Data Units Written:**** | **198,997 [101 GB]** | -| **Data Units Written:** | **305,302 [156 GB]** | -| **Host Read Commands:** | **3,480,816** | -| **Host Write Commands:** | **10,176,457** | -| **Error Information Log Entries:** | **5** | - -### Broken Left-Ctrl Key - -One thing I noticed after just a few hours of use is that the left-control key pops off if pressed in the upper-left corner: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-7-1.png) - -_Broken Yoga 900 key: Note the tiny cylinder missing in the left box vs the right -_ - -The layout of the Yoga 900 keyboard is the same as the Yoga 2 Pro, but the internals are different. The keys of the Yoga 2 Pro cannot be removed and replaced individually, and there is no way to pop off any of the keys without doing permanent damage. The Yoga 900 has the old style Thinkpad keys: which can be detached, and replaced individually. - -However, there is a defect and one of the 4 tiny cylinder notches in the hinge was missing so that it only connects to the key top at 3 points, and if you don’t press the key in the middle, it will slip off. - -I contacted Lenovo about this. Even though the keys are replaceable and serviceable, they will only replace the entire keyboard, and refuse to mail out any parts. They recommend I mail the computer in, or take it to the Geek Squad service center. I knew that mailing it in would take 2 weeks, so I called my local store to ask if they had Yoga keyboard parts in stock. They told me they don’t take the computers apart, they just mail them to Atlanta. There used to be places that could make many repairs to IBM laptops, and stocked the common parts, but that industry is apparently gone. - -I noticed this mistake within a couple of hours of using the computer, so I’m pretty sure it was a manufacturing defect. It is such a tiny piece of plastic that was deformed or broke off during assembly. - -Even though the computer is under warranty and could be fixed for free, I didn’t want to wait for something so minor, so I just went on the Internet and found a website called laptopkey.com and ordered a replacement key and hinge. It was actually tricky because there are 3 types of hinges! It took me several minutes to figure out which one my computer has because y’all look the same to me: - - ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/BigHinges-2.jpg) - -So I ordered the part, but I read it would arrive in about a week. It was very frustrating because I use left-Ctrl all the time when doing copy/paste, skipping through video or by word in text editors, etc. so I thought maybe I could swap the hinge from the right-ctrl, which I never use. - -So I tried to remove this key following instructions I found on the Internet: I got my fingernail under the upper left corner, and lifted till it clicked. And then I put my nail under the upper right corner, and did the same thing. But another one of those tiny pieces of plastic broke off, so now I have two broken hinges. It might not be possible to remove the keys without breaking these very tiny clips. These keyboards are serviceable perhaps only in theory. - -So I decided to go old-school and use superglue. I’d rather have the damn key stay on and have no urgent plans to replace them. It was tricky because I needed a small dab of glue about 1mm in diameter: too much in there it could gum up the works. - -My experience building R/C airplanes came in handy and I fixed it and now the left-Ctrl key is holding on. The right one still slips off but I hardly use it. I was happy again! This is a long sidetrack, but it is important to keep in mind maintenance of a machine. - -### Antergos vs. Arch - -After 3 years with Arch Linux, I had no interest in trying anything else. The Intel drivers had regressions, but otherwise Arch has been painless to run on a daily basis, and it got a little better every week. It’s exciting to be up to date with everything. I often had packages newer than what was in Ubuntu on their release date. Ubuntu users can find newer software in custom PPAs, but there isn’t any testing or coordination across them, so that people who use multiple run into problems. - -People also complain about Ubuntu upgrades hosing the machine and forcing a re-install, so even though their installation process is quicker, the ongoing maintenance isn’t. Every time I’ve read about someone borking an Arch installation, they would always admit it was a user error or something like btrfs corruption. - -I wanted to install [Antergos][34], which provides a GUI installer for Arch. However, the setup looked unreadable on my screen, and it didn’t recognize the Clickpad in their minimal install, which is the only one I had space for on my old 1GB USB key. So I decided to just install Arch old-school again. Thankfully, the Yoga still supports legacy BIOS, so I didn’t have to mess with [UEFI][35]. - -I was sorry I didn’t try out Antergos, because I think it could be a great distro for less technical people or those who want to quickly get into Arch Linux. The Arch wiki is filled with tips for best running Linux. I’d love to have something which setup weekly TRIM for my SSD, [Profile-Sync-Daemon][36], Android support, hardware-accelerated video playback, etc. There are quite a few things that nearly all users would want, and are just a few lines to detect and enable. - -Manjaro is a very popular Arch-based distribution with a GUI installer, but having run Arch for 3 years, I trust their packagers to work out issues between components. I’ve read a number of comments on Reddit from people who found their Manjaro installation broken after an update. - -My only complaint about my Arch installation now is the ugly unreadable bootloader screen. I just need to copy over the **grub.cfg** from my old machine. - -### Arch Install - -At first I just wanted to just move the hard drive from one laptop to the next so that I wouldn’t even have to install anything, but after taking the computers apart, I noticed the M.2 SSDs are a different shape. I could have done a low-level block copy, but just decided to start from scratch because it would be a good refresher. It had been 3 years. I had installed a lot of random crap over the years, and even when I remembered to un-install it there were all kinds of digital remnants. - -The Arch install went quite smoothly this time because the hardware had been around for so long. I still needed to do **rfkill unblock wifi**, but other than that everything else just worked. Apparently Linux still doesn’t know how to properly read the rfkill information from this model. Fortunately **systemd** has the ability to restore rfkill values on startup. - -### Kernel Buglist - -One of the things that continues to surprise me is that the Linux buglist is a mess. I know there are all of these people and this great rate of change, but what isn’t changing is the worst case scenario for a bug report. I don’t know why bugs sit around for years, but there clearly is no escalation process. - -I wrote an analogy in my last review I think is useful. Imagine if it took an airline 1-2 years to return your lost luggage. Would you use trust that company? In fact, what’s the point of making a new release if you’ve still got thousands of known bugs and hundreds of regressions? If 1% of every Boeing airplane crashed, would they just keep continuing like that for years? - -Maybe the Linux Foundation should hire some engineers to work on all the bugs that everyone else seems to be ignoring. There are a lot of people paid to work on Linux, and there are a lot of old bugs – which is usually what amateurs do. In my opinion the kernel would be better off not releasing anything for months until the bug count was under 50\. Right now it is 4672\. That would be a good reason to increment the major release number. - -There is something contradictory about making a new stable release every week, but they’ve been doing it that way for years, and they have critical fixes every time, so they are clearly doing something valuable. The kernel gets better at a great rate, so far be it for me to criticize, but I do think they should try something different. - -At least, bugs should get resolved within a specific timeframe. If that is exceeded, than it should escalate up to the maintainer and eventually to Linus. If there is a problem area with a lot of old bugs in a place that no one is working on, then Linus can point this out and crack the whip on the relevant parties. They need to think more like Boeing. - -### Lenovo - -Many Linux users hammer Lenovo for their lack of support on their consumer laptops, but they build quality hardware at a good price. As I wrote years ago, it was obvious not one person at Lenovo had bothered to install Linux on the Yoga 2 before they released it, and it is true for the Yoga 900 because it was impossible. - -I think everyone in their company should be dual-booting. It isn’t that hard to setup, and their customers might want that. Lenovo has 60,000 employees. At least, they need to hire a few people on their Yoga team willing to try out this thing called **Linux**. Windows is painful to use compared to Linux in various ways. Windows runs more applications, but I think perhaps half of their users would be happier with a properly configured Linux installation. - -While it is bad how Lenovo is still ignoring Linux, their problems apply to more than the software. On many models, the RAM chips are soldered on. In some devices, there are whitelists and only pre-approved cards can be installed. The Yogas don’t have a discrete graphics card, but even Lenovos that do provide no mechanism to upgrade the card, like you can with a desktop. I think someone needs to put a horse head in the bed of the Lenovo CEO. - -### Conclusion - -This Yoga 900 is an amazing laptop for the price, and it’s a definite step up from the Yoga 2 with the improvements. A similar Apple Macbook Pro is $1500, but it has 40% less pixels. - -Windows is adopting some of the best features of Linux, but they still don’t have native support for a package manager with all of the interesting free software components pre-compiled. Installing **ffmpeg** on Windows is a huge pain because of all the [dependent libraries][37] it uses. - -Microsoft built a Windows store, which is sort of like a repository, but it doesn’t handle inter-package dependencies, and isn’t setup to manage individual libraries. Microsoft also has a new package manager called [NuGet][38], but it seems to be used mostly for .Net software. It did have a package for ffmpeg, but it didn’t have any dependencies for the codecs so even after installing it, it won’t do anything useful yet. - -Last March, [Microsoft demonstrated][39] the ability to run Ubuntu command-line applications, which is quite a revolution. (They should have [started with Debian][40].) There’s even [a discussion][41] in their buglist to add support for more distros which could be quite tempting. - -For me at least, I have no need for Windows apps, and the extra maintenance time. Fixing issues in Windows involves hunting down things in lots of different places. Linux still has a fair number of places to configure a system, but overall it’s much simpler. - -I have friends who install 3rd party software on Windows just to keep their drivers up to date, because it grabs code from many more websites than just Microsoft’s. Windows has gotten better over the years, and it has more games and desktop applications, but it is an aging, closed system. - -I find Gnome classic a streamlined experience. I wish it wasn’t written in the clunky [fad Javascript][42], and they re-enabled a community around custom themes and color schemes. It’s also still missing some nice features from Gnome 2 and Windows 10, and could be a bit more stable. Gnome 3.0 in 2011 was a step backwards, but six years later we’re up to Gnome 3.22, and things are mature again. - -Gnome Classic is one of the best GUIs, but there are a [number of good ones][43] and all are getting better. This machine is working quite well now and I’m just going to sit back and keep waiting for the HiDPI and other improvements! I’m looking forward to deep learning inside the grammar checker of LibreOffice. - --------------------------------------------------------------------------------- - -via: http://keithcu.com/wordpress/?p=3739 - -作者:[keithccurtis][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://twitter.com/keithccurtis -[1]:https://www.amazon.com/Lenovo-13-3-inch-Multitouch-Convertible-Platinum/dp/B01NA6ANNK/ -[2]:http://keithcu.com/wordpress/?p=3270 -[3]:http://configure.us.dell.com/dellstore/config.aspx?oc=cax13w10ph5122&model_id=xps-13-9360-laptop&c=us&l=en&s=bsd&cs=04 -[4]:http://blog.lenovo.com/en/blog/why-you-should-give-in-to-the-new-thinkpad-keyboard -[5]:https://www.freedesktop.org/wiki/Software/libinput/ -[6]:https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=762ce4458974534a2407cc924db05840c89105df -[7]:https://mjg59.dreamwidth.org/41713.html -[8]:https://en.wikipedia.org/wiki/Electromigration -[9]:http://support.lenovo.com/us/en/products/Laptops-and-netbooks/Yoga-Series/yoga-900-13isk2/80UE/downloads/DS112754 -[10]:http://support.lenovo.com/us/en/products/laptops-and-netbooks/yoga-series/yoga-900-13isk2/downloads/ds119354 -[11]:https://linux.slashdot.org/comments.pl?sid=9861381&cid=53241071 -[12]:https://www.reddit.com/r/linux/comments/54gtpc/letter_to_the_federal_trade_commission_regarding/ -[13]:http://venturebeat.com/2016/09/21/lenovo-confirms-that-linux-wont-work-on-yoga-900-and-900s-laptops/ -[14]:http://venturebeat.com/2016/09/21/lenovo-confirms-that-linux-wont-work-on-yoga-900-and-900s-laptops/ -[15]:https://www.reddit.com/user/baronhk/ -[16]:https://www.reddit.com/user/baronhk/ -[17]:https://www.reddit.com/user/baronhk/ -[18]:https://duckduckgo.com/?q=lenovo+yoga+linux+compatibility&t=hs&ia=web -[19]:https://duckduckgo.com/?q=lenovo+yoga+linux+compatibility&t=hs&ia=web -[20]:https://duckduckgo.com/?q=lenovo+yoga+linux+compatibility&t=hs&ia=web -[21]:https://www.spinics.net/lists/linux-ide/msg53370.html -[22]:http://ark.intel.com/products/codename/37572/Skylake -[23]:http://ark.intel.com/products/codename/37572/Skylake -[24]:http://ark.intel.com/products/codename/37572/Skylake -[25]:http://ark.intel.com/products/codename/42174/Haswell#@All -[26]:http://www.anandtech.com/show/9562/intels-skylake-gpu-analyzing-the-media-capabilities -[27]:http://www.anandtech.com/show/9562/intels-skylake-gpu-analyzing-the-media-capabilities -[28]:https://trac.ffmpeg.org/wiki/HWAccelIntro -[29]:http://www.game-debate.com/gpu/index.php?gid=3295&gid2=3285&compare=iris-graphics-540-mobile-vs-intel-hd-graphics-520-mobile -[30]:https://www.freedesktop.org/wiki/Software/Beignet/ -[31]:http://keithcu.com/wordpress/?p=3444 -[32]:https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=hidpi -[33]:http://wiki.audacityteam.org/wiki/Linux_Issues#Hi-DPI -[34]:https://antergos.com/ -[35]:https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface -[36]:https://wiki.archlinux.org/index.php/Profile-sync-daemon -[37]:https://ffmpeg.zeranoe.com/builds/ -[38]:https://www.nuget.org/ -[39]:https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/ -[40]:http://keithcu.com/wordpress/?page_id=558 -[41]:https://github.com/Microsoft/BashOnWindows/issues/992 -[42]:http://notes.ericjiang.com/posts/751 -[43]:https://wiki.archlinux.org/index.php/Desktop_environment diff --git a/sources/talk/20170206 LEARN C PROGRAMMING WITH 9 EXCELLENT OPEN SOURCE BOOKS.md b/sources/talk/20170206 LEARN C PROGRAMMING WITH 9 EXCELLENT OPEN SOURCE BOOKS.md deleted file mode 100644 index 26d4425521..0000000000 --- a/sources/talk/20170206 LEARN C PROGRAMMING WITH 9 EXCELLENT OPEN SOURCE BOOKS.md +++ /dev/null @@ -1,262 +0,0 @@ -LEARN C PROGRAMMING WITH 9 EXCELLENT OPEN SOURCE BOOKS -============================================================ - -Books are very personal things. And programming books are no exception. We all form bonds with programming books that help master the rudiments of a language, and then be able to move on to fully exploit the language’s flexibility. - -I have carefully considered the open source C books that are closest to my heart. I have identified 9 books that mean the most to me. - -C is a general-purpose, procedural, portable, high-level programming language that is one of the most popular and influential languages. It was designed to be compiled using a straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. Many programming languages owe a considerable debt to C. It has become something of the lingua franca in the programming world. - -C is fairly simple to understand. It allows the programmer to organize programs in a clear, easy, logical way. It is a very flexible, practical and compact language combined with an easy to read syntax. Code written in C runs quickly, with easy access to the low level facilities in the computer. Compiler directives make it possible to produce a single version of a program compiled for different architectures. - -C is about freedom. It therefore makes sense to learn C with books that also embody freedom. Take a look at my open source picks and see if any of them grab your fancy. Put the kettle on and enjoy. - -| - ![The C Book](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/01/TheCBook.png?resize=200%2C290&ssl=1) - | - -### [The C Book][3] - -By Mike Banahan, Declan Brady and Mark Doran (350 pages) - -The C Book is designed for programmers who already have some experience of using a modern high-level procedural programming language. The book concentrates on the things that are special to C. In particular, it is the way that C is used which is focused on. - -Chapters include: - -* An Introduction to C -* Variables and Arithmetic – introduces some of the fundamentals of C, including keywords and identifiers, declaration of variables, real types, integral types, expressions and arithmetic, and constants -* Control of Flow and Logical Expressions – looks at the various ways that the control of flow statements can be used in a C program, including some statements that have not been introduced so far. Control of flow, more logical expressions, and strange operators -* Functions – the type of functions, recursion and argument passing, and linkage -* Arrays and Pointers – arrays, pointers, character handling, sizeof and storage allocation, pointers to functions, expressions involving pointers, arrays, the & operator and function declarations -* Structured Data Types – structures, unions, bitfields, enums, qualifiers and derived types, and initialization -* The Preprocessor – how the preprocessor works, and directives -* Specialized Areas of C – declarations, definitions and accessibility, typedef, const and volatile, and sequence points -* Libraries – diagnostics, character handling, localization, limits, mathematical functions, non-local jumps, signal handling, variable numbers of arguments, input and output, formatted I/O, character I/O, unformatted I/O, random access functions, general utilities, string handling, and date and time -* Complete Programs in C – putting it all together, arguments to main, interpreting program arguments, a pattern matching program, and a more ambitious example - -The authors give the reader permission to do anything they want with the book provided there is an acknowledgement of the authors and their copyright. From what Mike Banahan has confirmed, the book is effectively under the Creative Commons License. - - | -| - ![C Elements of Style](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/01/CElementsofStyle.jpg?resize=200%2C255&ssl=1) - | - -### [C Elements of Style][4] - -By Steve Oualline (265 pages) - -C Elements of Style is a useful guide which covers the principals of good programming style, teaching C and C++ programmers how to write code that can be easily read, understood, and maintained by others. Whether you are a student or professional programmer, you will benefit from the many tips and techniques for constructing elegant, reliable code. - -The book attempts to show readers how to build a good programming style into your code. Since computer reads only the code and the human concentrates on the comments, a good programming style pertains to both parts of a program. - -The ultimate goal is to build a well-designed, well-written code which not only make an effective use of the computer and but also contains careful constructed comments to help humans understand it. This condition will ease the debugging, maintenance and enhancement process, which will eventually improve the readability, portability, reliability and maintainability of your code. - -Inside, you will find guidelines on writing comments, program heading, determining variable names, statement formatting, statement details, writing preprocessor, organizing directories and creating makefile. - -This book is published under the Creative Commons License. - - | -| - ![Build Your Own Lisp](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/BuildYourOwnLisp.jpeg?resize=200%2C299&ssl=1) - | - -### [Build Your Own Lisp][5] - -By Daniel Holden (212 pages) - -Learn the C programming language and at the same time learn how to build your very own programming language, a minimal Lisp, in under 1000 lines of code. - -This book is for anyone wanting to learn C, or who has once wondered how to build their own programming language. It is not designed as a first programming language book, as you need some programming experience to make your way through the content. - -Build Your Own Lisp is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0. - -A paperback is available to purchase from Amazon. - - | -| - ![](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/GNUCReferenceManual.png?resize=200%2C279&ssl=1) - | - -### [The GNU C Reference Manual][6] - -By Trevis Rothwell, James Youngman (91 pages) - -The GNU C Reference Manual is a reference for the C programming language and aims to document the 1989 ANSI C standard, the 1999 ISO C standard, and the current state of GNU extensions to standard C. It is not designed for new programmers. - -Chapters cover: - -* Lexical Elements – describes the lexical elements that make up C source code after preprocessing. These elements are called tokens. There are five types of tokens: keywords, identifiers, constants, operators, and separators -* Data Types – examines primitive data types, enumerations, unions, structures, arrays, pointers, incomplete types, type qualifiers, storage class specifiers, and renaming types -* Expressions and Operators – also looks at incrementing / decrementing, arithmetic operators, complex conjugation, comparison operators, logical operators, bit shifting, bitwise local operators, pointer operators, the sizeof operator, type casts, and more -* Statements – read about labels, expression statements, the if statement, the switch statement, the while statement, the do statement, the for statement, blocks, the null statement, the goto statement, the break statement, the continue statement, the return statement, and the typedef statement -* Functions – learn about function declarations, function definitions, calling functions, function parameters, variable length parameter lists, calling functions through function pointers, the main function, recursive functions, and more -* Program Structure and Scope – looks at the big picture -* A Sample Program – a complete program written in C, consisting of both a C source file and a header file. This program is an expanded version of the quintessential “hello world” program, and serves as an example of how to format and structure C code for use in programs for FSF Project GNU - -The book is available under the terms of the GNU Free Documentation License, Version 1.3 or later. - - | -| - ![](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/GNUCProgrammingTutorial.png?resize=475%2C637&ssl=1) - | - -### [The GNU C Programming Tutorial][7] - -By Mark Burgess, Ron Hale-Evans (290 pages) - -The GNU C Programming Tutorial introduces the reader to the basic ideas in a logical order. It offers detailed coverage of each of the main elements of the C language and how to program in C, with special emphasis on the GNU/Linux compiler and associated software. - -There are chapters devoted to functions, variables and declarations, scope, expressions and operators, parameters, pointers, decisions, loops, arrays, strings, input and output, and much more. - -The GNU C Programming Tutorial is released under the GNU Free Documentation License, Version 1.1. - - | -| - ![](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/EssentialC.png?resize=200%2C270&ssl=1) - | - -### [Essential C][1] - -By Nick Parlante (45 pages) - -This Stanford CS Education is a fairly brief document which explains all the common features and techniques for C. The coverage is pretty quick, so it is targeted at a programmer with a background in another language. - -Topics include variables, int types, floating point types, promotion, truncation, operators, control structures (if, while, for), functions, value parameters, reference parameters, structs, pointers, arrays, the pre-processor, and the standard C library functions. - -Table of Contents: - -* Introduction -* Basic Types and Operators -* Control Structures -* Complex Data Types -* Functions -* Odds and Ends -* Advanced Arrays and Pointers -* Operators and Standard Library Reference - -The author’s description indicates this book is issued under an open-source like license. - - | -| - ![](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/BeejsGuideCProgramming.png?resize=200%2C273&ssl=1) - | - -### [Beej’s Guide to C Programming][8] - -By Brian “Beej” Hall (130 pages) - -Beej’s Guide to C Programming tries to lead the reader from complete and utter sheer lost confusion on to the sort of enlightened bliss that can only be obtained though pure C programming. - -Chapters: - -* Programming Building Blocks -* Variables, Expressions, and Statements – A variable is simply a name for a number. An expression in C consists of other expressions optionally put together with operators. Examines the if, while, do-while, and the for statements -* Building Blocks Revisited -* Functions – put some of those building blocks in their own functions when they become too large, or when they do a different thing than the rest of the code -* Variables, the Sequel – talks about variable scope and storage classes -* Pointers – they are the address of data. Just like an int can be 12, a pointer can be the address of data -* Structures – a construct that allows you to logically group variables into groups. You can then reference the group as a whole -* Arrays – a linear collection of related data -* Strings – a string in C is a sequence of bytes in memory that usually contains a bunch of letters -* Dynamic Memory – explores the malloc(), free(), realloc(), and calloc() functions -* More Stuff – topics include pointer arithmetic, typedef, enum, struct declarations, command line arguments, multidimensional arrays, casting and promotion, incomplete types, void pointers, NULL pointers, and static keywords -* Standard I/O Library – used for reading from and writing to files -* String Manipulation – find functions for pulling substrings out of strings, concatenating strings together, getting the length of a string, and more -* Mathematics – functions that will serve your general purpose mathematical needs - -This book is licensed under the Creative Commons Attribution-Noncommercial- No Derivative Works 3.0 License. - - | -| - ![](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/02/ModernC.png?resize=200%2C270&ssl=1) - | - -### [Modern C][2] - -By Jens Gustedt (310 pages) - -Modern C seeks to motivate the reader to climb to higher levels of knowledge. The book is divided into five levels: - -* First level – provides the reader with the very basics of C programs, their purpose, their structure, and how to use them -* Second level – details most principal concepts and features such as control structures, data types, operators and functions. It aims to provide the reader with a deeper understanding of the things that are going on with running programs -* Third level – goes to the heart of the C language. It fully explains pointers, familiarizes you with C’s memory model, and allows you to understand most of C’s library interface. -* Fourth level – goes into detail in specific topics, such as performance, reentrancy, atomicity, threads and type generic programming -* Fifth level – discusses the author’s ideas for a future development of C - -This book is licensed under the Creative Commons Attribution-Noncommercial- No Derivative Works 3.0 License. - - | -| - ![An Introduction to GCC](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/01/IntroductionGCC.png?resize=200%2C300&ssl=1) - | - -### [An Introduction to GCC][9] - -By Brian Gough (144 pages) - -An Introduction to GCC provides an introduction to the GNU C and C++ Compilers, gcc and g++, which are part of the GNU Compiler Collection (GCC). - -This book explains how to use the compiler itself. Based on years of observation of questions posted on mailing lists, it guides the reader straight to the important options of GCC. - -Chapters: - -* Introduction -* Compiling a C program – describes how to compile C programs using gcc. Programs can be compiled from a single source file or from multiple source files, and may use system libraries and header files -* Compilation options – describes other commonly-used compiler options available in GCC. These options control features such as the search paths used for locating libraries and include files, the use of additional warnings and diagnostics, preprocessor macros and C language dialects -* Using the preprocessor – describes the use of the GNU C preprocessor cpp, which is part of the GCC package. The preprocessor expands macros in source files before they are compiled. It is automatically called whenever GCC processes a C or C++ program -* Compiling for debugging – provides the -g debug option to store additional debugging information in object files and executables. This debugging information allows errors to be traced back from a specific machine instruction to the corresponding line in the original source file -* Compiling with optimization – GCC is an optimizing compiler. It provides a wide range of options which aim to increase the speed, or reduce the size, of the executable files it generates -* Compiling a C++ program – describes how to use GCC to compile programs written in C++, and the command-line options specific to that language -* Platform-specific options – describes some of the options available for common platforms: Intel and AMD x86 options, x86 extensions, x86 64-bit processors, DEC Alpha options, SPARC options, POWER/PowerPC options, Multi-architecture support, and floating-point issues -* Troubleshooting – GCC provides several help and diagnostic options to help troubleshoot problems with the compilation process -* Compiler-related tools – describes a number of tools which are useful in combination with GCC. These include the GNU archiver ar, for creating libraries, and the GNU profiling and coverage testing programs, gprof and gcov -* How the compiler works – describes in more detail how GCC transforms source files to an executable file. Compilation is a multi-stage process involving several tools, including the GNU Compiler itself (through the gcc or g++ frontends), the GNU Assembler as, and the GNU Linker ld. The complete set of tools used in the compilation process is referred to as a toolchain -* Examining compiled files – describes several useful tools for examining the contents of executable files and object files -* Common error messages – describes the most frequent error and warning messages produced by gcc and g++. Each case is accompanied by a description of the causes, an example and suggestions of possible solutions -* Getting help – if readers encounters a problem not covered by this introduction, there are several reference manuals which describe GCC and language-related topics in more detail - -This book is published under the GNU Free Documentation License - - | - -* * * - -Here are some informative C Books to download without charge, but which regrettably are not released under an open source license, or where license information is unclear. In no particular order: - -[Introduction to C Programming][14] – by Rob Miles -[The New Standard C: An Economic and Cultural Commentary][15] – by Derek M. Jones -[Object-Oriented Programming with ANSI-C][16] – by Axel-Tobias Schreiner -[Writing Bug-Free C Code][17] – by Jerry Jongenius - -And finally, my recommendation if you want to buy a canonical reference book is this title: [The C Programming Language][18]. Terse, not for beginners, but widely regarded as the classic C programming book. - - --------------------------------------------------------------------------------- - -via: https://www.ossblog.org/learn-c-programming-with-9-excellent-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]:http://cslibrary.stanford.edu/101/EssentialC.pdf -[2]:http://icube-icps.unistra.fr/img_auth.php/d/db/ModernC.pdf -[3]:http://publications.gbdirect.co.uk/c_book/ -[4]:http://www.oualline.com/books.free/style/index.html -[5]:http://buildyourownlisp.com/ -[6]:https://www.gnu.org/software/gnu-c-manual/ -[7]:http://www.crasseux.com/books/ctut.pdf -[8]:http://beej.us/guide/bgc/ -[9]:http://www.network-theory.co.uk/docs/gccintro/ -[10]:https://www.ossblog.org/author/steve/ -[11]:https://www.ossblog.org/learn-c-programming-with-9-excellent-open-source-books/#comments -[12]:https://www.ossblog.org/category/books/ -[13]:https://www.ossblog.org/category/programming/ -[14]:http://www.tti.unipa.it/~ricrizzo/KS/Data/RMiles/contents.html -[15]:http://www.coding-guidelines.com/cbook/cbook1_2.pdf -[16]:http://www.cs.rit.edu/~ats/books/ooc.pdf -[17]:http://www.duckware.com/bugfreec/index.html -[18]:https://en.wikipedia.org/wiki/The_C_Programming_Language diff --git a/sources/talk/20170207 How Linux Helped Me Become an Empowered Computer User.md b/sources/talk/20170207 How Linux Helped Me Become an Empowered Computer User.md new file mode 100644 index 0000000000..414634c7a9 --- /dev/null +++ b/sources/talk/20170207 How Linux Helped Me Become an Empowered Computer User.md @@ -0,0 +1,76 @@ +How Linux Helped Me Become an Empowered Computer User +============================================================ + + ![switching-linux](http://www.linuxinsider.com/article_images/story_graphics_xlarge/xl-2016-linux-1.jpg) + + ![](http://www.linuxinsider.com/images/2015/image-credit-adobe-stock_130x15.gif) + +If you were to ask any of my friends, they could readily attest to my profound passion for Linux. That said, it might surprise you to know that hardly two years ago, I barely knew what Linux was, let alone had any earnest interest in switching to it from Windows. + +Although a shift as dramatic as this may seem astonishing when considered in hindsight, analyzing my path from one push or influence to the next paints a more telling picture. It is with this approach that I want to share my story of how I came to not only use, but indeed champion, the Linux desktop. + +### My Security Awakening + +Before embarking on my journey two years ago, I was just an ordinary Windows user. While I was basically competent and tried to keep abreast of mainstream tech news, I had an unremarkable knowledge of computers. + +My attitude quickly began to change in light of the reporting on the intelligence programs of the National Security Agency in the summer of 2013\. The breadth of the online monitoring Edward Snowden revealed was unsettling, but it also underscored just how little most of us do -- or even know how to do -- to safeguard our own privacy. + +Whereas before I previously gave no particular consideration to computers or their role in my personal affairs, I came to realize the critical importance of taking control of one's digital life, and of the devices that power it. + +The logical next step was to determine exactly how to go about it. Though my goal seemed logical, achieving it would not be simple. Over the next few months I devoted my free time to scouring the Internet for guides on deploying privacy protections, encryption, and any other techniques that could protect me. + +Experts will tell you that if you're trying to evade intelligence agencies, you should give up. Yet those same experts will tell you that your only recourse for resisting even a fraction of state surveillance -- and a decent proportion of monitoring by lesser agencies more likely to target ordinary people -- is to use open source software. Linux, I soon found, was chief among those software options. + +### Proprietary vs. Open Source + +Upon further study, I became familiar with just what was so special about open source software. The lion's share of the software we use every day -- from chat clients to operating systems, including Windows -- is the opposite of open source software: It's proprietary. + +When Microsoft developers work on Windows, for example, they write the source code in some programming language and circulate this code only among their team. When they're ready to release the software, they compile it, converting it from human-readable code into the 1s and 0s that computers need to run it, but which even the most brilliant humans struggle to reverse-engineer to original source code. + +With this model, the only people who know for sure exactly what the software does, or whether it surreptitiously undermines or monitors its users, are the people who wrote it. + +Open source software, though, is released to the public in its source code form, along with downloadable binary packages for installation. Whether or not every individual user is capable of reading the source code to assess its security and privacy, the fact that it is public means that those with enough technical chops are free to do so, and they can notify users if the program contains hidden malicious processes or inadvertently buggy ones. + +After thorough research, it became clear that the only operating system that could guarantee my privacy and autonomy as a user was one that offered the transparency of the open source philosophy. The one knowledgeable friends and privacy advocates recommended most was Linux. I was ready to endure a rough transition if I had to, but my conviction in the importance of privacy gave me the confidence to try. + +### Baby Steps + +Although my resolve to switch to Linux was immediate, the process of migrating to it was gradual. I started by installing Ubuntu -- an easily configured and beginner-friendly Linux distribution -- to run side-by-side with the existing Windows installation on my aging laptop. + +By being able to choose Ubuntu or Windows each time I booted up my computer, I was able to find my footing on Linux while preserving the familiar refuge of Windows in case the former was missing direly needed functionality. + +As it turned out, a fatally corrupted hard drive prevented me from enjoying this setup for long, but I took that as an opportunity to pick out a new laptop with Linux in mind. As its standard Intel set of processors, graphic cards, and wireless adapters work well with Linux's drivers, I went with a Lenovo ThinkPad. + +I made a fresh start, completely wiping Windows from my new machine in favor of Debian, a widely compatible and stable distribution on which Ubuntu is based. More than merely surviving without the familiar Windows safety net, I thrived. I was soon immersing myself in the previously mysterious command line world. + +After I had a year of working with Linux under my belt, I took another plunge and installed Arch Linux, which requires a significantly more complex manual user installation process, with full disk encryption. That night installing Arch, with a Linux veteran supervising, marked one of the proudest accomplishments in my life. + +I had my share of challenges along the way -- sometimes applications that worked seamlessly on Windows required laborious extra steps or missing drivers needed installation -- but I surmounted them or sidestepped them and continued to figure out Linux at my own pace. + +### Full Steam Ahead + +As far as I had come, it was then that I really started to learn. I took up Linux to harness the power of my computer and ensure that it worked for me, but what kept me engaged was the freedom of modification and personalization that it offered. + +As an open source OS, Linux is infinitely open to customization. Although I initially expected to spend my time reading up on security practices (which I very much still do), I also found myself digging deep into configuration panels and laying out all the colors, icons and menus just so. + +It took some getting used to, but the more I threw myself into something new, the more confident -- and curious -- I became. + +A little over two years since setting out down this road, I've never felt more at home on my computer than I do today. I couldn't personalize Windows the way I wanted it, and from what I've learned from the open source community, I couldn't fully trust it, either. + +What was once simply a piece of hardware I owned is now something I have a close connection to -- not unlike the connection a journalist has to her notebook or a violinist to her instrument. + +I even find myself lamenting the fact that my phone is not as amenable to true Linux as my laptop and wondering what I can do about that. In the meantime, though, I will keep tinkering away on my Arch system, discovering new corners and exploring new possibilities whenever the chance arises. + +-------------------------------------------------------------------------------- + +via: http://www.linuxinsider.com/story/84286.html?rss=1 + +作者:[Jonathan Terrasi ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linkedin.com/company/ect-news-network +[1]:http://www.linuxinsider.com/story/84286.html?rss=1# +[2]:http://www.linuxinsider.com/perl/mailit/?id=84286 diff --git a/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md b/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md index 9fd0765f08..c2a4e32a8a 100644 --- a/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md +++ b/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md @@ -1,3 +1,7 @@ +Meditator-hkx 翻译中... + + + Windows wins the desktop, but Linux takes the world ============================================================ diff --git a/sources/talk/20170223 What a Linux Desktop Does Better.md b/sources/talk/20170223 What a Linux Desktop Does Better.md new file mode 100644 index 0000000000..181a844a41 --- /dev/null +++ b/sources/talk/20170223 What a Linux Desktop Does Better.md @@ -0,0 +1,90 @@ +What a Linux Desktop Does Better +============================================================ + + ![linux-desktop-advantages](http://www.linuxinsider.com/article_images/story_graphics_xlarge/xl-2017-linux-1.jpg) + + ![](http://www.linuxinsider.com/images/2015/image-credit-adobe-stock_130x15.gif) + +After I [resolved to adopt Linux][3], my confidence grew slowly but surely. Security-oriented considerations were compelling enough to convince me to switch, but I soon discovered many more advantages to the Linux desktop. + +For those still unsure about making the transition, or those who have done so but may not know everything their system can do, I'll showcase here some of the Linux desktop's advantages. + +### You Can't Beat Free! + +First and foremost, Linux is literally free. Neither the operating system nor any of the programs you run will cost you a dime. Beyond the obvious financial benefit of getting software for free, Linux allows users to  _be_  free by affording access to the basic tools of modern computer use -- such as word processing and photo editing -- which otherwise might be unavailable due to the cost barrier. + +Microsoft Office, which sets the de facto standard formats for documents of nearly every kind, demands a US$70 per year subscription. However, you can run [LibreOffice][4] for free while still handling documents in all the same formats with ease. + +Free software also gives you the chance to try new programs, and with them new ways of pursuing business and leisure, without their prospective costs forcing you to make a commitment. + +Instead of painstakingly weighing the merits of Mac or Windows and then taking a leap of faith, you can consider a vast spectrum of choices offered by[hundreds of distributions][5] -- basically, different flavors of Linux -- by trying each in turn until you find the one that's right for you. + +Linux can even save money on hardware, as some manufacturers -- notably Dell -- offer a discount for buying a computer with Linux preinstalled. They can charge less because they don't have to pass on the cost of licensing Windows from Microsoft. + +### You Can Make It Your Own + +There is practically nothing in Linux that can't be customized. Among the projects central to the Linux ecosystem are desktop environments -- that is, collections of basic user programs and visual elements, like status bars and launchers, that make up the user interface. + +Some Linux distributions come bundled with a desktop environment. Ubuntu is paired with the Unity desktop, for example. Others, such as with Debian, give you a choice at installation. In either case, users are free to change to any one they like. + +Most distributions officially support (i.e., vouch for compatibility) dozens of the most popular desktops, which makes finding the one you like best that much simpler. Within the pantheon of desktops, you can find anything from glossy modern interfaces like KDE Plasma or [Gnome][6], to simple and lightweight ones like Xfce and MATE. Within each of these, you can personalize your setup further by changing the themes, system trays and menus, choosing from galleries of other users' screens for inspiration. + +The customization possibilities go well beyond aesthetics. If you prize system stability, you can run a distribution like Mint, which offers dependable hardware support and ensures smooth updates. + +On the other hand, if you want to live on the cutting edge, you can install an OS like Arch Linux, which gives you the latest update to each program as soon as developers release it. + +If you'd rather take the middle path and stick with a stable foundation while running a few programs on the bleeding edge, you can download the source code -- that is, the code files written by the program's developers -- and compile them yourself. That requires running the source code through a utility to translate them into files of 1s and 0s (called "binaries") for your computer to execute. + +The Linux system is yours to tweak in whatever ways work best for you. + +### Lock It Down + +This versatility lends itself well to a third major advantage to Linux: security. + +To start with, while there are viruses for Linux, the number pales in comparison even to those for Mac. More importantly, the fact that the code for the core OS framework is open source -- and thus transparent to evaluation -- means there are fewer vulnerabilities in your basic system. + +While proprietary (i.e., non-open source) OSes sometimes are criticized as maliciously compromising user security, they pose just as great a threat due to poorly implemented, opaque processes. + +For instance, lots of Windows computers by default [do not check the cryptographic signatures][7] -- the mathematically guaranteed seals of authenticity -- on OS updates. + +With Linux, you can implement as much fine-grained control over signature checking as you choose, and the major distributions enforce safe default settings. This kind of accountability arises directly from the transparency of Linux's open source development model. + +Rolling release distributions like Arch add even more security, as critical patches are available almost as soon as they are approved. You would be hard-pressed to find a single mainstream OS that offers daily updates, but with Linux there are dozens. + +### It's a Natural Development Platform + +With a Linux desktop, developers -- or anyone interested in programming -- have the added benefit of Linux's great development tools. Among the best compiling tools around are the GNU C Compiler, or GCC, and GNU Autoconf, both key foundations of Linux. + +Linux comfortably supports dozens of programming languages available in most default repositories, which are the pools of pre-compiled software available to a distribution. + +Much of the Internet's infrastructure and many connected devices run on Linux -- from servers to smart devices such as security cameras and thermostats. Coding for these devices on Linux makes testing that much easier. If you have a computer-related project, Linux has everything you need to get the job done. + +### Community Is at the Heart of Everything Linux + +Finally, Linux has a tightly knit and friendly community. Because Linux is a relatively niche desktop OS, with around 3 percent market share, those who use it want prospective newcomers to stick around. + +User forums, especially for beginner-friendly distributions like Ubuntu, include comprehensive guides to walk you through the basics and troubleshoot issues. Because power users tend to prefer Linux, wiki pages for distributions often contain thorough documentation -- often applicable across distributions -- to enable users to pursue even the most esoteric projects. + +There are even casual Linux forums and [Reddit][8] threads for everything from comparing different software to showing off desktop themes. Taken together, this makes for a community with more camaraderie than I ever experienced as a Windows user. + +Immersing myself in the world of Linux for just over two years has convinced me that it offers something for everyone. I hope this brief sampling of its advantages gives you a sense of what you might discover in a Linux desktop. But don't just take my word for it -- the real fun is finding out for yourself! + +-------------------------------------------------------------------------------- + +via: http://www.linuxinsider.com/story/84326.html?rss=1 + +作者:[Jonathan Terrasi ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linkedin.com/company/ect-news-network +[1]:http://www.linuxinsider.com/story/84326.html?rss=1# +[2]:http://www.linuxinsider.com/perl/mailit/?id=84326 +[3]:http://www.linuxinsider.com/story/84286.html +[4]:http://www.libreoffice.org/ +[5]:https://en.wikipedia.org/wiki/Linux_distribution +[6]:http://en.wikipedia.org/wiki/GNOME +[7]:https://duo.com/blog/out-of-box-exploitation-a-security-analysis-of-oem-updaters +[8]:http://www.reddit.com/ diff --git a/sources/tech/20160412 How to use the ZYBO Yocto BSP.md b/sources/tech/20160412 How to use the ZYBO Yocto BSP.md new file mode 100644 index 0000000000..eee4b9be82 --- /dev/null +++ b/sources/tech/20160412 How to use the ZYBO Yocto BSP.md @@ -0,0 +1,274 @@ +### Introduction +This section provides a quick guide to +* Build Yocto image with meta-xilinx provided by Digilent + +# Prepare build sources and configuration +This section provides the basic steps to setup build system and configurations + +#### Prerequisites +* Internet access +* required tools + * git + * repo +* Vivado tools for JTAG boot +* SD card for SD Boot + SD Card reader for programing the SD card. +* Linux workstation - currently tested with 64bit Ubuntu 14.04.4 + +##### Install git +Ubuntu: + + $ sudo apt-get install git-core + +##### Install repo +Repo is a tool that makes it easier to work with Git in the context of Android. +We use it to simplify the process of preparing yocto layers. + + $ mkdir ~/bin + $ PATH=~/bin:$PATH + $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo + $ chmod a+x ~/bin/repo + +[repo command reference](https://source.android.com/source/using-repo.html) + +#### Notes +* Ensure Yocto build is not over NFS/CIFD +* Only support jethro release at this point + +#### Preparation +Fetch/clone the required layer repos and assume the layer repos are store in +"~/tmp/layers" folder. + + $ export branch=jethro + $ export layer_root=${HOME}/tmp/layers + $ mkdir -p $layer_root + $ cd $layer_root + +Fetch required layers and hardware project with 'repo' + + $ repo init -u https://github.com/Digilent/meta-manifest.git -b ${branch} + $ repo sync + +#### Initialize build directory +This section provides the general step to create and config the build directory + +Follow the commands to create a build directory "${HOME}/tmp/zybo-linux-bd-zynq7" + + $ cd ${HOME}/tmp + $ export target_machine="zybo-linux-bd-zynq7" + $ . ${layer_root}/poky/oe-init-build-env ${target_machine} + $ tree . + . + └── conf + ├── bblayers.conf + ├── local.conf + └── templateconf.cfg +oe-init-build-env generates some generic configuration files in the build/conf +directory. +* The "bblayer.conf" file defines layers that are include in the build +* The "local.conf" file defines the configuration of the build. + +##### Add required layers +Add meta-oe and meta-xilinx layer to the BBLAYERS variable + + $ cd ${HOME}/tmp/${target_machine} + $ sed -i "/meta-yocto-bsp/a \ ${layer_root}/meta-openembedded/meta-oe \\\ " conf/bblayers.conf + $ sed -i "/meta-yocto-bsp/a \ ${layer_root}/meta-xilinx \\\ " conf/bblayers.conf +you can also use vim/nano/other editor to add the layer to conf/bblayers.conf + +If you check the conf/bblayers.conf, you should see similar output to the follows: + + LCONF_VERSION = "6" + BBPATH = "${TOPDIR}" + BBFILES ?= "" + + BBLAYERS ?= " \ + ${HOME}/tmp/layers/poky/meta \ + ${HOME}/tmp/layers/poky/meta-yocto \ + ${HOME}/tmp/layers/poky/meta-yocto-bsp \ + ${HOME}/tmp/layers/meta-xilinx \ + ${HOME}/tmp/layers/meta-openembedded/meta-oe \ + " + BBLAYERS_NON_REMOVABLE ?= " \ + ${HOME}/tmp/layers/poky/meta \ + ${HOME}/tmp/layers/poky/meta-yocto \ + " +Where the ${HOME} is the path to your home directory. + +##### Customize the build configuration +The variables you need to customize: +* MACHINE + +[MACHINE]: +Defines the target build machine. In our case, it is zynq-hdmi_out-zynq7. +Modify the conf/local.conf to correct MACHINE with the following commands. + + $ sed -i "s/MACHINE ??= \"qemux86\"/MACHINE ?= \"${target_machine}\"/" conf/local.conf + +or you can use text editor replacing the following + + MACHINE ?= "qemux86" + +with + + MACHINE ?= "zybo-linux-bd-zynq7" + +Optional variables you may want to customize: +* DL_DIR +* SSTATE_DIR +* TMPDIR +* PACKAGE_CLASSES + +[DL_DIR]: +Defines where the upstream source code tarballs are stored. This allows multiple +builds without re-download the source code again. + +[SSTATE_DIR]: +Defines where to store the shared state files. It also allows multiple build +share the same state files and speed up the build processes. + +[TMPDIR]: +Define where to store the build outputs. Not recommended to share with other +builds. + +[PACKAGE_CLASSES] +Defines which packing formats to enable and used in the system. + +[Useful link](http://www.yoctoproject.org/docs/2.0/ref-manual/ref-manual.html#speeding-up-the-build) to speed up the build. + +##### Set up preferred kernel and u-boot +Since there are multiple u-boot/kernel recipes can be use for zynq-linux-bd-zynq7 +machine. We will need to define the preferred provider by adding the following +lines to conf/local.conf file + + PREFERRED_PROVIDER_virtual/bootloader = "u-boot-digilent" + PREFERRED_PROVIDER_u-boot = "u-boot-digilent" + PREFERRED_PROVIDER_virtual/kernel = "linux-digilent" + PREFERRED_PROVIDER_virtual/boot-bin = "u-boot-digilent" + +or + + $ echo 'PREFERRED_PROVIDER_virtual/bootloader = "u-boot-digilent"' >> conf/local.conf + $ echo 'PREFERRED_PROVIDER_u-boot = "u-boot-digilent"' >> conf/local.conf + $ echo 'PREFERRED_PROVIDER_virtual/kernel = "linux-digilent"' >> conf/local.conf + $ echo 'PREFERRED_PROVIDER_virtual/boot-bin = "u-boot-digilent"' >> conf/local.conf + +Note: currently supported kernel and u-boot recipe are as follows table: + +recipe name| Description +--- | --- +linux-digilent | Stable kernel that has been tested - fixed commit id +linux-digilent-dev | base on latest commit of [linux-digilent](https://github.com/Digilent/u-boot-digilent) master branch +u-boot-digilent | Stable U-Boot that has been tested - fixed commit id +u-boot-digilent-dev | base on latest commit of [u-boot-digilent](https://github.com/Digilent/u-boot-digilent) master branch + +##### Including additional pacakges +An example of adding mtd-utils to the image. Add the following line to +conf/local.conf file + + IMAGE_INSTALL_append = " mtd-utils" + +Another example of adding kernel modules to the rootfs. Add the following line to +conf/local.conf file + + IMAGE_INSTALL_append = " kernel-modules" + +##### Kernel configuration +Enter kernel menuconfig for the preferred kernel. + + $ bitbake virtual/kernel -c menuconfig + +or specific kernel receipt + + $ bitbake linux-digilent-dev -c menuconfig + +### Build +This section provides the basic yocto build + +#### Yocto default images types +Yocto poky distribution provides a set of reference image recipe to create +your own distribution. You can find them under poky directory. In here, we +only try to build **core-imiage-minimal** and **core-imiage-sato** + +##### minimal image +A image provides a console based Linux OS. Build core-image-minimal run: + + $ bitbake core-image-minimal + +Intall alsa-utils to test the audio on the zybo-linux-bd-zynq7 machine +(still issues, please refer to the known issue section for detail) by adding +"alsa-utils" to IMAGE_INSTALL_append variable in the conf/local.conf file + + IMAGE_INSTALL_append = " mtd-utils alsa-utils" + +##### sato image +Image with Sato, a mobile environment and visual style for mobile devices. +The image supports X11 with a Sato theme, Pimlico applications, and contains +terminal, editor, and file manager. To build it run: + + $ bitbake core-image-sato + +You can also append xterm to the image by adding the "xterm" to +IMAGE_INSTALL_append variable in conf/local.conf file. e.g. + + IMAGE_INSTALL_append = " mtd-utils xterm" + +#### build products +if you did not specify your own TMPDIR in local.conf, the default TMPDIR is under the +build directory, in this case, it should ${HOME}/tmp/${target_machine}/tmp. Image stores +at {HOME}/tmp/${target_machine}/tmp/deploy/images/zybo-linux-bd-zynq7. You can find a +list of build images in the directory. + + ${IMG_TYPE} refers to the build image, for example, core-image-minimal. + ${target_machine} refers to zybo-linux-bd-zynq7 in this example. + +File | Description +--- | --- +boot.bin | Zynq Boot Image that only contents the U-Boot SPL +download.bit | FPGA bitstream if applicable +fit.itb | fitImage with kernel + dtb + rootfs +sdroot-fitImage | fitImage with modified dtb which use use SD root (second partition of SD) +uImage | U-Boot image format of kernel image +linux.bin | Linux kernel in binary format +modules-${target_machine}.tgz | Kernel modules +sdimg | SD card image that can be used to program SD with dd (Linux/MAC) or Win32DiskImage(Windows) +system.dtb | Device Tree Binary (DTB) +uImage-its-${target_machine}.its | its that used to create the fitImage +u-boot.bin | U-Boot binary file +u-boot-dtb.bin | U-Boot binary file with DTB +u-boot-dtb.img | U-Boot image format of u-boot-dtb.bin +u-boot-spl.bin | SPL Preloader Binary +${IMG_TYPE}-${target_machine}.cpio | Root filesystem in cpio archive format +${IMG_TYPE}-${target_machine}.cpio.gz.uboot | Root filesystem in U-Boot image format with compression +${IMG_TYPE}-${target_machine}.ext4 | Root filesystem as ext4 image + + + +### Useful commands +Show list of package available in the yocto recipes + + $ bitbake -s +or + + $ bitbake-layers show-recipes + +Removes all output files and shared state cache for a target. Becareful +of using this command. This will force everything to be rebuild from scratch. + + $ bitbake cleansstate + +Removes all output files and shared state cache for a recipe + + $ bitbake -c cleansstate + +Build specific pkg, linux-digilent-dev as an example: + + $ bitbake linux-digilent-dev + + +List out the task available for a recipe, linux-digilent-dev as an example: + + $ bitbake -c listtasks linux-digilent-dev + +Run specific task for a recipe, linux-digilent-dev as an example: + + $ bitbake -c deploy linux-digilent-dev diff --git a/sources/tech/20170111 Git in 2016.md b/sources/tech/20170111 Git in 2016.md new file mode 100644 index 0000000000..95df7aa668 --- /dev/null +++ b/sources/tech/20170111 Git in 2016.md @@ -0,0 +1,726 @@ + + +Git in 2016 +============================================================ + + ![](https://cdn-images-1.medium.com/max/2000/1*1SiSsLMsNSyAk6khb63W9g.png) + + +Git had a  _huge_  year in 2016, with five feature releases[¹][57] ( _v2.7_  through  _v2.11_ ) and sixteen patch releases[²][58]. 189 authors[³][59] contributed 3,676 commits[⁴][60] to `master`, which is up 15%[⁵][61] over 2015! In total, 1,545 files were changed with 276,799 lines added and 100,973 lines removed[⁶][62]. + +However, commit counts and LOC are pretty terrible ways to measure productivity. Until deep learning develops to the point where it can qualitatively grok code, we’re going to be stuck with human judgment as the arbiter of productivity. + +With that in mind, I decided to put together a retrospective of sorts that covers changes improvements made to six of my favorite Git features over the course of the year. This article is pretty darn long for a Medium post, so I will forgive you if you want to skip ahead to a feature that particularly interests you: + +* [Rounding out the ][41]`[git worktree][25]`[ command][42] +* [More convenient ][43]`[git rebase][26]`[ options][44] +* [Dramatic performance boosts for ][45]`[git lfs][27]` +* [Experimental algorithms and better defaults for ][46]`[git diff][28]` +* `[git submodules][29]`[ with less suck][47] +* [Nifty enhancements to ][48]`[git stash][30]` + +Before we begin, note that many operating systems ship with legacy versions of Git, so it’s worth checking that you’re on the latest and greatest. If running `git --version` from your terminal returns anything less than Git `v2.11.0`, head on over to Atlassian's quick guide to [upgrade or install Git][63] on your platform of choice. + +### [`Citation` needed] + +One more quick stop before we jump into the qualitative stuff: I thought I’d show you how I generated the statistics from the opening paragraph (and the rather over-the-top cover image). You can use the commands below to do a quick  _year in review_  for your own repositories as well! + +``` +¹ Tags from 2016 matching the form vX.Y.0 +``` + +``` +$ git for-each-ref --sort=-taggerdate --format \ +'%(refname) %(taggerdate)' refs/tags | grep "v\d\.\d*\.0 .* 2016" +``` + +``` +² Tags from 2016 matching the form vX.Y.Z +``` + +``` +$ git for-each-ref --sort=-taggerdate --format '%(refname) %(taggerdate)' refs/tags | grep "v\d\.\d*\.[^0] .* 2016" +``` + +``` +³ Commits by author in 2016 +``` + +``` +$ git shortlog -s -n --since=2016-01-01 --until=2017-01-01 +``` + +``` +⁴ Count commits in 2016 +``` + +``` +$ git log --oneline --since=2016-01-01 --until=2017-01-01 | wc -l +``` + +``` +⁵ ... and in 2015 +``` + +``` +$ git log --oneline --since=2015-01-01 --until=2016-01-01 | wc -l +``` + +``` +⁶ Net LOC added/removed in 2016 +``` + +``` +$ git diff --shortstat `git rev-list -1 --until=2016-01-01 master` \ + `git rev-list -1 --until=2017-01-01 master` +``` + +The commands above were are run on Git’s `master` branch, so don’t represent any unmerged work on outstanding branches. If you use these command, remember that commit counts and LOC are not metrics to live by. Please don’t use them to rate the performance of your teammates! + +And now, on with the retrospective… + +### Rounding out Git worktrees + +The `git worktree` command first appeared in Git v2.5 but had some notable enhancements in 2016\. Two valuable new features were introduced in v2.7 — the `list` subcommand, and namespaced refs for bisecting — and the `lock`/`unlock` subcommands were implemented in v2.10. + +#### What’s a worktree again? + +The `[git worktree][49]` command lets you check out and work on multiple repository branches in separate directories simultaneously. For example, if you need to make a quick hotfix but don't want to mess with your working copy, you can check out a new branch in a new directory with: + +``` +$ git worktree add -b hotfix/BB-1234 ../hotfix/BB-1234 +Preparing ../hotfix/BB-1234 (identifier BB-1234) +HEAD is now at 886e0ba Merged in bedwards/BB-13430-api-merge-pr (pull request #7822) +``` + +Worktrees aren’t just for branches. You can check out multiple tags as different worktrees in order to build or test them in parallel. For example, I created worktrees from the Git v2.6 and v2.7 tags in order to examine the behavior of different versions of Git: + +``` +$ git worktree add ../git-v2.6.0 v2.6.0 +Preparing ../git-v2.6.0 (identifier git-v2.6.0) +HEAD is now at be08dee Git 2.6 +``` + +``` +$ git worktree add ../git-v2.7.0 v2.7.0 +Preparing ../git-v2.7.0 (identifier git-v2.7.0) +HEAD is now at 7548842 Git 2.7 +``` + +``` +$ git worktree list +/Users/kannonboy/src/git 7548842 [master] +/Users/kannonboy/src/git-v2.6.0 be08dee (detached HEAD) +/Users/kannonboy/src/git-v2.7.0 7548842 (detached HEAD) +``` + +``` +$ cd ../git-v2.7.0 && make +``` + +You could use the same technique to build and run different versions of your own applications side-by-side. + +#### Listing worktrees + +The `git worktree list` subcommand (introduced in Git v2.7) displays all of the worktrees associated with a repository: + +``` +$ git worktree list +/Users/kannonboy/src/bitbucket/bitbucket 37732bd [master] +/Users/kannonboy/src/bitbucket/staging d5924bc [staging] +/Users/kannonboy/src/bitbucket/hotfix-1234 37732bd [hotfix/1234] +``` + +#### Bisecting worktrees + +`[git bisect][50]` is a neat Git command that lets you perform a binary search of your commit history. It's usually used to find out which commit introduced a particular regression. For example, if a test is failing on the tip commit of my `master` branch, I can use `git bisect` to traverse the history of my repository looking for the commit that first broke it: + +``` +$ git bisect start +``` + +``` +# indicate the last commit known to be passing the tests +# (e.g. the latest release tag) +$ git bisect good v2.0.0 +``` + +``` +# indicate a known broken commit (e.g. the tip of master) +$ git bisect bad master +``` + +``` +# tell git bisect a script/command to run; git bisect will +# find the oldest commit between "good" and "bad" that causes +# this script to exit with a non-zero status +$ git bisect run npm test +``` + +Under the hood, bisect uses refs to track the good and bad commits used as the upper and lower bounds of the binary search range. Unfortunately for worktree fans, these refs were stored under the generic `.git/refs/bisect`namespace, meaning that `git bisect` operations that are run in different worktrees could interfere with each other. + +As of v2.7, the bisect refs have been moved to`.git/worktrees/$worktree_name/refs/bisect`, so you can run bisect operations concurrently across multiple worktrees. + +#### Locking worktrees + +When you’re finished with a worktree, you can simply delete it and then run `git worktree prune` or wait for it to be garbage collected automatically. However, if you're storing a worktree on a network share or removable media, then it will be cleaned up if the worktree directory isn't accessible during pruning — whether you like it or not! Git v2.10 introduced the `git worktree lock` and `unlock` subcommands to prevent this from happening: + +``` +# to lock the git-v2.7 worktree on my USB drive +$ git worktree lock /Volumes/Flash_Gordon/git-v2.7 --reason \ +"In case I remove my removable media" +``` + +``` +# to unlock (and delete) the worktree when I'm finished with it +$ git worktree unlock /Volumes/Flash_Gordon/git-v2.7 +$ rm -rf /Volumes/Flash_Gordon/git-v2.7 +$ git worktree prune +``` + +The `--reason` flag lets you leave a note for your future self, describing why the worktree is locked. `git worktree unlock` and `lock` both require you to specify the path to the worktree. Alternatively, you can `cd` to the worktree directory and run `git worktree lock .` for the same effect. + +### More Git r`ebase` options + +In March, Git v2.8 added the ability to interactively rebase whilst pulling with a `git pull --rebase=interactive`. Conversely, June's Git v2.9 release implemented support for performing a rebase exec without needing to drop into interactive mode via `git rebase -x`. + +#### Re-wah? + +Before we dive in, I suspect there may be a few readers who aren’t familiar or completely comfortable with the rebase command or interactive rebasing. Conceptually, it’s pretty simple, but as with many of Git’s powerful features, the rebase is steeped in some complex-sounding terminology. So, before we dive in, let’s quickly review what a rebase is. + +Rebasing means rewriting one or more commits on a particular branch. The `git rebase` command is heavily overloaded, but the name rebase originates from the fact that it is often used to change a branch's base commit (the commit that you created the branch from). + +Conceptually, rebase unwinds the commits on your branch by temporarily storing them as a series of patches, and then reapplying them in order on top of the target commit. + + + ![](https://cdn-images-1.medium.com/max/800/1*mgyl38slmqmcE4STS56nXA.gif) + +Rebasing a feature branch on master (`git rebase master`) is a great way to "freshen" your feature branch with the latest changes from master. For long-lived feature branches, regular rebasing minimizes the chance and severity of conflicts down the road. + +Some teams also choose to rebase immediately before merging their changes onto master in order to achieve a fast-forward merge (`git merge --ff ` ). Fast-forwarding merges your commits onto master by simply making the master ref point at the tip of your rewritten branch without creating a merge commit: + + ![](https://cdn-images-1.medium.com/max/800/1*QXa3znQiuNWDjxroX628VA.gif) + +Rebasing is so convenient and powerful that it has been baked into some other common Git commands, such as `git pull`. If you have some unpushed changes on your local master branch, running `git pull` to pull your teammates' changes from the origin will create an unnecessary merge commit: + + ![](https://cdn-images-1.medium.com/max/800/1*IxDdJ5CygvSWdD8MCNpZNg.gif) + +This is kind of messy, and on busy teams, you’ll get heaps of these unnecessary merge commits. `git pull --rebase` rebases your local changes on top of your teammates' without creating a merge commit: + + + ![](https://cdn-images-1.medium.com/max/800/1*HcroDMwBE9m21-hOeIwRmw.gif) + +This is pretty neat! Even cooler, Git v2.8 introduced a feature that lets you rebase  _interactively_  whilst pulling. + +#### Interactive rebasing + +Interactive rebasing is a more powerful form of rebasing. Like a standard rebase, it rewrites commits, but it also gives you a chance to modify them interactively as they are reapplied onto the new base. + +When you run `git rebase --interactive` (or `git pull --rebase=interactive`), you'll be presented with a list of commits in your text editor of choice: + +``` +$ git rebase master --interactive +``` + +``` +pick 2fde787 ACE-1294: replaced miniamalCommit with string in test +pick ed93626 ACE-1294: removed pull request service from test +pick b02eb9a ACE-1294: moved fromHash, toHash and diffType to batch +pick e68f710 ACE-1294: added testing data to batch email file +``` + +``` +# Rebase f32fa9d..0ddde5f onto f32fa9d (4 commands) +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup = like "squash", but discard this commit's log message +# x, exec = run command (the rest of the line) using shell +# d, drop = remove commit +# +# These lines can be re-ordered; they are executed from top to +# bottom. +# +# If you remove a line here THAT COMMIT WILL BE LOST. +``` + +Notice that each commit has the word `pick` next to it. That's rebase-speak for, "Keep this commit as-is." If you quit your text editor now, it will perform a normal rebase as described in the last section. However, if you change `pick` to `edit` or one of the other rebase commands, rebase will let you mutate the commit before it is reapplied! There are several available rebase commands: + +* `reword`: Edit the commit message. +* `edit`: Edit the files that were committed. +* `squash`: Combine the commit with the previous commit (the one above it in the file), concatenating the commit messages. +* `fixup`: Combine the commit with the commit above it, and uses the previous commit's log message verbatim (this is handy if you created a second commit for a small change that should have been in the original commit, i.e., you forgot to stage a file). +* `exec`: Run an arbitrary shell command (we'll look at a neat use-case for this later, in the next section). +* `drop`: This kills the commit. + +You can also reorder commits within the file, which changes the order in which they’re reapplied. This is handy if you have interleaved commits that are addressing different topics and you want to use `squash` or `fixup` to combine them into logically atomic commits. + +Once you’ve set up the commands and saved the file, Git will iterate through each commit, pausing at each `reword` and `edit` for you to make your desired changes and automatically applying any `squash`, `fixup`, `exec`, and `drop` commands for you. + +#### Non-interactive exec + +When you rebase, you’re essentially rewriting history by applying each of your new commits on top of the specified base. `git pull --rebase` can be a little risky because depending on the nature of the changes from the upstream branch, you may encounter test failures or even compilation problems for certain commits in your newly created history. If these changes cause merge conflicts, the rebase process will pause and allow you to resolve them. However, changes that merge cleanly may still break compilation or tests, leaving broken commits littering your history. + +However, you can instruct Git to run your project’s test suite for each rewritten commit. Prior to Git v2.9, you could do this with a combination of `git rebase −−interactive` and the `exec` command. For example, this: + +``` +$ git rebase master −−interactive −−exec=”npm test” +``` + +…would generate an interactive rebase plan that invokes `npm test` after rewriting each commit, ensuring that your tests still pass: + +``` +pick 2fde787 ACE-1294: replaced miniamalCommit with string in test +exec npm test +pick ed93626 ACE-1294: removed pull request service from test +exec npm test +pick b02eb9a ACE-1294: moved fromHash, toHash and diffType to batch +exec npm test +pick e68f710 ACE-1294: added testing data to batch email file +exec npm test +``` + +``` +# Rebase f32fa9d..0ddde5f onto f32fa9d (4 command(s)) +``` + +In the event that a test fails, rebase will pause to let you fix the tests (and apply your changes to that commit): + +``` +291 passing +1 failing +``` + +``` +1) Host request “after all” hook: +Uncaught Error: connect ECONNRESET 127.0.0.1:3001 +… +npm ERR! Test failed. +Execution failed: npm test +You can fix the problem, and then run + git rebase −−continue +``` + +This is handy, but needing to do an interactive rebase is a bit clunky. As of Git v2.9, you can perform a non-interactive rebase exec, with: + +``` +$ git rebase master -x “npm test” +``` + +Just replace `npm test` with `make`, `rake`, `mvn clean install`, or whatever you use to build and test your project. + +#### A word of warning + +Just like in the movies, rewriting history is risky business. Any commit that is rewritten as part of a rebase will have it’s SHA-1 ID changed, which means that Git will treat it as a totally different commit. If rewritten history is mixed with the original history, you’ll get duplicate commits, which can cause a lot of confusion for your team. + +To avoid this problem, you only need to follow one simple rule: + +> _Never rebase a commit that you’ve already pushed!_ + +Stick to that and you’ll be fine. + +### Performance boosts for `Git LFS` + +[Git is a distributed version control system][64], meaning the entire history of the repository is transferred to the client during the cloning process. For projects that contain large files — particularly large files that are modified regularly _ — _ the initial clone can be expensive, as every version of every file has to be downloaded by the client. [Git LFS (Large File Storage)][65] is a Git extension developed by Atlassian, GitHub, and a few other open source contributors that reduces the impact of large files in your repository by downloading the relevant versions of them lazily. Specifically, large files are downloaded as needed during the checkout process rather than during cloning or fetching. + +Alongside Git’s five huge releases in 2016, Git LFS had four feature-packed releases of its own: v1.2 through v1.5. You could write a retrospective series on Git LFS in its own right, but for this article, I’m going to focus on one of the most important themes tackled in 2016: speed. A series of improvements to both Git and Git LFS have greatly improved the performance of transferring files to and from the server. + +#### Long-running filter processes + +When you `git add` a file, Git's system of clean filters can be used to transform the file’s contents before being written to the Git object store. Git LFS reduces your repository size by using a clean filter to squirrel away large file content in the LFS cache and adds a tiny “pointer” file to the Git object store instead. + + + ![](https://cdn-images-1.medium.com/max/800/0*Ku328eca7GLOo7sS.png) + +Smudge filters are the opposite of clean filters — hence the name. When file content is read from the Git object store during a `git checkout`, smudge filters have a chance to transform it before it’s written to the user’s working copy. The Git LFS smudge filter transforms pointer files by replacing them with the corresponding large file, either from your LFS cache or by reading through to your Git LFS store on Bitbucket. + +![](https://cdn-images-1.medium.com/max/800/0*CU60meE1lbCuivn7.png) + +Traditionally, smudge and clean filter processes were invoked once for each file that was being added or checked out. So, a project with 1,000 files tracked by Git LFS invoked the `git-lfs-smudge` command 1,000 times for a fresh checkout! While each operation is relatively quick, the overhead of spinning up 1,000 individual smudge processes is costly. + +As of Git v2.11 (and Git LFS v1.5), smudge and clean filters can be defined as long-running processes that are invoked once for the first filtered file, then fed subsequent files that need smudging or cleaning until the parent Git operation exits. [Lars Schneider][66], who contributed long-running filters to Git, neatly summarized the impact of the change on Git LFS performance: + +> The filter process is 80x faster on macOS and 58x faster on Windows for the test repo with 12k files. On Windows, that means the tests runs in 57 seconds instead of 55 minutes! + +That’s a seriously impressive performance gain! + +#### Specialized LFS clones + +Long-running smudge and clean filters are great for speeding up reads and writes to the local LFS cache, but they do little to speed up transferring of large objects to and from your Git LFS server. Each time the Git LFS smudge filter can’t find a file in the local LFS cache, it has to make two HTTP calls to retrieve it: one to locate the file and one to download it. During a `git clone`, your local LFS cache is empty, so Git LFS will naively make two HTTP calls for every LFS tracked file in your repository: + + + ![](https://cdn-images-1.medium.com/max/800/0*ViL7r3ZhkGvF0z3-.png) + +Fortunately, Git LFS v1.2 shipped the specialized `[git lfs clone][51]` command. Rather than downloading files one at a time; `git lfs clone` disables the Git LFS smudge filter, waits until the checkout is complete, and then downloads any required files as a batch from the Git LFS store. This allows downloads to be parallelized and halves the number of required HTTP requests: + + ![](https://cdn-images-1.medium.com/max/800/0*T43VA0DYTujDNgkH.png) + +### Custom Transfer Adapters + +As discussed earlier, Git LFS shipped support for long running filter processes in v1.5\. However, support for another type of pluggable process actually shipped earlier in the year. Git LFS v1.3 included support for pluggable transfer adapters so that different Git LFS hosting services could define their own protocols for transferring files to and from LFS storage. + +As of the end of 2016, Bitbucket is the only hosting service to implement their own Git LFS transfer protocol via the [Bitbucket LFS Media Adapter][67]. This was done to take advantage of a unique feature of Bitbucket’s LFS storage API called chunking. Chunking means large files are broken down into 4MB chunks before uploading or downloading. + ![](https://cdn-images-1.medium.com/max/800/1*N3SpjQZQ1Ge8OwvWrtS1og.gif) + +Chunking gives Bitbucket’s Git LFS support three big advantages: + +1. Parallelized downloads and uploads. By default, Git LFS transfers up to three files in parallel. However, if only a single file is being transferred (which is the default behavior of the Git LFS smudge filter), it is transferred via a single stream. Bitbucket’s chunking allows multiple chunks from the same file to be uploaded or downloaded simultaneously, often dramatically improving transfer speed. +2. Resumable chunk transfers. File chunks are cached locally, so if your download or upload is interrupted, Bitbucket’s custom LFS media adapter will resume transferring only the missing chunks the next time you push or pull. +3. Deduplication. Git LFS, like Git itself, is content addressable; each LFS file is identified by a SHA-256 hash of its contents. So, if you flip a single bit, the file’s SHA-256 changes and you have to re-upload the entire file. Chunking allows you to re-upload only the sections of the file that have actually changed. To illustrate, imagine we have a 41MB spritesheet for a video game tracked in Git LFS. If we add a new 2MB layer to the spritesheet and commit it, we’d typically need to push the entire new 43MB file to the server. However, with Bitbucket’s custom transfer adapter, we only need to push ~7Mb: the first 4MB chunk (because the file’s header information will have changed) and the last 3MB chunk containing the new layer we’ve just added! The other unchanged chunks are skipped automatically during the upload process, saving a huge amount of bandwidth and time. + +Customizable transfer adapters are a great feature for Git LFS, as they allow different hosts to experiment with optimized transfer protocols to suit their services without overloading the core project. + +### Better `git diff` algorithms and defaults + +Unlike some other version control systems, Git doesn’t explicitly store the fact that files have been renamed. For example, if I edited a simple Node.js application and renamed `index.js` to `app.js` and then ran `git diff`, I’d get back what looks like a file deletion and an addition: + + + ![](https://cdn-images-1.medium.com/max/800/1*ohMUBpSh_jqz2ffScJ7ApQ.png) + +I guess moving or renaming a file is technically just a delete followed by an add, but this isn’t the most human-friendly way to show it. Instead, you can use the `-M` flag to instruct Git to attempt to detect renamed files on the fly when computing a diff. For the above example, `git diff -M` gives us: + + ![](https://cdn-images-1.medium.com/max/800/1*ywYjxBc1wii5O8EhHbpCTA.png) + +The similarity index on the second line tells us how similar the content of the files compared was. By default, `-M` will consider any two files that are more than 50% similar. That is, you need to modify less than 50% of their lines to make them identical as a renamed file. You can choose your own similarity index by appending a percentage, i.e., `-M80%`. + +As of Git v2.9, the `git diff` and `git log` commands will both detect renames by default as if you'd passed the `-M` flag. If you dislike this behavior (or, more realistically, are parsing the diff output via a script), then you can disable it by explicitly passing the `−−no-renames` flag. + +#### Verbose Commits + +Do you ever invoke `git commit` and then stare blankly at your shell trying to remember all the changes you just made? The verbose flag is for you! + +Instead of: + +``` +Ah crap, which dependency did I just rev? +``` + +``` +# Please enter the commit message for your changes. Lines starting +# with ‘#’ will be ignored, and an empty message aborts the commit. +# On branch master +# Your branch is up-to-date with ‘origin/master’. +# +# Changes to be committed: +# new file: package.json +# +``` + +…you can invoke `git commit −−verbose` to view an inline diff of your changes. Don’t worry, it won’t be included in your commit message: + + + ![](https://cdn-images-1.medium.com/max/800/1*1vOYE2ow3ZDS8BP_QfssQw.png) + +The `−−verbose` flag isn’t new, but as of Git v2.9 you can enable it permanently with `git config --global commit.verbose true`. + +#### Experimental Diff Improvements + +`git diff` can produce some slightly confusing output when the lines before and after a modified section are the same. This can happen when you have two or more similarly structured functions in a file. For a slightly contrived example, imagine we have a JS file that contains a single function: + +``` +/* @return {string} "Bitbucket" */ +function productName() { + return "Bitbucket"; +} +``` + +Now imagine we’ve committed a change that prepends  _another_  function that does something similar: + +``` +/* @return {string} "Bitbucket" */ +function productId() { + return "Bitbucket"; +} +``` + +``` +/* @return {string} "Bitbucket" */ +function productName() { + return "Bitbucket"; +} +``` + +You’d expect `git diff` to show the top five lines as added, but it actually incorrectly attributes the very first line to the original commit: + + + ![](https://cdn-images-1.medium.com/max/800/1*9C7DWMObGHMEqD-QFGHmew.png) + +The wrong comment is included in the diff! Not the end of the world, but the couple of seconds of cognitive overhead from the  _Whaaat?_  every time this happens can add up. + +In December, Git v2.11 introduced a new experimental diff option, `--indent-heuristic`, that attempts to produce more aesthetically pleasing diffs: + + + ![](https://cdn-images-1.medium.com/max/800/1*UyWZ6JjC-izDquyWCA4bow.png) + +Under the hood, `--indent-heuristic` cycles through the possible diffs for each change and assigns each a “badness” score. This is based on heuristics like whether the diff block starts and ends with different levels of indentation (which is aesthetically bad) and whether the diff block has leading and trailing blank lines (which is aesthetically pleasing). Then, the block with the lowest badness score is output. + +This feature is experimental, but you can test it out ad-hoc by applying the `--indent-heuristic` option to any `git diff` command. Or, if you like to live on the bleeding edge, you can enable it across your system with: + +``` +$ git config --global diff.indentHeuristic true +``` + +### Submodules with less suck + +Submodules allow you to reference and include other Git repositories from inside your Git repository. This is commonly used by some projects to manage source dependencies that are also tracked in Git, or by some companies as an alternative to a [monorepo][68] containing a collection of related projects. + +Submodules get a bit of a bad rap due to some usage complexities and the fact that it’s reasonably easy to break them with an errant command. + + + ![](https://cdn-images-1.medium.com/max/800/1*xNffiElY7BZNMDM0jm0JNQ.gif) + +However, they do have their uses and are, I think, still the best choice for vendoring dependencies. Fortunately, 2016 was a great year to be a submodule user, with some significant performance and feature improvements landing across several releases. + +#### Parallelized fetching + +When cloning or fetching a repository, appending the `--recurse-submodules`option means any referenced submodules will be cloned or updated, as well. Traditionally, this was done serially, with each submodule being fetched one at a time. As of Git v2.8, you can append the `--jobs=n` option to fetch submodules in  _n_  parallel threads. + +I recommend configuring this option permanently with: + +``` +$ git config --global submodule.fetchJobs 4 +``` + +…or whatever degree of parallelization you choose to use. + +#### Shallow submodules + +Git v2.9 introduced the `git clone -−shallow-submodules` flag. It allows you to grab a full clone of your repository and then recursively shallow clone any referenced submodules to a depth of one commit. This is useful if you don’t need the full history of your project’s dependencies. + +For example, consider a repository with a mixture of submodules containing vendored dependencies and other projects that you own. You may wish to clone with shallow submodules initially and then selectively deepen the few projects you want to work with. + +Another scenario would be configuring a continuous integration or deployment job. Git needs the super repository as well as the latest commit from each of your submodules in order to actually perform the build. However, you probably don’t need the full history for every submodule, so retrieving just the latest commit will save you both time and bandwidth. + +#### Submodule alternates + +The `--reference` option can be used with `git clone` to specify another local repository as an alternate object store to save recopying objects over the network that you already have locally. The syntax is: + +``` +$ git clone --reference +``` + +As of Git v2.11, you can use the `--reference` option in combination with `--recurse-submodules` to set up submodule alternates pointing to submodules from another local repository. The syntax is: + +``` +$ git clone --recurse-submodules --reference +``` + +This can potentially save a huge amount of bandwidth and local disk but it will fail if the referenced local repository does not have all the required submodules of the remote repository that you’re cloning from. + +Fortunately, the handy `--reference-if-able` option will fail gracefully and fall back to a normal clone for any submodules that are missing from the referenced local repository: + +``` +$ git clone --recurse-submodules --reference-if-able \ + +``` + +#### Submodule diffs + +Prior to Git v2.11, Git had two modes for displaying diffs of commits that updated your repository’s submodules: + +`git diff --submodule=short` displays the old commit and new commit from the submodule referenced by your project (this is also the default if you omit the `--submodule` option altogether): + + ![](https://cdn-images-1.medium.com/max/800/1*K71cJ30NokO5B69-a470NA.png) + +`git diff --submodule=log` is slightly more verbose, displaying the summary line from the commit message of any new or removed commits in the updated submodule: + + + ![](https://cdn-images-1.medium.com/max/800/1*frvsd_T44De8_q0uvNHB1g.png) + +Git v2.11 introduces a third much more useful option: `--submodule=diff`. This displays a full diff of all changes in the updated submodule: + + ![](https://cdn-images-1.medium.com/max/800/1*nPhJTjP8tcJ0cD8s3YOmjw.png) + +### Nifty enhancements to `git stash` + +Unlike submodules, `[git stash][52]` is almost universally beloved by Git users. `git stash` temporarily shelves (or  _stashes_ ) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on. + +#### Autostash + +If you’re a fan of `git rebase`, you might be familiar with the `--autostash`option. It automatically stashes any local changes made to your working copy before rebasing and reapplies them after the rebase is completed. + +``` +$ git rebase master --autostash +Created autostash: 54f212a +HEAD is now at 8303dca It's a kludge, but put the tuple from the database in the cache. +First, rewinding head to replay your work on top of it... +Applied autostash. +``` + +This is handy, as it allows you to rebase from a dirty worktree. There’s also a handy config flag named `rebase.autostash` to make this behavior the default, which you can enable globally with: + +``` +$ git config --global rebase.autostash true +``` + +`rebase.autostash` has actually been available since [Git v1.8.4][69], but v2.7 introduces the ability to cancel this flag with the `--no-autostash` option. If you use this option with unstaged changes, the rebase will abort with a dirty worktree warning: + +``` +$ git rebase master --no-autostash +Cannot rebase: You have unstaged changes. +Please commit or stash them. +``` + +#### Stashes as Patches + +Speaking of config flags, Git v2.7 also introduces `stash.showPatch`. The default behavior of `git stash show` is to display a summary of your stashed files. + +``` +$ git stash show +package.json | 2 +- +1 file changed, 1 insertion(+), 1 deletion(-) +``` + +Passing the `-p` flag puts `git stash show` into "patch mode," which displays the full diff: + + ![](https://cdn-images-1.medium.com/max/800/1*HpcT3quuKKQj9CneqPuufw.png) + +`stash.showPatch` makes this behavior the default. You can enable it globally with: + +``` +$ git config --global stash.showPatch true +``` + +If you enable `stash.showPatch` but then decide you want to view just the file summary, you can get the old behavior back by passing the `--stat` option instead. + +``` +$ git stash show --stat +package.json | 2 +- +1 file changed, 1 insertion(+), 1 deletion(-) +``` + +As an aside: `--no-patch` is a valid option but it doesn't negate `stash.showPatch` as you'd expect. Instead, it gets passed along to the underlying `git diff` command used to generate the patch, and you'll end up with no output at all! + +#### Simple Stash IDs + +If you’re a `git stash` fan, you probably know that you can shelve multiple sets of changes, and then view them with `git stash list`: + +``` +$ git stash list +stash@{0}: On master: crazy idea that might work one day +stash@{1}: On master: desperate samurai refactor; don't apply +stash@{2}: On master: perf improvement that I forgot I stashed +stash@{3}: On master: pop this when we use Docker in production +``` + +However, you may not know why Git’s stashes have such awkward identifiers (`stash@{1}`, `stash@{2}`, etc.) and may have written them off as "just one of those Git idiosyncrasies." It turns out that like many Git features, these weird IDs are actually a symptom of a very clever use (or abuse) of the Git data model. + +Under the hood, the `git stash` command actually creates a set of special commit objects that encode your stashed changes and maintains a [reflog][70]that holds references to these special commits. This is why the output from `git stash list` looks a lot like the output from the `git reflog` command. When you run `git stash apply stash@{1}`, you're actually saying, “Apply the commit at position 1 from the stash reflog.” + +As of Git v2.11, you no longer have to use the full `stash@{n}` syntax. Instead, you can reference stashes with a simple integer indicating their position in the stash reflog: + +``` +$ git stash show 1 +$ git stash apply 1 +$ git stash pop 1 +``` + +And so forth. If you’d like to learn more about how stashes are stored, I wrote a little bit about it in [this tutorial][71]. + +### <2017> + +And we’re done. Thanks for reading! I hope you enjoyed reading this behemoth as much as I enjoyed spelunking through Git’s source code, release notes, and `man` pages to write it. If you think I missed anything big, please leave a comment or let me know [on Twitter][72] and I'll endeavor to write a follow-up piece. + +As for what’s next for Git, that’s up to the maintainers and contributors (which [could be you!][73]). With ever-increasing adoption, I’m guessing that simplification, improved UX, and better defaults will be strong themes for Git in 2017\. As Git repositories get bigger and older, I suspect we’ll also see continued focus on performance and improved handling of large files, deep trees, and long histories. + +If you’re into Git and excited to meet some of the developers behind the project, consider coming along to [Git Merge][74] in Brussels in a few weeks time. I’m [speaking there][75]! But more importantly, many of the developers who maintain Git will be in attendance for the conference and the annual Git Contributors Summit, which will likely drive much of the direction for the year ahead. + +Or if you can’t wait ’til then, head over to Atlassian’s excellent selection of [Git tutorials][76] for more tips and tricks to improve your workflow. + + _If you scrolled to the end looking for the footnotes from the first paragraph, please jump to the _ [ _[Citation needed]_ ][77] _ section for the commands used to generate the stats. Gratuitous cover image generated using _ [ _instaco.de_ ][78] _ ❤️_ + + +-------------------------------------------------------------------------------- + +via: https://hackernoon.com/git-in-2016-fad96ae22a15#.t5c5cm48f + +作者:[Tim Pettersen][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://hackernoon.com/@kannonboy?source=post_header_lockup +[1]:https://medium.com/@g.kylafas/the-git-config-command-is-missing-a-yes-at-the-end-as-in-git-config-global-commit-verbose-yes-7e126365750e?source=responses---------1---------- +[2]:https://medium.com/@kannonboy/thanks-giorgos-fixed-f3b83c61589a?source=responses---------1---------- +[3]:https://medium.com/@TomSwirly/i-read-the-whole-thing-from-start-to-finish-415a55d89229?source=responses---------0-31--------- +[4]:https://medium.com/@g.kylafas +[5]:https://medium.com/@g.kylafas?source=responses---------1---------- +[6]:https://medium.com/@kannonboy +[7]:https://medium.com/@kannonboy?source=responses---------1---------- +[8]:https://medium.com/@TomSwirly +[9]:https://medium.com/@TomSwirly?source=responses---------0-31--------- +[10]:https://medium.com/@g.kylafas/the-git-config-command-is-missing-a-yes-at-the-end-as-in-git-config-global-commit-verbose-yes-7e126365750e?source=responses---------1----------#--responses +[11]:https://hackernoon.com/@kannonboy +[12]:https://hackernoon.com/@kannonboy?source=placement_card_footer_grid---------0-44 +[13]:https://medium.freecodecamp.com/@BillSourour +[14]:https://medium.freecodecamp.com/@BillSourour?source=placement_card_footer_grid---------1-43 +[15]:https://blog.uncommon.is/@lut4rp +[16]:https://blog.uncommon.is/@lut4rp?source=placement_card_footer_grid---------2-43 +[17]:https://medium.com/@kannonboy +[18]:https://medium.com/@kannonboy +[19]:https://medium.com/@g.kylafas/the-git-config-command-is-missing-a-yes-at-the-end-as-in-git-config-global-commit-verbose-yes-7e126365750e?source=responses---------1---------- +[20]:https://medium.com/@kannonboy/thanks-giorgos-fixed-f3b83c61589a?source=responses---------1---------- +[21]:https://medium.com/@TomSwirly/i-read-the-whole-thing-from-start-to-finish-415a55d89229?source=responses---------0-31--------- +[22]:https://hackernoon.com/setting-breakpoints-on-a-snowy-evening-df34fc3168e2?source=placement_card_footer_grid---------0-44 +[23]:https://medium.freecodecamp.com/the-code-im-still-ashamed-of-e4c021dff55e?source=placement_card_footer_grid---------1-43 +[24]:https://blog.uncommon.is/using-git-to-generate-versionname-and-versioncode-for-android-apps-aaa9fc2c96af?source=placement_card_footer_grid---------2-43 +[25]:https://hackernoon.com/git-in-2016-fad96ae22a15#fd10 +[26]:https://hackernoon.com/git-in-2016-fad96ae22a15#cc52 +[27]:https://hackernoon.com/git-in-2016-fad96ae22a15#42b9 +[28]:https://hackernoon.com/git-in-2016-fad96ae22a15#4208 +[29]:https://hackernoon.com/git-in-2016-fad96ae22a15#a5c3 +[30]:https://hackernoon.com/git-in-2016-fad96ae22a15#c230 +[31]:https://hackernoon.com/tagged/git?source=post +[32]:https://hackernoon.com/tagged/web-development?source=post +[33]:https://hackernoon.com/tagged/software-development?source=post +[34]:https://hackernoon.com/tagged/programming?source=post +[35]:https://hackernoon.com/tagged/atlassian?source=post +[36]:https://hackernoon.com/@kannonboy +[37]:https://hackernoon.com/?source=footer_card +[38]:https://hackernoon.com/setting-breakpoints-on-a-snowy-evening-df34fc3168e2?source=placement_card_footer_grid---------0-44 +[39]:https://medium.freecodecamp.com/the-code-im-still-ashamed-of-e4c021dff55e?source=placement_card_footer_grid---------1-43 +[40]:https://blog.uncommon.is/using-git-to-generate-versionname-and-versioncode-for-android-apps-aaa9fc2c96af?source=placement_card_footer_grid---------2-43 +[41]:https://hackernoon.com/git-in-2016-fad96ae22a15#fd10 +[42]:https://hackernoon.com/git-in-2016-fad96ae22a15#fd10 +[43]:https://hackernoon.com/git-in-2016-fad96ae22a15#cc52 +[44]:https://hackernoon.com/git-in-2016-fad96ae22a15#cc52 +[45]:https://hackernoon.com/git-in-2016-fad96ae22a15#42b9 +[46]:https://hackernoon.com/git-in-2016-fad96ae22a15#4208 +[47]:https://hackernoon.com/git-in-2016-fad96ae22a15#a5c3 +[48]:https://hackernoon.com/git-in-2016-fad96ae22a15#c230 +[49]:https://git-scm.com/docs/git-worktree +[50]:https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git#Binary-Search +[51]:https://www.atlassian.com/git/tutorials/git-lfs/#speeding-up-clones +[52]:https://www.atlassian.com/git/tutorials/git-stash/ +[53]:https://hackernoon.com/@kannonboy?source=footer_card +[54]:https://hackernoon.com/?source=footer_card +[55]:https://hackernoon.com/@kannonboy?source=post_header_lockup +[56]:https://hackernoon.com/@kannonboy?source=post_header_lockup +[57]:https://hackernoon.com/git-in-2016-fad96ae22a15#c8e9 +[58]:https://hackernoon.com/git-in-2016-fad96ae22a15#408a +[59]:https://hackernoon.com/git-in-2016-fad96ae22a15#315b +[60]:https://hackernoon.com/git-in-2016-fad96ae22a15#dbfb +[61]:https://hackernoon.com/git-in-2016-fad96ae22a15#2220 +[62]:https://hackernoon.com/git-in-2016-fad96ae22a15#bc78 +[63]:https://www.atlassian.com/git/tutorials/install-git/ +[64]:https://www.atlassian.com/git/tutorials/what-is-git/ +[65]:https://www.atlassian.com/git/tutorials/git-lfs/ +[66]:https://twitter.com/kit3bus +[67]:https://confluence.atlassian.com/bitbucket/bitbucket-lfs-media-adapter-856699998.html +[68]:https://developer.atlassian.com/blog/2015/10/monorepos-in-git/ +[69]:https://blogs.atlassian.com/2013/08/what-you-need-to-know-about-the-new-git-1-8-4/ +[70]:https://www.atlassian.com/git/tutorials/refs-and-the-reflog/ +[71]:https://www.atlassian.com/git/tutorials/git-stash/#how-git-stash-works +[72]:https://twitter.com/kannonboy +[73]:https://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches +[74]:http://git-merge.com/ +[75]:http://git-merge.com/#git-aliases +[76]:https://www.atlassian.com/git/tutorials +[77]:https://hackernoon.com/git-in-2016-fad96ae22a15#87c4 +[78]:http://instaco.de/ +[79]:https://medium.com/@Medium/personalize-your-medium-experience-with-users-publications-tags-26a41ab1ee0c#.hx4zuv3mg +[80]:https://hackernoon.com/ diff --git a/sources/tech/20170111 NMAP Common Scans – Part One.md b/sources/tech/20170111 NMAP Common Scans – Part One.md index 8cd1341089..7f1f724d5e 100644 --- a/sources/tech/20170111 NMAP Common Scans – Part One.md +++ b/sources/tech/20170111 NMAP Common Scans – Part One.md @@ -1,3 +1,4 @@ +wcnnbdk1 translating NMAP Common Scans – Part One ======================== diff --git a/sources/tech/20170123 Linux command line navigation tipstricks 3 - the CDPATH environment variable.md b/sources/tech/20170123 Linux command line navigation tipstricks 3 - the CDPATH environment variable.md index 9a03fb2102..9474f7f3cb 100644 --- a/sources/tech/20170123 Linux command line navigation tipstricks 3 - the CDPATH environment variable.md +++ b/sources/tech/20170123 Linux command line navigation tipstricks 3 - the CDPATH environment variable.md @@ -1,3 +1,5 @@ +[HaitaoBio](https://github.com/HaitaoBio) translating... + Linux command line navigation tips/tricks 3 - the CDPATH environment variable ============================================================ diff --git a/sources/tech/20170124 Compile-time assertions in Go.md b/sources/tech/20170124 Compile-time assertions in Go.md deleted file mode 100644 index 643c27c9d4..0000000000 --- a/sources/tech/20170124 Compile-time assertions in Go.md +++ /dev/null @@ -1,141 +0,0 @@ -Compile-time assertions in Go -============================================================ - - -This post is about a little-known way to make compile-time assertions in Go. You probably shouldn’t use it, but it is interesting to know about. - -As a warm-up, here’s a fairly well-known form of compile-time assertions in Go: Interface satisfaction checks. - -In this code ([playground][1]), the `var _ =` line ensures that type `W` is a `stringWriter`, as checked for by [`io.WriteString`][2]. - -``` -package main - -import "io" - -type W struct{} - -func (w W) Write(b []byte) (int, error) { return len(b), nil } -func (w W) WriteString(s string) (int, error) { return len(s), nil } - -type stringWriter interface { - WriteString(string) (int, error) -} - -var _ stringWriter = W{} - -func main() { - var w W - io.WriteString(w, "very long string") -} -``` - -If you comment out `W`’s `WriteString` method, the code will not compile: - -``` -main.go:14: cannot use W literal (type W) as type stringWriter in assignment: - W does not implement stringWriter (missing WriteString method) -``` - -This is useful. For most types that satisfy both `io.Writer` and `stringWriter`, if you eliminate the `WriteString` method, everything will continue to work as it did before, but with worse performance. - -Rather than trying to write a fragile test for a performance regression using [`testing.T.AllocsPerRun`][3], you can simply protect your code with a compile-time assertion. - -Here’s [a real world example of this technique from package io][4]. - -* * * - -OK, onward to obscurity! - -Interface satisfaction checks are great. But what if you wanted to check a plain old boolean expression, like `1+1==2`? - -Consider this code ([playground][5]): - -``` -package main - -import "crypto/md5" - -type Hash [16]byte - -func init() { - if len(Hash{}) < md5.Size { - panic("Hash is too small") - } -} - -func main() { - // ... -} -``` - -`Hash` is perhaps some kind of abstracted hash result. The `init` function ensures that it will work with [crypto/md5][6]. If you change `Hash` to be (say) `[8]byte`, it’ll panic when the process starts. However, this is a run-time check. What if we wanted it to fail earlier? - -Here’s how. (There’s no playground link, because this doesn’t work on the playground.) - -``` -package main - -import "C" - -import "crypto/md5" - -type Hash [16]byte - -func hashIsTooSmall() - -func init() { - if len(Hash{}) < md5.Size { - hashIsTooSmall() - } -} - -func main() { - // ... -} -``` - -Now if you change `Hash` to be `[8]byte`, it will fail during compilation. (Actually, it fails during linking. Close enough for our purposes.) - -``` -$ go build . -# demo -main.hashIsTooSmall: call to external function -main.init.1: relocation target main.hashIsTooSmall not defined -main.init.1: undefined: "main.hashIsTooSmall" -``` - -What’s going on here? - -`hashIsTooSmall` is [declared without a function body][7]. The compiler assumes that someone else will provide an implementation, perhaps an assembly routine. - -When the compiler can prove that `len(Hash{}) < md5.Size`, it eliminates the code inside the if statement. As a result, no one uses the function `hashIsTooSmall`, so the linker eliminates it. No harm done. As soon as the assertion fails, the code inside the if statement is preserved.`hashIsTooSmall` can’t be eliminated. The linker then notices that no one else has provided an implementation for the function and fails with an error, which was the goal. - -One last oddity: Why `import "C"`? The go tool knows that in normal Go code, all functions must have bodies, and instructs the compiler to enforce that. By switching to cgo, we remove that check. (If you run `go build -x` on the code above, without the `import "C"` line, you will see that the compiler is invoked with the `-complete` flag.) An alternative to adding `import "C"` is to [add an empty file called `foo.s` to the package][8]. - -I know of only one use of this technique, in the [compiler test suite][9]. There are other [imaginable places to apply it][10], but no one has bothered. - -And that’s probably how it should be. :) - - --------------------------------------------------------------------------------- - -via: http://commaok.xyz/post/compile-time-assertions - -作者:[Josh Bleecher Snyder][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://twitter.com/commaok -[1]:https://play.golang.org/p/MJ6zF1oNsX -[2]:https://golang.org/pkg/io/#WriteString -[3]:https://golang.org/pkg/testing/#AllocsPerRun -[4]:https://github.com/golang/go/blob/go1.8rc2/src/io/multi.go#L72 -[5]:https://play.golang.org/p/mjIMWsWu4V -[6]:https://golang.org/pkg/crypto/md5/ -[7]:https://golang.org/ref/spec#Function_declarations -[8]:https://github.com/golang/go/blob/go1.8rc2/src/os/signal/sig.s -[9]:https://github.com/golang/go/blob/go1.8rc2/test/fixedbugs/issue9608.dir/issue9608.go -[10]:https://github.com/golang/go/blob/go1.8rc2/src/runtime/hashmap.go#L261 diff --git a/sources/tech/20170124 How to Keep Hackers out of Your Linux Machine Part 3- Your Questions Answered.md b/sources/tech/20170124 How to Keep Hackers out of Your Linux Machine Part 3- Your Questions Answered.md new file mode 100644 index 0000000000..c854001b0b --- /dev/null +++ b/sources/tech/20170124 How to Keep Hackers out of Your Linux Machine Part 3- Your Questions Answered.md @@ -0,0 +1,81 @@ +How to Keep Hackers out of Your Linux Machine Part 3: Your Questions Answered +============================================================ + + ![Computer security](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/keep-hackers-out.jpg?itok=lqgHDxDu "computer security") +Mike Guthrie answers some of the security-related questions received during his recent Linux Foundation webinar. Watch the free webinar on-demand.[Creative Commons Zero][1] + +Articles [one][6] and [two][7] in this series covered the five easiest ways to keep hackers out of your Linux machine, and know if they have made it in. This time, I’ll answer some of the excellent security questions I received during my recent Linux Foundation webinar. [Watch the free webinar on-demand.][8] + +**How can I store a passphrase for a private key if private key authentication is used by automated systems?** + +This is tough. This is something that we struggle with on our end, especially when we are doing Red Teams because we have stuff that calls back automatically. I use Expect but I tend to be old-school on that. You are going to have to script it and, yes, storing that passphrase on the system is going to be tough; you are going to have to encrypt it when you store it. + +My Expect script encrypts the passphrase stored and then decrypts, sends the passphrase, and re-encrypts it when it's done. I do realize there are some flaws in that, but it's better than having a no-passphrase key. + +If you do have a no-passphrase key, and you do need to use it. Then I would suggest limiting the user that requires that to almost nothing. For instance, if you are doing some automated log transfers or automated software installs, limit the access to only what it requires to perform those functions. + +You can run commands by SSH, so don't give them a shell, make it so they just run that command and it will actually prevent somebody from stealing that key and doing something other than just that one command. + +**What do you think of password managers such as KeePass2?** + +Password managers, for me, are a very juicy target. With the advent of GPU cracking and some of the cracking capabilities in EC2, they become pretty easy to get past.  I steal password vaults all the time. + +Now, our success rate at cracking those, that's a different story. We are still in about the 10 percent range of crack versus no crack. If a person doesn't do a good job at keeping a secure passphrase on their password vault, then we tend to get into it and we have a large amount of success. It's better than nothing but still you need to protect those assets. Protect the password vault as you would protect any other passwords. + +**Do you think it is worthwhile from a security perspective to create a new Diffie-Hellman moduli and limit them to 2048 bit or higher in addition to creating host keys with higher key lengths?** + +Yeah. There have been weaknesses in SSH products in the past where you could actually decrypt the packet stream. With that, you can pull all kinds of data across. People use this safes to transfer files and passwords and they do it thoughtlessly as an encryption mechanism. Doing what you can to use strong encryption and changing your keys and whatnot is important. I rotate my SSH keys -- not as often as I do my passwords -- but I rotate them about once a year. And, yeah, it's a pain, but it gives me peace of mind. I would recommend doing everything you can to make your encryption technology as strong as you possibly can. + +**Is using four completely random English words (around 100k words) for a passphrase okay?** + +Sure. My passphrase is actually a full phrase. It's a sentence. With punctuation and capitalization. I don't use anything longer than that. + +I am a big proponent of having passwords that you can remember that you don’t have to write down or store in a password vault. A password that you can remember that you don't have to write down is more secure than one that you have to write down because it's funky. + +Using a phrase or using four random words that you will remember is much more secure than having a string of numbers and characters and having to hit shift a bunch of times. My current passphrase is roughly 200 characters long. It's something that I can type quickly and that I remember. + +**Any advice for protecting Linux-based embedded systems in an IoT scenario?** + +IoT is a new space, this is the frontier of systems and security. It is starting to be different every single day. Right now, I try to keep as much offline as I possibly can. I don't like people messing with my lights and my refrigerator. I purposely did not buy a connected refrigerator because I have friends that are hackers, and I know that I would wake up to inappropriate pictures every morning. Keep them locked down. Keep them locked up. Keep them isolated. + +The current malware for IoT devices is dependent on default passwords and backdoors, so just do some research into what devices you have and make sure that there's nothing there that somebody could particularly access by default. Then make sure that the management interfaces for those devices are well protected by a firewall or another such device. + +**Can you name a firewall/UTM (OS or application) to use in SMB and large environments?** + +I use pfSense; it’s a BSD derivative. I like it a lot. There's a lot of modules, and there's actually commercial support for it now, which is pretty fantastic for small business. For larger devices, larger environments, it depends on what admins you can get a hold of. + +I have been a CheckPoint admin for most of my life, but Palo Alto is getting really popular, too. Those types of installations are going to be much different from a small business or home use. I use pfSense for any small networks. + +**Is there an inherent problem with cloud services?** + +There is no cloud; there are only other people's computers. There are inherent issues with cloud services. Just know who has access to your data and know what you are putting out there. Realize that when you give something to Amazon or Google or Microsoft, then you no longer have full control over it and the privacy of that data is in question. + +**What preparation would you suggest to get an OSCP?** + +I am actually going through that certification right now. My whole team is. Read their materials. Keep in mind that OSCP is going to be the offensive security baseline. You are going to use Kali for everything. If you don't -- if you decide not to use Kali -- make sure that you have all the tools installed to emulate a Kali instance. + +It's going to be a heavily tools-based certification. It's a good look into methodologies. Take a look at something called the Penetration Testing Framework because that would give you a good flow of how to do your test and their lab seems to be great. It's very similar to the lab that I have here at the house. + + _[Watch the full webinar on demand][3], for free. And see [parts one][4] and [two][5] of this series for five easy tips to keep your Linux machine secure._ + + _Mike Guthrie works for the Department of Energy doing Red Team engagements and penetration testing._ + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-3-your-questions-answered + +作者:[MIKE GUTHRIE][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/anch +[1]:https://www.linux.com/licenses/category/creative-commons-zero +[2]:https://www.linux.com/files/images/keep-hackers-outjpg +[3]:http://portal.on24.com/view/channel/index.html?showId=1101876&showCode=linux&partnerref=linco +[4]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-1-top-two-security-tips +[5]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-2-three-more-easy-security-tips +[6]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-1-top-two-security-tips +[7]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-2-three-more-easy-security-tips +[8]:http://portal.on24.com/view/channel/index.html?showId=1101876&showCode=linux&partnerref=linco diff --git a/sources/tech/20170131 5 new guides for working with OpenStack.md b/sources/tech/20170131 5 new guides for working with OpenStack.md deleted file mode 100644 index 89e4a02a20..0000000000 --- a/sources/tech/20170131 5 new guides for working with OpenStack.md +++ /dev/null @@ -1,56 +0,0 @@ -5 new guides for working with OpenStack -============================================================ - - ![OpenStack tutorials](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/rh_003588_01_rd3os.combacktoschoolserieshe_rh_051x_0.png?itok=Tm2UcSXw "OpenStack tutorials") -Image by : opensource.com - -OpenStack experience continues to be among the most in-demand skills in the tech world, with more and more organizations seeking to build and manage their own open source clouds. But OpenStack is a huge domain of knowledge, containing dozen of individual projects that are being actively developed at a rapid pace. Just keeping your skills up to date can be a challenge. - -The good news is that there are lots of resources out there to keep you up to speed. In addition to the [official project documentation][9], a variety training and certification programs, printed guides, and other resources, there are also a ton of tutorials and guides written by members of the OpenStack community and published across a variety of blogs and online publications. - -At Opensource.com, every month we gather the best of these community-created resources and bring them together for you into one handy package. Here's what we rounded up last month. - -* First up this time is a quick introduction to [Mistral usage in TripleO][1] from Julie Pichon. Mistral is a workflow service, allowing you to set up a multi-step process automation and coordinating actions for you asynchronously. Learn the basics of Mistral, how it works, and how it is used within TripleO in this quick guide. - -* Want to dig further into TripleO for managing OpenStack deployments using OpenStack's own set of tools? Then you'll want to check out this [set of cheatsheets][2] for people who are making use of TripleO in their OpenStack setup. It's a work in progress, so feel free to contribute if you've got an idea of what should be included. - -* Completing our trifecta of TripleO guides, don't miss this [quick guide][3] to using TripleO to stand up a standalone Ceph deployment. All it takes is a short YAML file and an easy command. - -* Next up, if you're an OpenStack contributor, you might be familiar with the [Grafana dashboard][4] which displays various metrics around OpenStack's continuous integration infrastructure. Ever wondered how this service works, or want to create a new addition to this dashboard? Learn [how to create][5] your own local copy of the dashboard for testing purposes so you can play around with it and create your own modifications. - -* Ever wonder what's happening under the hood with networking on an OpenStack cloud? OpenStack often makes use of [Open vSwitch][6] for network services for Neutron and Nova; learn the basics of how it is set up in [this walkthrough][7]. - -* * * - -That's it for this time around. As always, be sure to check out our complete collection of [OpenStack tutorials][10], which brings together hundreds of individual guides published across the past three years. - --------------------------------------------------------------------------------- - -作者简介: - -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/1/openstack-tutorials - -作者:[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]:http://www.jpichon.net/blog/2016/12/quick-introduction-mistral-tripleo/ -[2]:http://www.anstack.com/blog/2016/12/16/printing-tripleo-cheat-sheet.html -[3]:http://giuliofidente.com/2016/12/tripleo-to-deploy-ceph-standlone.html -[4]:http://grafana.openstack.org/ -[5]:http://blog.cafarelli.fr/2016/12/local-testing-of-openstack-grafana-dashboard-changes/ -[6]:http://openvswitch.org/ -[7]:http://superuser.openstack.org/articles/openvswitch-openstack-sdn/ -[8]:https://opensource.com/article/17/1/openstack-tutorials?rate=q5H-KT2pm4NLExRhlHc0ru2dyjLkTSA45wim_2KtIec -[9]:http://docs.openstack.org/ -[10]:https://opensource.com/resources/openstack-tutorials -[11]:https://opensource.com/user/19894/feed -[12]:https://opensource.com/article/17/1/openstack-tutorials#comments -[13]:https://opensource.com/users/jason-baker diff --git a/sources/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md b/sources/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md deleted file mode 100644 index f9316f8a1b..0000000000 --- a/sources/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md +++ /dev/null @@ -1,168 +0,0 @@ -GHLandy Translating - -How to Configure Custom SSH Connections to Simplify Remote Access -============================================================ - -SSH (SSH client) is a program for remotely accessing a machine, it enables a user to [execute commands on a remote host][2]. It is one of the most recommended method for logging in to a remote host, since it is designed to provide secure encrypted communications between two untrusted hosts over an insecure network. - -SSH uses both a system-wide as well as a user-specific (custom) configuration file. In this tutorial, we will explain how to create a custom ssh configuration file and use certain options to connect to remote hosts. - -#### Requirements: - -1. You must have installed [OpenSSH client on your Linux desktop][1]. -2. Understand the common options used for remote connections via ssh. - -#### SSH Client Config Files - -Below are the locations of the ssh client configuration files: - -1. `/etc/ssh/ssh_config` – this is the default, system-wide configuration file. It contains settings that apply to all users of ssh client machine. -2. `~/.ssh/config` or `$HOME/.ssh/config` – is the user-specific/custom configuration file. It has configurations that apply to a specific user. It therefore overrides default settings in the system-wide config file. This is the file we will create and use. - -By default, users are authenticated in ssh using passwords, however, you can setup [ssh passwordless login using ssh keygen][3] in 5 simple steps. - -Note: In case the directory `~/.ssh` does not exist on your desktop system, create it with the following permissions. - -``` -$ mkdir -p ~/.ssh -$ chmod 0700 ~/.ssh -``` - -The chmod command above implies that only the user can have read, write and execute permissions on the directory as required by ssh settings. - -### How To Create User Specific SSH Configuration File - -This file is usually not created by default, so you need to create it with the read/write permissions for only the user. - -``` -$ touch ~/.ssh/config -$ chmod 0700 ~/.ssh/config -``` - -The above file contains sections defined by hosts specifications, and a section is only applied to hosts that match one of the patterns set in the specification. - -The conventional format of `~/.ssh/config` is as follows, and all empty lines as well as lines starting with `‘#’` are considered as comments: - -``` -Host host1 -ssh_option1=value1 -ssh_option2=value1 value2 -ssh_option3=value1 -Host host2 -ssh_option1=value1 -ssh_option2=value1 value2 -Host * -ssh_option1=value1 -ssh_option2=value1 value2 -``` - -From the format above: - -1. Host host1 – is a header definition for host1, this is where a host specification starts and it ends with the next header definition, Host host2 making a section. -2. host1, host2 are simply host aliases to use on the command line, they are not the actual hostnames of the remote hosts. -3. The configuration options such as ssh_option1=value1, ssh_option2=value1 value2 apply to a matched host and should be indented for well organized formatting. -4. For an option such as ssh_option2=value1 value2, the value value1 is considered first, then value2. -5. The header definition Host * (where `*` is a pattern – wildcard that matches zero or more characters) will match zero or more hosts. - -Still considering the format above, this is how ssh reads the config file. If you execute a ssh command to remotely access host1 like so: - -``` -$ ssh host1 -``` - -The above ssh command will does the following things: - -1. match the host alias host1 in the config file and applies the options set under the definition header, Host host1. -2. then moves to the next host section, Host host2 and finds that the name provided on the command line doesn’t match, so no options are used from here. -3. It proceeds to the last section, Host *, which matches all hosts. Here, it applies all the options in this section to the host connection. But it can not override any values of options that where already used in the previous section(s). -4. The same applies to host2. - -### How To Use User Specific SSH Configuration File - -Once you have understood how the ssh client config file works, you can create it as follows. Remember to use options and values (host aliases, port numbers, usernames and so on) applicable to your server environment. - -Open the config file with your favorite editor: - -``` -$ vi ~/.ssh/config -``` - -And define the necessary sections: - -``` -Host fedora25 -HostName 192.168.56.15 -Port 22 -ForwardX11 no -Host centos7 -HostName 192.168.56.10 -Port 22 -ForwardX11 no -Host ubuntu -HostName 192.168.56.5 -Port 2222 -ForwardX11 yes -Host * -User tecmint -IdentityFile ~/.ssh/id_rsa -Protocol 2 -Compression yes -ServerAliveInterval 60 -ServerAliveCountMax 20 -LogLevel INFO -``` - -A detailed explanation of the above ssh configuration options. - -1. HostName – defines the real host name to log into, alternatively, you can use a numeric IP addresses, it is also permitted (both on the command line and in HostName specifications). -2. User – specifies the user to log in as. -3. Port – sets the port number to connect on the remote host, the default is 22. Use the port number configured in the remote host’s sshd config file. -4. Protocol – this option defines the protocol versions ssh should support in order of preference. The usual values are ‘1’ and ‘2’, multiple versions must be comma-separated. -5. IdentityFile – specifies a file from which the user’s DSA, Ed25519, RSA or ECDSA authentication identity is read. -6. ForwardX11 – defines whether X11 connections will be automatically redirected over the secure channel and DISPLAY set. It has two possible values “yes” or “no”. -7. Compression – it’s used to set compression during the remote connection with the “yes” value. The default is “no”. -8. ServerAliveInterval – sets a timeout interval in seconds after which if no response (or data) has been received from the server, ssh will send a message through the encrypted channel to request a response from the server. The default value is 0, meaning no messages will be sent to the server, or 300 if the BatchMode option has been defined. -9. ServerAliveCountMax – sets the number of server alive messages which may be sent without ssh receiving any response from the server. -10. LogLevel – defines the verbosity level that is used when logging messages from ssh. The allowed values includes: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3\. And the default is INFO. - -The standard way of connecting to any remote Linux host (CentOS 7 – in my case), defined in section two of the config file above, we would normally type the command below: - -``` -$ ssh -i ~/.ssh/id_rsa -p 22 tecmint@192.168.56.10 -``` - -However, with the use of the ssh client configuration file, we can simply type the following command: - -``` -$ ssh centos7 -``` - -You can find more options and usage examples in the ssh client config man page: - -``` -$man ssh_config -``` - -That’s it for now, in this guide, we explained you how to use a user-specific (custom) ssh client config file in Linux. Use the feedback form below to write back to us concerning this article. - --------------------------------------------------------------------------------- - -译者简介: - -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. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/configure-custom-ssh-connection-in-linux/ - -作者:[Aaron Kili][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/aaronkili/ - -[1]:http://www.tecmint.com/install-openssh-server-in-linux/ -[2]:http://www.tecmint.com/execute-commands-on-multiple-linux-servers-using-pssh/ -[3]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/ diff --git a/sources/tech/20170202 How to make file-specific setting changes in Vim using Modeline.md b/sources/tech/20170202 How to make file-specific setting changes in Vim using Modeline.md index c4fbe3b0e2..c8b51fcb8c 100644 --- a/sources/tech/20170202 How to make file-specific setting changes in Vim using Modeline.md +++ b/sources/tech/20170202 How to make file-specific setting changes in Vim using Modeline.md @@ -1,5 +1,6 @@ How to make file-specific setting changes in Vim using Modeline ============================================================ +ch-cn translating ### On this page diff --git a/sources/tech/20170204 How to Configure Network Between Guest VM and Host in Oracle VirtualBox.md b/sources/tech/20170204 How to Configure Network Between Guest VM and Host in Oracle VirtualBox.md deleted file mode 100644 index 1ba086b52f..0000000000 --- a/sources/tech/20170204 How to Configure Network Between Guest VM and Host in Oracle VirtualBox.md +++ /dev/null @@ -1,254 +0,0 @@ -#rusking translating - -How to Configure Network Between Guest VM and Host in Oracle VirtualBox -============================================================ - -Once you have installed different operating systems in [Oracle VirtualBox][2], you may want to enable communication between the host and the virtual machines. - -In this article, we will describe the simplest and direct method of setting up a network for guest virtual machines and the host in Linux. - -For the purpose of this tutorial: - -1. Host Operating System – Linux Mint 18 -2. Virtual Machine OS – CentOS 7 and Ubuntu 16.10 - -#### Requirements - -1. A working [Oracle Virtualbox installed][1] on Host machine. -2. You must have installed a guest operating system such as Ubuntu, Fedora, CentOS, Linux Mint or any of your choice in the Oracle virtual box. -3. Power off the virtual machines as you perform the configurations up to the step where your required to turn them on. - -In order for the guest and host machines to communicate, they need to be on the same network and by default, you can attach up to four network cards to your guest machines. - -The default network card (Adapter 1) is normally used to connect the guest machines to the Internet using NATvia the host machine. - -Important: Always set the first adapter to communicate with the host and the second adapter to connect to the Internet. - -### Create a Network For Guests and Host Machine - -At the Virtualbox manager interface below, start by creating a network on which the host and guests will operate. - -Go to File –> Preferences or hit `Ctrl + G`: - -[ - ![Virtualbox Preferences Window](http://www.tecmint.com/wp-content/uploads/2017/02/Virtualbox-Preferences-Window.png) -][3] - -Virtualbox Preferences Window - -From the following interface, there are two options; choose Host-only Networks by clicking on it. Then use the `+`sign on the right to add a new host-only network. - -[ - ![Set Guest Network](http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Network.png) -][4] - -Set Guest Network - -Below is a screen shot showing a new host-only network has been created called vboxnet0. - -[ - ![Virtualbox Preferences Window](http://www.tecmint.com/wp-content/uploads/2017/02/Virtualbox-Preferences-Window-1.png) -][5] - -Virtualbox Preferences Window - -If you want, you can remove it by using the `-` button in the middle and to view the network details/settings, click on the edit button. - -You can as well change the values as per your preferences, such as the network address, network mask, etc. - -Note: The IPv4 address in the interface below is the IP address of your host machine. - -[ - ![Host Network Details](http://www.tecmint.com/wp-content/uploads/2017/02/Host-Network-Details.png) -][6] - -Host Network Details - -In the next interface, you can configure the DHCP server that is if you want the guest machines to use a dynamic IP address (make sure it is enabled before using it). But I recommend using a static IP address for the virtual machines. - -Now click OK on all network settings interfaces below to save the changes. - -[ - ![Set Guest Static IP aAddress](http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Static-IP-Address.png) -][7] - -Set Guest Static IP aAddress - -#### Configure Virtual Machine Network Settings - -Note: You can follow the steps below for every virtual machine that you want to add on the network to communicate with the host machine. - -Back at the virtual box manager interface, select your guest virtual machine such as Ubuntu 16.10 server or CentOS 7 and click on the Settings menu. - -[ - ![Configure VM Settings](http://www.tecmint.com/wp-content/uploads/2017/02/Configure-VM-Settings.png) -][8] - -Configure VM Settings - -#### Configure Adapter to Connect Virtual Machine to Host - -Choose the Network option from the interface above. Afterwards, configure first network card (Adapter 1) with the following settings: - -1. Check the option: “Enable Network Adapter” to turn it on. -2. In the field Attached to: select Host-only Adapter -3. Then select the Name of the network: vboxnet0 - -As in the screen shot below and click OK to save the settings: - -[ - ![Enable Network Adapter for Guest VM](http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-Guest-VM.png) -][9] - -Enable Network Adapter for Guest VM - -#### Configure Adapter to Connect Virtual Machine to Internet - -Then add a second network card (Adapter 2) to connect virtual machine to the Internet via the host. Use the settings below: - -1. Check the option: “Enable Network Adapter” to activate it. -2. In the field Attached to: select NAT - -[ - ![Enable Network Adapter for VM](http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-VM.png) -][10] - -Enable Network Adapter for VM - -#### Setup Static IP Address for Guest Virtual Machine - -At this stage, power on the guest virtual machine, login and [configure static IP address][11]. Run the command below to show all the interfaces on the guest machine and allocated IP addresses: - -``` -$ ip add -``` -[ - ![Configure Static IP Address for VM](http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Static-IP-Address-for-VM.png) -][12] - -Configure Static IP Address for VM - -From the screen shot above, you can see that there are three interfaces enabled on the virtual machine: - -1. `lo` – loopback interface -2. `enp0s3` (Adapter 1) – for host-only communication which is using the DHCP as set in one of the previous steps and later configured with a static IP address. -3. `enp0s8` (Adapter 2) – for connection to the Internet. It will use DHCP by default. - -##### On Debian/Ubuntu/Linux Mint - -Important: Here, I used Ubuntu 16.10 Server: IP address: 192.168.56.5. - -Open the file /etc/network/interfaces using your favorite editor with super user privileges: - -``` -$ sudo vi /etc/network/interfaces -``` - -Use the following settings for the interface enp0s3 (use your preferred values here): - -``` -auto enp0s3 -iface enp0s3 inet static -address 192.168.56.5 -network 192.168.56.0 -netmask 255.255.255.0 -gateway 192.168.56.1 -dns-nameservers 8.8.8.8 192.168.56.1 -``` - -Save the file and exit. - -Then restart network services like so: - -``` -$ sudo systemctl restart networking -``` - -Alternatively, reboot the system and closely, check if the interface is using the new ip addresses: - -``` -$ ip add -``` - -##### On RHEL/CentOS/Fedora - -Important: For this section, I used CentOS 7: IP address: 192.168.56.10. - -Begin by opening the file for enp0s3 – host-only network interface; /etc/sysconfig/network-scripts/ifcfg-enp0s3using your favorite editor with super user privileges: - -``` -$ sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 -``` - -Create/modify the following settings (use your preferred values here): - -``` -BOOTPROTO=static -ONBOOT=yes -IPADDR=192.168.56.10 -NETWORK=192.168.56.0 -NETMASK=255.255.255.0 -GATEWAY=192.168.56.1 -DNS=8.8.8.8 192.168.56.1 -NM_CONTROLLED=no #use this file not network manager to manage interface -``` - -Save the file and exit. Then restart network service as follows (you can as well reboot): - -``` -$ sudo systemctl restart network.service -``` - -Check if the interface is using the new IP addresses as follows: - -``` -$ ip add -``` - -#### Manage Virtual Machines From Host Using SSH - -On the host machine, use SSH to manage your virtual machines. In the following example, am accessing the CentOS 7 (192.168.56.10)server using SSH: - -``` -$ ssh tecmint@192.168.56.10 -$ who -``` -[ - ![Connect Guest VM using SSH](http://www.tecmint.com/wp-content/uploads/2017/02/Connect-Guest-VM-using-SSH.png) -][13] - -Connect Guest VM using SSH - -That’s it! In this post, we described a straightforward method of setting up a network between a guest virtual machines and the host. Do share your thoughts about this tutorial using the feedback section below. - --------------------------------------------------------------------------------- - -译者简介: - -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. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/network-between-guest-vm-and-host-virtualbox/ - -作者:[Aaron Kili][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/aaronkili/ - -[1]:http://www.tecmint.com/install-virtualbox-on-redhat-centos-fedora/ -[2]:http://www.tecmint.com/install-virtualbox-on-redhat-centos-fedora/ -[3]:http://www.tecmint.com/wp-content/uploads/2017/02/Virtualbox-Preferences-Window.png -[4]:http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Network.png -[5]:http://www.tecmint.com/wp-content/uploads/2017/02/Virtualbox-Preferences-Window-1.png -[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Host-Network-Details.png -[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Set-Guest-Static-IP-Address.png -[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-VM-Settings.png -[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-Guest-VM.png -[10]:http://www.tecmint.com/wp-content/uploads/2017/02/Enable-Network-Adapter-for-VM.png -[11]:http://www.tecmint.com/set-add-static-ip-address-in-linux/ -[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Static-IP-Address-for-VM.png -[13]:http://www.tecmint.com/wp-content/uploads/2017/02/Connect-Guest-VM-using-SSH.png diff --git a/sources/tech/20170208 4 open source tools for conducting online surveys.md b/sources/tech/20170208 4 open source tools for conducting online surveys.md deleted file mode 100644 index e16ddfcf63..0000000000 --- a/sources/tech/20170208 4 open source tools for conducting online surveys.md +++ /dev/null @@ -1,85 +0,0 @@ -4 open source tools for conducting online surveys -============================================================ - - - ![4 open source tools for doing online surveys](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_question_B.png?itok=UVCz8ld_ "4 open source tools for doing online surveys") -Image by : opensource.com - -Ah, the venerable survey. It can be a fast, simple, cheap, and effective way gather the opinions of friends, family, classmates, co-workers, customers, readers, and others. - -Millions turn to proprietary tools like SurveyGizmo, Polldaddy, SurveyMonkey, or even Google Forms to set up their surveys. But if you want more control, not just over the application but also the data you collect, then you'll want to go open source. - -Let's take a look at four open source survey tools that can suit your needs, no matter how simple or complex those needs are. - -### LimeSurvey - -[LimeSurvey][2] is where you turn to when you want a survey tool that can do just about everything you want it to do. You can use LimeSurvey for doing simple surveys and polls, and more complex ones that span multiple pages. If you work in more than one language, LimeSurvey supports 80 of them. - -LimeSurvey also lets you customize your surveys with your own JavaScript, photos, and videos, and even by editing your survey's HTML directly. And all that is only scratching the surface of [its features][3]. - -You can install LimeSurvey on your own server, or [get a hosted plan][4] that will set you back a few hundred euros a year (although there is a free option too). - -### JD Esurvey - -If LimeSurvey doesn't pack enough features for you and Java-powered web applications are your thing, then give [JD Esurvey ][5]a look. It's described as "an open source enterprise survey web application." It's definitely powerful, and ticks a number of boxes for organizations looking for a high-volume, robust survey tool. - -Using JD Esurvey, you can collect a range of information including answers to "Yes/No" questions and star ratings for products and services. You can even process answers to questions with multiple parts. JD Esurvey supports creating and managing surveys with tablets and smartphones, and your published surveys are mobile friendly too. According to the developer, the application is usable by [people with disabilities][6]. - -To give it a go, you can either [fork JD Esurvey on GitHub][7] or [download and install][8] a pre-compiled version of the application. - -### Quick Survey - -For many of us, tools like LimeSurvey and JD Esurvey are overkill. We just want a quick and dirty way to gather opinions or feedback. That's where [Quick Survey][9] comes in. - -Quick Survey only lets you create question-and-answer or multiple choice list surveys. You add your questions or create your list, then publish it and share the URL. You can add as many items to your survey as you need to, and the responses appear on Quick Survey's admin page. You can download the results of your surveys as a CSV file, too. - -While you can download the code for Quick Survey from GitHub, it's currently optimized for [Sandstorm.io][10] and [Sandstorm Oasis][11] where you can grab it from the [Sandstorm App Market][12]. - -### TellForm - -In terms of features, [TellForm][13] lies somewhere between LimeSurvey and Quick Survey. It's one of those tools for people who need more than a minimal set of functions, but who don't need everything and the kitchen sink. - -In addition to having 11 different types of surveys, TellForm has pretty good analytics attached to its surveys. You can easily customize the look and feel of your surveys, and the application's interface is simple and clean. - -If you want to host TellForm yourself, you can grab the code from the [GitHub repository][14]. Or, you can sign up for a [free hosted account][15]. - -* * * - -Do you have a favorite open source tool for doing online surveys? Feel free to share it with our community by leaving a comment. - --------------------------------------------------------------------------------- - -作者简介: - -Scott Nesbitt - Writer. Editor. Soldier of fortune. Ocelot wrangler. Husband and father. Blogger. Collector of pottery. Scott is a few of these things. He's also a long-time user of free/open source software who extensively writes and blogs about it. You can find Scott on Twitter, GitHub - --------------------------------------------------------------------------------- - - -via: https://opensource.com/article/17/2/tools-online-surveys-polls - -作者:[Scott Nesbitt ][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/scottnesbitt -[1]:https://opensource.com/article/17/2/tools-online-surveys-polls?rate=IvQATPRT8VEAJbe667E6i5txmmDenX8cL7YtkAxasWQ -[2]:https://www.limesurvey.org/ -[3]:https://www.limesurvey.org/about-limesurvey/features -[4]:https://www.limesurvey.org/services -[5]:https://www.jdsoft.com/jd-esurvey.html -[6]:https://www.ada.gov/508/ -[7]:https://github.com/JD-Software/JDeSurvey -[8]:https://github.com/JD-Software/JDeSurvey/wiki/Download-and-Installation -[9]:https://github.com/simonv3/quick-survey/ -[10]:http://sandstorm.io/ -[11]:http://oasis.sandstorm.io/ -[12]:https://apps.sandstorm.io/app/wupmzqk4872vgsye9t9x5dmrdw17mad97dk21jvcm2ph4jataze0 -[13]:https://www.tellform.com/ -[14]:https://github.com/whitef0x0/tellform -[15]:https://admin.tellform.com/#!/signup -[16]:https://opensource.com/user/14925/feed -[17]:https://opensource.com/article/17/2/tools-online-surveys-polls#comments -[18]:https://opensource.com/users/scottnesbitt diff --git a/sources/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md b/sources/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md deleted file mode 100644 index 1df4c79752..0000000000 --- a/sources/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md +++ /dev/null @@ -1,218 +0,0 @@ -free – A Standard Command to Check Memory Usage Statistics (Free & Used) in Linux -============================================================ - -We all knows, most of the Servers (Including world Top Super Computers are running in Linux) are running in Linux platform on IT infrastructure because Linux is more flexible compare with other operating systems. Other operating systems required reboot for small small changes & patch updates but Linux systems doesn’t required reboot except critical patch updates. - -One of the big challenge for Linux administrator to maintain the system up and running without any downtime. To managing memory utilization on Linux is another challenging task for administrator, `free` is one of the standard & widely used command, to analyze Memory Statistics (Free & Used Memory) in Linux. Today we are going to cover free command with useful options. - -Suggested Articles : - -* [smem – Linux Memory Reporting/Statistics Tool][1] -* [vmstat – A Standard Nifty Tool to Report Virtual Memory Statistics][2] - -#### What’s Free Command - -free displays the total amount of `free` and `used` physical and `swap` memory in the system, as well as the `buffers` and `caches`used by the kernel. The information is gathered by parsing /proc/meminfo. - -#### Display System Memory - -Run the `free` command without any option to display system memory, including total amount of `free`, `used`, `buffers`, `caches`& `swap`. - -``` -# free - total used free shared buffers cached -Mem: 32869744 25434276 7435468 0 412032 23361716 --/+ buffers/cache: 1660528 31209216 -Swap: 4095992 0 4095992 -``` - -The output has three columns. - -* Column-1 : Indicates Total memory, used memory, free memory, shared memory (mostly used by tmpfs (Shmem in /proc/meminfo)), memory used for buffers, cached contents memory size. - -* Total : Total installed memory (MemTotal in /proc/meminfo) -* Used : Used memory (calculated as total – free + buffers + cache) -* Free : Unused memory (MemFree in /proc/meminfo) -* Shared : Memory used (mostly) by tmpfs (Shmem in /proc/meminfo) -* Buffers : Memory used by kernel buffers (Buffers in /proc/meminfo) -* Cached : Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo) - -* Column-2 : Indicates buffers/cache used & free. -* Column-3 : Indicates Total swap memory (SwapTotal in /proc/meminfo), free (SwapFree in /proc/meminfo)) & used swap memory. - -#### Display Memory in MB - -By default `free` command output display memory in `KB - Kilobytes` which is bit confusion to most of the administrator (Many of us convert the output to MB, to understand the size, when the system has more memory). To avoid the confusion, add `-m` option with free command to get instant output with `MB - Megabytes`. - -``` -# free -m - total used free shared buffers cached -Mem: 32099 24838 7261 0 402 22814 --/+ buffers/cache: 1621 30477 -Swap: 3999 0 3999 -``` - -How to check, how much free ram I really have From the above output based on `used` & `free` column, you may think, you have very low free memory, when it’s really just `10%`, How ? - -Total Actual Available RAM = (Total RAM – column2 used) -Total RAM = 32099 -Actual used RAM = -1621 - -Total actual available RAM = 30477 - -If you have latest distribution, you have a option to see the actual free memory called `available`, for older distribution, look at the `free` column in the row that says `-/+ buffers/cache`. - -How to check, how much RAM actually used From the above output based on `used` & `free` column, you may think, you have utilized morethan `95%` memory. - -Total Actual used RAM = column1 used – (column1 buffers + column1 cached) -Used RAM = 24838 -Used Buffers = 402 -Used Cache = 22814 - -Total Actual used RAM = 1621 - -#### Display Memory in GB - -By default `free` command output display memory in `KB - Kilobytes` which is bit confusion to most of the administrator, so we can use the above option to get the output in `MB - Megabytes` but when the server has huge memory (morethan 100 GB or 200 GB), the above option also get confuse, so in this situation, we can add `-g` option with free command to get instant output with `GB - Gigabytes`. - -``` -# free -g - total used free shared buffers cached -Mem: 31 24 7 0 0 22 --/+ buffers/cache: 1 29 -Swap: 3 0 3 -``` - -#### Display Total Memory Line - -By default `free` command output comes with three columns (Memory, Buffers/Cache & Swap). To display consolidated total in separate line (Total (Mem+Swap), Used (Mem+(Used – Buffers/Cache)+Swap) & Free (Mem+(Used – Buffers/Cache)+Swap), add `-t` option with free command. - -``` -# free -t - total used free shared buffers cached -Mem: 32869744 25434276 7435468 0 412032 23361716 --/+ buffers/cache: 1660528 31209216 -Swap: 4095992 0 4095992 -Total: 36965736 27094804 42740676 -``` - -#### Run free with delay for better statistic - -By default free command display single statistics output which is not enough to troubleshoot further so, add delay (delay is the delay between updates in seconds) which capture the activity periodically. If you want to run free with 2 second delay, just use the below command (If you want more delay you can change as per your wish). - -The following command will run every 2 seconds until you exit. - -``` -# free -s 2 - total used free shared buffers cached -Mem: 32849392 25935844 6913548 188 182424 24632796 --/+ buffers/cache: 1120624 31728768 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25935288 6914104 188 182424 24632796 --/+ buffers/cache: 1120068 31729324 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25934968 6914424 188 182424 24632796 --/+ buffers/cache: 1119748 31729644 -Swap: 20970492 0 20970492 -``` - -#### Run free with delay & counts - -Alternatively you can run free command with delay and specific counts, once it reach the given counts then exit automatically. - -The following command will run every 2 seconds with 5 counts then exit automatically. - -``` -# free -s 2 -c 5 - total used free shared buffers cached -Mem: 32849392 25931052 6918340 188 182424 24632796 --/+ buffers/cache: 1115832 31733560 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931192 6918200 188 182424 24632796 --/+ buffers/cache: 1115972 31733420 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931348 6918044 188 182424 24632796 --/+ buffers/cache: 1116128 31733264 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931316 6918076 188 182424 24632796 --/+ buffers/cache: 1116096 31733296 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931308 6918084 188 182424 24632796 --/+ buffers/cache: 1116088 31733304 -Swap: 20970492 0 20970492 -``` - -#### Human readable format - -To print the human readable output, add `h` option with `free` command, which will print more detailed output compare with other options like m & g. - -``` -# free -h - total used free shared buff/cache available -Mem: 2.0G 1.6G 138M 20M 188M 161M -Swap: 2.0G 1.8G 249M -``` - -#### Split Buffers & Cached memory output - -By default `Buffers/Cached` memory output comes together. To split Buffers & Cached memory output, add `-w` option with free command. (This option is available on version 3.3.12). - -Note : See the above output, `Buffers/Cached` comes together. - -``` -# free -wh - total used free shared buffers cache available -Mem: 2.0G 1.6G 137M 20M 8.1M 183M 163M -Swap: 2.0G 1.8G 249M -``` - -#### Show Low and High Memory Statistics - -By default `free` command output comes without Low and High Memory Statistics. To display Show Low and High Memory Statistics, add `-l` option with free command. - -``` -# free -l - total used free shared buffers cached -Mem: 32849392 25931336 6918056 188 182424 24632808 -Low: 32849392 25931336 6918056 -High: 0 0 0 --/+ buffers/cache: 1116104 31733288 -Swap: 20970492 0 20970492 -``` - -#### Read more about free - -If you want to know more option which is available for free, simply navigate to man page. - -``` -# free --help -or -# man free -``` - --------------------------------------------------------------------------------- - -via: http://www.2daygeek.com/free-command-to-check-memory-usage-statistics-in-linux/ - -作者:[MAGESH MARUTHAMUTHU][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.2daygeek.com/author/magesh/ -[1]:http://www.2daygeek.com/smem-linux-memory-usage-statistics-reporting-tool/ -[2]:http://www.2daygeek.com/linux-vmstat-command-examples-tool-report-virtual-memory-statistics/ -[3]:http://www.2daygeek.com/author/magesh/ diff --git a/sources/tech/20170210 How to perform search operations in Vim.md b/sources/tech/20170210 How to perform search operations in Vim.md deleted file mode 100644 index 4fa38808f8..0000000000 --- a/sources/tech/20170210 How to perform search operations in Vim.md +++ /dev/null @@ -1,161 +0,0 @@ -How to perform search operations in Vim -============================================================ - -### On this page - -1. [Customize your search][5] - 1. [1\. Search highlighting][1] - 2. [2\. Making search case-insensitive][2] - 3. [3\. Smartcase search][3] - 4. [4\. Incremental search][4] -2. [Some other cool Vim search tips/tricks][6] -3. [Conclusion][7] - -While we've already [covered][8] several features of Vim until now, the editor's feature-set is so vast that no matter how much you learn, it doesn't seem to be enough. So continuing with our Vim tutorial series, in this write-up, we will discuss the various search techniques that the editor offers. - -But before we do that, please note that all the examples, commands, and instructions mentioned in this tutorial have been tested on Ubuntu 14.04, and the Vim version we've used is 7.4. - -### Basic search operations in Vim - -If you have opened a file in the Vim editor, and want to search a particular word or pattern, the first step that you have to do is to come out of the Insert mode (if you that mode is currently active). Once that is done, type '**/**' (without quotes) followed by the word/pattern that you want to search. - -For example, if the word you want to search is 'linux', here's how it will appear at the bottom of your Vim window: - -[ - ![Search for words in vim](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-basic-search.png) -][9] - -After this, just hit the Enter key and you'll see that Vim will place the cursor on the first line (containing the word) that it encounters beginning from the line where the cursor was when you were in Insert mode. If you've just opened a file and began searching then the search operation will start from the very first line of the file. - -To move on to the next line containing the searched word, press the '**n**' key. When you've traversed through all the lines containing the searched pattern, pressing the '**n**' key again will make the editor to repeat the search, and you'll be back to the first searched occurrence again. - -[ - ![Move to next search hit](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-end.png) -][10] - -While traversing the searched occurrences, if you want to go back to the previous occurrence, press '**N**' (shift+n). Also, it's worth mentioning that at any point in time, you can type '**ggn**' to jump to the first match, or '**GN**' to jump to the last. - -In case you are at the bottom of a file, and want to search backwards, then instead of initiating the search with **/**, use **?**. Here's an example: - -[ - ![search backwards](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-back.png) -][11] - -### Customize your search - -### 1\. Search highlighting - -While jumping from one occurrence of the searched word/pattern to another is easy using 'n' or 'N,' things become more user-friendly if the searched occurrences get highlighted. For example, see the screenshot below: - -[ - ![Search Highlighting in VIM](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-highlight-search.png) -][12] - -This can be made possible by setting the 'hlsearch' variable, something which you can do by writing the following in the normal/command mode: - -``` -:set hlsearch -``` - -[ - ![set hlsearch](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-set-hlsearch.png) -][13] - -### 2\. Making search case-insensitive - -By default, the search you do in Vim is case-sensitive. This means that if I am searching for 'linux', then 'Linux' won't get matched. However, if that's not what you are looking for, then you can make the search case-insensitive using the following command: - -``` -:set ignorecase -``` - -So after I set the 'ignorecase' variable using the aforementioned command, and searched for 'linux', the occurrences of 'LINUX' were also highlighted: - -[ - ![search case-insensitive](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-case.png) -][14] - -### 3\. Smartcase search - -Vim also offers you a feature using which you can ask the editor to be case-sensitive only when the searched word/pattern contains an uppercase character. For this you need to first set the 'ignorecase' variable and then set the 'smartcase' variable. - -``` -:set ignorecase -:set smartcase -``` - -For example, if a file contains both 'LINUX' and 'linux,' and smartcase is on, then only occurrences of the word LINUX will be searched if you search using '/LINUX'. However, if the search is '/linux', then all the occurrences will get matched irrespective of whether they are in caps or not. - -### 4\. Incremental search - -Just like, for example, Google, which shows search results as you type your query (updating them with each alphabet you type), Vim also provides incremental search. To access the feature, you'll have to execute the following command before you start searching: - -``` -:set incsearch -``` - -### Some other cool Vim search tips/tricks - -There are several other search-related tips tricks that you may find useful. - -To start off, if you want to search for a word that's there in the file, but you don't want to type it, you can just bring your cursor below it and press ***** (or **shift+8**). And if you want to launch a partial search (for example: search both 'in' and 'terminal'), then you can bring the cursor under the word (in our example, in) and search by pressing **g*** (press 'g' once and then keep pressing *) on the keyboard. - -Note: Press **#** or **g#** in case you want to search backwards. - -Next up, if you want, you can get a list of all occurrences of the searched word/pattern along with the respective lines and line numbers at one place. This can be done by type **[I** after you've initiated the search. Following is an example of how the results are grouped and displayed at the bottom of Vim window: - -[ - ![grouped search results](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-results-list.png) -][15] - -Moving on, as you might already know, the Vim search wraps by default, meaning after reaching the end of the file (or to the last occurrence of the searched word), pressing "search next" brings the cursor to the first occurrence again. If you want, you can disable this search wrapping by running the following command: - -``` -:set nowrapscan -``` - -To enable wrap scan again, use the following command: - -``` -:set wrapscan -``` - -Finally, suppose you want to make a slight change to an already existing word in the file, and then perform the search operation, then one way is to type **/** followed by that word. But if the word in long or complicated, then it may take time to type it. - -An easy way out is to bring the cursor under the word you want to slightly edit, then press '/' and then press Ctrl-r followed by Ctrl-w. The word under the cursor will not only get copied, it will be pasted after '/' as well, allowing you to easily edit it and go ahead with the search operation. - -For more tricks (including how you can use your mouse to make things easier in Vim), head to the [official Vim documentation][16]. - -### Conclusion - -Of course, nobody expects you to mug up all the tips/tricks mentioned here. What you can do is, start with the one you think will be the most beneficial to you, and practice it regularly. Once it gets embedded in your memory and becomes a habit, come here again, and see which one you should learn next. - -Do you know any more such tricks? Want to share it with everyone in the HTF community? Then leave it as a comment below. - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/perform-search-operations-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/perform-search-operations-in-vim/ -[1]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-search-highlighting -[2]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-making-searchnbspcaseinsensitive -[3]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-smartcase-search -[4]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-incremental-search -[5]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#customize-your-search -[6]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#some-other-cool-vim-search-tipstricks -[7]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#conclusion -[8]:https://www.howtoforge.com/tutorial/vim-editor-modes-explained/ -[9]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-basic-search.png -[10]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-end.png -[11]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-back.png -[12]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-highlight-search.png -[13]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-set-hlsearch.png -[14]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-case.png -[15]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-results-list.png -[16]:http://vim.wikia.com/wiki/Searching diff --git a/sources/tech/20170210 WD My Passport Wireless Linux Hacks.md b/sources/tech/20170210 WD My Passport Wireless Linux Hacks.md deleted file mode 100644 index a3b2a31957..0000000000 --- a/sources/tech/20170210 WD My Passport Wireless Linux Hacks.md +++ /dev/null @@ -1,40 +0,0 @@ -WD My Passport Wireless Linux Hacks -============================================================ - -While WD My Passport Wireless is a rather useful device in its own right, the fact that it powered by a lightweight yet complete Linux distribution means that its capabilities can be extended even further. Deploy, for example, [rclone][3] on the device, and you can back up the photos and raw files stored on the disk to any supported cloud storage service. - -Before you can do this, though, you need to connect the device to a Wi-Fi network and enable SSH (so that you can access the underlying Linux system via SSH). To connect the WD My Passport Wireless to you current Wi-Fi network, power the device and connect to the wireless hotspot it creates from your regular Linux machine. Open a browser, point it to _[http://mypassport.local][1]_, and log in to the device’s web interface. Switch to the Wi-Fi section, and connect to the existing your local Wi-Fi network. Switch then to the Admin section and enable SSH access. - - ![wd-mypassport-wireless-admin](https://scribblesandsnaps.files.wordpress.com/2017/02/wd-mypassport-wireless-admin.png?w=605) - -On your Linux machine, open the terminal and connect to the device using the `ssh root@mypassport.local` command. - -Deploying rclone then is a matter of running the following commands: - -| 123456789 | `curl -O http:``//downloads``.rclone.org``/rclone-current-linux-arm``.zip``unzip rclone-current-linux-arm.zip``cd` `rclone-*-linux-arm``cp` `rclone` `/usr/sbin/``chown` `root:root` `/usr/sbin/rclone``chmod` `755` `/usr/sbin/rclone``mkdir` `-p` `/usr/local/share/man/man1``sudo` `cp` `rclone.1` `/usr/local/share/man/man1/``sudo` `mandb` | - -Once you’ve done that, run the `rclone config` command. Since you are configuring rclone on a headless machine, follow the instructions on the [Remote Setup][4] page. You’ll find detailed information on configuring and using rclone in the [Linux Photography][5] book. - -You can put the WD My Passport Wireless to other practical uses, too. Since the device comes with Python, you can run scripts and Python-based web applications on the device. For example, you can deploy the simple [What’s in My Bag][6] application to track your photographic gear. - -| 12345 | `curl -LOk https:``//github``.com``/dmpop/wimb/archive/master``.zip``unzip master.zip``mv` `wimb-master/ wimb``cd` `wimb``curl -LOk https:``//github``.com``/bottlepy/bottle/raw/master/bottle``.py` | - -Run `./wimb.py` to start the app and point the browser to _[http://mypassport:8080/wimb][2]_ to access and use the application. - --------------------------------------------------------------------------------- - -via: https://scribblesandsnaps.com/2017/02/10/wd-my-passport-wireless-linux-hacks/ - -作者:[Dmitri Popov ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://scribblesandsnaps.com/author/dmpop/ -[1]:http://mypassport.local/ -[2]:http://mypassport:8080/wimb -[3]:http://rclone.org/ -[4]:http://rclone.org/remote_setup/ -[5]:https://gumroad.com/l/linux-photography -[6]:https://github.com/dmpop/wimb diff --git a/sources/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md b/sources/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md deleted file mode 100644 index 681c337afc..0000000000 --- a/sources/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md +++ /dev/null @@ -1,228 +0,0 @@ -translating by ypingcn - -A beginner's guide to understanding sudo on Ubuntu -============================================================ - -### On this page - -1. [What is sudo?][4] -2. [Can any user use sudo?][5] -3. [What is a sudo session?][6] -4. [The sudo password][7] -5. [Some important sudo command line options][8] - 1. [The -k option][1] - 2. [The -s option][2] - 3. [The -i option][3] -6. [Conclusion][9] - -Ever got a 'Permission denied' error while working on the Linux command line? Chances are that you were trying to perform an operation that requires root permissions. For example, the following screenshot shows the error being thrown when I was trying to copy a binary file to one of the system directories: - -[ - ![permission denied on the shell](https://www.howtoforge.com/images/sudo-beginners-guide/perm-denied-error.png) -][11] - -So what's the solution to this problem? Simple, use the **sudo** command. - -[ - ![run command with sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-example.png) -][12] - -The user who is running the command will be prompted for their login password. Once the correct password is entered, the operation will be performed successfully. - -While sudo is no doubt a must-know command for any and everyone who works on the command line in Linux, there are several other related (and in-depth) details that you should know in order to use the command more responsibly and effectively.  And that's exactly what we'll be discussing here in this article. - -But before we move ahead, it's worth mentioning that all the commands and instructions mentioned in this article have been tested on Ubuntu 14.04LTS with Bash shell version 4.3.11. - -### What is sudo? - -The sudo command, as most of you might already know, is used to execute a command with elevated privileges (usually as root). An example of this we've already discussed in the introduction section above. However, if you want, you can use sudo to execute command as some other (non-root) user. - -This is achieved through the -u command line option the tool provides. For example, in the example shown below, I (himanshu) tried renaming a file in some other user's (howtoforge) home directory, but got a 'permission denied' error. And then I tried the same 'mv' command with 'sudo -u howtoforge,' the command was successful: - -[ - ![What is sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-switch-user.png) -][13] - -### Can any user use sudo? - -No. For a user to be able to use sudo, an entry corresponding to that user should be in the /etc/sudoers file. The following paragraph - taken from Ubuntu's website - should make it more clear: - -``` -The /etc/sudoers file controls who can run what commands as what users on what machines and can also control special things such as whether you need a password for particular commands. The file is composed of aliases (basically variables) and user specifications (which control who can run what). -``` - -If you are using Ubuntu, it's easy to make sure that a user can run the sudo command: all you have to do is to make that user account type 'administrator'. This can be done by heading to System Settings... -> User Accounts. - -[ - ![sudo users](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-accounts.png) -][14] - -Unlocking the window: - -[ - ![unlocking window](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-unlock.png) -][15] - -Then selecting the user whose account type you want to change, and then changing the type to 'administrator' - -[ - ![choose sudo accounts](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-admin-account.png) -][16] - -However, if you aren't on Ubuntu, or your distribution doesn't provide this feature, you can manually edit the /etc/sudoers file to make the change. You'll be required to add the following line in that file: - -``` -[user]    ALL=(ALL:ALL) ALL -``` - -Needless to say, [user] should be replaced by the user-name of the account you're granting the sudo privilege. An important thing worth mentioning here is that the officially suggested method of editing this file is through the **visudo** command - all you have to do is to run the following command: - -sudo visudo - -To give you an idea why exactly is that the case, here's an excerpt from the visudo manual: - -``` -visudo edits the sudoers file in a safe fashion. visudo locks the sudoers file against multiple simultaneous edits, provides basic sanity checks, and checks for parse errors. If the sudoers file is currently being edited you will receive a message to try again later. -``` - -For more information on visudo, head [here][17]. - -### What is a sudo session? - -If you use the sudo command frequently, I am sure you'd have observed that after you successfully enter the password once, you can run multiple sudo commands without being prompted for the password. But after sometime, the sudo command asks for your password again. - -This behavior has nothing to do with the number of sudo-powered commands you run, but instead depends on time. Yes, by default, sudo won't ask for password for 15 minutes after the user has entered it once. Post these 15 minutes, you'll be prompted for password again. - -However, if you want, you can change this behavior. For this, open the /etc/sudoers file using the following command: - -sudo visudo - -And then go to the line that reads: - -``` -Defaults env_reset -``` - -[ - ![env_reset](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-time-default.png) -][18] - -and add the following variable (highlighted in bold below) at the end of the line - -``` -Defaults env_reset,timestamp_timeout=[new-value] -``` - -The [new-value] field should be replaced by the number of minutes you want your sudo session to last. For example, I used the value 40. - -[ - ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) -][19] - -In case you want to get prompted for password every time you use the sudo command, then in that case you can assign the value '0' to this variable. And for those of you who want that their sudo session should never time out, you can assign the value '-1'. - -Please note that using timestamp_timeout with value '-1' is strongly discouraged. - -### The sudo password - -As you might have observed, whenever sudo prompts you for a password and you start entering it, nothing shows up - not even asterisks that's usually the norm. While that's not a big deal in general, some users may want to have the asterisks displayed for whatever reason. - -The good thing is that's possible and pretty easy to do. All you have to do is to change the following line in /etc/sudoers file: - -``` -Defaults        env_reset -``` - -to - -``` -Defaults        env_reset,pwfeedback -``` - -And save the file. - -Now, whenever you'll type the sudo password, asterisk will show up. - -[ - ![hide the sudo password](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-password.png) -][20] - -### Some important sudo command line options - -Aside from the -u command line option (which we've already discussed at the beginning of this tutorial), there are some other important sudo command line options that deserve a mention. In this section, we will discuss some of those. - -### The -k option - -Consider a case where-in you've just run a sudo-powered command after entering your password. Now, as you already know, the sudo session remains active for 15-mins by default. Suppose during this session, you have to give someone access to your terminal, but you don't want them to be able to use sudo. What will you do? - -Thankfully, there exists a command line option -k that allows user to revoke sudo permission. Here's what the sudo man page has to say about this option: - -``` --k, --reset-timestamp - -When used without a command, invalidates the user's cached credentials. In other words, the next time sudo is run a password will be required. This option does not require a password and was added to allow a user to revoke sudo permissions from a .logout file. - -When used in conjunction with a command or an option that may require a password, this option will cause sudo to ignore the user's cached credentials. As a result, sudo will prompt for a password (if one is required by the security policy) and will not update the user's cached credentials. -``` - -### The -s option - -There might be times when you work requires you to run a bucketload of commands that need root privileges, and you don't want to enter the sudo password every now and then. Also, you don't want to tweak the sudo session timeout limit by making changes to the /etc/sudoers file.  - -In that case, you may want to use the -s command line option of the sudo command. Here's how the sudo man page explains it: - -``` --s, --shell - -Run the shell specified by the SHELL environment variable if it is set or the shell specified by the invoking user's password database entry. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. -``` - -So basically, what this command line option does is: - -* Launches a new shell - as for which shell, the SHELL env variable is referred. In case $SHELL is empty, the shell defined in the /etc/passwd file is picked up. -* If you're also passing a command name along with the -s option (for example: sudo -s whoami), then the actual command that gets executed is: sudo /bin/bash -c whoami. -* If you aren't trying to execute any other command (meaning, you're just trying to run sudo -s) then you get an interactive shell with root privileges. - -What's worth keeping in mind here is that the -s command line option gives you a shell with root privileges, but you don't get the root environment - it's your .bashrc that gets sourced. This means that, for example, in the new shell that sudo -s runs, executing the whoami command will still return your username, and not 'root'. - -### The -i option - -The -i option is similar to the -s option we just discussed. However, there are some differences. One of the key differences is that -i gives you the root environment as well, meaning your (user's) .bashrc is ignored. It's like becoming root without explicitly logging as root. What more, you don't have to enter the root user's password as well. - -**Important**: Please note that there exists a **su** command which also lets you switch users (by default, it lets you become root). This command requires you to enter the 'root' password. To avoid this, you can also execute it with sudo ('sudo su'); in that case you'll just have to enter your login password. However, 'su' and 'sudo su' have some underlying differences - to understand them as well as know more about how 'sudo -i' compares to them, head [here][10]. - -### Conclusion - -I hope that by now you'd have at least got the basic idea behind sudo, and how you tweak it's default behavior. Do try out the /etc/sudoers tweaks we've explained here, also go through the forum discussion (linked in the last paragraph) to get more insight about the sudo command. - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ - -作者:[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/sudo-beginners-guide/ -[1]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-k-option -[2]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-s-option -[3]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-i-option -[4]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-sudo -[5]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#can-any-user-use-sudo -[6]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-a-sudo-session -[7]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-sudo-password -[8]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#some-important-sudo-command-line-options -[9]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#conclusion -[10]:http://unix.stackexchange.com/questions/98531/difference-between-sudo-i-and-sudo-su -[11]:https://www.howtoforge.com/images/sudo-beginners-guide/big/perm-denied-error.png -[12]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-example.png -[13]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-switch-user.png -[14]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-accounts.png -[15]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-unlock.png -[16]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-admin-account.png -[17]:https://www.sudo.ws/man/1.8.17/visudo.man.html -[18]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-time-default.png -[19]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-timeout.png -[20]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-password.png diff --git a/sources/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md b/sources/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md deleted file mode 100644 index 94325eaf06..0000000000 --- a/sources/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md +++ /dev/null @@ -1,102 +0,0 @@ -申请翻译 -How to Auto Execute Commands/Scripts During Reboot or Startup -============================================================ - - Download Your Free eBooks NOW - [10 Free Linux eBooks for Administrators][5] | [4 Free Shell Scripting eBooks][6] - -I am always fascinated by the things going on behind the scenes when I [boot a Linux system and log on][1]. By pressing the power button on a bare metal or starting a virtual machine, you put in motion a series of events that lead to a fully-functional system – sometimes in less than a minute. The same is true when you log off and / or shutdown the system. - -What makes this more interesting and fun is the fact that you can have the operating system execute certain actions when it boots and when you logon or logout. - -In this distro-agnostic article we will discuss the traditional methods for accomplishing these goals in Linux. - -Note: We will assume the use of Bash as main shell for logon and logout events. If you happen to use a different one, some of these methods may or may not work. If in doubt, refer to the documentation of your shell. - -### Executing Linux Scripts During Reboot or Startup - -There are two traditional methods to execute a command or run scripts during startup: - -#### Method #1 – Use a cron Job - -Besides the usual format (minute / hour / day of month / month / day of week) that is widely used to indicate a schedule, [cron scheduler][2] also allows the use of `@reboot`. This directive, followed by the absolute path to the script, will cause it to run when the machine boots. - -However, there are two caveats to this approach: - -1. a) the cron daemon must be running (which is the case under normal circumstances), and -2. b) the script or the crontab file must include the environment variables (if any) that will be needed (refer to this StackOverflow thread for more details). - -#### Method #2 – Use /etc/rc.d/rc.local - -This method is valid even for systemd-based distributions. In order for this method to work, you must grant execute permissions to `/etc/rc.d/rc.local` as follows: - -``` -# chmod +x /etc/rc.d/rc.local -``` - -and add your script at the bottom of the file. - -The following image shows how to run two sample scripts (`/home/gacanepa/script1.sh` and `/home/gacanepa/script2.sh`) using a cron job and rc.local, respectively, and their respective results. - -script1.sh: -``` -#!/bin/bash -DATE=$(date +'%F %H:%M:%S') -DIR=/home/gacanepa -echo "Current date and time: $DATE" > $DIR/file1.txt -``` -script2.sh: -``` -#!/bin/bash -SITE="Tecmint.com" -DIR=/home/gacanepa -echo "$SITE rocks... add us to your bookmarks." > $DIR/file2.txt -``` -[ - ![Run Linux Scripts at Startup](http://www.tecmint.com/wp-content/uploads/2017/02/Run-Linux-Commands-at-Startup.png) -][3] - -Run Linux Scripts at Startup - -Keep in mind that both scripts must be granted execute permissions previously: - -``` -$ chmod +x /home/gacanepa/script1.sh -$ chmod +x /home/gacanepa/script2.sh -``` - -### Executing Linux Scripts at Logon and Logout - -To execute a script at logon or logout, use `~.bash_profile` and `~.bash_logout`, respectively. Most likely, you will need to create the latter file manually. Just drop a line invoking your script at the bottom of each file in the same fashion as before and you are ready to go. - -##### Summary - -In this article we have explained how to run script at reboot, logon, and logout. If you can think of other methods we could have included here, feel free to use the comment form below to point them out. We look forward to hearing from you! - --------------------------------------------------------------------------------- - -作者简介: - -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/auto-execute-linux-scripts-during-reboot-or-startup/ - -作者:[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/ -[00]:https://twitter.com/ravisaive -[01]:https://www.facebook.com/ravi.saive -[02]:https://plus.google.com/u/0/+RaviSaive - -[1]:http://www.tecmint.com/linux-boot-process/ -[2]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ -[3]:http://www.tecmint.com/wp-content/uploads/2017/02/Run-Linux-Commands-at-Startup.png -[4]:http://www.tecmint.com/author/gacanepa/ -[5]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ -[6]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170213 Orange Pi as Time Machine Server.md b/sources/tech/20170213 Orange Pi as Time Machine Server.md deleted file mode 100644 index 2b29f7c895..0000000000 --- a/sources/tech/20170213 Orange Pi as Time Machine Server.md +++ /dev/null @@ -1,147 +0,0 @@ -beyondworld translating - -Orange Pi as Time Machine Server -============================================================ - - ![Orange Pi as Time Machine Server](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=960%2C450) - -One of my projects has been to organize automated backups of the various computers in the house.  This includes a couple Macs with some precious data on them.  So, I decided to put my inexpensive [Orange Pi][3] with [Armbian][4] Linux to the test, with the goal of getting [Time Machine][5] working over the network to a USB drive attached to the pi board.  That being the case, I discovered and successfully installed Netatalk. - -[Netatalk][6] is open source software that acts as an Apple file server.  With a combination of [Avahi][7] and Netatalk running, your Mac can discover your pi board on the network and will even consider it to be a “Mac” type device.  This enables you to connect manually to the network drive but more importantly it enables Time Machine to find and use the remote drive.  The below guidance may help if you if you wish to set up a similar backup capability for your Macs. - -### Preparations - -To set up the USB drive, I first experimented with an HFS+ formatted file system.  Unfortunately, I could never get write permissions working.  So, I opted instead to create an EXT4 filesystem and ensured that my user “pi” had read/write permissions.  There are many ways to format a drive but my preferred (and recommended) method is to use [gparted][8] whenever possible.  Since gparted is included with the Armbian desktop, that I what I used. - -I wanted this drive to be automatically mounted to the same location every time the pi board boots or the USB drive is connected.  So, I created a location for it to be mounted, made a “tm” directory for the actual backups, and changed the ownership of “tm” to user pi: - -``` -cd /mnt -sudo mkdir timemachine -cd timemachine -sudo mkdir tm -sudo chown pi:pi tm -``` - -Then I opened a terminal and edited /etc/fstab… - -``` -sudo nano /etc/fstab -``` - -…and added a line at the end for the device  (in my case, is it sdc2): - -``` -/dev/sdc2 /mnt/timemachine ext4 rw,user,exec 0 0 -``` - -You will need to install some prerequisites packages via command line, some of which may already be installed on your system: - -``` -sudo apt-get install build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev libmysqlclient-dev avahi-daemon libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libio-socket-inet6-perl tracker libtracker-sparql-1.0-dev libtracker-miner-1.0-dev hfsprogs hfsutils avahi-daemon -``` - -### Install & Configure Netatalk - -The next action is to download Netatalk, extract the downloaded archive file, and navigate to the Netatalk software directory: - -``` -wget https://sourceforge.net/projects/netatalk/files/netatalk/3.1.10/netatalk-3.1.10.tar.bz2 -tar xvf netatalk-3.1.10.tar.bz2 -cd netatalk-3.1.10 -``` - -Now you need to configure, make, and make install the software.  In the netatalk-3.1.10 directory, run the following configure command and be prepared for it to take a bit of time: - -``` -./configure --with-init-style=debian-systemd --without-libevent --without-tdb --with-cracklib --enable-krbV-uam --with-pam-confdir=/etc/pam.d --with-dbus-daemon=/usr/bin/dbus-daemon --with-dbus-sysconf-dir=/etc/dbus-1/system.d --with-tracker-pkgconfig-version=1.0 -``` - -When that finishes, run: - -``` -make -``` - -Be prepared for this to take a rather long time to complete.  Seriously, grab a cup of coffee or something.  When that is finally done, run the following command: - -``` -sudo make install -``` - -That should complete in a brief moment.  Now you can verify installation and also find the location of configuration files with the following two commands: - -``` -sudo netatalk -V -sudo afpd -V -``` - -You will need to edit your afp.conf file so that your time machine backup location is defined, your user account has access to it, and to specify whether or not you want [Spotlight][9] to index your backups. - -``` -sudo nano /usr/local/etc/afp.conf -``` - -As an example, my afp.conf includes the following: - -``` -[My Time Machine Volume] -path = /mnt/timemachine/tm -valid users = pi -time machine = yes -spotlight = no -``` - -Finally, enable and start up Avahi and Netatalk: - -``` -sudo systemctl enable avahi-daemon -sudo systemctl enable netatalk -sudo systemctl start avahi-daemon -sudo systemctl start netatalk -``` - -### Connecting to the Network Drive - -At this point, your Mac may have already discovered your pi board and network drive. Open Finder on the Mac and see if you have something like this: - - ![](https://i2.wp.com/piboards.com/wp-content/uploads/2017/02/TM_drive.png?resize=241%2C89) - -You can also connect to the server by host name or IP address, for example: - -``` -afp://192.168.1.25 -``` - -### Time Machine Backup - -And at last…open Time Machine on the Mac, and select disk, and choose your Orange Pi. - - ![](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=579%2C381) - -This set up will definitely work and the Orange Pi handles the process like a champ, but keep in mind this may not be the fastest of backups.  But it is easy, inexpensive, and ‘just works’ like it should.  If you have success or improvements for this type of set up, please comment below or send me a note. - - ![](https://i0.wp.com/piboards.com/wp-content/uploads/2017/02/backup_complete.png?resize=300%2C71) - -Orange Pi boards are available at Amazon (affiliate links): - --------------------------------------------------------------------------------- - -via: http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ - -作者:[MIKE WILMOTH][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://piboards.com/author/piguy/ -[1]:http://piboards.com/author/piguy/ -[2]:http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ -[3]:https://www.amazon.com/gp/product/B018W6OTIM/ref=as_li_tl?ie=UTF8&tag=piboards-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B018W6OTIM&linkId=08bd6573c99ddb8a79746c8590776c39 -[4]:https://www.armbian.com/ -[5]:https://support.apple.com/kb/PH25710?locale=en_US -[6]:http://netatalk.sourceforge.net/ -[7]:https://en.wikipedia.org/wiki/Avahi_(software) -[8]:http://gparted.org/ -[9]:https://support.apple.com/en-us/HT204014 diff --git a/sources/tech/20170213 Set Up and Configure a Firewall with FirewallD on CentOS 7.md b/sources/tech/20170213 Set Up and Configure a Firewall with FirewallD on CentOS 7.md index 350b46aba5..444ad6b72e 100644 --- a/sources/tech/20170213 Set Up and Configure a Firewall with FirewallD on CentOS 7.md +++ b/sources/tech/20170213 Set Up and Configure a Firewall with FirewallD on CentOS 7.md @@ -1,3 +1,4 @@ +translating by Locez Set Up and Configure a Firewall with FirewallD on CentOS 7 ============================================================ diff --git a/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md deleted file mode 100644 index 3a638b150b..0000000000 --- a/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md +++ /dev/null @@ -1,48 +0,0 @@ -The Best Operating System for Linux Gaming: Which One Do You Use and Why? -============================================================ - - -### Tell us which is the best Linux distro for Linux gaming - - -In the last few months, we tried multiple GNU/Linux distributions for gaming purposes, and we have come to the conclusion that there's no perfect operating system out there designed for Linux gaming. - -We all know that the world of gaming is split between Nvidia and AMD users. Now, if you're using an Nvidia graphics card, even one from five years ago, chances are it's supported on most Linux-based operating systems because Nvidia provides up-to-date video drivers for most, if not all of its GPUs. - -Of course, this means that you shouldn't have any major issues with most GNU/Linux distributions if you have an Nvidia GPU. At least not related to graphical artifacts or other performance problems when playing games, which will drastically affect your gaming experiences. - -The best Linux gaming OS for AMD Radeon users - -Now, things are totally different if you're using an AMD Radeon GPU. We all know that AMD's proprietary graphics drivers still need a lot of work to be compatible with the latest GNU/Linux distributions and all the AMD GPUs that exist out there, as well as the latest X.Org Server and Linux kernel releases. - -Currently, the AMDGPU-PRO video driver works only on Ubuntu 16.04 LTS, CentOS 6.8/7.3, Red Hat Enterprise Linux 6.8/7.3, and SUSE Linux Enterprise Desktop and Server 12 SP2\. With the exception of Ubuntu 16.04 LTS, we have no idea why AMD provides support for all those server-oriented and enterprise-ready operating systems. - -We refuse to believe that there are Linux gamers out there who use any of these OSes for anything gaming related. The [latest AMDGPU-PRO update][1] finally brought support for AMD Radeon GPUs from the HD 7xxx and 8xxx series, but what if we don't want to use Ubuntu 16.04 LTS? - -On the other hand, we have the Mesa 3D Graphics Library, which is found on most distros out there. The Mesa graphics stack provides us with quite powerful open-source Radeon and AMDGPU drivers for our AMD GPUs, but to enjoy the best gaming experience possible, you also need to have the latest X.Org Server and Linux kernels. - -Not all Linux operating systems come with the latest Mesa (13.0), X.Org Server (1.19), and Linux kernel (4.9) versions with support for older AMD GPUs. Some have only one or two of these technologies, but we need them all and the kernel needs to be compiled with AMD Radeon Southern Islands and Sea Island support for the AMDGPU driver to work. - -We found the entire situation quite disheartening, at least for some AMD Radeon gamers using a bit older graphics cards. For now, we have discovered that the best gaming experience with an AMD Radeon HD 8xxx GPU can be achieved only by using Mesa 17 from Git and Linux kernel 4.10 RC. - -So we're asking you now - if you've found the perfect GNU/Linux distribution for gaming, no matter if your using an AMD Radeon or Nvidia GPU, but we are most interested in those who are using AMD GPUs, what distro and settings are you using and can you play the latest games or are still experiencing issues? Thank you! - --------------------------------------------------------------------------------- - -via: http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml - -作者:[Marius Nestor ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://news.softpedia.com/editors/browse/marius-nestor -[1]:http://news.softpedia.com/news/amdgpu-pro-16-60-linux-driver-finally-adds-amd-radeon-hd-7xxx-8xxx-support-512280.shtml -[2]:http://news.softpedia.com/editors/browse/marius-nestor -[3]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# -[4]:https://share.flipboard.com/bookmarklet/popout?v=2&title=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml&t=1487038258&utm_campaign=widgets&utm_medium=web&utm_source=flipit&utm_content=news.softpedia.com -[5]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# -[6]:http://twitter.com/intent/tweet?related=softpedia&via=mariusnestor&text=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml -[7]:https://plus.google.com/share?url=http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml -[8]:https://twitter.com/intent/follow?screen_name=mariusnestor diff --git a/sources/tech/20170214 CentOS Vs. Ubuntu.md b/sources/tech/20170214 CentOS Vs. Ubuntu.md index d6730b9766..4b06c9b851 100644 --- a/sources/tech/20170214 CentOS Vs. Ubuntu.md +++ b/sources/tech/20170214 CentOS Vs. Ubuntu.md @@ -1,3 +1,4 @@ +Yoo-4x translating # [CentOS Vs. Ubuntu][5] [ diff --git a/sources/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md b/sources/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md deleted file mode 100644 index 7b6dfb9140..0000000000 --- a/sources/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md +++ /dev/null @@ -1,72 +0,0 @@ -# rusking translating -# [Best Windows Like Linux Distributions For New Linux Users][12] - - -[ - ![Best Windows Like Linux Distributions](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/best-windows-like-linux-distributions_1_orig.jpg) -][5]Hey new Linux users, you may be wondering that which Linux distro to choose after seeing so many distros based on Linux. Most of you might be switching from windows to Linux and want those distros which are easy and simple, resemble like windows. So today I will cover those Linux distros whose Desktop Environment is much similar to windows, so let’s start. - -### Linux Mint - -[ - ![linux mint for new linux users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/linux-mint-for-new-linux-users.jpg?1487173522) -][6]The first distro on my list is the famous Linux distro i.e. “[Linux Mint”][14]. You might have heard about Linux mint somewhere when you decided to move from windows to Linux. It is considered as one of the best Linux distros alongside Ubuntu as it is very simple, powerful and easier to operate due to its famous Desktop environment cinnamon. [Cinnamon][15] is very easy to use and there are even [themes][16], icon pack, desklets, applets are available that you can use to make it fully look like any windows rather XP, 7, 8, or 10. [Cinnamon][17] is one of the famous DE in Linux world. You will surely find it easy, powerful and lovable.Also read - -[Linux Mint 18.1 "Serena" Is One Of The Finest Linux Distro -​][1][Cinnamon The Best Linux Desktop Environment For New Users][2] - -### Zorin OS - -[ - ![zorin os for windows users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/zorin-os-for-windows-users.jpg?1487174149) -][7][Zorin OS][18] is also the famous Linux distro replacement for windows 7\. Beautiful start menu, taskbar, animation while no compromise on speed and stability. Zorin OS will be the best choice for you if you love windows 7 and not windows 10\. It also comes with preloaded software, so you won't be troubled while looking for software. I was really fell in love with the animations and look. Go grab it.Also read - [Zorin OS 12 Review | LinuxAndUbuntu Distro Review Of The Week][3] - -### Robolinux - -[ - ![robolinux for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/robolinux-for-new-users.jpg?1487174455) -][8][Robolinux][9] is the Linux distribution that comes with built-in wine. Yeah! It has built-in support for windows applications so you won't miss your favorite applications from Windows. They call it “[Stealth VM][10]”. I was really impressed by this feature as it is unique. Also, there are a lot of DE, so can choose any DE that will suit your needs and love. They also have a tool to copy your whole C drive, so no file misses out. Unique. Isn’t it? - -### ChaletOS - -[ - ![chalet os for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/chalet-os-for-new-users.jpg?1487174713) -][11]Did someone say [ChaletOS][19]? It is one of those [Linux distros][20] that feature the closest look and feel to windows. The above pic is after I used windows 10 icons and theme, so you get the idea that it can be easily themed. Pre Handy apps also help to make distro better. You will really feel at home while using it. It's screenshot even fooled my friends. Go ahead and try it, you will love it.Also read - [ChaletOS A New Beautiful Linux Distribution][4] - -### Conclusion - -I wanted to keep this list as short as possible as I didn’t want to confuse a new user to find it difficult to choose among so many options. Still many users have got a distro that isn’t mentioned here. I would invite you to comment below your distro and help new Linux user to choose his best distro for the first time. -​ -Well, these four were the most used **Linux distros** to switch from windows to Linux, however Kubuntu, Elementary OS also put a competition. It overall depends upon users. Most of time [Linux Mint][21] always comes as a winner. I will really recommend it to you if this is your first time to Linux. Go ahead and grab your Linux today and be the part of change. | - --------------------------------------------------------------------------------- - -via: http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users - -作者:[linuxandubuntu.com][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users -[1]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever -[2]:http://www.linuxandubuntu.com/home/cinnamon-desktop-the-best-desktop-environment-for-new-linux-user -[3]:http://www.linuxandubuntu.com/home/zorin-os-12-review-linuxandubuntu-distro-review-of-the-week -[4]:http://www.linuxandubuntu.com/home/chaletos-new-beautiful-linux-distribution-based-on-xubuntu-and-a-clone-of-windows -[5]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users -[6]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/linux-mint-for-new-linux-users_orig.jpg -[7]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/zorin-os-for-windows-users_orig.jpg -[8]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/robolinux-for-new-users_orig.jpg -[9]:https://www.robolinux.org/ -[10]:https://www.robolinux.org/stealth-vm-info/ -[11]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/chalet-os-for-new-users_orig.jpg -[12]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users -[13]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users#comments -[14]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever -[15]:http://www.developer.linuxmint.com/ -[16]:http://www.linuxandubuntu.com/linux-themes/mintilicious-cinnamon-theme-install-in-linux-mint -[17]:http://www.linuxandubuntu.com/linux-apps-releases/cinnamon-2610 -[18]:https://zorinos.com/ -[19]:https://sites.google.com/site/chaletoslinux/home -[20]:http://www.linuxandubuntu.com/home/how-to-create-a-linux-distro -[21]:http://www.linuxandubuntu.com/home/linux-mint-18-sarah-review diff --git a/sources/tech/20170215 Generate random data for your applications with Elizabeth.md b/sources/tech/20170215 Generate random data for your applications with Elizabeth.md deleted file mode 100644 index 1aa74112ae..0000000000 --- a/sources/tech/20170215 Generate random data for your applications with Elizabeth.md +++ /dev/null @@ -1,94 +0,0 @@ -Generate random data for your applications with Elizabeth -============================================================ - - - ![Generate random data for your applications with Elizabeth](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28 "Generate random data for your applications with Elizabeth") -Image by : Opensource.com - - _Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. _ - -No, I've not had my article hijacked by a [Lorem ipsum][2] generator. For this month's Nooks & Crannies column, I found an interesting little Python library to help developers generate random data for their applications. It's called [Elizabeth][3]. - -Written by Líkið Geimfari, and licensed under the MIT license, Elizabeth has a set of 18 data providers in 21 different locales that you can use to generate random information, including names and personal characteristics, addresses, text data, transportation information, networking and Internet social media data, numbers, and much more. Installation requires [Python 3.2][4] or higher, and you can either install it using **pip**, or from the **git** repository. - -For my test drive, I installed with pip, on a fresh [Debian][5] Jessie box. You'll need to **apt-get install python3-pip**, which will install Python and needed dependencies. Then **pip install elizabeth**, and you're ready to use it. - -Just for giggles, let's generate some random data on a person in the Python interactive interpreter: - -``` ->>> from elizabeth import Personal ->>> p=Personal('en') ->>> p.full_name(gender="male") -'Elvis Herring' ->>> p.blood_type() -'B+' ->>> p.credit_card_expiration_date() -'09/17' ->>> p.email(gender='male') -'jessie7517@gmail.com' ->>> p.favorite_music_genre() -'Ambient' ->>> p.identifier(mask='13064########') -'1306420450944' ->>> p.sexual_orientation() -'Heterosexual' ->>> p.work_experience() -39 ->>> p.occupation() -'Senior System Designer' ->>> -``` - -Using it in your code works just the same way—create an object, and then call the methods you want to fill in your data. - -There are 18 different generator tools built into Elizabeth, and adding a new one is not at all difficult; you just have to define the routines that get the data from a JSON collection of values. Here's some random text string generation, again in the interpreter: - -``` ->>> from elizabeth import Text ->>> t=Text('en') ->>> t.swear_word() -'Rat-fink' ->>> t.quote() -'Let them eat cake.' ->>> t.words(quantity=20) -['securities', 'keeps', 'accessibility', 'barbara', 'represent', 'hentai', 'flower', 'keys', 'rpm', 'queen', 'kingdom', 'posted', 'wearing', 'attend', 'stack', 'interface', 'quite', 'elementary', 'broadcast', 'holland'] ->>> t.sentence() -'She spent her earliest years reading classic literature, and writing poetry.' -``` - -It's not a difficult exercise to use Elizabeth to populate a [SQLite][6] or other database you might need for development or testing. The introductory documentation gives an example for a medical application using the [Flask][7] lightweight web framework. - -I'm very impressed with Elizabeth—it's super-fast, lightweight, easily extensible, and the community, while small, is active and engaged. As of this writing, there have been 25 committers to the project, and issues are being handled swiftly. The [full documentation][8] for Elizabeth is easy to read and follow, and provides an extensive API reference, at least for US English. - -I tried tinkering with the links to find if documentation was available in other languages, but I didn't have any success. Because the APIs are different in non-English locales, documenting those variations would be extremely helpful for users. To be fair, it's not terribly hard to read the code and find out what methods are available, even if your Python-fu is not strong. Another glaring lack, for me, was the lack of Arabic or Hebrew locale test data. These are notable right-to-left languages, and for developers who are trying to internationalize their application, proper handling of these languages is a major hurdle. Tools like Elizabeth that can assist with that effort are great to have. - -For developers needing sample data for their applications, Elizabeth is a valuable tool, and for those trying to create truly multilingual, localizable applications, it could be a treasure. - --------------------------------------------------------------------------------- - -作者简介: - -D Ruth Bavousett - D Ruth Bavousett has been a system administrator and software developer for a long, long time, getting her professional start on a VAX 11/780, way back when. She spent a lot of her career (so far) serving the technology needs of libraries, and has been a contributor since 2008 to the Koha open source library automation suite.Ruth is currently a Perl Developer at cPanel in Houston, and also serves as chief of staff for two cats. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/2/elizabeth-python-library - -作者:[D Ruth Bavousett][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/druthb -[1]:https://opensource.com/article/17/2/elizabeth-python-library?rate=kuXZVuHCdEv_hrxRnK1YQctlsTJeFJLcVx3Nf2VIW38 -[2]:https://en.wikipedia.org/wiki/Lorem_ipsum -[3]:https://github.com/lk-geimfari/elizabeth -[4]:https://www.python.org/ -[5]:https://www.debian.org/ -[6]:https://sqlite.org/ -[7]:https://flask.pocoo.org/ -[8]:http://elizabeth.readthedocs.io/en/latest/index.html -[9]:https://opensource.com/user/36051/feed -[10]:https://opensource.com/article/17/2/elizabeth-python-library#comments -[11]:https://opensource.com/users/druthb diff --git a/sources/tech/20170215 How to take screenshots on Linux using Scrot.md b/sources/tech/20170215 How to take screenshots on Linux using Scrot.md index bc388bef11..12ee95eefe 100644 --- a/sources/tech/20170215 How to take screenshots on Linux using Scrot.md +++ b/sources/tech/20170215 How to take screenshots on Linux using Scrot.md @@ -1,3 +1,4 @@ +dongdongmian 翻译中 How to take screenshots on Linux using Scrot ============================================================ diff --git a/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md b/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md index 7b1ac69089..47447d62bd 100644 --- a/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md +++ b/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md @@ -1,3 +1,4 @@ +translating by xiaow6 Using Scripting Languages in IoT: Challenges and Approaches ============================================================ @@ -65,6 +66,6 @@ via: https://www.linux.com/news/event/elcna/2017/2/using-scripting-languages-iot [2]:https://www.linux.com/licenses/category/creative-commons-zero [3]:https://www.linux.com/files/images/paul-sokolovsky-2014-09-21jpg [4]:https://www.linux.com/files/images/scripting-languages-iotjpg -[5]:http://events.linuxfoundation.org/events/embedded-linux-conference/program/schedule?utm_source=linux&utm_campaign=elc17&utm_medium=blog&utm_content=video-blog +[5]:http://events.linuxfoundation.org/events/embedded-linux-conference/program/schedule?utm_source=linux&utm_campaign=elc17&utm_medium=blog&utm_content=video-blog [6]:http://events.linuxfoundation.org/events/embedded-linux-conference [7]:https://events.linuxfoundation.org/events/openiot-summit/program/schedule diff --git a/sources/tech/20170215 openSUSE on Raspberry Pi 3.md b/sources/tech/20170215 openSUSE on Raspberry Pi 3.md deleted file mode 100644 index fb915658e6..0000000000 --- a/sources/tech/20170215 openSUSE on Raspberry Pi 3.md +++ /dev/null @@ -1,81 +0,0 @@ -Cathon is translating... - -# openSUSE on Raspberry Pi 3: From Zero to Functional System in a Few Easy Steps - - -The following article has been contributed by Dmitri Popov, Technical Writer at the SUSE Documentation team. - -Deploying [openSUSE][2] on [Raspberry Pi 3][3] is not all that complicated, but there are a few tricks that smooth the process. - -First of all, you have several flavors to choose from. If you plan to use your Raspberry Pi 3 as a regular machine, an openSUSE version with a graphical desktop is your best option. And you can choose between several graphical environments: [X11][4], [Enlightenment][5], [Xfce][6], and [LXQT][7]. There is also the JeOS version of openSUSE which provides a bare-bones system ideal for transforming a Raspberry Pi 3 into a headless server. Better still, you can choose between the [Leap][8] and [Tumbleweed ][9]versions of openSUSE. - - ![](https://www.suse.com/communities/blog/files/2017/02/j5dkkbtepng-dmitri-popov-450x300.jpg) - -The first order of business is to download the desired openSUSE image from [https://en.opensuse.org/HCL:Raspberry_Pi3][10]. Next, you need to create a bootable microSD card. While you can write the downloaded image to a microSD card using command-line tools, [ _Etcher_ ][11] makes the process more enjoyable and safe. Grab the utility from the project’s website, extract the downloaded  _.zip_  file and make the resulting  _.AppImage_  file executable using the command: - - _chmod +x Etcher-x.x.x-linux-x64.AppImage_ - -Plug then a microSD card into your machine, launch Etcher by double-clicking on it, select the downloaded  _.raw.xz_  image file, and press Flash!. Connect a display and keyboard to the Raspberry Pi 3, insert the microSD card in it, and boot the little machine. During the first boot, openSUSE automatically expands the file system to make use of all free space on the card. At some point you’ll see the following message: - -``` -GPT data structures destroyed! You may now partition the disk using -fdisk or other utilities -``` - -There is no need to panic, though. Wait a minute or two, and openSUSE will continue to boot normally. When prompted, log in using the default  _root_  user name and  _linux_  password. - -If you choose to deploy JeOS on your Raspberry Pi 3, keep in mind that you won’t see any output in the screen during first boot. This means that the screen will remain blank until the system finishes expanding the file system. While you can configure kernel parameters to show output, it’s probably not worth the hassle. Just wait till you see the command-line prompt. - -Since openSUSE comes with SSH enabled and configured, you can boot the Raspberry Pi without a display. In this case, you need to connect the Raspberry Pi to your network via Ethernet. Just give the Raspberry Pi enough time to boot and expand the system, and you can then connect to it via SSH from any other machine on the same network using the  _ssh root@linux.local_  command. - -By default, you log in to the system as root, and it’s a good idea to create a regular user. The all-mighty YaST configuration tool lets you do that with consummate ease. Run the  _yast2_  command, switch to the Security and Users -> User and Group Management section, and add a new user. While you are at it, you can update the system in the System -> Online Update section. Once you’ve done that, quit YaST, reboot the Raspberry Pi, and log in as the newly created user. - -That’s all fine and dandy, but there is one crucial component of the system that doesn’t work right out of the box: the wireless interface. Fortunately, this issue is easy to solve. First, install the nano text editor using the command: - - _sudo zypper in nano_ - -then run: - - _sudo nano/etc/dracut.conf.d/raspberrypi_modules.conf_ - -to open the  _raspberrypi_modules.conf_  file for editing. Remove  _sdhci_iproc_  in the first line and uncomment the last line. Save the changes, run the command: - - _mkinitrd -f_ - -and reboot the Raspberry Pi. - - ![](https://www.suse.com/communities/blog/files/2017/02/figure1-raspi-450x329.png) - -Launch YaST again, switch to the System -> Network Settings section, and you should see the  _BCM43430 WLAN Card_  entry in the list of network interfaces. Select this entry and press Edit. Enable the Dynamic Address DHCP option, press Next, select the desired wireless network, and configure the required connection settings. Press Next and then OK to save the settings. Reboot the Raspberry Pi, and it should automatically connect to the specified Wi-Fi network. - -And that’s it ! - --------------------------------------------------------------------------------- - -via: https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/ - -作者:[chabowski][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.suse.com/communities/blog/author/chabowski/ -[1]:https://www.suse.com/communities/blog/author/chabowski/ -[2]:https://www.opensuse.org/ -[3]:https://www.raspberrypi.org/ -[4]:https://www.x.org/wiki/ -[5]:https://www.enlightenment.org/ -[6]:https://www.xfce.org/ -[7]:http://lxqt.org/ -[8]:https://www.opensuse.org/#Leap -[9]:https://www.opensuse.org/#Tumbleweed -[10]:https://en.opensuse.org/HCL:Raspberry_Pi3 -[11]:https://etcher.io/ -[12]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# -[13]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# -[14]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# -[15]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# -[16]:https://www.suse.com/communities/blog/opensuse-raspberry-pi-3-zero-functional-system-easy-steps/# -[17]:http://www.printfriendly.com/print?url=https%3A%2F%2Fwww.suse.com%2Fcommunities%2Fblog%2Fopensuse-raspberry-pi-3-zero-functional-system-easy-steps%2F -[18]:http://www.printfriendly.com/print?url=https%3A%2F%2Fwww.suse.com%2Fcommunities%2Fblog%2Fopensuse-raspberry-pi-3-zero-functional-system-easy-steps%2F diff --git a/sources/tech/20170216 MASTER Cpp PROGRAMMING WITH OPEN-SOURCE BOOKS.md b/sources/tech/20170216 MASTER Cpp PROGRAMMING WITH OPEN-SOURCE BOOKS.md deleted file mode 100644 index 302e245b30..0000000000 --- a/sources/tech/20170216 MASTER Cpp PROGRAMMING WITH OPEN-SOURCE BOOKS.md +++ /dev/null @@ -1,243 +0,0 @@ -MASTER C++ PROGRAMMING WITH OPEN-SOURCE BOOKS -============================================================ - -Books are very personal and subjective possessions. And programming books are no exception. But regardless of their style, focus, or pace, good C++ programming books take the reader on a compelling journey, opening eyes to the capabilities of the language, and showing how it can be used to build just about anything. - -I have carefully selected C++ books which all share the virtue of being compelling to read. I recommend 9 books which are released under public copyright licenses. Before doing so, I’ll give a brief introduction to C++. - -C++ was designed by Bjarne Stroustrup with its first release in 1983\. It is a statically typed, free-form, multi-paradigm, portable, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it has a combination of both high-level and low-level language features. C++ was designed for systems and applications programming, extending the C programming language. Hence the name C++, the increment operator is written as ++. - -C++ remains a popular programming language. For example, it is heavily used in embedded systems, banking, and telecommunications. It is a superset of C that retains the efficiency and notational convenience of C, while providing facilities for stronger type checking, multiple inheritance, data abstraction, exception handling operator overloading, generic programming, and object-oriented programming. C++ has influenced many other languages including C#, Java, and the development of C. - - - ![The Boost C++ Libraries](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/BoostC.jpeg?resize=200%2C245&ssl=1) - -### [The Boost C++ Libraries][3] - -By Boris Schäling (570 pages) - -The Boost C++ libraries are regarded as important and influential in the C++ world. These portable libraries provide support for tasks and structures such as multithreading, containers, string and text processing, iterators, linear algebra, pseudo-random number generation, template metaprogramming, concurrent programming, data structures, image processing, regular expressions, and unit testing. Boost works on almost any modern operating system, including Linux and Windows variants, and supports most modern compilers. - -This book introduces 72 Boost libraries that provide a wide range of useful capabilities. They help programmers manage memory and process strings more easily. The libraries provide containers and other data structures that extend the standard library. They make it easy to build platform-independent network applications. - -This is a gem to add to any collection. The 430 code examples illustrate the libraries’ capabilities well. - -Chapters examine memory management, string handling, containers, data structures, algorithms, communication, streams and files, and time. Later chapters proceed to explore functional, parallel and generic programming. The book closes with masterly coverage on language extensions, error and number handling, application libraries, design patterns, and other libraries. - -Boost C++ Libraries is released under the Creative Commons Attribution – NonCommercial – NoDerivatives 4.0 International License. There is a print version to buy on Amazon if you like to carry books around. Electronic version are also available to purchase in Kindle, E-book, and PDF formats. - - - ![C++ Annotations](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/CAnnotations.png?resize=470%2C663&ssl=1) - - -### [C++ Annotations][4] - -By Frank B. Brokken (1029 pages) - -The C++ Annotations offers an extensive tutorial about the C++ programming language. It can be used as a textbook for C++ programming courses. The C++ Annotations is intended for knowledgeable users of C or a language that uses a C-like grammar. - -Chapters include: - -* Name Spaces -* Strings – C offers rudimentary string support -* IO-stream Library – offers an input/output (I/O) library based on class concepts -* Classes – C offers two methods for structuring data of different types. The C struct holds data members of various types, and the C union also defines data members of various types. This chapter introduces classes, a kind of struct but its contents are by default inaccessible to the outside world -* Static Data and Functions -* Memory Management – examines the operators that handle memory allocation in C++ -* Exceptions – allow C++ programs to perform a controlled non-local return, without the disadvantages of longjmp and setjmp -* Operator Overloading – takes a look at operator overloading in general -* Abstract Containers -* Inheritance – another term for derivation. The chapter shows that base class pointers may be used to point to derived class objects -* Polymorphism – a special form of inheritance -* Friends – introduces the friend keyword and the principles that underly its use -* Pointers to Members – defining pointers to members, using pointers to members, pointers to static members, and pointer sizes -* Nested Classes – used in situations where the nested class has a close conceptual relationship to its surrounding class -* Standard Template Library (STL) – a general purpose library consisting of containers, generic algorithms, iterators, function objects, allocators, adaptors and data structures. The data structures used by the algorithms are abstract in the sense that the algorithms can be used with (practically) any data type -* Generic Algorithms – cover the STL’s generic algorithms -* Function Templates – explores the syntactic peculiarities of templates. The notions of template type parameter, template non-type parameter, and function template are introduced and several examples of templates are provided -* Class Templates – constructing and using class templates is discussed -* Advanced Template Use – following a short overview of subtleties related to templates the main characteristics of template meta programming are introduced - -The book is available in HTML, PDF, PostScript, and plain text. It’s freely distributable, and published under the terms of the GNU General Public License. - - - ![Introduction to Design Patterns in C++ with Qt 4, An](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/DesignPatternsQt4.jpeg?resize=200%2C264&ssl=1) - - -### [Introduction to Design Patterns in C++ with Qt 4, An][5] - -By Alan Ezust, Paul Ezust (656 pages) - -This book starts with an introduction to the basic C++ elements, OO concepts, UML, and the core Qt classes. It moves on to higher-level programming ideas, Qt modules, and design patterns. The final part of the book examines important C++ features with rigour. There is good coverage on functions, inheritance and polymorphism. - -The book is designed to be used in a university class, and assumes no C or C++ programming experience. It includes Qt examples, exercises, solutions, and lecture slides for instructors. - -This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later. - - - ![How to Think Like a Computer Scientist: C++](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/ComputerScientistC.jpg?resize=200%2C250&ssl=1) - - -### [How to Think Like a Computer Scientist: C++][6] - -By Allen B. Downey (191 pages) - -How To Think Like A Computer Scientist C++ version is a concise and gentle introduction to software design using the C++ programming language. Intended for would-be developers with no programming experience, this book starts with the most basic concepts and gradually adds new material at a pace that is comfortable to the reader. - -This book providing a wealth of information on: - -* Variables, expressions and statements -* Functions -* Conditionals and recursion -* Fruitful functions -* Iteration -* Strings -* Vectors -* Member functions -* Vectors of Objects -* Objects of Vectors -* Classes and invariants -* File Input/Output and apmatrixes - -How to Think Like a Computer Scientist: C++ Version is a free textbook available under the Creative Commons Attribution-NonCommercial 3.0 Unported License. - - - ![C++ GUI Programming with Qt 3](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/02/CQt3.jpeg?resize=200%2C262&ssl=1) - -### [C++ GUI Programming with Qt 3][7] - -By Jasmin Blanchette, Mark Summerfield (464 pages) - -The latest stable release of Qt is version 5.8\. This book teaches the reader how to write GUI programs using Qt 3, the last version of Qt 3 was released in 2004\. But there is a lot of the book which still makes sense for Qt 4 and Qt 5. - -C++ GUI Programming with Qt 3 assumes the reader has a rudimentary understanding of C++; this isn’t a book intended for a beginner. - -The book introduces the reader to all the concepts and practices to program GUI applications using Qt. Central topics are given a thorough treatment, and there is some specialized and advanced material. - -This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later. - - - ![Open Data Structures (in C++)](https://i2.wp.com/www.ossblog.org/wp-content/uploads/2017/02/OpenDataStructures.jpg?resize=200%2C300&ssl=1) - - -### [Open Data Structures (in C++)][1] - -By Pat Morin (336 pages) - -This book teaches the design and analysis of basic data structures and their implementation in C++. It covers the implementation and analysis of data structures for sequences (lists), queues, priority queues, unordered dictionaries, ordered dictionaries, and graphs. The author was motivated to offer undergraduate computer science a free way to study data structures. But this book is not intended to act as an introduction to the C++ programming language or the C++ Standard Template library. Instead, it should help programmers understand how STL data structures are implemented and why these implementations are efficient. - -Chapters cover array-based lists, linked lists, skiplists, hash tables, binary trees including random binary search trees, scapegoat trees, and red-black trees. Later chapters examine heaps, sorting algorithms (comparison-based, counting sort, and radix sort), graphs, data structures for integers, and external memory searching. - -The book and is released under a Creative Commons Attribution License. Read the book for free – released in HTML, PDF, and the book’s LaTeX, Java/C++/Python sources can be downloaded from GitHub. There is also a paperback version to buy. The book has been translated into Slovenian and Turkish. - - - ![Cross-Platform GUI Programming with wxWidgets](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/02/wxWidgets.jpeg?resize=200%2C264&ssl=1) - - -### [Cross-Platform GUI Programming with wxWidgets][8] - -By Julian Smart and Kevin Hock with Stefan CsomorBrifll (744 pages) - -wxWidgets is a popular C++ library that lets developers create applications for Windows, Mac OS X, Linux and other platforms with a single code base. It supports a wide range of graphical libraries. - -Following a brief introduction and getting started, the book’s chapters cover: - -* Event handling -* Window basics -* Drawing and painting -* Handing input -* Window layout using sizers -* Using standard dialogs -* Creating custom dialogs -* Programming with images -* Clipboard and drag and drop -* Advanced window classes -* Data structure classes -* Files and streams -* Memory management, debugging and error checking -* Writing international applications -* Writing multithreaded applications -* Programming with wxSocket -* Working with documents and views -* Perfecting your application - -This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later. - - - ![The Rook's Guide to C++](https://i0.wp.com/www.ossblog.org/wp-content/uploads/2017/02/RooksGuide.jpg?resize=200%2C300&ssl=1) - - -### [The Rook’s Guide to C++][2] - -By Jeremy Hansen (160 pages) - -Chapters cover variables, literals and constants, output, input, data types and conversion, conditionals (if, else and else if, switch statements), strings, loops, arrays, blocks, functions and scope. Later chapters examine problem solving and troubleshooting, the preprocessor, advanced arithmetic, file I/O, pointers, dynamic data, classes and abstraction, separation compilation and STL. - -Most of the book was written during a hackathon weekend by 25 Norwich University students. Certainly not flawless, but a good general text. It is released under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. The book is also available in print from Amazon. - - ![An Introduction to GCC](https://i1.wp.com/www.ossblog.org/wp-content/uploads/2017/01/IntroductionGCC.png?resize=200%2C300&ssl=1) - - -### [An Introduction to GCC][9] - -By Brian Gough (144 pages) - -An Introduction to GCC provides an introduction to the GNU C and C++ Compilers, gcc and g++, which are part of the GNU Compiler Collection (GCC). - -This book explains how to use the compiler itself. Based on years of observation of questions posted on mailing lists, it guides the reader straight to the important options of GCC. - -Chapters: - -* Introduction -* Compiling a C program – describes how to compile C programs using gcc. Programs can be compiled from a single source file or from multiple source files, and may use system libraries and header files -* Compilation options – describes other commonly-used compiler options available in GCC. These options control features such as the search paths used for locating libraries and include files, the use of additional warnings and diagnostics, preprocessor macros and C language dialects -* Using the preprocessor – describes the use of the GNU C preprocessor cpp, which is part of the GCC package. The preprocessor expands macros in source files before they are compiled. It is automatically called whenever GCC processes a C or C++ program -* Compiling for debugging – provides the -g debug option to store additional debugging information in object files and executables. This debugging information allows errors to be traced back from a specific machine instruction to the corresponding line in the original source file -* Compiling with optimization – GCC is an optimizing compiler. It provides a wide range of options which aim to increase the speed, or reduce the size, of the executable files it generates -* Compiling a C++ program – describes how to use GCC to compile programs written in C++, and the command-line options specific to that language -* Platform-specific options – describes some of the options available for common platforms: Intel and AMD x86 options, x86 extensions, x86 64-bit processors, DEC Alpha options, SPARC options, POWER/PowerPC options, Multi-architecture support, and floating-point issues -* Troubleshooting – GCC provides several help and diagnostic options to help troubleshoot problems with the compilation process -* Compiler-related tools – describes a number of tools which are useful in combination with GCC. These include the GNU archiver ar, for creating libraries, and the GNU profiling and coverage testing programs, gprof and gcov -* How the compiler works – describes in more detail how GCC transforms source files to an executable file. Compilation is a multi-stage process involving several tools, including the GNU Compiler itself (through the gcc or g++ frontends), the GNU Assembler as, and the GNU Linker ld. The complete set of tools used in the compilation process is referred to as a toolchain -* Examining compiled files – describes several useful tools for examining the contents of executable files and object files -* Common error messages – describes the most frequent error and warning messages produced by gcc and g++. Each case is accompanied by a description of the causes, an example and suggestions of possible solutions -* Getting help – if readers encounters a problem not covered by this introduction, there are several reference manuals which describe GCC and language-related topics in more detail - -This book is published under the GNU Free Documentation License. - -* * * - -There are other C++ books to download for free, but which are not released under an open source license, or where the author does not specify a license. Notable books include: - -[Thinking in C++, 2nd edition, Volume One & Two][14] – Bruce Eckel (and additionally Chuck Allison for Volume Two) -[C++ In Action:Industrial Strength Programming ][15]– by Bartosz Milewski - -And finally, my recommendation for a budding C++ programmer has to be [Programming — Principles and Practice Using C++ (Second Edition)][16]. Widely regarded as the finest introductory text, written by the inventor of C++. Worth every penny. - --------------------------------------------------------------------------------- - -via: https://www.ossblog.org/master-c-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]:http://opendatastructures.org/ods-cpp/ -[2]:https://rooksguide.org/ -[3]:https://theboostcpplibraries.com/ -[4]:http://www.icce.rug.nl/documents/cplusplus/ -[5]:http://www.informit.com/store/introduction-to-design-patterns-in-c-plus-plus-with-9780131879058 -[6]:http://greenteapress.com/thinkcpp/index.html -[7]:http://www.informit.com/store/c-plus-plus-gui-programming-with-qt-3-9780131240728 -[8]:http://www.informit.com/store/cross-platform-gui-programming-with-wxwidgets-9780131473812 -[9]:http://www.network-theory.co.uk/docs/gccintro/ -[10]:https://www.ossblog.org/author/steve/ -[11]:https://www.ossblog.org/master-c-programming-with-open-source-books/#comments -[12]:https://www.ossblog.org/category/books/ -[13]:https://www.ossblog.org/category/programming/ -[14]:http://mindview.net/Books/TICPP/ThinkingInCPP2e.html -[15]:http://www.relisoft.com/book/ -[16]:http://stroustrup.com/Programming/ diff --git a/sources/tech/20170216 Tips To Improve Ubuntu Speed.md b/sources/tech/20170216 Tips To Improve Ubuntu Speed.md deleted file mode 100644 index a45ae57fcf..0000000000 --- a/sources/tech/20170216 Tips To Improve Ubuntu Speed.md +++ /dev/null @@ -1,75 +0,0 @@ -# [Tips To Improve Ubuntu Speed][4] - - -[ - ![Tips To Improve Ubuntu Speed](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/tips-to-improve-ubuntu-speed_orig.jpg) -][2]Chances are that your Ubuntu desktop will run so smooth. You will wonder why you did not switch from those other slow loading desktop operating systems (looking at you Windows). Ubuntu runs smoothly on most modern machines and older machines using variants such as Lubuntu, Xubuntu and [Ubuntu MATE][6] are going to be impressive as well. Very few times, your experience can get poorer on your Ubuntu desktop. On the off chance that your Ubuntu PC is not running as smoothly as you would like, there are a few things you could do to improve your system performance and response.​But why is my computer running slow in the first place? Let me enumerate a few - -1. Computer is getting old -2. You have too many application installed -3. Something is broken in your system -4. Many more….. - -Now let us take a look at a few of this hacks. - -### 1\. Swappiness - -If you have a system with a Swap partition, this is for you (NOTE: Swap partitions are not recommended for Solid State Drives as they reduce the lifespan of the drive). Swap partitions aid systems especially ones with low RAM installed to manage your system memory. Writing data to Swap (hard disk) is slower compared to RAM, so you can reduce the swappiness value to limit how often data is written to your Swap partition. By default, Ubuntu’s swappiness is set to 60 percent so you can reduce to say 10 percent with the following command. -sudo bash -c "echo 'vm.swappiness = 10' >> /etc/sysctl.conf" - -### 2\. Stop Indexing - -Indexing aims to speed up search results, but on the other hand, can cause systems with old configuration. To stop indexing, enter the following command to remove the indexing tool.sudo apt-get purge apt-xapian-index - -### 3\. Manage your startup applications - -Startup applications can have a huge impact on the performance of your system. Some applications you install will add their startup entries to have them started at boot but you can remove some of these applications to improve your system performance. Open “Startup Applications” by typing searching in Unity launcher. Most of autostart entries will be hidden so enter the following command in terminal to make the visiblesudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop[ - ![ubuntu startup application](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/ubuntu-startup-application_orig.jpg) -][3] - -### 4\. Try Preload - -Preload is a daemon or a background service that monitors your application use on your system and the preloads the required binaries libraries ahead of time into memory so the applications start faster. Install preload with the following terminal command.sudo apt-get install preload - -### 5\. Choose Lighter Applications - -So what applications are you using on your Ubuntu desktop? Are there lighter alternatives available? If YES, then switch to them if they can meet your feature set. LibreOffice will give you the best office experience but an alternative like Abiword could very much improve your system performance. - -### 6\. Switch to a lighter DE - -Are you using Ubuntu with Unity or KDE? These desktop environments can be quite demanding on your system. Instead, you can switch to LxQt or XFCE by installing it along your current DE or switching to a different variant of Ubuntu like Lubuntu or Xubuntu for a more faster experienc. - -### 7\. Clean out junk from your system - -Ubuntu PCs do not get as slower with time as do Windows PC but they do get slower nonetheless. Cleaning unneeded files from your system can help improve your performance. Try the computer Janitor tool available with Ubuntu Tweak tool to clean up your system. There is also the Bleachbit tool available for cleaning your system. - -### 8\. Try a clean Install - -Sometimes, something might just be broken and cleaning out junk or most of the other options mentioned already might not help. Your only option therefore, is to backup your files and try a clean install. -Also read - [Bleachbit An Alternative To CCleaner][1] - -### 9\. Upgrade your hardware - -The last one on my list is upgrading your hardware. This might be possible on most situations, but if it is, it could very much improve your system performance. You could increase your installed RAM, switch from a traditional disk to a Solid State Drive or upgrade your processor especially if you’re running on a desktop PC. - -### Conclusion - -​I hope these simple tips will go a long way in having your Ubuntu desktop run at an **impressive speed**. Note you don’t need to do all these, just try out the ones that are applicable to your situation and find out how your system responds. Do you know any other way of improving your Ubuntu system’s performance? Share with us in the comments. | - --------------------------------------------------------------------------------- - -via: http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed - -作者:[linuxandubuntu.com][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed -[1]:http://www.linuxandubuntu.com/home/bleachbit-an-alternative-to-ccleaner-on-linux -[2]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed -[3]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/ubuntu-startup-application_orig.jpg -[4]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed -[5]:http://www.linuxandubuntu.com/home/tips-to-improve-ubuntu-speed#comments -[6]:http://www.linuxandubuntu.com/home/linuxandubuntu-distro-review-of-the-week-ubuntu-mate-1610 diff --git a/sources/tech/20170217 How to Use Yum History to Find Out Installed or Removed Packages Info.md b/sources/tech/20170217 How to Use Yum History to Find Out Installed or Removed Packages Info.md deleted file mode 100644 index 6acaa4e6ca..0000000000 --- a/sources/tech/20170217 How to Use Yum History to Find Out Installed or Removed Packages Info.md +++ /dev/null @@ -1,221 +0,0 @@ -OneNewLife translating - -How to Use ‘Yum History’ to Find Out Installed or Removed Packages Info -============================================================ - - -[YUM][1] is an interactive, rpm based, high level package manager for RHEL/CentOS systems, it enables users to install new packages, remove/erase old/unwanted packages. It can [automatically run system updates][2] and does dependency analysis, and also perform queries on the installed and/or available packages plus so much more. - -In this article, we will explain how to view history of YUM transactions in order to find out information about installed packages and those that where removed/erased from a system. - -**Suggested Read:** [20 Linux YUM Commands for Package Management][3] - -Below are some examples of how to use the YUM history command. - -### View Complete YUM History - -To view a full history of YUM transactions, we can run the command below which will show us the: transaction id, login user who executed the particular action, date and time when the operation happened, the actual action and additional information about any thing wrong with the operation: - -``` -# yum history -``` -[ - ![View Yum History](http://www.tecmint.com/wp-content/uploads/2017/02/View-Yum-History.png) -][4] - -View Yum History - -### Use Yum to Find Package Info - -The history sub-commands: info/list/summary can take a transaction ID or package name as an argument. Additionally, the list sub-command can take a special argument, all meaning – all transactions. - -The previous history command is equivalent to running: - -``` -# yum history list all -``` - -And, you can view details of transactions concerning a given package such as `httpd` web server with the `info`command as follows: - -``` -# yum history info httpd -``` -[ - ![Yum - Find Package Info](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Package-Info.png) -][5] - -Yum – Find Package Info - -To get a summary of the transactions concerning `httpd` package, we can issue the following command: - -``` -# yum history summary httpd -``` -[ - ![Yum - Find Summary of Package](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Summary-of-Package.png) -][6] - -Yum – Find Summary of Package - -It is also possible to use a transaction ID, the command below will display details of the transaction ID `15`. - -``` -# yum history info 15 -``` -[ - ![Yum - Find Package Info Using ID](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Info-Using-ID.png) -][7] - -Yum – Find Package Info Using ID - -### Use Yum History to Find Package Transaction Info - -There are sub-commands that print out transaction details of a specific package or group of packages. We can use `package-list` or `package_info` to view more info about `httpd` package like so: - -``` -# yum history package-list httpd -OR -# yum history package-info httpd -``` -[ - ![Yum - Find Package Transaction Info](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Transaction-Info.png) -][8] - -Yum – Find Package Transaction Info - -To get history about multiple packages, we can run: - -``` -# yum history package-list httpd epel-release -OR -# yum history packages-list httpd epel-release -``` -[ - ![Yum - Find Multiple Packages Info](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Multiple-Package-Info.png) -][9] - -Yum – Find Multiple Packages Info - -### Use Yum to Rollback Packages - -Furthermore, there are certain history sub-commands that enable us to: undo/redo/rollback transactions. - -1. Undo – will undo a specified transaction. -2. redo – repeat the work of a specified transaction -3. rollback – will undo all transactions up to the point of the specified transaction. - -They take either a single transaction id or the keyword last and an offset from the last transaction. - -For example, assuming we’ve done 60 transactions, “last” refers to transaction 60, and “last-4” points to transaction 56. - -**Suggested Read:** [How to Use ‘yum-utils’ to Maintain Yum and Boost its Performance][10] - -This is how the sub-commands above work: If we have 5 transactions: V, W, X, Y and Z, where packages where installed respectively. - -``` -# yum history undo 2 #will remove package W -# yum history redo 2 #will reinstall package W -# yum history rollback 2 #will remove packages from X, Y, and Z. -``` - -In the following example, transaction 2 was a update operation, as seen below, the redo command that follows will repeat transaction 2 upgrading all the packages updated by that time: - -``` -# yum history | grep -w "2" -``` -[ - ![Yum - Find Package Transaction ID](http://www.tecmint.com/wp-content/uploads/2017/02/Find-Yum-Package-Transaction-ID.png) -][11] - -Yum – Find Package Transaction ID - -``` -# yum history redo 2 -``` -[ - ![Yum Redo Package Update](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Redo-Package-Update.png) -][12] - -Yum Redo Package Update - -The redo sub-command can also take some optional arguments before we specify a transaction: - -1. force-reinstall – reinstalls any packages that were installed in that transaction (via yum install, upgrade or downgrade). -2. force-remove – removes any packages that were updated or downgraded. - -``` -# yum history redo force-reinstall 16 -``` -[ - ![Yum - Force Install Package](http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Force-Install-Package.png) -][13] - -Yum – Force Install Package - -### Find Yum History Database and Sources Info - -These sub-commands provide us information about the history DB and additional info sources: - -1. addon-info – will provide sources of additional information. -2. stats – displays statistics about the current history DB. -3. sync – enables us to alter the the rpmdb/yumdb data stored for any installed packages. - -Consider the commands below to understand how these sub-commands practically work: - -``` -# yum history addon-info -# yum history stats -# yum history sync -``` - -To set a new history file, use the new sub-command: - -``` -# yum history new -``` - -We can find a complete information about YUM history command and several other commands in the yum man page: - -``` -# man yum -``` - -**Suggested Read:** [4 Ways to Disable/Lock Certain Package Updates Using Yum][14] - -That’s it for now. In this guide, we explained various YUM history commands to view details of YUM transactions. Remember to offer us your thoughts concerning this guide via the comment section below. - --------------------------------------------------------------------------------- - -作者简介: - -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. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/view-yum-history-to-find-packages-info/ - -作者:[Aaron Kili][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/aaronkili/ - -[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ -[2]:http://www.tecmint.com/auto-install-security-patches-updates-on-centos-rhel/ -[3]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ -[4]:http://www.tecmint.com/wp-content/uploads/2017/02/View-Yum-History.png -[5]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Package-Info.png -[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Find-Summary-of-Package.png -[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Info-Using-ID.png -[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Package-Transaction-Info.png -[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Multiple-Package-Info.png -[10]:http://www.tecmint.com/linux-yum-package-management-with-yum-utils/ -[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Find-Yum-Package-Transaction-ID.png -[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Redo-Package-Update.png -[13]:http://www.tecmint.com/wp-content/uploads/2017/02/Yum-Force-Install-Package.png -[14]:http://www.tecmint.com/yum-lock-disable-blacklist-certain-package-update-version/ -[15]:http://www.tecmint.com/author/aaronkili/ -[16]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ -[17]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170217 How to install pandom a true random number generator for Linux.md b/sources/tech/20170217 How to install pandom a true random number generator for Linux.md new file mode 100644 index 0000000000..71b6d4d97e --- /dev/null +++ b/sources/tech/20170217 How to install pandom a true random number generator for Linux.md @@ -0,0 +1,478 @@ +How to install pandom: a true random number generator for Linux +============================================================ + +### On this page + +1. [Introduction][40] +2. [1 Installation of pandom][41] + 1. [1.1 Gain root access][1] + 2. [1.2 Install build dependencies][2] + 3. [Arch based systems][3] + 4. [Debian based systems][4] + 5. [Red Hat based systems][5] + 6. [SUSE based systems][6] + 7. [1.3 Download and extract sources][7] + 8. [1.4 Test before installing (recommended)][8] + 9. [1.5 Determine init system][9] + 10. [1.6 Install pandom][10] + 11. [init.d based init system (e.g: upstart, sysvinit)][11] + 12. [systemd as init system][12] +3. [2 Analysis of checkme file][42] + 1. [2.1 Gain root access][13] + 2. [2.2 Install build dependencies][14] + 3. [Arch based systems][15] + 4. [Debian based systems][16] + 5. [Red Hat based systems][17] + 6. [SUSE based systems][18] + 7. [2.3 Download and extract sources][19] + 8. [2.4 Install entropyarray][20] + 9. [2.5 Analyze checkme file][21] + 10. [2.6 Uninstall entropyarray (optional)][22] +4. [3 Installation using debian repository][43] + 1. [3.1 Gain root access][23] + 2. [3.2 Install keyring][24] + 3. [3.3 Install sources list][25] + 4. [Wheezy][26] + 5. [Jessie][27] + 6. [Stretch][28] + 7. [3.4 Update sources list][29] + 8. [3.5 Test pandom][30] + 9. [3.6 Install pandom][31] +5. [4 Managing pandom][44] + 1. [4.1 Performance test][32] + 2. [4.2 Entropy and serial correlation test][33] + 3. [4.3 System service][34] + 4. [init.d based init system (e.g: upstart, sysvinit)][35] + 5. [systemd as init system][36] +6. [5 Increasing unpredictability or performance][45] + 1. [5.1 Edit source files][37] + 2. [5.2 Test the unpredictability][38] + 3. [5.3 Install personalized pandom][39] + +This tutorial is for amd64 / x86_64 linux kernel versions greater and equal to 2.6.9\. It explains how to install [pandom][46]: a timing jitter true random number generator maintained by ncomputers.org + +### Introduction + +The built-in Linux kernel true random number generator provides low throughput under modern circumstances, as for example: personal computers with solid state drives (SSD) and virtual private servers (VPS). + +This problem is becoming popular in linux implementations, because of the continuously increasing need for true random numbers, mainly by diverse cryptographic purposes. + +Pandom outputs around 8 KiB/s entropy of 64 [ubits][47] / 64 bits, is compatible with physical and virtual environments and assumes, that no other process running as root user writes to /dev/random. + +### 1 Installation of pandom + +### 1.1 Gain root access + +Pandom must be installed as root, run this command if needed. + +su - + +### 1.2 Install build dependencies + +In order to download and install pandom, you need: GNU **as**sembler, GNU **make**, GNU **tar** and GNU **wget** (the last two usually installed already). You may uninstall them later at will. + +### Arch based systems + +pacman -S binutils make + +### Debian based systems + +apt-get install binutils make + +### Red Hat based systems + +dnf install binutils make + +yum install binutils make + +### SUSE based systems + +zypper install binutils make + +### 1.3 Download and extract sources + +These commands download and extract the sources of pandom from ncomputers.org using **wget** and **tar**. + +wget [http://ncomputers.org/pandom.tar.gz][48] +tar xf pandom.tar.gz +cd pandom/amd64-linux + +### 1.4 Test before installing (recommended) + +This recommended test takes around 8 minutes. It checks for kernel support and generates a file named **checkme** (analyzed on the next section). + +make check + +### 1.5 Determine init system + +Before installing pandom, you need to know, which init software does your system use. If the following command outputs the word **running**, it means that your system is using **systemd**, otherwise it is likely, that your system is using an **init.d** implementation (e.g: upstart, sysvinit). There might be some exceptions, more information in these [unix.stackexchange.com][49] answers. + +systemctl is-system-running + +``` +running +``` + +### 1.6 Install pandom + +Once you know which system does your linux implementation use, then you may install pandom accordingly. + +### init.d based init system (e.g: upstart, sysvinit) + +Install pandom running this command, if your system is using an **init.d** implementation (e.g: upstart, sysvinit). + +make install-init.d + +### systemd as init system + +Install pandom running this command, if your system is using **systemd**. + +make install-systemd + +### 2 Analysis of checkme file + +Before using pandom for cryptographic purposes, it is highly recommended to analyze **checkme** file generated during the installation process in the previous section of this tutorial. This task is useful for knowing if the numbers are truly random or not. This section explains how to analyze **checkme** file using ncomputers.org/**entropyarray**: a shell script, that tests entropy and serial correlation of its input. + +**Note**: this analysis might be run in another computer, such as a laptop or desktop computer. For example: if you are installing pandom in a constrained-resources virtual private server (VPS), you might opt to copy **checkme** file to your personal computer, in order to analyze it there. + +### 2.1 Gain root access + +Entropyarray must be installed as root, run this command if needed. + +su - + +### 2.2 Install build dependencies + +In order to download and install entropyarray, you need: GNU **g++** compiler, GNU **make**, GNU **tar** and GNU **wget** (the last two usually installed already). You may uninstall them later at will. + +### Arch based systems + +pacman -S gcc make + +### Debian based systems + +apt-get install g++ make + +### Red Hat based systems + +dnf install gcc-c++ make + +yum install gcc-c++ make + +### SUSE based systems + +zypper install gcc-c++ make + +### 2.3 Download and extract sources + +These commands download and extract the sources of entropyarray from ncomputers.org using **wget** and **tar**. + +wget [http://ncomputers.org/rearray.tar.gz][50] +wget [http://ncomputers.org/entropy.tar.gz][51] +wget [http://ncomputers.org/entropyarray.tar.gz][52] + +tar xf entropy.tar.gz +tar xf rearray.tar.gz +tar xf entropyarray.tar.gz + +### 2.4 Install entropyarray + +**Note**: errors regarding -std=c++11 mean that the GNU **g++** compiler version doesn't support ISO C++ 2011 standard. You may try to compile ncomputers.org/**entropy** and ncomputers.org/**rearray** in another system that supports it (e.g: GNU g++ in a newer version of your favorite linux distribution) and then install the compiled binaries using **make install** in the system you would like to run **entropyarray**, or skip this step, despite it is highly recommended that you analyze **checkme** file before using pandom for any cryptographic purpose. + +cd rearray; make install; cd .. +cd entropy; make install; cd .. +cd entropyarray; make install; cd .. + +### 2.5 Analyze checkme file + +**Note**: 64 [ubits][53] / 64 bits pandom implementations should result this test with entropy above **15.977** and **max** frequency below **70**. If your results differ too much, you may try to increase the unpredictability of your pandom implementation as described in the fifth section of this tutorial. In case you skipped the last step, you may use other tools such as [pseudorandom number sequence test][54]. + +entropyarray checkme + +``` +entropyarray in /tmp/tmp.mbCopmzqsg +15.977339 +min:12 +med:32 +max:56 +15.977368 +min:11 +med:32 +max:58 +15.977489 +min:11 +med:32 +max:59 +15.977077 +min:12 +med:32 +max:60 +15.977439 +min:8 +med:32 +max:59 +15.977374 +min:13 +med:32 +max:60 +15.977312 +min:12 +med:32 +max:67 +``` + +### 2.6 Uninstall entropyarray (optional) + +If you plan to not use entropyarray any more, then you might want to uninstall it at will. + +cd entropyarray; make uninstall; cd .. +cd entropy; make uninstall; cd .. +cd rearray; make uninstall; cd .. + +### 3 Installation using debian repository + +If you would like to keep pandom updated on your debian based system, you may opt to install / reinstall it using ncomputers.org debian repository. + +### 3.1 Gain root access + +The below debian packages must be installed as root, run this command if needed. + +su - + +### 3.2 Install keyring + +This debian package includes the public key of the ncomputers.org debian repository. + +wget [http://ncomputers.org/debian/keyring.deb][55] +dpkg -i keyring.deb +rm keyring.deb + +### 3.3 Install sources list + +These debian packages include the sources list of the ncomputers.org debian repository according to the latest debian distributions (year 2017). + +**Note**: It is also possible to write the commented lines below in **/etc/apt/sources.list**, instead of installing the respective debian package for your debian distribution, but if these sources change in the future, then you would need to update them manually. + +### Wheezy + +#deb [http://ncomputers.org/debian][56] wheezy main +wget [http://ncomputers.org/debian/wheezy.deb][57] +dpkg -i wheezy.deb +rm wheezy.deb + +### Jessie + +#deb [http://ncomputers.org/debian][58] jessie main +wget [http://ncomputers.org/debian/jessie.deb][59] +dpkg -i jessie.deb +rm jessie.deb + +### Stretch + +#deb [http://ncomputers.org/debian][60] stretch main +wget [http://ncomputers.org/debian/stretch.deb][61] +dpkg -i stretch.deb +rm stretch.deb + +### 3.4 Update sources list + +Once the keyring and sources list are installed. + +apt-get update + +### 3.5 Test pandom + +Once tested, you may uninstall the below package at will. + +**Note**: if you have already tested pandom in your linux implementation, you may skip this step. + +apt-get install pandom-test +pandom-test + +``` +generating checkme file, please wait around 8 minutes ... +entropyarray in /tmp/tmp.5SkiYsYG3h +15.977366 +min:12 +med:32 +max:57 +15.977367 +min:13 +med:32 +max:57 +15.977328 +min:12 +med:32 +max:61 +15.977431 +min:12 +med:32 +max:59 +15.977437 +min:11 +med:32 +max:57 +15.977298 +min:11 +med:32 +max:59 +15.977196 +min:10 +med:32 +max:57 +``` + +### 3.6 Install pandom + +apt-get install pandom + +### 4 Managing pandom + +After pandom was installed, you might want to manage it. + +### 4.1 Performance test + +Pandom offers around 8 kilobytes per second, but its performance may vary depending on the environment. + +dd if=/dev/random of=/dev/null bs=8 count=512 + +``` +512+0 records in +512+0 records out +4096 bytes (4.1 kB, 4.0 KiB) copied, 0.451253 s, 9.1 kB/s +``` + +### 4.2 Entropy and serial correlation test + +Besides of ncomputers.org/**entropyarray**, there are more tests, for example [NIST testsuite by Ilja Gerhardt][62]. + +entropyarray /dev/random 1M + +### 4.3 System service + +Pandom runs as a system service. + +### init.d based init system (e.g: upstart, sysvinit) + +/etc/init.d/random status +/etc/init.d/random start +/etc/init.d/random stop +/etc/init.d/random restart + +### systemd as init system + +systemctl status random +systemctl start random +systemctl stop random +systemctl restart random + +### 5 Increasing unpredictability or performance + +If you would like to try to increase the unpredictabiity or the performance of your pandom implementation, you may try to add or delete CPU time measurements. + +### 5.1 Edit source files + +In the source files **test.s** and **tRNG.s** add or remove measurement blocks at will. + +``` +#measurement block +mov $35,%rax +syscall +rdtsc +[...] + +#measurement block +mov $35,%rax +syscall +rdtsc +[...] +``` + +### 5.2 Test the unpredictability + +We recommend to always test any personalized pandom implementation before using it for cryptographic purposes. + +make check + +### 5.3 Install personalized pandom + +If you are happy with the results, then you may install your personalized pandom implementation. + +make install + +Additional information and updates: [http://ncomputers.org/pandom][63] + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/ + +作者:[Oliver][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-install-pandom-a-true-random-number-generator/ +[1]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-gain-root-access +[2]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-build-dependencies +[3]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#arch-based-systems +[4]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#debian-based-systems +[5]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#red-hat-based-systems +[6]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#suse-based-systems +[7]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-download-and-extract-sources +[8]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-test-before-installing-recommended +[9]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-determine-init-system +[10]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-pandom +[11]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#initd-based-init-system-eg-upstart-sysvinit +[12]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#systemd-as-init-system +[13]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-gain-root-access-2 +[14]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-build-dependencies-2 +[15]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#arch-based-systems-2 +[16]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#debian-based-systems-2 +[17]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#red-hat-based-systems-2 +[18]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#suse-based-systems-2 +[19]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-download-and-extract-sources-2 +[20]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-entropyarray +[21]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-analyze-checkme-file +[22]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-uninstall-entropyarray-optional +[23]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-gain-root-access-3 +[24]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-keyring +[25]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-sources-list +[26]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#wheezy +[27]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#jessie +[28]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#stretch +[29]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-update-sources-list +[30]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-test-pandom +[31]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-pandom-2 +[32]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-performance-test +[33]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-entropy-and-serial-correlation-test +[34]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-system-service +[35]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#initd-based-init-system-eg-upstart-sysvinit-2 +[36]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#systemd-as-init-system-2 +[37]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-edit-source-files +[38]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-test-the-unpredictability +[39]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-install-personalized-pandom +[40]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#introduction +[41]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-installation-of-pandom +[42]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-analysis-of-checkme-file +[43]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-installation-using-debian-repository +[44]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-managing-pandom +[45]:https://www.howtoforge.com/tutorial/how-to-install-pandom-a-true-random-number-generator/#-increasing-unpredictability-or-performance +[46]:http://ncomputers.org/pandom +[47]:http://ncomputers.org/ubit +[48]:http://ncomputers.org/pandom.tar.gz +[49]:http://unix.stackexchange.com/a/18210/94448 +[50]:http://ncomputers.org/rearray.tar.gz +[51]:http://ncomputers.org/entropy.tar.gz +[52]:http://ncomputers.org/entropyarray.tar.gz +[53]:http://ncomputers.org/ubit +[54]:http://www.fourmilab.ch/random/ +[55]:http://ncomputers.org/debian/keyring.deb +[56]:http://ncomputers.org/debian +[57]:http://ncomputers.org/debian/wheezy.deb +[58]:http://ncomputers.org/debian +[59]:http://ncomputers.org/debian/jessie.deb +[60]:http://ncomputers.org/debian +[61]:http://ncomputers.org/debian/stretch.deb +[62]:https://gerhardt.ch/random.php +[63]:http://ncomputers.org/pandom diff --git a/sources/tech/20170217 Understanding the difference between sudo and su.md b/sources/tech/20170217 Understanding the difference between sudo and su.md new file mode 100644 index 0000000000..c62dd17bc0 --- /dev/null +++ b/sources/tech/20170217 Understanding the difference between sudo and su.md @@ -0,0 +1,159 @@ +申请翻译 +Understanding the difference between sudo and su +============================================================ + +### On this page + +1. [The su command in Linux][7] + 1. [su -][1] + 2. [su -c][2] +2. [Sudo vs Su][8] + 1. [Password][3] + 2. [Default behavior][4] + 3. [Logging][5] + 4. [Flexibility][6] +3. [Sudo su][9] + +In one of our[ earlier articles][11], we discussed the 'sudo' command in detail. Towards the ends of that tutorial, there was a mention of another similar command 'su' in a small note. Well, in this article, we will discuss in detail the 'su' command as well as how it differs from the 'sudo' command. + +But before we do that, please note that all the instructions and examples mentioned in this tutorial have been tested on Ubuntu 14.04LTS. + +### The su command in Linux + +The main work of the su command is to let you switch to some other user during a login session. In other words, the tool lets you assume the identity of some other user without having to logout and then login (as that user). + +The su command is mostly used to switch to the superuser/root account (as root privileges are frequently required while working on the command line), but - as already mentioned - you can use it to switch to any other, non-root user as well. + +Here's how you can use this command to switch to the root user: + +[ + ![The su cmmand without commandline options](https://www.howtoforge.com/images/sudo-vs-su/su-command.png) +][12] + +The password that this command requires is also of the root user. So in general, the su command requires you to enter the password of the target user. After the correct password is entered, the tool starts a sub-session inside the existing session on the terminal. + +### su - + +There's another way to switch to the root user: run the 'su -' command: + +[ + ![The su - command](https://www.howtoforge.com/images/sudo-vs-su/su-hyphen-command.png) +][13] + +Now, what's the difference between 'su' and 'su -' ? Well, the former keeps the environment of the old/original user even after the switch to root has been made, while the latter creates a new environment (as dictated by the ~/.bashrc of the root user), similar to the case when you explicitly log in as root user from the log-in screen. + +The man page of 'su' also makes it clear: + +``` +The optional argument - may be used to provide an environment similar to what the user would expect had the user logged in directly. +``` + +So, you'll agree that logging in with 'su -' makes more sense. But as the 'su' command also exists, one might wonder when that's useful. The following excerpt - taken from the [ArchLinux wiki website][14] - gives a good idea about the benefits and pitfalls of the 'su' command: + +* It sometimes can be advantageous for a system administrator to use the shell account of an ordinary user rather than its own. In particular, occasionally the most efficient way to solve a user's problem is to log into that user's account in order to reproduce or debug the problem. + +* However, in many situations it is not desirable, or it can even be dangerous, for the root user to be operating from an ordinary user's shell account and with that account's environmental variables rather than from its own. While inadvertently using an ordinary user's shell account, root could install a program or make other changes to the system that would not have the same result as if they were made while using the root account. For instance, a program could be installed that could give the ordinary user power to accidentally damage the system or gain unauthorized access to certain data. + +Note: In case you want to pass more arguments after - in 'su -', then you should use the -l command line option that the command offers (instead of -). Here's the definition of - and the -l command line option: + +``` +-, -l, --login +Provide an environment similar to what the user would expect had the user logged in directly. + +When - is used, it must be specified as the last su option. The other forms (-l and --login) do not have this restriction. +``` + +### su -c + +There's another option of the 'su' command that's worth mentioning: -c. It lets you provide a command that you want to run after switching to the target user. + +The man page of 'su' explains it as: + +``` +-c, --command COMMAND + Specify a command that will be invoked by the shell using its -c. + +The executed command will have no controlling terminal. This option cannot be used to execute interactive programs which need a controlling TTY. +``` + +Consider the following example template: + +su [target-user] -c [command-to-run] + +So in this case, the 'command-to-run' will be executed as: + +[shell] -c [command-to-run] + +Where 'shell' would be replaced by 'target-user' shell defined in the /etc/passwd file. + +### Sudo vs Su + +Now since we have discussed the basics of the 'su' command as well, it's time we discuss the differences between the 'sudo' and the 'su' commands. + +### Password + +The primary difference between the two is the password they require: while 'sudo' requires current user's password, 'su' requires you to enter the root user password. + +Quite clearly, 'sudo' is a better alternative between the two as far as security is concerned. For example, consider the case of computer being used by multiple users who also require root access. Using 'su' in such a scenario means sharing the root password with all of them, which is not a good practice in general. + +Moreover, in case you want to revoke the superuser/root access of a particular user, the only way is to change the root password and then redistribute the new root password among all the other users. + +With Sudo, on the other hand, you can handle both these scenarios effortlessly. Given that 'sudo' requires users to enter their own password, you don't need to share the root password will all the users in the first place. And to stop a particular user from accessing root privileges, all you have to do is to tweak the corresponding entry in the 'sudoers' file. + +### Default behavior + +The other difference between the two commands is in their default behavior. While 'sudo' only allows you to run a single command with elevated privileges, the 'su' command launches a new shell, allowing you to run as many commands as you want with root privileges until you explicitly exit that sell. + +So the default behavior of the 'su' command is potentially dangerous given the possibility that the user can forget the fact that they are working as root, and might inadvertently make some irrecoverable changes (such as run the 'rm -rf' command in wrong directory). For a detailed discussion on why it's not encouraged to always work as root, head [here][10]. + +### Logging + +Although commands run through 'sudo' are executed as the target user (which is 'root' by default), they are tagged with the sudoer's user-name. But in case of 'su', it's not possible to directly trace what a user did after they su'd to the root account. + +### Flexibility + +The 'sudo' command is far more flexible in that you can even limit the commands that you want the sudo-ers to have access to. In other words, users with access to 'sudo' can only be given access to commands that are required for their job. However, with 'su' that's not possible - either you have the privilege to do everything or nothing. + +### Sudo su + +Presumably due to the potential risks involved with using 'su' or logging directly as root, some Linux distributions - like Ubuntu - disable the root user account by default. Users are encouraged to use 'sudo' whenever they need root privileges. + +However, you can still do 'su' successfully, i.e, without entering the root password. All you need to do is to run the following command: + +sudo su + +Since you're running the command with 'sudo', you'll only be required to enter your password. So once that is done, the 'su' command will be run as root, meaning it won't ask for any passwords. + +**PS**: In case you want to enable the root account on your system (although that's strongly discouraged because you can always use 'sudo' or 'sudo su'), you'll have to set the root password manually, which you can do that using the following command: + +sudo passwd root + +### Conclusion + +Both this as well as our previous tutorial (which focuses on 'sudo') should give you a good idea about the available tools that let you do tasks that require escalated (or a completely different set of) privileges. In case you have something to share about 'su' or 'sudo', or want to share your own experience, you are welcome to do that in comments below. + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/sudo-vs-su/ + +作者:[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/sudo-vs-su/ +[1]:https://www.howtoforge.com/tutorial/sudo-vs-su/#su- +[2]:https://www.howtoforge.com/tutorial/sudo-vs-su/#su-c +[3]:https://www.howtoforge.com/tutorial/sudo-vs-su/#password +[4]:https://www.howtoforge.com/tutorial/sudo-vs-su/#default-behavior +[5]:https://www.howtoforge.com/tutorial/sudo-vs-su/#logging +[6]:https://www.howtoforge.com/tutorial/sudo-vs-su/#flexibility +[7]:https://www.howtoforge.com/tutorial/sudo-vs-su/#the-su-command-in-linux +[8]:https://www.howtoforge.com/tutorial/sudo-vs-su/#sudo-vs-su +[9]:https://www.howtoforge.com/tutorial/sudo-vs-su/#sudo-su +[10]:http://askubuntu.com/questions/16178/why-is-it-bad-to-login-as-root +[11]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/ +[12]:https://www.howtoforge.com/images/sudo-vs-su/big/su-command.png +[13]:https://www.howtoforge.com/images/sudo-vs-su/big/su-hyphen-command.png +[14]:https://wiki.archlinux.org/index.php/Su diff --git a/sources/tech/20170221 How to Install and Configure FTP Server in Ubuntu.md b/sources/tech/20170221 How to Install and Configure FTP Server in Ubuntu.md new file mode 100644 index 0000000000..76e297cad5 --- /dev/null +++ b/sources/tech/20170221 How to Install and Configure FTP Server in Ubuntu.md @@ -0,0 +1,281 @@ +ucasfl translating +How to Install and Configure FTP Server in Ubuntu +============================================================ + +FTP (File Transfer Protocol) is a relatively old and most used standard network protocol used for uploading/downloading files between two computers over a network. However, FTP by its original insecure, because it transmits data together with user credentials (username and password) without encryption. + +Warning: If you planning to use FTP, consider configuring FTP connection with SSL/TLS (will cover in next article). Otherwise, it’s always better to use secure FTP such as [SFTP][1]. + +**Suggested Read:** [How to Install and Secure FTP Server in CentOS 7][2] + +In this tutorial, we will show how to install, configure and secure a FTP server (VSFTPD in full “Very Secure FTP Daemon“) in Ubuntu to have a powerful security against FTP vulnerabilities. + +### Step 1: Installing VsFTP Server in Ubuntu + +1. First, we need to update the system package sources list and then install VSFTPD binary package as follows: + +``` +$ sudo apt-get update +$ sudo apt-get install vsftpd +``` + +2. Once the installation completes, the service will be disabled initially, therefore, we need to start it manually for the mean time and also enable it to start automatically from the next system boot: + +``` +------------- On SystemD ------------- +# systemctl start vsftpd +# systemctl enable vsftpd +------------- On SysVInit ------------- +# service vsftpd start +# chkconfig --level 35 vsftpd on +``` + +3. Next, if you have [UFW firewall][3] enabled ( its not enabled by default) on the server, you have to open ports 21and 20 where the FTP daemons are listening, in order to allow access to FTP services from remote machines, then add the new firewall rules as follows: + +``` +$ sudo ufw allow 20/tcp +$ sudo ufw allow 21/tcp +$ sudo ufw status +``` + +### Step 2: Configuring and Securing VsFTP Server in Ubuntu + +4. Let’s now perform a few configurations to setup and secure our FTP server, first we will create a backup of the original config file /etc/vsftpd/vsftpd.conf like so: + +``` +$ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig +``` + +Next, let’s open the vsftpd config file. + +``` +$ sudo vi /etc/vsftpd.conf +OR +$ sudo nano /etc/vsftpd.conf +``` + +Add/modify the following options with these values: + +``` +anonymous_enable=NO # disable anonymous login +local_enable=YES # permit local logins +write_enable=YES # enable FTP commands which change the filesystem +local_umask=022 # value of umask for file creation for local users +dirmessage_enable=YES # enable showing of messages when users first enter a new directory +xferlog_enable=YES # a log file will be maintained detailing uploads and downloads +connect_from_port_20=YES # use port 20 (ftp-data) on the server machine for PORT style connections +xferlog_std_format=YES # keep standard log file format +listen=NO # prevent vsftpd from running in standalone mode +listen_ipv6=YES # vsftpd will listen on an IPv6 socket instead of an IPv4 one +pam_service_name=vsftpd # name of the PAM service vsftpd will use +userlist_enable=YES # enable vsftpd to load a list of usernames +tcp_wrappers=YES # turn on tcp wrappers +``` + +5. Now, configure VSFTPD to allow/deny FTP access to users based on the user list file /etc/vsftpd.userlist. + +Note that by default, users listed in userlist_file=/etc/vsftpd.userlist are denied login access with `userlist_deny=YES` option if `userlist_enable=YES`. + +But, the option `userlist_deny=NO` twists the meaning of the default setting, so only users whose username is explicitly listed in userlist_file=/etc/vsftpd.userlist will be allowed to login to the FTP server. + +``` +userlist_enable=YES # vsftpd will load a list of usernames, from the filename given by userlist_file +userlist_file=/etc/vsftpd.userlist # stores usernames. +userlist_deny=NO +``` + +Important: When users login to the FTP server, they are placed in a chrooted jail, this is the local root directory which will act as their home directory for the FTP session only. + +Next, we will look at two possible scenarios of how to set the chrooted jail (local root) directory, as explained below. + +6. At this point, let’s add/modify/uncomment these two following options to [restrict FTP users to their Home directories][4]. + +``` +chroot_local_user=YES +allow_writeable_chroot=YES +``` + +The option `chroot_local_user=YES` importantly means local users will be placed in a chroot jail, their home directory by default after login. + +And we must as well understand that VSFTPD does not permit the chroot jail directory to be writable, by default for security reasons, however, we can use the option allow_writeable_chroot=YES to disable this setting. + +Save the file and close it. Then we have to restart VSFTPD services for the changes above to take effect: + +``` +------------- On SystemD ------------- +# systemctl restart vsftpd +------------- On SysVInit ------------- +# service vsftpd restart +``` + +### Step 3: Testing VsFTP Server in Ubuntu + +7. Now we will test FTP server by creating a FTP user with [useradd command][5] as follows: + +``` +$ sudo useradd -m -c "Aaron Kili, Contributor" -s /bin/bash aaronkilik +$ sudo passwd aaronkilik +``` + +Then, we have to explicitly list the user aaronkilik in the file /etc/vsftpd.userlist with the [echo command][6] and tee command as below: + +``` +$ echo "aaronkilik" | sudo tee -a /etc/vsftpd.userlist +$ cat /etc/vsftpd.userlist +``` + +8. Now it’s about time to test our above configurations are functioning as required. We will begin by testing anonymous logins; we can clearly see from the output below that anonymous logins are not permitted on the FTP server: + +``` +# ftp 192.168.56.102 +Connected to 192.168.56.102 (192.168.56.102). +220 Welcome to TecMint.com FTP service. +Name (192.168.56.102:aaronkilik) : anonymous +530 Permission denied. +Login failed. +ftp> bye +221 Goodbye. +``` + +9. Next, let’s test if a user not listed in the file /etc/vsftpd.userlist will be granted permission to login, which is not true from the output that follows: + +``` +# ftp 192.168.56.102 +Connected to 192.168.56.102 (192.168.56.102). +220 Welcome to TecMint.com FTP service. +Name (192.168.56.10:root) : user1 +530 Permission denied. +Login failed. +ftp> bye +221 Goodbye. +``` + +10. Now we will carry out a final test to determine whether a user listed in the file /etc/vsftpd.userlist, is actually placed in his/her home directory after login. And this is true from the output below: + +``` +# ftp 192.168.56.102 +Connected to 192.168.56.102 (192.168.56.102). +220 Welcome to TecMint.com FTP service. +Name (192.168.56.102:aaronkilik) : aaronkilik +331 Please specify the password. +Password: +230 Login successful. +Remote system type is UNIX. +Using binary mode to transfer files. +ftp> ls +``` +[ + ![Verify FTP Login in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-Login-in-Ubuntu.png) +][7] + +Verify FTP Login in Ubuntu + +Warning: Setting the option `allow_writeable_chroot=YES` can be so dangerous, it has possible security implications, especially if the users have upload permission, or more so, shell access. Only use it if you exactly know what you are doing. + +We should note that these security implications are not specific to VSFTPD, they can also affect all other FTP daemons which offer to put local users in chroot jails. + +Because of this reason, in the section below, we will explain a more secure method of setting a different non-writable local root directory for a user. + +### Step 4: Configure FTP User Home Directories in Ubuntu + +11. Now, open the VSFTPD configuration file once more time. + +``` +$ sudo vi /etc/vsftpd.conf +OR +$ sudo nano /etc/vsftpd.conf +``` + +and comment out the unsecure option using the `#` character as shown below: + +``` +#allow_writeable_chroot=YES +``` + +Next, create the alternative local root directory for the user (aaronkilik, yours is possibly not the same) and set the required permissions by disabling write permissions to all other users to this directory: + +``` +$ sudo mkdir /home/aaronkilik/ftp +$ sudo chown nobody:nogroup /home/aaronkilik/ftp +$ sudo chmod a-w /home/aaronkilik/ftp +``` + +12. Then, create a directory under the local root with the appropriate permissions where the user will store his files: + +``` +$ sudo mkdir /home/aaronkilik/ftp/files +$ sudo chown -R aaronkilk:aaronkilik /home/aaronkilik/ftp/files +$ sudo chmod -R 0770 /home/aaronkilik/ftp/files/ +``` + +Afterwards, add/modify the options below in the VSFTPD config file with their corresponding values: + +``` +user_sub_token=$USER # inserts the username in the local root directory +local_root=/home/$USER/ftp # defines any users local root directory +``` + +Save the file and close it. And restart the VSFTPD services with the recent settings: + +``` +------------- On SystemD ------------- +# systemctl restart vsftpd +------------- On SysVInit ------------- +# service vsftpd restart +``` + +13. Now, let’s perform a final check and make sure that the user’s local root directory is the FTP directory we created in his Home directory. + +``` +# ftp 192.168.56.102 +Connected to 192.168.56.102 (192.168.56.102). +220 Welcome to TecMint.com FTP service. +Name (192.168.56.10:aaronkilik) : aaronkilik +331 Please specify the password. +Password: +230 Login successful. +Remote system type is UNIX. +Using binary mode to transfer files. +ftp> ls +``` +[ + ![FTP User Home Directory Login](http://www.tecmint.com/wp-content/uploads/2017/02/FTP-User-Home-Directory-Login.png) +][8] + +FTP User Home Directory Login + +That’s it! Remember to share your opinion about this guide via the comment form below or possibly provide us any important information concerning the topic. + +Last but not least, do not miss our next article, where we will describe how to [secure an FTP server using SSL/TLS][9] connections in Ubuntu 16.04/16.10, until then, always stay tunned to TecMint. + +-------------------------------------------------------------------------------- + + +作者简介: + +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. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-ftp-server-in-ubuntu/ + +作者:[Aaron Kili][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/aaronkili/ + +[1]:http://www.tecmint.com/sftp-command-examples/ +[2]:http://www.tecmint.com/install-ftp-server-in-centos-7/ +[3]:http://www.tecmint.com/how-to-install-and-configure-ufw-firewall/ +[4]:http://www.tecmint.com/restrict-sftp-user-home-directories-using-chroot/ +[5]:http://www.tecmint.com/add-users-in-linux/ +[6]:http://www.tecmint.com/echo-command-in-linux/ +[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-Login-in-Ubuntu.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/FTP-User-Home-Directory-Login.png +[9]:http://www.tecmint.com/secure-ftp-server-using-ssl-tls-on-ubuntu/ +[10]:http://www.tecmint.com/author/aaronkili/ +[11]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[12]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170221 How to access shell or run external commands from within Vim.md b/sources/tech/20170221 How to access shell or run external commands from within Vim.md new file mode 100644 index 0000000000..1fe25e83bb --- /dev/null +++ b/sources/tech/20170221 How to access shell or run external commands from within Vim.md @@ -0,0 +1,127 @@ +yangmingming translating +How to access shell or run external commands from within Vim +============================================================ + +### On this page + +1. [Execute external commands in Vim][1] +2. [Access Shell in Vim][2] +3. [The loophole to keep in mind][3] + +Vim, as you might already know, is a feature-packed and powerful editor. Here at HowtoForge, we've written several tutorials on Vim, covering its [basic usage][4], [plugins][5], as well as some [other][6] [useful][7] features. But given the sea of features Vim offers, we always find something useful to share with our readership. + +In this tutorial, we will focus on how you can execute external commands as well as access the command line shell from within the editor window. + +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 14.04, and the Vim version we've used is 7.4. + +### Execute external commands in Vim + +Sometimes you might want to execute external commands from within the Vim editor window. For example, consider a situation where-in you've opened a file in Vim, made some changes, and then while trying to save those changes, Vim throws an error saying you don't have sufficient permissions. + +[ + ![Execute commands in VIM](https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/vim-perm-error.png) +][8] + +Now, exiting the current vim session and again opening the file with sufficient privileges will mean loss of all the changes you've done, so that'd, you'll agree, not be an option in most of the cases. It's situations like these where the ability to run external commands from within the editor comes in handy. + +We'll come back to the above use-case later(**), but for now, let's understand how you can run basic commands from within vim. + +Suppose while editing a file, you want to know the number of lines, words, and characters the file contains. To do this, in the command mode of Vim, just input colon (:) followed by a bang (!) and finally the command ('wc' in this case) followed by the file name (use % for current file). + +``` +:! wc % +``` + +Here's an example: + +File with the aforementioned command ready to be executed: + +[ + ![Command ready to be executed in VIM](https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/vim-count-lines.png) +][9] + +and here's the output on the terminal: + +[ + ![command output](https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/vim-wc-output.png) +][10] + +After you are done seeing the output, press the Enter key and you'll be taken back to your Vim session. + +This feature can come in really handy in situations where, say, you are writing a code or script, and want to quickly know whether or not the code/script contains any compile-time or syntax errors. + +Moving on, in case the requirement is to add the output to the file, use the ':read !' command. Here's an example: + +``` +:read ! wc % +``` + +The 'read' command inserts the output of the external command on a new line below the current line in the file being edited. If you want, you can also specify a particular line number - the output will be added after that particular line. + +For example, the following command will add the output of 'wc' after the second line the file. + +``` +:2read ! wc % +``` + +**Note**: Use '$' to insert after the last line and '0' to insert before the first line. + +Now, coming back to the usecase we discussed in the beginning (**), here's the command that'll help you save the file without needing to close it first (which means no loss of unsaved changes) and then opening it with, say, [sudo][11].  + +``` +:w ! sudo tee % +``` + +[ + ![](https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/vim-sudo-passwrd.png) +][12] + +### Access Shell in Vim + +In addition to executing individual commands, you can also have yourself dropped in a newly-launched shell from within Vim. For this, all you have to do is to run the following command from the editor: + +``` +:shell +``` + +or + +``` +:sh +``` + +and type 'exit' when you are done with the shell work - this will bring you back into the Vim session from where you left initially. + +### The loophole to keep in mind + +While the ability to access a shell definitely has its own uses in real world, it can also be used as a privilege escalation technique. As we have explained in one of our earlier tutorials (on sudoedit), even if you provide a user sudo access to only edit one file through Vim, they may launch a new shell from within the editor using this technique, and will then be able to do anything as 'root' or superuser. + +# Conclusion + +Ability to run external commands from within Vim is an important feature that can come in handy in many situations (some of them we have mentioned in this tutorial). The learning curve for this feature isn't steep, so both beginners as well as experienced users can take advantage of it. + +Have you been using this feature for quite some time now? Do you have something to share? Please leave your thoughts in comments below. + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-access-shell-or-run-external-commands-from-within-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-access-shell-or-run-external-commands-from-within-vim/ +[1]:https://www.howtoforge.com/tutorial/how-to-access-shell-or-run-external-commands-from-within-vim/#execute-external-commands-in-vim +[2]:https://www.howtoforge.com/tutorial/how-to-access-shell-or-run-external-commands-from-within-vim/#access-shell-in-vim +[3]:https://www.howtoforge.com/tutorial/how-to-access-shell-or-run-external-commands-from-within-vim/#the-loophole-to-keep-in-mind +[4]:https://www.howtoforge.com/vim-basics +[5]:https://www.howtoforge.com/tutorial/vim-editor-plugins-for-software-developers-3/ +[6]:https://www.howtoforge.com/tutorial/vim-modeline-settings/ +[7]:https://www.howtoforge.com/tutorial/vim-editor-modes-explained/ +[8]:https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/big/vim-perm-error.png +[9]:https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/big/vim-count-lines.png +[10]:https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/big/vim-wc-output.png +[11]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/ +[12]:https://www.howtoforge.com/images/how-to-access-shell-or-run-external-commands-from-within-vim/big/vim-sudo-passwrd.png diff --git a/sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md b/sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md index 10de5ce7a2..a3efebdfc6 100644 --- a/sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md +++ b/sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md @@ -1,3 +1,4 @@ +#rusking translating Create a Shared Directory on Samba AD DC and Map to Windows/Linux Clients – Part 7 ============================================================ diff --git a/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md b/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md new file mode 100644 index 0000000000..49405cbc24 --- /dev/null +++ b/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md @@ -0,0 +1,120 @@ +Introduction to LaTeXila - a multi-language LaTeX editor for Linux +============================================================ + +### On this page + +1. [Why LaTeX?][1] +2. [Starting work on a new document and setting up the structure][2] +3. [LaTeXila ease of use and mathematics][3] +4. [From .tex to .rtf][4] +5. [Conclusion][5] + +LaTeXila is a multi-language LaTeX editor for Linux users who prefer the GTK+ looks. The software is simple, easy to use, adequately powerful and customizable, so if you’re interested in LaTeX you should give this tool a try. In the following quick guide, I will showcase how to get started with LaTeXila and what its main features are. But first... + +### Why LaTeX? + +So, if I want to create a text document, why wouldn’t I simply use the standard LibreOffice or Abiword tools? The answer is because LaTeX editors in general offer more powerful formatting tools than your standard text editor, while the process of writing the content remains simple and pivotal. LaTeX is a document preparation system that is actually meant to simplify the formatting procedures for the most common forms of publishing like books and scientific reports that may contain a lot of mathematical formulas, multi-lingual typesetting elements, cross-references and citations, indexes, bibliographies, etc. While all of these things can actually be done in LibreOffice, they are way easier in LaTeXila while the end result is bound to be of a higher quality if done right. + +### Starting work on a new document and setting up the structure + +First, we need to create a new file on LaTeXila, and this can be done by clicking on the “New File” icon located on the upper left. This will open a dialog that allows us to select a template and get started quickly. + +[ + ![Start the LaTex Editor](https://www.howtoforge.com/images/introduction-to-latexila/pic_1.png) +][6] + +Let’s suppose that I will write a book so I select the book template, add the title and author in the corresponding brackets as shown in the following screenshot: + +[ + ![Open the book template](https://www.howtoforge.com/images/introduction-to-latexila/pic_2.png) +][7] + +Now let me explain a few things about the structure. I know it looks like coding, and if you are a writer and not a coder it may look strange to work like that but bear with me and I’ll explain. + +Between the first line and the ninth line, we have all the stuff that define some basic factors for the whole document. In the first line for example, we can define the paper format and the font size by changing the “[a4paper,11pt]” accordingly. More options can be added inside this particular square brackets space separated by commas. + +Between lines two and four, we can see entries that start with “\userpackage” followed by the options in square brackets and the command in brackets. These are enhancement packages that LaTeXila has installed by default in our system and uses them by default in most templates. The particular ones concern the font encoding, character encoding, and fonts quality respectively. + +Proceeding to the “\maketitle” row, here we can add a separate title page beyond the first one that will be placed on the top by default. Similarly, the row containing the “\tableofcontents” command is for the automatic creation of a table of contents for the book. + +Finally, we can name the chapter as we like by adding a title in the brackets next to the “\chapter”. This first chapter will be automatically marked as chapter one. You may add your content in the following lines, and the chapter ends when the next one begins by \chapter again on a new line. This new chapter will be automatically marked as chapter two, and so on. + +[ + ![LaTex Formatting](https://www.howtoforge.com/images/introduction-to-latexila/pic_3.png) +][8] + +Chapters can also be separated into smaller chunks by using the command “\section” and then even more with the command “\subsection”. Both sections and chapters should be automatically detected by the “\tableofcontents” command which will use their title and page number. See the following screenshot to correlate the way chapters and sections work for your book. + +[ + ![LaTex preview](https://www.howtoforge.com/images/introduction-to-latexila/pic_4.png) +][9] + +If you want to get an overview of the structure, you may change the left sidebar to the “Structure” setting and ensure that all is structured as intended. From the same tool, you may control any data tables or images that are placed in each section. + +[ + ![LaTex structure](https://www.howtoforge.com/images/introduction-to-latexila/pic_5.png) +][10] + +Talking about these, some people want to include the location of tables and images into their table of contents. To do this, you may add the following lines below the “\tableofcontents”: + +\listoffigures +\listoftables + +The final command that signifies the end of the book is the “\end{document}” so your structure must always end with this. + +### LaTeXila ease of use and mathematics + +While LaTeX is a document creation system based on commands that are independent of the editor one uses, it is important to note that LaTeXila offers a set of helpful tools that will save you time and effort while writing your report or book. For example, there’s an auto-completion function for LaTeX commands as that is conveniently activated every time you start typing a command. + +[ + ![Mathematic Formulas in LaTex](https://www.howtoforge.com/images/introduction-to-latexila/pic_6.png) +][11] + +There’s an integrated spell checking system based on gspell that you may set to the right language from the “Tools” menu on the top bar, and there’s the top toolbar that contains buttons for almost anything that you’ll need. From left to right, you can add chapters and parts, add cross-references, fiddle with the character size and styling for a selected part, add bullet lists, and mathematical functions. These can be done manually, but it is always nicer to have them one click away instead. + +For the creation of the mathematical formulas, you can use a combination of the toolbar options with the sidebar characters that are added with a simple click. Just select the “Symbols” in the left sidebar and you’ll find the relevant categories of “Relations”, “Greek symbols”, “Operators” etc. See the following screenshot as an example of what can be done: + +[ + ![Greek Symbols and Operators](https://www.howtoforge.com/images/introduction-to-latexila/pic_7.png) +][12] + +These graphical lists of symbols really make the creation of formulas and mathematical expressions a walk in the park. + +### From .tex to .rtf + +By default, LaTeXila saves your work in the standard “.tex” format which we can use to build a “rich text format” document that we can open with a word editor like LibreOffice. To do this, we need to install a package named “latex2rtf” which is available in all distributions. We then hop into the file destination, open a terminal there and type “latex2rtf filename” as shown: + +[ + ![LaTEX to RTF export](https://www.howtoforge.com/images/introduction-to-latexila/pic_8.png) +][13] + +Of course, LaTeXila offers its own building tools that you can access from the top toolbar or the top panel (Build), but I am giving you latex2rtf in case something goes wrong with the other system which in my case didn’t work. + +### Conclusion + +If the above sparked your interest to go ahead and discover the power of LaTeX, then good. My intention was to present a tool that is good for newcomers in the sense that it is easy to use and write on. If only LaTeXila had a dual screen mode with a live previewer, and it would be perfect… + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/ + +作者:[Bill Toulas][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/introduction-to-latexila-latex-editor/ +[1]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#why-latex +[2]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#starting-work-on-a-new-document-and-setting-up-the-structure +[3]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#latexila-ease-of-use-and-mathematics +[4]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#from-tex-to-rtf +[5]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#conclusion +[6]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_1.png +[7]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_2.png +[8]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_3.png +[9]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_4.png +[10]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_5.png +[11]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_6.png +[12]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_7.png +[13]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_8.png diff --git a/sources/tech/20170222 The Perfect Server CentOS 7.3 with Apache Postfix Dovecot Pure-FTPD BIND and ISPConfig 3.1.md b/sources/tech/20170222 The Perfect Server CentOS 7.3 with Apache Postfix Dovecot Pure-FTPD BIND and ISPConfig 3.1.md new file mode 100644 index 0000000000..daf5f0819a --- /dev/null +++ b/sources/tech/20170222 The Perfect Server CentOS 7.3 with Apache Postfix Dovecot Pure-FTPD BIND and ISPConfig 3.1.md @@ -0,0 +1,393 @@ +The Perfect Server CentOS 7.3 with Apache, Postfix, Dovecot, Pure-FTPD, BIND and ISPConfig 3.1 +============================================================ + +### This tutorial exists for these OS versions + +* **CentOS 7.3** +* [CentOS 7.2][3] +* [CentOS 7.1][4] +* [CentOS 7][5] + +### On this page + +1. [1 Requirements][6] +2. [2 Preliminary Note][7] +3. [3 Prepare the server][8] +4. [4 Enable Additional Repositories and Install Some Software][9] +5. [5 Quota][10] + 1. [Enabling quota on the / (root) partition][1] + 2. [Enabling quota on a separate /var partition][2] +6. [6 Install Apache, MySQL, phpMyAdmin][11] + +This tutorial shows the installation of ISPConfig 3.1 on a CentOS 7.3 (64Bit) server. ISPConfig is a web hosting control panel that allows you to configure the following services through a web browser: Apache web server, Postfix mail server, MySQL, BIND nameserver, PureFTPd, SpamAssassin, ClamAV, Mailman, and many more. + +### 1 Requirements + +To install such a system you will need the following: + +* A Centos 7.3 minimal server system. This can be a server installed from scratch as described in our [Centos 7.3 minimal server tutorial][12] or a virtual-server or root-server from a hosting company that has a minimal Centos 7.3 setup installed. +* A fast Internet connection. + +### 2 Preliminary Note + +In this tutorial, I use the hostname server1.example.com with the IP address 192.168.1.100 and the gateway 192.168.1.1. These settings might differ for you, so you have to replace them where appropriate. + +Please note that HHVM and XMPP are not supported in ISPConfig for the CentOS platform yet. If you like to manage an XMPP chat server from within ISPConfig or use HHVM (Hip Hop Virtual Machine) in an ISPConfig website, then please use Debian 8 or Ubuntu 16.04 as server OS instead of CentOS 7.3. + +### 3 Prepare the server + +**Set the keyboard layout** + +In case that the keyboard layout of the server does not match your keyboard, you can switch to the right keyboard (in my case "de" for a german keyboard layout, with the localectl command: + +`localectl set-keymap de` + +To get a list of all available keymaps, run: + +`localectl list-keymaps` + +I want to install ISPConfig at the end of this tutorial, ISPConfig ships with the Bastille firewall script that I will use as firewall, therefor I disable the default CentOS firewall now. Of course, you are free to leave the CentOS firewall on and configure it to your needs (but then you shouldn't use any other firewall later on as it will most probably interfere with the CentOS firewall). + +Run... + +``` +yum -y install net-tools +systemctl stop firewalld.service +systemctl disable firewalld.service +``` + +to stop and disable the CentOS firewall. It is ok when you get errors here, this just indicates that the firewall was not installed. + +Then you should check that the firewall has really been disabled. To do so, run the command: + +`iptables -L` + +The output should look like this: + +[root@server1 ~]# iptables -L +Chain INPUT (policy ACCEPT) +target prot opt source destination + +Chain FORWARD (policy ACCEPT) +target prot opt source destination + +Chain OUTPUT (policy ACCEPT) +target prot opt source destination + +Or use the firewall-cmd command: + +firewall-cmd --state + +[root@server1 ~]# firewall-cmd --state +not running +[root@server1 ~]# + +Now I will install the network configuration editor and the shell based editor "nano" that I will use in the next steps to edit the config files: + +yum -y install nano wget NetworkManager-tui + +If you did not configure your network card during the installation, you can do that now. Run... + +nmtui + +... and go to Edit a connection: + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui1.png) +][13] + +Select your network interface: + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui2.png) +][14] + +Then fill in your network details - disable DHCP and fill in a static IP address, a netmask, your gateway, and one or two nameservers, then hit Ok: + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui3.png) +][15] + +Next select OK to confirm the changes that you made in the network settings + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui4.png) +][16] + +and Quit to close the nmtui network configuration tool. + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui5.png) +][17] + +You should run + +ifconfig + +now to check if the installer got your IP address right: + +``` +[root@server1 ~]# ifconfig +ens33: flags=4163 mtu 1500 + inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 + inet6 fe80::20c:29ff:fecd:cc52 prefixlen 64 scopeid 0x20 + + ether 00:0c:29:cd:cc:52 txqueuelen 1000 (Ethernet) + RX packets 55621 bytes 79601094 (75.9 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 28115 bytes 2608239 (2.4 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73 mtu 65536 + inet 127.0.0.1 netmask 255.0.0.0 + inet6 ::1 prefixlen 128 scopeid 0x10 + loop txqueuelen 0 (Local Loopback) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + +If your network card does not show up there, then it not be enabled on boot, In this case, open the file /etc/sysconfig/network-scripts/ifcfg-eth0 + +nano /etc/sysconfig/network-scripts/ifcfg-ens33 + +and set ONBOOT to yes: + +[...] +ONBOOT=yes +[...] + +and reboot the server. + +Check your /etc/resolv.conf if it lists all nameservers that you've previously configured: + +cat /etc/resolv.conf + +If nameservers are missing, run + +nmtui + +and add the missing nameservers again. + +Now, on to the configuration... + +**Adjusting /etc/hosts and /etc/hostname** + +Next, we will edit /etc/hosts. Make it look like this: + +nano /etc/hosts + +``` +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +192.168.1.100 server1.example.com server1 + +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 +``` + +Set the hostname in the /etc/hostname file. The file shall contain the fully qualified domain name (e.g. server1.example.com in my case) and not just the short name like "server1". Open the file with the nano editor: + +nano /etc/hostname + +And set the hostname in the file. + +``` +server1.example.com +``` + +Save the file and exit nano. + +**Disable SELinux** + +SELinux is a security extension of CentOS that should provide extended security. In my opinion you don't need it to configure a secure system, and it usually causes more problems than advantages (think of it after you have done a week of trouble-shooting because some service wasn't working as expected, and then you find out that everything was ok, only SELinux was causing the problem). Therefore I disable it (this is a must if you want to install ISPConfig later on). + +Edit /etc/selinux/config and set SELINUX=disabled: + +nano /etc/selinux/config + +``` +# This file controls the state of SELinux on the system. +# SELINUX= can take one of these three values: +# enforcing - SELinux security policy is enforced. +# permissive - SELinux prints warnings instead of enforcing. +# disabled - No SELinux policy is loaded. +SELINUX=disabled +# SELINUXTYPE= can take one of these two values: +# targeted - Targeted processes are protected, +# mls - Multi Level Security protection. +SELINUXTYPE=targeted +``` + +Afterwards we must reboot the system: + +reboot + +### 4 Enable Additional Repositories and Install Some Software + +First, we import the GPG keys for software packages: + +rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* + +Then we enable the EPEL repository on our CentOS system as lots of the packages that we are going to install in the course of this tutorial are not available in the official CentOS 7 repository: + +yum -y install epel-release + +yum -y install yum-priorities + +Edit /etc/yum.repos.d/epel.repo... + +nano /etc/yum.repos.d/epel.repo + +... and add the line priority=10 to the [epel] section: + +``` +[epel] +name=Extra Packages for Enterprise Linux 7 - $basearch +#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch +failovermethod=priority +enabled=1 +priority=10 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 +[...] +``` + +Then we update our existing packages on the system: + +yum -y update + +Now we install some software packages that are needed later on: + +yum -y groupinstall 'Development Tools' + +### 5 Quota + +(If you have chosen a different partitioning scheme than I did, you must adjust this chapter so that quota applies to the partitions where you need it.) + +To install quota, we run this command: + +yum -y install quota + +Now we check if quota is already enabled for the filesystem where the website (/var/www) and maildir data (var/vmail) is stored. In this example setup, I have one big root partition, so I search for ' / ': + +mount | grep ' / ' + +[root@server1 ~]# mount | grep ' / ' +/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,noquota) +[root@server1 ~]# + +If you have a separate /var partition, then use: + +mount | grep ' /var ' + +instead. If the line contains the word "**noquota**", then proceed with the following steps to enable quota. + +### Enabling quota on the / (root) partition + +Normally you would enable quota in the /etc/fstab file, but if the filesystem is the root filesystem "/", then quota has to be enabled by a boot parameter of the Linux Kernel. + +Edit the grub configuration file: + +nano /etc/default/grub + +search fole the line that starts with GRUB_CMDLINE_LINUX and add rootflags=uquota,gquota to the commandline parameters so that the resulting line looks like this: + +``` +GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet rootflags=uquota,gquota" +``` + +and apply the changes by running the following command. + +cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg_bak +grub2-mkconfig -o /boot/grub2/grub.cfg + +and reboot the server. + +reboot + +Now check if quota is enabled: + +mount | grep ' / ' + +[root@server1 ~]# mount | grep ' / ' +/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,usrquota,grpquota) +[root@server1 ~]# + +When quota is active, we can see "**usrquota,grpquota**" in the mount option list. + +### Enabling quota on a separate /var partition + +If you have a separate /var partition, then edit /etc/fstab and add ,uquota,gquota to the / partition (/dev/mapper/centos-var): + +nano /etc/fstab + +``` + +# +# /etc/fstab +# Created by anaconda on Sun Sep 21 16:33:45 2014 +# +# Accessible filesystems, by reference, are maintained under '/dev/disk' +# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info +# +/dev/mapper/centos-root / xfs defaults 1 1 +/dev/mapper/centos-var /var xfs defaults,uquota,gquota 1 2 +UUID=9ac06939-7e43-4efd-957a-486775edd7b4 /boot xfs defaults 1 3 +/dev/mapper/centos-swap swap swap defaults 0 0 +``` + +Then run + +mount -o remount /var + +quotacheck -avugm +quotaon -avug + +to enable quota. When you get an error that there is no partition with quota enabled, then reboot the server before you proceed. + +### 6 Install Apache, MySQL, phpMyAdmin + +We can install the needed packages with one single command: + +yum -y install ntp httpd mod_ssl mariadb-server php php-mysql php-mbstring phpmyadmin + +To ensure that the server can not be attacked trough the [HTTPOXY][18] vulnerability, we will disable the HTTP_PROXY header in apache globally.  + +Add the apache header rule at the end of the httpd.conf file: + +echo "RequestHeader unset Proxy early" >> /etc/httpd/conf/httpd.conf + +And restart httpd to apply the configuration change. + +service httpd restart + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/ + +作者:[ Till Brehm][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/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/ +[1]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#enabling-quota-on-the-root-partition +[2]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#enabling-quota-on-a-separate-var-partition +[3]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-2-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/ +[4]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-1-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig3/ +[5]:https://www.howtoforge.com/perfect-server-centos-7-apache2-mysql-php-pureftpd-postfix-dovecot-and-ispconfig3 +[6]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-requirements +[7]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-preliminary-note +[8]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#nbspprepare-the-server +[9]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#nbspenable-additional-repositories-and-install-some-software +[10]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-quota +[11]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-install-apache-mysql-phpmyadmin +[12]:https://www.howtoforge.com/tutorial/centos-7-minimal-server/ +[13]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui1.png +[14]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui2.png +[15]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui3.png +[16]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui4.png +[17]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui5.png +[18]:https://www.howtoforge.com/tutorial/httpoxy-protect-your-server/ diff --git a/sources/tech/20170223 How to install Arch Linux on VirtualBox.md b/sources/tech/20170223 How to install Arch Linux on VirtualBox.md new file mode 100644 index 0000000000..dd7b5f2999 --- /dev/null +++ b/sources/tech/20170223 How to install Arch Linux on VirtualBox.md @@ -0,0 +1,491 @@ +How to install Arch Linux on VirtualBox +============================================================ + +### On this page + +1. [Arch Linux Repositories][8] +2. [Install Arch Linux on Virtual Box][9] + 1. [Download Arch Linux][1] + 2. [Initializing Installation with Oracle VM VirtualBox Manager][2] + 3. [Partition the hard disk][3] + 4. [Bootstrap Arch Linux][4] + 5. [Setup hostname and networking][5] + 6. [Install the Bootloader][6] + 7. [Boot into the installed ArchLinux operating system][7] + +Arch Linux is a Linux-based operating system that is designed for i689 and 86-64 computers. Its unique package manager is responsible for providing updates to the latest software applications using “pacman” with complete tracking. Pacman is the package manager that is used to install, update, and remove the software packages. It is designed entirely for free and open-source software, along with the support from the Linux community. + +Arch Linux is also popular for having a comprehensive documentation in form of the community wiki known as ArchWiki. This Linux operating system is based on binary packages that are targeted for i832, 64-bit, and 32-bit systems and optimized for the best performance on the modern hardware systems. + +You can install Arch Linux directly to your home computer by following this guide but you can also install it on a virtual machine on your Windows computer by using VirtualBox. + +### Arch Linux Repositories + +To install Arch Linux on Virtual Box, you must know the basic repositories of this Linux-based operating system. A repository is a storage location from where the software packages are retrieved during the installation process. There are multiple repositories available for Arch Linux, which are accessible via pacman and maintained by package maintainers. Here is a list of some of the basic repositories used to install Arch Linux on Virtual Box: + +* The **core **repository contains all the packages that are needed to setup the base system like booting Arch Linux, and building packages. + +* The **extra **repository contains extra packages that do not fit in the core involving desktop environment. + +* The **community **repositoryhas packages that are adopted by trusted Linux community users, and most of them will transfer to the core or extra repository. + +* The **Multilib **repository contains 32-bit software and libraries for 32-bit application installation on 64-bit system. + +* The **testing **repository contains packages that are destined for core or extra repositories. + +* The **community-testing** repository is for the Linux community. + +* The **multilib testing **repositoryis similar to the testing repository, but for multilib candidates. + +* The **gnome-unstable **repository has the latest GNOME desktop environment. + +* The **kde-unstable **repository contains the latest KDE software before they are been released. + +### Install Arch Linux on Virtual Box + +### Download Arch Linux + +To install Arch Linux on Virtual Box, you must have the latest Arch Linux version that you can download from their [official website][10]. You can pick either the direct download option or torrent download, which is on a secure server. Before the installation, make sure you have 20 MB of free disk space and 1 GB of RAM in your system. + +[ + ![Download Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/1212.png) +][11] + +### Initializing Installation with Oracle VM VirtualBox Manager + +Open the Oracle VM VirtualBox manager, click on new, and type in the name of the new operating system you want to create; in this case, it is Arch Linux. The system will automatically pick up the type and version of the Arch Linux, based on your system’s configuration. Click on  _next_ . + +[ + ![Open VirtualBox](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12121.png) +][12] + +Allocate the desired  RAM size to your new operating system, which is ideally 1024 MB. Click on  _next _ and then click on  _create_ , to create a virtual disk now. + +[ + ![Set RAM size](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12122.png) +][13] + +On the nextpage, you will be asked to select the type of hard disk file you want for your new operating system. Select VirtualBox Disk Image usually. + +[ + ![Select disk file type](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12123.png) +][14] + +Choose dynamically allocated and click  _next_ . + +[ + ![Allocate disk space dynamically](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12124.png) +][15] + +Allocate 20 GB hard disk file location and size. + +[ + ![Choose a hard disk size of 20GB](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12125.png) +][16] + +Now you can see that your Arch Linux operating system is created. Now you can click  _start_ . + +[ + ![Start the Virtual Machine](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12126.png) +][17] + +Click on 'browser' and select the startup disk, which you downloaded from the Arch Linux official website. + +[ + ![Choose Arch Linux Disk image](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12127.png) +][18] + +[ + ![Browse for disk image file](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12128.png) +][19] + +Click on  _start_  and then open the full-screen view. + +[ + ![Open the full-screen view](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12129.png) +][20] + +[ + ![Start the Arch Linux VM](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121210.png) +][21] + +### **Booting to Install Arch Linux on Virtual Box** + +You will see the first opening page of Arch Linux. Click on “Boot Arch Linux (x86_64), which is for 64-bit or click on “Boot Arch Linux (i686)”, which is for 32-bit. + +[ + ![Choose to boot Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121211.png) +][22] + +As soon as you click on the first option, the system will start booting. While it completes the temporary boot, we are basically moving into the live version and are logged in as root user. + +[ + ![Booting into Arch Linux live version](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121212.png) +][23] + +Check the Internet connection by typing in the following command. + + _ping google.com_ + +The word ping stands for packet internet gopher. You will soon see the response that means Arch Linux has activated the Internet connection. This is essential to perform certain installation steps. + +[ + ![Test internet connectivity with ping](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121213.png) +][24] + +Clear the command by typing + + _clear_ + +Before we start the installation, you should partition your drive. Type  _# fdisk – 1 _ and you will see the current system’s disk partition. Focus on the 20 GB hard drives that you allocated to Arch in the beginning. + +[ + ![Partition the harddisk](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121214.png) +][25] + +### Partition the hard disk + +We are going to partition this 20 GB space into three partitions. The first one is the primary root partition that will be of 10 GB. The second will be the swap partition, which will be twice the initial RAM allocation that will be 2048 MB. The third will be the logical partition that will be 8 GB allocated. + +[ + ![Create 3 disk partitions](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121215.png) +][26] + +Type the command: + + _cfdisk_ + + You will see gpt, dos, sgi, and sun. Select the  _dos _ option and press  _enter_ . + +[ + ![Create a partition of type DOS](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121216.png) +][27] + +Here you will see the main disk space, which is 20 GB. To change this, press on the free space and type 10G. + +[ + ![Choose 10GB partition size](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121217.png) +][28] + +Press  _enter _ and then click on the “primary” partition. + +[ + ![](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121218.png) +][29] + +Now select the “bootable” type by pressing enter on bootable. + +[ + ![Make partition bootable.](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121219.png) +][30] + +Go to  _write _ and press enter, to write partition to disk. + +[ + ![Write partition to disk](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121220.png) +][31] + +Then type  _yes_  to make the changes, successfully. + +[ + ![Confirm changes](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121221.png) +][32] + +Now the 10 GB partition is created. Click on  _free space _ and then enter the partition size of 2048 M. + +[ + ![Create the 2GB swap partition](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121222.png) +][33] + +Now follow the same steps to create the logical partition. Then press enter on  _quit_  and clear the command by typing + + _clear_ . + +[ + ![quit cfdisk](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121223.png) +][34] + +Format the newly partitioned disk by typing: + + _mkfs.ext4 /dev/sda1_ + +Here  _sda1 _ is the partition name. Repeat this for the second drive by typing: + + _mkfs.ext4 /dev/sda3_ + +and for the swap partition, + + _mkswap/dev/sda2_ . + +[ + ![Format the swap partition with mkswap](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121224.png) +][35] + +Activate the swap by typing: + + _swapon/ dev/ sda2_ + +and clear the command by typing: + + _clear_ . + +[ + ![Enable swap](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121225.png) +][36] + +Mount the primary partition to start the installation part by typing: + + _mount /dev/ sda1 / mnt._ + +[ + ![Mount the partitions](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121226.png) +][37] + +### Bootstrap Arch Linux + +Bootstrap the system by typing: + + _pacstrap /mnt base base-devel_ + +You can see that it is synchronizing the data packages. + +[ + ![Bootstrap Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121227.png) +][38] + +The installation will start and will take a few minutes. + +[ + ![Arch Linux installation has been started](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121228.png) +][39] + +After the base installation create the fstab file by tying: + + _genfstab /mnt>> /mnt/etc/fstab_ + +[ + ![Generating /etc/fstab](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121229.png) +][40] + +Configure locale, time and root password + +Change the system root to the Arch Linux installation directory by typing: + + _arch-chroot /mnt /bin /bash_ + + Now to configure the language settings: + + _nano /etc / local.gen_ + +[ + ![Set language in Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121230.png) +][41] + +Select the following language configuration by deleting the # and pressing  _control + x, _ press  _y_ , and press  _enter_ . + +[ + ![select language](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121231.png) +][42] + +Now activate it by typing: + + _locale-gen_ + +and press  _enter_ . + +[ + ![Generate the locales in Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121232.png) +][43] + +Create the  /etc/locale.conf file by typing: + + _nano /etc/locale.conf_ + +then press  _enter_ . Now you can add your language to the system by adding this line to the file: + +``` +LANG=en_US.UTF-8 +``` + + Then press  _control + x _ and press  _y_ , and press  _enter_ . + +[ + ![Set default language](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/1.png) +][44] + +Synchronize the zone information by typing: + +ls user/share/zoneinfo_ + +and you will find a list of all the zones of the world. + +[ + ![Set System language default](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/11.png) +][45] + +To select your zone, type: + + _ln –s /usr/share/zoneinfo/Asia/Kolkata/etc/localtime_ + +or you can select any name from the below list. + +[ + ![](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12.png) +][46] + +Set the time standard using the command. + + _hwclock --systohc –utc_ + +And the hardware clock is synchronized. + +[ + ![Set time](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/13.png) +][47] + +Set the root user password by typing: + + _passwd_ + +And press  _enter_ . Then type your password and press enter. + +[ + ![Set the root password](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/14.png) +][48] + +### Setup hostname and networking + +Enter the host name of the network by typing: + + _nano /etc/hostname_ + +and press  _enter_ . Now type any name and then press  _control + x _ and press  _y_ , and press  _enter_ . + +[ + ![Set the hostname](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/15.png) +][49] + +Enable the dhcpcd by typing: + + _systemctl enable dhcpcd_ + +and it will be started at next boot time to fetch an IP address automatically. + +[ + ![Enable dhcpd](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/16.png) +][50] + +### Install the Bootloader + +The final step, initiate the grub installation. Type: + + _pacman –S grub os-rober_ + +then press  _y _ and the download part will begin. + +[ + ![Configure grub](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/17.png) +][51] + +Install the grub boot loader to the hard disk by typing: + + _grub-install /dev/sd_ + +and configure it: + + _grub-mkconfig –o/ boot/ grub/ grub.cfg_ + +[ + ![Install and configure grub boot loader](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/18.png) +][52] + +Finally reboot the system by typing: + + _reboot_ + +and press  _enter._ + +[ + ![Reboot the system](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/19.png) +][53] + +### Boot into the installed ArchLinux operating system + +Choose “Boot Existing OS” to boot Arch Linux on Virtual Box. + +[ + ![Boot Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/110.png) +][54] + +Login with your root name and password, and you will enter your new Arch Linux operating system. + +[ + ![Arch Linux installed successfully](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/111.png) +][55] + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/ + +作者:[Dimitris][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/install-arch-linux-on-virtualbox/ +[1]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#download-arch-linux +[2]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#initializing-installation-with-oracle-vm-virtualbox-manager +[3]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#partition-the-hard-disk +[4]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#bootstrap-arch-linux +[5]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#setup-hostname-and-networking +[6]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#install-the-bootloader +[7]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#boot-into-the-installed-archlinux-operating-system +[8]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#arch-linux-repositories +[9]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#install-arch-linux-on-virtual-box +[10]:https://www.archlinux.org/ +[11]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/1212.png +[12]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12121.png +[13]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12122.png +[14]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12123.png +[15]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12124.png +[16]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12125.png +[17]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12126.png +[18]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12127.png +[19]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12128.png +[20]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12129.png +[21]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121210.png +[22]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121211.png +[23]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121212.png +[24]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121213.png +[25]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121214.png +[26]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121215.png +[27]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121216.png +[28]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121217.png +[29]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121218.png +[30]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121219.png +[31]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121220.png +[32]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121221.png +[33]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121222.png +[34]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121223.png +[35]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121224.png +[36]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121225.png +[37]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121226.png +[38]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121227.png +[39]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121228.png +[40]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121229.png +[41]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121230.png +[42]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121231.png +[43]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121232.png +[44]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/1.png +[45]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/11.png +[46]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12.png +[47]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/13.png +[48]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/14.png +[49]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/15.png +[50]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/16.png +[51]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/17.png +[52]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/18.png +[53]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/19.png +[54]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/110.png +[55]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/111.png diff --git a/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md b/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md new file mode 100644 index 0000000000..70fef0c365 --- /dev/null +++ b/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md @@ -0,0 +1,243 @@ +translating by DockerChen + +Setting Up a Secure FTP Server using SSL/TLS on Ubuntu +============================================================ + + Download Your Free eBooks NOW - [10 Free Linux eBooks for Administrators][13] | [4 Free Shell Scripting eBooks][14] + +In this tutorial, we will describe how to secure a FTP server (VSFTPD stands for “Very Secure FTP Daemon”) using SSL/TLS in Ubuntu 16.04/16.10. + +If you’re looking to setup a secure FTP server for CentOS based distributions, you can read – [Secure an FTP Server Using SSL/TLS on CentOS][2] + +After following the various steps in this guide, we will have learned the fundamentals of enabling encryption services in a FTP server for secure data transfers is crucial. + +#### Requirements + +1. You must [Install and Configure a FTP Server in Ubuntu][1] + +Before we move further, make sure that all commands in this article will be run as root or [sudo privileged account][3]. + +### Step 1: Generating SSL/TLS Certificate for FTP on Ubuntu + +1. We will begin by creating a subdirectory under: /etc/ssl/ to store the SSL/TLS certificate and key files if it doesn’t exist: + +``` +$ sudo mkdir /etc/ssl/private +``` + +2. Now let’s generate the certificate and key in a single file, by running the command below. + +``` +$ sudo openssl req -x509 -nodes -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -days 365 -newkey rsa:2048 +``` + +The above command will prompt you to answer the questions below, don’t forget to enter values that applicable to your scenario. + +``` +Country Name (2 letter code) [XX]:IN +State or Province Name (full name) []:Lower Parel +Locality Name (eg, city) [Default City]:Mumbai +Organization Name (eg, company) [Default Company Ltd]:TecMint.com +Organizational Unit Name (eg, section) []:Linux and Open Source +Common Name (eg, your name or your server's hostname) []:tecmint +Email Address []:admin@tecmint.com +``` + +### Step 2: Configuring VSFTPD to Use SSL/TLS on Ubuntu + +3. Before we perform any VSFTPD configurations, for those who have [UFW firewall enabled][4], you have to open the ports 990 and 40000-50000 to allow TLS connections and the port range of passive ports to set in the VSFTPD configuration file respectively: + +``` +$ sudo ufw allow 990/tcp +$ sudo ufw allow 40000:50000/tcp +$ sudo ufw status +``` + +4. Now, open the VSFTPD config file and define the SSL details in it: + +``` +$ sudo vi /etc/vsftpd/vsftpd.conf +OR +$ sudo nano /etc/vsftpd/vsftpd.conf +``` + +Then, add or locate the option `ssl_enable` and set its value to YES to activate the use of SSL, again, because TLS is more secure than SSL, we will restrict VSFTPD to use TLS instead, by enabling the `ssl_tlsv1` option: + +``` +ssl_enable=YES +ssl_tlsv1=YES +ssl_sslv2=NO +ssl_sslv3=NO +``` + +5. Next, comment out the lines below using the `#` character as follows: + +``` +#rsa_cert_file=/etc/ssl/private/ssl-cert-snakeoil.pem +#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key +``` + +Afterwards, add the lines below to define the location of the SSL certificate and key file: + +``` +rsa_cert_file=/etc/ssl/private/vsftpd.pem +rsa_private_key_file=/etc/ssl/private/vsftpd.pem +``` + +6. Now, we also have to prevent anonymous users from using SSL, then force all non-anonymous logins to use a secure SSL connection for data transfer and to send the password during login: + +``` +allow_anon_ssl=NO +force_local_data_ssl=YES +force_local_logins_ssl=YES +``` + +7. Furthermore, we can use the options below to add more security features in the FTP server. With option `require_ssl_reuse=YES`, all SSL data connections are required to exhibit SSL session reuse; proving that they know the same master secret as the control channel. So, we should disable it. + +``` +require_ssl_reuse=NO +``` + +In addition, we can set which SSL ciphers VSFTPD will permit for encrypted SSL connections with the `ssl_ciphers` option. This will help frustrate any efforts by attackers who try to force a specific cipher which they possibly discovered vulnerabilities in: + +``` +ssl_ciphers=HIGH +``` + +8. Then, let’s define the port range (min and max port) of passive ports. + +``` +pasv_min_port=40000 +pasv_max_port=50000 +``` + +9. To enable SSL debugging, meaning openSSL connection diagnostics are recorded to the VSFTPD log file, we can use the `debug_ssl` option: + +``` +debug_ssl=YES +``` + +Finally save the file and close it. Then restart VSFTPD service: + +``` +$ systemctl restart vsftpd +``` + +### Step 3: Verify FTP with SSL/TLS Connections on Ubuntu + +10. After performing all the above configurations, test if VSFTPD is now using SSL/TLS connections by trying to [use FTP from the command line][5] as below. + +From the output below, there is an error message telling us VSFTPD can only permit users (non-anonymous) to login from secure clients which support encryption services. + +``` +$ ftp 192.168.56.10 +Connected to 192.168.56.10 (192.168.56.10). +220 Welcome to TecMint.com FTP service. +Name (192.168.56.10:root) : ravi +530 Non-anonymous sessions must use encryption. +Login failed. +421 Service not available, remote server has closed connection +ftp> +``` + +The command line doesn’t support encryption services thus resulting to the error above. Therefore, to securely connect to a FTP server with encryption services enabled, we need a FTP client that supports SSL/TLS connections by default, such as FileZilla. + +### Step 4:Install FileZilla On Clients to Connect FTP Securely + +FileZilla is a powerful, widely used cross-platform FTP client which supports FTP over SSL/TLS and more. To install FileZilla on a Linux client machine, use the following command. + +``` +--------- On Debian/Ubuntu --------- +$ sudo apt-get install filezilla +--------- On CentOS/RHEL/Fedora --------- +# yum install epel-release filezilla +--------- On Fedora 22+ --------- +$ sudo dnf install filezilla +``` + +12. Once the installation completes, open it and go to File=>Sites Manager or (press Ctrl+S) to get the Site Manager interface below. + +[ + ![Filezilla Site Manager](http://www.tecmint.com/wp-content/uploads/2017/02/Filezilla-Site-Manager.png) +][6] + +Filezilla Site Manager + +13. Now, define the host/site name, add the IP address, define the protocol to use, encryption and logon type as in the screen shot below (use values that apply to your scenario): + +Click on New Site button to configure a new site/host connection. + +``` +Host: 192.168.56.10 +Protocol: FTP – File Transfer Protocol +Encryption: Require explicit FTP over #recommended +Logon Type: Ask for password #recommended +User: username +``` +[ + ![Configure New FTP Site on Filezilla](http://www.tecmint.com/wp-content/uploads/2017/02/Configure-New-FTP-Site-on-Filezilla.png) +][7] + +Configure New FTP Site on Filezilla + +14. Then click on Connect from the interface above to enter the password, and then verify the certificate being used for the SSL/TLS connection, and click OK once more to connect to the FTP server: + +[ + ![Verify FTP SSL Certificate](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-SSL-Certificate-1.png) +][8] + +Verify FTP SSL Certificate + +15. Now, you should have logged successfully into the FTP server over a TLS connection, check the connection status section for more information from the interface below. + +[ + ![Connected to Ubuntu FTP Server](http://www.tecmint.com/wp-content/uploads/2017/02/Connected-Ubuntu-FTP-Server.png) +][9] + +Connected to Ubuntu FTP Server + +16. Lastly, let’s [transfer files from the local machine to the FTP sever][10] in the files folder, take a look at the lower end of the FileZilla interface to view reports concerning file transfers. + +[ + ![Secure FTP File Transfer using Filezilla](http://www.tecmint.com/wp-content/uploads/2017/02/Transfer-Files-Securely-using-FTP.png) +][11] + +Secure FTP File Transfer using Filezilla + +That’s all! Always remember that installing a FTP server without enabling encryption services has certain security implications. As we explained in this tutorial, you can configure a FTP server to use SSL/TLS connections to implement security in Ubuntu 16.04/16.10. + +If you face any issues in setting up SSL/TLS on FTP server, do use the comment form below to share your problems or thoughts concerning this tutorial/topic. + +-------------------------------------------------------------------------------- + + +作者简介: + +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. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/secure-ftp-server-using-ssl-tls-on-ubuntu/ + +作者:[Aaron Kili][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/aaronkili/ + +[1]:http://www.tecmint.com/install-ftp-server-in-ubuntu/ +[2]:http://www.tecmint.com/axel-commandline-download-accelerator-for-linux/ +[3]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ +[4]:http://www.tecmint.com/how-to-install-and-configure-ufw-firewall/ +[5]:http://www.tecmint.com/sftp-command-examples/ +[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Filezilla-Site-Manager.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-New-FTP-Site-on-Filezilla.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-SSL-Certificate-1.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Connected-Ubuntu-FTP-Server.png +[10]:http://www.tecmint.com/sftp-command-examples/ +[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Transfer-Files-Securely-using-FTP.png +[12]:http://www.tecmint.com/author/aaronkili/ +[13]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[14]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170227 How to setup a Linux server on Amazon AWS.md b/sources/tech/20170227 How to setup a Linux server on Amazon AWS.md new file mode 100644 index 0000000000..24fcffa029 --- /dev/null +++ b/sources/tech/20170227 How to setup a Linux server on Amazon AWS.md @@ -0,0 +1,144 @@ +​How to setup a Linux server on Amazon AWS +============================================================ + +### On this page + +1. [Setup a Linux VM in AWS][1] +2. [Connect to an EC2 instance from Windows][2] + +AWS (Amazon Web Services) is one of the leading cloud server providers worldwide. You can setup a server within a minute using the AWS platform. On AWS, you can fine tune many techncal details of your server like the number of CPU's, Memory and HDD space, type of HDD (SSD which is faster or a classic IDE) and so on. And the best thing about the AWS is that you need to pay only for the services that you have used. To get started, AWS provides a special account called "Free tier" where you can use the AWS technology free for one year with some minor restrictions like you can use the server only upto 750 Hours a month, when you cross this theshold they will charge you. You can check all the rules related this on [aws portal][3]. + +Since I am writing this post about creating a Linux server on AWS, having a "Free Tier" account is the main pre-requisite. To sign up for this account you can use this [link][4]. Kindly note that you need to enter your credit card details while creating the account. + +So let's assume that you have created the "free tier" account. + +Before we proceed, you must know some of the terminologies in AWS to understand the setup: + +1. EC2 (Elastic compute cloud): This term used for the virtual machine. +2. AMI (Amazon machine image): Used for the OS instance. +3. EBS (Elastic block storage): one of the type Storage environment in AWS. + +Now login to AWS console at below location: + +[https://console.aws.amazon.com/][5] + +The AWS console will look like this: + +[ + ![Amazon AWS console](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_console.JPG) +][6] + +### Setup a Linux VM in AWS + +1: Create an EC2 (virtual machine) instance: Before installing the OS on you must create a VM in AWS. To create this, click on EC2 under compute menu: + +[ + ![Create an EC2 instance](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_console_ec21.png) +][7] + +2\. Now click on "Launch Instance" Button under Create instance. + +[ + ![Launch the EC2 instance](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_launch_ec2.png) +][8] + +3\. Now, when you are using a free tier account, then better select the Free Tier radio button so that AWS will filter the instances which are used for free usage. This will keep you aside from paying money to AWS for using billed resources under AWS. + +[ + ![Select Free Tier instances only](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_free_tier_radio1.png) +][9] + +4\. To proceed further, select following options: + +a. **Choose an AMI in the classic instance wizard: selection --> I'll use Red Hat Enterprise Linux 7.2 (HVM), SSD Volume Type here** + +b. Select "**t2.micro**" for the instance details. + +c. **Configure Instance Details**: Do not change anything simply click next. + +d. **Add Storage: **Do not change anything simply click next as we will using default Size 10 (GiB) Hard disk in this case. + +e. **Add Tags**: Do not change anything simply click next. + +f. **Configure Security Group**: Now select port 22 which is used for ssh so that you can access this server from anywhere. + +[ + ![Configure AWS server](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_ssh_port1.png) +][10] + +g. **Select review and launch button** + +h. If all the details are Ok now press the "**Launch**" button, + +i. Once you clicked the Launch button, a popup window gets displayed to create a "Key pair" as shown below: Select the option "create a new key pair" and give a name to key pair. Then download the same. You require this key pair while connecting to the server using ssh. At the end, click the "Launch Instance" button. + +[ + ![Create Key pair](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_key_pair.png) +][11] + +j. After clicking Launch instance Button, go to services at the left top side. Select Compute--> EC2\. Now click on running instance link as below: + +[ + ![Go to the running EC2 instance](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_running_instance.png) +][12] + +k. Now you can see that your new VM is ready with status "running" as shown below. Select the Instance and Please note down the "Public DNS value" which is required for logging on to the server. + +[ + ![Public DNS value of the VM](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_dns_value.png) +][13] + +Now you are done with creating a sample Linux installed VM. To connect to the server, follow below steps. + +### Connect to an EC2 instance from Windows + +1\. First of all, you need to have putty gen and Putty exe's for connecting to the server from Windows (or the SSH command on Linux). You can download putty by following this [Link][14]. + +2\. Now open the putty gen "puttygen.exe". + +3\. You need to click on the "Load button", browse and select the keypair file (pem file) that you downloaded above from Amazon. + +4\. You need to select the "ssh2-RSA" option and click on the save private key button. Kindly select yes on the next pop-up. + +5\. Save the file with the file extension .ppk. + +6\. Now you need to open Putty.exe. Go to connection at the left side menu then select "SSH" and then select "Auth". You need to click on the browse button to select the .ppk file that we created in the step 4. + +7\. Now click on the "session" menu and paste the DNS value captured during the 'k' step of this tutorial in the "host name" box and hit the open button. + +8\. Upon asking for username and password, enter "**ec2-user**" and blank password and then give below command. + +$sudo su - + +Hurray, you are now root on the Linux server which is hosted on AWS cloud. + +[ + ![Logged in to AWS EC2 server](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_putty1.JPG) +][15] + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-setup-linux-server-with-aws/ + +作者:[MANMOHAN MIRKAR][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-setup-linux-server-with-aws/ +[1]:https://www.howtoforge.com/tutorial/how-to-setup-linux-server-with-aws/#setup-a-linux-vm-in-aws +[2]:https://www.howtoforge.com/tutorial/how-to-setup-linux-server-with-aws/#connect-to-an-ec-instance-from-windows +[3]:http://aws.amazon.com/free/ +[4]:http://aws.amazon.com/ec2/ +[5]:https://console.aws.amazon.com/ +[6]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_console.JPG +[7]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_console_ec21.png +[8]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_launch_ec2.png +[9]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_free_tier_radio1.png +[10]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_ssh_port1.png +[11]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_key_pair.png +[12]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_running_instance.png +[13]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_dns_value.png +[14]:http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html +[15]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_putty1.JPG diff --git a/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md b/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md new file mode 100644 index 0000000000..ec558f4363 --- /dev/null +++ b/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md @@ -0,0 +1,401 @@ +# LXD 2.0: Debugging and contributing to LXD [12/12] + + + ![LXD logo](https://linuxcontainers.org/static/img/containers.png) + +### Introduction + + +This is finally it! The last blog post in this [series of 12][3] that started almost a year ago. + +If you followed the series from the beginning, you should have been using LXD for quite a bit of time now and be pretty familiar with its day to day operation and capabilities. + +But what if something goes wrong? What can you do to track down the problem yourself? And if you can’t, what information should you record so that upstream can track down the problem? + +And what if you want to fix issues yourself or help improve LXD by implementing the features you need? How do you build, test and contribute to the LXD code base? + +## Debugging LXD & filing bug reports + +### LXD log files + +#### /var/log/lxd/lxd.log + +This is the main LXD log file. To avoid filling up your disk very quickly, only log messages marked as INFO, WARNING or ERROR are recorded there by default. You can change that behavior by passing “–debug” to the LXD daemon. + +#### /var/log/lxd/CONTAINER/lxc.conf + +Whenever you start a container, this file is updated with the configuration that’s passed to LXC. +This shows exactly how the container will be configured, including all its devices, bind-mounts, … + +#### /var/log/lxd/CONTAINER/forkexec.log + +This file will contain errors coming from LXC when failing to execute a command. +It’s extremely rare for anything to end up in there as LXD usually handles errors much before that. + +#### /var/log/lxd/CONTAINER/forkstart.log + +This file will contain errors coming from LXC when starting the container. +It’s extremely rare for anything to end up in there as LXD usually handles errors much before that. + +### CRIU logs (for live migration) + +If you are using CRIU for container live migration or live snapshotting there are additional log files recorded every time a CRIU dump is generated or a dump is restored. + +Those logs can also be found in /var/log/lxd/CONTAINER/ and are timestamped so that you can find whichever matches your most recent attempt. They will contain a detailed record of everything that’s dumped and restored by CRIU and are far better for understanding a failure than the typical migration/snapshot error message. + +### LXD debug messages + +As mentioned above, you can switch the daemon to doing debug logging with the –debug option. +An alternative to that is to connect to the daemon’s event interface which will show you all log entries, regardless of the configured log level (even works remotely). + +An example for “lxc init ubuntu:16.04 xen” would be: +**lxd.log:** + +``` +INFO[02-24|18:14:09] Starting container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 +INFO[02-24|18:14:10] Started container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 +``` + +**lxc monitor –type=logging:** + +``` +metadata: + context: {} + level: dbug + message: 'New events listener: 9b725741-ffe7-4bfc-8d3e-fe620fc6e00a' +timestamp: 2017-02-24T18:14:01.025989062-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0 + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.341283344-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StorageCoreInit +timestamp: 2017-02-24T18:14:09.341536477-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0/containers/xen + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.347709394-05:00 +type: logging + +metadata: + context: + ip: '@' + method: PUT + url: /1.0/containers/xen/state + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.357046302-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'New task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:09.358387853-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Started task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:09.358578599-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0/operations/2e2cf904-c4c4-4693-881f-57897d602ad3/wait + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.366213106-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolInit +timestamp: 2017-02-24T18:14:09.369636451-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolCheck +timestamp: 2017-02-24T18:14:09.369771164-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.424696767-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + name: xen + level: dbug + message: ContainerUmount +timestamp: 2017-02-24T18:14:09.432723719-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.721067917-05:00 +type: logging + +metadata: + context: + action: start + created: 2017-02-24 23:11:45 +0000 UTC + ephemeral: "false" + name: xen + stateful: "false" + used: 1970-01-01 00:00:00 +0000 UTC + level: info + message: Starting container +timestamp: 2017-02-24T18:14:09.749808518-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0 + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.792551375-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StorageCoreInit +timestamp: 2017-02-24T18:14:09.792961032-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /internal/containers/23/onstart + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.800803501-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolInit +timestamp: 2017-02-24T18:14:09.803190248-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolCheck +timestamp: 2017-02-24T18:14:09.803251188-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.803306055-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Scheduler: container xen started: re-balancing' +timestamp: 2017-02-24T18:14:09.965080432-05:00 +type: logging + +metadata: + context: + action: start + created: 2017-02-24 23:11:45 +0000 UTC + ephemeral: "false" + name: xen + stateful: "false" + used: 1970-01-01 00:00:00 +0000 UTC + level: info + message: Started container +timestamp: 2017-02-24T18:14:10.162965059-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Success for task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:10.163072893-05:00 +type: logging +``` + +The format from “lxc monitor” is a bit different from what you’d get in a log file where each entry is condense into a single line, but more importantly you see all those “level: dbug” entries + +## Where to report bugs + +### LXD bugs + +The best place to report LXD bugs is upstream at [https://github.com/lxc/lxd/issues][4]. +Make sure to fill in everything in the bug reporting template as that information saves us a lot of back and forth to reproduce your environment. + +### Ubuntu bugs + +If you find a problem with the Ubuntu package itself, failing to install, upgrade or remove. Or run into issues with the LXD init scripts. The best place to report such bugs is on Launchpad. + +On an Ubuntu system, you can do so with: ubuntu-bug lxd +This will automatically include a number of log files and package information for us to look at. + +### CRIU bugs + +Bugs that are related to CRIU which you can spot by the usually pretty visible CRIU error output should be reported on Launchpad with: ubuntu-bug criu + +Do note that the use of CRIU through LXD is considered to be a beta feature and unless you are willing to pay for support through a support contract with Canonical, it may take a while before we get to look at your bug report. + +## Contributing to LXD + +LXD is written in [Go][5] and [hosted on Github][6]. +We welcome external contributions of any size. There is no CLA or similar legal agreement to sign to contribute to LXD, just the usual Developer Certificate of Ownership (Signed-off-by: line). + +We have a number of potential features listed on our issue tracker that can make good starting points for new contributors. It’s usually best to first file an issue before starting to work on code, just so everyone knows that you’re doing that work and so we can give some early feedback. + +### Building LXD from source + +Upstream maintains up to date instructions here: [https://github.com/lxc/lxd#building-from-source][7] + +You’ll want to fork the upstream repository on Github and then push your changes to your branch. We recommend rebasing on upstream LXD daily as we do tend to merge changes pretty regularly. + +### Running the testsuite + +LXD maintains two sets of tests. Unit tests and integration tests. You can run all of them with: + +``` +sudo -E make check +``` + +To run the unit tests only, use: + +``` +sudo -E go test ./... +``` + +To run the integration tests, use: + +``` +cd test +sudo -E ./main.sh +``` + +That latter one supports quite a number of environment variables to test various storage backends, disable network tests, use a ramdisk or just tweak log output. Some of those are: + +* LXD_BACKEND: One of “btrfs”, “dir”, “lvm” or “zfs” (defaults to “dir”) + Lets your run the whole testsuite with any of the LXD storage drivers. +* LXD_CONCURRENT: “true” or “false” (defaults to “false”) + This enables a few extra concurrency tests. +* LXD_DEBUG: “true” or “false” (defaults to “false”) + This will log all shell commands and run all LXD commands in debug mode. +* LXD_INSPECT: “true” or “false” (defaults to “false”) + This will cause the testsuite to hang on failure so you can inspect the environment. +* LXD_LOGS: A directory to dump all LXD log files into (defaults to “”) + The “logs” directory of all spawned LXD daemons will be copied over to this path. +* LXD_OFFLINE: “true” or “false” (defaults to “false”) + Disables any test which relies on outside network connectivity. +* LXD_TEST_IMAGE: path to a LXD image in the unified format (defaults to “”) + Lets you use a custom test image rather than the default minimal busybox image. +* LXD_TMPFS: “true” or “false” (defaults to “false”) + Runs the whole testsuite within a “tmpfs” mount, this can use quite a bit of memory but makes the testsuite significantly faster. +* LXD_VERBOSE: “true” or “false” (defaults to “false”) + A less extreme version of LXD_DEBUG. Shell commands are still logged but –debug isn’t passed to the LXC commands and the LXD daemon only runs with –verbose. + +The testsuite will alert you to any missing dependency before it actually runs. A test run on a reasonably fast machine can be done under 10 minutes. + +### Sending your branch + +Before sending a pull request, you’ll want to confirm that: + +* Your branch has been rebased on the upstream branch +* All your commits messages include the “Signed-off-by: First Last ” line +* You’ve removed any temporary debugging code you may have used +* You’ve squashed related commits together to keep your branch easily reviewable +* The unit and integration tests all pass + +Once that’s all done, open a pull request on Github. Our [Jenkins][8] will validate that the commits are all signed-off, a test build on MacOS and Windows will automatically be performed and if things look good, we’ll trigger a full Jenkins test run that will test your branch on all storage backends, 32bit and 64bit and all the Go versions we care about. + +This typically takes less than an hour to happen, assuming one of us is around to trigger Jenkins. + +Once all the tests are done and we’re happy with the code itself, your branch will be merged into master and your code will be in the next LXD feature release. If the changes are suitable for the LXD stable-2.0 branch, we’ll backport them for you. + +# Conclusion + +I hope this series of blog post has been helpful in understanding what LXD is and what it can do! + +This series’ scope was limited to the LTS version of LXD (2.0.x) but we also do monthly feature releases for those who want the latest features. You can find a few other blog posts covering such features listed in the original [LXD 2.0 series post][9]. + +# Extra information + +The main LXD website is at: [https://linuxcontainers.org/lxd +][10]Development happens on Github at: [https://github.com/lxc/lxd][11] +Mailing-list support happens on: [https://lists.linuxcontainers.org][12] +IRC support happens in: #lxcontainers on irc.freenode.net +Try LXD online: [https://linuxcontainers.org/lxd/try-it][13] + +-------------------------------------------------------------------------------- + +via: https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ + +作者:[Stéphane Graber ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://stgraber.org/author/stgraber/ +[1]:https://stgraber.org/author/stgraber/ +[2]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[3]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[4]:https://github.com/lxc/lxd/issues +[5]:https://golang.org/ +[6]:https://github.com/lxc/lxd +[7]:https://github.com/lxc/lxd#building-from-source +[8]:https://jenkins.linuxcontainers.org/ +[9]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[10]:https://linuxcontainers.org/lxd +[11]:https://github.com/lxc/lxd +[12]:https://lists.linuxcontainers.org/ +[13]:https://linuxcontainers.org/lxd/try-it +[14]:https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ diff --git a/sources/tech/20170228 How to Install and Secure MariaDB 10 in CentOS 7.md b/sources/tech/20170228 How to Install and Secure MariaDB 10 in CentOS 7.md new file mode 100644 index 0000000000..95edea40f1 --- /dev/null +++ b/sources/tech/20170228 How to Install and Secure MariaDB 10 in CentOS 7.md @@ -0,0 +1,148 @@ +How to Install and Secure MariaDB 10 in CentOS 7 +============================================================ + + +MariaDB is a free and open source fork of well known MySQL database management server software, developed by the brains behind MySQL, it’s envisioned to remain free/open source. + +In this tutorial, we will show you how to install MariaDB 10.1 stable version in the most widely used versions of RHEL/CentOS and Fedora distributions. + +For your information, Red Hat Enterprise Linux/CentOS 7.0 switched from supporting MySQL to MariaDB as the default database management system. + +Note that in this tutorial, we’ll assume your working on the server as root, otherwise, use the [sudo command][7] to run all the commands. + +### Step 1: Add MariaDB Yum Repository + +1. Start by adding the MariaDB YUM repository file `MariaDB.repo` for RHEL/CentOS and Fedora systems. + +``` +# vi /etc/yum.repos.d/MariaDB.repo +``` + +Now add the following lines to your respective Linux distribution version as shown. + +#### On CentOS 7 + +``` +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.1/centos7-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +``` + +#### On RHEL 7 + +``` +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.1/rhel7-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +``` +[ + ![Add MariaDB Yum Repo](http://www.tecmint.com/wp-content/uploads/2017/02/Add-MariaDB-Repo.png) +][8] + +Add MariaDB Yum Repo + +### Step 2: Install MariaDB in CentOS 7 + +2. Once MariaDB repository has been added, you can easily install it with just one single command. + +``` +# yum install MariaDB-server MariaDB-client -y +``` +[ + ![Install MariaDB in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/02/Install-MariaDB-in-CentOS-7.png) +][9] + +Install MariaDB in CentOS 7 + +3. As soon as the installation of MariaDB packages completes, start the database server daemon for the time being, and also enable it to start automatically at the next boot like so: + +``` +# systemctl start mariadb +# systemctl enable mariadb +# systemctl status mariadb +``` +[ + ![Start MariaDB Service in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service-in-CentOS-7.png) +][10] + +Start MariaDB Service in CentOS 7 + +### Step 3: Secure MariaDB in CentOS 7 + +4. Now its time to secure your MariaDB by setting root password, disabling remote root login, removing the test database as well as anonymous users and finally reload privileges as shown in the screen shot below: + +``` +# mysql_secure_installation +``` +[ + ![Secure MySQL in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/02/Secure-MySQL-in-CentOS-7.png) +][11] + +Secure MySQL in CentOS 7 + +5. After securing the database server, you may want to check certain MariaDB features such as: installed version, default program argument list, and also login to the MariaDB command shell as follows: + +``` +# mysql -V +# mysqld --print-defaults +# mysql -u root -p +``` +[ + ![Verify MySQL Version](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-MySQL-Version.png) +][12] + +Verify MySQL Version + +### Step 4: Learn MariaDB Administration + +If you are new to MySQL/MariaDB, start off by going through these guides: + +1. [Learn MySQL / MariaDB for Beginners – Part 1][1] +2. [Learn MySQL / MariaDB for Beginners – Part 2][2] +3. [MySQL Basic Database Administration Commands – Part III][3] +4. [20 MySQL (Mysqladmin) Commands for Database Administration – Part IV][4] + +Also check out these following articles to fine tune your MySQL/MariaDB performance and use the tools to monitor the activity of your databases. + +1. [15 Tips to Tune and Optimize Your MySQL/MariaDB Performance][5] +2. [4 Useful Tools to Monitor MySQL/MariaDB Database Activities][6] + +That’s it for now! In this simple tutorial, we showed you how to install MariaDB 10.1 stable version in various RHEL/CentOS and Fedora. Use the feedback form below to send us any questions or any thoughts concerning this guide. + +-------------------------------------------------------------------------------- + +作者简介: + +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. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-mariadb-in-centos-7/ + +作者:[Aaron Kili][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/aaronkili/ + +[1]:http://www.tecmint.com/learn-mysql-mariadb-for-beginners/ +[2]:http://www.tecmint.com/learn-mysql-mariadb-advance-functions-sql-queries/ +[3]:http://www.tecmint.com/gliding-through-database-mysql-in-a-nutshell-part-i/ +[4]:http://www.tecmint.com/mysqladmin-commands-for-database-administration-in-linux/ +[5]:http://www.tecmint.com/mysql-mariadb-performance-tuning-and-optimization/ +[6]:http://www.tecmint.com/mysql-performance-monitoring/ +[7]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Add-MariaDB-Repo.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Install-MariaDB-in-CentOS-7.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service-in-CentOS-7.png +[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Secure-MySQL-in-CentOS-7.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Verify-MySQL-Version.png +[13]:http://www.tecmint.com/author/aaronkili/ +[14]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[15]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170301 How to Install or Upgrade to Latest Kernel Version in CentOS 7.md b/sources/tech/20170301 How to Install or Upgrade to Latest Kernel Version in CentOS 7.md new file mode 100644 index 0000000000..ea6600be78 --- /dev/null +++ b/sources/tech/20170301 How to Install or Upgrade to Latest Kernel Version in CentOS 7.md @@ -0,0 +1,177 @@ +How to Install or Upgrade to Latest Kernel Version in CentOS 7 +============================================================ + +by [Gabriel Cánepa][14] | Published: March 1, 2017 | Last Updated: March 6, 2017 + + Download Your Free eBooks NOW - [10 Free Linux eBooks for Administrators][15] | [4 Free Shell Scripting eBooks][16] + +Although some people use the word Linux to represent the operating system as a whole, it is important to note that, strictly speaking, Linux is only the kernel. On the other hand, a distribution is a fully-functional system built on top of the kernel with a wide variety of application tools and libraries. + +During normal operations, the kernel is responsible for performing two important tasks: + +1. Acting as an interface between the hardware and the software running on the system. +2. Managing system resources as efficiently as possible. + +To do this, the kernel communicates with the hardware through the drivers that are built into it or those that can be later installed as a module. + +For example, when an application running on your machine wants to connect to a wireless network, it submits that request to the kernel, which in turns uses the right driver to connect to the network. + +**Suggested Read:** [How to Upgrade Kernel in Ubuntu][1] + +With new devices and technology coming out periodically, it is important to keep our kernel up to date if we want to make the most of out them. Additionally, updating our kernel will help us to leverage new kernel functions and to protect ourselves from vulnerabilities that have been discovered in previous versions. + +Ready to update your kernel on CentOS 7 or one of their derivatives such as RHEL 7 and Fedora? If so, keep reading! + +### Step 1: Checking Installed Kernel Version + +When we install a distribution it includes a certain version of the Linux kernel. To show the current version installed on our system we can do: + +``` +# uname -sr +``` + +The following image shows the output of the above command in a CentOS 7 server: + +[ + ![Check Kernel Version in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-CentOS-7.png) +][2] + +Check Kernel Version in CentOS 7 + +If we now go to [https://www.kernel.org/][3], we will see that the latest kernel version is 4.10.1 at the time of this writing (other versions are available from the same site). + +One important thing to consider is the life cycle of a kernel version – if the version you are currently using is approaching its end of life, no more bug fixes will be provided after that date. For more info, refer to the [kernel Releases][4] page. + +### Step 2: Upgrading Kernel in CentOS 7 + +Most modern distributions provide a way to upgrade the kernel using a [package management system such as yum][5] and an officially-supported repository. + +However, this will only perform the upgrade to the most recent version available from the distribution’s repositories – not the latest one available in the [https://www.kernel.org/][6]. Unfortunately, Red Hat only allows to upgrade the kernel using the former option. + +As opposed to Red Hat, CentOS allows the use of ELRepo, a third-party repository that makes the upgrade to a recent version a kernel. + +To enable the ELRepo repository on CentOS 7, do: + +``` +# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org +# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm +``` +[ + ![Enable ELRepo in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Enable-ELRepo-in-CentOS-7.png) +][7] + +Enable ELRepo in CentOS 7 + +Once the repository has been enabled, you can use the following command to list the available kernel.related packages: + +``` +# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available +``` +[ + ![Yum - Find Available Kernel Versions](http://www.tecmint.com/wp-content/uploads/2017/03/Yum-Find-Available-Kernel-Versions.png) +][8] + +Yum – Find Available Kernel Versions + +Next, install the latest mainline stable kernel: + +``` +# yum --enablerepo=elrepo-kernel install kernel-ml +``` +[ + ![Install Latest Kernel Version in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Install-Latest-Kernel-Version-in-CentOS-7.png) +][9] + +Install Latest Kernel Version in CentOS 7 + +Finally, reboot your machine to apply the latest kernel, and then run following command to check the kernel version: + +``` +uname -sr +``` +[ + ![Verify Kernel Version](http://www.tecmint.com/wp-content/uploads/2017/03/Verify-Kernel-Version.png) +][10] + +Verify Kernel Version + +### Step 3: Set Default Kernel Version in GRUB + +To make the newly-installed version the default boot option, you will have to modify the GRUB configuration as follows: + +Open and edit the file /etc/default/grub and set `GRUB_DEFAULT=0`. This means that the first kernel in the GRUB initial screen will be used as default. + +``` +GRUB_TIMEOUT=5 +GRUB_DEFAULT=0 +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet" +GRUB_DISABLE_RECOVERY="true" +``` + +Next, run the following command to recreate the kernel configuration. + +``` +# grub2-mkconfig -o /boot/grub2/grub.cfg +``` +[ + ![Set Kernel in GRUB](http://www.tecmint.com/wp-content/uploads/2017/03/Set-Kernel-in-GRUB.png) +][11] + +Set Kernel in GRUB + +Reboot and verify that the latest kernel is now being used by default. + +[ + ![Booting Default Kernel Version in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Booting-Default-Kernel-Version.png) +][12] + +Booting Default Kernel Version in CentOS 7 + +Congratulations! You have upgraded your kernel in CentOS 7! + +##### Summary + +In this article we have explained how to easily upgrade the Linux kernel on your system. There is yet another method which we haven’t covered as it involves compiling the kernel from source, which would deserve an entire book and is not recommended on production systems. + +Although it represents one of the best learning experiences and allows for a fine-grained configuration of the kernel, you may render your system unusable and may have to reinstall it from scratch. + +If you are still interested in building the kernel as a learning experience, you will find instructions on how to do it at the [Kernel Newbies][13] page. + +As always, feel free to use the form below if you have any questions or comments about this article. + +-------------------------------------------------------------------------------- + +作者简介: + +I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/ + +作者:[Matei Cezar][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/cezarmatei/ + +[1]:http://www.tecmint.com/upgrade-kernel-in-ubuntu/ +[2]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-CentOS-7.png +[3]:https://www.kernel.org/ +[4]:https://www.kernel.org/category/releases.html +[5]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[6]:https://www.kernel.org/ +[7]:http://www.tecmint.com/wp-content/uploads/2017/03/Enable-ELRepo-in-CentOS-7.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/03/Yum-Find-Available-Kernel-Versions.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/03/Install-Latest-Kernel-Version-in-CentOS-7.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/03/Verify-Kernel-Version.png +[11]:http://www.tecmint.com/wp-content/uploads/2017/03/Set-Kernel-in-GRUB.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/03/Booting-Default-Kernel-Version.png +[13]:https://kernelnewbies.org/KernelBuild +[14]:http://www.tecmint.com/author/gacanepa/ +[15]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[16]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170302 How to use markers and perform text selection in Vim.md b/sources/tech/20170302 How to use markers and perform text selection in Vim.md new file mode 100644 index 0000000000..e611f74302 --- /dev/null +++ b/sources/tech/20170302 How to use markers and perform text selection in Vim.md @@ -0,0 +1,127 @@ +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 diff --git a/sources/tech/20170302 Installation of Devuan Linux Fork of Debian.md b/sources/tech/20170302 Installation of Devuan Linux Fork of Debian.md new file mode 100644 index 0000000000..4aabe33be1 --- /dev/null +++ b/sources/tech/20170302 Installation of Devuan Linux Fork of Debian.md @@ -0,0 +1,266 @@ +Installation of Devuan Linux (Fork of Debian) +============================================================ + + +Devuan Linux, the most recent fork of Debian, is a version of Debian that is designed to be completely free of systemd. + +Devuan was announced towards the end of 2014 and has been actively developed over that time. The most recently release is the beta2 release of codenamed: Jessie (Yes the same name as the current stable version of Debian). + +The final release for the current stable release is said to be ready in early 2017\. To read more about the project please visit the community’s home page: [https://devuan.org/][1]. + +This article will walk through the installation of Devuan’s current release. Most of the packages available in Debian are available in Devuan allowing for a fairly seamless transition for Debian users to Devuan should they prefer the freedom to choose their initialization system. + +#### System Requirements + +Devuan, like Debian. Is very light on system requirements. The biggest determining factor is the desktop environment the user wishes to use. This guide will assume that the user would like a ‘flashier’ desktop environment and will suggest the following minimums: + +1. At least 15GB of disk space; strongly encouraged to have more +2. At least 2GB of ram; more is encouraged +3. USB or CD/DVD boot support +4. Internet connection; installer will download files from the Internet + +### Devuan Linux Installation + +As with all of the author’s guides, this guide will be assuming that a USB drive is available to use as the installation media. Take note that the USB drive should be as close to 4/8GB as possible and ALL DATA WILL BE REMOVED! + +The author has had issues with larger USB drives but some may still work. Regardless, following the next few steps WILL RESULT IN DATA LOSS ON THE USB DRIVE. + +Please be sure to backup all data before proceeding. This bootable Kali Linux USB drive is going to be created from another Linux machine. + +1. First obtain the latest release of Devuan installation ISO from [https://devuan.org/][2] or you can obtain from a Linux station, type the following commands: + +``` +$ cd ~/Downloads +$ wget -c https://files.devuan.org/devuan_jessie_beta/devuan_jessie_1.0.0-beta2_amd64_CD.iso +``` + +2. The commands above will download the installer ISO file to the user’s ‘Downloads’ folder. The next process is to write the ISO to a USB drive to boot the installer. + +To accomplish this we can use the `'dd'` tool within Linux. First, the disk name needs to be located with [lsblk command][3] though. + +``` +$ lsblk +``` +[ + ![Find Device Name in Linux](http://www.tecmint.com/wp-content/uploads/2017/03/Find-Device-Name-in-Linux.png) +][4] + +Find Device Name in Linux + +With the name of the USB drive determined as `/dev/sdc`, the Devuan ISO can be written to the drive with the `dd` tool. + +``` +$ sudo dd if=~/Downloads/devuan_jessie_1.0.0-beta2_amd64_CD.iso of=/dev/sdc +``` + +Important: The above command requires root privileges so utilize ‘sudo’ or login as the root user to run the command. Also this command will REMOVE EVERYTHING on the USB drive. Be sure to backup needed data. + +3. Once the ISO is copied over to the USB drive, plug the USB drive into the respective computer that Devuan should be installed upon and proceed to boot to the USB drive. + +Upon successful booting to the USB drive, the user will be presented with the following screen and should proceed with the ‘Install’ or ‘Graphical Install’ options. + +This guide will be using the ‘Graphical Install’ method. + +[ + ![Devuan Graphic Installation](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Graphic-Installation.png) +][5] + +Devuan Graphic Installation + +4. Allow the installer to boot to the localization menus. Once here the user will be prompted with a string of windows asking about the user’s keyboard layout and language. Simply select the desired options to continue. + +[ + ![Devuan Language Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Language-Selection.png) +][6] + +Devuan Language Selection + +[ + ![Devuan Location Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Location-Selection.png) +][7] + +Devuan Location Selection + +[ + ![Devuan Keyboard Configuration](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Keyboard-Configuration.png) +][8] + +Devuan Keyboard Configuration + +5. The next step is to provide the installer with the hostname and domain name that this machine will be a member. + +The hostname should be something unique but the domain can be left blank if the computer won’t be part of a domain. + +[ + ![Set Devuan Linux Hostname](http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Hostname.png) +][9] + +Set Devuan Linux Hostname + +[ + ![Set Devuan Linux Domain Name](http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Domain-Name.png) +][10] + +Set Devuan Linux Domain Name + +6. Once the hostname and domain name information have been provided the installer will want the user to provide a ‘root’ user password. + +Take note to remember this password as it will be required to do administrative tasks on this Devuan machine! Devuan doesn’t install the sudo package by default so the admin user will be ‘root’ when this installation finishes. + +[ + ![Setup Devuan Linux Root User](http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-Root-User.png) +][11] + +Setup Devuan Linux Root User + +7. The next series of questions will be for the creation of a non-root user. It is always a good to avoid using your system as the root user whenever possible. The installer will prompt for the creation of a non-root user at this point. + +[ + ![Setup Devuan Linux User Account](http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-User-Account.png) +][12] + +Setup Devuan Linux User Account + +8. Once the root user password and user creation prompts have completed, the installer will request that the clock be [set up with NTP][13]. + +Again a connection to the internet will be required in order for this to work for most systems! + +[ + ![Devuan Linux Timezone Setup](http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Clock-on-Devuan-Linux.png) +][14] + +Devuan Linux Timezone Setup + +9. The next step will be the act of partitioning the system. For most user’s ‘Guided – use entire disk’ is typically sufficient. However, if advanced partitioning is desired, this would be the time to set them up. + +[ + ![Devuan Linux Partitioning](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Partitioning.png) +][15] + +Devuan Linux Partitioning + +Be sure to confirm the partition changes after clicking continue above in order to write the partitions to the disk! + +10. Once the partitioning is completed, the installer will begin to install the base files for Devuan. This process will take a few minutes but will stop when the system is ready to configure a network mirror (software repository). Most users will want to click ‘yes’ when prompted to use a network mirror. + +[ + ![Devuan Linux Configure Package Manager](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Configure-Package-Manager.png) +][16] + +Devuan Linux Configure Package Manager + +Clicking `yes` here will present the user with a list of network mirrors by country. It is typically best to pick the mirror that is geographically closest to the machines location. + +[ + ![Devuan Linux Mirror Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirror-Selection.png) +][17] + +Devuan Linux Mirror Selection + +[ + ![Devuan Linux Mirrors](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirrors.png) +][18] + +Devuan Linux Mirrors + +11. The next screen is the traditional Debian ‘popularity contest’ all this does is track what packages are downloaded for statistics on package usage. + +This can be enabled or disabled to the administrator’s preference during the installation process. + +[ + ![Configure Devuan Linux Popularity Contest](http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Devuan-Linux-Popularity-Contest.png) +][19] + +Configure Devuan Linux Popularity Contest + +12. After a brief scan of the repositories and a couple of package updates, the installer will present the user with a list of software packages that can be installed to provide a Desktop Environment, SSH access, and other system tools. + +While Devuan has some of the major Desktop Environments listed, it should be noted that not all of them are ready for use in Devuan yet. The author has had good luck with Xfce, LXDE, and Mate in Devuan (Future articles will walk the user through how to install Enlightenment from source in Devuan as well). + +If interested in installing a different Desktop Environment, un-check the ‘Devuan Desktop Environment’ check box. + +[ + ![Devuan Linux Software Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Software-Selection.png) +][20] + +Devuan Linux Software Selection + +Depending on the number of items selected in the above installer screen, there may be a couple of minutes of downloads and installations taking place. + +When all the software installation is completed, the installer will prompt the user for the location to install ‘grub’. This is typically done on ‘/dev/sda’ as well. + +[ + ![Devuan Linux Grub Install](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install.png) +][21] + +Devuan Linux Grub Install + +[ + ![Devuan Linux Grub Install Disk](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install-Disk.png) +][22] + +Devuan Linux Grub Install Disk + +13. After GRUB successfully installs to the boot drive, the installer will alert the user that the installation is complete and to reboot the system. + +[ + ![Devuan Linux Installation Completes](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Installation-Completes.png) +][23] + +Devuan Linux Installation Completes + +14. Assuming that the installation was indeed successful, the system should either boot into the chosen Desktop Environment or if no Desktop Environment was selected, the machine will boot to a text based console. + +[ + ![Devuan Linux Console](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Console.png) +][24] + +Devuan Linux Console + +This concludes the installation of the latest version of Devuan Linux. The next article in this short series will cover the [installation of the Enlightenment Desktop Environment][25] from source code on a Devuan system. Please let Tecmint know if you have any issues or questions and thanks for reading! + +-------------------------------------------------------------------------------- + +作者简介: + +He is an Instructor of Computer Technology with Ball State University where he currently teaches all of the departments Linux courses and co-teaches Cisco networking courses. He is an avid Debian user as well as many of the derivatives of Debian such as Mint, Ubuntu, and Kali. Rob holds a Masters in Information and Communication Sciences as well as several industry certifications from Cisco, EC-Council, and Linux Foundation. + +----------------------------- + +via: http://www.tecmint.com/installation-of-devuan-linux/ + +作者:[Rob Turner ][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/robturner/ +[1]:https://devuan.org/ +[2]:https://devuan.org/ +[3]:http://www.tecmint.com/find-usb-device-name-in-linux/ +[4]:http://www.tecmint.com/wp-content/uploads/2017/03/Find-Device-Name-in-Linux.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Graphic-Installation.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Language-Selection.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Location-Selection.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Keyboard-Configuration.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Hostname.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Domain-Name.png +[11]:http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-Root-User.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-User-Account.png +[13]:http://www.tecmint.com/install-and-configure-ntp-server-client-in-debian/ +[14]:http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Clock-on-Devuan-Linux.png +[15]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Partitioning.png +[16]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Configure-Package-Manager.png +[17]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirror-Selection.png +[18]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirrors.png +[19]:http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Devuan-Linux-Popularity-Contest.png +[20]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Software-Selection.png +[21]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install.png +[22]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install-Disk.png +[23]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Installation-Completes.png +[24]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Console.png +[25]:http://www.tecmint.com/install-enlightenment-on-devuan-linux/ +[26]:http://www.tecmint.com/author/robturner/ +[27]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[28]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170304 7 Ways to Determine the File System Type in Linux.md b/sources/tech/20170304 7 Ways to Determine the File System Type in Linux.md new file mode 100644 index 0000000000..0728657f09 --- /dev/null +++ b/sources/tech/20170304 7 Ways to Determine the File System Type in Linux.md @@ -0,0 +1,157 @@ +7 Ways to Determine the File System Type in Linux (Ext2, Ext3 or Ext4) +============================================================ + + +A file system is the way in which files are named, stored, retrieved as well as updated on a storage disk or partition; the way files are organized on the disk. + +A file system is divided in two segments called: User Data and Metadata (file name, time it was created, modified time, it’s size and location in the directory hierarchy etc). + +In this guide, we will explain seven ways to identify your Linux file system type such as Ext2, Ext3, Ext4, BtrFS, GlusterFS plus many more. + +### 1\. Using df Command + +df command reports file system disk space usage, to include the file system type on a particular disk partition, use the `-T` flag as below: + +``` +$ df -Th +OR +$ df -Th | grep "^/dev" +``` +[ + ![df Command - Find Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/Find-Filesystem-Type-Using-df-Command.png) +][3] + +df Command – Find Filesystem Type + +For a comprehensive guide for df command usage go through our articles: + +1. [12 Useful “df” Commands to Check Disk Space in Linux][1] +2. [Pydf – An Alternative ‘df’ Command That Shows Disk Usage in Colours][2] + +### 2\. Using fsck Command + +fsck is used to check and optionally [repair Linux file systems][4], it can also print the [file system type on specified disk partitions][5]. + +The flag `-N` disables checking of file system for errors, it just shows what would be done (but all we need is the file system type): + +``` +$ fsck -N /dev/sda3 +$ fsck -N /dev/sdb1 +``` +[ + ![fsck - Print Linux Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/fsck-Print-Linux-Filesystem-Type.png) +][6] + +fsck – Print Linux Filesystem Type + +### 3\. Using lsblk Command + +lsblk displays block devices, when used with the `-f` option, it prints file system type on partitions as well: + +``` +$ lsblk -f +``` +[ + ![lsblk - Shows Linux Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/lsblk-Shows-Linux-Filesystem-Type.png) +][7] + +lsblk – Shows Linux Filesystem Type + +### 4\. Using mount Command + +mount command is used to [mount a file system in Linux][8], it can also be used to [mount an ISO image][9], [mount remote Linux filesystem][10] and so much more. + +When run without any arguments, it prints [info about disk partitions][11] including the file system type as below: + +``` +$ mount | grep "^/dev" +``` +[ + ![Mount - Show Filesystem Type in Linux](http://www.tecmint.com/wp-content/uploads/2017/03/Mount-Show-Filesystem-Type.png) +][12] + +Mount – Show Filesystem Type in Linux + +### 5\. Using blkid Command + +blkid command is used to [find or print block device properties][13], simply specify the disk partition as an argument like so: + +``` +$ blkid /dev/sda3 +``` +[ + ![blkid - Find Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/blkid-Find-Filesystem-Type.png) +][14] + +blkid – Find Filesystem Type + +### 6\. Using file Command + +file command identifies file type, the `-s` flag enables reading of block or character files and `-L` enables following of symlinks: + +``` +$ sudo file -sL /dev/sda3 +``` +[ + ![file - Identifies Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/file-command-identifies-filesystem-type.png) +][15] + +file – Identifies Filesystem Type + +### 7\. Using fstab File + +The /etc/fstab is a static file system info (such as mount point, file system type, mount options etc) file: + +``` +$ cat /etc/fstab +``` +[ + ![Fstab - Shows Linux Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/fstab-shows-filesystem-types.png) +][16] + +Fstab – Shows Linux Filesystem Type + +That’s it! In this guide, we explained seven ways to identify your Linux file system type. Do you know of any method not mentioned here? Share it with us in the comments. + +-------------------------------------------------------------------------------- + +作者简介: + +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. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/find-linux-filesystem-type/ + +作者:[Aaron Kili][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/aaronkili/ + +[1]:http://www.tecmint.com/how-to-check-disk-space-in-linux/ +[2]:http://www.tecmint.com/pyd-command-to-check-disk-usage/ +[3]:http://www.tecmint.com/wp-content/uploads/2017/03/Find-Filesystem-Type-Using-df-Command.png +[4]:http://www.tecmint.com/defragment-linux-system-partitions-and-directories/ +[5]:http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/ +[6]:http://www.tecmint.com/wp-content/uploads/2017/03/fsck-Print-Linux-Filesystem-Type.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/03/lsblk-Shows-Linux-Filesystem-Type.png +[8]:http://www.tecmint.com/sshfs-mount-remote-linux-filesystem-directory-using-ssh/ +[9]:http://www.tecmint.com/extract-files-from-iso-files-linux/ +[10]:http://www.tecmint.com/sshfs-mount-remote-linux-filesystem-directory-using-ssh/ +[11]:http://www.tecmint.com/linux-tools-to-monitor-disk-partition-usage/ +[12]:http://www.tecmint.com/wp-content/uploads/2017/03/Mount-Show-Filesystem-Type.png +[13]:http://www.tecmint.com/find-usb-device-name-in-linux/ +[14]:http://www.tecmint.com/wp-content/uploads/2017/03/blkid-Find-Filesystem-Type.png +[15]:http://www.tecmint.com/wp-content/uploads/2017/03/file-command-identifies-filesystem-type.png +[16]:http://www.tecmint.com/wp-content/uploads/2017/03/fstab-shows-filesystem-types.png +[17]:http://www.tecmint.com/find-linux-filesystem-type/# +[18]:http://www.tecmint.com/find-linux-filesystem-type/# +[19]:http://www.tecmint.com/find-linux-filesystem-type/# +[20]:http://www.tecmint.com/find-linux-filesystem-type/# +[21]:http://www.tecmint.com/find-linux-filesystem-type/#comments +[22]:http://www.tecmint.com/author/aaronkili/ +[23]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[24]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md b/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md new file mode 100644 index 0000000000..8aaff488bf --- /dev/null +++ b/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md @@ -0,0 +1,91 @@ +How to Upgrade Kernel to Latest Version in Ubuntu +============================================================ + + +Periodically new devices and technology coming out and it’s important to keep our Linux system kernel up-to-date if we want to get the most of out it. Moreover, updating system kernel will ease us to take advantage of new kernel fuctions and also it helps us to protect ourselves from vulnerabilities that have been found in earlier versions. + +**Suggested Read:** [How to Upgrade Kernel in CentOS 7][1] + +Ready to update your kernel on Ubuntu 16.04 or one of their derivatives such as Debian and Linux Mint? If so, keep reading! + +### Step 1: Check Installed Kernel Version + +To find the current version of installed kernel on our system we can do: + +``` +$ uname -sr +``` + +The following image shows the output of the above command in a Ubuntu 16.04 server: + +[ + ![Check Kernel Version in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png) +][2] + +Check Kernel Version in Ubuntu + +### Step 2: Upgrading Kernel in Ubuntu 16.04 + +To upgrade the kernel in Ubuntu 16.04, go to [http://kernel.ubuntu.com/~kernel-ppa/mainline/][3] and choose the desired version from the list by clicking on it. + +Next, download the `.deb` files for your system architecture (see highlighted in yellow below for a 32-bit system): + +``` +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913_4.9.13-040913.201702260631_all.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-image-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb +``` + +Once you’ve downloaded all the above kernel files, now install them as follows: + +``` +$ sudo dpkg -i *.deb +``` + +Once the installation is complete, reboot your machine and verify that the new kernel version is being used: + +``` +$ uname -sr +``` + +And that’s it. You are now using a much more recent kernel version than the one installed by default with Ubuntu 16.04. + +##### Summary + +In this article we’ve shown how to easily upgrade the Linux kernel on Ubuntu system. There is yet another procedure which we haven’t showed here as it requires compiling the kernel from source, which is not recommended on production Linux systems. + +If you’re still interested in compiling the kernel as a learning experience, you will get the instructions on how to do it at the [Kernel Newbies][4] page. + +As always, feel free to use the form below if you have any questions or comments about this article. + +-------------------------------------------------------------------------------- + + +作者简介: + +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. + +-------------------------------------------------------------------------------- +作者简介: + +Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/upgrade-kernel-in-ubuntu/ + +作者:[Gabriel Cánepa][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/gacanepa/ + +[1]:http://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/ +[2]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png +[3]:http://kernel.ubuntu.com/~kernel-ppa/mainline/ +[4]:https://kernelnewbies.org/KernelBuild +[5]:http://www.tecmint.com/author/gacanepa/ +[6]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[7]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170306 Understanding 7z command switches - part I.md b/sources/tech/20170306 Understanding 7z command switches - part I.md new file mode 100644 index 0000000000..b804a053e8 --- /dev/null +++ b/sources/tech/20170306 Understanding 7z command switches - part I.md @@ -0,0 +1,272 @@ +Understanding 7z command switches - part I +============================================================ + +### On this page + +1. [Include files][1] +2. [Exclude files][2] +3. [Set password for your archive][3] +4. [Set output directory][4] +5. [Creating multiple volumes][5] +6. [Set compression level of archive][6] +7. [Display technical information of archive][7] + +7z is no doubt a feature-rich and powerful archiver (claimed to offer the highest compression ratio). Here at HowtoForge, we have [already discussed][9] how you can install and use it. But the discussion was limited to basic features that you can access using the 'function letters' the tool provides. + +Expanding our coverage on the tool, here in this tutorial, we will be discussing some of the 'switches' 7z offers. But before we proceed, it's worth sharing that all the instructions and commands mentioned in this tutorial have been tested on Ubuntu 16.04 LTS. + +**Note**: We will be using the files displayed in the following screenshot for performing various operations using 7zip. + +[ + ![ls from test directory](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/ls.png) +][10] + +### +Include files + +The 7z tool allows you selectively include files in an archive. This feature can be accessed using the -i switch. + +Syntax: + +-i[r[-|0]]{@listfile|!wildcard} + +For example, if you want to include only ‘.txt’ files in your archive, you can use the following command: + +$ 7z a ‘-i!*.txt’ include.7z + +Here is the output: + +[ + ![add files to 7zip](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/include.png) +][11] + +Now, to check whether the newly-created archive file contains only ‘.txt’ file or not, you can use the following command: + +$ 7z l include.7z + +Here is the output: + +[ + ![Result](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/includelist.png) +][12] + +In the above screenshot, you can see that only ‘testfile.txt’ file has been added to the archive. + +### Exclude files + +If you want, you can also exclude the files that you don’t need. This can be done using the -x switch. + +Syntax: + +-x[r[-|0]]]{@listfile|!wildcard} + +For example, if you want to exclude a file named ‘abc.7z’ from the archive that you are going to create, then you can use the following command: + +$ 7z a ‘-x!abc.7z’ exclude.7z + +Here is the output: + +[ + ![exclude files from 7zip](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/exclude.png) +][13] + +To check whether the resulting archive file has excluded ‘abc.7z’ or not, you can use the following command: + +$ 7z l exclude.7z + +Here is the output: + +[ + ![result of file exclusion](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/excludelist.png) +][14] + +In the above screenshot, you can see that ‘abc.7z’ file has been excluded from the new archive file. + +**Pro tip**: Suppose the task is to exclude all the .7z files with names starting with letter ‘t’ and include all .7z files with names starting with letter ‘a’ . This can be done by combining both ‘-i’ and ‘-x’ switches in the following way: + +$ 7z a '-x!t*.7z' '-i!a*.7z' combination.7z + +### Set password for your archive + +7z also lets you password protect your archive file. This feature can be accessed using the -p switch. + +$ 7z a [archive-filename] -p[your-password] -mhe=[on/off] + +**Note**: The -mhe option enables or disables archive header encryption (default is off). + +For example: + +$ 7z a password.7z -pHTF -mhe=on + +Needless to say, when you will extract your password protected archive, the tool will ask you for the password. To extract a password-protected file, use the 'e' function letter. Following is an example: + +$ 7z e password.7z + +[ + ![protect 7zip archive with a password](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/password.png) +][15] + +### Set output directory + +The tool also lets you extract an archive file in the directory of your choice. This can be done using the -o switch. Needless to say, the switch only works when the command contains either the ‘e’ function letter or the ‘x’ function letter. + +$ 7z [e/x] [existing-archive-filename] -o[path-of-directory] + +For example, suppose the following command is run in the present working directory: + +$ 7z e output.7z -ohow/to/forge + +And, as the value passed to the -o switch suggests, the aim is to extract the archive in the ./how/to/forge directory. + +Here is the output: + +[ + ![7zip output directory](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/output.png) +][16] + +In the above screenshot, you can see that all the contents of existing archive file has been extracted. But where? To check whether or not the archive file has been extracted in the ./how/to/forge directory or not, we can use the ‘ls -R’ command. + +[ + ![result](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/ls_-R.png) +][17] + +In the above screenshot, we can see that all the contents of output.7z have indeed been extracted to ./how/to/forge. + +### Creating multiple volumes + +With the help of the 7z tool, you can create multiple volumes (smaller sub-archives) of your archive file. This is very useful when transferring large files over a network or in a USB. This feature can be accessed using the -v switch. The switch requires you to specify size of sub-archives. + +We can specify size of sub-archives in bytes (b), kilobytes (k), megabytes (m) and gigabytes (g). + +$ 7z a [archive-filename] [files-to-archive] -v[size-of-sub-archive1] -v[size-of-sub-archive2] .... + +Let's understand this using an example. Please note that we will be using a new directory for performing operations on the -v switch. + +Here is the screenshot of the directory contents: + +[ + ![7zip volumes](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/volumels.png) +][18] + +Now, we can run the following command for creating multiple volumes (sized 100b each) of an archive file: + +7z a volume.7z * -v100b + +Here is the screenshot: + +[ + ![compressing volumes](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/volume.png) +][19] + +Now, to see the list of sub-archives that were created, use the ‘ls’ command. + +[ + ![list of archives](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/volumels2.png) +][20] + +As seen in the above screenshot, a total of four multiple volumes have been created - volume.7z.001, volume.7z.002, volume.7z.003, and volume.7z.004 + +**Note**: You can extract files using the .7z.001 archive. But, for that, all the other sub-archive volumes should be present in the same directory. + +### Set compression level of archive + +7z also allows you to set compression levels of your archives. This feature can be accessed using the -m switch. There are various compression levels in 7z, such as -mx0, -mx1, -mx3, -mx5, -mx7 and -mx9. + +Here's a brief summary about these levels: + +-**mx0** = Don't compress at all - just copy the contents to archive. +-**mx1** = Consumes least time, but compression is low. +-**mx3** = Better than -mx1. +-**mx5** = This is default (compression is normal). +-**mx7** = Maximum compression. +-**mx9** = Ultra compression. + +**Note**: For more information on these compression levels, head [here][8]. + +$ 7z a [archive-filename] [files-to-archive] -mx=[0,1,3,5,7,9] + +For example, we have a bunch of files and folders in a directory, which we tried compressing using a different compression level each time. Just to give you an idea, here's the command used when the archive was created with compression level '0'. + +$ 7z a compression(-mx0).7z * -mx=0 + +Similarly, other commands were executed. + +Here is the list of output archives (produced using the 'ls' command), with their names suggesting the compression level used in their creation, and the fifth column in the output revealing the effect of compression level on their size. + +[ + ![7zip compression level](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/compression.png) +][21] + +### +Display technical information of archive + +If you want, 7z also lets you display technical information of an archive - it's type, physical size, header size, and so on - on the standard output. This feature can be accessed using the -slt switch. This switch only works with the ‘l’ function letter. + +$ 7z l -slt [archive-filename] + +For example: + +$ 7z l -slt abc.7z + +Here is the output: + +[ + ![](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/slt.png) +][22] + +# Specify type of archive to create + +If you want to create a non 7zip archive (which gets created by default), you can specify your choice using the -t switch.  + +$ 7z a -t[specify-type-of-archive] [archive-filename] [file-to-archive] + +The following example shows a command to create a .zip file: + +7z a -tzip howtoforge * + +The output file produced is 'howtoforge.zip'. To cross verify its type, use the 'file' command: + +[ + ![](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/type.png) +][23] + +So, howtoforge.zip is indeed a ZIP file. Similarly, you can create other kind of archives that 7z supports. + +# Conclusion + +As you would agree, the knowledge of 7z 'function letters' along with 'switches' lets you make the most out of the tool. We aren't yet done with switches - there are some more that will be discussed in part 2. + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/understanding-7z-command-switches/ + +作者:[ 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/understanding-7z-command-switches/ +[1]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#include-files +[2]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#exclude-files +[3]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#set-password-for-your-archive +[4]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#set-output-directory +[5]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#creating-multiple-volumes +[6]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#set-compression-level-of-archive +[7]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#display-technical-information-of-archive +[8]:http://askubuntu.com/questions/491223/7z-ultra-settings-for-zip-format +[9]:https://www.howtoforge.com/tutorial/how-to-install-and-use-7zip-file-archiver-on-ubuntu-linux/ +[10]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/ls.png +[11]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/include.png +[12]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/includelist.png +[13]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/exclude.png +[14]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/excludelist.png +[15]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/password.png +[16]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/output.png +[17]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/ls_-R.png +[18]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/volumels.png +[19]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/volume.png +[20]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/volumels2.png +[21]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/compression.png +[22]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/slt.png +[23]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/type.png diff --git a/sources/tech/20170307 Assign Read-Write Access to a User on Specific Directory in Linux.md b/sources/tech/20170307 Assign Read-Write Access to a User on Specific Directory in Linux.md new file mode 100644 index 0000000000..da5dec793d --- /dev/null +++ b/sources/tech/20170307 Assign Read-Write Access to a User on Specific Directory in Linux.md @@ -0,0 +1,152 @@ +Assign Read/Write Access to a User on Specific Directory in Linux +============================================================ + + +In a previous article, we showed you how to [create a shared directory in Linux][3]. Here, we will describe how to give read/write access to a user on a specific directory in Linux. + +There are two possible methods of doing this: the first is [using ACLs (Access Control Lists)][4] and the second is [creating user groups to manage file permissions][5], as explained below. + +For the purpose of this tutorial, we will use following setup. + +``` +Operating system: CentOS 7 +Test directory: /shares/project1/reports +Test user: tecmint +Filesystem type: Ext4 +``` + +Make sure all commands are executed as root user or use the the [sudo command][6] with equivalent privileges. + +Let’s start by creating the directory called `reports` using the mkdir command: + +``` +# mkdir -p /shares/project1/reports +``` + +### Using ACL to Give Read/Write Access to User on Directory + +Important: To use this method, ensure that your Linux filesystem type (such as Ext3 and Ext4, NTFS, BTRFS) support ACLs. + +1. First, [check the current file system type][7] on your system, and also whether the kernel supports ACL as follows: + +``` +# df -T | awk '{print $1,$2,$NF}' | grep "^/dev" +# grep -i acl /boot/config* +``` + +From the screenshot below, the filesystem type is Ext4 and the kernel supports POSIX ACLs as indicated by the CONFIG_EXT4_FS_POSIX_ACL=y option. + +[ + ![Check Filesystem Type and Kernel ACL Support](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Filesystem-Type-and-Kernel-ACL-Support.png) +][8] + +Check Filesystem Type and Kernel ACL Support + +2. Next, check if the file system (partition) is mounted with ACL option or not: + +``` +# tune2fs -l /dev/sda1 | grep acl +``` +[ + ![Check Partition ACL Support](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Partition-ACL-Support.png) +][9] + +Check Partition ACL Support + +From the above output, we can see that default mount option already has support for ACL. If in case it’s not enabled, you can enable it for the particular partition (/dev/sda3 for this case): + +``` +# mount -o remount,acl / +# tune2fs -o acl /dev/sda3 +``` + +3. Now, its time to assign a read/write access to a user `tecmint` to a specific directory called `reports`by running the following commands. + +``` +# getfacl /shares/project1/reports # Check the default ACL settings for the directory +# setfacl -m user:tecmint:rw /shares/project1/reports # Give rw access to user tecmint +# getfacl /shares/project1/reports # Check new ACL settings for the directory +``` +[ + ![Give Read/Write Access to Directory Using ACL](http://www.tecmint.com/wp-content/uploads/2017/03/Give-Read-Write-Access-to-Directory-Using-ACL.png) +][10] + +Give Read/Write Access to Directory Using ACL + +In the screenshot above, the user `tecmint` now has read/write (rw) permissions on directory /shares/project1/reports as seen from the output of the second getfacl command. + +For more information about ACL lists, do check out our following guides. + +1. [How to Use ACLs (Access Control Lists) to Setup Disk Quotas for Users/Groups][1] +2. [How to Use ACLs (Access Control Lists) to Mount Network Shares][2] + +Now let’s see the second method of assigning read/write access to a directory. + +### Using Groups to Give Read/Write Access to User on Directory + +1. If the user already has a default user group (normally with same name as username), simply change the group owner of the directory. + +``` +# chgrp tecmint /shares/project1/reports +``` + +Alternatively, create a new group for multiple users (who will be given read/write permissions on a specific directory), as follows. However, this will c[reate a shared directory][11]: + +``` +# groupadd projects +``` + +2. Then add the user `tecmint` to the group `projects` as follows: + +``` +# usermod -aG projects tecmint # add user to projects +# groups tecmint # check users groups +``` + +3. Change the group owner of the directory to projects: + +``` +# chgrp projects /shares/project1/reports +``` + +4. Now set read/write access for the group members: + +``` +# chmod -R 0760 /shares/projects/reports +# ls -l /shares/projects/ #check new permissions +``` + +That’s it! In this tutorial, we showed you how to give read/write access to a user on a specific directory in Linux. If any issues, do ask via the comment section below. + +-------------------------------------------------------------------------------- + + +作者简介: + +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. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/give-read-write-access-to-directory-in-linux/ + +作者:[Aaron Kili][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/aaronkili/ +[1]:http://www.tecmint.com/set-access-control-lists-acls-and-disk-quotas-for-users-groups/ +[2]:http://www.tecmint.com/rhcsa-exam-configure-acls-and-mount-nfs-samba-shares/ +[3]:http://www.tecmint.com/create-a-shared-directory-in-linux/ +[4]:http://www.tecmint.com/secure-files-using-acls-in-linux/ +[5]:http://www.tecmint.com/manage-users-and-groups-in-linux/ +[6]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ +[7]:http://www.tecmint.com/find-linux-filesystem-type/ +[8]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Filesystem-Type-and-Kernel-ACL-Support.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Partition-ACL-Support.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/03/Give-Read-Write-Access-to-Directory-Using-ACL.png +[11]:http://www.tecmint.com/create-a-shared-directory-in-linux/ +[12]:http://www.tecmint.com/author/aaronkili/ +[13]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[14]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/sources/tech/20170307 How to make release notes count.md b/sources/tech/20170307 How to make release notes count.md new file mode 100644 index 0000000000..889d98e68b --- /dev/null +++ b/sources/tech/20170307 How to make release notes count.md @@ -0,0 +1,58 @@ +How to make release notes count +============================================================ + + ![How to make release notes count](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/rh_003784_02_os.comcareers_resume_rh1x.png?itok=CK6VJq5w "How to make release notes count") +>Image by : opensource.com + +Congratulations! You're ready to ship the latest release of your software package. Now you need to make sure your release notes are in order. Sure, you could just slap "bug fixes and performance improvements" on the box and call it a day, but that doesn't really tell your users anything. + +Release notes are for both support and marketing. They tell your current users why this new release is important to them and showcase your software to potential users. Thus, you want to make the content clear, understandable, and most importantly, relevant. There's no one way to write release notes, so this is general advice, not an edict. + +One popular trend is to make the release notes a narrative that includes a lot of silliness. If that's your thing, go for it—just remember that jokes are often context-sensitive, and what you think is hilarious might be totally lost on your readers. And, of course, you can't forget to include the important information. + +### Getting started + +Perhaps the single most important takeaway from this article is to write your release notes for the people who will read them. For user-facing software, focus on the user-facing behavior instead of the internal implementation. For example, say, "Clicking the 'Cancel' button will light your computer on fire," instead of "thermalEventTrigger defaulted to True in the cancelThatThing function." + +Try to limit each note to a sentence or two. The point is to highlight the important part, not give a detailed explanation. If you have a public issue tracker, include a link (or at least an issue number) where readers can go find details if they're so inclined. + +You don't have to lay out your release notes this way, but I like the following format. Start with the version number and release date. For major releases, you might also include a few sentences to highlight the major theme. For example, "This release focuses on adding an email client, because that's the eventual end state of all software." + +### Compatibility changes + +If the new release introduces changes in compatibility or default behavior, highlight those explicitly. Your users will thank you, as will anyone who provides user support. Describe the cases where the behavior change will be encountered, how to address the change, and what happens if the user doesn't act on the change. For minor releases, you probably don't have any incompatible changes, so you can leave out this section. + +### Features and enhancements + +Now is the time to brag about all of the cool, new stuff your software does, but remember to focus on the user's perspective. For example, "The software now supports the automatic detection of pictures of lunch and posts them to Instagram." + +### Issues resolved + +No software is perfect, and this is the section where you tell readers about all of the hard work your team did to make the project a little better. Write these notes in the past tense, because the bad behavior is dead and gone. If it's clear where the bug was introduced, include that information. Some projects include bugs in the documentation in this section as well. + +### Known issues + +Because no software is perfect, there are always bugs left unsquashed. This section is the place to list those. You don't have to confess everything; focus on the bugs that impact functionality, especially if they were discovered since the last release. Write these in the future tense, and when you've addressed it, you just have to change the verb tense and it's ready to move up a section. + +-------------------------------------------------------------------------------- + +作者简介: + +Ben Cotton - Ben Cotton is a meteorologist by training and a high-performance computing engineer by trade. Ben works as a technical evangelist at Cycle Computing. He is a Fedora user and contributor, co-founded a local open source meetup group, and is a member of the Open Source Initiative and a supporter of Software Freedom Conservancy. Find him on Twitter (@FunnelFiasco) + + +-------------- + +via: https://opensource.com/article/17/3/how-to-improve-release-notes + +作者:[Ben Cotton][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/bcotton +[1]:https://opensource.com/article/17/3/how-to-improve-release-notes?rate=81ry_1MGfmsPXV6_y_4St2DQI4XyJAqIzs4yTNtUrpA +[2]:https://opensource.com/user/30131/feed +[3]:https://opensource.com/article/17/3/how-to-improve-release-notes#comments +[4]:https://opensource.com/users/bcotton diff --git a/sources/tech/20170307 How to set up a personal web server with a Raspberry Pi.md b/sources/tech/20170307 How to set up a personal web server with a Raspberry Pi.md new file mode 100644 index 0000000000..d23a96c22d --- /dev/null +++ b/sources/tech/20170307 How to set up a personal web server with a Raspberry Pi.md @@ -0,0 +1,307 @@ +How to set up a personal web server with a Raspberry Pi +============================================================ + + ![How to set up a personal web server with a Raspberry Pi](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/lightbulb_computer_person_general_.png?itok=ZY3UuQQa "How to set up a personal web server with a Raspberry Pi") +>Image by : opensource.com + +A personal web server is "the cloud," except you own and control it as opposed to a large corporation. + +Owning a little cloud has a lot of benefits, including customization, free storage, free Internet services, a path into open source software, high-quality security, full control over your content, the ability to make quick changes, a place to experiment with code, and much more. Most of these benefits are immeasurable, but financially these benefits can save you over $100 per month. + + ![Building your own web server with Raspberry Pi](https://opensource.com/sites/default/files/1-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Building your own web server with Raspberry Pi") + +Image by Mitchell McLaughlin, CC BY-SA 4.0 + +I could have used AWS, but I prefer complete freedom, full control over security, and learning how things are built. + +* Self web-hosting: No BlueHost or DreamHost +* Cloud storage: No Dropbox, Box, Google Drive, Microsoft Azure, iCloud, or AWS +* On-premise security +* HTTPS: Let’s Encrypt +* Analytics: Google +* OpenVPN: Do not need private Internet access (at an estimated $7 per month) + +Things I used: + +* Raspberry Pi 3 Model B +* MicroSD Card (32GB recommended, [Raspberry Pi Compatible SD Cards][1]) +* USB microSD card reader +* Ethernet cable +* Router connected to Wi-Fi +* Raspberry Pi case +* Amazon Basics MicroUSB cable +* Apple wall charger +* USB mouse +* USB keyboard +* HDMI cable +* Monitor (with HDMI input) +* MacBook Pro + +### Step 1: Setting up the Raspberry Pi + +Download the most recent release of Raspbian (the Raspberry Pi operating system). [Raspbian Jessie][6] ZIP version is ideal [1]. Unzip or extract the downloaded file. Copy it onto the SD card. [Pi Filler][7] makes this process easy. [Download Pi Filer 1.3][8] or the most recent version. Unzip or extract the downloaded file and open it. You should be greeted with this prompt: + + ![Pi Filler prompt](https://opensource.com/sites/default/files/2-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Pi Filler prompt") + +Make sure the USB card reader has NOT been inserted yet. If it has, eject it. Proceed by clicking Continue. A file explorer should appear. Locate the uncompressed Raspberry Pi OS file from your Mac or PC and select it. You should see another prompt like the one pictured below: + + ![USB card reader prompt](https://opensource.com/sites/default/files/3-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "USB card reader") + +Insert the MicroSD card (32GB recommended, 16GB minimum) into the USB MicroSD Card Reader. Then insert the USB reader into the Mac or PC. You can rename the SD card to "Raspberry" to distinguish it from others. Click Continue. Make sure the SD card is empty. Pi Filler will  _erase_  all previous storage at runtime. If you need to back up the card, do so now. When you are ready to continue, the Raspbian OS will be written to the SD card. It should take between one to three minutes. Once the write is completed, eject the USB reader, remove the SD card, and insert it into the Raspberry Pi SD card slot. Give the Raspberry Pi power by plugging the power cord into the wall. It should start booting up. The Raspberry Pi default login is: + +**username: pi +password: raspberry** + +When the Raspberry Pi has completed booting for the first time, a configuration screen titled "Setup Options" should appear like the image below [2]: + + ![Raspberry Pi software configuration setup](https://opensource.com/sites/default/files/4-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Raspberry Pi software configuration setup") + +Select the "Expand Filesystem" option and hit the Enter key [3]. Also, I recommend selecting the second option, "Change User Password." It is important for security. It also personalizes your Raspberry Pi. + +Select the third option in the setup options list, "Enable Boot To Desktop/Scratch" and hit the Enter key. It will take you to another window titled "Choose boot option" as shown in the image below. + + ![Choose boot option](https://opensource.com/sites/default/files/5-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Choose boot option") + +In the "Choose boot option" window, select the second option, "Desktop log in as user 'pi' at the graphical desktop" and hit the Enter button [4]. Once this is done you will be taken back to the "Setup Options" page. If not, select the "OK" button at the bottom of this window and you will be taken back to the previous window. + +Once both these steps are done, select the "Finish" button at the bottom of the page and it should reboot automatically. If it does not, then use the following command in the terminal to reboot. + +**$ sudo reboot** + +After the reboot from the previous step, if everything went well, you will end up on the desktop similar to the image below. + + ![Raspberry Pi desktop](https://opensource.com/sites/default/files/6-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Raspberry Pi desktop") + +Once you are on the desktop, open a terminal and enter the following commands to update the firmware of the Raspberry Pi. + +``` +$ sudo apt-get update + +$ sudo apt-get upgrade-y + +$ sudo apt-get dist-upgrade -y + +$ sudo rpi-update +``` + +This may take a few minutes. Now the Raspberry Pi is up-to-date and running. + +### Step 2: Configuring the Raspberry Pi + +SSH, which stands for Secure Shell, is a cryptographic network protocol that lets you securely transfer data between your computer and your Raspberry Pi. You can control your Raspberry Pi from your Mac's command line without a monitor or keyboard. + +To use SSH, first, you need your Pi's IP address. Open the terminal and type: + +``` +$ sudo ifconfig +``` + +If you are using Ethernet, look at the "eth0" section. If you are using Wi-Fi, look at the "wlan0" section. + +Find "inet addr" followed by an IP address—something like 192.168.1.115, a common default IP I will use for the duration of this article. + +With this address, open terminal and type: + +``` +$ ssh pi@192.168.1.115 +``` + +For SSH on PC, see footnote [5]. + +Enter the default password "raspberry" when prompted, unless you changed it. + +You are now logged in via SSH. + +### Remote desktop + +Using a GUI (graphical user interface) is sometimes easier than a command line. On the Raspberry Pi's command line (using SSH) type: + +``` +$ sudo apt-get install xrdp +``` + +Xrdp supports the Microsoft Remote Desktop Client for Mac and PC. + +On Mac, navigate to the app store and search for "Microsoft Remote Desktop." Download it. (For a PC, see footnote [6].) + +After installation, search your Mac for a program called "Microsoft Remote Desktop." Open it. You should see this: + + ![Microsoft Remote Desktop](https://opensource.com/sites/default/files/7-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Microsoft Remote Desktop") + +Image by Mitchell McLaughlin, CC BY-SA 4.0 + +Click "New" to set up a remote connection. Fill in the blanks as shown below. + + ![Setting up a remote connection](https://opensource.com/sites/default/files/8-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Setting up a remote connection") + +Image by Mitchell McLaughlin, CC BY-SA 4.0 + +Save it by exiting out of the "New" window. + +You should now see the remote connection listed under "My Desktops." Double click it. + +After briefly loading, you should see your Raspberry Pi desktop in a window on your screen, which looks like this: + + ![Raspberry Pi desktop](https://opensource.com/sites/default/files/6-image_by_mitchell_mclaughlin_cc_by-sa_4.0_0.png "Raspberry Pi desktop") + +Perfect. Now, you don't need a separate mouse, keyboard, or monitor to control the Pi. This is a much more lightweight setup. + +### Static local IP address + +Sometimes the local IP address 192.168.1.115 will change. We need to make it static. Type: + +``` +$ sudo ifconfig +``` + +Write down from the "eth0" section or the "wlan0" section, the "inet addr" (Pi's current IP), the "bcast" (the broadcast IP range), and the "mask" (subnet mask address). Then, type: + +``` +$ netstat -nr +``` + +Write down the "destination" and the "gateway/network." + + ![Setting up a local IP address](https://opensource.com/sites/default/files/setting_up_local_ip_address.png "Setting up a local IP address") + +The cumulative records should look something like this: + +``` +net address 192.168.1.115 +bcast 192.168.1.255 +mask 255.255.255.0 +gateway 192.168.1.1 +network 192.168.1.1 +destination 192.168.1.0 +``` + +With this information, you can set a static internal IP easily. Type: + +``` +$ sudo nano /etc/dhcpcd.conf +``` + +Do not use **/etc/network/interfaces**. + +Then all you need to do is append this to the bottom of the file, substituting the correct IP address you want. + +``` +interface eth0 +static ip_address=192.168.1.115 +static routers=192.168.1.1 +static domain_name_servers=192.168.1.1 +``` + +Once you have set the static internal IP address, reboot the Raspberry Pi with: + +``` +$ sudo reboot +``` + +After rebooting, from terminal type: + +``` +$ sudo ifconfig +``` + +Your new static settings should appear for your Raspberry Pi. + +### Static global IP address + +If your ISP (internet service provider) has already given you a static external IP address, you can skip ahead to the port forwarding section. If not, continue reading. + +You have set up SSH, a remote desktop, and a static internal IP address, so now computers inside the local network will know where to find the Pi. But you still can't access your Raspberry Pi from outside the local Wi-Fi network. You need your Raspberry Pi to be accessible publicly from anywhere on the Internet. This requires a static external IP address [7]. + +It can be a sensitive process initially. Call your ISP and request a static external (sometimes referred to as static global) IP address. The ISP holds the decision-making power, so I would be extremely careful dealing with them. They may refuse your static external IP address request. If they do, you can't fault the ISP because there is a legal and operational risk with this type of request. They particularly do not want customers running medium- or large-scale Internet services. They might explicitly ask why you need a static external IP address. It is probably best to be honest and tell them you plan on hosting a low-traffic personal website or a similar small not-for-profit internet service. If all goes well, they should open a ticket and call you in a week or two with an address. + +### Port forwarding + +This newly obtained static global IP address your ISP assigned is for accessing the router. The Raspberry Pi is still unreachable. You need to set up port forwarding to access the Raspberry Pi specifically. + +Ports are virtual pathways where information travels on the Internet. You sometimes need to forward a port in order to make a computer, like the Raspberry Pi, accessible to the Internet because it is behind a network router. A YouTube video titled [What is TCP/IP, port, routing, intranet, firewall, Internet][9] by VollmilchTV helped me visually understand ports. + +Port forwarding can be used for projects like a Raspberry Pi web server, or applications like VoIP or peer-to-peer downloading. There are [65,000+ ports][10] to choose from, so you can assign a different port for every Internet application you build. + +The way to set up port forwarding can depend on your router. If you have a Linksys, a YouTube video titled  _[How to go online with your Apache Ubuntu server][2]_  by Gabriel Ramirez explains how to set it up. If you don't have a Linksys, read the documentation that comes with your router in order to customize and define ports to forward. + +You will need to port forward for SSH as well as the remote desktop. + +Once you believe you have port forwarding configured, check to see if it is working via SSH by typing: + +``` +$ ssh pi@your_global_ip_address +``` + +It should prompt you for the password. + +Check to see if port forwarding is working for the remote desktop as well. Open Microsoft Remote Desktop. Your previous remote connection settings should be saved, but you need to update the "PC name" field with the static external IP address (for example, 195.198.227.116) instead of the static internal address (for example, 192.168.1.115). + +Now, try connecting via remote desktop. It should briefly load and arrive at the Pi's desktop. + + ![Raspberry Pi desktop](https://opensource.com/sites/default/files/6-image_by_mitchell_mclaughlin_cc_by-sa_4.0_1.png "Raspberry Pi desktop") + +Good job. The Raspberry Pi is now accessible from the Internet and ready for advanced projects. + +As a bonus option, you can maintain two remote connections to your Pi. One via the Internet and the other via the LAN (local area network). It's easy to set up. In Microsoft Remote Desktop, keep one remote connection called "Pi Internet" and another called "Pi Local." Configure Pi Internet's "PC name" to the static external IP address—for example, 195.198.227.116\. Configure Pi Local's "PC name" to the static internal IP address—for example, 192.168.1.115\. Now, you have the option to connect globally or locally. + +If you have not seen it already, watch  _[How to go online with your Apache Ubuntu server][3]_  by Gabriel Ramirez as a transition into Project 2\. It will show you the technical architecture behind your project. In our case, you are using a Raspberry Pi instead of an Ubuntu server. The dynamic DNS sits between the domain company and your router, which Ramirez omits. Beside this subtlety, the video is spot on when explaining visually how the system works. You might notice this tutorial covers the Raspberry Pi setup and port forwarding, which is the server-side or back end. See the original source for more advanced projects covering the domain name, dynamic DNS, Jekyll (static HTML generator), and Apache (web hosting), which is the client-side or front end. + +### Footnotes + +[1] I do not recommend starting with the NOOBS operating system. I prefer starting with the fully functional Raspbian Jessie operating system. + +[2] If "Setup Options" does not pop up, you can always find it by opening Terminal and executing this command: + +``` +$ sudo-rasps-config +``` + +[3] We do this to make use of all the space present on the SD card as a full partition. All this does is expand the operating system to fit the entire space on the SD card, which can then be used as storage memory for the Raspberry Pi. + +[4] We do this because we want to boot into a familiar desktop environment. If we do not do this step, the Raspberry Pi boots into a terminal each time with no GUI. + +[5] + + ![PuTTY configuration](https://opensource.com/sites/default/files/putty_configuration.png "PuTTY configuration") + +[Download and run PuTTY][11] or another SSH client for Windows. Enter your IP address in the field, as shown in the above screenshot. Keep the default port at 22\. Hit Enter, and PuTTY will open a terminal window, which will prompt you for your username and password. Fill those in, and begin working remotely on your Pi. + +[6] If it is not already installed, download [Microsoft Remote Desktop][12]. Search your computer for Microsoft Remote Desktop. Run it. Input the IP address when prompted. Next, an xrdp window will pop up, prompting you for your username and password. + +[7] The router has a dynamically assigned external IP address, so in theory, it can be reached from the Internet momentarily, but you'll need the help of your ISP to make it permanently accessible. If this was not the case, you would need to reconfigure the remote connection on each use. + + _For the original source, visit [Mitchell McLaughlin's Full-Stack Computer Projects][4]._ + +-------------------------------------------------------------------------------- + +作者简介: + +Mitchell McLaughlin - I'm an open-web contributor and developer. My areas of interest are broad, but specifically I enjoy open source software/hardware, bitcoin, and programming in general. I reside in San Francisco. My work experience in the past has included brief stints at GoPro and Oracle. + +------------- + + +via: https://opensource.com/article/17/3/building-personal-web-server-raspberry-pi-3 + +作者:[Mitchell McLaughlin ][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/mitchm +[1]:http://elinux.org/RPi_SD_cards +[2]:https://www.youtube.com/watch?v=i1vB7JnPvuE#t=07m08s +[3]:https://www.youtube.com/watch?v=i1vB7JnPvuE#t=07m08s +[4]:https://mitchellmclaughlin.com/server.html +[5]:https://opensource.com/article/17/3/building-personal-web-server-raspberry-pi-3?rate=Zdmkgx8mzy9tFYdVcQZSWDMSy4uDugnbCKG4mFsVyaI +[6]:https://www.raspberrypi.org/downloads/raspbian/ +[7]:http://ivanx.com/raspberrypi/ +[8]:http://ivanx.com/raspberrypi/files/PiFiller.zip +[9]:https://www.youtube.com/watch?v=iskxw6T1Wb8 +[10]:https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers +[11]:http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html +[12]:https://www.microsoft.com/en-us/store/apps/microsoft-remote-desktop/9wzdncrfj3ps +[13]:https://opensource.com/user/41906/feed +[14]:https://opensource.com/article/17/3/building-personal-web-server-raspberry-pi-3#comments +[15]:https://opensource.com/users/mitchm diff --git a/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md b/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md index 16ac5a6428..b661c1a8ff 100644 --- a/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md +++ b/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md @@ -1,3 +1,4 @@ +zschong 翻译中 ### What is Debian? A brief introduction Hello buddies.!!  diff --git a/sources/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md b/sources/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md deleted file mode 100644 index b6cf7ed236..0000000000 --- a/sources/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md +++ /dev/null @@ -1,86 +0,0 @@ -### Linux Deepin - A distro with a unique style - - -On the sixth segment of this series we have **Linux Deepin. **Well this distro is very interesting and must mention it's eye candy for sure. There are lot of distros, but lot of them are only making fair market by using what already is available. But the story is very different here, though this distro is based on ubuntu but they provide their own desktop environment. There are very few distros which make a great deal by making something of their own creation. Last time we have seen**Elementary OS **with thier own Pantheon desktop environment. Let's have a look how it is in case of Linux Deepin.  - -[ - ![](http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png) -][6] - -First of all just after after you log in to your account, you will get welcomed by a beautiful desktop with a well designed and good looking dock. This dock is customisable and have some interesting effects depending on softwares placed in dock. - -[ - ![](http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png) -][7] - -Now there is an launcher icon on the dock, but there's one more way to open launcher that is just hit the pointer onto the upper left corner. The launcher itself is well categorized and elegant.  - -[ - ![](http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png) -][8]  - - -As you can see in above screenshot the launcher is properly categorized and different software are sorted accordingly. and there's another good thing is if you hit the pointer on lower left corner then it will minimize all your running softwares an bring you on desktop. Again hitting on same corner will restore all the running tasks again. - - -[ - ![](http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png) -][9]  - -Now if you hit the lower right corner, it will slide out control center. From here one can change all the settings of the pc. - - -[ - ![](http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png) -][10]  - -As you can see in above screenshot control center is also well categorized and well designed you can change almost all the settings of PC from here. Even you can customize your boot screen with custom wallpapers. - - -[ - ![](http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png) -][11]  - -Linux deepin have it's software store bundled with the distro. You can fin most of the software here and it's very easy to install them as well. Software store is also properly designed and well sorted for easy navigation. - - -[ - ![](http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png) -][12]  - -Another interesting feature here is Deepin game. It offers lots of free to play online games which are quite interesting to play and good to keep one entertained. - - -[ - ![](http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png) -][13] - -Linux Deepin also offers a rich music player which have internet radio service built in too. Don't have offline music in your PC no worries just switch to network radio and enjoy music online. - -Overall Linux Deepin has lot more to offer plus they know how to keep users entertained while using their product. It's like their motto is "whatever we do, we gonna do it with some style". The support is quite good as it i given by people who us deepin in actual. Despite of being a chinese distro it offers english language too so there's no need to worry about language problem. The iso of Deepin is around 1.5 gb in size. You can also visit thier **[Official Site][14] **for more information and downloads. We would highly recommend you to try out this distro. With this we end today's segment of "**Introduction with Linux Distro**" series. We will be back with more distros n next segments so stay tuned with us. Till then, ciao. - --------------------------------------------------------------------------------- - -via: http://www.techphylum.com/2014/08/linux-deepin-distro-with-unique-style.html - -作者:[sumit rohankar https://plus.google.com/112160169713374382262][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/112160169713374382262 -[1]:http://www.techphylum.com/2014/06/linux-mint-introduction.html -[2]:http://www.techphylum.com/2014/05/elementary-os-brief-introduction.html -[3]:http://www.techphylum.com/2014/05/Introduction-to-fedora.html -[4]:http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html -[5]:http://www.techphylum.com/2014/05/what-is-opensuse-introduction.html -[6]:http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png -[7]:http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png -[8]:http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png -[9]:http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png -[10]:http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png -[11]:http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png -[12]:http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png -[13]:http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png -[14]:http://www.linuxdeepin.com/index.en.html diff --git a/sources/tech/linux-distro -explain/20160708 Manjaro Linux explained.md b/sources/tech/linux-distro -explain/20160708 Manjaro Linux explained.md deleted file mode 100644 index 0132d69756..0000000000 --- a/sources/tech/linux-distro -explain/20160708 Manjaro Linux explained.md +++ /dev/null @@ -1,58 +0,0 @@ -Transtating by Chao-zhi - -# Manjaro Linux explained - -Today we have Manjaro on our seventh segment. Manjaro is based on Arch Linux with a beautiful user interface. Manjaro is not much older like Debian or Arch but still it emerged as a stable and reliable Linux Distribution,standing and differentiating itself in the crowd of Distros. In 2011 there was the first initial release of Manjaro. Since then it improved a lot and today we are having the latest version 16.06.1 codenamed 'Daniella'.  - -**So why should We consider Manjaro over other Linux Distributions?**We are not telling you to use Manjaro instead of other distributions, but we are going to give you reasons to think about it.So let's start it. - -* ** Based on Arch:  **As many people know or think, Arch is absolutely a no joke distribution. Newbies find it difficult to use. Many newbies find it hard to install as Arch Linux doesn't have graphical installer. On the other hand , Manjaro have a graphical installer which is easy to use. So people or newbies who are thinking to try Arch (but doubting on difficulties) can use Manjaro. Manjaro is easy to install and it have user friendly UI. - -* **Desktop Environments:  **Manjaro has quite a lot choices when it comes to desktop environments. It gives variety of choices like Xfce, KDE, Deepin, BspWM, Budgie, i3, LXDE, Cinnamon, Enlightenment, Netbook, Fluxbox, Gnome, JWM, LXQT, MATE, Openbox and PekWM. In all this desktop environments Manjaro works like a charm. The official desktop environments of Manjaro are Xfce and KDE, while other DE are community supported. We are currently using KDE Plasma desktop ewnvironment on Manjaro 16.06.1. - - [ - ![Manjaro 16.06.1 with KDE plasma 5.6.5](https://4.bp.blogspot.com/-PvT_KN4_avM/V3_eMdhSAvI/AAAAAAAABLY/jjQDrV6dXOw9_vcS5XD3-kZy-chWsR1PQCLcB/s640/Desktop%2B1_001.png "Manjaro 16.06.1 with KDE plasma 5.6.5") -][7] - -> Manjaro 16.06.1 running KDE plasma 5.6.5 - -> If you think you are trapped with KDE or Xfce in Manjaro, the don't worry you can always install other desktop environments from package manager. - - [ - ![Manjaro 16.06.1 with KDE plasma 5.6.5](https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s640/Screenshot_20160708_223023.png "Manjaro 16.06.1 with KDE plasma 5.6.5") -][8] -> Downloading Budgie DE from Package manager. - -* **Stability and Package Management: **Manjaro may be new but it is stable. Latest version of Manjaro ships with Linux kernel 4.6.2. Manjaro is not only stable, but also it is bleeding edge. It brings latest updates on softwares as soon as it gets compiled in repositories. Manjaro uses pacman for package management. Pacman is already famous due to Arch Linux (and game ofcourse). To get more user-friendly Manjaro uses Octopi, a graphical frontend for Pacman which is written in Qt. Manjaro also maintains it's own repositories so there's always an advantage of that. - -[ - ![Manjaro 16.06.1 with KDE plasma 5.6.5](https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s640/Screenshot_20160708_223023.png "Manjaro 16.06.1 with KDE plasma 5.6.5") -][9] ->Octopi Package manager - -* **Community support: ** Manjaro is also a community based linux like many others. There are always people to help you out whenever you need it. Apart from Xfce and KDE (which are officially maintained) all other desktop environments are compiled and maintained by Manjaro community. If any user is in problem he can always count on community to help him and he can beassured to get help from actual Manjaro users. - -These are just a few reasons,which we've listed out here. You will get many as you will get your hands over it.  - -**Still thinking about installing it ?** If you're still confused about Manjaro then You can also give it  try in Virtualbox and then can install it in actual machine, if you liked it. We are also posting this topic on Manjaro 16.06.1\. So Guys have fun with Linux and stay tuned with us because we are bringing more segments to this series. Keep visiting us for more interesting stuffs on Linux. - --------------------------------------------------------------------------------- - -via: http://www.techphylum.com/2016/07/manjaro-linux-explained.html - -作者:[sumit rohankar ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/112160169713374382262 -[1]:http://www.techphylum.com/2014/08/linux-deepin-distro-with-unique-style.html -[2]:http://www.techphylum.com/2014/06/linux-mint-introduction.html -[3]:http://www.techphylum.com/2014/05/elementary-os-brief-introduction.html -[4]:http://www.techphylum.com/2014/05/Introduction-to-fedora.html -[5]:http://www.techphylum.com/2014/05/what-is-opensuse-introduction.html -[6]:http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html -[7]:https://4.bp.blogspot.com/-PvT_KN4_avM/V3_eMdhSAvI/AAAAAAAABLY/jjQDrV6dXOw9_vcS5XD3-kZy-chWsR1PQCLcB/s1600/Desktop%2B1_001.png -[8]:https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s1600/Screenshot_20160708_223023.png -[9]:https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s1600/Screenshot_20160708_223023.png diff --git a/translated/talk/20170110 What engineers and marketers can learn from each other.md b/translated/talk/20170110 What engineers and marketers can learn from each other.md index 239dc17491..7092fa9db0 100644 --- a/translated/talk/20170110 What engineers and marketers can learn from each other.md +++ b/translated/talk/20170110 What engineers and marketers can learn from each other.md @@ -44,11 +44,11 @@ _“营销人员都很懒散。”_ 那段时间,我快速地学到了很多东西,因为如果我们想把达美航空公司恢复到正常状态,还需要做很多的工作——市场营销更像是一个以解决问题为导向,以用户为中心的充满挑战性的大工程,只是销售人员和工程师这两大阵营都没有迅速地意识到这个问题。 -### 两大文件差异 +### 两大文化差异 工程管理和市场营销之间的这个“巨大鸿沟”确实是根深蒂固的,这跟 C.P. Snow (英语物理化学家和小说家)提出的[“两大文化差异"问题][1]很相似。具有科学素质的工程师和具有艺术细胞的营销人员操着不同的语言,不同的文化观念导致他们不同的价值取向。 -但是,事实上他们有更多的相似之处。华盛顿大学[最新研究][2](由微软、谷歌和美国国家科学基金会共同赞助)发现”一个伟大软件工程师必须具备哪些优秀的素质,“毫无疑问,一个伟大的销售人员同样也应该具备这些素质。例如,专家们给出的一些优秀品质如下: +但是,事实上他们比想象中有更多的相似之处。华盛顿大学[最新研究][2](由微软、谷歌和美国国家科学基金会共同赞助)发现”一个伟大软件工程师必须具备哪些优秀的素质,“毫无疑问,一个伟大的销售人员同样也应该具备这些素质。例如,专家们给出的一些优秀品质如下: * 充满激情 * 性格开朗 @@ -94,7 +94,7 @@ via: https://opensource.com/open-organization/17/1/engineers-marketers-can-learn 作者:[Jackie Yeaney][a] 译者:[rusking](https://github.com/rusking) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Bestony](https://github.com/Bestony) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20170111 How to choose your first programming language.md b/translated/talk/20170111 How to choose your first programming language.md index 4116461722..c900c0968e 100644 --- a/translated/talk/20170111 How to choose your first programming language.md +++ b/translated/talk/20170111 How to choose your first programming language.md @@ -1,29 +1,28 @@ 如何挑选你的第一门编程语言 -============================================================[ - -][1] +============================================================ +[][1] ![How to choose your first programming language](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/EDU_OSDC_IntroOS_520x292_FINAL.png?itok=va-tdc8j "How to choose your first programming language") opensource.com 供图 -人们有着各种各样的原因想学编程。你也许想要做一个程序,或者你只是想投入其中。所以,在选择你的第一门编程语言之前,问问你自己:你想要程序运行在哪里?你想要程序做什么? +人们有着各种各样的原因想学编程。你也许是想要做一个程序,又或者你只是想投入其中。所以,在选择你的第一门编程语言之前,问问你自己:你想要程序运行在哪里?你想要程序做什么? -你选择编程的原因决定第一门编程语言的选择。 +你选择编程的原因将会决定第一门编程语言的选择。 -_在这篇文章里,我会交换着使用“编程”(code , program)、“开发”(develop) 等动词,“代码”(code)、“程序”(program)、“应用”(application/app)等名词。这是考虑到你可能听过的语言用法_ +_在这篇文章里,我会交替使用“编程”(code , program)、“开发”(develop) 等动词,“代码”(code)、“程序”(program)、“应用”(application/app)等名词。这考虑到你可能听过的语言用法_ ### 了解你的设备 在你编程语言的选择上,你的程序将运行在何处是个决定性因素。 -桌面应用是运行在台式机或者笔记本电脑上的传统软件程序。这样你将会编写同一时间内只能在一台电脑上运行的代码。移动应用,也就是熟知的“ APP ”,运行在使用 IOS Android 或者其他操作系统上的移动设备上。网页应用是功能像应用的网页。 +桌面应用是运行在台式机或者笔记本电脑上的传统软件程序。这样你编写的代码在同一时间内只能在一台电脑上运行。移动应用,也就是我们所熟知的“ APP ”,运行在使用 IOS 、Android 或者其他操作系统的移动设备上。网页应用是功能像应用的网页。 -按网络的 客户-服务器 架构分,网页开发者经常被分为两类: +按互联网的 客户-服务器 架构分,网页开发者经常被分为两类: -* 前端开发,就是编写运行在浏览器自身的代码。这是个面对用户的部分,或者说是程序的前端。有时候被称为客户端编程,因为浏览器是网络的客户-服务器架构的半壁江山。浏览器运行在你本地的电脑或者设备上。 +* 前端开发,就是编写运行在浏览器自身的代码。这是个面对用户的部分,或者说是程序的前端。有时候被称为客户端编程,因为浏览器是互联网的客户-服务器架构的半壁江山。浏览器会运行在你本地的电脑或者设备上。 -* 后台开发,也就是大家所熟知的服务器端开发,编写的代码运行在你不能实际接触的服务器电脑上。 +* 后台开发,也就是大家所熟知的服务器端开发,编写的代码运行在你无法实际接触的服务器上。 ### 创造什么 @@ -38,7 +37,7 @@ _在这篇文章里,我会交换着使用“编程”(code , program)、 ### Python -[Python][2] 是对于第一次编程的人来说是最为流行的编程语言之一,而且这不是巧合。Python 是一门通用的编程语言。这意味着它能应用在广泛的编程任务上。你能用 Python 完成几乎_所有_事情。这一点使得很多新手能实际应用这门编程语言。另外, Python 有两个重要的设计特征,使得其对于新手更友好:清晰、类似于英语的[语法][3]和强调代码的[可读性][4]。 +[Python][2] 是对于第一次编程的人来说是最为流行的编程语言之一,而且这不是巧合。Python 是一门通用的编程语言。这意味着它能应用在广泛的编程任务上。你能用 Python 完成几乎_所有_事情。这一点使得很多新手能在实际中应用这门编程语言。另外, Python 有两个重要的设计特征,使得其对于新手更友好:清晰、类似于英语的[语法][3]和强调代码的[可读性][4]。 从本质上讲,一门编程语言的语法就是你所输入的能让这编程语言生效的内容。这包括单词,特殊字符(例如“ ; ”、“ $ ”、“ % ” 或者 “ {} ”),空格或者以上任意的组合。Python 尽可能地使用英语,不像其他编程语言那样经常使用标点符号或者特殊的字符。所以,Python 阅读起来更自然、更像是人类语言。这一点帮助新的编程人员聚焦于解决问题,而且他们能花费更少的时间挣扎在语言自身的特性上。 @@ -75,11 +74,11 @@ def fun(x): big_fun(x) ``` -在这里,只有一个选择。如果代码不是这样排列的,它将不能工作。如果你编写了可以工作的代码,你就有了可阅读的代码。同样也留意一下在语法上的差异。不同的是“ def ” ,在 Python 代码中这个词是英语单词,大家都很熟悉这单词的含义(译者注:def 是 definition 的缩写,定义的意思)。在 C 语言的例子中 “ void ” 和 “ int ” 就没有那么直接。 +在这里,只有一个选择。如果代码不是这样排列的,它将无法工作。如果你编写了可以工作的代码,你就有了可阅读的代码。同样也留意一下两者在语法上的差异。不同的是“ def ” ,在 Python 代码中这个词是英语单词,大家都很熟悉这单词的含义(译者注:def 是 definition 的缩写,定义的意思)。在 C 语言的例子中 “ void ” 和 “ int ” 就没有那么直接。 Python 也有个优秀的生态系统。这有两层意思,第一,你有一个使用该语言的庞大、活跃的社区,当你需要帮助指导的时候,你能向他们求助。第二,它有大量早已存在的库,库是指完成特定功能的代码集合。从高级数学运算、图形到计算机视觉,甚至是你能想象到的任何事情。 -Python 成为你第一门编程语言有两个缺点。第一是它有时候安装起来很复杂,特别是在运行着 Windows 的电脑上。(如果你有一台 Mac 或者 Linux 的电脑,Python 已经安装好了。)虽然这问题不是不能克服,而且情况总在改善,但是这对于一些人来说还是个阻碍。第二个缺点是,对于那些明确想要建设网站的人来讲,虽然有很多用 Python 写的项目(例如 [Django][6] 和[Flask][7] ),但是编写运行在浏览器上的 Python 代码却没有多少选择。它主要是后台或者服务器端语言。 +Python 作为你第一门编程语言有两个缺点。第一是它有时候安装起来很复杂,特别是在运行着 Windows 的电脑上。(如果你有一台 Mac 或者 Linux 的电脑,Python 默认已经安装好了。)虽然这问题不是不能克服,而且情况总在改善,但是这对于一些人来说还是个阻碍。第二个缺点是,对于那些明确想要建设网站的人来讲,虽然有很多用 Python 写的项目(例如 [Django][6] 和[Flask][7] ),但是编写运行在浏览器上的 Python 代码却没有多少选择。它主要是后台或者服务器端语言。 ### JavaScript @@ -111,7 +110,7 @@ via: https://opensource.com/article/17/1/choosing-your-first-programming-languag 作者:[Kojo Idrissa][a] 译者:[ypingcn](https://github.com/ypingcn) -校对:[校对者ID](https://github.com/校对者ID) +校对:[bestony](https://github.com/bestony) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20170111 The difference between development and deployment.md b/translated/talk/20170111 The difference between development and deployment.md index ed5d55ca33..fe68b606f0 100644 --- a/translated/talk/20170111 The difference between development and deployment.md +++ b/translated/talk/20170111 The difference between development and deployment.md @@ -1,19 +1,18 @@ 开发和部署的不同 ============================================================ - ![The difference between development and deployment](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUS_OpenSourceExperience_520x292_cm.png?itok=APna2N9Y "The difference between development and deployment") -图片提供 :  +![The difference between development and deployment](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUS_OpenSourceExperience_520x292_cm.png?itok=APna2N9Y "The difference between development and deployment") -opensource.com +图片提供 : opensource.com -多年来,我是一名 Smalltalk 程序员,这种经验给让我在观察编程世界时有不同的想法。例如,源代码应该存储在文本文件中的想法需要一些习惯。 +多年前,我是一名 Smalltalk 程序员,这种经验给让我在观察编程世界时有不同的想法。例如,花时间来适应源代码应该存储在文本文件中的想法。 -我们作为程序员通常区分“开发”和“部署”,特别是我们在一个地方开发使用的工具不同于我们之后部署软件时的地点和工具。在Smalltalk世界里,没有这样的区别。 +我们作为程序员通常区分“开发”和“部署”,特别是我们在一个地方开发使用的工具不同于我们之后部署软件时的地点和工具。在 Smalltalk 世界里,没有这样的区别。 -Smalltalk 构建于虚拟机包含了你的开发环境(IDE、调试器、文本编辑器、版本控制等)的想法上,如果你必须修改任何代码,你将修改内存中运行副本。如果你想快照运行中的机器,你可以这样做,如果你想分发你的代码,你可以发送一个运行的机器镜像(包括IDE、调试器、文本编辑器、版本控制等)的副本到用户。这就是 90 年代软件开发的工作原理(对我们中的一些人来说)。 +Smalltalk 构建在包含了你的开发环境(IDE、调试器、文本编辑器、版本控制等)的虚拟机的想法之上,如果你不得不修改任何一处代码,你要修改内存中运行副本。如果你可以为运行中的机器打个快照,如果你想做的话,如果你想分发你的代码,你可以发送一个运行中的机器的镜像(包括IDE、调试器、文本编辑器、版本控制等)的副本到用户。这就是 90 年代软件开发的工作原理(对我们中的一些人来说)。 -如今部署环境与开发环境有了很大的不同。对于初学者,你不希望那里有任何开发工具。一旦部署,就没有版本控制、没有调试、没有开发环境。有记录和监视,这些在我们的开发环境中没有,并且有一个“构建管道”,它将我们的软件从我们开发形式转换为部署形式。例如,Docker 容器试图重新抓住 1990 年代 Smalltalk 程序员部署经验的一些简单性,而不希望对开发体验做同样的事情。 +如今部署环境与开发环境有了很大的不同。对于初学者,你不要期望那里有任何开发工具。一旦部署,就没有版本控制、没有调试、没有开发环境。有的是记录和监视,这些在我们的开发环境中没有,并且有一个“构建管道”,它将我们的软件从我们开发形式转换为部署形式。例如,Docker 容器试图重新抓住 1990 年代 Smalltalk 程序员部署经验的一些简单性,而不希望对开发体验做同样的事情。 -我想如果 Smalltalk 世界是我唯一的编程隐喻体验,无法区分开发和部署环境,我可能作为侥幸回顾一下它。但在我是一名 Smalltalk 程序员之前,我是一位 APL 程序员,这也是一个可以修改虚拟机镜像的世界,其中开发和部署是无法区分的。因此,我相信,当前的世界,人们编辑单独的源代码文件,然后运行构建管道以e创建在编辑代码时不存在的部署工作,然后将这些作品部署到用户。我们已经以某种方式将这种反模式软件开发制度化,并且不断发展的软件环境的需求正在迫使我们找到回到 20 世纪 90 年代更有效的技术的方法。因此会有 Docker 的成功。因此,我需要提出建议。 +我想如果 Smalltalk 世界是我唯一的编程隐喻体验,无法区分开发和部署环境,我可能偶尔回顾一下它。但在我是一名 Smalltalk 程序员之前,我是一位 APL 程序员,这也是一个可以修改虚拟机镜像的世界,其中开发和部署是无法区分的。因此,我相信,在当前的世界,人们编辑单独的源代码文件,然后运行构建管道以创建在编辑代码时不存在的部署工作,然后将这些作品部署到用户。我们已经以某种方式将这种反模式软件开发制度化,并且不断发展的软件环境的需求正在迫使我们找到回到 20 世纪 90 年代更有效的技术的方法。因此会有 Docker 的成功。因此,我需要提出建议。 我有两个建议:我们在运行时系统中实现(和使用)版本控制,我们通过更改运行系统来开发软件,而不是用新的运行系统替换它们。这两个想法是相关的。为了安全地更改正在运行的系统,我们需要一些版本控制功能来支持“撤消”功能。也许公平地说,我只提出一个建议。让我举例来说明。 @@ -29,9 +28,9 @@ Smalltalk 构建于虚拟机包含了你的开发环境(IDE、调试器、文 一种可能性是,诸如版本控制系统的工具不被设计为在生产环境中使用。例如,给某人许可推送到测试分支而不是生产分支是不可能的。对这个方案最常见的反对是,如果发现了一个漏洞,你会想要将某些提交标记为不可访问。这将是另一种更细粒度的权限的情况;开发人员将具有对所有提交的读取权限,但外部用户不会。我们可能需要对现有工具进行一些额外的工作以支持这种模式,但是这些功能很容易理解,并已被设计到其他软件中。例如,Linux (或 PostgreSQL)实现了对不同用户的细粒度权限的想法。 -随着云环境变得越来越普及,这些想法变得更加相关:云总是在运行。例如,我们可以看到,AWS 中等价的 “文件系统”(S3)实现了版本控制,所以你可能有一个不同的想法,使用一台 web 服务器提供来自 S3 的资产,并使用会话信息选择不同版本的资产。重要的想法并不是实现是最好的,而是支持运行时版本控制的愿望。 +随着云环境变得越来越普及,这些想法变得更加相关:云总是在运行。例如,我们可以看到,AWS 中等价的 “文件系统”(S3)实现了版本控制,所以你可能有一个不同的想法,使用一台 web 服务器提供来自 S3 的资产,并使用会话信息选择不同版本的资产。重要的想法并不是实现是最好的,而是支持运行时版本控制的愿景。 -部署的软件环境应该是“版本感知”的原则扩展到除了服务静态资产的web服务器之外的其他工具。在将来的文章中,我将介绍版本库,数据库和应用程序服务器的方法。 +部署的软件环境应该是“版本感知”的原则,扩展到除了服务静态资产的web服务器之外的其他工具。在将来的文章中,我将介绍版本库,数据库和应用程序服务器的方法。 _在 linux.conf.au 中了解更多 Robert Lefkowitz 2017 年 ([#lca2017][1])在 Hobart:[保持 Linux 伟大][2]的主题。_ @@ -49,7 +48,7 @@ via: https://opensource.com/article/17/1/difference-between-development-deployme 作者:[Robert M. Lefkowitz][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Bestony](https://github.com/Bestony) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20170116 Terrible Ideas in Git.md b/translated/talk/20170116 Terrible Ideas in Git.md deleted file mode 100644 index f3af553b9e..0000000000 --- a/translated/talk/20170116 Terrible Ideas in Git.md +++ /dev/null @@ -1,39 +0,0 @@ -Git 中糟糕的想法 -============================================================ - - - ![Corey Quinn](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/corey-quinn-lcna.png?itok=IU3oGzfn "Corey Quinn") -在 LinuxCon 北美会议上 FutureAdvisor 的 Corey Quinn 说:“Git 的确让你可以做一些额外的强大的事。在这次谈论中,强大是愚蠢的委婉说法” [Linux 基金会][2] - -在 LinuxCon 北美会议上 FutureAdvisor 的 Corey Quinn 说:“Git 的确让你可以做一些额外的强大的事。在这次谈论中,强大是愚蠢的委婉说法”。在使用 Git 时,谁没有至少经历一个时刻让你感觉像个傻子?当然,Git 是很棒的,每个人都在使用它,你可以用几个基本命令完成你的大部分工作。但它也有强大的力量,让我们觉得我们不知道我们在做什么。 - -但这真的对我们自己不公平。没有人知道一切,每个人知道的都不同。Quinn 提醒我们:“在我许多谈话的 QA 时,人们有时举手说:“嗯,我有一个傻问题。” 你看到人们在那里说:“是啊!这是一个非常愚蠢的问题”。但是当他们得到答案时,这些人正在大量记笔记。 - -![Git](https://www.linux.com/sites/lcom/files/styles/floated_images/public/heffalump-git-corey-quinn_0.png?itok=xh5JlnLW "Git") - -[有权限使用][1] - -Quinn 开始了一些有趣的演示,你可以用 Git 做一些可怕的事情,例如 rebase master 然后进行强制推送搞乱整个项目、输入错误命令并收到 git 提示、提交大型二进制文件等。然后他演示了如何使这些可怕的事情不怎么可怕,如更加明智地管理大型二进制文件。“你可以提交大的二进制文件,你可以在 Git 中提交大文件,如果你需要存储大的二进制文件,这里有两个工具会真的加快加载,一个是 git-annex,这是由 Debian 开发人员 Joey Hess 开发的,而 git-lfs 是由 GitHub 支持的。 - -你有连续输入错误么?例如,当你想要 “git status” 时却输入 “git stitis”?Quinn 有一个方案:“Git 确实对别名有内置支持,所以你可以使用相对较长、复杂的东西,并把它命名为一个短的 Git 命令。” 你还可以使用 shell 别名。 - -Quinn 说:“我们都听说过 rebase master 然后强制推送,这样一个给你所有同事的搞笑恶作剧,它会改变历史,所以突然之前发生的事情并不是人们真正在做的事,而且其他人都被卷入了这个过程。。一群鲸鱼被称为“pod”,一群乌鸦中被称为“谋杀”,一群开发者被称为“合并冲突”。。。更严重的是,如果有人这样做,你有几个选择。包括从备份中恢复 master,还原提交,或者把责任人从屋顶扔下去。或者,采取一定的预防措施并使用一个并不知名的 Git 功能称为分支保护。启用分支保护后,无法删除或强制推送分支,并且在接受前,请求必须至少有一个审核。” - -Quinn 演示了几个更奇妙的有用工具,使 Git 更高效和万无一失,如 mr、vcsh和定制的 shell 提示。你可以在下面看到完整的视频,并享受更多的傻笑话。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/news/event/LinuxCon-Europe/2016/terrible-ideas-git-0 - -作者:[CARLA SCHRODER][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/cschroder -[1]:https://www.linux.com/licenses/category/used-permission -[2]:https://www.linux.com/licenses/category/linux-foundation -[3]:https://www.linux.com/files/images/heffalump-git-corey-quinnpng-0 -[4]:https://www.linux.com/files/images/corey-quinn-lcnapng -[5]:http://events.linuxfoundation.org/events/linuxcon-north-america diff --git a/translated/talk/20170116 Why every business should consider an open source point of sale system.md b/translated/talk/20170116 Why every business should consider an open source point of sale system.md index e2a37f2366..7a357060f0 100644 --- a/translated/talk/20170116 Why every business should consider an open source point of sale system.md +++ b/translated/talk/20170116 Why every business should consider an open source point of sale system.md @@ -9,7 +9,7 @@ opensource.com 销售点终端 (POS) 系统是从很久以前的简单的收银机发展而来的。如今的 POS 系统可以提供一体化解决方案,包括支付流程,库存管理,营销工具等等。零售店也可以使用移动设备来接收现金流和各种成本支出相关的日报表。 -POS 系统是每家企业重要的生命线,那就意味着你在选择 POS 系统的过程中要非常谨慎。目前可供选择的收银系统也很多,但是如果你想节约成本,适应不断变化的业务需求,跟上技术发展的脚步,你应该很明智地考虑使用开源系统。你可以随意使用一款开源 POS 系统公开的源代码,这比那些严格保密源代码的专有系统要有更大的优势。 +POS 系统是每家企业重要的生命线,那就意味着你在选择 POS 系统的过程中要非常谨慎。目前可供选择的收银系统也很多,但是如果你想节约成本,适应不断变化的业务需求,跟上技术发展的脚步,你应该很明智地考虑使用开源系统。你可以随意使用一款源代码公开的开源 POS 系统,这比那些严格保密源代码的专有系统要有更大的优势。 使用开源的 POS 系统,你可以获得它的一些非常重要的特性。 @@ -54,7 +54,7 @@ POS 系统是每家企业重要的生命线,那就意味着你在选择 POS 作者简介: -![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/preston-pilgrim-2016_0.jpg?itok=7fzNsTww) +![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/img_1217_1.jpg) 我是 AcroMedia 公司数字化市场营销项目经理。我们主要使用 Drupal 开源系统来为客户提供定制化商业解决方案。 @@ -64,7 +64,7 @@ via: https://opensource.com/article/17/1/open-source-point-sale-system 作者:[Preston Pilgrim][a] 译者:[rusking](https://github.com/rusking) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Bestony](https://github.com/Bestony) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20170117 Arch Linux on a Lenovo Yoga 900.md b/translated/talk/20170117 Arch Linux on a Lenovo Yoga 900.md new file mode 100644 index 0000000000..693a16e7a5 --- /dev/null +++ b/translated/talk/20170117 Arch Linux on a Lenovo Yoga 900.md @@ -0,0 +1,311 @@ +# Arch Linux on a Lenovo Yoga 900 +联想 Yoga 900 笔记本安装 Arch Linux 系统后的感悟 + +_注意:这篇文章比较长,有将近 5500 多个单词,而且还有很多非常有意思的链接,因此,你最好还是先给自己准备点喝的吧,然后再花时间来阅读。_ + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-1.jpg) +在 [联想 Yoga 2 笔记本电脑][2] 上使用了 3 年多的 Arch Linux 系统后,我决定换个新的 Yoga 900 笔记本电脑来安装 Arch Linux 系统: + +_联想 Yoga 900 笔记本电脑在[亚马逊网站上的特价][1] 为 925 美元 —— 8GB 内存, 256 GB 固态硬盘, 3200×1800 的分辨率,处理器为 Skylake 3.2GHz , Iris Graphics 显卡。_ + +同等配置的戴尔笔记本电脑 [XPS 13][3] 搭载新一代 Inter 处理器,售价 1650 美元。 Yoga 910 为当前最新款,价格为 1300 美元。但是,我压根就不会考虑这一款,因为它的键盘设计得太狗屎了。很多评论都从其外观颜色及材质方面大作文章,但是我偏偏从它的键盘设计上来挑刺。 + +### 键盘 + + +Yoga 2 Pro 和 Yoga 900 这两款笔记本电脑从外观上看没啥区别。它的键盘设计跟曾经光鲜亮丽的 IBM Thinkpad 的键盘比起来可真是差远了,但是这还不算是最狗屎的键盘,好歹我还用了三年多的 Yoga 2 ,而且早已经习惯了。不幸的是,新款 Yoga 910 的键盘设计更是糟糕透了。 + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-2.png) +_Yoga 2 和 Yoga 900 的键盘布局_ + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-3.png) +_Yoga 910 的键盘_ + +Yoga 910 键盘的问题是它的 右-shift 按键位置不合理,你不挪动手根本就按不到那个键。这个键的位置非常特殊,可以说是跟我上 9 年级打字课时所用的 IBM 打字机键盘到目前为止用过的所有键盘都不一样。我更愿意看到这个失误出现在华硕或是戴尔公司的电脑上,而不是来自于曾经让一代代美国人学习和工作并且创造了打印机传奇历史的 IBM 公司。 + +Yoga 团队每一年都会更改键盘布局。想象一下,如果 IBM 公司在 20 世纪的时候也不断改变他们的打印机键盘布局,而且还吹嘘这是为了提高"[工作效率]"[4]。那么这个公司可能早就倒闭了! + +我基本上还能习惯 Yoga 910 的向上/向下翻页键跟方向键整合到一起,其它的一些改变也无大碍,但是 shift 键就是设计上的一个败笔,我太讨厌因为某些东西而改变自己的使用习惯了。 + +其实,联想笔记本电脑在键盘的设计上还有很多地方需要改进,比如说,让音量增加键与应用程序关闭键不要靠得太近。尽管目前已经有一个降低亮度的开关了,他们也可以重新考虑设计一个更简单的方式来快速关闭显示器。他们还应该设计一个重叠式的数字小键盘。难道联想的工程师觉得只有在商务工作中才会使用到数字小键盘吗? + +Yoga 910 的键盘布局改变得太多了,也许再也回不到曾经的老式键盘了。我希望 Yoga 的键盘不要再随便改了。我更愿意拥有一个比电脑更高效 10 倍的键盘。 + +我在联想官网的评论中看到有些用户由于对 Yoga 910 的键使用不习惯的原因而申请退货。我觉得联想公司应该制定这样一条规定:如果革个工程师想更改键盘布局,他们必须给出一个***非常充分***的理由,如果这种设计给用户在使用方面造成了巨大的不便,那么将以剁其一根手指的代价来让他也体会下这种痛苦。如果真有这样一条规则,那么将会大大减少那些毫无意义的更改键盘的行为。 Yoga 910 笔记本电脑可以说是联想公司呕心沥血之杰作了,但是其输入系统却是一大败笔。 + +### 总体评价 + +Yoga 2 对于我的任何操作,其反应速度都非常快。它的固态硬盘也非常给力,但是用在 Arch Linux 系统下就有些大材小用了。那些只使用 Windows 系统的用户就不会体会到他们的系统有多么的庞大臃肿: + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-4.png) + +在 90 年代时期,由于处理器的性能每隔 18 个月翻一倍,并且软件的大小也经常成倍的增长,因此,一款新的电脑每隔几年就会发布出来。现在早已发生了翻天覆地的变化。新款的 Yoga 900 笔记本电脑在运行性能测试的过程中,速度比我的 Yoga 2 还要快 30% 。 Yoga 900 的 CPU 主频为 3.2 GHz ,老款的 Yoga 2 主频为 2.6 GHz ,因此, Yoga 900 最大的亮点是更快的 CPU 处理频率。 + +Haswell 处理器架构于 2013 年发布了,而 Skylake 处理器架构在 2015 年才发布,因此,经过两年的发展,处理器性能有了很大的改善。新一代的处理器最大的改进是采用 14 纳米工艺制造技术来代替原先的 22 纳米工艺技术,这意味着新款笔记本电脑散热更小,电池使用时间更长。我的老款的 Yoga 2 笔记本在中等亮度的情况下,电池使用时长只有 3 个半小时左右,但是新款 Yoga 900 的电池使用时长高达 7 小时。 + +Yoga 2 的转轴已经开始松动和裂开了,我也没有一个好的办法来拧紧,只能从网上找新的配件来更换或者发给联想售后进行维修了。 + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-5.png) + +Yoga 的转轴用于将笔记本电脑放平,甚至是将电脑合起来作为平板电脑使用,但是我觉得这样用起来很笨重,所以也就不想去自找麻烦。这么多年来,只要它在日常工作中能够正常打开和合拢,我就已经很高兴了。 + +Yoga 900 坚固的表链式铰链应该更耐用: + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-6-1.jpg) + +有一个很明显的小毛病就是如果你摇晃笔记本电脑时,其格格作响的声音会让你误以为是内部的零部件损坏了,你自然会担心电子器件短路的危险!然而,这只不过是 800 多片钢片构成的仿表带铰链发出的声音。 + +Yoga 2 总的来说是一款设计精良的产品,但是如果我将显示器展平,然后单手拖住的时候,它会有一点向下弯曲,而且有时候键盘背光灯也会熄灭。两款 Yoga 笔记本电脑都很轻薄,但是 Yoga 900 看起来更坚固耐用一些。 + +### 触摸板 + +Yoga 2 最严重的问题出现在触摸板上。这不是硬件导致的,而是驱动程序自身的问题,由于触摸板驱动程序本身没人在维护,因此存在很多缺陷。很遗憾, Synaptics 公司本来可以很轻易地安排一个工程师来维护这几千行的代码,但是联想重新写了另外一个版本的与系统内核集成在一起的驱动程序,而且还没有公开发布出来。 + +然而,为了让触摸板设备和其它输入设备的管理和使用更加方便简捷,一个叫做 [Libinput][5] 的新软件库被建立起来。 Libinput 最好的一点就是,维护人员会修复各种缺陷。还有一个很适用的功能就是如果你左指尖触摸鼠标单击区域,它现在会通过你的右指尖记录指针移动轨迹。但是,让人难以接受的事情是, Synaptics 的这个基本的功能在 Linux 系统中很多年前就无法使用了。 + +触摸板设备一直运行正常,但是它不再像以前那样发出敲击声了。实际上这也不是什么问题,但是这会让我担心我在触摸板上的操作是否正确。老款的 Thinkpad 笔记本电脑有好几个左右按键,因此,如果其中一个损坏了,你可以使用另外一个,但是 Yoga 笔记本只有一个鼠标左右按键,如果损坏了就只能插入鼠标来代替使用了。(联想还巴不得你的电脑赶紧坏了好换新的。) + +### 内核支持 + +当年我购买 Haswell 处理器的笔记本电脑时,硬件都是最新的,因此,我折腾了好几个月才把 Linux 驱动程序相关的问题解决了。而现在我使用的新一代的 Skylake 处理器的笔记本电脑,在[处理器发布 8 个多月后][6],其内核崩溃的问题才被修复了。以前老款笔记本电脑的 [电源管理][7] 一直运行不正常,但是从新款笔记本电脑使用来看,以前的问题大都不存在了,而且有了很大的改善。如果用户不进行任何操作,这个笔记本电脑会自动进入到低功耗 C6-C10 状态。(这个功能是由 Linux 系统中的  **powertop 省电工具** 进行控制的。) + +电源管理这个功能非常重要,它不仅会影响到电池的使用寿命,而且由于[电解迁移][8]的原因,那些非常小的电路板会逐渐耗尽。英特尔公司甚至发出公告:”电池使用的长期可靠性是无法保障的,除非所有程序都运行在低功耗的空闲状态。“通过让程序运行在低功耗模式下,以使用更小的电源回路,从而让电池使用寿命更长。 + +现在 Haswell 处理器架构对 Linux 系统的支持性已经非常好了,但是之前的很长一段时间,它的支持性都很差。刚开始那一年,我提出了很多 Haswell 处理器相关的问题,但是现在可以看出这两款处理器在对 Linux 系统的支持上都有了很大的改善。 + +### 联想笔记本的 BIOS 不兼容 Linux 系统 + +在 Yoga 900 电脑上安装 Arch Linux 系统之前,我得在 Windows 系统中再格式化出一个新的 BIOS 分区来。实际上,我的电脑中得有 2 个 BIOS 系统。最新版本的 Yoga 900 BIOS [不包括][9]我需要的必备修补程序,犹豫了一会之后,我恍然大悟,然后我 [安装][10]了一个单独的 "仅 Linux 系统" 的 BIOS 更新,这样我的联想电脑就不再支持 Windows 系统了:"你不可怜下我吗?“ + +那些经常关注 Linux 系统的用户就很清楚, Yoga 900 和其它最新款的联想笔记本电脑无法安装 Linux 系统,因为它不会[检测硬件驱动程序][12]。联想回复其笔记本电脑已不再支持 Linux 系统了,因为它使用的是[新型的 RAID 控制器模式][13] 。然而,实现 RAID 机制就意味着需要更多的磁盘,而笔记本电脑只有一个硬盘,并且也没有多余的空间来安装另外一块磁盘了。 + +下面是联想给出的[官方解释][14]: + +>“为了更好地支持 Yoga 系列产品以及整个行业领先的 360 度铰链转轴设计技术的发展,我们采用了一种存储控制器模式,很遗憾,这种模式不支持 Linux 系统,也不允许安装 Linux 系统。” + +我觉得很搞笑,为了转轴而采用特殊的存储控制器!这就好比一个汽车制造公司宣称由于新型的广播设备,他们必须改变汽车的轮胎一样。 + +这引发了巨大的争议,感谢 Reddit 网站的 [Baron][15][H][16][K][17] 的努力,他为媒体提供了大量的信息,并联系了伊利诺斯州检查院。搜索 "[联想 Yoga][18][L][19][inux 兼容性][20]" 出现 300,000 条结果。联想或许会因为销售不允许用户安装自己的操作系统的”通用“ PC 而触犯法律。对于我来说,为电脑设置默认的操作系统是毫无意义的。 + +黑客也被卷入到这场”战争“中进来,他们最终发现通过设置 UEFI ,这款笔记本也能够支持 AHCI 控制器模式,只是默认被禁用了。简单来说,联想故意取消对 Linux 系统的支持没啥好处。因为大家都已经明白事实真相了,如果这件事闹到法庭上,联想也只能自取其辱。 + +幸运的是,这些新闻引起了他们的关注,并且他们也逐渐地更新了 BIOS 。这篇文章就是在运行着 Linux 系统的 Yoga 900 笔记本电脑上写的,因此,我们应该庆祝下这个伟大的胜利。大家都希望联想从中受到教训,但是我并不看好。他们本来就应该为你的电脑提供一个选择操作系统的机会。他们应该在用户之前就发现了这个缺陷了。我将等待一个周左右的时间才能拿到定制化的电脑。他们应该把分区设置好,并且让用户定制很多东西,安装最新版的软件,而不是使用一个需要很多更新的老镜像文件。 + +一些钟爱联想电脑的用户认为这是 Linux 系统自己的问题,是 Linux 系统本身就不支持最新的 RAID 驱动模式导致的问题。然而, AHCI 控制器模式本来是一个非常流行的标准,但是由于英特尔公司为这种硬件写的代码"[太糟糕][21]"而被 Linux 系统内核开发团队拒绝了。该团队要求英特尔公司提供这种硬件的详细设计说明,但是他们一直没有给出任何答复。 + +### 散热 + +当 CPU 占用很高时, Yoga 2 笔记本会变得很烫。有一次我把笔记本放到毯子上编译 LibreOffice 软件时就把底部的塑料壳烧焦了,这实在是太丑陋了,这让我看上去像是一个很穷酸的程序员。我试着用铁刷子和松脂油来擦除烧售的部分,但是也没什么鸟用。 + + ![](http://keithcu.com/wordpress/wp-content/uploads/2015/04/20150327_135649-2.jpg) + +新款的笔记本电脑使用金属外壳,不容易褪色,并且 Skylake 处理器架构比 Haswell 的要强劲得多。把散热口设计了跟转轴融合在一起,这是一个非常明智及巧妙的做法,如果散热口在其它位置则可能被堵塞住。 + +用了很多年的 Yoga 2 ,我觉得最烦人的一件事就是它的风扇里累积了厚厚的尘埃,运行时听上去就像是沙子摩擦的声音!这些尘埃分布得很广,使用时产生的声音也大,让人容易分心。我把笔记本电脑拆开来清除里面的尘埃,但是风扇的叶片是隐藏的,无法进行清除。我只能把整个风扇替换掉了。在 Yoga2 上完成简单的工作,比如文字处理和浏览器上网时,风扇不会旋转,但是当它旋转时,如果不带耳机会感到很烦人。 + +Yoga 900 的风扇叶片密度很高,而且运行的很平稳,也不会让人分心。 Yoga 900 的风扇好像一直都在旋转,但是速度非常慢,而且声音很小也很安静。我家里电冰箱和空气净化器的声音都要比它大得多,除了笔记本电脑在负载的情况下声音有点大,不过那也不影响我工作。 + +### 显示器 + +Yoga 2 的显示屏很大气,但是也同样存在大家所熟知的问题,比如屏幕上的黄色看上去更像是橙色。然而,整体画质看起来还算细腻,其它颜色方面也不错。 Yoga 900 的屏幕已经修复了那个黄颜色的问题。它不是一个真正的 4K 屏,实际上仅有 3200×1800 的分辨率,但是从 15.6 寸的显示屏上看,它的像素要比真正的 4K 屏要细腻得多,所以显示效果超级锐利。 + +当年我购买 Yoga 2 笔记本电脑时,由于其使用的是当时最新的 Haswell 处理器架构,所以我遇到很多英特尔显卡显示异常的问题,这些问题过了几个月后才被解决。之后,我还发现了一个会导致 Linux 系统崩溃的内存泄漏问题,并且这个缺陷好多年都没被处理。 + +我在 VLC 播放器中使用( shift + 箭头键)快进视频时,遇到了好几次内存耗尽的问题。系统也没显示 VLC 播放器占用了多少的内存,但是电脑内存却耗尽了。很明显这是内核导致的内存泄漏问题。我创建了一个 swap 文件作为虚拟内存使用,以减少内存耗尽的时间,但是有好几次我没注意时,这个文件又被占满了。几年后,这个问题逐渐消失了,而且现在 Linux 系统也运行得很稳定。 + +大家都认为英特尔公司为 Linux 系统开发的驱动程序是最好的,但是他们更像是微软内部的一个实验项目。英特尔 公司的驱动程序开发人员都很专业,只是 Linux 系统的驱动开发人员都不够多。在发布硬件之前,他们都竭力让驱动程序做得更完美。 英特尔公司生产的 [1][22][13][23] [这些处理器][24] 都是基于 Skylake 处理器架构的,只是在特性上有细微的区别。听起来你会觉得有很多类型的处理器,但是在 [Haswell 处理器][25] 时期,英特尔公司生产出高度集成的 256 核芯片处理器。10 年前我听一个 Inter 公司的员工说过,相对于 Windows 来说,他们仅投入了 1% 到 Linux 系统上,从现在的情形来看,确实是那样的。 + +在我使用 Yoga 2 的过程中唯一遇到的性能问题是无法正常播放 4K 视频。屏幕经常出现卡顿,或是出现每秒跳跃 5 帧的现象: + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/VlcGlitch.jpg) + +Yoga 2 甚至是在播放 1920×1080 分辨率的视频时有时候也显得很吃力,看样子它最多只能以 60fps 的速度来播放视频。出现这样的情况也可能是因为我一直在运行着其它的应用程序,比如 Firefox 浏览器和 LibreOffice 办公软件。 + +Skylake 处理器主要用于在 60 fps 的速度下使用 H.264 、 VP9 以及其它解码方式来播放 4K 视频。实际上这款处理器中有很多硬件专门用于加速[多媒体][26][特性][27]。我尝试使用 **ffmpeg 软件** 来处理 H264 格式的硬件编码,我发现即使只使用一个 CPU 的情况下,其处理速度也比原来的处理器快 4 倍。这种性能太棒了。不爽的是,在设置的过程中有点麻烦,因为你必须使用很多命令行参数: + +“**-threads 1 -vaapi_device /dev/dri/renderD128 -vcodec h264_vaapi -vf format=’nv12|vaapi,hwupload’**” + +我尝试找到一种方法让 **ffmpeg 软件** 保存这些命令,这样我就不用每次都手动输入这么多参数了,但是最后发现根本行不通。而且无论怎样,在整个过程中也不能自动传递这些参数。我还发现在使用这个硬件的的过程中不能重置视频大小,只能忽略或接受,因此,我很少会用这个工具。如果 **ffmpeg 软件** 可以实现这一点就完美了。由于很多用户都不了解,或者是不想太麻烦,所以还有很多未使用的硬件资源。这个软件有很多跟 Linux 系统和 Windows 系统相关的应用接口,如果要进行视频编码和解码,将会是[一件麻烦事][28]。 + +Skylake 处理器架构在播放 4K 视频方面表现得更出色,但是有时候它也会出现卡顿现象,然后瞬间降到 10 fps 的播放速度。我想起其中一部分卡顿现象就是在播放《X 战警》的过程中。我尝试在 Wayland 下播放 4K 视频时却很流畅,这让我非常满意。很高兴看到 OpenGL 给予的大力支持。在硬件方面, Inter 公司 2014 年以来支持的最新版本是 4.5 。 + +我的 Yoga 900 (-13ISK2) 笔记本电脑实际上是一个升级版,使用比 520 [更快][29] 的 Iris 540 图像协同处理器,而且它的流处理器多达 24 个。然而,它只能用来玩 SuperTuxKart 游戏,而且还得将游戏显示效果设置为中等,分辨率调整为 1600×900 ,速度为 20 fps ,我也不想在这里吹什么牛。说真的,这款游戏比前几年改善了很多,而且游戏界面也漂亮得多。 + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Screenshot-from-2017-01-10-17-03-57.png) + +英特尔公司在中国有一个从事[使能][30]的团队,专门支持 OpenCL 对显卡的使用。但是,我从未看到 Blender 的任何用户使用它,因此我怀疑这个团队是不是作摆设用的。英特尔公司已经很长时间都没有支持 OpenCL 了,那些使用 Blender 软件处理重要工作的用户早已换成 Nvidia 或者 AMD 显卡,即使英特尔公司后来重新写了代码,大家也没太多的兴趣做测试。 + +有一件事让我感到非常意外,我在另外一台机器上做光线追踪测试时发现,一个四核的处理器比使用循环引擎的 NVidia 960M 的处理器要快得多。很明显,在处理那个任务时, 640 CUDA 多核心处理器也比不上 4 个英特尔公司的 CPU 。更高级的英特尔处理器有 2000 多个核心,性能更强悍。 + +### HiDPI + +最近这几年, Linux 系统在高分辨率屏幕方面已经做得越来越好了,但是仍然有很长的路要走。还好目前的 Gnome 版本对 HiDPI 的支持也算完美。如果你把火狐浏览器的 **layout.css.devPixelsPerPx** 这个参数值设置为 2\ ,其显示效果更美观。然而这个 13.3 寸的屏幕分辨率还是显得略小了些,我还安装了一个无斜视加强版插件,这让屏幕在 120 度范围内看起来更方便。 + +很高兴地看到 LibreOffice 办公软件的界面在当前设置的屏幕下变得更加美观,因为我安装了 2014 年 4 月份发布的[一些补丁][31],而且这些功能还一直在不断的完善中。最大的问题是 LibreOffice 软件界面的工具图标重叠起来了。有很多主题都包括 SVG 图标,但是这些图标不会跟产品一起发布出来。跟 PNG 类型的图标相比, SVG 图标加载更慢,而且还要占用缓存。[Tomaž Vajngerl 在这方面投入很多的精力][32],但是还未发布出来。尽管这样, LibreOffice 比那些没有易识别图标的 Linux 系统应用程序要漂亮得多。 + +应用程序在高分辨率屏幕中的检测与应用方面正在不断的完善,但是还有其它一些很流行的小程序,比如 Gimp ,Audacity 和 Inkscape 仍然不能使用。我为 Gimp 软件安装了一个很强大的定制化主题,但是所有的图标都变得大不一样,尽管这些图标已经显示得够大了,但是也很难识别出来。 + +Linux 系统仅占了 1.5% 的市场份额,然而,遗憾的是其相关负责人也没有对这些问题给予更多的重视。虽然很多应用软件逐步使用 GTK 3 工具来开发它们的图形界面,但是 Audacity 这款音频处理软件好像是已经[终止][33]开发了。在第一次调查中我发现,那些提供长期支持的应用程序仍然有很多地方需要改进,但是 3 年多过去了,即使是那些很出名的软件也没做到位。 + +### SSD 固态硬盘 + +由于我平时对系统做了各种各样的优化,尤其是对火狐浏览器做的优化,因此我的老款电脑的硬盘仍然可以正常工作。还记得我的 **/tmp** 目录被我设置成自动作为 RAM 设备,因此,我经常把文件默认下载到那里。有时候我会在 /tmp 目录下把一个 500 MB 的视频剪辑成 20 MB 的小视频,或者是转换成另外的格式,因此我对硬盘的写操作做得比较频繁。这样做的工作量很大,也可能没必要,但是在 RAM 存储中运行速度更快。 + +在这三年里,我几乎对每个硬盘的存储单元做了 25 次写入,这意味着这块硬盘可以使用 350 年左右。极大部分的写操作都用于 Arch Linux 系统的更新。我每个月都会构建新的 LibreOffice 软件,每周都会更新“稳定”版系统内核。实时把系统升级到最新棒真的让人很爽,但是与 Debian 的稳定版系统相比起来,这将会进行 100 多次写入操作。然后,能够让每一个系统组件都升级到最新版,这也是值得的。 + +新的三星硬盘诊断工具也无法检测出每个硬盘存储单元的写次数。事实上,我也不能确定这个硬盘的存储单元类型是什么以及在处理任务的过程中写了多少次。我相信从“占用率“这个数据可以看到硬盘的使用时长,但是也许这只跟空闲的存储单元有关。我没有找到任何相关文档,因此我只能猜测到大致跟下面的数据差不多了: + +||| +|--|--| +| **型号:** | **SAMSUNG MZVLV256HCHP-000L2** | +| **固件版本(0x06):** | **3 Slots** | +| **可用空间:** | **100%** | +| **可用的空闲阈值:** | **10%** | +| **已用百分比:** | **0%** | +| ****存储单元写数据:**** | **198,997 [101 GB]** | +| **存储单元写数据:** | **305,302 [156 GB]** | +| **主机读命令:** | **3,480,816** | +| **主机写命令:** | **10,176,457** | +| **错误日志条目信息:** | **5** | + +### 损坏的左 Ctrl 键 + +在使用了几个小时之后,我发现一个问题,如果我按键盘左上角时,左 Ctrl 键会弹起来: + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/Yoga900-7-1.png) + +_损坏的 Yoga 900 按键:注意跟右侧对比下,你会发现左侧少了个小圆柱体形状的东西:_ + +Yoga 900 键盘布局跟 Yoga 2 Pro 版一致,但是内部结构不同。 Yoga 2 Pro 版的键盘不能单独移除和替换按键,而且你也没有办法撬起任何按键,除非那个按键被你彻底搞坏了。 Yoga 900 的按键跟老款的 Thinpad 笔记本一样的:每个按键都是分开的,你可以单独取下来进行更换。 + +然而,还有一个小毛病,每个键轴有 4 个小圆筒状的凹槽部件,如果不小心丢失了一个,那么该按键就只有三个接触点了,如果你不敲击到按键的中间位置,那么这个按键的键帽将会逐渐脱落下来。 + +我把这个问题反馈给联想。尽管这些按键还能使用,也可以替换成新的,但是他们只替换整个键盘,不会寄送任何零散部件。他们建议我把笔记本电脑寄给联想售后中心进行维修,或者是送到极客小组服务中心。我知道寄到联想售后的话至少要 2 周的时间,因此我咨询了当地的商店,看他们是否有 Yoga 笔记本的键盘配件。他们告诉我,他们不维修电脑,只负责把它寄到亚特兰大。那里曾经有很多地方可以维修 IBM 的各种笔记本电脑,而且也有各种配件,但是现在已经是不可能的了。 + +我用了好几个小时后才注意到了这个问题,我确信那是生产笔记本电脑过程中的疏忽导致的。这是一块非常小的塑料块,在装配的过程中就早已变形或损坏了。 + +尽管这个电脑还在保修期,可以免费进行维修,我可不想为这些小事情耽搁太多时间,因此我在网上找到一个叫做 laptopkey.com 的网站,然后订购了一个换键和转轴。真是太诡异了,竟然有三种类型的转轴!我花了好一会才搞明白我的电脑适合哪一种类型,因为这三种类型太难区分了: + + ![](http://keithcu.com/wordpress/wp-content/uploads/2017/01/BigHinges-2.jpg) + +因此我预定了这个配件,但是还得花费至少一个星期的时间才到收到。这真是太让我抓狂了,因为我每次使用复制粘贴、视频跳跃或者是在编辑器里按单词移动及其它相关操作时,只能使用右 Ctrl 键。我觉得我可以把右边的 Ctrl 键更换到左边来,但是我从未这么弄过。 + +因此,我尝试跟着网上找到的视频步骤把这个键弄下来:我先用指甲扣起左上角到一定高度。然后用同样的方式操作右上角,但是另外一个小塑料片被折断了,因此我弄坏了两个键轴。如果不损坏这些非常细小的塑料夹片,根本不可能把按键撬下来。这种类型的键盘只不是理论上可以进行更换吧。 + +因此,我决定采用笨办法,使用强力胶。我情愿让这个该死的按键就这样固定死了,我暂时没有一个紧急的方法来替换它们。这真是太折腾了,因为我只需要大概直径 1mm 的胶水:如果弄太多的胶水可能会让情况变得更糟糕。 + +我维修小型遥控飞机的经验在维修电脑上也非常有帮助,我修好它了,而且左边的 Ctrl 键也固定好了。右边的那个 Ctrl 键还处于分离状态,但是我几乎用不到。我的心情又好起来了,真是柳暗花明又一村啊,但是懂得如何维修电脑也是个非常重要的技能。 + +### Antergos 与 Arch Linux 系统对比 + +在我使用了 3 年多的 Arch Linux 系统之后,我再也没兴趣去尝试其它操作系统了。虽然英特尔公司更新驱动程序的步伐有些落后,但是无论怎样,在日常工作中使用 Arch Linux 系统还是挺让人愉快的,而且每一个星期都有所进步。实时更新任何程序真的让人很爽。我经常使用比 Ubuntu 系统发布时间还要新的软件包。虽然 Ubuntu 用户可以在自定义的 PPA 中找到更新的软件包,但是这种软件包都没有经过任何测试或修复,因此用户在使用过程中会遇到各种各样的问题。 + +也有用户抱怨 Ubuntu 系统升级时会导致机器自动重启或者强制用户重新安装软件,因此,即使安装的过程很快,之后却需要很长的时间来维护。我每次听到有人抱怨 Arch 系统的安装过程时,最终的原因还不是他们自己操作不当或是文件系统损坏的问题。 + +我曾经想尝试安装 [Antergos 系统][34],那是一款基于 Arch Linux 并搭载了桌面环境的 Linux 发行版。然而,安装过程中的设置界面在显示器上看不清楚,而且最小化安装后也识别不到触摸板,那是我仅有的 1 GB 存储空间了。因此,我决定还是重新安装原来的 Arch Linux 系统。还好 Yoga 笔记本仍然支持传统的 BIOS 启动方式,这样我就不用再去折腾 [UEFI][35] 了。 + +很遗憾我没能试用 Antergos 系统,因为我觉得对于那些技术水平一般的用户或是想快速入门 Arch Linux 系统的用户来说, Antergos 算是一个非常强大的 Linux 发行版了。 Arch 在维基上有丰富的文档新资料教你如何完美地使用这个 Linux 系统。我喜欢每周定时对固态硬盘做优化,包括调试[用户配置文件-同步-进程][36]脚本、对安卓系统的支持以及在视频播放中使用硬件加速等等。在 Linux 系统中有很多大家都需要去折腾的功能特性,只需要输入几行命令就可以搞定了。 + +Manjaro 也是一款非常流行的基于 Arch Linux 并搭载了桌面环境的 Linux 发行版,但是用了 3 年多的 Arch Linux 系统后,我更信任使用 Arch 系统中的软件包来解决组件之间的问题。我在 Reddit 网站看到一些评论,有用户反映说 Manjaro 系统升级后就崩溃了。 + +我对 Arch Linux 系统唯一不爽的一点就是它又难看又不可读的引导加载界面。还好我只需要使用老电脑中的 **grub.cfg** 配置文件来替换掉就可以了。 + +### 安装 Arch Linux 系统 + +起初我只想简单地把硬盘从老的笔记本电脑移植到新的笔记本电脑上,这样我就不用安装任何东西了,但是拆开电脑后,我发现 M.2 接口的固态硬盘形状很特殊。本来我也可以使用一个简单的块复制方法来完成移植,但是这一次是一个很好的回顾安装过程的机会,所以我决定从头再来一遍。 3 年多的时间里,我安装了很多没用的应用程序,即使有些被我卸载了,系统中还存在很多的遗留文件。 + +由于 Arch 900 笔记本电脑已经发布出来一段时间了,其硬件也不是最新的,所以安装 Arch Linux 系统的过程进行得很顺利。我还要使用 **rfkill 工具来开启无线上网** 功能,除此之外,系统都正常运行了。显然, Linux 系统下还不能正常使用 rfkill 工具。幸运的是在启动 rfkill 工具时, **systemd** 会自动恢复rfkill 的数据。 + +### Kernel Buglist内核故障列表 + +有一件事让我非常惊讶, Linux 操作系统的缺陷列表太混乱了。我知道有很多的用户参与其中,其变化频率也很高,但是,一成不变的最糟糕的事情却是系统缺陷报告。我搞不懂为什么有些系统缺陷已经存在好多年了,但是却丝毫没有修复的迹象。 + +我在上次的审查中打过一个很好的比方。假设航空公司花了一两年的时间才把你丢失的行李找回来了。还你会信任那家公司吗?实际上,如果你还有几千个已知的系统缺陷和上百次系统回归,那么你发布新的发行版有什么意义呢?如果波音公司的每一架飞机都有 1% 的坠机概率,那他们会这么多年都置之不理吗? + +也许 Linux 系统基金会应该雇佣一些专职的工程师来修复那些看似被遗忘的系统缺陷问题。有很多人从事 Linux 系统工作,大家都清楚该系统有很多历史缺陷未修复——通常情况下,这些问题都是普通用户自己处理的。我觉得目前的 Linux 系统就不要发布任何更新了,先花几个月的时间去修复那些系统缺陷,直到缺陷数量小于 50\ 个时,再发布新版本,这样的系统内核会更稳定。现在还有 4672 个系统缺陷问题未解决。这将会是一个非常好的改变发行版主版本号的理由。 + +有些东西跟每周发布一个新的稳定发行版是相悖的,但是这种方式还持续了这么多年了,而且他们每次都发布一些重要补丁,因此他们也算是做了一些非常有意义的工作。内核的开发速度很快,也变得越来越好,因此早已超出我吐槽的范围了,但是我还是觉得他们应该尝试一些新的东西。 + +至少,系统缺陷问题应该在规定的时间内处理。如果超出指定时间,这个系统缺陷应该提交给到维护工程师并逐渐发送给 Linux 本人。如果某个领域内存在很多的历史缺陷也没人去修复,那么 Linus 应该公开并严厉批评相关组织机构。他们更应该像波音公司那样去思考解决问题。 + +### Lenovo + +很多 Linux 用户都痛击联想公司对定制化的笔记本缺少支持,好在他们创造了性价比较高的硬件。正如我多年前写的一样,很明显,联想公司在发布 Yoga 2 之前就没人安装过 Linux 系统来进行测试, Yoga 900 笔记本也是如此,因为这是根本不可能的事情。 + +我觉得他们公司的每个员工都应该安装双系统。这在设置上并不难,用户也更希望他们这样做。联想有 60000 多员工。至少他们应该在公司内部成立一个 Yoga 团队,然后招一些人来着手处理 **Linux 系统** 问题。 +Windows 系统在很多方面比 Linux 系统更难用。Windows 系统虽然能够运行更多的应用程序,但是我觉得也许他们公司的大部分员工还是更乐于使用自定义的 Linux 系统吧。 + +尽管现在联想对 Linux 系统很不屑,他们制造的麻烦比软件方面还多。在很多型号的笔记本电脑中, RAM 芯片被焊接固定了。他们只允许白名单设备和预授权的插件安装到联想笔记本电脑中。 Yoga 笔记本也没有独立显卡,而且联想公司本来也不支持更新主板上的插件。我想有人会把这些矛头指向联想公司的 CEO 。 + +### 总结 + +Yoga 900 笔记本电脑的售价确实让人激动不已,而且相对于前一款 Yoga 2 来说,其改进方面也是有目共睹的。相近配置的苹果 Macbook Pro 笔记本电脑价格为 1500 美元,但是像素却比 Yoga 900 少了 40% 。 + +Windows 系统从 Linux 系统中汲取了很多特性,但是 Windows 系统一直没有一个包管理器来对那些非常有趣的且免费的预编译软件组件提供本地支持。因为 ffmpeg 工具使用很多的[依赖包][37],所以在 Windows 系统中安装 **ffmpeg ** 工具就是一件很头疼的事, + +微软建立了 Windows 应用商店,这有点类似 Linux 系统中的软件仓库,但是它不会处理软件包之间的依赖性,而且也不允许用户设置个人软件仓库。微软还开发了一个新的包管理器,叫做 [NuGet][38],但是它主要用于 .Net 语言开发的软件。也包括 ffmpeg 工具的安装包,但是没有与该代码相关的任何依赖包,因此即使安装完成后也没啥用。 + +去年 3 月份,[微软公司宣布][39] Windows 系统支持运行 Ubuntu 的命令行及应用程序,这的确是一个革命性的转折点。([他们本应该先支持 Debian 系统][40]。)甚至还有[热议][41]声称 Windows 系统将会支持更多的 Linux 发行版,这真是太让人激动了。 + +至少对于我来说,我不需要使用任何 Windows 的应用程序,也不需要浪费额外的时间去维护了。在 Windows 系统中修复问题时,你可以到很多不同的地方查询解决问题的方法。 Linux 系统有很多的地方要进行配置,但是总的来说,这已经很简单了。 + +我有个朋友为了更新驱动程序,需要在 Windows 下安装第三方软件,因为更新这种操作需要从微软网站以及其它更多的网站来抓取源代码。 Windows 系统已经比前几年做得更好了,有更多的游戏和桌面应用程序,但是它仍然是一个封闭式老系统。 + +我发现 Gnome Classic 桌面给人一种简洁性的体验。我希望它不是使用很繁杂的[流行 Javascript 脚本][42]语言编写的,他们还要重新建立一个关于定制化主题和颜色主题的社区。 Gnome 2 和 Windows 10 系统中的有些非常有用的功能也消失了,而且也没有老版本的稳定。 2011 年发布的 Gnome 3.0 完全就是走回头路,但是 6 年后的 Gnome 3.22 终于再续辉煌。 + +Gnome Classic 桌面环境是最优秀的图形化界面之一,[很多优秀的特性][43]都变得越来越好了。已安装完成 Arch Linux 系统的 Yoga 900 笔记本电脑现在都运行正常了,我期待着 Linux 系统对 HiDPI 模式和其它方面的改进!我迫不及待地想深入学习 LibreOffice 办公软件里的语法检查特性。 + +-------------------------------------------------------------------------------- + +via: http://keithcu.com/wordpress/?p=3739 + +作者:[keithccurtis][a] +译者:[rusking](https://github.com/rusking) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://twitter.com/keithccurtis +[1]:https://www.amazon.com/Lenovo-13-3-inch-Multitouch-Convertible-Platinum/dp/B01NA6ANNK/ +[2]:http://keithcu.com/wordpress/?p=3270 +[3]:http://configure.us.dell.com/dellstore/config.aspx?oc=cax13w10ph5122&model_id=xps-13-9360-laptop&c=us&l=en&s=bsd&cs=04 +[4]:http://blog.lenovo.com/en/blog/why-you-should-give-in-to-the-new-thinkpad-keyboard +[5]:https://www.freedesktop.org/wiki/Software/libinput/ +[6]:https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=762ce4458974534a2407cc924db05840c89105df +[7]:https://mjg59.dreamwidth.org/41713.html +[8]:https://en.wikipedia.org/wiki/Electromigration +[9]:http://support.lenovo.com/us/en/products/Laptops-and-netbooks/Yoga-Series/yoga-900-13isk2/80UE/downloads/DS112754 +[10]:http://support.lenovo.com/us/en/products/laptops-and-netbooks/yoga-series/yoga-900-13isk2/downloads/ds119354 +[11]:https://linux.slashdot.org/comments.pl?sid=9861381&cid=53241071 +[12]:https://www.reddit.com/r/linux/comments/54gtpc/letter_to_the_federal_trade_commission_regarding/ +[13]:http://venturebeat.com/2016/09/21/lenovo-confirms-that-linux-wont-work-on-yoga-900-and-900s-laptops/ +[14]:http://venturebeat.com/2016/09/21/lenovo-confirms-that-linux-wont-work-on-yoga-900-and-900s-laptops/ +[15]:https://www.reddit.com/user/baronhk/ +[16]:https://www.reddit.com/user/baronhk/ +[17]:https://www.reddit.com/user/baronhk/ +[18]:https://duckduckgo.com/?q=lenovo+yoga+linux+compatibility&t=hs&ia=web +[19]:https://duckduckgo.com/?q=lenovo+yoga+linux+compatibility&t=hs&ia=web +[20]:https://duckduckgo.com/?q=lenovo+yoga+linux+compatibility&t=hs&ia=web +[21]:https://www.spinics.net/lists/linux-ide/msg53370.html +[22]:http://ark.intel.com/products/codename/37572/Skylake +[23]:http://ark.intel.com/products/codename/37572/Skylake +[24]:http://ark.intel.com/products/codename/37572/Skylake +[25]:http://ark.intel.com/products/codename/42174/Haswell#@All +[26]:http://www.anandtech.com/show/9562/intels-skylake-gpu-analyzing-the-media-capabilities +[27]:http://www.anandtech.com/show/9562/intels-skylake-gpu-analyzing-the-media-capabilities +[28]:https://trac.ffmpeg.org/wiki/HWAccelIntro +[29]:http://www.game-debate.com/gpu/index.php?gid=3295&gid2=3285&compare=iris-graphics-540-mobile-vs-intel-hd-graphics-520-mobile +[30]:https://www.freedesktop.org/wiki/Software/Beignet/ +[31]:http://keithcu.com/wordpress/?p=3444 +[32]:https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=hidpi +[33]:http://wiki.audacityteam.org/wiki/Linux_Issues#Hi-DPI +[34]:https://antergos.com/ +[35]:https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface +[36]:https://wiki.archlinux.org/index.php/Profile-sync-daemon +[37]:https://ffmpeg.zeranoe.com/builds/ +[38]:https://www.nuget.org/ +[39]:https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/ +[40]:http://keithcu.com/wordpress/?page_id=558 +[41]:https://github.com/Microsoft/BashOnWindows/issues/992 +[42]:http://notes.ericjiang.com/posts/751 +[43]:https://wiki.archlinux.org/index.php/Desktop_environment diff --git a/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md b/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md deleted file mode 100644 index 2aa3e28983..0000000000 --- a/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md +++ /dev/null @@ -1,38 +0,0 @@ -我需要在 AGPLv3 许可证下提供源码么? -============================================================ - ![Do I need to provide access to source code under the AGPLv3 license?](https://opensource.com/sites/default/files/styles/image-full-size/public/images/law/LAW_PatentSpotlight_520x292_cm.png.png?itok=bCn-kMx2 "Do I need to provide access to source code under the AGPLv3 license?") - -图片提供: - -opensource.com - -[GNU Affero 通用公共许可证版本 3][1](A​​GPLv3)是与 GPLv3 几乎相同的公共版权许可证。两个许可证具有相同的公共版权范围,但在一个重要方面有重大差异。 AGPLv3 的第 13 节规定了 GPLv2 或 GPLv3 中不存在的附加条件: - ->你必须给你那些使用计算机网络远程(如果你的版本支持此类交互)与它交互的用户提供一个通过网络服务器利用一些标准或者常规复制手段免费获得相关你的版本的源码的机会。 - -尽管“通过计算机网络远程交互”的范围应该被理解为涵盖超越常规 SaaS 的情况,但是这个条件主要适用于目前被认为是 SaaS 的部署。目标是在用户使用 web 服务提供功能但是不提供功能代码的分发的环境中关闭普通 GPL 中的感知漏洞。因此,第 13 节提供了超出 GPLv2 第 3 节以及 GPLv3 和 AGPLv3 第 6 节中包含的目标代码分发触发要求的额外源码公开要求。 - -常常被误解的是,AGPLv3 第 13 节中的源代码要求仅在 AGPLv3 软件已被“你”(例如,提供网络服务的实体)修改的地方触发。我的解释是,只要“你”不修改 AGPLv3 的代码,许可证不应该被理解为需要按照第 13 节规定的方式访问相应的源码。如我所见,尽管即使公开许可证不必要的源代码也是一个好主意,但在 AGPL 下许多未修改以及标准部署的软件模块根本不会触发第 13 节。 - -如何解释 AGPL 的条款和条件,包括 AGPL 软件是否已被修改,可能需要根据具体情况的事实和细节进行法律分析。 - --------------------------------------------------------------------------------- - -作者简介: - -![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/kaufman-picture.jpg?itok=FPIizDR-) - -Jeffrey R. Kaufman 是全球领先的开源软件解决方案提供商 Red Hat 公司的开源 IP 律师。Jeffrey 也是托马斯·杰斐逊法学院的兼职教授。在入职 Red Hat 之前,Jeffrey 曾经担任高通公司的专利顾问,向首席科学家办公室提供开源顾问。Jeffrey在 RFID、条形码、图像处理和打印技术方面拥有多项专利。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/1/providing-corresponding-source-agplv3-license - -作者:[Jeffrey Robert Kaufman][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/jkaufman -[1]:https://www.gnu.org/licenses/agpl-3.0-standalone.html diff --git a/translated/talk/20170118 How to gain confidence to participate in open source.md b/translated/talk/20170118 How to gain confidence to participate in open source.md index 507cf0872c..322f8c9f0a 100644 --- a/translated/talk/20170118 How to gain confidence to participate in open source.md +++ b/translated/talk/20170118 How to gain confidence to participate in open source.md @@ -12,7 +12,7 @@ 这里不得不说说这样一个事实:我们每一个人都一些值得分享的事情。但是你要找出这个值得分享的事情是什么,以及在哪个位置分享它才能把这个分享推向最积极、最有意义的一面。 -认真思考一下三点,这将增强你的自信,并能让你在开源社区中更好的取得进步。 +认真思考一下三点,这将增强你的自信,并能让你在开源社区中更容易取得进步。 ### 没有人会站在你的角度来看待你 @@ -20,9 +20,9 @@ 我们都习惯了这样理解,周围的人都是根据我们的行为来做出评判的。这一习惯相当于学习如何更像社会群体一样生活的副产品。而且很可能在我们的童年,父母根据我们的行为设置的奖励机制时,这个习惯就根植我们心底。到了青春期,老师们对我们的表现来评价,给我们划分等级和分数,拿我们和身边的小伙伴对比。这样的动力和奖励机制给我们的大脑建立了一个包括自我反思在内的反馈回路。我们需要预测自己能否得到回报,并要为那些可能发生的事情做好应对。 -现今的我们都有这样第一个疑惑:身边的人是如何看到我的?可能因此,真相是多数人都不会花太多时间来对你进行正确客观的评价。我们所有人只是关注自己的回报,我们有自己热衷于某件事的的热情、有大量急待解决的问题。也有一些人忙于关心他们自己如何影响身边的人,他们并不会在身上花费时间。他们根本不会注意到你是否出错、大声谈话还是向他们的背景乐一样。所有的那些疑惑都只是在你自己的脑海中而已,而非在其他任何人脑中。 +现今的我们都有这样第一个疑惑:身边的人是如何看我的?然而,真相是多数人都不会花太多时间来对你进行正确客观的评价。我们所有人只是关注自己的回报,我们有自己热衷于某件事的的热情、有大量急待解决的问题。也有一些人忙于关心他们自己如何影响身边的人,他们并不会在身上花费时间。他们根本不会注意到你是否出错、大声谈话还是向他们的背景乐一样。所有的那些疑惑都只是在你自己的脑海中而已,而非在其他任何人脑中。 -我们需要为人们所接受的愿望也是人生意义的一部分,但是这类接受我们所遇之人的一时兴起。这些人可能对我们缺乏全面认识,比如我们叫什么、我们来自哪里、形成我们认知的经历,等等。我们能否为人们所接受是一件不受我们自身控制的事情。但是,我们是可以通过与之交流来改变的。 +我们需要为人们所接受的愿望也是人生意义的一部分,但是这类受我们所遇之人的一时兴起。这些人可能对我们缺乏全面认识,比如我们叫什么、我们来自哪里、形成我们认知的经历,等等。我们能否为人们所接受是一件不受我们自身控制的事情。但是,我们是可以通过与之交流来改变的。 在开源的高密度社区的世界里,记住这一点是非常重要的:人们是不会过多的考虑你的。因为你的同事和导师都在忙于其他项目或则社区成员。 @@ -42,7 +42,7 @@ 那么,这些和自信有些什么关系呢?通过表明你重视他人的知识和付出,你提高的不仅是他们的自信,还有你自己的自信。那时你将会感到更加灵活。有些时候,你不得不承认自己也有不懂的地方。 -自信自认也许会说“是的,我不知道”,但却不会因此而沮丧。 +自信的人也许会说“是的,我不知道”,但却不会因此而沮丧。 ### 一分耕耘,一分收获 (You reap what you sow) @@ -77,7 +77,7 @@ via: https://opensource.com/article/17/1/3-ways-improve-your-confidence 作者:[Laura Hilliger][a] 译者:[GHlandy](https://github.com/GHlandy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Bestony](https://github.com/Bestony) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20170126 How to join a technical community.md b/translated/talk/20170126 How to join a technical community.md index 06d8c15c28..7485cd779d 100644 --- a/translated/talk/20170126 How to join a technical community.md +++ b/translated/talk/20170126 How to join a technical community.md @@ -1,9 +1,10 @@ -如何加入技术社区 +如何加入一个技术社区 ============================================================ ### 参照以下几步可以让你很容易地融入社区 ![How to join a technical community](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_DebucketizeOrgChart_A.png?itok=oBdRm8vc "How to join a technical community") + 图片提供: opensource.com 加入一个新的社区在很多情况下可能是一个艰巨的任务。当加入一个新的技术社区时,焦虑感可能特别强烈,尤其是一些社区对新成员的严厉甚至讥讽。 @@ -14,7 +15,7 @@ 该过程开始于实际加入社区前。第一步是确保社区适合你,同时你也是社区的一个补充。 -这听起来很简单,但每个社区都有不同的文化、态度、理念和公认的规范。如果你是某话题的新成员,面向行业专业人士的社区不是一个理想的起点。同样,如果你是一个寻找深入并且极其复杂问题的答案的专家,一个初学者的社区肯定也不太合适。无论哪种方式,两边的不匹配几乎肯定会导致双方的失望。同样,一些社区将是非常正规并且面向商业的,而另一些社区将非常宽松和悠闲,同时许多社区氛围在二者之间。选择适合你的社区,或最低限度不是你厌恶的社区,将有助于确保你的长期参与。 +这听起来很简单,但每个社区都有不同的文化、态度、理念和公认的规范。如果你是某话题的新成员,面向行业专业人士的社区不是一个理想的起点。同样,如果你是一个寻找深入并且极其复杂问题的答案的专家,一个初学者的社区肯定也不太合适。无论哪种方式,两边的不匹配几乎肯定会导致双方的失望。同样,一些社区将是非常正规并且面向商业的,而另一些社区将非常宽松和悠闲,同时许多社区氛围在二者之间。选择适合你的社区,或至少不是你厌恶的社区,这将有助于确保你的长期参与。 ### 浏览社区 @@ -28,19 +29,19 @@ ### 保持尊重 -虽然社区间的接受方式有很大的不同,但你应该永远保持尊重。避免争吵和人身攻击,并始终努力建设社区。记住,你在互联网上发布的东西,它永远存在,并为大家所看到。 +虽然社区间的接受方式有很大的不同,但你应该永远保持尊重。避免争吵和人身攻击,并始终努力建设社区。记住,你在互联网上发布的东西,它将永远存在,并为大家所看到。 ### 问题 -### 提问 +#### 提问 记住,精心设计的问题可以更快地得到更好的答案,正如我在十月专栏[The Queue][2]中指出的。 -### 回答 +#### 回答 -一旦遇见了自己很了解的关于基础或非常容易回答的提问时,“尊重”的理念也同样适用,就像提问时一样。一个技术上的冗长并充满优越感的正确答案,并不是介绍自己到一个新的社区的正确方式。 +一旦遇见了自己很了解的关于基础或非常容易回答的提问时,“尊重”的理念也同样适用,就像提问时一样。一个技术上的冗长并充满优越感的正确答案,并不是向一个新的社区介绍自己的正确方式。 -### 其他讨论 +#### 其他讨论 即使在技术社区,并不是所有的讨论都是关于某个问题或答案。在这种情况下,以尊重和周到的、不带有侮辱和人身攻击的方式,提出不同的意见、挑战他人的观点是健康正确的做法。 @@ -60,7 +61,7 @@ via: https://opensource.com/article/17/1/how-join-technical-community 作者:[Jeremy Garcia][a] 译者:[livc](https://github.com/livc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Bestony](https://github.com/Bestony) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/talk/20170205 Can academic faculty members teach with wikipedia.md b/translated/talk/20170205 Can academic faculty members teach with wikipedia.md index 5434ea027d..829c10a86c 100644 --- a/translated/talk/20170205 Can academic faculty members teach with wikipedia.md +++ b/translated/talk/20170205 Can academic faculty members teach with wikipedia.md @@ -1,20 +1,21 @@ #教职人员是否可以运用维基百科教学? [![Can academic faculty members teach with Wikipedia?](https://camo.githubusercontent.com/47dfe3fec215387fa7bb1f2c038f4e78e0e2e47d/68747470733a2f2f6f70656e736f757263652e636f6d2f73697465732f64656661756c742f66696c65732f7374796c65732f696d6167652d66756c6c2d73697a652f7075626c69632f696d616765732f656475636174696f6e2f4544555f61636164656d6963735f353230783239325f6d612e706e673f69746f6b3d397846574f637436)](https://camo.githubusercontent.com/47dfe3fec215387fa7bb1f2c038f4e78e0e2e47d/68747470733a2f2f6f70656e736f757263652e636f6d2f73697465732f64656661756c742f66696c65732f7374796c65732f696d6167652d66756c6c2d73697a652f7075626c69632f696d616765732f656475636174696f6e2f4544555f61636164656d6963735f353230783239325f6d612e706e673f69746f6b3d397846574f637436) + 图片来自 : opensource.com 自从2010年,已经有29000 个学生完成了 Wiki Ed 这一项目。他们在维基百科上添加了 25 百万的词条,等同于 85000 页纸张的内容。这还是 Britannica 百科全书中所有词条的 66%。Wiki Ed 的学生们最积极的时候,他们正贡献着维基百科上那 10% 且尚未发展的学术板块。 为了了解更多关于这个项目的信息,我联络了 LiAnna Davis -- Wiki Ed项目的负责人。他极富热情地同意来回答我的问题。 -贴士:[Wiki Education Foundation (Wiki Ed)](https://wikiedu.org/) 的平台是用免费软件搭建的,链接为: [WikiEdu Dashboard GitHub](https://github.com/WikiEducationFoundation/WikiEduDashboard). +提示:[Wiki Education Foundation (Wiki Ed)](https://wikiedu.org/) 的平台是用免费软件搭建的,链接为: [WikiEdu Dashboard GitHub](https://github.com/WikiEducationFoundation/WikiEduDashboard). **Wiki Ed 这一项目是如何启动的?说说你的背景以及你是如何参与进这个项目的。** 在2010年,[Wikimedia Foundation](https://wikimediafoundation.org/wiki/Home)(简称WMF,运营维基百科的非营利组织)注意到了一个趋势 -- 大学的教职人员如果本身也是维基词条的编辑者,他们已经成功地将编辑维基词条作为一项任务交给了自己课堂里的学生。WMF 就此开展了一个试行项目试图回答这个问题:如果本身不编辑维基词条的教职人员支持课程中包含维基词条的编辑任务,他们是否可以通过维基百科实现教学呢? -我是这个团队的一员,在2010年被试行雇用,我对这个问题的回答是:“可以。” 在 2013年,WMF将这个项目的美国分部和加拿大分部拆分,形成了一个新的非营利性组织 -- the Wiki Education Foundation (Wiki Ed);自此我也从 WMF 到了Wiki Ed。自那以后我们便成为了一个独立组织,我们可以专注于这个项目并且将这个项目拓展开来 -- 起初 WMF 时期每年只有75个班级参与,而这个学期以及有275班级参与了 Wiki Ed。 +我是这个团队的一员,在2010年被试行雇用,我对这个问题的回答是:“可以。” 在 2013年,WMF将这个项目的美国分部和加拿大分部拆分,形成了一个新的非营利性组织 -- the Wiki Education Foundation (Wiki Ed);自此我也从 WMF 到了Wiki Ed。自那以后我们便成为了一个独立组织,我们可以专注于这个项目并且将这个项目拓展开来 -- 起初 WMF 时期每年只有75个班级参与,而这个学期已经有275班级参与了 Wiki Ed。 **人们总是默认大学生对科技相关的一切事物都很敏感,尤其是互联网,但是你们的网站上写道,“大学本科学生可能具有高科技敏感度,但这并不代表他们具有高科技成熟度。” 你可以稍微解释一下这句话吗?** @@ -34,7 +35,7 @@ **一个教师会需要哪些职业素养来参与这个项目?学生又是需要哪些训练呢?** -当你在 [the Wikipedia Education Foundation's Teach page](http://teach.wikiedu.org/)上注册的时候,你会发现Wiki Ed为新加入的教职人员提供了如何运用维基百科实现教学的在线指南。我们还有为学生提供的一系列的在线训练,根据他们不同的任务自动分配不同的指南(例如,如果你希望你的学生在文章中插入图片,他们会得到一个如何插入编辑图片的教学单元,如果你不需要,他们便不会得到这个单元的指南)。在部分十几个学科中,我们还有特定的指南书展示了这几个学科的特定编辑方式。除此之外,我们还有熟练维基百科编辑的工作人员帮助回答学生和导师们的问题。我们的系统已经在逐步扩大;我们在这个秋季学期已经支持了超过 6300 个学生,并且已经适应了与没有维基编辑经验的教职人员合作,因此这样就保证了没有人会因为资历不够而不参与。 +当你在 [the Wikipedia Education Foundation's Teach page](http://teach.wikiedu.org/)上注册的时候,你会发现Wiki Ed为新加入的教职人员提供了如何运用维基百科实现教学的在线指南。我们还有为学生提供的一系列的在线训练,根据他们不同的任务自动分配不同的指南(例如,如果你希望你的学生在文章中插入图片,他们会得到一个如何插入编辑图片的教学单元,如果你不需要,他们便不会得到这个单元的指南)。在部分十几个学科中,我们还有特定的指南书展示了这几个学科的特定编辑方式。除此之外,我们还有熟练维基百科编辑的工作人员帮助回答学生和导师们的问题。我们的系统已经在逐步扩大;我们在这个秋季学期已经支持了超过 6300 个学生,并且已经适应了与没有维基编辑经验的教职人员合作,因此这样就保证了没有人会因为资历不够而无法参与。 **”访问学者“这个项目是指?** @@ -55,6 +56,8 @@ Don Watkins 是一个教育家,专注教育技术,创业家,开源提倡 via: https://opensource.com/article/17/1/Wiki-Education-Foundation -作者:Don Watkins 译者:scoutydren 校对:校对者ID +作者: Don Watkins +译者:[scoutydren](https://github.com/scoutydren) +校对:[Bestony](https://github.com/Bestony) -本文由 LCTT 原创编译,Linux中国 荣誉推出 +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/talk/The history of Android/16 - The history of Android.md b/translated/talk/The history of Android/16 - The history of Android.md deleted file mode 100644 index 53c603c7bf..0000000000 --- a/translated/talk/The history of Android/16 - The history of Android.md +++ /dev/null @@ -1,66 +0,0 @@ -安卓编年史 -================================================================================ -### 安卓 3.0 蜂巢—平板和设计复兴 ### - -尽管姜饼中做了许多改变,安卓仍然是移动世界里的丑小鸭。相比于 iPhone,它的优雅程度和设计完全抬不起头。另一方面来说,为数不多的能与 iOS 的美学智慧相当的操作系统之一是 Palm 的 WebOS。WebOS 有着优秀的整体设计,创新的功能,而且被寄予期望能够从和 iPhone 的长期竞争中拯救公司。 - -尽管如此,一年之后,Palm 资金链断裂。Palm 公司从未看到 iPhone 的到来,到 WebOS 就绪的时候已经太晚了。2010年4月,惠普花费10亿美元收购了 Palm。尽管惠普收购了一个拥有优秀用户界面的产品,界面的首席设计师,Matias Duarte,并没有加入惠普公司。2010年5月,就在惠普接手 Palm 之前,Duarte 加入了谷歌。惠普买下了面包,但谷歌雇佣了它的烘培师。 - -![第一部蜂巢设备,摩托罗拉 Xoom 10英寸平板。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/Motorola-XOOM-MZ604.jpg) -第一部蜂巢设备,摩托罗拉 Xoom 10英寸平板。 - -在谷歌,Duarte 被任命为安卓用户体验主管。这是第一次有人公开掌管安卓的外观。尽管 Matias 在安卓 2.2 发布时就来到了谷歌,第一个真正受他影响的安卓版本是 3.0 蜂巢,它在2011年2月发布。 - -按谷歌自己的说法,蜂巢是匆忙问世的。10个月前,苹果发布了 iPad,让平板变得更加现代,谷歌希望能够尽快做出回应。蜂巢就是那个回应,一个运行在10英寸触摸屏上的安卓版本。悲伤的是,将这个系统推向市场是如此优先的事项,以至于边边角角都被砍去了以节省时间。 - -新系统只用于平板——手机不能升级到蜂巢,这加大了谷歌让系统运行在差异巨大的不同尺寸屏幕上的难度。但是,仅支持平板而不支持手机使得蜂巢源码没有泄露。之前的安卓版本是开源的,这使得黑客社区能够将其最新版本移植到所有的不同设备之上。谷歌不希望应用开发者在支持不完美的蜂巢手机移植版本时感到压力,所以谷歌将源码留在自己手中,并且严格控制能够拥有蜂巢的设备。匆忙的开发还导致了软件问题。在发布时,蜂巢不是特别稳定,SD卡不能工作,Adobe Flash——安卓最大的特色之一——还不被支持。 - -[摩托罗拉 Xoom][1]是为数不多的拥有蜂巢的设备之一,它是这个新系统的旗舰产品。Xoom 是一个10英寸,16:9 的平板,拥有 1GB 内存和 1GHz Tegra 2 双核处理器。尽管是由谷歌直接控制更新的新版安卓发布设备,它并没有被叫做“Nexus”。对此最可能的原因是谷歌对它没有足够的信心称其为旗舰。 - -尽管如此,蜂巢是安卓的一个里程碑。在一个体验设计师的主管之下,整个安卓用户界面被重构,绝大多数奇怪的应用设计都得到改进。安卓的默认应用终于看起来像整体的一部分,不同的界面有着相似的布局和主题。然而重新设计安卓会是一个跨版本的项目——蜂巢只是将安卓塑造成型的开始。这第一份草稿为安卓未来版本的样子做了基础设计,但它也用了过多的科幻主题,谷歌将花费接下来的数个版本来淡化它。 - -![蜂巢和姜饼的主屏幕。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/homeskreen.png) -蜂巢和姜饼的主屏幕。 -Ron Amadeo供图 - -姜饼只是在它的量子壁纸上试验了科幻外观,蜂巢整个系统的以电子为灵感的主题让它充满科幻意味。所有东西都是黑色的,如果你需要对比色,你可以从一些不同色调的蓝色中挑选。所有蓝色的东西还有“光晕”效果,让整个系统看起来像是外星科技创造的。默认背景是个六边形的全息方阵(一个蜂巢!明白了吗?),看起来像是一艘飞船上的传送阵的地板。 - -蜂巢最重要的变化是增加了系统栏。摩托罗拉 Xoom 除了电源和音量键之外没有配备实体按键,所以蜂巢添加了一个大黑色底栏到屏幕底部,用于放置导航按键。这意味着默认安卓界面不再需要特别的实体按键。在这之前,安卓没有实体的返回,菜单和 Home 键就不能正常工作。现在,软件提供了所有必需的按钮,任何带有触摸屏的设备都能够运行安卓。 - -新软件按键带来的最大的好处是灵活性。新的应用指南表明应用应不再要求实体菜单按键,需要用到的时候,蜂巢会自动检测并添加四个按钮到系统栏让应用正常工作。另一个软件按键的灵活属性是它们可以改变设备的屏幕方向。除了电源和音量键之外,Xoom 的方向实际上不是那么重要。从用户的角度来看,系统栏始终处于设备的“底部”。代价是系统栏明显占据了一些屏幕空间。为了在10英寸平板上节省空间,状态栏被合并到了系统栏中。所有的常用状态指示放在了右侧——有电源,连接状态,时间还有通知图标。 - -主屏幕的整个布局都改变了,用户界面部件放在了设备的四个角落。屏幕底部左侧放置着之前讨论过的导航按键,右侧用于状态指示和通知,顶部左侧显示的是文本搜索和语音搜索,右侧有应用抽屉和添加小部件的按钮。 - -![新锁屏界面和最近应用界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/lockscreen-and-recent.png) -新锁屏界面和最近应用界面。 -Ron Amadeo供图 - -(因为 Xoom 是一部 [较重] 的10英寸,16:9平板设备,这意味着它主要是横屏使用。虽然大部分应用还支持竖屏模式,但是到目前为止,由于我们的版式限制,我们大部分使用的是竖屏模式的截图。请记住蜂巢的截图来自于10英寸的平板,而姜饼的截图来自3.7英寸的手机。二者所展现的信息密度是不能直接比较的。) - -解锁界面——从菜单按钮到旋转式拨号盘再到滑动解锁——移除了解锁步骤的任何精度要求,它采用了一个环状解锁盘。从中间向任意方向向外滑动就能解锁设备。就像旋转式解锁,这种解锁方式更加符合人体工程学,而不用强迫你的手指完美地遵循一条笔直的解锁路径。 - -第二张图中略缩图条带是由新增的“最近应用”按钮打开的界面,现在处在返回和 Home 键旁边。不像姜饼中长按 Home 键显示一组最近应用的图标,蜂巢在屏幕上显示应用图标和略缩图,使得在任务间切换变得更加方便。最近应用的灵感明显来自于 Duarte 在 WebOS 中的“卡片式”多任务管理,其使用全屏略缩图来切换任务。这个设计提供和 WebOS 的任务切换一样的易识别体验,但更小的略缩图允许更多的应用一次性显示在屏幕上。 - -尽管最近应用的实现看起来和你现在的设备很像,这个版本实际上是非常早期的。这个列表不能滚动,这意味着竖屏下只能显示七个应用,横屏下只能显示五个。任何超出范围的应用会从列表中去除。而且你也不能通过滑动略缩图来关闭应用——这只是个静态的列表。 - -这里我们看到电子灵感影响的完整主题效果:略缩图的周围有蓝色的轮廓以及神秘的光晕。这张截图还展示软件按键的好处——上下文。返回按钮可以关闭略缩图列表,所以这里的箭头指向下方,而不是通常的样子。 - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/16/ - -译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2011/03/ars-reviews-the-motorola-xoom/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo diff --git a/sources/tech/20160602 Building a data science portfolio - Storytelling with data.md b/translated/tech/20160602 Building a data science portfolio - Storytelling with data.md similarity index 83% rename from sources/tech/20160602 Building a data science portfolio - Storytelling with data.md rename to translated/tech/20160602 Building a data science portfolio - Storytelling with data.md index 625b08efdc..281c2dee20 100644 --- a/sources/tech/20160602 Building a data science portfolio - Storytelling with data.md +++ b/translated/tech/20160602 Building a data science portfolio - Storytelling with data.md @@ -1,105 +1,107 @@ -Translated by Yoo-4x -Building a data science portfolio: Storytelling with data +建立一项数据科学组合:讲一个关于数据的故事 ======== ->This is the first in a series of posts on how to build a Data Science Portfolio. If you like this and want to know when the next post in the series is released, you can [subscribe at the bottom of the page][35]. +>这是如何建立科学组合系列文章中的第一篇。如果你喜欢这篇文章并且想知道此系列的下一篇文章何时发表,你可以[在页面底部订阅][35]。 -Data science companies are increasingly looking at portfolios when making hiring decisions. One of the reasons for this is that a portfolio is the best way to judge someone’s real-world skills. The good news for you is that a portfolio is entirely within your control. If you put some work in, you can make a great portfolio that companies are impressed by. +数据科学公司们在采用一个想法时越来越看重组合结果。其中一个原因就是运用组合是分析一个人真实技能的最好方式。对你来说好消息解释组合是完全可以被你掌控的。如果你针对一些事情做了一些工作,你就能的奥一个令那些公司印象深刻的组合结果。 -The first step in making a high-quality portfolio is to know what skills to demonstrate. The primary skills that companies want in data scientists, and thus the primary skills they want a portfolio to demonstrate, are: +建立一个高质量组合的第一步就是知道展示什么技能。那些公司们主要希望数据科学工作者拥有的技能,或者说他们主要希望组合所展示的技能是: -* Ability to communicate -* Ability to collaborate with others -* Technical competence -* Ability to reason about data -* Motivation and ability to take initiative +* 表达能力 +* 合作能力 +* 专业技能 +* 解释数据的能力 +* 有目标和有积极性的 -Any good portfolio will be composed of multiple projects, each of which may demonstrate 1-2 of the above points. This is the first post in a series that will cover how to make a well-rounded data science portfolio. In this post, we’ll cover how to make your first project for a data science portfolio, and how to tell an effective story using data. At the end, you’ll have a project that will help demonstrate your ability to communicate, and your ability to reason about data. +任何一个好的组合都由多个工程构成,每一个工程都会展示1-2个上面所说的点。这是涵盖了“如何完成一个完整的科学组合”系列文章的第一篇。在这篇文章中,我们将会涵括如何完成你的第一项数据科学组合工程,并且对此进行有效的解释。在ui后,你将会得到一个帮助展示你表达能力和解释数据能力的工程。 -### Storytelling with data +### 讲述一个关于数据的故事 -Data science is fundamentally about communication. You’ll discover some insight in the data, then figure out an effective way to communicate that insight to others, then sell them on the course of action you propose. One of the most critical skills in data science is being able to tell an effective story using data. An effective story can make your insights much more compelling, and help others understand your ideas. +于数据科学表达是基础。你将会发现数据的内含,并且找出一个高效的方式来向他人表达,之后向他们展示你所开展的课题。数据科学最关键的手法之一就是能够讲述一个关于使用数据的清晰的故事。一个好的故事能够使你得到的结果更加引人注目,并且能是别人理解你的想法。 -A story in the data science context is a narrative around what you found, how you found it, and what it means. An example might be the discovery that your company’s revenue has dropped 20% in the last year. It’s not enough to just state that fact – you’ll have to communicate why revenue dropped, and how to potentially fix it. +数据科学中的故事是一个讲述关于你发现了什么,你怎么发现它的,并且它意味着什么的故事。例如假使发现你公司的收入相对去年减少了百分之二十。这并不能够确定原因或者表达为什么收入会减少并且在尝试修复它。 -The main components of storytelling with data are: +讲述关于数据的故事主要包含: -* Understanding and setting the context -* Exploring multiple angles -* Using compelling visualizations -* Using varied data sources -* Having a consistent narrative +* 理解并确定内容 +* 从多角度发觉 +* 使用有趣的表示方法 +* 使用多种数据来源 +* 有一致的叙述 -The best tool to effectively tell a story with data is [Jupyter notebook][34]. If you’re unfamiliar, [here’s][33] a good tutorial. Jupyter notebook allows you to interactively explore data, then share your results on various sites, including Github. Sharing your results is helpful both for collaboration, and so others can extend your analysis. +用来讲述关于数据的故事最有效率的工具就是[Jupyter notebook][34]。如果你不熟悉,[此处][33]有一个好的教程。 Jupyter notebook 允许你交互式的发掘数据,并且将你的结果分享到多个网站,包括Github,分享你的结果有助于合作研究和其他人拓展你的分析。 -We’ll use Jupyter notebook, along with Python libraries like Pandas and matplotlib in this post. +我们将使用Jupyter notebook,Python库和matplotlib在这篇文章中。 -### Choosing a topic for your data science project +### 为你的数据科学工程选择一个主题 -The first step in creating a project is to decide on your topic. You want the topic to be something you’re interested in, and are motivated to explore. It’s very obvious when people are making projects just to make them, and when people are making projects because they’re genuinely interested in exploring the data. It’s worth spending extra time on this step, so ensure that you find something you’re actually interested in. +建立一个工程的第一步就是觉得你的主题。你需要你的主题是你兴趣所在的,并且有动力去挖掘。当人们为了完成一个项目而完成和当人们完成项目是因为有兴趣去进行数据挖掘时的区别是很明显的。这个步骤是值得花费时间的,所以确保你找到了你真正感兴趣的东西。 -A good way to find a topic is to browse different datasets and seeing what looks interesting. Here are some good sites to start with: +一个寻找主题的好的方法就是浏览不同的数据组并且寻找感兴趣的部分。这里有一些作为起点的好的网站: -* [Data.gov][20] – contains government data. -* [/r/datasets][19] – a subreddit that has hundreds of interesting datasets. -* [Awesome datasets][18] – a list of datasets, hosted on Github. -* [rs.io][17] – a great blog post with hundreds of interesting datasets. +* [Data.gov][20] - 包含了政府据。 +* [/r/datasets][19] – 一个有着上百个有趣数据组的reddit(reddit是一个类似于贴吧、论坛的网站)。 +* [Awesome datasets][18] – 一个数据组的列表,位于Github上。 +* [rs.io][17] – 一个有着上百个有趣数据组的博客。 -In real-world data science, you often won’t find a nice single dataset that you can browse. You might have to aggregate disparate data sources, or do a good amount of data cleaning. If a topic is very interesting to you, it’s worth doing the same here, so you can show off your skills better. +真实世界中的数据科学,经常无法找到合适的单个数据组。你可能需要合并多个独立的数据源,或者做数量庞大的数据清理。如果主题非常吸引你,这是值得这样做的,并且也能更好的展示你的技能。 -For the purposes of this post, we’ll be using data about New York city public schools, which can be found [here][32]. +关于这篇文章的主题,我们将使用纽约市公立学校的数据,我们可以在[这里][32]找到它。 -### Pick a topic +### 选择主题 -It’s important to be able to take the project from start to finish. In order to do this, it can be helpful to restrict the scope of the project, and make it something we know we can finish. It’s easier to add to a finished project than to complete a project that you just can’t seem to ever get enough motivation to finish. +对于完成项目来说这是十分重要的。因为主题能很好的限制项目的范围,并且使它能够是我们知道它可以被完成。比起一个没有足够动力完成的工程来说添加到一个完成的工程更加容易。 -In this case, we’ll look at the [SAT scores][31] of high schoolers, along with various demographic and other information about them. The SAT, or Scholastic Aptitude Test, is a test that high schoolers take in the US before applying to college. Colleges take the test scores into account when making admissions decisions, so it’s fairly important to do well on. The test is divided into 3 sections, each of which is scored out of 800 points. The total score is out of 2400 (although this has changed back and forth a few times, the scores in this dataset are out of 2400). High schools are often ranked by their average SAT scores, and high SAT scores are considered a sign of how good a school district is. +所以,我们将关注高中的[学术评估测试][31],伴随着多种人口统计和它们的其它数据。关于SAT,或者说学习评估测试,是美国高中生进入大学前的测试。大学在做判定时将成绩录入账号,所以高分是十分重要的。考试分为三个阶段,每个阶段总分为800。全部分数为2400(即使这个前后更改了几次,在数据中总分还是2400)。高中经常通过平均STA分数进行排名,并且SAT是评判高中有多好的标准。 -There have been allegations about the SAT being unfair to certain racial groups in the US, so doing this analysis on New York City data will help shed some light on the fairness of the SAT. +因为由关于STA分数对于美国中某些种族群体是不公平的。,所以这个纽约市数据分析能够帮助对SAT的公平性有轻许帮助。 -We have a dataset of SAT scores [here][30], and a dataset that contains information on each high school [here][29]. These will form the base of our project, but we’ll need to add more information to create compelling analysis. +我们有SAT成绩的数据组[这里][30],并且数据组中包含了每所高中的信息[这里][29]。这些将总成我们的工程的基础,但是我们将将如更多的信息来创建有趣的分析。 -### Supplementing the data +### 补充数据 -Once you have a good topic, it’s good to scope out other datasets that can enhance the topic or give you more depth to explore. It’s good to do this upfront, so you have as much data as possible to explore as you’re building your project. Having too little data might mean that you give up on your project too early. +如果你已经有了一个很好的主题,拓展其它可以提升主题或者更深入挖掘数据的的数据组是被推荐的。十分适合在前期做这些工作,那么你将会有尽可能多的数据来构建你的工程。有着越少的数据意味着你太早的放弃了你的工程。 -In this case, there are several related datasets on the same website that cover demographic information and test scores. +在包含人口统计信息和测试成绩的网站上这里有一些相关的数据组。 -Here are the links to all of the datasets we’ll be using: +这些是我们将会用到的所有数据组: -* [SAT scores by school][16] – SAT scores for each high school in New York City. -* [School attendance][15] – attendance information on every school in NYC. -* [Math test results][14] – math test results for every school in NYC. -* [Class size][13] – class size information for each school in NYC. +* [SAT scores by school][16] – 纽约市每所高中的STA成绩。 +* [School attendance][15] – 纽约市每所学校的出勤信息。 +* [Math test results][14] – 纽约市每所学校的数学成绩。 +* [Class size][13] - 纽约市每所学校课堂人数信息。 * [AP test results][12] – Advanced Placement exam results for each high school. Passing AP exams can get you college credit in the US. -* [Graduation outcomes][11] – percentage of students who graduated, and other outcome information. -* [Demographics][10] – demographic information for each school. -* [School survey][9] – surveys of parents, teachers, and students at each school. -* [School district maps][8] – contains information on the layout of the school districts, so that we can map them out. +* [AP test results][12] - 高阶位考试,在美国,通过AP测试就能获得大学学分。 +译者注:高阶位考试(AP)是美国和加拿大的一个由大学委员会创建的计划,该计划为高中学生提供大学水平的课程和考试。 美国学院和大学可以授予在考试中获得高分的学生的就学和课程学分。 -All of these datasets are interrelated, and we’ll be able to combine them before we do any analysis. +* [Graduation outcomes][11] – 由百分之几的学生毕业了,和其它去向信息。 +* [Demographics][10] – 每个学校的人口统计信息。 +* [School survey][9] – 学校的家长、教师,学生的问卷。 +* [School district maps][8] – 包含学校的区域布局信息,因此我们能将它们在地图上标出。 -### Getting background information +这些数据组合之间是相互关联的,并且我们能够在开始分析之前进行合并。 -Before diving into analyzing the data, it’s useful to research some background information. In this case, we know a few facts that will be useful: +### 获取背景信息 -* New York City is divided into `5` boroughs, which are essentially distinct regions. -* Schools in New York City are divided into several school district, each of which can contains dozens of schools. -* Not all the schools in all of the datasets are high schools, so we’ll need to do some data cleaning. -* Each school in New York City has a unique code called a `DBN`, or District Borough Number. -* By aggregating data by district, we can use the district mapping data to plot district-by-district differences. +在开始分析数据之前,搜索一些背景信息是有必要的。我们知道这些有用的信息: -### Understanding the data +* 纽约市被分为五个不同的辖区 +* 纽约市的学校坐落在学校区域内,每个都学校区域都可能包含数十所学校。 +* 数据组中的并不全是高中,所以我们需要对数据进行一些清理工作。 +* 纽约市的每所学校都有自己单独的编码,被称为‘DBN’,或者区域行政编号。 +* 为了通过区域进行合并数据,我们可以使用地图区域信息来绘制逐区差异。 -In order to really understand the context of the data, you’ll want to spend time exploring and reading about the data. In this case, each link above has a description of the data, along with the relevant columns. It looks like we have data on the SAT scores of high schoolers, along with other datasets that contain demographic and other information. +### 理解数据 -We can run some code to read in the data. We’ll be using [Jupyter notebook][28] to explore the data. The below code will: +为了真正的理解数据信息,你将需要花费时间挖掘和阅读数据。因此,每一个数据链接的描述信息都沿着相关列。假如我们拥有高中SAT成绩信息,包含图像和其它信息的数据组。 -* Loop through each data file we downloaded. -* Read the file into a [Pandas DataFrame][7]. -* Put each DataFrame into a Python dictionary. +我们可以运行一些代码来读取数据。我们将使用[Jupyter notebook][28]来挖掘数据。下面的代码将会执行一下操作: + +* 循环通过我们下载的所有数据文件。 +* 将文件读取到[Pandas DataFrame][7]。 +* 将所有数据框架导入Python数据库中。 In [100]: ``` @@ -115,7 +117,7 @@ for f in files: ``` -Once we’ve read the data in, we can use the [head][27] method on DataFrames to print the first `5` lines of each DataFrame: +一旦我们将数据读入,我们就可以使用数据框架中的[头部][27]方法打印每个数据框架的前五行。 In [103]: ``` @@ -379,21 +381,23 @@ hs_directory ``` -We can start to see some useful patterns in the datasets: +我们可以开始在数据组合中观察有用的部分: * Most of the datasets contain a `DBN` column -* Some fields look interesting for mapping, particularly `Location 1`, which contains coordinates inside a larger string. -* Some of the datasets appear to contain multiple rows for each school (repeated DBN values), which means we’ll have to do some preprocessing. +* 大部分数据组包含DBN列。 +* 一些条目看起来在地图上标出会很有趣,特别是`Location 1`,这列对应的信息会多一些。 +* 有些数据组会出现每所学校对应多行数据(DBN数据重复),这意味着我们要进行预处理。 ### Unifying the data +### 统一数据 -In order to work with the data more easily, we’ll need to unify all the individual datasets into a single one. This will enable us to quickly compare columns across datasets. In order to do this, we’ll first need to find a common column to unify them on. Looking at the output above, it appears that `DBN` might be that common column, as it appears in multiple datasets. +为了使工作更简单,我们将需要将全部零散的数据组统一为一个。这将使我们能够快速跨数据组对比数据列。因此,我们需要找到相同的列将他们统一起来。请查看上面的输出数据,当DBN出现在多个数据组中时它很可能成为共同列。 -If we google `DBN New York City Schools`, we end up [here][26], which explains that the `DBN` is a unique code for each school. When exploring datasets, particularly government ones, it’s often necessary to do some detective work to figure out what each column means, or even what each dataset is. +如果我们用google搜索`DBN New York City Schools`, 我们[在此][26]得到了结果。它解释了DBN是每个学校独特的编码。我们将挖掘数据组,特别是政府数据组。这通常需要做一些工作来找出每列的含义,或者每个数据组是的意图。 -The problem now is that two of the datasets, `class_size`, and `hs_directory`, don’t have a `DBN` field. In the `hs_directory` data, it’s just named `dbn`, so we can just rename the column, or copy it over into a new column called `DBN`. In the `class_size` data, we’ll need to try a different approach. +现在这两个数据组的主要的问题是,`class_size`, 和 `hs_directory`数据组, 没有 `DBN` 列。在`hs_directory` 数据中是dbn,那么我们只需重命名即可,或者将它复制到新的名为DBN的列中。在`class_size`数据中,我们将需要尝试不同的方法。 -The `DBN` column looks like this: +DBN列: In [5]: ``` @@ -411,7 +415,7 @@ Out[5]: Name: DBN, dtype: object ``` -If we look at the `class_size` data, here’s what we’d see in the first `5` rows: +如果我们看向`class_size`数据,我们将看到前五行: In [4]: ``` @@ -429,9 +433,9 @@ Out[4]: | 3 | 1 | M | M015 | P.S. 015 Roberto Clemente | 01 | CTT | - | - | - | 17.0 | 1.0 | 17.0 | 17.0 | 17.0 | ATS | NaN | | 4 | 1 | M | M015 | P.S. 015 Roberto Clemente | 02 | GEN ED | - | - | - | 15.0 | 1.0 | 15.0 | 15.0 | 15.0 | ATS | NaN | -As you can see above, it looks like the `DBN` is actually a combination of `CSD`, `BOROUGH`, and `SCHOOL CODE`. For those unfamiliar with New York City, it is composed of `5` boroughs. Each borough is an organizational unit, and is about the same size as a fairly large US City.`DBN` stands for `District Borough Number`. It looks like `CSD` is the District, `BOROUGH` is the borough, and when combined with the `SCHOOL CODE`, forms the `DBN`. There’s no systematized way to find insights like this in data, and it requires some exploration and playing around to figure out. +正如上面所见,DBN实际上是`CSD`, `BOROUGH`, 和 `SCHOOL CODE` 的组合。对那些不熟悉纽约市的人来说,纽约由五个行政区组成。每个行政区是一个组织团体,并且有着美国城市一样的面积。DBN全称为行政区域编号。看起来就像CSD是区域,BOROUGH是行政区,并且当与SCHOOL CODE合并时就组成了DBN。这里并没有系统的方法寻找像这个数据这样的内在规律,并且这需要一些探索和努力来发现。 -Now that we know how to construct the `DBN`, we can add it into the `class_size` and `hs_directory` datasets: +现在我们已经知道了DBN的组成,那么我们就可以将它加入到class_size和hs_directory数据组中了: In [ ]: ``` @@ -440,16 +444,16 @@ data["hs_directory"]["DBN"] = data["hs_directory"]["dbn"] ``` -### Adding in the surveys +### 加入问卷 -One of the most potentially interesting datasets to look at is the dataset on student, parent, and teacher surveys about the quality of schools. These surveys include information about the perceived safety of each school, academic standards, and more. Before we combine our datasets, let’s add in the survey data. In real-world data science projects, you’ll often come across interesting data when you’re midway through your analysis, and will want to incorporate it. Working with a flexible tool like Jupyter notebook will allow you to quickly add some additional code, and re-run your analysis. +最可能值得一看的数据组之一就是学生、家长和老师关于学校质量的问卷了。这些问卷包含了每所学校的安全度,教学水平等。之前我们所合并了数据组,让我们们添加问卷数据。在真实世界的数据科学工程中,你将要经常会在分析过程中碰到有趣的数据,并且希望合并它。使用灵活的工具就像Jupyter notebook 将允许你快速添加一些新的代码,并且重新开始你的分析。 -In this case, we’ll add the survey data into our `data` dictionary, and then combine all the datasets afterwards. The survey data consists of `2` files, one for all schools, and one for school district `75`. We’ll need to write some code to combine them. In the below code, we’ll: +因此,我们将添加问卷数据到我们的data文件夹,并且合并所有之前的数据。问卷数据分为两个文件,一个包含所有的学校,一个包含75号区域的学校。我们将需要写一些代码来合并它们。之后的代码我们将: -* Read in the surveys for all schools using the `windows-1252` file encoding. -* Read in the surveys for district 75 schools using the `windows-1252` file encoding. -* Add a flag that indicates which school district each dataset is for. -* Combine the datasets into one using the [concat][6] method on DataFrames. +* 读取所有学校的问卷,并使用windows-1252作为编码。 +* 使用windows-1252编码读取所有75号区域学校的问卷。 +* 添加标签来表明每个数据组包含哪个区域的学校。 +* 使用数据框架[concat][6]方法合并数据组为一个。 In [66]: ``` @@ -461,7 +465,7 @@ survey = pandas.concat([survey1, survey2], axis=0) ``` -Once we have the surveys combined, there’s an additional complication. We want to minimize the number of columns in our combined dataset so we can easily compare columns and figure out correlations. Unfortunately, the survey data has many columns that aren’t very useful to us: +一旦我们将问卷合并,这里将会有一些混乱。我们希望我们合并的数据组列数最少,那么我们将可以轻易的进行列之间的对比并找出期间的关联。不幸的是,问卷数据有很多列并不是很有用: In [16]: ``` @@ -480,11 +484,11 @@ Out[16]: 5 rows × 2773 columns -We can resolve this issue by looking at the data dictionary file that we downloaded along with the survey data. The file tells us the important fields in the data: +我们可以通过查看数据文件夹中伴随问卷数据下载下来的文件来解决这个问题。它告诉我们们数据中重要的部分是哪些: ![](https://www.dataquest.io/blog/images/misc/xj5ud4r.png) -We can then remove any extraneous columns in `survey`: +我们可以去除`survey`数据组中多余的列: In [17]: ``` @@ -501,11 +505,11 @@ Out[17]: (1702, 23) ``` -Making sure you understand what each dataset contains, and what the relevant columns are can save you lots of time and effort later on. +请确保理你已经了解了每个数据组的内容和相关联的列,者能节约你之后大量的时间和精力: -### Condensing datasets +### 精简数据组 -If we take a look at some of the datasets, including `class_size`, we’ll immediately see a problem: +如果我们看向某些数据组,包括`class_size`,我们将立刻发现问题: In [18]: ``` @@ -523,7 +527,7 @@ Out[18]: | 3 | 1 | M | M015 | P.S. 015 Roberto Clemente | 01 | CTT | - | - | - | 17.0 | 1.0 | 17.0 | 17.0 | 17.0 | ATS | NaN | 01M015 | | 4 | 1 | M | M015 | P.S. 015 Roberto Clemente | 02 | GEN ED | - | - | - | 15.0 | 1.0 | 15.0 | 15.0 | 15.0 | ATS | NaN | 01M015 | -There are several rows for each high school (as you can see by the repeated `DBN` and `SCHOOL NAME` fields). However, if we take a look at the `sat_results` dataset, it only has one row per high school: +每所高中都有许多行(正如你所见的重复的`DBN`和`SCHOOL NAME`)。然而,如果我们看向`sat_result`数据组,每所高中只有一行: In [21]: ``` @@ -541,12 +545,12 @@ Out[21]: | 3 | 01M458 | FORSYTH SATELLITE ACADEMY | 7 | 414 | 401 | 359 | | 4 | 01M509 | MARTA VALLE HIGH SCHOOL | 44 | 390 | 433 | 384 | -In order to combine these datasets, we’ll need to find a way to condense datasets like `class_size` to the point where there’s only a single row per high school. If not, there won’t be a way to compare SAT scores to class size. We can accomplish this by first understanding the data better, then by doing some aggregation. With the `class_size`dataset, it looks like `GRADE` and `PROGRAM TYPE` have multiple values for each school. By restricting each field to a single value, we can filter most of the duplicate rows. In the below code, we: +为了合并这些数据组,我们将需要找到方法精简数据组到如`class_size`般一行对应一所高中。否则,我们将不能将SAT成绩与班级大小进行比较。我们通过先更好的理解数据,然后做一些合并来完成。`class_size`数据组像`GRADE`和`PROGRAM TYPE`,每个学校有多个数据对应。为了将每个范围内的数据变为一个数据,我们将大部分重复行过滤掉,在下面的代码中我们将会: -* Only select values from `class_size` where the `GRADE` field is `09-12`. -* Only select values from `class_size` where the `PROGRAM TYPE` field is `GEN ED`. -* Group the `class_size` dataset by `DBN`, and take the average of each column. Essentially, we’ll find the average `class_size` values for each school. -* Reset the index, so `DBN` is added back in as a column. +* 只从`class_size`中选择`GRADE`范围为`09-12`的行。 +* 只从`class_size`中选择`PROGRAM TYPE`是`GEN ED`的值。 +* 将`class_size`以`DBN`分组,然后取每列的平均值。重要的是,我们将找到每所学校班级大小平均值。 +* 重置索引,将`DBN`重新加到列中。 In [68]: ``` @@ -559,9 +563,9 @@ data["class_size"] = class_size ``` -### Condensing other datasets +### 精简其它数据组 -Next, we’ll need to condense the `demographics` dataset. The data was collected for multiple years for the same schools, so there are duplicate rows for each school. We’ll only pick rows where the `schoolyear` field is the most recent available: +接下来,我们将需要精简`demographic`数据组。这里有每个学校收集多年的数据,所以这里每所学校有许多重复的行。我们将只选取`schoolyear`最近的可用行: In [69]: ``` @@ -571,7 +575,7 @@ data["demographics"] = demographics ``` -We’ll need to condense the `math_test_results` dataset. This dataset is segmented by `Grade`and by `Year`. We can select only a single grade from a single year: +我们需要精简`math_test_results` 数据组。这个数据组被`Grade`和`Year`划分。我们将只选取一年选取一个年级。 In [70]: ``` @@ -580,7 +584,7 @@ data["math_test_results"] = data["math_test_results"][data["math_test_results"][ ``` -Finally, `graduation` needs to be condensed: +最后,`graduation`需要被精简: In [71]: ``` @@ -589,14 +593,14 @@ data["graduation"] = data["graduation"][data["graduation"]["Demographic"] == "To ``` -Data cleaning and exploration is critical before working on the meat of the project. Having a good, consistent dataset will help you do your analysis more quickly. +在完成工程的主要部分之前数据清理和挖掘是十分重要的。有一个高质量的,一致的数据组将会使你的分析更加快速。 -### Computing variables +### 计算变量 -Computing variables can help speed up our analysis by enabling us to make comparisons more quickly, and enable us to make comparisons that we otherwise wouldn’t be able to do. The first thing we can do is compute a total SAT score from the individual columns `SAT Math Avg. Score`, `SAT Critical Reading Avg. Score`, and `SAT Writing Avg. Score`. In the below code, we: +计算变量可以通过使我们的比较更加快速来加快分析速度,并且能是我们做到本无法做到的比较。我们能做的第一件事就是从分开的列`SAT Math Avg. Score`, `SAT Critical Reading Avg. Score`, and `SAT Writing Avg. Score`计算SAT成绩: -* Convert each of the SAT score columns from a string to a number. -* Add together all of the columns to get the `sat_score` column, which is the total SAT score. +* 将SAT列数值从字符转转化为数字。 +* 将所有列相加以得到`sat_score`,即SAT成绩。 In [72]: ``` @@ -608,10 +612,10 @@ data['sat_results']['sat_score'] = data['sat_results'][cols[0]] + data['sat_resu ``` -Next, we’ll need to parse out the coordinate locations of each school, so we can make maps. This will enable us to plot the location of each school. In the below code, we: +接下来,我们将需要进行每所学校一致区域分析,所以我们将制作地图。这将是我们画出每所学校的位置,下面的代码,我们将会: -* Parse latitude and longitude columns from the `Location 1` column. -* Convert `lat` and `lon` to be numeric. +* 从`Location 1`列分析出经度和维度。 +* 转化`lat`(经度)和`lon`(维度)为数字。 In [73]: ``` @@ -623,7 +627,7 @@ for c in ['lat', 'lon']: ``` -Now, we can print out each dataset to see what we have: +现在,我们将输出每个数据组来查看我们有了什么数据: In [74]: ``` @@ -861,18 +865,18 @@ hs_directory ``` -### Combining the datasets +### 合并数据组 -Now that we’ve done all the preliminaries, we can combine the datasets together using the `DBN` column. At the end, we’ll have a dataset with hundreds of columns, from each of the original datasets. When we join them, it’s important to note that some of the datasets are missing high schools that exist in the `sat_results` dataset. To resolve this, we’ll need to merge the datasets that have missing rows using the `outer` join strategy, so we don’t lose data. In real-world data analysis, it’s common to have data be missing. Being able to demonstrate the ability to reason about and handle missing data is an important part of building a portfolio. +现在我们已经完成了全部准备工作,我们可以用`DBN`列将数据组合并在一起了。在最后,我们将会从原始数据组得到一个有着上百列的数据组。当我们合并它们。请注意有些数据组中会没有`sat_result`中出现的高中。为了解决这个问题,我们需要使用`outer`方法来合并缺少行的数据组,这样我们就不会丢失数据。在实际分析中,缺少数据是很常见的。能够展示解释和解决数据缺失的能力是科学投资组合的重要部分。 -You can read about different types of joins [here][25]. +你可以在[此][25]阅读关于不同类型的join。 -In the below code, we’ll: +接下来的代码,我们将会: -* Loop through each of the items in the `data` dictionary. -* Print the number of non-unique DBNs in the item. -* Decide on a join strategy – `inner` or `outer`. -* Join the item to the DataFrame `full` using the column `DBN`. +* 循环通过`data`文件夹中的每一个条目。 +* 输出条目中的DBN码。 +* 决定join类别 - `inner`或`outer`。 +* 使用`DBN`列将条目合并到数据框架`full`中。 In [75]: ``` @@ -915,19 +919,19 @@ Out[75]: (374, 174) ``` -### Enjoying this post? Learn data science with Dataquest! +### 喜欢这篇文章?通过数据查询学习数据科学! ##### -* Learn from the comfort of your browser. -* Work with real-life data sets. -* Build a portfolio of projects. +* 从浏览器舒适的学习。 +* 使用实际的数据组。 +* 建立科学组合工程。 -[Start for Free][5] +[开始免费][5] -### Adding in values +### 添加值 -Now that we have our `full` DataFrame, we have almost all the information we’ll need to do our analysis. There are a few missing pieces, though. We may want to correlate the [Advanced Placement][24] exam results with SAT scores, but we’ll need to first convert those columns to numbers, then fill in any missing values: +现在我们有了我们的`full`数据框架,我们几乎拥有分析需要的所有数据。虽然这里有一些缺少的部分。我们可能将[AP][24] 考试结果与 SAT 成绩相关联,但是我们首先需要将这些列转化为数字,然后填充缺失的数据。 In [76]: ``` @@ -940,7 +944,7 @@ full[cols] = full[cols].fillna(value=0) ``` -Then, we’ll need to calculate a `school_dist` column that indicates the school district of the school. This will enable us to match up school districts and plot out district-level statistics using the district maps we downloaded earlier: +然后我们将需要计算表示哦学校所在区域的`school_dist`列。这将是我们匹配学校区域并且使用我们之前下载的区域地图画出地区级别的地图。 In [77]: ``` @@ -948,7 +952,7 @@ full["school_dist"] = full["DBN"].apply(lambda x: x[:2]) ``` -Finally, we’ll need to fill in any missing values in `full` with the mean of the column, so we can compute correlations: +最终,我们将需要用列的平均值填充缺失的数据到`full`中。那么我们就可以计算关联了: In [79]: ``` @@ -956,9 +960,9 @@ full = full.fillna(full.mean()) ``` -### Computing correlations +### 计算关联 -A good way to explore a dataset and see what columns are related to the one you care about is to compute correlations. This will tell you which columns are closely related to the column you’re interested in. We can do this via the [corr][23] method on Pandas DataFrames. The closer to `0` the correlation, the weaker the connection. The closer to `1`, the stronger the positive correlation, and the closer to `-1`, the stronger the negative correlation`: +一个好的方法来挖掘数据并查看哪些列与你所关心的问题有联系就是计算关联。这将告诉你哪列与你所关心的列更加有关联。你可以通过Pandas DataFrame 的[corr][23]方法来完成。越接近0则关联越小。越接近1则正相关越强,越接近-1则负关联越强: In [80]: ``` @@ -1032,25 +1036,25 @@ lon -1.315241e-01 Name: sat_score, dtype: float64 ``` -This gives us quite a few insights that we’ll need to explore: +这给了我们一些我们需要探索的内在规律: -* Total enrollment correlates strongly with `sat_score`, which is surprising, because you’d think smaller schools, which focused more on the student, would have higher scores. -* The percentage of females at a school (`female_per`) correlates positively with SAT score, whereas the percentage of males (`male_per`) correlates negatively. -* None of the survey responses correlate highly with SAT scores. -* There is a significant racial inequality in SAT scores (`white_per`, `asian_per`, `black_per`, `hispanic_per`). -* `ell_percent` correlates strongly negatively with SAT scores. +* total_enrollment 与 `sat_score`强烈相关,这是令人惊讶的,因为你曾经认为越小的学校越专注与学生就会取得更高的成绩。 +* 女生所占学校的比例(`female_per`) 与SAT成绩呈正相关,而男生所占学生比例(`male_per`)成负相关。 +* 没有问卷与SAT成绩成正相关。 +* SAT成绩由明显的种族不平等(`white_per`, `asian_per`, `black_per`, `hispanic_per`)。 +* `ell_percent` 与SAT成绩明显负相关。 -Each of these items is a potential angle to explore and tell a story about using the data. +每一个条目都是一个潜在的角度来挖掘和讲述一个关于数据的故事。 -### Setting the context +### 设置上下文 -Before we dive into exploring the data, we’ll want to set the context, both for ourselves, and anyone else that reads our analysis. One good way to do this is with exploratory charts or maps. In this case, we’ll map out the positions of the schools, which will help readers understand the problem we’re exploring. +在我们开始数据挖掘之前,我们将希望设置上下文,不仅为了我们自己,也是为了其它阅读我们分析的人。一个好的方法就是建立挖掘图标或者地图。因此,我们将在地图标出所有学校的位置,这将有助于读者理解我们所探索的问题。 -In the below code, we: +在下面的代码中,我们将会: -* Setup a map centered on New York City. -* Add a marker to the map for each high school in the city. -* Display the map. +* 建立纽约市为中心的地图。 +* 为城市里的每所高中添加一个标号。 +* 显示地图。 In [82]: ``` @@ -1068,7 +1072,7 @@ schools_map Out[82]:![](https://www.dataquest.io/blog/images/storytelling/map.png) -This map is helpful, but it’s hard to see where the most schools are in NYC. Instead, we’ll make a heatmap: +这个地图十分有用,但是不容易查看纽约哪里学校最多。因此,我们将用热图来代替它: In [84]: ``` @@ -1081,15 +1085,15 @@ schools_heatmap Out[84]:![](https://www.dataquest.io/blog/images/storytelling/heatmap.png) -### District level mapping +### 区域级别映射 -Heatmaps are good for mapping out gradients, but we’ll want something with more structure to plot out differences in SAT score across the city. School districts are a good way to visualize this information, as each district has its own administration. New York City has several dozen school districts, and each district is a small geographic area. +热图能够很好的标出梯度,但是我们将需要更结构化的画出不同城市之间的SAT分数差距。学校地区是一个很好的方式图形化信息,就像每个区域都有自己的管理者。纽约市数十个学校区域,并且每个区域都是一个小的地理区域。 -We can compute SAT score by school district, then plot this out on a map. In the below code, we’ll: +我们可以通过学校区域来计算SAT分数,然后将它们画在地图上。在下面的代码中,我们将会: -* Group `full` by school district. -* Compute the average of each column for each school district. -* Convert the `school_dist` field to remove leading `0`s, so we can match our geograpghic district data. +* 通过学校区域对`full`进行分组。 +* 计算每个学校区域的每列的平均值。 +* 去掉`school_dist`头部的0,然后我们就可以匹配地理数据了。 In [ ]: ``` @@ -1099,7 +1103,7 @@ district_data["school_dist"] = district_data["school_dist"].apply(lambda x: str( ``` -We’ll now we able to plot the average SAT score in each school district. In order to do this, we’ll read in data in [GeoJSON][22] format to get the shapes of each district, then match each district shape with the SAT score using the `school_dist` column, then finally create the plot: +我们现在将可以画出SAT在每个学校区域的平均值了。因此,我们将会读取[GeoJSON][22]中的数据,转化为每个区域的形状,然后通过`school_dist`列对每个区域图形和SAT成绩进行匹配。最终我们将创建一个图形: In [85]: ``` @@ -1124,11 +1128,11 @@ show_district_map("sat_score") Out[85]:![](https://www.dataquest.io/blog/images/storytelling/district_sat.png) -### Exploring enrollment and SAT scores +### 挖掘注册人数与SAT分数 -Now that we’ve set the context by plotting out where the schools are, and SAT score by district, people viewing our analysis have a better idea of the context behind the dataset. Now that we’ve set the stage, we can move into exploring the angles we identified earlier, when we were finding correlations. The first angle to explore is the relationship between the number of students enrolled in a school and SAT score. +现在我们已经依地区画出学校位置和STA成绩确定了上下文,浏览我们分析的人将会对数据的上下文有更好的理解。现在我们已经完成了基础工作,我们可以开始从我们上面寻找关联时所提到的角度分析了。第一个分析角度是学校注册学生人数与SAT成绩。 -We can explore this with a scatter plot that compares total enrollment across all schools to SAT scores across all schools. +我们可以通过所有学校的注册学生与SAT成绩的散点图来分析。 In [87]: ``` @@ -1145,9 +1149,9 @@ Out[87]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZQAAAEQCAYAAACX5IJuAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJztnX28XVV557+/8BITSAg3KAhBgwq12FiQUWjFEmshtOOISKt0lEakONOUXiDB8tIXM9Wh+BLUzFSpKBCqMKVaEKcZSLCktZ1KNBiIRoQoOBAEJCmG15CXZ/5Y6+Tue+6595577z7n7HPu7/v5rM/Ze+23Z+9zznr2Ws/LUkRgjDHGTJQpnRbAGGNMb2CFYowxphSsUIwxxpSCFYoxxphSsEIxxhhTClYoxhhjSqGlCkXS4ZLulPR9Sd+T1J/rPyHpB5LukfT3kg4oHHOppAck3SfplEL9cZI25G2faaXcxhhjx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tIMVqFPlxRJzRCXmM6QY85GWMMaYUPORljDGmFKxQjDHGlIIVijHGmFKwQjHGGFMKVijGGGNK4f8D5wfWJYWhjXwAAAAASUVORK5CYII=) -As you can see, there’s a cluster at the bottom left with low total enrollment and low SAT scores. Other than this cluster, there appears to only be a slight positive correlation between SAT scores and total enrollment. Graphing out correlations can reveal unexpected patterns. +如你所见,底部左边低注册人数低SAT成绩有一个集群。这个集群意外,SAT成绩与全部注册人数只有轻微正相关。画出的关联显示了意想不到的图形. -We can explore this further by getting the names of the schools with low enrollment and low SAT scores: +我们可以通过获取低注册人数且低SAT成绩的学校的名字进行进一步的分析。 In [88]: ``` @@ -1172,11 +1176,11 @@ Out[88]: Name: School Name, dtype: object ``` -Some searching on Google shows that most of these schools are for students who are learning English, and are low enrollment as a result. This exploration showed us that it’s not total enrollment that’s correlated to SAT score – it’s whether or not students in the school are learning English as a second language or not. +在Google上进行了一些搜索确定了这些学校大多数是为了正在学习英语而开设的,所以由这低注册人数。这个挖掘向我们展示了并不是所有的注册人数都与SAT成绩有关联 - 这里是否由学习英语作为第二语言的学生。 -### Exploring English language learners and SAT scores +### 挖掘英语学习者和SAT成绩 -Now that we know the percentage of English language learners in a school is correlated with lower SAT scores, we can explore the relationship. The `ell_percent` column is the percentage of students in each school who are learning English. We can make a scatterplot of this relationship: +现在我们知道英语学习者所占学校学生比例与低的SAT成绩有关联,我们可以探索其中的规律。`ell_percent`列表示一个学校英语学习者所占的比例。我们可以制作关于这个关联的散点图。 In [89]: ``` @@ -1191,7 +1195,7 @@ Out[89]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZEAAAEQCAYAAABxzUkqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJztnX2cXVV577/PYBLyPpmB8pYUUKIQjEKoEAuWKA2hVkWhvlUsoBevjd4hJKgQtdIrF6GSCKlVKkIIKlSuig29ERLQaa1eiQ4Eo0kktMI1sYmSiKOBvM0894+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BCVIyEiBBCiIqREBFCCFExEiJCCCEqRkJECCFExfx/pPXgqnK8qPcAAAAASUVORK5CYII=) -It looks like there are a group of schools with a high `ell_percentage` that also have low average SAT scores. We can investigate this at the district level, by figuring out the percentage of English language learners in each district, and seeing it if matches our map of SAT scores by district: +看起来这里有一组学校有着高的`ell_percentage`值并且有这低的SAT成绩。我们可以在区域层面调查这个关系,通过找出每个区域英语学习者所占的比例,并且查看是否与我们的区域层面SAT地图所匹配: In [90]: ``` @@ -1202,11 +1206,11 @@ Out[90]: ![](https://www.dataquest.io/blog/images/storytelling/district_ell.png) -As we can see by looking at the two district level maps, districts with a low proportion of ELL learners tend to have high SAT scores, and vice versa. +我们一可通过两个区域层面地图来查看,一个低ELL(English-language)学习者比例的地区更倾向有高SAT成绩,反之亦然。 -### Correlating survey scores and SAT scores +### 关联问卷分数和SAT分数 -It would be fair to assume that the results of student, parent, and teacher surveys would have a large correlation with SAT scores. It makes sense that schools with high academic expectations, for instance, would tend to have higher SAT scores. To test this theory, lets plot out SAT scores and the various survey metrics: +学生、家长和老师的问卷结果如果与SAT分数有很大的关联的假设是合理的。就使例如具有高学术期望的学校倾向于有着更高的SAT分数是合理的。为了测这个理论,让我们画出SAT分数和多种问卷指标: In [91]: ``` @@ -1221,11 +1225,11 @@ Out[91]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX4AAAEuCAYAAACJVHkLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAGXtJREFUeJzt3XuUZWV95vHvYxPGG6CdICh2xBgYhTGKzgBRZ9KJtw5mxJgBJIkxxKgrs1AZzSzUOIKXGJNBExXHRRQRr4wOXnAFBWLSjkYU0PYOCpp2ASoSb1wMI+pv/ti75FBUVRd96uyzu97vZ61aVft23l9Xdz97n/fs992pKiRJ7bjDvAuQJA3L4Jekxhj8ktQYg1+SGmPwS1JjDH5JaszUwZ9kS5LLklye5MQltt8/yYVJbkry3EXbtif5XJJtSS6athZJ0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PVKb/rX//sMk+9HNArnvHOr4dlWdM4d2fybJBcBRVfX9fvnudM+6fezAddyD7vnD+3PrO5z+aK3bMvilNn2gD7j/STczZQFvnEMd2/rHP34AWJgzZ9DbOYG9F0K/b/x7SfYZsP0F7wf+L3ABt7z7mUmXjMEvtenLwE+q6uwkBwOHAIM/ehG4M13gP2bR+iGD/ydJ7lNVXwdIsj/zefbvnYZ6App9/FKDJvr4HwG8jO7K/0VVddicSxtcki10zwD4CN14hv8EPL2qPjRwHS8DLqyqv5t1W07ZILXpJ/333wLe0IfN7kMXkWRTkvcmubb/OjvJvYesoQ/4f0/3Lugs4DnAD4esoXcCXRfcTUmu77+um0VDdvVIbbo6yd8CjwZekeSOzOdC8Azg7cDR/fLv9esePVQBSZ4GPAvYRDdK9nDgQrpbXYe0F92f/75V9eIk92FGH7h7xS+16WjgPOAx/Qebdwf++xzq2Luqzqiqm/uvNwP3GLiGZwOHAtur6tfpPu/4wcA1ALwOOIxuqgboHgF56iwa8opfalBV3QicPbH8Tbrnvg7tO0meTPcs4NCF3r8MXMNNVfWvSUhyx6q6LMm/HbgGgMOq6pAk2wCq6rtJZtL9ZvBLmqfj6K5qF2YF/Xi/bkhX9re2vg+4IMn3gO0D1wDwo37qCACS7M2M7i7yrh5Jc5PkTOCEqvpev7wROGUWg5ZWWc9muikbPrSKZ/Guddu/T9cF91DgTLq5el5YVe9a87YMfknzsjD75I7WtSLJA4BH9osfrqpLZ9GOXT2S5ilJNlbVd/uFjcxnLvxR6IN+JmE/yeCXNE+vBC5M8i66D3ePAv58viWtf3b1SJqrfsqI36Cbl+YfqupLcy5p3TP4JakxDuCSpMYY/JLUGINfkhpj8EtSY/4/UzeqepUNQsYAAAAASUVORK5CYII=) -Surprisingly, the two factors that correlate the most are `N_p` and `N_s`, which are the counts of parents and students who responded to the surveys. Both strongly correlate with total enrollment, so are likely biased by the `ell_learners`. The other metric that correlates most is `saf_t_11`. That is how safe students, parents, and teachers perceived the school to be. It makes sense that the safer the school, the more comfortable students feel learning in the environment. However, none of the other factors, like engagement, communication, and academic expectations, correlated with SAT scores. This may indicate that NYC is asking the wrong questions in surveys, or thinking about the wrong factors (if their goal is to improve SAT scores, it may not be). +惊人的,关联最大的两个事实是`N_p`和`N_s`,分别是家长和学生回应的问卷。都与注册人数有着很强的关联,所以很可能偏离了`ell_learner`。此外指标关联最强的就是`saf_t_11`。就是学生、家长和老师对学校安全程度的感知。这说明了,越安全的学校,更能让学生在环境里安心学习。然而其它因子,像互动,交流和学术水平都与SAT分数无关,这也许表明了纽约在问卷中问了不理想的问题或者想错了因子(如果他们的目的是提高SAT分数的话)。 -### Exploring race and SAT scores +### 挖掘种族和SAT分数 -One of the other angles to investigate involves race and SAT scores. There was a large correlation differential, and plotting it out will help us understand what’s happening: +其中一个就读就是调查种族和SAT分数的联系。这是一个大相关微分,并且将其画出来帮助我们理解到底发生了什么: In [92]: ``` @@ -1240,7 +1244,7 @@ Out[92]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXcAAAE0CAYAAADXDHM8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAGAdJREFUeJzt3X20JVV95vHvY7eACoQYFJSXEBURdDBoRHSMtm+BqIHENwYd3+IoMwY1zhoD6Epsk5iMZmmMulQGWcBoVhxRJ2JUEAkdUREFEURpBBUDGMhoRISggv7mj6qGy+Xee7pv3e7q2v39rMXiVp19Tv0ozn3uPrvq7J2qQpLUlruNXYAkaeUZ7pLUIMNdkhpkuEtSgwx3SWqQ4S5JDRoc7kkOS7I+yRVJjl3g8V2TnJHkq0kuTfLioceUJC0tQ+5zT7IKuBx4CnAt8GXgqKq6bE6btcD2VXV8kl379rtV1W1DCpckLW5oz/1g4MqquqqqbgU+CBwxr82/ADv3P+8M/MBgl6TNa/XA5+8BXD1n+xrg0fPanAj8Y5LvATsBzx14TEnSDEPDfWPGdF4HfLWq1iR5IHBWkodX1Y/nNkriPAiStAxVlfn7hob7tcBec7b3ouu9z/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+Anw3/qFen4yck3L5gVVSeol+RXghqr6eZJ7ATtV1XVj17Uc9twlbdMWWt83d8xDXUx0CUjDXdK2rsn1fR2WkSS6uY6AZwH7MKfjW1VvHKumIey5S1LnY8ANdBOvTfZC6gb23CWJbjrqqnrY2HWsFO9zl6TOF5IcOHYRK8Weu6Rt2pzpk1cB+9LN/rphBaaqqkkGvuEuaZs2Y/pkquqqLVLICjPcJalBjrlLUoMMd0lqkOEuSQ0y3CWpQf8f9xOebfTGNUUAAAAASUVORK5CYII=) -It looks like the higher percentages of white and asian students correlate with higher SAT scores, but higher percentages of black and hispanic students correlate with lower SAT scores. For hispanic students, this may be due to the fact that there are more recent immigrants who are ELL learners. We can map the hispanic percentage by district to eyeball the correlation: +看起来更高的白种和亚洲学生与更高的SAT分数有关联,但是更高的黑人和西班牙裔与更低的SAT分数有关联。对于西班牙学生,这可能因为近年的移民还是英语学习者的事实。我们可以标出区层面的西班牙裔的比例并观察联系。 In [93]: ``` @@ -1252,11 +1256,11 @@ Out[93]: ![](https://www.dataquest.io/blog/images/storytelling/district_hispanic.png) -It looks like there is some correlation with ELL percentage, but it will be necessary to do some more digging into this and other racial differences in SAT scores. +看起来这里与英语学习者比例有关联,但是这将有必要做一些挖掘这种和在SAT分数上的其它种族差异。 -### Gender differences in SAT scores +### SAT分数上的性别差异` -The final angle to explore is the relationship between gender and SAT score. We noted that a higher percentage of females in a school tends to correlate with higher SAT scores. We can visualize this with a bar graph: +挖掘性别与SAT分数之间的关系是最后一个角度。我们注意学校更高的女生比例倾向于与更高的SAT分数有关联。我们可以可视化为一个条形图: In [94]: ``` @@ -1271,7 +1275,7 @@ Out[94]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX4AAAEuCAYAAACJVHkLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAEvlJREFUeJzt3X+s3XV9x/Hny9Zl1mgYDiliEScgsmhgi6DOxJv4Ix0kxWVOgyQ6ZpRlQ92iC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+SWrM/wMaCBh+0KRiFQAAAABJRU5ErkJggg==) -To dig more into the correlation, we can make a scatterplot of `female_per` and `sat_score`: +为了在关联中挖掘更多,我们可以制作一个`female_per`和`sat_score`的散点图: In [95]: ``` @@ -1286,7 +1290,7 @@ Out[95]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZEAAAEQCAYAAABxzUkqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJztnXucXWV577/PhBAyCclkJpZbECgXMRgVqCQWkHjhUrUgUC89QiNYLI12gAwqxGPlVEq1CGLag1QUCFo4pQoIH9MQ9JhTPVWi4Ra5SHIUSmIDkogjlyRD5jl/vO/KXnvP2jN79m3tPfv3/Xzez6z9rrXe9ay197zPet/n8pq7I4QQQlRDV94CCCGEaF+kRIQQQlSNlIgQQoiqkRIRQghRNVIiQgghqkZKRAghRNU0VImY2f5m9n0ze8TMfmZm/bH+SjN7zMweMrPbzWxm6pxLzWy9mT1uZiel6o82s3Vx35caKbcQQojKsEbGiZjZ3sDe7v6gmU0H1gLvAeYA33P3YTP7HIC7X2Jmc4FbgDcB+wHfBQ51dzezNcDH3H2Nma0Alrn7yoYJL4QQYkwaOhJx983u/mDcfgF4DNjX3e919+F42H0EpQJwGnCruw+5+5PABmC+me0D7Onua+JxNxOUkRBCiBxpmk3EzA4EjiQojTTnAivi9r7AxtS+jYQRSWn9plgvhBAiR5qiROJU1jeBC+KIJKn/FLDD3W9phhxCCCHqy26NvoCZTQa+BXzD3e9M1X8IeCfw9tThm4D9U5/nEEYgmyhMeSX1mzKupURgQggxTtzdajm5YQUwgv3iiyX1pwCPALNL6ucCDwK7AwcB/4+C8f8+YH5scwVwSsb1vJH30+BndVneMkj+/OWQ/O1Z2ln+WvvNRo9EjgXOAh42swdi3VJgWVQU95oZwI/cfbG7P2pmtwGPAq8Aiz3eJbAYuAmYCqxweWYJIUTuNFSJuPsPyba7HDrKOVcAV2TUrwXm1U86IYQQtaK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4DozmxLbfd7djyEsFHReXM8Fwpou/e5eVjkJ0Qg0nSU6HQNOJqSHvzjWTQFeTejMv+/uLwIvmtnzhGyzEJIHvj5uzzOzywmJEKcDK4suEBaN+kPgX0PiWgB2H0Ou2wDcfYOZ/QI4HDgpXutP4jEzgEOAV4A17v7UeG5ciHogJSJE4Ax3X5+uMLP5wPZU1XDqs1P4/7kJONXd15nZIsLoJk0X8Bt3P7IG+ZIRzcc8rASYlnMhYXEqIZqOprOEgHuA/uSDmSWdfebKhxlMJyyqNBk4i0KHb4B5WPXxl8kIwgKvz25q13nvjccdTLDdPB7lXBzXJsfMDktNuwmRC1IiopNJljX9LDDZzB42s58B/6Nkf/r40nMBPk1YY/6HBJtI1jEfBD5sZg8CPwNOHUOu/yQsBrQC+At33wF8lbCA0/1mtg74MmE01FbLyYqJhdYTEaLFMLMbgbvd/fa8ZRFiLDQSEUIIUTUyrAuRE2a2FHhvSfVt7n5OHvIIUQ2azhJCCFE1ms4SQghRNVIiQgghqkZKRAghRNVIiQghhKgaKREhhBBV8/8Bq3PAsBX5v8AAAAAASUVORK5CYII=) -It looks like there’s a cluster of schools with a high percentage of females, and very high SAT scores (in the top right). We can get the names of the schools in this cluster: +看起来这里有一个高女生比例高SAT成绩的簇(右上角)。我们可以获取簇中学校的名字: In [96]: ``` @@ -1306,11 +1310,11 @@ Out[96]: Name: School Name, dtype: object ``` -Searching Google reveals that these are elite schools that focus on the performing arts. These schools tend to have higher percentages of females, and higher SAT scores. This likely accounts for the correlation between higher female percentages and SAT scores, and the inverse correlation between higher male percentages and lower SAT scores. +使用Google进行搜索可以得到这些是专注于表演艺术的精英学校。这些学校有着更高比例的女生和更高的SAT分数。这可能解释了更高的女生比例和SAT分数的关联,并且相反的更高的男生比例与更低的SAT分数。 -### AP scores +### AP成绩 -So far, we’ve looked at demographic angles. One angle that we have the data to look at is the relationship between more students taking Advanced Placement exams and higher SAT scores. It makes sense that they would be correlated, since students who are high academic achievers tend to do better on the SAT. +至今,我们将关注人口统计角度。一个我们通过数据来看参加高阶测试的学生和SAT分数的角度。因为高学术获得者倾向于有着高的SAT分数说明了它们是有关联的。 In [98]: ``` @@ -1327,7 +1331,7 @@ Out[98]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAY8AAAEPCAYAAAC6Kkg/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJztnX+cXFV5/9/PkiXkd7LBLwihghqqwSCQQtKCusoXiPUHCK1YhaJQ1MZ2gSQqpChppal+aSKmFqkRQmiFSqVgbGNIpG5LrRANBAKBklRBEgpKAgTyiyT7fP84ZzJ3Zmd278zOzJ3Z/bxfr/PKvWfOvfeZSXKee55fx9wdIYQQohLashZACCFE6yHlIYQQomKkPIQQQlSMlIcQQoiKkfIQQghRMVIeQgghKqauysPMjjKzH5nZY2b2qJl1xf7rzOxxM3vYzP7ZzMYlrrnKzDaa2RNmdmaif5qZrY+ffa2ecgshhOgbq2eeh5kdDhzu7uvMbDSwFjgHmATc6+49ZvZlAHe/0symALcBJwNHAj8EJru7m9ka4E/cfY2ZrQAWu/vKugkvhBCiLHVdebj7c+6+Lh6/CjwOHOHuq929Jw57gKBMAM4Gbnf3ve7+FLAJmG5mrwfGuPuaOO5WghISQgiRAQ3zeZjZ0cCJBGWR5GJgRTw+Atic+GwzYQVS3L8l9gshhMiAhiiPaLL6LnBZXIHk+v8MeM3db2uEHEIIIWrDsHo/wMzagTuBf3D3uxP9Hwd+Fzg9MXwLcFTifBJhxbGFvGkr17+lxLNUqEsIISrE3a2ai+rWACP4J75a1D8TeAw4tKh/CrAOOBg4Bvgf8k79B4Dp8Z4rgJklnuf1/D51/q3mZy2D5M9eDsnfmq2V5a923qz3yuNU4ALgETN7KPbNAxZHBbHazAB+4u6z3H2Dmd0BbAD2AbM8fjtgFnALMAJY4Yq0EkKIzKir8nD3/6S0X2VyH9csABaU6F8LTK2ddEIIIapFGebNQ3fWAgyQ7qwFGCDdWQswQLqzF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QQomKkPIQQQlSMlIcQQoiKkfIQQghRMVIeQqTAzO6KlUYfNbNLY9+rZrYo9v3QzA7t4/pLzWyNma0zs++a2QgzG2dmTyXGjDKzX8byECfHDakeMrPrrEk2MxMih5SHEOm42N1/CzgZ6DKzDkLl0Z+6+9uAfweu6eP6O939FHc/AXgcuMTDviHrzKwzjnk/sNLd9xPKc1zq7icC+2j9isZikCHlIUQ6LjOzdcBPCJWOJwM9wHfi5/8AnNbH9VPN7D4zewT4GJDb6+E7hCJ1AB8BvmNhS+XRHjYDA7iN5iw0KYYwUh5C9ENcGZxOKHR3AqHw3SG5jxN/9rU6uAWY5e7HA38OjIj93wdmmtkEwl4K/1ZKhIHIL0Q9kPIQon/GAi+6+24zeyswI/a3Ab8Xjz9KqGJbjtHAc2bWDlyQ63T3V4GfAouB73vgJeCVWNYbwopEiKaiqTeDEqJJWAl82sw2EEpa/yT27wBOMbOrCVshn1/meoAvEPZE/3X8c3Tis+8AdwCdib5LgCVm1kPwp7yMEE2ESrILUSVm9oq7j6nTvUe5+454fCVwmLtfUY9nCVENWnkIUT31fPN6n5ldRfg/+hTw8To+S4iK0cpDiBpiZl8HTi3qvt7dl2UhjxD1QspDCCFExSjaSgghRMVIeQghhKgYKQ8hhBAVI+UhhBCiYqQ8hBBCVMz/B9n2P5AJnyYcAAAAAElFTkSuQmCC) -It looks like there is indeed a strong correlation between the two. An interesting cluster of schools is the one at the top right, which has high SAT scores and a high proportion of students that take the AP exams: +看起来它们之间确实有着很强的关联。有趣的是右上角高SAT分数的学校有着高的AP测试通过比例: In [99]: ``` @@ -1348,24 +1352,24 @@ Out[99]: Name: School Name, dtype: object ``` -Some Google searching reveals that these are mostly highly selective schools where you need to take a test to get in. It makes sense that these schools would have high proportions of AP test takers. +功过google搜索解释了大多数高选择性的学校你需要经过测试才能进入。这就说明了为什么这些学校会有高的AP通过人数。 -### Wrapping up the story +### 包装故事 -With data science, the story is never truly finished. By releasing analysis to others, you enable them to extend and shape your analysis in whatever direction interests them. For example, in this post, there are quite a few angles that we explored inmcompletely, and could have dived into more. +在数据科学中,故事不可能真正完结。通过向其他人发布分析,你允许它们拓展并且运用你的分析到他们所感兴趣的方向。比如在本文中,这里有一些角度我们没有完成并且可以探索更加深入。 -One of the best ways to get started with telling stories using data is to try to extend or replicate the analysis someone else has done. If you decide to take this route, you’re welcome to extend the analysis in this post and see what you can find. If you do this, make sure to comment below so I can take a look. +一个最好的方式开始讲述故事就是尝试拓展或者复制别人已经完成的分析。如果你觉得采取这个方式,你被欢迎拓展这篇文章的分析并得知你的收获。如果你确实这么做了,请在下面评论,那么我就可以看到了。 -### Next steps +### 下一步 -If you’ve made it this far, you hopefully have a good understanding of how to tell a story with data, and how to build your first data science portfolio piece. Once you’re done with your data science project, it’s a good idea to post it on [Github][21] so others can collaborate with you on it. +如果你做的足够多,你将很有希望对讲一个关于数据的故事和构建你的第一个数据科学组合有很好的理解。一旦你完成了你的数据科学工程,发表在[Github][21]上是一个好的想法,这样别人就能够与你一起合作。 -_If you liked this, you might like to read the other posts in our ‘Build a Data Science Portfolio’ series:_ +_如果你洗管这篇文章,你可能希望阅读我们‘Build a Data Science Portfolio’系列文章的其它部分:_ -* _[How to setup up a data science blog][4]._ -* _[Building a machine learning project][3]._ -* _[The key to building a data science portfolio that will get you a job][2]._ -* _[17 places to find datasets for data science projects][1]_ +* _[如何建立一个数据科学博客][4]._ +* _[建立一个机器学习工程][3]._ +* _[将帮助你的到工作的数据科学组合的关键]._ +* _[17 你能找到其它数据科学工程数据组的地方]._ -------------------------------------------------------------------------------- @@ -1374,7 +1378,7 @@ via: https://www.dataquest.io/blog/data-science-portfolio-project/ 作者:[Vik Paruchuri ][a] -译者:[译者ID](https://github.com/译者ID) +译者:[Yoo-4x] 校对:[校对者ID](https://github.com/校对者ID) diff --git a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md b/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md deleted file mode 100644 index 1bce0fd22a..0000000000 --- a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md +++ /dev/null @@ -1,1088 +0,0 @@ -一个使用asyncio协程的网络爬虫 -=== - - -## 介绍 - -经典的计算机科学强调高效的算法,尽可能快地完成计算。但是很多网络程序的时间并不是消耗在计算上,而是在等待许多慢速的连接或者低频事件的发生。这些程序暴露出一个新的挑战:如何高效的等待大量网络事件。一个现代的解决方案是异步I/O。 - -这一章我们将实现一个简单的网络爬虫。这个爬虫只是一个原型式的异步应用,因为它等待许多响应而只做少量的计算。一次爬的网页越多,它就能越快的完成任务。如果它为每个动态的请求启动一个线程的话,随着并发请求数量的增加,它会在耗尽套接字之前,耗尽内存或者线程相关的资源。使用异步I/O可以避免这个的问题。 - -我们将分三个阶段展示这个例子。首先,我们会实现一个事件循环并用这个事件循环和回调来勾画出一个网络爬虫。它很有效,但是当把它扩展成更复杂的问题时,就会导致无法管理的混乱代码。然后,由于Python的协程不仅有效而且可扩展,我们将用Python的生成器函数实现一个简单的协程。在最后一个阶段,我们将使用Python标准库"asyncio"中功能完整的协程和异步队列完成这个网络爬虫。 - -## 任务 - -网络爬虫寻找并下载一个网站上的所有网页,也许还会把它们存档,为它们建立索引。从根URL开始,它获取每个网页,解析出没有遇到过的链接加到队列中。当网页没有未见到过的链接并且队列为空时,它便停止运行。 - -我们可以通过同时下载大量的网页来加快这一过程。当爬虫发现新的链接,它使用一个新的套接字并行的处理这个新链接,解析响应,添加新链接到队列。当并发很大时,可能会导致性能下降,所以我们会限制并发的数量,在队列保留那些未处理的链接,直到一些正在执行的任务完成。 - -## 传统方式 - -怎么使一个爬虫并发?传统的做法是创建一个线程池,每个线程使用一个套接字在一段时间内负责一个网页的下载。比如,下载xkcd.com网站的一个网页: - -```python -def fetch(url): - sock = socket.socket() - sock.connect(('xkcd.com', 80)) - request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(url) - sock.send(request.encode('ascii')) - response = b'' - chunk = sock.recv(4096) - while chunk: - response += chunk - chunk = sock.recv(4096) - - # Page is now downloaded. - links = parse_links(response) - q.add(links) -``` - -套接字操作默认是阻塞的:当一个线程调用一个类似`connect`和`recv`方法时,它会阻塞,直到操作完成.[^15]因此,为了同一时间内下载多个网页,我们需要很多线程。一个复杂的应用会通过线程池保持空闲的线程来分摊创建线程的开销。同样的做法也适用于套接字,使用连接池。 - -到目前为止,线程是昂贵的,操作系统对一个进程,一个用户,一台机器能使用线程做了不同的硬性限制。在Jesse系统中,一个Python线程需要50K的内存,开启上万个线程会失败。每个线程的开销和系统的限制就是这种方式的瓶颈所在。 - -在Dan Kegel那一篇很有影响力的文章"The C10K problem"[^8]中,它提出多线程方式在I/O并发上的局限性。他在开始写道, - ->是时候网络服务器要同时处理成千上万的客户啦,你不这样认为么?毕竟,现在网络是个很大的地方。 - -Kegel在1999年创造出"C10K"术语。一万个连接在今天看来还是可接受的,但是问题依然存在,只不过大小不同。回到那时候,对于C10K问题,每个连接启一个线程是不切实际的。现在这个限制已经成指数级增长。确实,我们的玩具网络爬虫使用线程也可以工作的很好。但是,对于有着千万级连接的大规模应用来说,限制依然存在:会消耗掉所有线程,即使套接字还够用。那么我们该如何解决这个问题? - -## 异步 - -异步I/O框架在一个线程中完成并发操作。让我们看看这是怎么做到的。 - -异步框架使用*非阻塞*套接字。异步爬虫中,我们在发起到服务器的连接前把套接字设为非阻塞: - -```python -sock = socket.socket() -sock.setblocking(False) -try: - sock.connect(('xkcd.com', 80)) -except BlockingIOError: - pass -``` - -对一个非阻塞套接字调用`connect`方法会立即抛出异常,即使它正常工作。这个异常模拟了底层C语言函数的行为,它把`errno`设置为`EINPROGRESS`,告诉你操作已经开始。 - -现在我们的爬虫需要一种知道连接何时建立的方法,这样它才能发送HTTP请求。我们可以简单地使用循环来重试: - -```python -request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(url) -encoded = request.encode('ascii') - -while True: - try: - sock.send(encoded) - break # Done. - except OSError as e: - pass - -print('sent') -``` - -这种方法不仅消耗CPU,也不能有效的等待*多个*套接字。在远古时代,BSD Unix的解决方法是`select`,一个C函数,它在一个或一组非阻塞套接字上等待事件发生。现在,互联网应用大量连接的需求,导致`select`被`poll`代替,以及BSD的`kqueue`和Linux的`epoll`。它们的API和`select`相似,但在大数量的连接中也能有较好的性能。 - -Python 3.4的`DefaultSelector`使用你系统上最好的类`select`函数。去注册一个网络I/O事件,我们创建一个非阻塞套接字,并使用默认的selector注册。 - -```python -from selectors import DefaultSelector, EVENT_WRITE - -selector = DefaultSelector() - -sock = socket.socket() -sock.setblocking(False) -try: - sock.connect(('xkcd.com', 80)) -except BlockingIOError: - pass - -def connected(): - selector.unregister(sock.fileno()) - print('connected!') - -selector.register(sock.fileno(), EVENT_WRITE, connected) -``` - -我们不理会这个伪造的错误,调用`selector.register`,传递套接字文件描述符,一个表示我们想要监听什么事件的常量。为了当连接建立时收到提醒,我们使用`EVENT_WRITE`:它表示什么时候这个套接字可写。我们还传递了一个Python函数,`connected`,当对应事件发生时被调用。这样的函数被称为*回调*。 - -我们在一个循环中处理I/O提醒,随着selector接收到它们。 - -```python -def loop(): - while True: - events = selector.select() - for event_key, event_mask in events: - callback = event_key.data - callback() -``` - -`connected`回调函数被保存在`event_key.data`中,一旦这个非阻塞套接字建立连接,它就会被取出来执行。 - -不像我们前面那个快速重试的循环,这里的`select`调用会阻塞,等待下一个I/O事件,接着执行等待这个事件的回调函数。 - -到目前为止我们展现了什么?我们展示了如何开始一个I/O操作和当操作准备好时调用回调函数。异步*框架*,它在单线程中执行并发操作,建立在两个功能之上,非阻塞套接字和事件循环。 - -## 回调 - -用我们刚刚建立的异步框架,怎么才能完成一个网络爬虫?即使是一个简单的网页下载程序也是很难写的。 - -首先,我们有一个未获取的URL集合,和一个已经解析过的URL集合。 - -```python -urls_todo = set(['/']) -seen_urls = set(['/']) -``` - -这两个集合加在一起就是所有的URL。用"/"初始化它们。 - -获取一个网页需要一系列的回调。在套接字连接建立时`connected`回调触发,它向服务器发送一个GET请求。但是它要等待响应,所以我们需要注册另一个回调函数,当回调被调用,它也不能一次读取完整的请求,所以,需要再一次注册,如此反复。 - -让我们把这些回调放在一个`Fetcher`对象中,它需要一个URL,一个套接字,还需要一个地方保存返回的字节: - -```python -class Fetcher: - def __init__(self, url): - self.response = b'' # Empty array of bytes. - self.url = url - self.sock = None -``` - -我们的入口点在`Fetcher.fetch`: - -```python - # Method on Fetcher class. - def fetch(self): - self.sock = socket.socket() - self.sock.setblocking(False) - try: - self.sock.connect(('xkcd.com', 80)) - except BlockingIOError: - pass - - # Register next callback. - selector.register(self.sock.fileno(), - EVENT_WRITE, - self.connected) -``` - -`fetch`方法从连接一个套接字开始。但是要注意这个方法在连接建立前就返回了。它必须返回到事件循环中等待连接建立。为了理解为什么要要这样,假设我们程序的整体结构如下: - -```python -# Begin fetching http://xkcd.com/353/ -fetcher = Fetcher('/353/') -fetcher.fetch() - -while True: - events = selector.select() - for event_key, event_mask in events: - callback = event_key.data - callback(event_key, event_mask) -``` - -所有的事件提醒都在事件循环中的`select`函数后处理。所以`fetch`必须把控制权交给事件循环。这样我们的程序才能知道什么时候连接已建立,接着循环调用`connected`回调,它已经在`fetch`方法中注册过。 - -这里是我们`connected`方法的实现: - -```python - # Method on Fetcher class. - def connected(self, key, mask): - print('connected!') - selector.unregister(key.fd) - request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(self.url) - self.sock.send(request.encode('ascii')) - - # Register the next callback. - selector.register(key.fd, - EVENT_READ, - self.read_response) -``` - -这个方法发送一个GET请求。一个真正的应用会检查`send`的返回值,以防所有的信息没能一次发送出去。但是我们的请求很小,应用也不复杂。它只是简单的调用`send`,然后等待响应。当然,它必须注册另一个回调并把控制权交给事件循环。接下来也是最后一个回调函数`read_response`,它处理服务器的响应: - -```python - # Method on Fetcher class. - def read_response(self, key, mask): - global stopped - - chunk = self.sock.recv(4096) # 4k chunk size. - if chunk: - self.response += chunk - else: - selector.unregister(key.fd) # Done reading. - links = self.parse_links() - - # Python set-logic: - for link in links.difference(seen_urls): - urls_todo.add(link) - Fetcher(link).fetch() # <- New Fetcher. - - seen_urls.update(links) - urls_todo.remove(self.url) - if not urls_todo: - stopped = True -``` - -这个回调在每次selector发现套接字*可读*时被调用,可读有两种情况:套接字接受到数据或它被关闭。 - -这个回调函数从套接字读取4K数据。如果没有4k,那么有多少读多少。如果比4K多,`chunk`只包4K数据并且这个套接字保持可读,这样在事件循环的下一个周期,会在次回到这个回调函数。当响应完成时,服务器关闭这个套接字,`chunk`为空。 - -没有展示的`parse_links`方法,它返回一个URL集合。我们为每个新的URL启动一个fetcher。注意一个使用异步回调方式编程的好处:我们不需要为共享数据加锁,比如我们往`seen_urls`增加新链接时。这是一种非抢占式的多任务,它不会在我们代码中的任意一个地方中断。 - -我们增加了一个全局变量`stopped`,用它来控制这个循环: - -```python -stopped = False - -def loop(): - while not stopped: - events = selector.select() - for event_key, event_mask in events: - callback = event_key.data - callback() -``` - -一旦所有的网页被下载下来,fetcher停止这个事件循环,程序退出。 - -这个例子让异步编程的一个问题明显的暴露出来:意大利面代码。 - -我们需要某种方式来表达一串计算和I/O操作,并且能够调度多个这样的操作让他们并发的执行。但是,没有线程你不能把这一串操作写在一个函数中:当函数开始一个I/O操作,它明确的把未来所需的状态保存下来,然后返回。你需要考虑如何写这个状态保存的代码。 - -让我们来解释下这到底是什么意思。考虑在线程中使用通常的阻塞套接字来获取一个网页时是多么简单。 - -```python -# Blocking version. -def fetch(url): - sock = socket.socket() - sock.connect(('xkcd.com', 80)) - request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(url) - sock.send(request.encode('ascii')) - response = b'' - chunk = sock.recv(4096) - while chunk: - response += chunk - chunk = sock.recv(4096) - - # Page is now downloaded. - links = parse_links(response) - q.add(links) -``` - -在一个套接字操作和下一个操作之间这个函数到底记住了什么?它有一个套接字,一个URL和一个可增长的`response`。运行在线程中的函数使用编程语言的基本功能,栈中的局部变量来保存临时的状态。这样的函数有一个"continuation"----在I/O结束后它要执行的代码。运行时通过线程的指令指针来记住这个continuation。你不必考虑怎么在I/O操作后恢复局部变量和这个continuation。语言本身的特性帮你解决。 - -但是用一个基于回调的异步框架,这些语言特性不能提供一点帮助。当等待I/O操作时,一个函数必须明确的保存它的状态,因为它会在I/O操作完成之前返回并清除栈帧。为了在我们基于回调的例子中代替局部变量,我们把`sock`和`response`作为Fetcher实例`self`属性。为了代替指令指针,它通过注册`connnected`和`read_response`回调来保存continuation。随着应用功能的增长,我们手动保存回调的复杂性也会增加。如此繁复的记账式工作会让编码者感到头痛。 - -更糟糕的是,当我们的回调函数抛出异常会发生什么?假设我们没有写好`parse_links`方法,它在解析HTML时抛出异常: - -``` -Traceback (most recent call last): - File "loop-with-callbacks.py", line 111, in - loop() - File "loop-with-callbacks.py", line 106, in loop - callback(event_key, event_mask) - File "loop-with-callbacks.py", line 51, in read_response - links = self.parse_links() - File "loop-with-callbacks.py", line 67, in parse_links - raise Exception('parse error') -Exception: parse error -``` - -这个堆栈回溯只能显示出事件循环调用了一个回调。我们不知道是什么导致了这个错误。这条链的两边都被破坏:不知道从哪来也不知到哪去。这种丢失上下文的现象被称为"stack ripping",它还会阻止我们为回调链设置异常处理。 - -所以,除了关于多线程和异步那个更高效的争议,还有一个关于这两者之间的争论,谁更容易出错。如果在同步上出现失误,线程更容易出现数据竞争的问题,而回调因为"stack ripping"问题而非常难于调试。 - -## 协程 - -还记得我们对你许下的承诺么?我们可以写出这样的异步代码,它既有回调方式的高效,也有多线程代码的简洁。这个结合是同过一种称为协程的模式来实现的。使用Python3.4标准库asyncio和一个叫"aiohttp"的包,在协程中获取一个网页是非常直接的[^10]: - -```python - @asyncio.coroutine - def fetch(self, url): - response = yield from self.session.get(url) - body = yield from response.read() -``` - -它也是可扩展的。在Jesse系统上,与每个线程50k内存相比,一个Python协程只需要3k内存。Python很容易就可以启动上千个协程。 - -协程的概念可以追溯到计算机科学的远古时代,它很简单,一个可以暂停和恢复的子过程。线程是被操作系统控制的抢占式多任务,而协程是可合作的,它们自己选择什么时候暂停去执行下一个协程。 - -有很多协程的实现。甚至在Python中也有几种。Python3.4标准库asyncio中的协程,它是建立在生成器,一个Future类和"yield from"语句之上。从Python3.5开始,协程变成了语言本身的特性。然而,理解Python3.4中这个通过语言原有功能实现的协程,是我们处理Python3.5中原生协程的基础。 - -## 生成器如何工作 - -在你理解生成器之前,你需要知道普通的Python函数是怎么工作的。当一个函数调用一个子过程,这个被调用函数获得控制权。直到它返回或者有异常发生,才把控制权交给调用者: - -```python ->>> def foo(): -... bar() -... ->>> def bar(): -... pass -``` - -标准的Python解释器是C语言写的。一个Python函数被调用对应的C函数是`PyEval_EvalFrameEx`。它获得一个Python栈帧结构并在这个栈帧的上下文中执行Python字节码。这里是`foo`的字节码: - -```python ->>> import dis ->>> dis.dis(foo) - 2 0 LOAD_GLOBAL 0 (bar) - 3 CALL_FUNCTION 0 (0 positional, 0 keyword pair) - 6 POP_TOP - 7 LOAD_CONST 0 (None) - 10 RETURN_VALUE -``` - -`foo`函数在它栈中加载`bar`并调用它,然后把`bar`的返回值从栈中弹出,加载`None`值并返回。 - -当`PyEval_EvalFrameEx`遇到`CALL_FUNCTION`字节码时,它会创建一个新的栈帧,并用这个栈帧递归的调用`PyEval_EvalFrameEx`来执行`bar`函数。 - -图 - -非常重要的一点是,Python的栈帧在堆中分配!Python解释器是一个标准的C程序,所以他的栈帧是正常的栈帧。但是Python的栈帧是在堆中处理。这意味着Python栈帧在函数调用结束后依然可以存在。我们在`bar`函数中保存当前的栈帧,交互式的看看这种现象: - -```python ->>> import inspect ->>> frame = None ->>> def foo(): -... bar() -... ->>> def bar(): -... global frame -... frame = inspect.currentframe() -... ->>> foo() ->>> # The frame was executing the code for 'bar'. ->>> frame.f_code.co_name -'bar' ->>> # Its back pointer refers to the frame for 'foo'. ->>> caller_frame = frame.f_back ->>> caller_frame.f_code.co_name -'foo' -``` - -现在该说Python生成器了,它使用同样构件--code object和栈帧--去完成一个不可思议的任务。 - -这是一个生成器函数: - -```python ->>> def gen_fn(): -... result = yield 1 -... print('result of yield: {}'.format(result)) -... result2 = yield 2 -... print('result of 2nd yield: {}'.format(result2)) -... return 'done' -... -``` - -在Python把`gen_fn`编译成字节码的过程中,一旦它看到`yield`语句就知道这是一个生成器函数而不是普通的函数。它就会设置一个标志来记住这个事实: - -```python ->>> # The generator flag is bit position 5. ->>> generator_bit = 1 << 5 ->>> bool(gen_fn.__code__.co_flags & generator_bit) -True -``` - -当你调用一个生成器函数,Python看到这个标志,就不会运行它而是创建一个生成器: - -```python ->>> gen = gen_fn() ->>> type(gen) - -``` - -Python生成器封装了一个栈帧和函数体代码: - -```python ->>> gen.gi_code.co_name -'gen_fn' -``` - -所有通过调用`gen_fn`的生成器指向同一段代码,但都有各自的栈帧。这些栈帧不再任何一个C函数栈中,而是在堆空间中等待被使用: - -图 - -栈帧中有一个指向最后执行指令的指针。初始化为-1,意味着它没开始运行: - -```python ->>> gen.gi_frame.f_lasti --1 -``` - -当我们调用`send`时,生成器一直运行到第一个`yield`语句处停止。并且`send`返回1,yield语句后的表达式的值。 - -```python ->>> gen.send(None) -1 -``` - -现在生成器的指令指针是3,字节码一共有56个字节: - -```python ->>> gen.gi_frame.f_lasti -3 ->>> len(gen.gi_code.co_code) -56 -``` - -这个生成器可以在任何时候,任何函数中恢复运行,因为它的栈帧并不在真正的栈中,而是堆中。在调用链中它的位置也是不确定的,它不必遵循普通函数先进后出的顺序。它像云一样自由。 - -我们可以传递一个`hello`给生成器,它会成为yield语句的结果,并且生成器运行到第二个yield语句处。 - -```python ->>> gen.send('hello') -result of yield: hello -2 -``` - -现在栈帧中包含局部变量`result`: - -```python ->>> gen.gi_frame.f_locals -{'result': 'hello'} -``` - -其它从`gen_fn`创建的生成器有着它自己的栈帧和局部变量。 - -当我们在一次调用`send`,生成器从第二个yield开始运行,以抛出一个特殊的`StopIteration`异常为结束。 - -```python ->>> gen.send('goodbye') -result of 2nd yield: goodbye -Traceback (most recent call last): - File "", line 1, in -StopIteration: done -``` - -这个异常有一个值"done",它就是生成器的返回值。 - -## 使用生成器构建协程 - -所以生成器可以暂停,可以给它一个值让它恢复,并且它还有一个返回值。这些特性看起来很适合去建立一个不使用回调的异步编程模型。我们想创造一个协程:一个在程序中可以和其他过程合作调度的过程。我们的协程将会是标准库`asyncio`中协程的一个简化版本,我们将使用生成器,futures和`yield from`语句。 - -首先,我们需要一种方法去代表协程需要等待的未来事件。一个简化的版本是: - -```python -class Future: - def __init__(self): - self.result = None - self._callbacks = [] - - def add_done_callback(self, fn): - self._callbacks.append(fn) - - def set_result(self, result): - self.result = result - for fn in self._callbacks: - fn(self) -``` - -一个future初始化为未解决的,它同过调用`set_result`来解决。[^12] - -让我们用futures和协程来改写我们的fetcher。我们之前用回调写的fetcher如下: - -```python -class Fetcher: - def fetch(self): - self.sock = socket.socket() - self.sock.setblocking(False) - try: - self.sock.connect(('xkcd.com', 80)) - except BlockingIOError: - pass - selector.register(self.sock.fileno(), - EVENT_WRITE, - self.connected) - - def connected(self, key, mask): - print('connected!') - # And so on.... -``` - -`fetch`方法开始连接一个套接字,然后注册`connected`回调函数,它会在套接字建立连接后调用。现在我们使用协程把这两步合并: - -```python - def fetch(self): - sock = socket.socket() - sock.setblocking(False) - try: - sock.connect(('xkcd.com', 80)) - except BlockingIOError: - pass - - f = Future() - - def on_connected(): - f.set_result(None) - - selector.register(sock.fileno(), - EVENT_WRITE, - on_connected) - yield f - selector.unregister(sock.fileno()) - print('connected!') -``` - -现在,`fetch`是一个生成器,因为他有一个`yield`语句。我们创建一个未决的future,然后yield它,暂停执行直到套接字连接建立。内函数`on_connected`解决这个future。 - -但是当future被解决,谁来恢复这个生成器?我们需要一个协程驱动器。让我们叫它`task`: - -```python -class Task: - def __init__(self, coro): - self.coro = coro - f = Future() - f.set_result(None) - self.step(f) - - def step(self, future): - try: - next_future = self.coro.send(future.result) - except StopIteration: - return - - next_future.add_done_callback(self.step) - -# Begin fetching http://xkcd.com/353/ -fetcher = Fetcher('/353/') -Task(fetcher.fetch()) - -loop() -``` - -task通过传递一个None值给`fetch`来启动它。`fetch`运行到它yeild一个future,这个future被task捕获作为`next_future`。当套接字连接建立,事件循环运行回调函数`on_connected`,这里future被解决,`step`被调用,生成器恢复运行。 - -## 用`yield from`重构协程 - -一旦套接字连接建立,我们就可以发送HTTP请求,然后读取服务器响应。不再需要哪些分散在各处的回调函数,我们把它们放在同一个生成器函数中: - -```python - def fetch(self): - # ... connection logic from above, then: - sock.send(request.encode('ascii')) - - while True: - f = Future() - - def on_readable(): - f.set_result(sock.recv(4096)) - - selector.register(sock.fileno(), - EVENT_READ, - on_readable) - chunk = yield f - selector.unregister(sock.fileno()) - if chunk: - self.response += chunk - else: - # Done reading. - break -``` - -从套接字中读取所有信息的代码看起来很通用。我们能不把它提取成一个子过程?现在该Python3的`yield from`登场了。它能让一个生成器委托另一个生成器。 - -让我们先回到原来那个简单的生成器: - -```python ->>> def gen_fn(): -... result = yield 1 -... print('result of yield: {}'.format(result)) -... result2 = yield 2 -... print('result of 2nd yield: {}'.format(result2)) -... return 'done' -... -``` - -为了从其他生成器调用这个生成器,我们使用`yield from`: - - -```python ->>> # Generator function: ->>> def caller_fn(): -... gen = gen_fn() -... rv = yield from gen -... print('return value of yield-from: {}' -... .format(rv)) -... ->>> # Make a generator from the ->>> # generator function. ->>> caller = caller_fn() -``` - -这个`caller`的行为的和它委派的生成器表现的完全一致: - -```python ->>> caller.send(None) -1 ->>> caller.gi_frame.f_lasti -15 ->>> caller.send('hello') -result of yield: hello -2 ->>> caller.gi_frame.f_lasti # Hasn't advanced. -15 ->>> caller.send('goodbye') -result of 2nd yield: goodbye -return value of yield-from: done -Traceback (most recent call last): - File "", line 1, in -StopIteration -``` - -注意到`caller`的指令指针保持15不变,就是`yield from`的地方,即使内部的生成器从一个yield语句运行到下一个yield,它始终不变。[^13]从`caller`外部来看,我们无法分辨yield出的值是来自`caller`还是它委派的生成器。而从`gen`内部来看,我们也不能分辨传给它的值是来自`caller`还是`caller`的外面。`yield from`是一个光滑的管道,值通过它进出`gen`,一直到`gen`结束。 - -协程可以用`yield from`把工作委派给子协程,还可以接受子协程的返回值。注意到上面的`caller`打印出"return value of yield-from: done"。当`gen`完成后,它的返回值成为`caller`中`yield from`语句的值。 - -```python - rv = yield from gen -``` - -我们批评过基于回调的异步编程模式,其中最大的不满是关于`stack ripping`:当一个回调抛出异常,它的堆栈回溯通常是毫无用处的。它只显示出事件循环运行了它,而没有说为什么。那么协程怎么样? - -```python ->>> def gen_fn(): -... raise Exception('my error') ->>> caller = caller_fn() ->>> caller.send(None) -Traceback (most recent call last): - File "", line 1, in - File "", line 3, in caller_fn - File "", line 2, in gen_fn -Exception: my error -``` - -这还是比较有用的,当异常抛出时,堆栈回溯显示出`caller_fn`委派了`gen_fn`。令人更欣慰的是,你可以像正常函数一样使用异常处理: - -```python ->>> def gen_fn(): -... yield 1 -... raise Exception('uh oh') -... ->>> def caller_fn(): -... try: -... yield from gen_fn() -... except Exception as exc: -... print('caught {}'.format(exc)) -... ->>> caller = caller_fn() ->>> caller.send(None) -1 ->>> caller.send('hello') -caught uh oh -``` - -所以我们可以像提取子过程一样提取子协程。让我们从fetcher中提取一些有用的子协程。我们先写一个可以读一块数据的协程`read`: - -```python -def read(sock): - f = Future() - - def on_readable(): - f.set_result(sock.recv(4096)) - - selector.register(sock.fileno(), EVENT_READ, on_readable) - chunk = yield f # Read one chunk. - selector.unregister(sock.fileno()) - return chunk -``` - -在`read`的基础上,`read_all`协程读取整个信息: - -```python -def read_all(sock): - response = [] - # Read whole response. - chunk = yield from read(sock) - while chunk: - response.append(chunk) - chunk = yield from read(sock) - - return b''.join(response) -``` - -如果你换个角度看,它们看起来就像在做阻塞I/O的普通函数一样。但是事实上,`read`和`read_all`都是协程。yield from`read`暂停`read_all`直到I/O操作完成。当`read_all`暂停时,事件循环正在做其它的工作等待其他的I/O操作。`read`在下次循环中完成I/O操作时,`read_all`恢复运行。 - -现在,`fetch`可以直接调用`read_all`: - -```python -class Fetcher: - def fetch(self): - # ... connection logic from above, then: - sock.send(request.encode('ascii')) - self.response = yield from read_all(sock) -``` - -神奇的是,Task类不需要做任何改变,它像以前一样驱动`fetch`协程: - -```python -Task(fetcher.fetch()) -loop() -``` - -当`read`yield一个future时,task从`yield from`管道中接受它,就像直接从`fetch`接受一样。当循环解决一个future时,task把它的结果送给`fetch`,通过管道,`read`接受到这个值,这完全就像task直接驱动`read`一样: - -图 - -亲爱的读者,我们已经完成了对asyncio协程探索。我们深入观察了生成器的机制,实现了简单的future和task。我们指出协程是如何利用两个世界的优点:比线程高效,比回调清晰。当然真正的asyncio比我们这个简化版本要复杂的多。真正的框架需要处理zero-copyI/0,公平调度,异常处理和其他大量特性。 - -使用asyncio编写协程代码比你现在看到的要简单的多。在前面的代码中,我们从基本原理去实现协程,所以你看到了回调,task和future,甚至非阻塞套接字和``select``调用。但是当用asyncio编写应用,这些都不会出现在你的代码中。我们承诺过,你可以像这样下载一个网页: - -```python - @asyncio.coroutine - def fetch(self, url): - response = yield from self.session.get(url) - body = yield from response.read() -``` - -对我们的探索还满意么?回到我们原始的任务:使用asyncio写一个网络爬虫。 - -## 使用协程 - -我们从描述爬虫如何工作开始。现在是时候用asynio去实现它了。 - -我们爬虫从获取第一个网页开始,解析出链接并把它们加到队列中。此后它开始傲游整个网站,并发的获取网页。倒是由于客户端和服务端的限制,我们希望有一个最大数目的worker。任何时候一个worker完成一个网页的获取,它应该立即从队列中取出下一个链接。我们会遇到没有事干的时候,所以worker必须能够暂停。一旦又有worker获取一个有很多链接的网页,队列会突增,暂停的worker立马被唤醒。最后,当任务完成后我们的程序必须能退出。 - -假如你的worker是线程,怎样去描述你的算法?我们可以使用Python标准库中的同步队列。每次有新的一项加入,队列增加它的tasks计数器。线程worker完成一个任务后调用`task_done`。主线程阻塞在`Queue.join`,直到tasks计数器与`task_done`调用次数相匹配,然后退出。 - -通过个一asynio队列,协程使用和线程一样的模式来实现。首先我们导入它[^6]: - -```python -try: - from asyncio import JoinableQueue as Queue -except ImportError: - # In Python 3.5, asyncio.JoinableQueue is - # merged into Queue. - from asyncio import Queue -``` - -我们把worker的共享状态收集在一个crawler类中,主要的逻辑写在`crawl`方法中。我们在一个协程中启动`crawl`,运行asyncio的事件循环直到`crawl`完成: - -```python -loop = asyncio.get_event_loop() - -crawler = crawling.Crawler('http://xkcd.com', - max_redirect=10) - -loop.run_until_complete(crawler.crawl()) -``` - -crawler用一个跟URL和最大重定向数来初始化,它把`(URL, max_redirect`)序对放入队列中。(为什么要这样做,敬请期待) - -```python -class Crawler: - def __init__(self, root_url, max_redirect): - self.max_tasks = 10 - self.max_redirect = max_redirect - self.q = Queue() - self.seen_urls = set() - - # aiohttp's ClientSession does connection pooling and - # HTTP keep-alives for us. - self.session = aiohttp.ClientSession(loop=loop) - - # Put (URL, max_redirect) in the queue. - self.q.put((root_url, self.max_redirect)) -``` - -现在队列中未完成的任务数是1。回到我们的主程序,启动事件循环和`crawl`方法: - -```python -loop.run_until_complete(crawler.crawl()) -``` -`crawl`协程唤起workers。它像一个主线程:阻塞在`join`上直到所有任务完成,同时workers在后台运行。 - -```python - @asyncio.coroutine - def crawl(self): - """Run the crawler until all work is done.""" - workers = [asyncio.Task(self.work()) - for _ in range(self.max_tasks)] - - # When all work is done, exit. - yield from self.q.join() - for w in workers: - w.cancel() -``` - -如果worker是线程,可能我们不会一次把它们全部创建出来。为了避免创建线程的昂贵代价,通常一个线程池会按需增长。但是协程很便宜,我们简单的把他们全部创建出来。 - -怎么关闭这个`crawler`很有趣。当`join`完成,worker存活但是被暂停:他们等待更多的URL。所以主协程在退出之前清除它们。否则Python解释器关闭调用所有对象的析构函数,活着的worker叫喊到: - -``` -ERROR:asyncio:Task was destroyed but it is pending! -``` - -`cancel`又是如何工作的呢?生成器还有一个我们还没介绍的特点。你可以从外部抛一个异常给它: - - -```python ->>> gen = gen_fn() ->>> gen.send(None) # Start the generator as usual. -1 ->>> gen.throw(Exception('error')) -Traceback (most recent call last): - File "", line 3, in - File "", line 2, in gen_fn -Exception: error -``` - -生成器被`throw`恢复,但是他现在抛出一个异常。如何生成器没有捕获异常的代码,这个异常被传递到顶层。所以注销一个协程: - -```python - # Method of Task class. - def cancel(self): - self.coro.throw(CancelledError) -``` - -任何时候生成器在`yield from`语句暂停,被恢复并且抛出一个异常。我们在task的`step`方法中处理撤销。 - -现在worker直到他被注销了,所以当它被销毁时,它不再抱怨。 - -一旦`crawl`注销了worker,它就退出。同时事件循环看见这个协程结束了,也就退出l。 - -```python -loop.run_until_complete(crawler.crawl()) -``` - -`crawl`方法包含了所有主协程需要做的事。而worker则完成了从队列中获取URL,获取网页,解析它们得到新的链接。每个worker独立的运行`worker`协程: - -```python - @asyncio.coroutine - def work(self): - while True: - url, max_redirect = yield from self.q.get() - - # Download page and add new links to self.q. - yield from self.fetch(url, max_redirect) - self.q.task_done() -``` - -Python看见这段代码包含`yield from`语句,就把它编译成生成器函数。所以在`crawl`方法中,我们调用了10次`self.work`,但并没有真正执行,它仅仅创建了10个生成器对象并把它们包装成Task对象。task接收生成器yield的future,通过调用send方法,future的结果做为send的参数,来驱动它。由于生成器有自己的栈帧,它们可以独立运行,独立的局部变量和指令指针。 - -worker使用队列来协调, 等待新的URL: - -```python - url, max_redirect = yield from self.q.get() -``` - -队列的`get `方法也是一个协程,它一直暂停到有新的URL进入队列。 - -碰巧,这也是最后crawl停止时,协程暂停的地方。当主协程注销worker时,从协程的角度,`yield from`抛出`CancelledError`结束了它在循环中的最后旅程。 - -worker获取一个网页,解析链接,把新的链接放入队列中,接着调用`task_done`减小计数器。最终一个worker遇到一个没有新链接的网页,并且队列里也没有任务,这次`task_done`的调用使计数器减为0,而`crawl`正阻塞在`join`方法上,现在它就可以结束了。 - -我们承诺过要解释为什么队列中要使用序对,像这样: - -```python -# URL to fetch, and the number of redirects left. -('http://xkcd.com/353', 10) -``` - -新的URL的重定向次数是10。获取一个特别的URL会重定向一个新的位置。我们减小重定向次数,并把新的URL放入队列中。 - -```python -# URL with a trailing slash. Nine redirects left. -('http://xkcd.com/353/', 9) -``` - -我们使用的`aiohttp`默认的会重定向返回最终的结果。但是,我们告诉它不要这样做,爬虫自己处理重定向。所以它可以合并那些目的相同的重定向路径:如果我们已经看到一个URL,说明它已经从其他的地方走过这条路了。 - - -```python - @asyncio.coroutine - def fetch(self, url, max_redirect): - # Handle redirects ourselves. - response = yield from self.session.get( - url, allow_redirects=False) - - try: - if is_redirect(response): - if max_redirect > 0: - next_url = response.headers['location'] - if next_url in self.seen_urls: - # We have been down this path before. - return - - # Remember we have seen this URL. - self.seen_urls.add(next_url) - - # Follow the redirect. One less redirect remains. - self.q.put_nowait((next_url, max_redirect - 1)) - else: - links = yield from self.parse_links(response) - # Python set-logic: - for link in links.difference(self.seen_urls): - self.q.put_nowait((link, self.max_redirect)) - self.seen_urls.update(links) - finally: - # Return connection to pool. - yield from response.release() -``` - -如果这是多进程代码,就有可能遇到讨厌的竞争条件。比如,一个work检查一个链接是否在`seen_urls`中,如果没有它就把这个链接加到队列中并把它放到`seen_urls`中。如果它在这两步操作之间被中断,而另一个work解析到相同的链接,发现它并没有出现在`seen_urls`中就把它加入队列中。这导致同样的链接在队列中出现两次,做了重复的工作和错误的统计。 - -然而,一个协程只在`yield from`是才会被中断。这是协程比多线程少遇到竞争条件的关键。多线程必须获得锁来明确的进入一个临界区,否则它就是可中断的。而Python的协程默认是不会被中断的,只有它yield主动放弃控制权。 - -我们不再需要在用回调方式时的fetcher类了。这个类只是不高效回调的一个变通方法:在等待I/O时,它需要一个存储状态的地方,因为局部变量并不能在函数调用间保留。倒是`fetch`协程可以像普通函数一样用局部变量保存它的状态,所以我们不再需要一个类。 - -当`fetch`完成对服务器回应的处理,它返回到调用它的work。work调用`task_done`,接着从队列中取出一个URL。 - -当`fetch`把新的链接放入队列中,它增加未完成的任务计数器。主协程在等待`q.join`。而当没有新的链接并且这是队列中最后一个URL,work调用`task_done`,任务计数器变为0,主协程从`join`中退出。 - -与work和主协程一起工作的队列代码像这样: - -```python -class Queue: - def __init__(self): - self._join_future = Future() - self._unfinished_tasks = 0 - # ... other initialization ... - - def put_nowait(self, item): - self._unfinished_tasks += 1 - # ... store the item ... - - def task_done(self): - self._unfinished_tasks -= 1 - if self._unfinished_tasks == 0: - self._join_future.set_result(None) - - @asyncio.coroutine - def join(self): - if self._unfinished_tasks > 0: - yield from self._join_future -``` - -主协程`crawl`yield from`join`。所以当最后一个workd把计数器减为0,它告诉`crawl`恢复运行。 - -旅程快要结束了。我们的程序从`crawl`调用开始: - -```python -loop.run_until_complete(self.crawler.crawl()) -``` - -程序如何结束?因为`crawl`是一个生成器函数。调用它返回一个生成器。为了驱动它,asyncio把它包装成一个task: - - -class EventLoop: - def run_until_complete(self, coro): - """Run until the coroutine is done.""" - task = Task(coro) - task.add_done_callback(stop_callback) - try: - self.run_forever() - except StopError: - pass - -class StopError(BaseException): - """Raised to stop the event loop.""" - -def stop_callback(future): - raise StopError -``` - -当这个任务完成,它抛出`StopError`, 事件循环把这个异常当作正常退出的信号。 - -但是,task的`add_done_callbock`和`result`方法又是什么呢?你可能认为task就像一个future,不错,你的直觉是对的。我们必须承认一个向你隐藏的细节,task是future。 - -```python -class Task(Future): - """A coroutine wrapped in a Future.""" -``` - -通常,一个future被别人调用`set_result`。但是task,当协程结束时,它自己解决自己。记得我们解释过当Python生成器返回时,它抛出一个特殊的`StopIteration`异常: - -```python - # Method of class Task. - def step(self, future): - try: - next_future = self.coro.send(future.result) - except CancelledError: - self.cancelled = True - return - except StopIteration as exc: - - # Task resolves itself with coro's return - # value. - self.set_result(exc.value) - return - - next_future.add_done_callback(self.step) -``` - -所以当事件循环调用`task.add_done_callback(stop_callback)`,它就准备被这个task结束。在看一次`run_until_complete`; - -```python - # Method of event loop. - def run_until_complete(self, coro): - task = Task(coro) - task.add_done_callback(stop_callback) - try: - self.run_forever() - except StopError: - pass -``` - -当task捕获`StopIteration`并解决自己,这个回调重循环中抛出`StopError`。循环结束调用栈回到`run_until_complete`。我们的程序结束。 - -## 总结 - -现代的程序越来越多是I/O密集型而不是CPU密集型。对于这样的程序,Python的线程和不合适:全局锁阻止真正的并行计算,并且抢占切换也导致他们更容易出现竞争。异步通常是正确的选择。但是随着基于回调的异步代码增加,它会变得非常混乱。协程是一个更整洁的替代者。它们自然的重构成子过程,有健全的异常处理和栈追溯。 - -如果我们换个角度看`yield from`语句,一个协程看起来像一个传统的线程。甚至我们采用金典的多线程模式编程,不需要重新发明。因此,与回调相比,协程更适合有经验的多线程的编码者。 - -但是当我们打开眼睛关注`yield from`语句,我们能看到协程放弃控制权的标志点。不像多线程,协程展示出我们的代码哪里可以被中断哪里不能。在Glyph Lefkowitz富有启发性的文章"Unyielding"[^4]:"线程让局部推理变得困难,然而局部推理可能是软件开发中最重要的事"。然而,明确的yield,让"通过子过程本身而不是整个系统理解它的行为(应此,正确性)"成为可能。 - -这章写于Python和异步的复兴时期。你刚学到的基于生成器的的协程,在2014年发布在Python 3.4的"asyncio"模块。2015年9月,Python 3.5发布,协程成为语言的一部分。这个原生的协程通过"async def"来声明, 使用"await"而不是"yield from"委托一个协程或者等待Future。 - - -除了这些优点,核心的思想不变。Python新的原生协程与生成器只是在语法上不同,工作原理非常相似。事实上,在Python解释器中它们公用同一个实现方法。Task,Future和事件循环扮演这在asynico中同样的角色。 - -你已经知道asyncio协程是如何工作的了,现在你可以忘记大部分的细节。这些机制隐藏在一个整洁的接口下。但是你对这基本原理的理解能让你在现代异步环境下正确而高效的编写代码。 - -[^4]: [https://glyph.twistedmatrix.com/2014/02/unyielding.html](https://glyph.twistedmatrix.com/2014/02/unyielding.html) - -[^5]: [https://docs.python.org/3/library/queue.html](https://docs.python.org/3/library/queue.html) - -[^6]: [https://docs.python.org/3/library/asyncio-sync.html](https://docs.python.org/3/library/asyncio-sync.html) - -[^7]: For a complex solution to this problem, see [http://www.tornadoweb.org/en/stable/stack_context.html](http://www.tornadoweb.org/en/stable/stack_context.html) - -[^8]: [http://www.kegel.com/c10k.html](http://www.kegel.com/c10k.html) - -[^9]: The actual `asyncio.Queue` implementation uses an `asyncio.Event` in place of the Future shown here. The difference is an Event can be reset, whereas a Future cannot transition from resolved back to pending. - -[^10]: The `@asyncio.coroutine` decorator is not magical. In fact, if it decorates a generator function and the `PYTHONASYNCIODEBUG` environment variable is not set, the decorator does practically nothing. It just sets an attribute, `_is_coroutine`, for the convenience of other parts of the framework. It is possible to use asyncio with bare generators not decorated with `@asyncio.coroutine` at all. - - -[^11]: Jesse listed indications and contraindications for using async in "What Is Async, How Does It Work, And When Should I Use It?", available at pyvideo.org. -[^bayer]: Mike Bayer compared the throughput of asyncio and multithreading for different workloads in his "Asynchronous Python and Databases": http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/ - - -[^11]: Jesse listed indications and contraindications for using async in ["What Is Async, How Does It Work, And When Should I Use It?":](http://pyvideo.org/video/2565/what-is-async-how-does-it-work-and-when-should). Mike Bayer compared the throughput of asyncio and multithreading for different workloads in ["Asynchronous Python and Databases":](http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/) - - -[^12]: This future has many deficiencies. For example, once this future is resolved, a coroutine that yields it should resume immediately instead of pausing, but with our code it does not. See asyncio's Future class for a complete implementation. - -[^13]: In fact, this is exactly how "yield from" works in CPython. A function increments its instruction pointer before executing each statement. But after the outer generator executes "yield from", it subtracts 1 from its instruction pointer to keep itself pinned at the "yield from" statement. Then it yields to *its* caller. The cycle repeats until the inner generator throws `StopIteration`, at which point the outer generator finally allows itself to advance to the next instruction. - -[^14]: Python's global interpreter lock prohibits running Python code in parallel in one process anyway. Parallelizing CPU-bound algorithms in Python requires multiple processes, or writing the parallel portions of the code in C. But that is a topic for another day. - -[^15]: Even calls to `send` can block, if the recipient is slow to acknowledge outstanding messages and the system's buffer of outgoing data is full. - - -[^16]: Guido introduced the standard asyncio library, called "Tulip" then, at [PyCon 2013](http://pyvideo.org/video/1667/keynote). - - -[^16]: Guido introduced the standard asyncio library, called "Tulip" then, at PyCon 2013. - - -[^17]: Python 3.5's built-in coroutines are described in [PEP 492](https://www.python.org/dev/peps/pep-0492/), "Coroutines with async and await syntax." - --------------------------------------- -via: http://aosabook.org/en/500L/pages/a-web-crawler-with-asyncio-coroutines.html - -作者: A. Jesse Jiryu Davis and Guido van Rossum -译者:[qingyunha](https://github.com/qingyunha) -校对: - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20161018 Suspend to Idle.md b/translated/tech/20161018 Suspend to Idle.md deleted file mode 100644 index 989f113f69..0000000000 --- a/translated/tech/20161018 Suspend to Idle.md +++ /dev/null @@ -1,147 +0,0 @@ - -# Suspend to Idle - -### 简介 - -Linux内核提供了多种睡眠状态,各个状态通过设置系统中的不同部件进入低耗电模式来节约能源。目前总共有四种状态,分别是:suspend to idle,power-on standby,suspend to ram和suspend to disk。这些状态分别对应ACPI的4种状态:S0,S1,S3和S4。suspend to idle是纯软件实现的,主要用于尽量保持CPU处于睡眠状态。powder-on standby则使设备处于低耗电状态,并且停止non-boot CPU运行。suspend to ram则会更进一步处理关闭部件节约能源,包括停止CPU运行,只保持内存自刷新工作,保证内存中的内容仍然存在。suspend to disk则是尽最大努力关闭部件进行节能,包括关闭内存。然后内存中的内容会被写到硬盘,待唤醒计算机的时候将硬盘中的内容重新恢复到内存中。 - -这篇博文主要介绍挂起suspend to idle的实现。如上所说,suspend to idle主要通过软件实现。一般平台的挂起过程包括冻结用户空间并将外围设备调至低耗电模式。但是系统并不是直接关闭和拔掉运行中的cpu,而是静静地强制将CPU进入休眠状态。随着外围设备进入了低耗电模式,除了唤醒相关的中断外不会有其他中断产生。唤醒中断包括那些设置用于唤醒系统的计时器(比如RTC,普通计时器等)、或者电源开关、USB和其它外围设备。 - -在冻结过程中,当系统进入休眠状态时会调用一个特殊的cpu休眠函数。这个enter_freeze()函数可以简单得和调用cpu进入休眠的enter()函数相同,也可以更复杂。复杂的程度由将SoCs置为低耗电模式的条件和方法决定。 - -### 先决条件 - -### 平台挂起条件 - -一般情况,为了支持S2I,系统必须实现platform_suspend_ops并提供最低限度的挂起支持。这意味着至少要实现platform_suspend_ops中的所有必要函数的功能。如果suspend to idle 和suspend to ram都支持,那么至少要实现suspend_valid_only_men。 - -最近,内核开始支持支持S2I。Sudeep Holla表示无须满足platform_suspend_ops条件也会支持S2I。这个分支已经被接收并将在4.9版本被合并,该分支的路径在[https://lkml.org/lkml/2016/8/19/474][1] - -如果定义了suspend_ops。那么可以通过查看/sys/power/state文件得知系统具体支持哪些挂起状态。如下操作: - -``` -# cat /sys/power/state -``` - -freeze mem_ - -这个示例的结果显示该平台支持S0(suspend to idle)和S3(suspend to ram)。随着Sudeep's的发展,只有那些没有实现platform_suspend_ops的平台才会显示freeze的结果。 - -### 唤醒中断 - -一旦系统处于某种睡眠状态,系统必须要接收某个唤醒事件才能恢复系统。这些唤醒事件一般由系统的设备产生。因此确保这些设备的驱动实现了唤醒中断,并且在接收这些中断的基础上产生了唤醒事件。如果唤醒设备没有正确配置,那么系统收到中断后只能继续保持睡眠状态而不会恢复。 - -一旦设备正确实现了唤醒接口的调用,那么该设备就能产生唤醒事件。确保DT正确配置了唤醒源。下面是一个示例唤醒源配置,该文件来自(arch/arm/boot/dst/am335x-evm.dts): - -``` -    gpio_keys: volume_keys@0 {__ -               compatible = “gpio-keys”; -               #address-cells = <1>; -               #size-cells = <0>; -               autorepeat; - -               switch@9 { -                       label = “volume-up”; -                       linux,code = <115>; -                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; -                       wakeup-source; -               }; - -               switch@10 { -                       label = “volume-down”; -                       linux,code = <114>; -                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; -                       wakeup-source; -               }; -       }; -``` -如上所示,有两个gpio键被配置为了唤醒源,在系统挂起期间按下其中任何一个键都会产生一个唤醒事件。 - -相对与DT文件配置的另一个唤醒源配置就是设备驱动配置自身,如果设备驱动在代码里面配置了唤醒支持,那么就会使用该默认唤醒配置。 - -### 补充 - -### freeze功能 - -如果系统希望能够充分使用suspend to idle,那么应该在cpu空闲驱动代码中定义enter_freeze()函数。enter_freeze()与enter()的使用方式完全不同,因此不能给enter和enter_freeze实现相同的enter()功能。如果没有定义enter_freeze(),虽然系统会挂起,但是不会触发那些只有当enter_freeze()定义了才会触发的函数,比如tick_freeze()和stop_critical_timing()都不会发生。虽然这也会导致中断唤醒系统,但不会导致系统恢复,系统处理完中断后会继续睡眠。在该最低限度情况下,系统会直接调用enter()。 - -在挂起过程中,越少中断产生越好(最好一个也没有)。 - -下图显示了能耗和时间的对比。图中的两个尖刺分别是挂起和恢复阶段。挂起前后的能耗尖刺是系统退出空闲态正在进行的记录操作,进程调度,计时器处理等。由于潜在的原因系统进入更深层次休眠状态进行的默认操作需要花很多时间。 - - ![blog-picture-one](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-one-1024x767.png) -Power Usage Time Progression - -下面的跟踪时序图显示了4核CPU在系统挂起和恢复操作这段时间内的活动。如图所示,在挂起这段时间没有请求或者中断被处理。 - - ![blog-picture-2](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-2-1024x577.png) - -Ftrace capture of Suspend/Resume - -### 空闲状态 - -你必须确定哪个空闲状态支持冻结,在冻结期间,电源相关代码会决定用哪个空闲状态来实现冻结。这个过程是通过在每个空闲状态中查找谁定义了enter_freeze()来决定的。cpu空闲驱动代码或者SoC挂起相关代码必须实现冻结相关操作,并通过指定冻结功能给所有CPU的可应用空闲状态进行配置。 - -比如Qualcomm会在平台的挂起功能中的初始化代码处定义enter_freeze函数。这个工作是在cpu空闲驱动已经初始化并且所有数据结构已经定义就位的情况下进行的。 - -### 挂起/恢复相关驱动支持 - -你可能会在第一次成功挂起操作后碰到驱动相关的bug。很多驱动开发者没有精力完全测试挂起和恢复相关的代码。由于用户空间已经被冻结,唤醒设备此时已经处于休眠状态并且pm_runtime已经被禁止。你可能会发现挂起操作并没有多少工作可做,因为pm_runtime已经做好了挂起相关的准备。 - -### 测试相关 - -测试suspend to idle可以手动进行,也可以用(脚本或程序)自动挂起,使用自动睡眠或者Android中的wakelock来让系统挂起。如果手动测试,下面的操作会直接将系统冻结。 - -``` -/ # echo freeze > /sys/power/state -[  142.580832] PM: Syncing filesystems … done. -[  142.583977] Freezing user space processes … (elapsed 0.001 seconds) done. -[  142.591164] Double checking all user space processes after OOM killer disable… (elapsed 0.000 seconds) -[  142.600444] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done._ -_[  142.608073] Suspending console(s) (use no_console_suspend to debug) -[  142.708787] mmc1: Reset 0x1 never completed. -[  142.710608] msm_otg 78d9000.phy: USB in low power mode -[  142.711379] PM: suspend of devices complete after 102.883 msecs -[  142.712162] PM: late suspend of devices complete after 0.773 msecs -[  142.712607] PM: noirq suspend of devices complete after 0.438 msecs -< system suspended > -…. -< wake irq triggered > -[  147.700522] PM: noirq resume of devices complete after 0.216 msecs -[  147.701004] PM: early resume of devices complete after 0.353 msecs -[  147.701636] msm_otg 78d9000.phy: USB exited from low power mode -[  147.704492] PM: resume of devices complete after 3.479 msecs -[  147.835599] Restarting tasks … done. -/ # -``` - -在上面的例子中,需要注意MMC驱动的操作占了102.883ms中的100ms。有些设备驱动在挂起的时候有很多工作要做,比如将数据刷出到硬盘,或者其他耗时的操作等。 - -如果系统定义了freeze。那么系统将尝试挂起操作,如果没有freeze功能,那么你会看到下面的提示: - -``` -/ # echo freeze > /sys/power/state  -sh: write error: Invalid argument -/ # -``` - -### 未来的发展 - -目前在ARM平台上的suspend to idle有两方面的工作需要做。第一方面是前面提到的需要准备好platform_suspend_ops相关工作,该工作致力于冻结状态的合法化并将并到4.9版本的内核中。另一方面是关于冻结功能方面的支持。 - -如果你希望设备有更好的响应及表现那么应该继续完善冻结相关功能的实现。然而很多SoCs会使用ARM的cpu空闲驱动,这使得ARM能够完善自己独特的冻结功能。而事实上,ARM正在尝试添加自己特有的支持。如果SoCs供应商希望实现他们自己的cpu空闲驱动或者需要在进入更深层次的冻结休眠状态时提供额外的支持,那么只有实现自己的冻结功能。 - --------------------------------------------------------------------------------- - -via: http://www.linaro.org/blog/suspend-to-idle/ - -作者:[Andy Gross][a] - -译者:[beyondworld](https://github.com/beyondworld) - -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linaro.org/author/andygross/ -[1]:https://lkml.org/lkml/2016/8/19/474 diff --git a/translated/tech/20170103 5 things to watch in Go programming in 2017.md b/translated/tech/20170103 5 things to watch in Go programming in 2017.md deleted file mode 100644 index fba1fee8d4..0000000000 --- a/translated/tech/20170103 5 things to watch in Go programming in 2017.md +++ /dev/null @@ -1,107 +0,0 @@ -2017 年 Go 语言编程值得关注的 5 点 -============================================================ - -### 今年像动态插件,serverless 的 Go 以及 HTTP/2 这些创新对你的开发意味着什么? - -Go 1.8 将于下个月发布,它将有几个新功能,包括: - -* [HTTP/2 Push] [1] -* [HTTP 服务器平滑关闭] [2] -* [插件] [3] -* [缺省 GOPATH] [4] - -这些新功能的影响力取决于你和开发团队如何使用 Go。 自从 Go 1.0 于 2012 年发布以来,其简单性、并发性和内置支持使其保持[普及度][9]不断增长,所以“Go 擅长什么”的答案一直在增长。 - -这里我会提供一些想法,从即将到来的版本及 Go 世界最近其它吸引我的地方。这不是一个详尽的列表,所以请[让我知道][10]你认为在 2017 年 Go 还会发生哪些重要的事。 - -### Go 的超级可部署性 + 插件 = 容器、任何东西? - -下个月计划发布的 [1.8 版本][11],我已经与几个人交谈过添加动态插件 - 这是为了加载在编译时不是程序一部分的共享库的代码 - 会如何影响像容器之类的事物。 动态插件使容器中的高并发微服务变得更加简单。 你可以轻松地加载插件作为外部进程,同时具备在容器中微服务的所有好处:保护你的主进程不会崩溃,并且没有任何东西会搞乱你的内存空间。 对插件的动态支持应该是在 Go 中使用容器的福音。 - -_关于专家现场 Go 培训,请注册_[ _Go Beyond the Basics_][12]_。_ - -### 跨平台支持仍在吸引开发人员 - -在 Go 开源之后的 7 年里,它已被全球采用。[Daniel Whitenack][13] 是一名数据科学家和工程师,他为 Jupyter 维护 Go 内核,告诉我最近他[在西伯利亚做数据科学和 Go 语言培训][14],(是的,在西伯利亚!数据科学和Go - 之后再细讲一下...)并 “很惊讶地看到那里 Go 社区是如此活跃和积极。” 人们将继续采取 Go 用于项目的另一个很大的原因是交叉编译,对此,几个 Go 专家解释说[这在 Go 1.5 版本中更容易了][15]。来自其他语言(如 Python)的开发人员应该发现,在没有 VM 的目标平台上,能够为多个操作系统构建捆绑的、可以部署的应用程序是在 Go 中工作的关键。 - -在 1.8 版本中对跨平台的支持,再加上[编译时间 15% 的速度提高][16],你就可以看到为什么 Go 是初创公司最喜欢的语言。 - -*有兴趣了解 Go 的基础知识吗?查看 [Go 基础学习路径][17] 让 O’Reilly 专家来带你开始。* - -### Go 解释器在开发中:再见 Read-Eval-Print-Loop - -有一些真正的聪明人正在做一个 [Go 解释器][18],我一定会持续关注它。如你所知的那样,有几个 Read-Eval-Print-Loop(REPL)的解决方案可以用来评估表达式并确保代码按预期工作,但这些方法通常意味着容忍不便的事项,或费力从几个方案中找到一个适合你的案例。有一个健壮、一致的解释器就太好了,一旦我了解到更多,我会告诉你们。 - - -*在开发中使用 Go 复杂特性?观看 O'Reilly 的视频训练 [中级 Go ][19]*。 - -### Go 的 serverless - 会是什么样子? - -是的,现在围绕 serverless 架构有很多炒作,也就是功能即服务(FaaS)。但有时候也有些模糊,那么关于 Go 的 serverless 发生了什么?我们能在今年看到一个 Go 语言原生支持的 serverless 服务么? - -AWS Lambda 是最知名的 serverless 提供商,但 Google 最近还推出了 [Google Cloud Functions][20]。这两个 FaaS 解决方案使你可以在不管理服务器的情况下运行代码,你的代码存储在别人为你管理的服务器集群上,并且仅在触发事件调用它时运行。AWS Lambda 目前支持 JavaScript、Python 和 Java,还可以启动 Go、Ruby 和 bash 进程。 Google Cloud Functions 只支持 JavaScript,但很可能不久将支持 Java 和 Python。许多物联网设备已经使用 serverless 方案,随着 Go 越来越多地被创业公司采用,serverless 似乎是一个可能的增长点,所以我在关注这些 serverless 解决方案中 Go 的开发情况。 - -已经有[几个框架][25]可以支持 AWS Lambdas: - -* [λGordon][5] - 使用 CloudFormation 创建、连接及部署 AWS Lambdas -* [Apex][6] - 构建、部署及管理 AWS Lambda 函数 -* [Sparta][7] - AWS Lambda 微服务的 Go 框架 - -还有一个 AWS Lambda 替代品支持 Go: - -* [Iron.io][8]:建立在 Docker 和 Go 之上;语言不可知;支持 Golang、Python、Ruby、PHP 和 .NET - -*有关 serverless 架构的更多信息,请观看 Mike Roberts 在旧金山 O'Reilly 软件架构会议上的演讲主题:[_serverless介绍_][22]。* - -### 数据科学中的 Go - -我在本文开头暗示了这一点:也许令人惊讶的是很多人都在使用 Go 进行数据科学和机器学习。关于它是否适合还有一些争论,但基于像[ Gopher 学院在 2016 年 12月][23]的年度文章那样,你会注意到 30 篇文章中至少有 4 篇是关于机器学习或分布式数据处理,这些都在发生。 - -我之前关于 Go 的易部署性的观点可能是数据科学家使用 Go 的一个关键原因:他们可以更轻松地在可读以及可用于生产的应用程序中向他人展示数据模型。与此相结合的是 Go 的广泛使用(正如我前面提到的,它正变得越来越流行!),而且有数据专家创建“可用并且与其它程序兼容”的程序。任何使用 Go 构建的应用数据科学家会在公司其他部分使用相同的语言,或者至少非常适合现代架构。 - -*更多关于 Go 的数据科学,Daniel Whitenack 写了一个很好的概述,解释了如何使用它: [Data Science Gophers][24]。* - --------------------------------------------------------------------------------- - -作者简介: - -![](https://cdn-images-1.medium.com/fit/c/60/60/1*MFGykrfk6_HjkJzePBtaMw.png) - -O'Reilly Media 的监督编辑,与编辑团队合作,涵盖各种各样的编程主题。 - --------------------------------------------------------------------------------- - -via: https://medium.com/@sconant/5-things-to-watch-in-go-programming-in-2017-39cd7a7e58e3#.8t4to5jr1 - -作者:[Susan Conant][a] -译者:[geekpi](https://github.com/geekpi) -校对:[jasminepeng](https://github.com/jasminepeng) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://medium.com/@sconant?source=footer_card -[1]:https://beta.golang.org/doc/go1.8#h2push -[2]:https://beta.golang.org/doc/go1.8#http_shutdown -[3]:https://beta.golang.org/doc/go1.8#plugin -[4]:https://beta.golang.org/doc/go1.8#gopath -[5]:https://github.com/jorgebastida/gordon -[6]:https://github.com/apex/apex -[7]:http://gosparta.io/ -[8]:https://www.iron.io/ -[9]:https://github.com/golang/go/wiki/GoUsers -[10]:https://twitter.com/SuConant -[11]:https://beta.golang.org/doc/go1.8 -[12]:https://www.safaribooksonline.com/live-training/courses/go-beyond-the-basics/0636920065357/ -[13]:https://www.oreilly.com/people/1ea0c-daniel-whitenack -[14]:https://devfest.gdg.org.ru/en/ -[15]:https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba44ec#.7s7sxmc4h -[16]:https://beta.golang.org/doc/go1.8#compiler -[17]:http://shop.oreilly.com/category/learning-path/go-fundamentals.do -[18]:https://github.com/go-interpreter -[19]:http://shop.oreilly.com/product/0636920047513.do -[20]:https://cloud.google.com/functions/docs/ -[21]:https://github.com/SerifAndSemaphore/go-serverless-list -[22]:https://www.safaribooksonline.com/library/view/oreilly-software-architecture/9781491976142/video288473.html?utm_source=oreilly&utm_medium=newsite&utm_campaign=5-things-to-watch-in-go-programming-body-text-cta -[23]:https://blog.gopheracademy.com/series/advent-2016/ -[24]:https://www.oreilly.com/ideas/data-science-gophers -[25]:https://github.com/SerifAndSemaphore/go-serverless-list diff --git a/translated/tech/20170118 Why Linux Installers Need to Add Security Features.md b/translated/tech/20170118 Why Linux Installers Need to Add Security Features.md deleted file mode 100644 index 2771c56e9f..0000000000 --- a/translated/tech/20170118 Why Linux Installers Need to Add Security Features.md +++ /dev/null @@ -1,71 +0,0 @@ -为何 Linux 安装者需要添加安全功能 -============================================================ - -> _由于安全问题越来越严重,Linux 发行版需要在安装程序中突出显示基本安全选项,而不是用户稍后可以手动添加的选项。_ - -十二年前,Linux 发行版努力使安装变得简单。在 Ubuntu 和 Fedora 的领导下,它们很早就实现了这一目标。现在,随着对安全性越来越关注,它们需要稍微转变下方向,并在安装程序中突出显示基本安全选项,而不是用户稍后可以手动添加的选项。 - -当然,在最好的情况下,说服用户来设置安全功能都是困难的。太多用户不愿意添加如非特权用户帐户或密码一样简单的功能,他们显然更喜欢用重装或者以每小时 80 美元的价格咨询专家来减少风险。 - -然而,如果一般用户不会注意安全,那他可能会在安装过程中注意。他们可能永远不会再想到它,但也许在安装过程中,当他们的注意力集中时,特别是如果有可见的解释,他们可能被说服选择一个复选框。 - -这种转变也并不伟大。许多安装程序已经提供了自动登录的选择 - 一个不包含个人数据的安装功能或许是可以接受的,但很可能不会被那些觉得登录不方便的用户使用。同样感谢 Ubuntu,它选择加密文件系统 - 至少在主目录中是这样 - 它已经成为许多安装程序的标准。我真正建议的是这样的。 - -此外,外部安装程序如 Firefox 已经无缝合并了隐私浏览,[Signal Private Messenger][8] 是一个替代标准 Android 手机和联系人应用程序。 - -这些建议远不是激进的。它只需要意志和想象力来实现它。 - -### Linux 安全第一步 - -应该将什么类型的安全功能添加到安装程序? - -首先是防火墙。有许多图形界面程序可以设置设置防火墙。尽管十七年的经验,但是为了解释 Byron 谈论 Coleridge 的形而上学的猜测,我有时希望有人解释他们的解释。 - -尽管有良好的意图,大多数防火墙工具让处理 iptables 似乎很直接。[Bastille Linux][9],一个现在已经停止维护加固系统,可以用于安装一个基本的防火墙,我看不出为什么其他发行版不能做同样的事情。 - -一些工具在安装后就可以使用,并且对安装者而言可以没有困难地添加。例如,[Grub 2][10],大多数发行版使用的引导管理器包含了基本密码保护。但不可否认的是,密码仍可以通过 Live CD 绕过,但它仍然在日常情况下提供一定程度的保护,包括远程登录。 - -类似地,一个后安装的密码管理器(如 [pwgen][11])可以添加到安装程序的设置帐户部分。这些工具强制可接受密码的长度,以及它们的大小写字母,数字和特殊字符的组合。它们许多都可以为你生成密码,有些甚至可以记住密码。 - -还有些工具可以在安装中添加。例如,安装程序可以请求定期备份的计划,并添加一个 cronjob 和一个简单的备份工具,如[kbackup][12]。 - -那么加密电子邮件怎么办?如今最流行的邮件阅读器包括了加密邮件的能力,但是设置和使用加密需要用户采取额外的设置,这使常见的任务复杂化,以至于用户会忽略它。然而,看看 Signal 在手机上的加密有多么简单,很显然,在笔记本电脑和工作站上加密会更容易。这大多数发行版可能都喜欢对等加密,而不喜欢 Signal 那样的集中式服务器,但像 [Ring][13] 这样的程序可以提供这种功能。 - -无论在安装程序中添加了什么功能,也许预防措施也可以扩展到生产力软件,如 LibreOffice。大多数安全工作都集中在电子邮件、网络浏览和聊天中,但文字处理程序和电子表格,以及他们的宏语言,是一个明显的恶意软件感染的来源和隐私关注。除了像 [Qubes OS][14]或 [Subgraph][15] 这样的几个意外之外,很少有人努力将生产力软件纳入其安全预防措施 - 这可能会留下一个空白的安全漏洞。 - -### 适应现代 - -当然,在意安全的用户也许会采取一些安全的方法。然而,这样的用户可以是信任自己。 - -我关心的是那些不太了解或不太愿意自己做修补的用户。我们越来越需要易于使用的安全性,并且亟待解决。 - -这些例子只是开始。它们中的大多数已经存在,并且需要以这样的方式来实现它们,使得用户不能忽略它们,并且能够以最少的知识来使用它们。可能实现所有这些只需要一个程序员,包括原型、UI 设计和测试,且不用超过一个月。 - -然而,直到添加这些功能后,大多数主流的 Linux 发行版几乎不能说是对安全性关注。毕竟,如果用户从不使用它们,那怎么会是好工具? - --------------------------------------------------------------------------------- - -via: http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html - -作者:[Bruce Byfield][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.datamation.com/author/Bruce-Byfield-6030.html -[1]:http://www.datamation.com/feedback/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html -[2]:http://www.datamation.com/author/Bruce-Byfield-6030.html -[3]:http://www.datamation.com/e-mail/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html -[4]:http://www.datamation.com/print/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html -[5]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html#comment_form -[6]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html# -[7]:http://www.datamation.com/author/Bruce-Byfield-6030.html -[8]:https://whispersystems.org/ -[9]:http://bastille-linux.sourceforge.net/ -[10]:https://help.ubuntu.com/community/Grub2/Passwords -[11]:http://pwgen-win.sourceforge.net/downloads.html -[12]:http://kbackup.sourceforge.net/ -[13]:https://savannah.gnu.org/projects/ring/ -[14]:https://www.qubes-os.org/ -[15]:https://subgraph.com/sgos/ diff --git a/translated/tech/20170119 Get to know Tuleap for project management.md b/translated/tech/20170119 Get to know Tuleap for project management.md deleted file mode 100644 index 7045120b6d..0000000000 --- a/translated/tech/20170119 Get to know Tuleap for project management.md +++ /dev/null @@ -1,77 +0,0 @@ -开始了解 Tuleap 用于项目管理 -============================================================ - -### Tuleap 正在被 Eclipse 基金会使用,用来取代 Bugzilla - - ![Get to know Tuleap for project management](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=kOixOaEU "Get to know Tuleap for project management") - -图片提供:opensource.com - -Tuleap 是一个独特的开源项目管理工具,目前发展势头很好,现在,每个月它会出一个大版本。它还被列在[ 2015 年前 5 大开源项目管理工具][1]和[ 2016 年前 11 个项目管理工具][2]中。 - -Manuel Vacelet,Enalean 的联合创始人和 CTO,Tuleap 项目背后的公司说:“Tuleap 是一个完整的 GPLv2 平台,用于托管软件项目,它提供了一个中心位置,在这里团队可以找到他们所需的所有工具,成功地追踪他们软件项目的生命周期。他们可以找到项目管理(Scrum、看板、瀑布、混合等等)、源码控制(git 和 svn)和代码审查(pull 请求和 gerrit)、持续集成、问题跟踪、wiki 和文档等的支持。” - -在这次采访中,我会和 Manuel 讨论如何开始使用它,以及如何以开源方式管理 Tuleap。 - -**Nitish Tiwari (NT): 为什么 Tuleap 项目很重要? ** - -**Manuel Vacelet(MV):** Tuleap 很重要是因为我们坚信一个成功的(软件)项目必须涉及所有利益相关者:开发人员、项目经理、QA、客户和用户。 - -很久以前,我是 SourceForge 的一个实习生(当 SourceForge 还是一个自由开源项目时),它最终会在几年后将成为 Tuleap。 我的第一个贡献是将 PhpWiki 集成到该工具中(不要告诉任何人,代码写的很糟)。 - -现在,我很高兴作为首席技术官和产品负责人在 Enalean 工作,该公司是 Tuleap 项目的主要贡献公司。 - -**NT: 给我们说下技术方面。** - -**MV:** Tuleap 核心系统是基于 LAMP 并且依赖于 CentOS。如今的开发栈是 AngularJS (v1)、REST 后端(PHP)、基于 NodeJS 的实时推送服务器。但如果你想成为一名 Tuleap 全栈开发人员,你还将需要接触 bash、Perl、Python、Docker、Make。 - -说到技术方面,需要重点强调的 Tuleap 的一个显著特征是它的可扩展性。Tuleap 在单实例、单服务器上并且没有复杂的 IT,可以处理超过 10,000 人。 - -**NT:给我们说下关于项目的用户和社区。有谁参与?他们如何使用这个工具?** - -**MV:** 用户非常多样化。从小型初创公司使用 Tuleap 跟踪他们的项目进度并管理他们的源代码到非常大的公司,如法国电信运营商 Orange,它部署了超过 17,000 用户和 5000 个项目。 - -许多用户依靠 Tuleap 来促进敏捷项目并跟踪其进度。开发人员和客户共享同一个工作区。客户不需要学习如何使用 GitHub,也不需要开发人员做额外的工作,将其工作转换到“客户可访问”平台。 - -今年,Tuleap 被[ Eclipse 基金会][3]使用,取代了Bugzilla。 - -印度电子信息技术部使用 Tuleap 创建了印度政府开放电子政务的开放式协作开发平台。 - -Tuleap 有多种不同的使用方式和配置。有些人使用它作为 Drupal 客户门户网站的后端; 它们通过 REST API 插入到 Tuleap 中以管理 bug 和服务请求。 - -甚至一些建筑师也使用它来管理他们的工作进度和 AutoCAD 文件。 - -**NT:Tuleap 是否做了一些特别的事,使社区更安全,更多样化?** - -**MV:** 我们还没有创建“行为准则”; 本社区非常平和以及受欢迎,但我们有计划这样做。Tuleap 的开发人员和贡献者来自不同的国家(例如加拿大、突尼斯、法国)。而且 35% 的活跃开发者和贡献者是女性。 - -**NT:由社区建议的 Tuleap 功能的百分比是多少?** - -**MV:** 几乎 100% 的功能是由社区驱动的。 - -这是 Enalean 的关键挑战之一:找到一种商业模式,使我们能以正确的方式做开源软件。对我们来说,“开放核心”模式(其中应用程序的核心是开放的,但有趣和有用的部分是封闭源的)不是正确的方法,因为你最终还是要依赖闭源。因此,我们发明了[OpenRoadmap][4],这种方式是我们从社区和最终用户那里收集需求,并找公司来支付。 - - --------------------------------------------------------------------------------- - -作者简介: - -![](https://opensource.com/sites/default/files/styles/profile_pictures/public/nitish-crop.png?itok=h4PaLDQq) - -Nitish 是一名专业的软件开发人员并对开源有热情。作为基于 Linux 的杂志的技术作者,他会尝试新的开源工具。他喜欢阅读和探索任何开源。在他的空闲时间,他喜欢读励志书。他目前正在构建 DevUp - 一个让开发人员以真正的方式连接所有工具和拥抱 DevOps 的平台。你可以在 Twitter 上关注他 @tiwari_nitish。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/1/interview-Tuleap-project - -作者:[Nitish Tiwari][a] -译者:[geekpi](https://github.com/geeki) -校对:[jamsinepeng](https://github.com/jasminepeng) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/tiwarinitish86 -[1]:https://opensource.com/business/15/1/top-project-management-tools-2015 -[2]:https://opensource.com/business/16/3/top-project-management-tools-2016 -[3]:http://www.eclipse.org/ -[4]:https://blog.enalean.com/enalean-open-roadmap-how-it-works/ diff --git a/translated/tech/20170119 Long-term Embedded Linux Maintenance Made Easier.md b/translated/tech/20170119 Long-term Embedded Linux Maintenance Made Easier.md deleted file mode 100644 index fc5f73c0d0..0000000000 --- a/translated/tech/20170119 Long-term Embedded Linux Maintenance Made Easier.md +++ /dev/null @@ -1,55 +0,0 @@ -长期维护嵌入式 Linux 内核变得容易 -============================================================ - - ![Jan Lübbe ](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jan-lubbe-elc.png?itok=6G5lADKu "Jan Lübbe ") -*Pengutronix 内核黑客 Jan Lübbe 总结了嵌入式 Linux 中正在增长的安全威胁,并在这次欧洲嵌入式 Linux 会议上概述了一个计划,以保持长期设备的安全和完整功能。* - [Linux 基金会][1] - - -安全漏洞只发生在 Windows 上的好日子在快速消退。恶意软件黑客和拒绝服务专家越来越多地针对过时的嵌入式 Linux 设备,因此在 10 月[欧洲嵌入式 Linux 会议Embedded Linux Conference Europe][3](ELCE)上的几个演讲的主题就与修复 Linux 安全漏洞相关。 - -最好的参加者之一是“长期维护、管理嵌入式系统 10 年以上”的 [Pengutronix][4] 内核黑客 Jan Lübbe。在总结嵌入式 Linux 中不断增长的安全威胁后,Lübbe 制定了一项计划,以确保长期设备的安全和完整的功能。 Lübbe 说:“我们需要迁移到更新、更稳定的内核,并进行持续维护以修复关键漏洞。我们需要做上游和自动化流程,并建立一个可持续的工作流程。我们没有任何借口,让系统中仍留有过时的软件。” - -随着 Linux 设备变得越来越老,传统的生命周期程序已经不再适用。 Lübbe 说:“通常,你会从 SoC 供应商或主线上获取内核、构建系统,并添加到用户空间。你自定义并添加了一个程序,在做了一些检测后就完成了。但是,在此之后有 15 年的维护阶段,你最好希望平台没有变化,或者想添加新的功能,或者需要实施管理调整。” - -所有这些变化,越来越多地导致系统暴露出新错误,并需要大量更新以与上游软件保持同步。 Lübbe 说:“在内核中发生导致问题的错误并不总是无意的”。对于去年在 Allwinner 内核中发现的[后门][5],他又补充说:“这些供应商内核从来不会执行主线社区的审查流程”。 - -Lübbe 继续说:“你不能相信你的供应商会做正确的事情。也许只有一两个工程师看了这个后门代码。如果补丁发布在 Linux 内核邮件列表上,这将永远不会发生。因为总会有人注意到。硬件供应商不关心安全或维护。也许你会在一两年后得到更新,但是即使这样,他们从一个固定版本开始开发到他们声明稳定的点通常需要几年的时间。如果你在这个基础上开始开发,你可能又增加了半年,这就更过时了。” - -越来越多的嵌入式开发人员在长期稳定Long Term Stable(LTS)内核上构建长期产品。但这并不意味着你的工作已经完成。Lübbe 说:“一个产品发布后,人们经常不再遵循稳定的发行链,也不再应用安全补丁。这样你会得到两个世界中最糟糕的:一个过时的内核以及没有安全性。你不会得到许多人测试的好处。” - -Lübbe 指出,使用像 Red Hat 这样的面向服务器的发行版的 Pengutronix 客户经常遇到问题,因为不断快速的定制、部署和升级系统,就像有系统管理员在当班。 - -“更新对一些东西有用,特别是如果它们是 x86,但每个项目基本上是自己建立基础设施更新到新版本。” - -许多开发人员选择向后移植作为更新长期产品的解决方案。Lübbe 说:“开始时很容易,但是一旦你不在项目的维护窗口,他们不会告诉你你使用的版本是否受到一个 bug 的影响,因此很难判断一个修复是否相关。于是你不停打补丁和更新,bug 也在累积,而这些你必须自己维护,因为其他人不使用这些补丁。使用开源软件的好处就丢失了。” - -### 跟随上游项目 - -Lübbe 认为,最好的解决方案是跟踪由上游项目维护的版本。“我们主要关注基于主线的开发,所以我们在产品和主流内核及其他上游项目之间尽可能没有差别。长期系统在主线上得到很好的支持。大多数不使用 3D 图形的系统可以运行很少的补丁。较新的内核版本还有很多[新的强化功能][6],这些可以减少漏洞的影响。 - -跟随主线对许多开发人员来说似乎是令人畏惧的,但是如果从一开始就这样,然后坚持下去,就会相对容易一些,Lübbe 说:“你需要为系统上做的一切制定流程。你总需要知道什么软件正在运行,这在使用良好的构建系统时会更容易。每个软件版本应定义完整的系统,以便你可以更新相关的一切。如果你不知道那里有什么,你就不能解决它。你还会想要更新的自动测试和自动部署。” - -为了“节省更新周期”,Lübbe 建议在开始开发时使用最新的 Linux 内核,并且在进入测试时才转到稳定的内核。之后,他建议每年将系统中的所有软件(包括内核、构建系统、用户空间、glibc 和组件(如 OpenSSL))更新为当年上游项目支持的版本。 - -Lübbe 说:“在这个时间点更新并不意味着你需要部署。如果没有看到安全漏洞,你可以把补丁放在一边,需要时它就准备好了。” - -最后,Lübbe 建议每个月查看发布公告,并且每周检查 CVE 和主线列表上的安全公告。你只需要问自己“安全公告是否影响到了你”。他补充说:“如果你的内核足够新,就没有太多的工作。你不会希望通过在新闻中看到你的设备来获得有关你的产品的反馈。” - --------------------------------------------------------------------------------- - -via: https://www.linux.com/news/event/ELCE/2017/long-term-embedded-linux-maintenance-made-easier - -作者:[ERIC BROWN][a] -译者:[geekpi](https://github.com/geekpi) -校对:[jasminepeng](https://github.com/jasminepeng) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/ericstephenbrown -[1]:https://www.linux.com/licenses/category/linux-foundation -[2]:https://www.linux.com/files/images/jan-lubbe-elcpng -[3]:http://events.linuxfoundation.org/events/archive/2016/embedded-linux-conference-europe -[4]:http://www.pengutronix.de/index_en.html -[5]:http://arstechnica.com/security/2016/05/chinese-arm-vendor-left-developer-backdoor-in-kernel-for-android-pi-devices/ -[6]:https://www.linux.com/news/event/ELCE/2017hardening-kernel-protect-against-attackers diff --git a/translated/tech/20170120 Getting Started with Bitbucket for Version Control.md b/translated/tech/20170120 Getting Started with Bitbucket for Version Control.md deleted file mode 100644 index 20a8bda679..0000000000 --- a/translated/tech/20170120 Getting Started with Bitbucket for Version Control.md +++ /dev/null @@ -1,125 +0,0 @@ -使用 Bitbucket 开始版本控制 -============================================================ - - ![](https://www.blogmint.com/frontendUtil/openPage?page=blog-post-read&oId=c41aba944ad4408095c09ccabc1921ec&uId=1a715d24df2f49c0be2acf7d7409ffbb&count=1&image=one-pixel.png) - -在互联网成为一个巨大的、世界性的现象之前,开发团队曾经被限制在一个小的物理空间内。如果一家公司没有资金支持这样一个冒险,那么与世界另一方的人合作是一个非常昂贵或几乎不可能的梦想。 - -幸运的是,情况不再是这样了。互联网诞生了基于网络的解决方案,允许公司组成的合作团体,包括彼此相距数千英里的人。 - -自从 2008 年首次推出以来,[Bitbucket][1]已成为使用 Mercurial 或 Git 版本控制系统(VCS)的开发人员团队中越来越受欢迎的选择。 - -它提供两个免费帐户与无限数量的私人存储库(每个最多5个用户)和多个付费计划,允许每个帐户有更多用户。此外,标记为 public 的仓库对可以编辑或读取其内容的人数没有限制。 - -### 注册 Bitbucket - -要使用 Bitbucket,你需要设置一个免费帐户。要这样做,请进入 [https://bitbucket.org/][2],然后单击开始免费按钮。 - -首先,你需要输入有效的电子邮件地址,然后点击继续。 你的电子邮件帐户将被验证,如果一切正常,你将被提示输入所需的密码。完成后,再次点击“继续”,并检查你的电子邮件收件箱以确认你的帐户是否已创建: - -[ - ![Bitbucket Singup](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Singup.png) -][3] - -Bitbucket 注册 - -验证电子邮件地址后,系统会要求你选择用户名。 然后将创建你的帐户,你将会进入 Bitbucket 面板,在那里开始创建团队、项目和仓库: - -[ - ![Bitbucket Dashboard](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Dashboard.png) -][4] - -Bitbucket 面板 - -如你所见,你可以在几分钟内注册 Bitbucket。Atlassianhave 的人简化了这个过程,以便你可以把你的时间真正用在 Bitbucket 上- 我们接下来会解释这个。 - -### 使用使用 Bitbucket - -让我们检查下在注册完 Bitbucket 之后必须要做的事情。下面是最需做的清单: - -[ - ![Explore Bitbucket Features](http://www.tecmint.com/wp-content/uploads/2017/01/Explore-Bitbucket-Features.png) -][5] - -探索 Bitbucket 功能 - -###### 1). 创建一个团队通过允许多个 Bitbucket 用户共享一个账号计划的方式鼓励协作。 - -这将允许他们轻松地管理团队拥有的仓库。要创建团队,请输入所需的名称,并确保团队标识不存在。接下来,输入你要添加到群组的人员的电子邮件地址,并指明是否要将其设为管理员。最后,单击创建: - -[ - ![Bitbucket - Create a Team](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-Team.png) -][6] - -Bitbucket – 创建一个团队 - -###### 2) 创建或导入一个仓库 - -如果你已经使用基于 Git 的解决方案,你可以轻松地将你的仓库导入 Bitbucket。否则,你可以从头创建一个。让我们看看在每种情况下你需要做什么。 - -要创建新的仓库,请单击“仓库”菜单中的“创建仓库”选项。为新仓库和要分组到的项目选择一个名称。接下来,指明是否要将其设置为 private 以及类型(Git 或 Mercurial)。最后,单击创建仓库: - -[ - ![Bitbucket - Create a New Repository](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-New-Repository.png) -][7] - -Bitbucket – 创建一个新仓库 - -要导入现有仓库,请从仓库下拉菜单中选择导入仓库。要开始导入,请指定源,输入 URL 和所需的登录凭据(如果需要)。 - -最后,选择新的仓库设置,然后单击导入仓库。忽略有关在指定的 URL 处找不到的仓库的警告,因为它是虚拟的,仅用于演示目的: - -[ - ![Bitbucket - Import Existing Code](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Import-Existing-Code.png) -][8] - -Bitbucket – 导入存在的代码 - -就是这样,很简单吧。 - -### 在 Bitbucket 中使用仓库工作 - -在你创建一个新仓库或者导入一个仓库时,它会在你的列表上展示出来。这时你就能执行一些常规操作比如克隆、创建分支、pull request、提交修改、添加 README 文件等等: - -[ - ![Bitbucket - Repository Overview](http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Repository-Overview.png) -][9] - -Bitbucket – 仓库概述 - -如果你想了解如何用仓库工作,或者你觉得你想要提升你的 git 技能,你可以参考[ Bitbucket 离线文档][10]。 - -##### 总结 - -如你所见,不管你是版本管理的新手或者老手,Bitbucket 让它变得简单。如果你对本文有任何疑问或评论,请不要犹豫让我们知道。我们期待听到你的声音! - --------------------------------------------------------------------------------- - -作者简介: - -![](http://1.gravatar.com/avatar/7badddbc53297b2e8ed7011cf45df0c0?s=256&d=blank&r=g) - -我是 Ravi Saive,TecMint 的创建者。一个喜爱在互联网上分享技巧和提示的计算机 geek 和 Linux 老手。我的大多数服务运行在 Linux 开源平台上。请在 Twitter、Facebook、Google+ 上关注我。 - --------------------------------------------------------------------------------- - - -via: http://www.tecmint.com/bitbucket-for-version-control/ - -作者:[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://bit.ly/2ieExnS -[2]:http://bit.ly/2ioJISt -[3]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Singup.png -[4]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Dashboard.png -[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Explore-Bitbucket-Features.png -[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-Team.png -[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Create-a-New-Repository.png -[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Import-Existing-Code.png -[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Bitbucket-Repository-Overview.png -[10]:https://confluence.atlassian.com/bitbucket/bitbucket-cloud-documentation-home-221448814.html diff --git a/translated/tech/20170120 How to write web apps in R with Shiny.md b/translated/tech/20170120 How to write web apps in R with Shiny.md deleted file mode 100644 index e89a885718..0000000000 --- a/translated/tech/20170120 How to write web apps in R with Shiny.md +++ /dev/null @@ -1,68 +0,0 @@ -如何用 R 语言的 Shiny 库编写 web 程序 -============================================================ - ![How to write web apps in R with Shiny](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUSINESS_lightbulbs.png?itok=70w-2-Ta "How to write web apps in R with Shiny") -图片提供:  - -opensource.com - -新年快乐!我这个月在写一些更加长的文章,所以你可以在未来几个星期内寻找它们。对于这个月的 Nooks 和 Crannies,我想简要地提一个我一直在自己在玩的一个很棒的 R 库。 - -我的一个亲密朋友最近在用 R 编写东西。我一直都对它很感兴趣,一直在试图挤一点时间,至少学习更多关于 R 以及你可以做的事情的种类。探索 R 的数字处理能力对我而言是一个持续斗争,因为我并不是如我朋友那样有一个数学头脑。这对我来说很慢,但我一直试图将它与我在其他领域的经验联系起来,我甚至开始考虑非常简单的 web 程序。 - -[Shiny][1]是一个来自 RStudio 的工具包,它让创建 web 程序变得更容易。它能从 R 控制台轻松安装,只需要一行,最新的稳定版本将加载供你使用。这里有一个很棒的[教程][2],它会通过设置应用程序的概念、通过前面的课程构建技能的方式引导你。 Shiny 的授权是 GPLv3,源代码可以在 [GitHub][3] 上获得。 - -这是一个用 Shiny 写的简单的小 web 程序: - -``` - -library(shiny) - -server <- function(input, output, session) { - observe({ - myText <- paste("Value above is: ", input$textIn) - updateTextInput(session, "textOut", value=myText) - }) -} - -ui <- basicPage( - h3("My very own sample application!"), - textInput("textIn", "Input goes here, please."), - textInput("textOut", "Results will be printed in this box") -) - -shinyApp(ui = ui, server = server) -``` - -当你在输入框中输入时文字时,它会复制提示语句后面的文字。这并没有什么奇特的,但它向你展示了一个 Shiny 程序的基本结构。“服务端”部分允许你处理所有后端工作,如计算、数据库检索或程序需要发生的任何其他操作。“UI”部分定义了接口,它可以根据需要变得简单或复杂。 - -Shiny 中包含的大量样式和主题使用的是 [Bootstrap][4],所以你可以在学习了一点后,就能用 R 创建广泛的、功能丰富的 web 程序。附加包可以扩展功能,甚至更高级的 JavaScript 程序、模板等。 - -你可以以几种方式处理 Shiny 的后端工作。如果你只是在本地运行你的程序,加载库会就能做到。对于想要发布到网络上的程序,你可以在[ RStudio 的 Shiny 网站][5]上共享它们,运行开源版本的 Shiny 服务器,或通过年度订阅服务从 RStudio 处购买 Shiny Server Pro。 - -经验丰富的 R 大牛可能已经知道 Shiny 了;它已经存在大约几年了。对于像我这样从一个完全不同的编程语言来的人并希望学习一点 R 的人来说,我发现它是相当有帮助的。 - --------------------------------------------------------------------------------- - - -作者简介: - -![](https://opensource.com/sites/default/files/styles/profile_pictures/public/ruth1_avi.jpg?itok=I_EE7NmY) - -D Ruth Bavousett - D Ruth Bavousett 已经成为一名系统管理员和软件开发人员很长时间了,他的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前是休斯敦 cPanel 的 Perl 开发人员, 的两只猫的工作人员。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/1/writing-new-web-apps-shiny - -作者:[D Ruth Bavousett][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/druthb -[1]:http://shiny.rstudio.com/ -[2]:http://shiny.rstudio.com/tutorial -[3]:https://github.com/studio/shiny -[4]:http://getbootstrap.com/ -[5]:http://shinyapps.io/ diff --git a/translated/tech/20170124 Compile-time assertions in Go.md b/translated/tech/20170124 Compile-time assertions in Go.md new file mode 100644 index 0000000000..ad987be541 --- /dev/null +++ b/translated/tech/20170124 Compile-time assertions in Go.md @@ -0,0 +1,141 @@ +Go 语言编译期断言 +============================================================ + + +这篇文章是关于一个鲜为人知的方法让 Go 在编译期断言。你可能不会使用它,但是了解一下也很有趣。 + +作为一个热身,这里是一个在 Go 中相当知名的编译时断言:接口满意度检查。 + +在这段代码([playground][1])中,`var _ =` 行确保类型 `W` 是一个 `stringWriter`,由 [`io.WriteString`][2] 检查。 + +``` +package main + +import "io" + +type W struct{} + +func (w W) Write(b []byte) (int, error) { return len(b), nil } +func (w W) WriteString(s string) (int, error) { return len(s), nil } + +type stringWriter interface { + WriteString(string) (int, error) +} + +var _ stringWriter = W{} + +func main() { + var w W + io.WriteString(w, "very long string") +} +``` + +如果你注释掉了 `W` 的 `WriteString` 方法,代码将无法编译: + +``` +main.go:14: cannot use W literal (type W) as type stringWriter in assignment: + W does not implement stringWriter (missing WriteString method) +``` + +这是很有用的。对于大多数同时满足 `io.Writer` 和 `stringWriter` 的类型,如果你删除 `WriteString` 方法,一切都会像以前一样继续工作,但性能较差。 + +你可以使用编译时断言保护你的代码,而不是试图使用[`testing.T.AllocsPerRun'][3]为性能回归编写一个脆弱的测试。 + +这是[一个实际的 io 包中的技术例子][4]。 + +* * * + +好的,让我们隐晦一点! + +接口满意检查是很棒的。但是如果你想检查一个简单的布尔表达式,如 `1 + 1 == 2` ? + +考虑这个代码([playground] [5]): + +``` +package main + +import "crypto/md5" + +type Hash [16]byte + +func init() { + if len(Hash{}) < md5.Size { + panic("Hash is too small") + } +} + +func main() { + // ... +} +``` + +`Hash` 可能是某种抽象的哈希结果。`init` 函数确保它将与[crypto/md5][6]一起工作。如果你改变 `Hash` 为(也就是)`[8]byte`,它会在进程启动时发生混乱。但是,这是一个运行时检查。如果我们想要早点发现怎么办? + +就是这样。(没有 playground 链接,因为这在 playground 上不起作用。) + +``` +package main + +import "C" + +import "crypto/md5" + +type Hash [16]byte + +func hashIsTooSmall() + +func init() { + if len(Hash{}) < md5.Size { + hashIsTooSmall() + } +} + +func main() { + // ... +} +``` + +现在如果你改变 `Hash` 为 `[8]byte`,它将在编译过程中失败。(实际上,它在链接过程中失败。足够接近我们的目标了。) + +``` +$ go build . +# demo +main.hashIsTooSmall: call to external function +main.init.1: relocation target main.hashIsTooSmall not defined +main.init.1: undefined: "main.hashIsTooSmall" +``` + +这里发生了什么? + +`hashIsTooSmall` 是[一个没有函数体的声明][7]。编译器假定别人将提供一个实现,也许是一个汇编程序。 + +当编译器可以证明 `len(Hash {}) $DIR/file1.txt +``` +script2.sh: +``` +#!/bin/bash +SITE="Tecmint.com" +DIR=/home/gacanepa +echo "$SITE rocks... add us to your bookmarks." > $DIR/file2.txt +``` +[ + ![启动时执行 Linux 脚本](http://www.tecmint.com/wp-content/uploads/2017/02/Run-Linux-Commands-at-Startup.png) +][3] + +*启动时执行 Linux 脚本 * + +记住,一定要提前给两个示例脚本授予执行权限: + +``` +$ chmod +x /home/gacanepa/script1.sh +$ chmod +x /home/gacanepa/script2.sh +``` + +### 在登录或注销时执行 Linux 脚本 + +要在登录或注销时执行脚本,分别需要使用 `~.bash_profile` 和 `~.bash_logout` 文件。多数情况下,后者需要手动创建。在每个文件的底部,添加调用脚本代码,如前面例中所示,就可以实现这个功能。 + +##### 总结 + +本文主要介绍如何在启动、登录以及注销系统时执行脚本。如果你有其他的方法可以补充,请使用下面的评论表给我们指出,我们期待您的回应! + +-------------------------------------------------------------------------------- + +作者简介: + +Gabriel Cánepa 是 GNU/Linux 系统管理员, 阿根廷圣路易斯 Villa Mercedes 的 web 开发人员。他为一家国际大型消费品公司工作,在日常工作中使用 FOSS 工具以提高生产力,并从中获得极大乐趣。 + +-------------------------------------------------------------------------------- + + +via: http://www.tecmint.com/auto-execute-linux-scripts-during-reboot-or-startup/ + +作者:[Gabriel Cánepa][a] +译者:[zhb127](https://github.com/zhb127) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[00]:https://twitter.com/ravisaive +[01]:https://www.facebook.com/ravi.saive +[02]:https://plus.google.com/u/0/+RaviSaive + +[1]:http://www.tecmint.com/linux-boot-process/ +[2]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ +[3]:http://www.tecmint.com/wp-content/uploads/2017/02/Run-Linux-Commands-at-Startup.png +[4]:http://www.tecmint.com/author/gacanepa/ +[5]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[6]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/translated/tech/20170213 Orange Pi as Time Machine Server.md b/translated/tech/20170213 Orange Pi as Time Machine Server.md new file mode 100644 index 0000000000..893b476bd4 --- /dev/null +++ b/translated/tech/20170213 Orange Pi as Time Machine Server.md @@ -0,0 +1,145 @@ + +使用Orange Pi搭建Time Machine服务 +================================= + + ![Orange Pi as Time Machine Server](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=960%2C450) + +我有一个项目是安排各类家用计算机进行自动备份。该项目将重要数据存放在一组Macs中。但是我决定将那些运行[Armbian][4] Linux的[Orange Pi][3]用来做实验,目的是希望能够将[Time Machine][5]运行在安装了USB网络驱动的Orange Pi主板上。在这种情况下,我找到成功安装Netatalk的方法。 + +[Netatalk][6]是一个开源软件,用于苹果文件服务器。通过[Avahi][7]和Netatalk配合运行,你的Mac设备能够识别网络上的Orange Pi设备,并会将Orange pi设备当作Mac类型的设备。这使得你能够自动连接作为网络设备,更重要的是使得Time Machine能够发现并使用远程驱动。下面的指南能够帮助你在Macs上设置类似的备份机制。 + +### 准备工作 + +为了安装USB驱动,我首先尝试了HFS+格式文件系统,不幸的是我没能成功写入。所以我选择创建一个EXT4文件系统,并确保pi用户有读写权限。Linux有很多格式化磁盘的方法,但是我最喜欢(推荐)的仍然是[gparted][8]。由于gparted已经集成在Armbian桌面了,所以我直接使用了该工具。 + +我预期的是当Pi主板启动或者USB驱动连接的时候这个设备能够自动挂载到相同的位置。于是我创建了一个目录用于挂载:新建一个tm目录用于真正的备份地址,并将tm的所有者更改为pi。 + +``` +cd /mnt +sudo mkdir timemachine +cd timemachine +sudo mkdir tm +sudo chown pi:pi tm +``` + +下一步,我打开一个终端并编辑/etc/fstab文件 + +``` +sudo nano /etc/fstab +``` + +并在该文件末尾添加了一行我的设备信息(根据我的设备情况,设置为sdc2): + +``` +/dev/sdc2 /mnt/timemachine ext4 rw,user,exec 0 0 +``` + +你需要通过命名行预装一些包,可能其中一些已经安装在你的系统上了: + +``` +sudo apt-get install build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev libmysqlclient-dev avahi-daemon libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libio-socket-inet6-perl tracker libtracker-sparql-1.0-dev libtracker-miner-1.0-dev hfsprogs hfsutils avahi-daemon +``` + +### 安装并配置Netatalk + +下一步是下载Netatalk,解压下载的archive文件,然后切换到Netatalk目录: + +``` +wget https://sourceforge.net/projects/netatalk/files/netatalk/3.1.10/netatalk-3.1.10.tar.bz2 +tar xvf netatalk-3.1.10.tar.bz2 +cd netatalk-3.1.10 +``` + +然后需要顺序执行configure,make,make install命令安装软件。在netatalk-3.1.10目录中执行configure命令,这个命令需要花点时间才能执行完。 + +``` +./configure --with-init-style=debian-systemd --without-libevent --without-tdb --with-cracklib --enable-krbV-uam --with-pam-confdir=/etc/pam.d --with-dbus-daemon=/usr/bin/dbus-daemon --with-dbus-sysconf-dir=/etc/dbus-1/system.d --with-tracker-pkgconfig-version=1.0 +``` + +configure运行完成后执行make: + +``` +make +``` + +执行完make命令需要花较长时间,可以考虑喝杯咖啡或者做点其他什么。当执行完后执行以下命令: + +``` +sudo make install +``` + +这个命令能够快速执行完成。现在你可以通过下面两个命令验证安装是否成功以及查找配置文件位置。 + +``` +sudo netatalk -V +sudo afpd -V +``` + +然后你需要编辑afp.conf配置文件并在其中指定Time Machine备份路径,可以访问的帐号名并指定是否使用[Spotlight][9]用于搜索备份。 + +``` +sudo nano /usr/local/etc/afp.conf +``` + +下面是afp.conf的配置示例: + +``` +[My Time Machine Volume] +path = /mnt/timemachine/tm +valid users = pi +time machine = yes +spotlight = no +``` +最后,设置Avahi和Netatalk并启动。 + +``` +sudo systemctl enable avahi-daemon +sudo systemctl enable netatalk +sudo systemctl start avahi-daemon +sudo systemctl start netatalk +``` + +### 连接到网络驱动 + +此时,你的Mac可能已经发现并识别了你的Pi设备。打开Mac中的Finder访问下面地址看看以下内容: + + ![](https://i2.wp.com/piboards.com/wp-content/uploads/2017/02/TM_drive.png?resize=241%2C89) + +当然你也可以通过host或者ip地址访问,比如: + +``` +afp://192.168.1.25 +``` +### Time Machine备份 +### Time Machine Backup + +最后打开Mac上的Time Machine,然后选中硬盘,选择Orange pi。 + + ![](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=579%2C381) + +通过这样设置后Orange Pi肯定能够正常工作并能够像champ一样处理,不过这并不是最快速的备份方式。但是这个方法比较简单且便宜,并且正如其展示的一样能够正常工作。如果你已经成功或者改进了这些设置,请在下面留言或者发送消息给我。 + + ![](https://i0.wp.com/piboards.com/wp-content/uploads/2017/02/backup_complete.png?resize=300%2C71) + +Amazon上有售卖Orange Pi主板: + +-------------------------------------------------------------------------------- + +via: http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ + +作者:[MIKE WILMOTH][a] +译者:[beyondworld](https://github.com/beyondworld) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://piboards.com/author/piguy/ +[1]:http://piboards.com/author/piguy/ +[2]:http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ +[3]:https://www.amazon.com/gp/product/B018W6OTIM/ref=as_li_tl?ie=UTF8&tag=piboards-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B018W6OTIM&linkId=08bd6573c99ddb8a79746c8590776c39 +[4]:https://www.armbian.com/ +[5]:https://support.apple.com/kb/PH25710?locale=en_US +[6]:http://netatalk.sourceforge.net/ +[7]:https://en.wikipedia.org/wiki/Avahi_(software) +[8]:http://gparted.org/ +[9]:https://support.apple.com/en-us/HT204014 diff --git a/translated/tech/20170213 Set Up and Configure a Firewall with FirewallD on CentOS 7.md b/translated/tech/20170213 Set Up and Configure a Firewall with FirewallD on CentOS 7.md new file mode 100644 index 0000000000..aef7d7031c --- /dev/null +++ b/translated/tech/20170213 Set Up and Configure a Firewall with FirewallD on CentOS 7.md @@ -0,0 +1,159 @@ + +在 CentOS 7 上利用 FirewallD 设置和配置防火墙 +============================================================ + + ![](https://www.rosehosting.com/blog/wp-content/uploads/2017/02/set-up-and-configure-a-firewall-with-firewalld-on-centos-7.jpg) + + + +FirewallD 是 CentOS 7 服务器上的一个默认可用的防火墙管理工具。基本上,它是 iptables 的封装,有图形配置工具 firewall-config 和命令行工具 firewall-cmd。使用 iptables 服务每次改动都要求刷新旧规则,并且从 `/etc/sysconfig/iptables` 读取新规则,然而 firewalld 仅仅会应用改动了的不同部分。 + +### FirewallD zones + + +FirewallD 使用 services 和 zones 代替 iptables 的 rules 和 chains 。 + +默认情况下,有以下的 zones 可用: + + +* drop – 丢弃所有传入的网络数据包并且无回应,只有传出网络连接可用。 +* block — 拒绝所有传入网络数据包并回应一条主机禁止 ICMP 的消息,只有传出网络连接可用。 +* public — 只接受被选择的传入网络连接,用于公共区域。 +* external — 用于启用伪装的外部网络,只接受被选择的传入网络连接。 +* dmz — DMZ 隔离区,外部受限地访问内部网络,只接受被选择的传入网络连接。 +* work — 对于处在你家庭区域内的计算机,只接受被选择的传入网络连接。 +* home — 对于处在你家庭区域内的计算机,只接受被选择的传入网络连接。 +* internal — 对于处在你内部网络的计算机,只接受被选择的传入网络连接。 +* trusted — 所有网络连接都接受。 + +列出所有可用的 zones : +``` +# firewall-cmd --get-zones +work drop internal external trusted home dmz public block +``` + +列出默认的 zone : +``` +# firewall-cmd --get-default-zone +public +``` + +改变默认的 zone : +``` +# firewall-cmd --set-default-zone=dmz +# firewall-cmd --get-default-zone +dmz +``` + +### FirewallD services + +FirewallD services 使用 XML 配置文件为 firewalld 录入服务信息。 + +列出所有可用的 services : +``` +# firewall-cmd --get-services +amanda-client amanda-k5-client bacula bacula-client ceph ceph-mon dhcp dhcpv6 dhcpv6-client dns docker-registry dropbox-lansync freeipa-ldap freeipa-ldaps freeipa-replication ftp high-availability http https imap imaps ipp ipp-client ipsec iscsi-target kadmin kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mosh mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3 pop3s postgresql privoxy proxy-dhcp ptp pulseaudio puppetmaster radius rpc-bind rsyncd samba samba-client sane smtp smtps snmp snmptrap squid ssh synergy syslog syslog-tls telnet tftp tftp-client tinc tor-socks transmission-client vdsm vnc-server wbem-https xmpp-bosh xmpp-client xmpp-local xmpp-server +``` + + + +XML 配置文件存储在 `/usr/lib/firewalld/services/` 和 `/etc/firewalld/services/` 目录。 + +### 用 FirewallD 配置你的防火墙 + + +作为一个例子,假设你正在运行一个 web 服务,端口为 7022 的 SSH 服务和邮件服务,你可以利用 FirewallD 这样配置你的 [RoseHosting VPS][6]: + + +首先设置默认 zone 为 dmz。 +``` +# firewall-cmd --set-default-zone=dmz +# firewall-cmd --get-default-zone +dmz +``` + +添加持久性的 HTTP 和 HTTPS service 规则到 dmz zone : +``` +# firewall-cmd --zone=dmz --add-service=http --permanent +# firewall-cmd --zone=dmz --add-service=https --permanent +``` + + +开启端口 25 (SMTP) 和端口 465 (SMTPS) : +``` +firewall-cmd --zone=dmz --add-service=smtp --permanent +firewall-cmd --zone=dmz --add-service=smtps --permanent +``` + + +开启 IMAP, IMAPS, POP3 和 POP3S 端口: +``` +firewall-cmd --zone=dmz --add-service=imap --permanent +firewall-cmd --zone=dmz --add-service=imaps --permanent +firewall-cmd --zone=dmz --add-service=pop3 --permanent +firewall-cmd --zone=dmz --add-service=pop3s --permanent +``` + + +将 SSH 端口改到 7022 后,我们移除 ssh service (端口 22),并且开启端口 7022 +``` +firewall-cmd --remove-service=ssh --permanent +firewall-cmd --add-port=7022/tcp --permanent +``` + +要实现这些更改,我们需要重新加载防火墙: +``` +firewall-cmd --reload +``` + + +最后可以列出这些规则: +### firewall-cmd –list-all + +``` +dmz +target: default +icmp-block-inversion: no +interfaces: +sources: +services: http https imap imaps pop3 pop3s smtp smtps +ports: 7022/tcp +protocols: +masquerade: no +forward-ports: +sourceports: +icmp-blocks: +rich rules: +``` + +* * * + + + +当然,如果你使用任何一个我们的 [CentOS VPS hosting][7] 服务,你完全不用做这些。在这种情况下,你可以直接叫我们的专家 Linux 管理员为你设置。他们提供 24x7 h 的帮助并且会马上回应你的请求。 + + +PS. 如果你喜欢这篇文章,请按分享按钮分享给你社交网络上的朋友或者直接在下面留下一个回复。谢谢。 + +-------------------------------------------------------------------------------- + +via: https://www.rosehosting.com/blog/set-up-and-configure-a-firewall-with-firewalld-on-centos-7/ + +译者简介: + +[Locez](http://locez.com) 是一个喜欢技术,喜欢折腾的 Linuxer,靠着对 Linux 的兴趣自学了很多 Linux 相关的知识,并且志在于为 Linux 在中国普及出一份力。 + +作者:[rosehosting.com][a] +译者:[Locez](https://github.com/locez) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.rosehosting.com/blog/set-up-and-configure-a-firewall-with-firewalld-on-centos-7/ +[1]:https://www.rosehosting.com/blog/set-up-and-configure-a-firewall-with-firewalld-on-centos-7/ +[2]:https://www.rosehosting.com/blog/set-up-and-configure-a-firewall-with-firewalld-on-centos-7/#comments +[3]:https://www.rosehosting.com/blog/category/tips-and-tricks/ +[4]:https://plus.google.com/share?url=https://www.rosehosting.com/blog/set-up-and-configure-a-firewall-with-firewalld-on-centos-7/ +[5]:http://www.linkedin.com/shareArticle?mini=true&url=https://www.rosehosting.com/blog/set-up-and-configure-a-firewall-with-firewalld-on-centos-7/&title=Set%20Up%20and%20Configure%20a%20Firewall%20with%20FirewallD%20on%20CentOS%207&summary=FirewallD%20is%20a%20firewall%20management%20tool%20available%20by%20default%20on%20CentOS%207%20servers.%20Basically,%20it%20is%20a%20wrapper%20around%20iptables%20and%20it%20comes%20with%20graphical%20configuration%20tool%20firewall-config%20and%20command%20line%20tool%20firewall-cmd.%20With%20the%20iptables%20service,%20every%20change%20requires%20flushing%20of%20the%20old%20rules%20and%20reading%20the%20new%20rules%20... +[6]:https://www.rosehosting.com/linux-vps-hosting.html +[7]:https://www.rosehosting.com/centos-vps.html diff --git a/translated/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md b/translated/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md new file mode 100644 index 0000000000..f14b1d2868 --- /dev/null +++ b/translated/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md @@ -0,0 +1,80 @@ +# [Best Windows Like Linux Distributions For New Linux Users][12] + [给新手的最佳类 Windows 界面的 Linux 发行版][12] + +[ + ![Best Windows Like Linux Distributions](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/best-windows-like-linux-distributions_1_orig.jpg) +][5] + +Linux 世界的新同学们,大家好,当你看到这么多基于 Linux 内核的发行版后,是不是在选择的过程中无从下手呢。很多同学都是刚刚从熟悉的 Windows 系统来到陌生的 Linux 世界里,都希望使用一款即简单易用,又跟 Windows 长得很像的 Linux 发行版,因此我今天将给大家介绍几款这样的 Linux 发行版,它们的桌面环境跟 Windows 系统界面十分相似,咱们开始吧! + +### Linux Mint + +[ + ![linux mint for new linux users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/linux-mint-for-new-linux-users.jpg?1487173522) +][6] + +我给大家介绍的第一款非常流行的 Linux 发行版就是 “[Linux Mint 操作系统”][14] 。当你决定使用 Linux 系统来代替 Windows 系统时,你应该在某些地方听说过 Linux Mint 这个发行版吧。 Linux Mint 和 Ubuntu 系统一样被公认为是最好用的 Linux 发行版之一, Linux Mint 系统因其简洁易用、功能强大的 Cinnamon 桌面环境而出名。 [Cinnamon][15] 使用起来非常简单,而且你还可以使用各种[桌面主题][16]、图标库、桌面小工具和应用组件来把 Linux Mint 系统配置得跟 Windows XP 、 Windows 7 、 Winows 8 或者 Windows 10 系统的界面一样。 [Cinnamon][17] 也是 Linux 系统中非常流行的桌面环境之一。你一定会对这个简单易用、功能强大的桌面环境爱不释手。同时,你也可以阅读这两篇文章 [Linux Mint 18.1 "Serena" —— 最幽雅的 Linux 发行版之一​][1] 以及 [Cinnamon ——给新手的最佳 Linux 桌面环境][2] 来进一步了解 Linux Mint 操作系统和 Cinnamon 桌面环境。 + +### Zorin OS + +[ + ![zorin os for windows users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/zorin-os-for-windows-users.jpg?1487174149) +][7] + +[Zorin OS 操作系统][18] 也是可以用来替代 Windows 7\ 系统的一款非常流行的 Linux 发行版。其开始菜单和任务栏非常漂亮,整体界面美观充满活力,而且在速度和稳定性方面也相当出色。如果你喜欢的是 Windows 7 而不是 Windows 10\ 系统,那么 Zorin OS 将会是你最好的选择。 Zorin OS 同样预安装了很多软件,因此你再也不用费尽周折的去找软件来安装了。其华丽的仿 Windows 7 系统的界面风格更是让人一见如故。大胆去尝试吧。你还可以阅读[Zorin OS 12 评测 | 本周 Linux 和 Ubuntu 发行版评测][3]这篇文章来进一步了解 Zorin OS 系统。 + +### Robolinux + +[ + ![robolinux for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/robolinux-for-new-users.jpg?1487174455) +][8] + +[Robolinux 操作系统][9] 是一个内嵌了 Windows 运行环境的 Linux 发行版。它支持用户在 Linux 系统中运行 Windows 应用程序,因此,你再也不用担心自己喜欢的 Windows 应用程序在 Linux 系统中无法使用的问题了。在 Robolinux 系统中,这个特性被称为“[隐形虚拟机][10]”。我对这个新颖独特的功能非常感兴趣。同时, Rololinux 系统还包括其它几个桌面环境,你可以根据自己的喜好选择某一个桌面环境。这个系统中还有一个用于完全备份 C 盘的工具,不会让你丢失任何文件。很独特吧,对不对? + +### ChaletOS + +[ + ![chalet os for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/chalet-os-for-new-users.jpg?1487174713) +][11] + +大家有谁用过 [ChaletOS 操作系统][19] 吗?这是一款在界面外观和使用感觉上最接近于 Windows 的 [Linux 发行版][20] 之一。上面的截图是在我使用了 Windows 10 图标和主题包后的效果,使用这个主题包后,可以让 ChaletOS 的桌面变得和 Windows 10 界面一样。一些预安装的应用程序也可以帮助你更好的使用 ChaletOS 系统。在使用的过程中你仿佛又回到了熟悉的 Windows 世界里。上面的截图竟然让我的朋友们信以为真了。去试一试吧,你肯定会喜欢这个发行版。你还可以通过 [ChaletOS —— Linux 发行版中的新秀][4] 这篇文章来进一步了解 ChaletOS 系统。 + +### 总结 + +这篇文章中列出的发行版我尽量写得简短一些,否则会给新手们在选择的过程中造成太多的困惑,无从下手。还有一些大家正在使用的 Linux 发行版在本文中并未提及。希望你们在下面的评论中提出来,以帮助我们的新朋友们在选择 Linux 发行版的过程中作出正确的选择。 + +​ +好吧,到此为止吧,这 4 款操作系统都是从 Windows 转向 Linux 的新用户在学习过程中使用最广泛的 **Linux 发行版** ,当然 Kubuntu 和 Elementary OS 系统也不甘示弱。想安装哪个版本,完全由你自己决定。大多数情况下 [Linux Mint 操作系统][21] 一直独占鳌头。如果你刚踏入 Linux 的世界,我建议你从 Linux Mint 系统开始。行动起来吧,现在就安装一个自己喜欢的 Linux 系统,勇往直前,成为改变 Linux 开源世界的一员。| + +-------------------------------------------------------------------------------- + +via: http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users + +作者:[linuxandubuntu.com][a] +译者:[rusking](https://github.com/rusking) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users +[1]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever +[2]:http://www.linuxandubuntu.com/home/cinnamon-desktop-the-best-desktop-environment-for-new-linux-user +[3]:http://www.linuxandubuntu.com/home/zorin-os-12-review-linuxandubuntu-distro-review-of-the-week +[4]:http://www.linuxandubuntu.com/home/chaletos-new-beautiful-linux-distribution-based-on-xubuntu-and-a-clone-of-windows +[5]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users +[6]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/linux-mint-for-new-linux-users_orig.jpg +[7]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/zorin-os-for-windows-users_orig.jpg +[8]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/robolinux-for-new-users_orig.jpg +[9]:https://www.robolinux.org/ +[10]:https://www.robolinux.org/stealth-vm-info/ +[11]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/chalet-os-for-new-users_orig.jpg +[12]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users +[13]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users#comments +[14]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever +[15]:http://www.developer.linuxmint.com/ +[16]:http://www.linuxandubuntu.com/linux-themes/mintilicious-cinnamon-theme-install-in-linux-mint +[17]:http://www.linuxandubuntu.com/linux-apps-releases/cinnamon-2610 +[18]:https://zorinos.com/ +[19]:https://sites.google.com/site/chaletoslinux/home +[20]:http://www.linuxandubuntu.com/home/how-to-create-a-linux-distro +[21]:http://www.linuxandubuntu.com/home/linux-mint-18-sarah-review diff --git a/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md new file mode 100644 index 0000000000..5ce7670d61 --- /dev/null +++ b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md @@ -0,0 +1,189 @@ +如何在 Debian 和 Ubuntu 上安装 MariaDB 10 +============================================================ + +MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个免费并且开源的分支。它由 MySQL 的原开发者在 GPLv2(通用公共许可证 2 版)下开发,并保持开源。 + +它被设计来实现 MySQL 的高兼容性。对于初学者,可以阅读 [MariaDB vs MySQL][5] 来了解关于它们的特性的更多信息。更重要的是,它被一些大公司/组织使用,比如 Wikipedia、WordPress.com 和 Google plus ,除此之外还有更多的。 + +在这篇文章中,我将向你们展示如何在 Debian 和 Ubuntu 发行版中安装 MariaDB 10.1 稳定版。 + +### 在 Debian 和 Ubuntu 上安装 MariaDB + +1. 在安装之前 MariaDB 之前,你需要通过下面的命令导入仓库密匙并获取 MariaDB 仓库 + +#### 在 Debian 10(Sid) 上 + +``` +$ sudo apt-get install software-properties-common +$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 +$ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian sid main' +``` + +#### 在 Debian 9(Stretch) 上 + +``` +$ sudo apt-get install software-properties-common +$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 +$ sudo add-apt-repository 'deb [arch=amd64] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian stretch main' +``` + +#### 在 Debian 8(Jessie) 上 + +``` +$ sudo apt-get install software-properties-common +$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db +$ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian jessie main' +``` + +#### 在 Debian 7(Wheezy) 上 + +``` +$ sudo apt-get install python-software-properties +$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db +$ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian wheezy main' +``` + +#### 在 Ubuntu 16.10(Yakkety Yak) 上 + +``` +$ sudo apt-get install software-properties-common +$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 +$ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu yakkety main' +``` + +#### 在 Ubuntu 16.04 (Xenial Xerus) 上 + +``` +$ sudo apt-get install software-properties-common +$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 +$ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu xenial main' +``` + +#### 在 Ubuntu 14.04 (Trusty) 上 + +``` +$ sudo apt-get install software-properties-common +$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db +$ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu trusty main' +``` + +2. 然后,更新系统安装包列表,并像下面这样安装 MariaDB 服务器: + +``` +$ sudo apt-get update +$ sudo apt-get install mariadb-server +``` + +安装过程中,将会请求你配置 MariaDB 服务器;在下面的页面中设置一个安全的 root 用户密码: + +[ + ![Set New Root Password for MariaDB](http://www.tecmint.com/wp-content/uploads/2017/02/Set-New-Root-Password-for-MariaDB.png) +][6] + +为 MariaDB 设置新的 Root 密码 + +重新输入密码并按下 [ENTER] 键来继续安装。 + + +[ + ![Repeat MariaDB Password](http://www.tecmint.com/wp-content/uploads/2017/02/Repeat-MariaDB-Password.png) +][7] + +再次输入 MariaDB 密码 + +当 MariaDB 安装包安装完成以后,启动数据库服务器 daemon,同时启用它,使得在下次开机时它能够像下面这样自动启动: + +``` +------------- On SystemD Systems ------------- +$ sudo systemctl start mariadb +$ sudo systemctl enable mariadb +$ sudo systemctl status mariadb +------------- On SysVinit Systems ------------- +$ sudo service mysql start +$ chkconfig --level 35 mysql on +OR +$ update-rc.d mysql defaults +$ sudo service mysql status +``` +[ + ![Start MariaDB Service](http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service.png) +][8] + +开启 MariaDB 服务 + +4. 然后,运行 `mysql_secure_installation` 脚本来保护数据库,在这儿你可以: + +1. 设置 root 密码(如果在上面的配置环节你没有进行设置的话)。 +2. 禁止远程 root 登录 +3. 移除测试数据库 +4. 移除匿名用户 +5. 重装特权 + +``` +$ sudo mysql_secure_installation +``` +[ + ![Secure MariaDB Installation](http://www.tecmint.com/wp-content/uploads/2017/02/sudo-mysql-secure-installation.png) +][9] + +保护 MariaDB 安装 + +5. 一旦数据库服务器受保护以后,可以使用下面的 shell 命令查看已安装版本和登录 MariaDB: + +``` +$ mysql -V +$ mysql -u root -p +``` +[ + ![Check MariaDB Version](http://www.tecmint.com/wp-content/uploads/2017/02/Check-MariaDB-Version.png) +][10] + +查看 MariaDB 版本 + +开始学习 MySQL/MariaDB, 请阅读: + +1. [MySQL / MariaDB 初学者学习指南 — Part 1][1] +2. [MySQL / MariaDB 初学者学习指南 — Part 2][2] +3. [MySQL 基本数据库管理命令 — Part III][3] +4. [针对数据库管理员的 20 个 MySQL (Mysqladmin) 命令 — Part IV][4] + +查看在 Linux 中[监控 MySQL/MariaDB 性能][11]的四个有用的命令行工具,同时浏览 [15 个有用的 MySQL/MariaDB 性能调整和优化技巧][12]。 + +这就是本文的全部内容了。在这篇文章中,我向你们展示了如何在 Debian 和 Ubuntu 的不同发行版中安装 MariaDB 10.1 稳定版。你可以通过下面的评论框给我们提任何问题或者想法。 + +-------------------------------------------------------------------------------- + + +作者简介: + +Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux 系统管理员和网络开发人员,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。 + + + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-mariadb-in-ubuntu-and-debian/ + +作者:[Aaron Kili][a] +译者:[ucasFL](https://github.com/ucasFL) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/learn-mysql-mariadb-for-beginners/ +[2]:http://www.tecmint.com/learn-mysql-mariadb-advance-functions-sql-queries/ +[3]:http://www.tecmint.com/gliding-through-database-mysql-in-a-nutshell-part-i/ +[4]:http://www.tecmint.com/mysqladmin-commands-for-database-administration-in-linux/ +[5]:https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-features/ +[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Set-New-Root-Password-for-MariaDB.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Repeat-MariaDB-Password.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/sudo-mysql-secure-installation.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/02/Check-MariaDB-Version.png +[11]:http://www.tecmint.com/mysql-performance-monitoring/ +[12]:http://www.tecmint.com/mysql-mariadb-performance-tuning-and-optimization/ +[13]:http://www.tecmint.com/author/aaronkili/ +[14]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[15]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/translated/tech/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md b/translated/tech/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md deleted file mode 100644 index f1d6d241f9..0000000000 --- a/translated/tech/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md +++ /dev/null @@ -1,128 +0,0 @@ -LXD 2.0 系列(十):LXD和OpenStack -====================================== - -这是 [LXD 2.0 系列介绍文章][1]的第十一篇。 - - ![LXD logo](https://linuxcontainers.org/static/img/containers.png) - -介绍 -============================================================ - -首先对这次的延期抱歉。为了让一切正常我花了很长时间。我第一次尝试是使用devstack时遇到了一些必须解决问题。 然而即使这样,我还是不能够使网络正常。 - -我终于放弃了devstack,并使用用户友好的Juju尝试使用“conjure-up”部署完整的Ubuntu OpenStack。它终于工作了! - -下面是如何运行一个完整的OpenStack,使用LXD容器而不是VM,并在LXD容器中运行所有这些(嵌套的!)。 - -# 要求 - -这篇文章假设你有一个可以工作的LXD设置,提供容器网络访问,并且你有一个非常强大的CPU,大约50GB给容器空间和至少16GB的内存。 - -记住,我们在这里运行一个完整的OpenStack,这东西不是很轻量! - -# 设置容器 - -OpenStack由大量不同做不同事情的组件组成。 一些需要一些额外的特权,这样可以使设置更简单,我们将使用特权容器。 - -我们将配置支持嵌套的容器,预加载所有需要的内核模块,并允许它访问/dev/mem(显然是需要的)。 - -请注意,这意味着LXD容器的大部分安全特性对该容器被禁用。 然而由OpenStack自身产生的容器将是无特权的,并且可以正常使用LXD的安全特性。 - -``` -lxc launch ubuntu:16.04 openstack -c security.privileged=true -c security.nesting=true -c "linux.kernel_modules=iptable_nat, ip6table_nat, ebtables, openvswitch" -lxc config device add openstack mem unix-char path=/dev/mem -``` - -LXD中有一个小bug,它会尝试加载已经加载到主机上的内核模块。这已在LXD 2.5中得到修复,并将在LXD 2.0.6中修复,但在此之前,可以使用以下方法: - -``` -lxc exec openstack -- ln -s /bin/true /usr/local/bin/modprobe -``` - -我们需要加几条PPA并安装conjure-up,它是我们用来安装Openstack的部署工具。 - -``` -lxc exec openstack -- apt-add-repository ppa:conjure-up/next -y -lxc exec openstack -- apt-add-repository ppa:juju/stable -y -lxc exec openstack -- apt update -lxc exec openstack -- apt dist-upgrade -y -lxc exec openstack -- apt install conjure-up -y -``` - -最后一步是在容器内部配置LXD网络。 -所有问题都选择默认,除了: - -* 使用“dir”存储后端(“zfs”不在嵌套容器中有用) -* 不要配置IPv6网络(conjure-up/juju不太兼容它) - -``` -lxc exec openstack -- lxd init -``` - -现在配置完容器了,现在我们部署OpenStack! - -# 用conjure-up部署OpenStack - -如先前提到的,我们用conjure-up部署OpenStack。 -这是一个很棒的用户友好的可以与Juju交互来部署复杂服务的工具。 - -首先: - -``` -lxc exec openstack -- sudo -u ubuntu -i conjure-up -``` - -* 选择“OpenStack with NovaLXD” -* 选择“localhost”作为部署目标(使用LXD) -* 点击“Deploy all remaining applications” - -接下来会部署OpenStack。整个过程会花费一个多小时,这取决于你运行的机器。你将看到所有服务会被分配一个容器,然后部署并最终互连。 - - ![Conjure-Up deploying OpenStack](https://www.stgraber.org/wp-content/uploads/2016/10/conjure-up.png) - -部署完成后会显示一个安装完成的界面。它会导入一些初始镜像、设置SSH权限、配置网络最后会显示面板的IP地址。 - -# 访问面板并生成一个容器 - -面板运行在一个容器中,因此你不能直接从浏览器中访问。 -最简单的方法是设置一条NAT规则: - -``` -lxc exec openstack -- iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to -``` - -其中“”是conjure-up在安装结束时给你的面板IP地址。 - -你现在可以获取“openstack”容器的IP地址(来自“lxc info openstack”),并将浏览器指向:http:///horizon - -第一次加载可能需要几分钟。 一旦显示了登录界面,输入默认登录名和密码(admin/openstack),你就会看到OpenStack的欢迎面板! - -  ![oslxd-dashboard](https://www.stgraber.org/wp-content/uploads/2016/10/oslxd-dashboard.png) - -现在可以选择左边的“Project”选项卡,进入“Instances”页面。 要启动一个使用nova-lxd的新实例,点击“Launch instance”,选择你想要的镜像,网络等,接着你的实例就产生了。 - -一旦它运行后,你可以为它分配一个浮动IP,它将允许你从你的“openstack”容器中访问你的实例。 - -# 总结 - -OpenStack是一个非常复杂的软件,你也不会想在家里或在单个服务器上运行它。 但是,不管怎样在你的机器上包含这些服务在一个容器中都是非常有趣的。 - -conjure-up是部署这种复杂软件的一个很好的工具,背后使用Juju驱动部署,为每个单独的服务使用LXD容器,最后是实例本身。 - -它也是少数几个容器嵌套多层并实际上有意义的情况之一! - --------------------------------------------------------------------------- -作者简介:我是Stéphane Graber。我是LXC和LXD项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical有限公司担任LXD的技术主管。 - --------------------------------------------------------------------------------- - -via: https://www.stgraber.org/2016/10/26/lxd-2-0-lxd-and-openstack-1112/ - -作者:[Stéphane Graber ][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.stgraber.org/author/stgraber/ -[1]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ diff --git a/translated/tech/linux-ditro -explain/20140507 What is Linux A brief Description.md b/translated/tech/linux-distro -explain/20140507 What is Linux A brief Description.md similarity index 100% rename from translated/tech/linux-ditro -explain/20140507 What is Linux A brief Description.md rename to translated/tech/linux-distro -explain/20140507 What is Linux A brief Description.md diff --git a/translated/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md b/translated/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md new file mode 100644 index 0000000000..0af17c4f11 --- /dev/null +++ b/translated/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md @@ -0,0 +1,86 @@ +### Linux Deepin - 一个拥有独特风格的发行版 + + +这是本系列的第六篇 **Linux Deepin。**这个发行版真的是非常有意思,它有着许多吸引眼球的地方。许许多多的发行版,它们仅仅将已有的应用放入它的应用市场中,使得它们的应用市场十分冷清。但是 Deepin 却将一切变得不同,虽然这个发行版是基于 Debian 的,但是它提供了属于它自己的桌面环境。只有很少的发行版能够将他自己创造的软件做得很好。上次我们曾经提到了 **Elementary OS ** 有着自己的 Pantheon 桌面环境。让我们来看看 Deepin 做得怎么样。 + +[ + ![](http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png) +][6] + +首先,在你登录你的账户后,你会在你设计良好的桌面上看到一个欢迎界面和一个精美的 Dock。这个 Dock 是可定制的,当你将软件放到上面后,它可以有着各种特效。 + +[ + ![](http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png) +][7] + +可以看到 Dock 上有着一个启动器图标,但是还有一个办法可以打开启动器,就是将指针移动到左上角。启动器界面优雅,并且可以分类浏览。 + +[ + ![](http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png) +][8]  + +你可以做上面的截图中看到,启动器中的应用被分类得井井有条。还有一个好的地方是当你用鼠标点击到左下角,所有桌面上的应用将会最小化。再次点击则会回复原样。 + + +[ + ![](http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png) +][9]  + +如果你点击右下角,他将会滑出控制中心。这里可以更改所有电脑上的设置。 + + +[ + ![](http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png) +][10]  + +你可以看到截屏中的控制中心,设计得非常棒而且也是分类得井井有条,你可以在这里设置所有电脑上的项目。甚至可以自定义你的启动界面的壁纸。 + + +[ + ![](http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png) +][11]  + +Deepin 有一个自己的应用市场。你可以在这里找到绝大多数软件,并且他们很容易安装。应用市场也被设计得很好,分类齐全易于导航。 + + +[ + ![](http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png) +][12]  + +另一个亮点是 Deepin 的游戏。他提供许多免费的可联网玩耍的游戏,他们非常的有意思可以很好的用于消磨时光。 + +[ + ![](http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png) +][13] + +Deepin 也提供一个好用的音乐播放软件,它有着网络电台点播功能。如果你本地没有音乐你也不用害怕,你可以调到网络电台模式来享受音乐。 + +总的来说,Deepin 知道如何让用户享受它的产品。就像他们的座右铭那样:“要做,就做出风格”。他们提供的支持服务也非常棒。尽管是个中国的发行版,但是英语支持得也很好,不用担心语言问题。他的安装镜像大约 1.5 GB。你的访问他们的**[官网][14]**来获得更多信息或者下载。我们非常的推荐你试试这个发行版。 + +这就是本篇**Linux 发行版介绍** 的全部内容了,我们将会继续介绍其他的发行版。下次再见! + +-------------------------------------------------------------------------------- + +via: http://www.techphylum.com/2014/08/linux-deepin-distro-with-unique-style.html + +作者:[sumit rohankar https://plus.google.com/112160169713374382262][a] +译者:[Chao-zhi](https://github.com/Chao-zhi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/112160169713374382262 +[1]:http://www.techphylum.com/2014/06/linux-mint-introduction.html +[2]:http://www.techphylum.com/2014/05/elementary-os-brief-introduction.html +[3]:http://www.techphylum.com/2014/05/Introduction-to-fedora.html +[4]:http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html +[5]:http://www.techphylum.com/2014/05/what-is-opensuse-introduction.html +[6]:http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png +[7]:http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png +[8]:http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png +[9]:http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png +[10]:http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png +[11]:http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png +[12]:http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png +[13]:http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png +[14]:http://www.linuxdeepin.com/index.en.html diff --git a/translated/tech/linux-distro -explain/20160708 Manjaro Linux explained.md b/translated/tech/linux-distro -explain/20160708 Manjaro Linux explained.md new file mode 100644 index 0000000000..1f268f7416 --- /dev/null +++ b/translated/tech/linux-distro -explain/20160708 Manjaro Linux explained.md @@ -0,0 +1,56 @@ +# 什么是 Manjaro Linux 操作系统? + +这个系列的第七篇,我们来说一说什么是 Manjaro。Manjaro 是基于 Arch Linux 并且拥有一个漂亮的用户界面的操作系统。 Manjaro 并不像 Debian 或者 Arch 这些 Linux 发行版一样古老,但是他依然十分的稳定而可靠,从而在各色发行版中显得鹤立鸡群。2011 年 Manjaro 才推出了第一个版本。从那以后它一直在不断的进步,今天最新的版本为 16.06.1,代号为 “Daniella”。 + +**为什么我认为 Manjaro 超越了其他的发行版?** 我并没有强求你使用 Manjaro 来替代其他发行版,但是我会尝试说服你来使用 Manjaro。那么让我开始吧! + +*   **基于 Arch:**就像许多人已经知道的那样,不开玩笑的说 Arch 绝对是一个优秀的发行版。但是它对于新手来说十分难以使用。许多新手根本就无法在非图形界面下完成 Arch 的安装。与之相反,Manjaro 有着一个好用的图形安装界面。所以那些想要尝试 Arch 但是又被它的高难度操作所困扰的人们可以去试试 Manjaro。Manjaro 很容易安装并且有着一个友好的用户界面。 + +*   **桌面环境:**Manjaro 在桌面环境上有着许多选择,比如 Xfce、KDE、Deepin、BspWM、Budgie、i3、LXDE、Cinnamon、Enlightenment、Netbook、Fluxbox、Gnome、JWM、LXQT、MATE、Openbox 和 PekWM。所有这些桌面环境在 Manjaro 中都十分漂亮。Manjaro 官方的桌面环境是 Xfce 和 KDE,而其他桌面环境则是社区支持的,我现在就是在 Manjaro 16.06.1中使用 KDE Plasma 桌面环境。 + + [ + ![Manjaro 16.06.1 with KDE plasma 5.6.5](https://4.bp.blogspot.com/-PvT_KN4_avM/V3_eMdhSAvI/AAAAAAAABLY/jjQDrV6dXOw9_vcS5XD3-kZy-chWsR1PQCLcB/s640/Desktop%2B1_001.png "Manjaro 16.06.1 with KDE plasma 5.6.5") +][7] + +> 运行着 KDE plasma 5.6.5 的 Manjaro 16.06.1 + +> 如果你不喜欢 Manjaro 中的 KDE 或者 Xfce,不用担心,你可以从软件包管理器中随时安装其他桌面环境。 + + [ + ![Manjaro 16.06.1 with KDE plasma 5.6.5](https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s640/Screenshot_20160708_223023.png "Manjaro 16.06.1 with KDE plasma 5.6.5") +][8] +> 从软件包管理器中下载 Budgie 桌面环境。 + +* **稳定并且独特的包管理机制:**虽然 Manjaro 很新,但是它也很稳定。Manjaro 的最后一个版本装载的是Linux 内核 4.6.2。Manjaro 不仅仅稳定,更新也比较快。软件更新不久后,就会被它编译到它的库中。Manjaro 用 pacman 来管理它的软件包。Arch Linux 因 Pacman 而名震天下 (当然也饱受争议)。Manjaro 则使用 Octopi 来使其变得更加用户友好,Octopi 是一个用 Qt 编写的 pacman 的图形前端。Manjaro 很好的维护了他自己的库,这也是它的一个优势。 + +[ + ![Manjaro 16.06.1 with KDE plasma 5.6.5](https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s640/Screenshot_20160708_223023.png "Manjaro 16.06.1 with KDE plasma 5.6.5") +][9] +>Octopi 软件包管理器 + +* **社区支持:** 和其他发行版一样,Manjaro 也是一个基于社区的 linux 发行版。当你需要的时候,社区里总是会有人来帮助你。除了 Xfce 和 KDE 是官方支持的以外,其他所有桌面的编译和维护都是由社区完成的。任何用户有了疑问都可以到社区来寻求帮助,这里总是会有真实的 Manjaro 用户来帮助你。 + +在这里,我仅仅只列出了这么几点原因,但是如果你开始使用它了,你会发现更多惊喜的。 + +**还在考虑是否安装它?** 如果你还在彷徨与是否使用 Manjaro 你可以先在 Virtualbox 中试试它,然后再考虑在实体机中安装它。如果你喜欢它,请在这个话题下评论吧,欢迎点赞,关注,丢香蕉给我们,么么哒。 + +-------------------------------------------------------------------------------- + +原文: http://www.techphylum.com/2016/07/manjaro-linux-explained.html + +作者:[sumit rohankar ][a] +译者:[Chao-zhi](https://github.com/Chao-zhi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/112160169713374382262 +[1]:http://www.techphylum.com/2014/08/linux-deepin-distro-with-unique-style.html +[2]:http://www.techphylum.com/2014/06/linux-mint-introduction.html +[3]:http://www.techphylum.com/2014/05/elementary-os-brief-introduction.html +[4]:http://www.techphylum.com/2014/05/Introduction-to-fedora.html +[5]:http://www.techphylum.com/2014/05/what-is-opensuse-introduction.html +[6]:http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html +[7]:https://4.bp.blogspot.com/-PvT_KN4_avM/V3_eMdhSAvI/AAAAAAAABLY/jjQDrV6dXOw9_vcS5XD3-kZy-chWsR1PQCLcB/s1600/Desktop%2B1_001.png +[8]:https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s1600/Screenshot_20160708_223023.png +[9]:https://1.bp.blogspot.com/-vxZ3bI1TTA4/V3_ePOiQG5I/AAAAAAAABLg/ANw2qSmRTVcxl0JZEsUxNGciBdkwuvt9wCKgB/s1600/Screenshot_20160708_223023.png