mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-25 00:50:15 +08:00
Merge branch 'master' of https://github.com/LCTT/TranslateProject into new
This commit is contained in:
commit
87c70672b2
@ -0,0 +1,49 @@
|
||||
从过时的 Windows 机器迁移到 Linux
|
||||
======
|
||||
> 这是一个当老旧的 Windows 机器退役时,决定迁移到 Linux 的故事。
|
||||
|
||||

|
||||
|
||||
我在 ONLYOFFICE 的市场部门工作的每一天,我都能看到 Linux 用户在网上讨论我们的办公软件。我们的产品在 Linux 用户中很受欢迎,这使得我对使用 Linux 作为日常工具的体验非常好奇。我的老旧的 Windows XP 机器在性能上非常差,因此我决定了解 Linux 系统(特别是 Ubuntu)并且决定去尝试使用它。我的两个同事也加入了我的计划。
|
||||
|
||||
### 为何选择 Linux ?
|
||||
|
||||
我们必须做出改变,首先,我们的老系统在性能方面不够用:我们经历过频繁的崩溃,每当运行超过两个应用时,机器就会负载过度,关闭机器时有一半的几率冻结等等。这很容易让我们从工作中分心,意味着我们没有我们应有的工作效率了。
|
||||
|
||||
升级到 Windows 的新版本也是一种选择,但这样可能会带来额外的开销,而且我们的软件本身也是要与 Microsoft 的办公软件竞争。因此我们在这方面也存在意识形态的问题。
|
||||
|
||||
其次,就像我之前提过的, ONLYOFFICE 产品在 Linux 社区内非常受欢迎。通过阅读 Linux 用户在使用我们的软件时的体验,我们也对加入他们很感兴趣。
|
||||
|
||||
在我们要求转换到 Linux 系统一周后,我们拿到了崭新的装好了 [Kubuntu][1] 的机器。我们选择了 16.04 版本,因为这个版本支持 KDE Plasma 5.5 和包括 Dolphin 在内的很多 KDE 应用,同时也包括 LibreOffice 5.1 和 Firefox 45 。
|
||||
|
||||
### Linux 让人喜欢的地方
|
||||
|
||||
我相信 Linux 最大的优势是它的运行速度,比如,从按下机器的电源按钮到开始工作只需要几秒钟时间。从一开始,一切看起来都超乎寻常地快:总体的响应速度,图形界面,甚至包括系统更新的速度。
|
||||
|
||||
另一个使我惊奇的事情是跟 Windows 相比, Linux 几乎能让你配置任何东西,包括整个桌面的外观。在设置里面,我发现了如何修改各种栏目、按钮和字体的颜色和形状,也可以重新布置任意桌面组件的位置,组合桌面小工具(甚至包括漫画和颜色选择器)。我相信我还仅仅只是了解了基本的选项,之后还需要探索这个系统更多著名的定制化选项。
|
||||
|
||||
Linux 发行版通常是一个非常安全的环境。人们很少在 Linux 系统中使用防病毒的软件,因为很少有人会写病毒程序来攻击 Linux 系统。因此你可以拥有很好的系统速度,并且节省了时间和金钱。
|
||||
|
||||
总之, Linux 已经改变了我们的日常生活,用一系列的新选项和功能大大震惊了我们。仅仅通过短时间的使用,我们已经可以给它总结出以下特性:
|
||||
|
||||
* 操作很快很顺畅
|
||||
* 高度可定制
|
||||
* 对新手很友好
|
||||
* 了解基本组件很有挑战性,但回报丰厚
|
||||
* 安全可靠
|
||||
* 对所有想改变工作场所的人来说都是一次绝佳的体验
|
||||
|
||||
你已经从 Windows 或 MacOS 系统换到 Kubuntu 或其他 Linux 变种了么?或者你是否正在考虑做出改变?请分享你想要采用 Linux 系统的原因,连同你对开源的印象一起写在评论中。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/1/move-to-linux-old-windows
|
||||
|
||||
作者:[Michael Korotaev][a]
|
||||
译者:[bookug](https://github.com/bookug)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/michaelk
|
||||
[1]:https://kubuntu.org/
|
@ -1,57 +1,52 @@
|
||||
Linux 开发的五大必备工具
|
||||
======
|
||||
> Linux 上的开发工具如此之多,以至于会担心找不到恰好适合你的。
|
||||
|
||||

|
||||
|
||||
Linux 已经成为工作、娱乐和个人生活等多个领域的支柱,人们已经越来越离不开它。在 Linux 的帮助下,技术的发展速度超出了人们的想象,Linux 开发的速度也以指数规模增长。因此,越来越多的开发者也不断地加入开源和学习 Linux 开发地潮流当中。在这个过程之中,合适的工具是必不可少的,可喜的是,随着 Linux 的发展,大量适用于 Linux 的开发工具也不断成熟。甚至可以说,这样的工具已经多得有点惊人。
|
||||
Linux 已经成为工作、娱乐和个人生活等多个领域的支柱,人们已经越来越离不开它。在 Linux 的帮助下,技术的变革速度超出了人们的想象,Linux 开发的速度也以指数规模增长。因此,越来越多的开发者也不断地加入开源和学习 Linux 开发地潮流当中。在这个过程之中,合适的工具是必不可少的,可喜的是,随着 Linux 的发展,大量适用于 Linux 的开发工具也不断成熟。甚至可以说,这样的工具已经多得有点惊人。
|
||||
|
||||
为了选择更合适自己的开发工具,缩小选择范围是很必要的。但是这篇文章并不会要求你必须使用某个工具,而只是缩小到五个工具类别,然后对每个类别提供一个例子。然而,对于大多数类别,都会有不止一种选择。下面我们来看一下。
|
||||
|
||||
### 容器
|
||||
|
||||
放眼于现实,现在已经是容器的时代了。容器既容易进行部署,又可以方便地构建开发环境。如果你针对的是特定的平台的开发,将开发流程所需要的各种工具都创建到容器映像中是一种很好的方法,只要使用这一个容器映像,就能够快速启动大量运行所需服务的实例。
|
||||
放眼于现实,现在已经是容器的时代了。容器既及其容易部署,又可以方便地构建开发环境。如果你针对的是特定的平台的开发,将开发流程所需要的各种工具都创建到容器映像中是一种很好的方法,只要使用这一个容器映像,就能够快速启动大量运行所需服务的实例。
|
||||
|
||||
一个使用容器的最佳范例是使用 [Docker][1],使用容器(或 Docker)有这些好处:
|
||||
|
||||
* 开发环境保持一致
|
||||
|
||||
* 部署后即可运行
|
||||
|
||||
* 易于跨平台部署
|
||||
|
||||
* Docker 映像适用于多种开发环境和语言
|
||||
|
||||
* 部署单个容器或容器集群都并不繁琐
|
||||
|
||||
|
||||
|
||||
通过 [Docker Hub][2],几乎可以找到适用于任何平台、任何开发环境、任何服务器,任何服务的映像,几乎可以满足任何一种需求。使用 Docker Hub 中的映像,就相当于免除了搭建开发环境的步骤,可以直接开始开发应用程序、服务器、API 或服务。
|
||||
通过 [Docker Hub][2],几乎可以找到适用于任何平台、任何开发环境、任何服务器、任何服务的映像,几乎可以满足任何一种需求。使用 Docker Hub 中的映像,就相当于免除了搭建开发环境的步骤,可以直接开始开发应用程序、服务器、API 或服务。
|
||||
|
||||
Docker 在所有 Linux 平台上都很容易安装,例如可以通过终端输入以下命令在 Ubuntu 上安装 Docker:
|
||||
|
||||
```
|
||||
sudo apt-get install docker.io
|
||||
|
||||
```
|
||||
|
||||
Docker 安装完毕后,就可以从 Docker 仓库中拉取映像,然后开始开发和部署了(如下图)。
|
||||
|
||||
![Docker images][4]
|
||||
|
||||
|
||||
*图 1: Docker 镜像准备部署*
|
||||
|
||||
### 版本控制工具
|
||||
|
||||
如果你正在开发一个巨大的项目,又或者参与团队开发,版本控制工具是必不可少的,它可以用于记录代码变更、提交代码以及合并代码。如果没有这样的工具,项目几乎无法妥善管理。在 Linux 系统上,[Git][6] 和 [GitHub][7] 的易用性和流行程度是其它版本控制工具无法比拟的。如果你对 Git 和 GitHub 还不太熟悉,可以简单理解为 Git 是在本地计算机上安装的版本控制系统,而 GitHub 则是用于上传和管理项目的远程存储库。 Git 可以安装在大多数的 Linux 发行版上。例如在基于 Debian 的系统上,只需要通过以下这一条简单的命令就可以安装:
|
||||
如果你正在开发一个大型项目,又或者参与团队开发,版本控制工具是必不可少的,它可以用于记录代码变更、提交代码以及合并代码。如果没有这样的工具,项目几乎无法妥善管理。在 Linux 系统上,[Git][6] 和 [GitHub][7] 的易用性和流行程度是其它版本控制工具无法比拟的。如果你对 Git 和 GitHub 还不太熟悉,可以简单理解为 Git 是在本地计算机上安装的版本控制系统,而 GitHub 则是用于上传和管理项目的远程存储库。 Git 可以安装在大多数的 Linux 发行版上。例如在基于 Debian 的系统上,只需要通过以下这一条简单的命令就可以安装:
|
||||
|
||||
```
|
||||
sudo apt-get install git
|
||||
|
||||
```
|
||||
|
||||
安装完毕后,就可以使用 Git 来实施版本控制了(如下图)。
|
||||
|
||||
![Git installed][9]
|
||||
|
||||
|
||||
*图 2:Git 已经安装,可以用于很多重要任务*
|
||||
|
||||
Github 会要求用户创建一个帐户。用户可以免费使用 GitHub 来管理非商用项目,当然也可以使用 GitHub 的付费模式(更多相关信息,可以参阅[价格矩阵][10])。
|
||||
|
||||
@ -63,23 +58,23 @@ Github 会要求用户创建一个帐户。用户可以免费使用 GitHub 来
|
||||
|
||||
![Bluefish][13]
|
||||
|
||||
|
||||
*图 3:运行在 Ubuntu 18.04 上的 Bluefish*
|
||||
|
||||
### IDE
|
||||
|
||||
集成开发环境(Integrated Development Environment, IDE)是包含一整套全面的工具、可以实现一站式功能的开发环境。 开发者除了可以使用 IDE 编写代码,还可以编写文档和构建软件。在 Linux 上也有很多适用的 IDE,其中 [Geany][14] 就包含在标准软件库中,它对用户非常友好,功能也相当强大。 Geany 具有语法高亮、代码折叠、自动完成,构建代码片段、自动关闭 XML 和 HTML 标签、调用提示、支持多种文件类型、符号列表、代码导航、构建编译,简单的项目管理和内置的插件系统等强大功能。
|
||||
<ruby>集成开发环境<rt>Integrated Development Environment</rt></ruby>(IDE)是包含一整套全面的工具、可以实现一站式功能的开发环境。 开发者除了可以使用 IDE 编写代码,还可以编写文档和构建软件。在 Linux 上也有很多适用的 IDE,其中 [Geany][14] 就包含在标准软件库中,它对用户非常友好,功能也相当强大。 Geany 具有语法高亮、代码折叠、自动完成,构建代码片段、自动关闭 XML 和 HTML 标签、调用提示、支持多种文件类型、符号列表、代码导航、构建编译,简单的项目管理和内置的插件系统等强大功能。
|
||||
|
||||
Geany 也能在系统上轻松安装,例如执行以下命令在基于 Debian 的 Linux 发行版上安装 Geany:
|
||||
|
||||
```
|
||||
sudo apt-get install geany
|
||||
|
||||
```
|
||||
|
||||
安装完毕后,就可以快速上手这个易用且强大的 IDE 了(如下图)。
|
||||
|
||||
![Geany][16]
|
||||
|
||||
|
||||
*图 4:Geany 可以作为你的 IDE*
|
||||
|
||||
### 文本比较工具
|
||||
|
||||
@ -89,19 +84,18 @@ Meld 可以打开两个文件进行比较,并突出显示文件之间的差异
|
||||
|
||||
![Comparing two files][19]
|
||||
|
||||
*图 5: 以简单差异的模式比较两个文件*
|
||||
|
||||
Meld 也可以通过大多数标准的软件库安装,在基于 Debian 的系统上,执行以下命令就可以安装:
|
||||
|
||||
Meld 也可以通过标准软件如安装,在基于 Debian 的系统上,执行以下命令就可以安装:
|
||||
```
|
||||
sudo apt-get install meld
|
||||
|
||||
```
|
||||
|
||||
### 高效地工作
|
||||
|
||||
以上提到的五个工具除了帮助你完成工作,而且有助于提高效率。尽管适用于 Linux 开发者的工具有很多,但对于以上几个类别,你最好分别使用一个对应的工具。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/learn/intro-to-linux/2018/8/5-essential-tools-linux-development
|
||||
@ -109,7 +103,7 @@ via: https://www.linux.com/learn/intro-to-linux/2018/8/5-essential-tools-linux-d
|
||||
作者:[Jack Wallen][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,66 @@
|
||||
IssueHunt: A New Bounty Hunting Platform for Open Source Software
|
||||
======
|
||||
One of the issues that many open-source developers and companies struggle with is funding. There is an assumption, an expectation even, among the community that Free and Open Source Software must be provided free of cost. But even FOSS needs funding for continued development. How can we keep expecting better quality software if we don’t create systems that enable continued development?
|
||||
|
||||
We already wrote an article about [open source funding platforms][1] out there that try to tackle this shortcoming, as of this July there is a new contender in the market that aims to help fill this gap: [IssueHunt][2].
|
||||
|
||||
### IssueHunt: A Bounty Hunting platform for Open Source Software
|
||||
|
||||
![IssueHunt website][3]
|
||||
|
||||
IssueHunt offers a service that pays freelance developers for contributing to open-source code. It does so through what are called bounties: financial rewards granted to whoever solves a given problem. The funding for these bounties comes from anyone who is willing to donate to have any given bug fixed or feature added.
|
||||
|
||||
If there is a problem with a piece of open-source software that you want fixed, you can offer up a reward amount of your choosing to whoever fixes it.
|
||||
|
||||
Do you want your own product snapped? Offer a bounty on IssueHunt to whoever snaps it. It’s as simple as that.
|
||||
|
||||
And if you are a programmer, you can browse through open issues. Fix the issue (if you could), submit a pull request on the GitHub repository and if your pull request is merged, you get the money.
|
||||
|
||||
#### IssueHunt was originally an internal project for Boostnote
|
||||
|
||||
![IssueHunt][4]
|
||||
|
||||
The product came to be when the developers behind the note-taking app [Boostnote][5] reached out to the community for contributions to their own product.
|
||||
|
||||
In the first two years of utilizing IssueHunt, Boostnote received over 8,400 Github stars through hundreds contributors and overwhelming donations.
|
||||
|
||||
The product was so successful that the team decided to open it up to the rest of the community.
|
||||
|
||||
Today, [a list of projects utilize this service][6], offering thousands of dollars in bounties among them.
|
||||
|
||||
Boostnote boasts [$2,800 in total bounties][7], while Settings Sync, previously known as Visual Studio Code Settings Sync, offers [more than $1,600 in bounties.][8]
|
||||
|
||||
There are other services that provide something similar to what IssueHunt is offering here. Perhaps the most notable is [Bountysource][9], which offers a similar bounty service to IssueHunt, while also offering subscription payment processing similar to [Librepay][10].
|
||||
|
||||
#### What do you think of IssueHunt?
|
||||
|
||||
At the time of writing this article, IssueHunt is in its infancy, but I am incredibly excited to see where this project ends up in the comings years.
|
||||
|
||||
I don’t know about you, but I am more than happy paying for FOSS. If the product is high quality and adds value to my life, then I will happily pay the developer the product. Especially since FOSS developers are creating products that respect my freedom in the process.
|
||||
|
||||
That being said, I will definitely keep my eye on IssueHunt moving forward for ways I can support the community either with my own money or by spreading the word where contribution is needed.
|
||||
|
||||
But what do you think? Do you agree with me, or do you think software should be Gratis free, and that contributions should be made on a volunteer basis? Let us know what you think in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/issuehunt/
|
||||
|
||||
作者:[Phillip Prado][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/phillip/
|
||||
[1]: https://itsfoss.com/open-source-funding-platforms/
|
||||
[2]: https://issuehunt.io
|
||||
[3]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/issuehunt-website.png
|
||||
[4]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/issuehunt.jpg
|
||||
[5]: https://itsfoss.com/boostnote-linux-review/
|
||||
[6]: https://issuehunt.io/repos
|
||||
[7]: https://issuehunt.io/repos/53266139
|
||||
[8]: https://issuehunt.io/repos/47984369
|
||||
[9]: https://www.bountysource.com/
|
||||
[10]: https://liberapay.com/
|
84
sources/talk/20181003 13 tools to measure DevOps success.md
Normal file
84
sources/talk/20181003 13 tools to measure DevOps success.md
Normal file
@ -0,0 +1,84 @@
|
||||
13 tools to measure DevOps success
|
||||
======
|
||||
How's your DevOps initiative really going? Find out with open source tools
|
||||

|
||||
|
||||
In today's enterprise, business disruption is all about agility with quality. Traditional processes and methods of developing software are challenged to keep up with the complexities that come with these new environments. Modern DevOps initiatives aim to help organizations use collaborations among different IT teams to increase agility and accelerate software application deployment.
|
||||
|
||||
How is the DevOps initiative going in your organization? Whether or not it's going as well as you expected, you need to do assessments to verify your impressions. Measuring DevOps success is very important because these initiatives target the very processes that determine how IT works. DevOps also values measuring behavior, although measurements are more about your business processes and less about your development and IT systems.
|
||||
|
||||
A metrics-oriented mindset is critical to ensuring DevOps initiatives deliver the intended results. Data-driven decisions and focused improvement activities lead to increased quality and efficiency. Also, the use of feedback to accelerate delivery is one reason DevOps creates a successful IT culture.
|
||||
|
||||
With DevOps, as with any IT initiative, knowing what to measure is always the first step. Let's examine how to use continuous delivery improvement and open source tools to assess your DevOps program on three key metrics: team efficiency, business agility, and security. These will also help you identify what challenges your organization has and what problems you are trying to solve with DevOps.
|
||||
|
||||
### 3 tools for measuring team efficiency
|
||||
|
||||
Measuring team efficiency—in terms of how the DevOps initiative fits into your organization and how well it works for cultural innovation—is the hardest area to measure. The key metrics that enable the DevOps team to work more effectively on culture and organization are all about agile software development, such as knowledge sharing, prioritizing tasks, resource utilization, issue tracking, cross-functional teams, and collaboration. The following open source tools can help you improve and measure team efficiency:
|
||||
|
||||
* [FunRetro][1] is a simple, intuitive tool that helps you collaborate across teams and improve what you do.
|
||||
* [Kanboard][2] is a [kanban][3] board that helps you visualize your work in progress to focus on your goal.
|
||||
* [Bugzilla][4] is a popular development tool with issue-tracking capabilities.
|
||||
|
||||
|
||||
|
||||
### 6 tools for measuring business agility
|
||||
|
||||
Speed is all that matters for accelerating business agility. Because DevOps gives organizations capabilities to deliver software faster with fewer failures, it's fast gaining acceptance. The key metrics are deployment time, change lead time, release frequency, and failover time. Puppet's [2017 State of DevOps Report][5] shows that high-performing DevOps practitioners deploy code updates 46x more frequently and high performers experience change lead times of under an hour, or 440x faster than average. Following are some open source tools to help you measure business agility:
|
||||
|
||||
* [Kubernetes][6] is a container-orchestration system for automating deployment, scaling, and management of containerized applications. (Read more about [Kubernetes][7] on Opensource.com.)
|
||||
* [CRI-O][8] is a Kubernetes orchestrator used to manage and launch containerized workloads without relying on a traditional container engine.
|
||||
* [Ansible][9] is a popular automation engine used to automate apps and IT infrastructure and run tasks including installing and configuring applications.
|
||||
* [Jenkins][10] is an automation tool used to automate the software development process with continuous integration. It facilitates the technical aspects of continuous delivery.
|
||||
* [Spinnaker][11] is a multi-cloud continuous delivery platform for releasing software changes with high velocity and confidence. It combines a powerful and flexible pipeline management system with integrations to the major cloud providers.
|
||||
* [Istio][12] is a service mesh that helps reduce the complexity of deployments and eases the strain on your development teams.
|
||||
|
||||
|
||||
|
||||
### 4 tools for measuring security
|
||||
|
||||
Security is always the last phase of measuring your DevOps initiative's success. Enterprises that have combined development and operations teams under a DevOps model are generally successful in releasing code at a much faster rate. But this has increased the need for integrating security in the DevOps process (this is known as DevSecOps), because the faster you release code, the faster you release any vulnerabilities in it.
|
||||
|
||||
Measuring security vulnerabilities early ensures that builds are stable before they pass to the next stage in the release pipeline. In addition, measuring security can help overcome resistance to DevOps adoption. You need tools that can help your dev and ops teams identify and prioritize vulnerabilities as they are using software, and teams must ensure they don't introduce vulnerabilities when making changes. These open source tools can help you measure security:
|
||||
|
||||
* [Gauntlt][13] is a ruggedization framework that enables security testing by devs, ops, and security.
|
||||
* [Vault][14] securely manages secrets and encrypts data in transit, including storing credentials and API keys and encrypting passwords for user signups.
|
||||
* [Clair][15] is a project for static analysis of vulnerabilities in appc and Docker containers.
|
||||
* [SonarQube][16] is a platform for continuous inspection of code quality. It performs automatic reviews with static analysis of code to detect bugs, code smells, and security vulnerabilities.
|
||||
|
||||
|
||||
|
||||
**[See our related security article,[7 open source tools for rugged DevOps][17].]**
|
||||
|
||||
Many DevOps initiatives start small. DevOps requires a commitment to a new culture and process rather than new technologies. That's why organizations looking to implement DevOps will likely need to adopt open source tools for collecting data and using it to optimize business success. In that case, highly visible, useful measurements will become an essential part of every DevOps initiative's success
|
||||
|
||||
### What to read next
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/10/devops-measurement-tools
|
||||
|
||||
作者:[Daniel Oh][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/daniel-oh
|
||||
[1]: https://funretro.io/
|
||||
[2]: http://kanboard.net/
|
||||
[3]: https://en.wikipedia.org/wiki/Kanban
|
||||
[4]: https://www.bugzilla.org/
|
||||
[5]: https://puppet.com/resources/whitepaper/state-of-devops-report
|
||||
[6]: https://kubernetes.io/
|
||||
[7]: https://opensource.com/resources/what-is-kubernetes
|
||||
[8]: https://github.com/kubernetes-incubator/cri-o
|
||||
[9]: https://github.com/ansible
|
||||
[10]: https://jenkins.io/
|
||||
[11]: https://www.spinnaker.io/
|
||||
[12]: https://istio.io/
|
||||
[13]: http://gauntlt.org/
|
||||
[14]: https://www.hashicorp.com/blog/vault.html
|
||||
[15]: https://github.com/coreos/clair
|
||||
[16]: https://www.sonarqube.org/
|
||||
[17]: https://opensource.com/article/18/9/open-source-tools-rugged-devops
|
@ -1,7 +1,3 @@
|
||||
# sober-wang 翻译中
|
||||
|
||||
|
||||
|
||||
30 Best Sources For Linux / *BSD / Unix Documentation On the We
|
||||
======
|
||||
|
||||
|
@ -1,140 +0,0 @@
|
||||
[translating by dianbanjiu] The Best Linux Distributions for 2018
|
||||
============================================================
|
||||
|
||||

|
||||
Jack Wallen shares his picks for the best Linux distributions for 2018.[Creative Commons Zero][6]Pixabay
|
||||
|
||||
It’s a new year and the landscape of possibility is limitless for Linux. Whereas 2017 brought about some big changes to a number of Linux distributions, I believe 2018 will bring serious stability and market share growth—for both the server and the desktop.
|
||||
|
||||
For those who might be looking to migrate to the open source platform (or those looking to switch it up), what are the best choices for the coming year? If you hop over to [Distrowatch][14], you’ll find a dizzying array of possibilities, some of which are on the rise, and some that are seeing quite the opposite effect.
|
||||
|
||||
So, which Linux distributions will 2018 favor? I have my thoughts. In fact, I’m going to share them with you now.
|
||||
|
||||
Similar to what I did for[ last year’s list][15], I’m going to make this task easier and break down the list, as follows: sysadmin, lightweight distribution, desktop, distro with more to prove, IoT, and server. These categories should cover the needs of any type of Linux user.
|
||||
|
||||
With that said, let’s get to the list of best Linux distributions for 2018.
|
||||
|
||||
### Best distribution for sysadmins
|
||||
|
||||
[Debian][16] isn’t often seen on “best of” lists. It should be. Why? If you consider that Debian is the foundation for Ubuntu (which is, in turn, the foundation for so many distributions), it’s pretty easy to understand why this distribution should find its way on many a list. But why for administrators? I’ve considered this for two very important reasons:
|
||||
|
||||
* Ease of use
|
||||
|
||||
* Extreme stability
|
||||
|
||||
Because Debian uses the dpkg and apt package managers, it makes for an incredibly easy to use environment. And because Debian offers one of the the most stable Linux platforms, it makes for an ideal environment for so many things: Desktops, servers, testing, development. Although Debian may not include the plethora of applications found in last years winner (for this category), [Parrot Linux][17], it is very easy to add any/all the necessary applications you need to get the job done. And because Debian can be installed with your choice of desktop (Cinnamon, GNOME, KDE, LXDE, Mate, or Xfce), you can be sure the interface will meet your needs.
|
||||
|
||||
|
||||

|
||||
Figure 1: The GNOME desktop running on top of Debian 9.3.[Used with permission][1]
|
||||
|
||||
At the moment, Debian is listed at #2 on Distrowatch. Download it, install it, and then make it serve a specific purpose. It may not be flashy, but Debian is a sysadmin dream come true.
|
||||
|
||||
### Best lightweight distribution
|
||||
|
||||
Lightweight distribution serve a very specific purpose—giving new life to older, lesser-powered machines. But that doesn’t mean these particular distributions should only be considered for your older hardware. If speed is your ultimate need, you might want to see just how fast this category of distribution will run on your modern machine.
|
||||
|
||||
Topping the list of lightweight distributions for 2018 is [Lubuntu][18]. Although there are plenty of options in this category, few come even close to the next-to-zero learning curve found on this distribution. And although Lubuntu’s footprint isn’t quite as small as Puppy Linux, thanks to it being a member of the Ubuntu family, the ease of use gained with this distribution makes up for it. But fear not, Lubuntu won’t bog down your older hardware.The requirements are:
|
||||
|
||||
* CPU: Pentium 4 or Pentium M or AMD K8
|
||||
|
||||
* For local applications, Lubuntu can function with 512MB of RAM. For online usage (Youtube, Google+, Google Drive, and Facebook), 1GB of RAM is recommended.
|
||||
|
||||
Lubuntu makes use of the LXDE desktop (Figure 2), which means users new to Linux won’t have the slightest problem working with this distribution. The short list of included apps (such as Abiword, Gnumeric, and Firefox) are all lightning fast and user-friendly.
|
||||
|
||||
### [lubuntu.jpg][8]
|
||||
|
||||

|
||||
Figure 2: The Lubuntu LXDE desktop in action.[Used with permission][2]
|
||||
|
||||
Lubntu can make short and easy work of breathing life into hardware that is up to ten years old.
|
||||
|
||||
### Best desktop distribution
|
||||
|
||||
For the second year in a row, [Elementary OS][19] tops my list of best Desktop distribution. For many, the leader on the Desktop is [Linux Mint][20] (which is a very fine flavor). However, for my money, it’s hard to beat the ease of use and stability of Elementary OS. Case in point, I was certain the release of [Ubuntu][21] 17.10 would have me migrating back to Canonical’s distribution. Very soon after migrating to the new GNOME-Friendly Ubuntu, I found myself missing the look, feel, and reliability of Elementary OS (Figure 3). After two weeks with Ubuntu, I was back to Elementary OS.
|
||||
|
||||
### [elementaros.jpg][9]
|
||||
|
||||

|
||||
Figure 3: The Pantheon desktop is a work of art as a desktop.[Used with permission][3]
|
||||
|
||||
Anyone that has given Elementary OS a go immediately feels right at home. The Pantheon desktop is a perfect combination of slickness and user-friendliness. And with each update, it only gets better.
|
||||
|
||||
Although Elementary OS stands at #6 on the Distrowatch page hit ranking, I predict it will find itself climbing to at least the third spot by the end of 2018\. The Elementary developers are very much in tune with what users want. They listen and they evolve. However, the current state of this distribution is so good, it seems all they could do to better it is a bit of polish here and there. Anyone looking for a desktop that offers a unified look and feel throughout the UI, Elementary OS is hard to beat. If you need a desktop that offers an outstanding ratio of reliability and ease of use, Elementary OS is your distribution.
|
||||
|
||||
### Best distro for those with something to prove
|
||||
|
||||
For the longest time [Gentoo][22] sat on top of the “show us your skills” distribution list. However, I think it’s time Gentoo took a backseat to the true leader of “something to prove”: [Linux From Scratch][23]. You may not think this fair, as LFS isn’t actually a distribution, but a project that helps users create their own Linux distribution. But, seriously, if you want to go a very long way to proving your Linux knowledge, what better way than to create your own distribution? From the LFS project, you can build a custom Linux system, from the ground up... entirely from source code. So, if you really have something to prove, download the [Linux From Scratch Book][24] and start building.
|
||||
|
||||
### Best distribution for IoT
|
||||
|
||||
For the second year in a row [Ubuntu Core][25] wins, hands down. Ubuntu Core is a tiny, transactional version of Ubuntu, built specifically for embedded and IoT devices. What makes Ubuntu Core so perfect for IoT is that it places the focus on snap packages—universal packages that can be installed onto a platform, without interfering with the base system. These snap packages contain everything they need to run (including dependencies), so there is no worry the installation will break the operating system (or any other installed software). Also, snaps are very easy to upgrade and run in an isolated sandbox, making them a great solution for IoT.
|
||||
|
||||
Another area of security built into Ubuntu Core is the login mechanism. Ubuntu Core works with Ubuntu One ssh keys, such that the only way to log into the system is via uploaded ssh keys to a [Ubuntu One account][26] (Figure 4). This makes for a heightened security for your IoT devices.
|
||||
|
||||
### [ubuntucore.jpg][10]
|
||||
|
||||

|
||||
Figure 4:The Ubuntu Core screen indicating a remote access enabled via Ubuntu One user.[Used with permission][4]
|
||||
|
||||
### Best server distribution
|
||||
|
||||
This where things get a bit confusing. The primary reason is support. If you need commercial support your best choice might be, at first blush, [Red Hat Enterprise Linux][27]. Red Hat has proved itself, year after year, to not only be one of the strongest enterprise server platforms on the planet, but the single most profitable open source businesses (with over $2 billion in annual revenue).
|
||||
|
||||
However, Red Hat isn’t far and away the only server distribution. In fact, Red Hat doesn’t even dominate every aspect of Enterprise server computing. If you look at cloud statistics on Amazon’s Elastic Compute Cloud alone, Ubuntu blows away Red Hat Enterprise Linux. According to [The Cloud Market][28], EC2 statistics show RHEL at under 100k deployments, whereas Ubuntu is over 200k deployments. That’s significant.
|
||||
|
||||
The end result is that Ubuntu has pretty much taken over as the leader in the cloud. And if you combine that with Ubuntu’s ease of working with and managing containers, it starts to become clear that Ubuntu Server is the clear winner for the Server category. And, if you need commercial support, Canonical has you covered, with [Ubuntu Advantage][29].
|
||||
|
||||
The one caveat to Ubuntu Server is that it defaults to a text-only interface (Figure 5). You can install a GUI, if needed, but working with the Ubuntu Server command line is pretty straightforward (and something every Linux administrator should know).
|
||||
|
||||
### [ubuntuserver.jpg][11]
|
||||
|
||||

|
||||
Figure 5: The Ubuntu server login, informing of updates.[Used with permission][5]
|
||||
|
||||
### The choice is yours
|
||||
|
||||
As I said before, these choices are all very subjective … but if you’re looking for a great place to start, give these distributions a try. Each one can serve a very specific purpose and do it better than most. Although you may not agree with my particular picks, chances are you’ll agree that Linux offers amazing possibilities on every front. And, stay tuned for more “best distro” picks next week.
|
||||
|
||||
_Learn more about Linux through the free ["Introduction to Linux" ][13]course from The Linux Foundation and edX._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/learn/intro-to-linux/2018/1/best-linux-distributions-2018
|
||||
|
||||
作者:[JACK WALLEN ][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/jlwallen
|
||||
[1]:https://www.linux.com/licenses/category/used-permission
|
||||
[2]:https://www.linux.com/licenses/category/used-permission
|
||||
[3]:https://www.linux.com/licenses/category/used-permission
|
||||
[4]:https://www.linux.com/licenses/category/used-permission
|
||||
[5]:https://www.linux.com/licenses/category/used-permission
|
||||
[6]:https://www.linux.com/licenses/category/creative-commons-zero
|
||||
[7]:https://www.linux.com/files/images/debianjpg
|
||||
[8]:https://www.linux.com/files/images/lubuntujpg-2
|
||||
[9]:https://www.linux.com/files/images/elementarosjpg
|
||||
[10]:https://www.linux.com/files/images/ubuntucorejpg
|
||||
[11]:https://www.linux.com/files/images/ubuntuserverjpg-1
|
||||
[12]:https://www.linux.com/files/images/linux-distros-2018jpg
|
||||
[13]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
||||
[14]:https://distrowatch.com/
|
||||
[15]:https://www.linux.com/news/learn/sysadmin/best-linux-distributions-2017
|
||||
[16]:https://www.debian.org/
|
||||
[17]:https://www.parrotsec.org/
|
||||
[18]:http://lubuntu.me/
|
||||
[19]:https://elementary.io/
|
||||
[20]:https://linuxmint.com/
|
||||
[21]:https://www.ubuntu.com/
|
||||
[22]:https://www.gentoo.org/
|
||||
[23]:http://www.linuxfromscratch.org/
|
||||
[24]:http://www.linuxfromscratch.org/lfs/download.html
|
||||
[25]:https://www.ubuntu.com/core
|
||||
[26]:https://login.ubuntu.com/
|
||||
[27]:https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux
|
||||
[28]:http://thecloudmarket.com/stats#/by_platform_definition
|
||||
[29]:https://buy.ubuntu.com/?_ga=2.177313893.113132429.1514825043-1939188204.1510782993
|
@ -1,4 +1,4 @@
|
||||
Rock Solid React.js Foundations: A Beginner’s Guide
|
||||
GraveAccent翻译中 Rock Solid React.js Foundations: A Beginner’s Guide
|
||||
============================================================
|
||||
** 此处有Canvas,请手动处理 **
|
||||
|
||||
@ -289,4 +289,4 @@ via: https://medium.freecodecamp.org/rock-solid-react-js-foundations-a-beginners
|
||||
[9]:https://codepen.io/raynesax/pen/QaROqK
|
||||
[10]:https://twitter.com/rajat1saxena
|
||||
[11]:mailto:rajat@raynstudios.com
|
||||
[12]:https://www.youtube.com/channel/UCUmQhjjF9bsIaVDJUHSIIKw
|
||||
[12]:https://www.youtube.com/channel/UCUmQhjjF9bsIaVDJUHSIIKw
|
||||
|
@ -1,114 +0,0 @@
|
||||
translating by Flowsnow
|
||||
|
||||
A Simple, Beautiful And Cross-platform Podcast App
|
||||
======
|
||||
|
||||

|
||||
|
||||
Podcasts have become very popular in the last few years. Podcasts are what’s called “infotainment”, they are generally light-hearted, but they generally give you valuable information. Podcasts have blown up in the last few years, and if you like something, chances are there is a podcast about it. There are a lot of podcast players out there for the Linux desktop, but if you want something that is visually beautiful, has slick animations, and works on every platform, there aren’t a lot of alternatives to **CPod**. CPod (formerly known as **Cumulonimbus** ) is an open source and slickest podcast app that works on Linux, MacOS and Windows.
|
||||
|
||||
CPod runs on something called **Electron** – a tool that allows developers to build cross-platform (E.g Windows, MacOs and Linux) desktop GUI applications. In this brief guide, we will be discussing – how to install and use CPod podcast app in Linux.
|
||||
|
||||
### Installing CPod
|
||||
|
||||
Go to the [**releases page**][1] of CPod. Download and Install the binary for your platform of choice. If you use Ubuntu/Debian, you can just download and install the .deb file from the releases page as shown below.
|
||||
|
||||
```
|
||||
$ wget https://github.com/z-------------/CPod/releases/download/v1.25.7/CPod_1.25.7_amd64.deb
|
||||
|
||||
$ sudo apt update
|
||||
|
||||
$ sudo apt install gdebi
|
||||
|
||||
$ sudo gdebi CPod_1.25.7_amd64.deb
|
||||
```
|
||||
|
||||
If you use any other distribution, you probably should use the **AppImage** in the releases page.
|
||||
|
||||
Download the AppImage file from the releases page.
|
||||
|
||||
Open your terminal, and go to the directory where the AppImage file has been stored. Change the permissions to allow execution:
|
||||
|
||||
```
|
||||
$ chmod +x CPod-1.25.7-x86_64.AppImage
|
||||
```
|
||||
|
||||
Execute the AppImage File:
|
||||
|
||||
```
|
||||
$ ./CPod-1.25.7-x86_64.AppImage
|
||||
```
|
||||
|
||||
You’ll be presented a dialog asking whether to integrate the app with the system. Click **Yes** if you want to do so.
|
||||
|
||||
### Features
|
||||
|
||||
**Explore Tab**
|
||||
|
||||

|
||||
|
||||
CPod uses the Apple iTunes database to find podcasts. This is good, because the iTunes database is the biggest one out there. If there is a podcast out there, chances are it’s on iTunes. To find podcasts, just use the top search bar in the Explore section. The Explore Section also shows a few popular podcasts.
|
||||
|
||||
**Home Tab**
|
||||
|
||||

|
||||
|
||||
The Home Tab is the tab that opens by default when you open the app. The Home Tab shows a chronological list of all the episodes of all the podcasts that you have subscribed to.
|
||||
|
||||
From the home tab, you can:
|
||||
|
||||
1. Mark episodes read.
|
||||
2. Download them for offline playing
|
||||
3. Add them to the queue.
|
||||
|
||||

|
||||
|
||||
**Subscriptions Tab**
|
||||
|
||||

|
||||
|
||||
You can of course, subscribe to podcasts that you like. A few other things you can do in the Subscriptions Tab is:
|
||||
|
||||
1. Refresh Podcast Artwork
|
||||
2. Export and Import Subscriptions to/from an .OPML file.
|
||||
|
||||
|
||||
|
||||
**The Player**
|
||||
|
||||

|
||||
|
||||
The player is perhaps the most beautiful part of CPod. The app changes the overall look and feel according to the banner of the podcast. There’s a sound visualiser at the bottom. To the right, you can see and search for other episodes of this podcast.
|
||||
|
||||
**Cons/Missing Features**
|
||||
|
||||
While I love this app, there are a few features and disadvantages that CPod does have:
|
||||
|
||||
1. Poor MPRIS Integration – You can play/pause the podcast from the media player dialog of your desktop environment, but not much more. The name of the podcast is not shown, and you can go to the next/previous episode.
|
||||
2. No support for chapters.
|
||||
3. No auto-downloading – you have to manually download episodes.
|
||||
4. CPU usage during use is pretty high (even for an Electron app).
|
||||
|
||||
|
||||
|
||||
### Verdict
|
||||
|
||||
While it does have its cons, CPod is clearly the most aesthetically pleasing podcast player app out there, and it has most basic features down. If you love using visually beautiful apps, and don’t need the advanced features, this is the perfect app for you. I know for a fact that I’m going to use it.
|
||||
|
||||
Do you like CPod? Please put your opinions on the comments below!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/cpod-a-simple-beautiful-and-cross-platform-podcast-app/
|
||||
|
||||
作者:[EDITOR][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/editor/
|
||||
[1]: https://github.com/z-------------/CPod/releases
|
@ -1,3 +1,5 @@
|
||||
translating---geekpi
|
||||
|
||||
How to Boot Ubuntu 18.04 / Debian 9 Server in Rescue (Single User mode) / Emergency Mode
|
||||
======
|
||||
Booting a Linux Server into a single user mode or **rescue mode** is one of the important troubleshooting that a Linux admin usually follow while recovering the server from critical conditions. In Ubuntu 18.04 and Debian 9, single user mode is known as a rescue mode.
|
||||
|
@ -1,3 +1,5 @@
|
||||
HankChow translating
|
||||
|
||||
How to Replace one Linux Distro With Another in Dual Boot [Guide]
|
||||
======
|
||||
**If you have a Linux distribution installed, you can replace it with another distribution in the dual boot. You can also keep your personal documents while switching the distribution.**
|
||||
|
@ -1,302 +0,0 @@
|
||||
heguangzhi Translating
|
||||
|
||||
An introduction to swap space on Linux systems
|
||||
======
|
||||
|
||||

|
||||
|
||||
Swap space is a common aspect of computing today, regardless of operating system. Linux uses swap space to increase the amount of virtual memory available to a host. It can use one or more dedicated swap partitions or a swap file on a regular filesystem or logical volume.
|
||||
|
||||
There are two basic types of memory in a typical computer. The first type, random access memory (RAM), is used to store data and programs while they are being actively used by the computer. Programs and data cannot be used by the computer unless they are stored in RAM. RAM is volatile memory; that is, the data stored in RAM is lost if the computer is turned off.
|
||||
|
||||
Hard drives are magnetic media used for long-term storage of data and programs. Magnetic media is nonvolatile; the data stored on a disk remains even when power is removed from the computer. The CPU (central processing unit) cannot directly access the programs and data on the hard drive; it must be copied into RAM first, and that is where the CPU can access its programming instructions and the data to be operated on by those instructions. During the boot process, a computer copies specific operating system programs, such as the kernel and init or systemd, and data from the hard drive into RAM, where it is accessed directly by the computer’s processor, the CPU.
|
||||
|
||||
### Swap space
|
||||
|
||||
Swap space is the second type of memory in modern Linux systems. The primary function of swap space is to substitute disk space for RAM memory when real RAM fills up and more space is needed.
|
||||
|
||||
For example, assume you have a computer system with 8GB of RAM. If you start up programs that don’t fill that RAM, everything is fine and no swapping is required. But suppose the spreadsheet you are working on grows when you add more rows, and that, plus everything else that's running, now fills all of RAM. Without swap space available, you would have to stop working on the spreadsheet until you could free up some of your limited RAM by closing down some other programs.
|
||||
|
||||
The kernel uses a memory management program that detects blocks, aka pages, of memory in which the contents have not been used recently. The memory management program swaps enough of these relatively infrequently used pages of memory out to a special partition on the hard drive specifically designated for “paging,” or swapping. This frees up RAM and makes room for more data to be entered into your spreadsheet. Those pages of memory swapped out to the hard drive are tracked by the kernel’s memory management code and can be paged back into RAM if they are needed.
|
||||
|
||||
The total amount of memory in a Linux computer is the RAM plus swap space and is referred to as virtual memory.
|
||||
|
||||
### Types of Linux swap
|
||||
|
||||
Linux provides for two types of swap space. By default, most Linux installations create a swap partition, but it is also possible to use a specially configured file as a swap file. A swap partition is just what its name implies—a standard disk partition that is designated as swap space by the `mkswap` command.
|
||||
|
||||
A swap file can be used if there is no free disk space in which to create a new swap partition or space in a volume group where a logical volume can be created for swap space. This is just a regular file that is created and preallocated to a specified size. Then the `mkswap` command is run to configure it as swap space. I don’t recommend using a file for swap space unless absolutely necessary.
|
||||
|
||||
### Thrashing
|
||||
|
||||
Thrashing can occur when total virtual memory, both RAM and swap space, become nearly full. The system spends so much time paging blocks of memory between swap space and RAM and back that little time is left for real work. The typical symptoms of this are obvious: The system becomes slow or completely unresponsive, and the hard drive activity light is on almost constantly.
|
||||
|
||||
If you can manage to issue a command like `free` that shows CPU load and memory usage, you will see that the CPU load is very high, perhaps as much as 30 to 40 times the number of CPU cores in the system. Another symptom is that both RAM and swap space are almost completely allocated.
|
||||
|
||||
After the fact, looking at SAR (system activity report) data can also show these symptoms. I install SAR on every system I work on and use it for post-repair forensic analysis.
|
||||
|
||||
### What is the right amount of swap space?
|
||||
|
||||
Many years ago, the rule of thumb for the amount of swap space that should be allocated on the hard drive was 2X the amount of RAM installed in the computer (of course, that was when most computers' RAM was measured in KB or MB). So if a computer had 64KB of RAM, a swap partition of 128KB would be an optimum size. This rule took into account the facts that RAM sizes were typically quite small at that time and that allocating more than 2X RAM for swap space did not improve performance. With more than twice RAM for swap, most systems spent more time thrashing than actually performing useful work.
|
||||
|
||||
RAM has become an inexpensive commodity and most computers these days have amounts of RAM that extend into tens of gigabytes. Most of my newer computers have at least 8GB of RAM, one has 32GB, and my main workstation has 64GB. My older computers have from 4 to 8 GB of RAM.
|
||||
|
||||
When dealing with computers having huge amounts of RAM, the limiting performance factor for swap space is far lower than the 2X multiplier. The Fedora 28 online Installation Guide, which can be found online at [Fedora Installation Guide][1], defines current thinking about swap space allocation. I have included below some discussion and the table of recommendations from that document.
|
||||
|
||||
The following table provides the recommended size of a swap partition depending on the amount of RAM in your system and whether you want sufficient memory for your system to hibernate. The recommended swap partition size is established automatically during installation. To allow for hibernation, however, you will need to edit the swap space in the custom partitioning stage.
|
||||
|
||||
_Table 1: Recommended system swap space in Fedora 28 documentation_
|
||||
|
||||
| **Amount of system RAM** | **Recommended swap space** | **Recommended swap with hibernation** |
|
||||
|--------------------------|-----------------------------|---------------------------------------|
|
||||
| less than 2 GB | 2 times the amount of RAM | 3 times the amount of RAM |
|
||||
| 2 GB - 8 GB | Equal to the amount of RAM | 2 times the amount of RAM |
|
||||
| 8 GB - 64 GB | 0.5 times the amount of RAM | 1.5 times the amount of RAM |
|
||||
| more than 64 GB | workload dependent | hibernation not recommended |
|
||||
|
||||
At the border between each range listed above (for example, a system with 2 GB, 8 GB, or 64 GB of system RAM), use discretion with regard to chosen swap space and hibernation support. If your system resources allow for it, increasing the swap space may lead to better performance.
|
||||
|
||||
Of course, most Linux administrators have their own ideas about the appropriate amount of swap space—as well as pretty much everything else. Table 2, below, contains my recommendations based on my personal experiences in multiple environments. These may not work for you, but as with Table 1, they may help you get started.
|
||||
|
||||
_Table 2: Recommended system swap space per the author_
|
||||
|
||||
| Amount of RAM | Recommended swap space |
|
||||
|---------------|------------------------|
|
||||
| ≤ 2GB | 2X RAM |
|
||||
| 2GB – 8GB | = RAM |
|
||||
| >8GB | 8GB |
|
||||
|
||||
One consideration in both tables is that as the amount of RAM increases, beyond a certain point adding more swap space simply leads to thrashing well before the swap space even comes close to being filled. If you have too little virtual memory while following these recommendations, you should add more RAM, if possible, rather than more swap space. As with all recommendations that affect system performance, use what works best for your specific environment. This will take time and effort to experiment and make changes based on the conditions in your Linux environment.
|
||||
|
||||
#### Adding more swap space to a non-LVM disk environment
|
||||
|
||||
Due to changing requirements for swap space on hosts with Linux already installed, it may become necessary to modify the amount of swap space defined for the system. This procedure can be used for any general case where the amount of swap space needs to be increased. It assumes sufficient available disk space is available. This procedure also assumes that the disks are partitioned in “raw” EXT4 and swap partitions and do not use logical volume management (LVM).
|
||||
|
||||
The basic steps to take are simple:
|
||||
|
||||
1. Turn off the existing swap space.
|
||||
|
||||
2. Create a new swap partition of the desired size.
|
||||
|
||||
3. Reread the partition table.
|
||||
|
||||
4. Configure the partition as swap space.
|
||||
|
||||
5. Add the new partition/etc/fstab.
|
||||
|
||||
6. Turn on swap.
|
||||
|
||||
|
||||
|
||||
|
||||
A reboot should not be necessary.
|
||||
|
||||
For safety's sake, before turning off swap, at the very least you should ensure that no applications are running and that no swap space is in use. The `free` or `top` commands can tell you whether swap space is in use. To be even safer, you could revert to run level 1 or single-user mode.
|
||||
|
||||
Turn off the swap partition with the command which turns off all swap space:
|
||||
|
||||
```
|
||||
swapoff -a
|
||||
|
||||
```
|
||||
|
||||
Now display the existing partitions on the hard drive.
|
||||
|
||||
```
|
||||
fdisk -l
|
||||
|
||||
```
|
||||
|
||||
This displays the current partition tables on each drive. Identify the current swap partition by number.
|
||||
|
||||
Start `fdisk` in interactive mode with the command:
|
||||
|
||||
```
|
||||
fdisk /dev/<device name>
|
||||
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
fdisk /dev/sda
|
||||
|
||||
```
|
||||
|
||||
At this point, `fdisk` is now interactive and will operate only on the specified disk drive.
|
||||
|
||||
Use the fdisk `p` sub-command to verify that there is enough free space on the disk to create the new swap partition. The space on the hard drive is shown in terms of 512-byte blocks and starting and ending cylinder numbers, so you may have to do some math to determine the available space between and at the end of allocated partitions.
|
||||
|
||||
Use the `n` sub-command to create a new swap partition. fdisk will ask you the starting cylinder. By default, it chooses the lowest-numbered available cylinder. If you wish to change that, type in the number of the starting cylinder.
|
||||
|
||||
The `fdisk` command now allows you to enter the size of the partitions in a number of formats, including the last cylinder number or the size in bytes, KB or MB. Type in 4000M, which will give about 4GB of space on the new partition (for example), and press Enter.
|
||||
|
||||
Use the `p` sub-command to verify that the partition was created as you specified it. Note that the partition will probably not be exactly what you specified unless you used the ending cylinder number. The `fdisk` command can only allocate disk space in increments on whole cylinders, so your partition may be a little smaller or larger than you specified. If the partition is not what you want, you can delete it and create it again.
|
||||
|
||||
Now it is necessary to specify that the new partition is to be a swap partition. The sub-command `t` allows you to specify the type of partition. So enter `t`, specify the partition number, and when it asks for the hex code partition type, type 82, which is the Linux swap partition type, and press Enter.
|
||||
|
||||
When you are satisfied with the partition you have created, use the `w` sub-command to write the new partition table to the disk. The `fdisk` program will exit and return you to the command prompt after it completes writing the revised partition table. You will probably receive the following message as `fdisk` completes writing the new partition table:
|
||||
|
||||
```
|
||||
The partition table has been altered!
|
||||
Calling ioctl() to re-read partition table.
|
||||
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
|
||||
The kernel still uses the old table.
|
||||
The new table will be used at the next reboot.
|
||||
Syncing disks.
|
||||
```
|
||||
|
||||
At this point, you use the `partprobe` command to force the kernel to re-read the partition table so that it is not necessary to perform a reboot.
|
||||
|
||||
```
|
||||
partprobe
|
||||
```
|
||||
|
||||
Now use the command `fdisk -l` to list the partitions and the new swap partition should be among those listed. Be sure that the new partition type is “Linux swap”.
|
||||
|
||||
It will be necessary to modify the /etc/fstab file to point to the new swap partition. The existing line may look like this:
|
||||
|
||||
```
|
||||
LABEL=SWAP-sdaX swap swap defaults 0 0
|
||||
|
||||
```
|
||||
|
||||
where `X` is the partition number. Add a new line that looks similar this, depending upon the location of your new swap partition:
|
||||
|
||||
```
|
||||
/dev/sdaY swap swap defaults 0 0
|
||||
|
||||
```
|
||||
|
||||
Be sure to use the correct partition number. Now you can perform the final step in creating the swap partition. Use the `mkswap` command to define the partition as a swap partition.
|
||||
|
||||
```
|
||||
mkswap /dev/sdaY
|
||||
|
||||
```
|
||||
|
||||
The final step is to turn swap on using the command:
|
||||
|
||||
```
|
||||
swapon -a
|
||||
|
||||
```
|
||||
|
||||
Your new swap partition is now online along with the previously existing swap partition. You can use the `free` or `top` commands to verify this.
|
||||
|
||||
#### Adding swap to an LVM disk environment
|
||||
|
||||
If your disk setup uses LVM, changing swap space will be fairly easy. Again, this assumes that space is available in the volume group in which the current swap volume is located. By default, the installation procedures for Fedora Linux in an LVM environment create the swap partition as a logical volume. This makes it easy because you can simply increase the size of the swap volume.
|
||||
|
||||
Here are the steps required to increase the amount of swap space in an LVM environment:
|
||||
|
||||
1. Turn off all swap.
|
||||
|
||||
2. Increase the size of the logical volume designated for swap.
|
||||
|
||||
3. Configure the resized volume as swap space.
|
||||
|
||||
4. Turn on swap.
|
||||
|
||||
|
||||
|
||||
|
||||
First, let’s verify that swap exists and is a logical volume using the `lvs` command (list logical volume).
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# lvs
|
||||
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
|
||||
home fedora_studentvm1 -wi-ao---- 2.00g
|
||||
pool00 fedora_studentvm1 twi-aotz-- 2.00g 8.17 2.93
|
||||
root fedora_studentvm1 Vwi-aotz-- 2.00g pool00 8.17
|
||||
swap fedora_studentvm1 -wi-ao---- 8.00g
|
||||
tmp fedora_studentvm1 -wi-ao---- 5.00g
|
||||
usr fedora_studentvm1 -wi-ao---- 15.00g
|
||||
var fedora_studentvm1 -wi-ao---- 10.00g
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
You can see that the current swap size is 8GB. In this case, we want to add 2GB to this swap volume. First, stop existing swap. You may have to terminate running programs if swap space is in use.
|
||||
|
||||
```
|
||||
swapoff -a
|
||||
|
||||
```
|
||||
|
||||
Now increase the size of the logical volume.
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# lvextend -L +2G /dev/mapper/fedora_studentvm1-swap
|
||||
Size of logical volume fedora_studentvm1/swap changed from 8.00 GiB (2048 extents) to 10.00 GiB (2560 extents).
|
||||
Logical volume fedora_studentvm1/swap successfully resized.
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
Run the `mkswap` command to make this entire 10GB partition into swap space.
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# mkswap /dev/mapper/fedora_studentvm1-swap
|
||||
mkswap: /dev/mapper/fedora_studentvm1-swap: warning: wiping old swap signature.
|
||||
Setting up swapspace version 1, size = 10 GiB (10737414144 bytes)
|
||||
no label, UUID=3cc2bee0-e746-4b66-aa2d-1ea15ef1574a
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
Turn swap back on.
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# swapon -a
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
Now verify the new swap space is present with the list block devices command. Again, a reboot is not required.
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:0 0 60G 0 disk
|
||||
|-sda1 8:1 0 1G 0 part /boot
|
||||
`-sda2 8:2 0 59G 0 part
|
||||
|-fedora_studentvm1-pool00_tmeta 253:0 0 4M 0 lvm
|
||||
| `-fedora_studentvm1-pool00-tpool 253:2 0 2G 0 lvm
|
||||
| |-fedora_studentvm1-root 253:3 0 2G 0 lvm /
|
||||
| `-fedora_studentvm1-pool00 253:6 0 2G 0 lvm
|
||||
|-fedora_studentvm1-pool00_tdata 253:1 0 2G 0 lvm
|
||||
| `-fedora_studentvm1-pool00-tpool 253:2 0 2G 0 lvm
|
||||
| |-fedora_studentvm1-root 253:3 0 2G 0 lvm /
|
||||
| `-fedora_studentvm1-pool00 253:6 0 2G 0 lvm
|
||||
|-fedora_studentvm1-swap 253:4 0 10G 0 lvm [SWAP]
|
||||
|-fedora_studentvm1-usr 253:5 0 15G 0 lvm /usr
|
||||
|-fedora_studentvm1-home 253:7 0 2G 0 lvm /home
|
||||
|-fedora_studentvm1-var 253:8 0 10G 0 lvm /var
|
||||
`-fedora_studentvm1-tmp 253:9 0 5G 0 lvm /tmp
|
||||
sr0 11:0 1 1024M 0 rom
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
You can also use the `swapon -s` command, or `top`, `free`, or any of several other commands to verify this.
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# free
|
||||
total used free shared buff/cache available
|
||||
Mem: 4038808 382404 2754072 4152 902332 3404184
|
||||
Swap: 10485756 0 10485756
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
Note that the different commands display or require as input the device special file in different forms. There are a number of ways in which specific devices are accessed in the /dev directory. My article, [Managing Devices in Linux][2], includes more information about the /dev directory and its contents.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/9/swap-space-linux-systems
|
||||
|
||||
作者:[David Both][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/dboth
|
||||
[1]: https://docs.fedoraproject.org/en-US/fedora/f28/install-guide/
|
||||
[2]: https://opensource.com/article/16/11/managing-devices-linux
|
87
sources/tech/20180927 5 cool tiling window managers.md
Normal file
87
sources/tech/20180927 5 cool tiling window managers.md
Normal file
@ -0,0 +1,87 @@
|
||||
5 cool tiling window managers
|
||||
======
|
||||
|
||||

|
||||
The Linux desktop ecosystem offers multiple window managers (WMs). Some are developed as part of a desktop environment. Others are meant to be used as standalone application. This is the case of tiling WMs, which offer a more lightweight, customized environment. This article presents five such tiling WMs for you to try out.
|
||||
|
||||
### i3
|
||||
|
||||
[i3][1] is one of the most popular tiling window managers. Like most other such WMs, i3 focuses on low resource consumption and customizability by the user.
|
||||
|
||||
You can refer to [this previous article in the Magazine][2] to get started with i3 installation details and how to configure it.
|
||||
|
||||
### sway
|
||||
|
||||
[sway][3] is a tiling Wayland compositor. It has the advantage of compatibility with an existing i3 configuration, so you can use it to replace i3 and use Wayland as the display protocol.
|
||||
|
||||
You can use dnf to install sway from Fedora repository:
|
||||
|
||||
```
|
||||
$ sudo dnf install sway
|
||||
```
|
||||
|
||||
If you want to migrate from i3 to sway, there’s a small [migration guide][4] available.
|
||||
|
||||
### Qtile
|
||||
|
||||
[Qtile][5] is another tiling manager that also happens to be written in Python. By default, you configure Qtile in a Python script located under ~/.config/qtile/config.py. When this script is not available, Qtile uses a default [configuration][6].
|
||||
|
||||
One of the benefits of Qtile being in Python is you can write scripts to control the WM. For example, the following script prints the screen details:
|
||||
|
||||
```
|
||||
> from libqtile.command import Client
|
||||
> c = Client()
|
||||
> print(c.screen.info)
|
||||
{'index': 0, 'width': 1920, 'height': 1006, 'x': 0, 'y': 0}
|
||||
```
|
||||
|
||||
To install Qlite on Fedora, use the following command:
|
||||
|
||||
```
|
||||
$ sudo dnf install qtile
|
||||
```
|
||||
|
||||
### dwm
|
||||
|
||||
The [dwm][7] window manager focuses more on being lightweight. One goal of the project is to keep dwm minimal and small. For example, the entire code base never exceeded 2000 lines of code. On the other hand, dwm isn’t as easy to customize and configure. Indeed, the only way to change dwm default configuration is to [edit the source code and recompile the application][8].
|
||||
|
||||
If you want to try the default configuration, you can install dwm in Fedora using dnf:
|
||||
|
||||
```
|
||||
$ sudo dnf install dwm
|
||||
```
|
||||
|
||||
For those who wand to change their dwm configuration, the dwm-user package is available in Fedora. This package automatically recompiles dwm using the configuration stored in the user home directory at ~/.dwm/config.h.
|
||||
|
||||
### awesome
|
||||
|
||||
[awesome][9] originally started as a fork of dwm, to provide configuration of the WM using an external configuration file. The configuration is done via Lua scripts, which allow you to write scripts to automate tasks or create widgets.
|
||||
|
||||
You can check out awesome on Fedora by installing it like this:
|
||||
|
||||
```
|
||||
$ sudo dnf install awesome
|
||||
```
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/5-cool-tiling-window-managers/
|
||||
|
||||
作者:[Clément Verna][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org
|
||||
[1]: https://i3wm.org/
|
||||
[2]: https://fedoramagazine.org/getting-started-i3-window-manager/
|
||||
[3]: https://swaywm.org/
|
||||
[4]: https://github.com/swaywm/sway/wiki/i3-Migration-Guide
|
||||
[5]: http://www.qtile.org/
|
||||
[6]: https://github.com/qtile/qtile/blob/develop/libqtile/resources/default_config.py
|
||||
[7]: https://dwm.suckless.org/
|
||||
[8]: https://dwm.suckless.org/customisation/
|
||||
[9]: https://awesomewm.org/
|
@ -0,0 +1,73 @@
|
||||
Tips for listing files with ls at the Linux command line
|
||||
======
|
||||
Learn some of the Linux 'ls' command's most useful variations.
|
||||

|
||||
|
||||
One of the first commands I learned in Linux was `ls`. Knowing what’s in a directory where a file on your system resides is important. Being able to see and modify not just some but all of the files is also important.
|
||||
|
||||
My first LInux cheat sheet was the [One Page Linux Manual][1] , which was released in1999 and became my go-to reference. I taped it over my desk and referred to it often as I began to explore Linux. Listing files with `ls -l` is introduced on the first page, at the bottom of the first column.
|
||||
|
||||
Later, I would learn other iterations of this most basic command. Through the `ls` command, I began to learn about the complexity of the Linux file permissions and what was mine and what required root or sudo permission to change. I became very comfortable on the command line over time, and while I still use `ls -l` to find files in the directory, I frequently use `ls -al` so I can see hidden files that might need to be changed, like configuration files.
|
||||
|
||||
According to an article by Eric Fischer about the `ls` command in the [Linux Documentation Project][2], the command's roots go back to the `listf` command on MIT’s Compatible Time Sharing System in 1961. When CTSS was replaced by [Multics][3], the command became `list`, with switches like `list -all`. According to [Wikipedia][4], `ls` appeared in the original version of AT&T Unix. The `ls` command we use today on Linux systems comes from the [GNU Core Utilities][5].
|
||||
|
||||
Most of the time, I use only a couple of iterations of the command. Looking inside a directory with `ls` or `ls -al` is how I generally use the command, but there are many other options that you should be familiar with.
|
||||
|
||||
`$ ls -l` provides a simple list of the directory:
|
||||
|
||||

|
||||
|
||||
Using the man pages of my Fedora 28 system, I find that there are many other options to `ls`, all of which provide interesting and useful information about the Linux file system. By entering `man ls` at the command prompt, we can begin to explore some of the other options:
|
||||
|
||||

|
||||
|
||||
To sort the directory by file sizes, use `ls -lS`:
|
||||
|
||||

|
||||
|
||||
To list the contents in reverse order, use `ls -lr`:
|
||||
|
||||

|
||||
|
||||
To list contents by columns, use `ls -c`:
|
||||
|
||||

|
||||
|
||||
`ls -al` provides a list of all the files in the same directory:
|
||||
|
||||

|
||||
|
||||
Here are some additional options that I find useful and interesting:
|
||||
|
||||
* List only the .txt files in the directory: `ls *.txt`
|
||||
* List by file size: `ls -s`
|
||||
* Sort by time and date: `ls -d`
|
||||
* Sort by extension: `ls -X`
|
||||
* Sort by file size: `ls -S`
|
||||
* Long format with file size: `ls -ls`
|
||||
* List only the .txt files in a directory: `ls *.txt`
|
||||
|
||||
|
||||
|
||||
To generate a directory list in the specified format and send it to a file for later viewing, enter `ls -al > mydirectorylist`. Finally, one of the more exotic commands I found is `ls -R`, which provides a recursive list of all the directories on your computer and their contents.
|
||||
|
||||
For a complete list of the all the iterations of the `ls` command, refer to the [GNU Core Utilities][6].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/10/ls-command
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/don-watkins
|
||||
[1]: http://hackerspace.cs.rutgers.edu/library/General/One_Page_Linux_Manual.pdf
|
||||
[2]: http://www.tldp.org/LDP/LG/issue48/fischer.html
|
||||
[3]: https://en.wikipedia.org/wiki/Multics
|
||||
[4]: https://en.wikipedia.org/wiki/Ls
|
||||
[5]: http://www.gnu.org/s/coreutils/
|
||||
[6]: https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html#ls-invocation
|
119
sources/tech/20181004 Archiving web sites.md
Normal file
119
sources/tech/20181004 Archiving web sites.md
Normal file
@ -0,0 +1,119 @@
|
||||
Archiving web sites
|
||||
======
|
||||
|
||||
I recently took a deep dive into web site archival for friends who were worried about losing control over the hosting of their work online in the face of poor system administration or hostile removal. This makes web site archival an essential instrument in the toolbox of any system administrator. As it turns out, some sites are much harder to archive than others. This article goes through the process of archiving traditional web sites and shows how it falls short when confronted with the latest fashions in the single-page applications that are bloating the modern web.
|
||||
|
||||
### Converting simple sites
|
||||
|
||||
The days of handcrafted HTML web sites are long gone. Now web sites are dynamic and built on the fly using the latest JavaScript, PHP, or Python framework. As a result, the sites are more fragile: a database crash, spurious upgrade, or unpatched vulnerability might lose data. In my previous life as web developer, I had to come to terms with the idea that customers expect web sites to basically work forever. This expectation matches poorly with "move fast and break things" attitude of web development. Working with the [Drupal][2] content-management system (CMS) was particularly challenging in that regard as major upgrades deliberately break compatibility with third-party modules, which implies a costly upgrade process that clients could seldom afford. The solution was to archive those sites: take a living, dynamic web site and turn it into plain HTML files that any web server can serve forever. This process is useful for your own dynamic sites but also for third-party sites that are outside of your control and you might want to safeguard.
|
||||
|
||||
For simple or static sites, the venerable [Wget][3] program works well. The incantation to mirror a full web site, however, is byzantine:
|
||||
|
||||
```
|
||||
$ nice wget --mirror --execute robots=off --no-verbose --convert-links \
|
||||
--backup-converted --page-requisites --adjust-extension \
|
||||
--base=./ --directory-prefix=./ --span-hosts \
|
||||
--domains=www.example.com,example.com http://www.example.com/
|
||||
|
||||
```
|
||||
|
||||
The above downloads the content of the web page, but also crawls everything within the specified domains. Before you run this against your favorite site, consider the impact such a crawl might have on the site. The above command line deliberately ignores [`robots.txt`][] rules, as is now [common practice for archivists][4], and hammer the website as fast as it can. Most crawlers have options to pause between hits and limit bandwidth usage to avoid overwhelming the target site.
|
||||
|
||||
The above command will also fetch "page requisites" like style sheets (CSS), images, and scripts. The downloaded page contents are modified so that links point to the local copy as well. Any web server can host the resulting file set, which results in a static copy of the original web site.
|
||||
|
||||
That is, when things go well. Anyone who has ever worked with a computer knows that things seldom go according to plan; all sorts of things can make the procedure derail in interesting ways. For example, it was trendy for a while to have calendar blocks in web sites. A CMS would generate those on the fly and make crawlers go into an infinite loop trying to retrieve all of the pages. Crafty archivers can resort to regular expressions (e.g. Wget has a `--reject-regex` option) to ignore problematic resources. Another option, if the administration interface for the web site is accessible, is to disable calendars, login forms, comment forms, and other dynamic areas. Once the site becomes static, those will stop working anyway, so it makes sense to remove such clutter from the original site as well.
|
||||
|
||||
### JavaScript doom
|
||||
|
||||
Unfortunately, some web sites are built with much more than pure HTML. In single-page sites, for example, the web browser builds the content itself by executing a small JavaScript program. A simple user agent like Wget will struggle to reconstruct a meaningful static copy of those sites as it does not support JavaScript at all. In theory, web sites should be using [progressive enhancement][5] to have content and functionality available without JavaScript but those directives are rarely followed, as anyone using plugins like [NoScript][6] or [uMatrix][7] will confirm.
|
||||
|
||||
Traditional archival methods sometimes fail in the dumbest way. When trying to build an offsite backup of a local newspaper ([pamplemousse.ca][8]), I found that WordPress adds query strings (e.g. `?ver=1.12.4`) at the end of JavaScript includes. This confuses content-type detection in the web servers that serve the archive, which rely on the file extension to send the right `Content-Type` header. When such an archive is loaded in a web browser, it fails to load scripts, which breaks dynamic websites.
|
||||
|
||||
As the web moves toward using the browser as a virtual machine to run arbitrary code, archival methods relying on pure HTML parsing need to adapt. The solution for such problems is to record (and replay) the HTTP headers delivered by the server during the crawl and indeed professional archivists use just such an approach.
|
||||
|
||||
### Creating and displaying WARC files
|
||||
|
||||
At the [Internet Archive][9], Brewster Kahle and Mike Burner designed the [ARC][10] (for "ARChive") file format in 1996 to provide a way to aggregate the millions of small files produced by their archival efforts. The format was eventually standardized as the WARC ("Web ARChive") [specification][11] that was released as an ISO standard in 2009 and revised in 2017. The standardization effort was led by the [International Internet Preservation Consortium][12] (IIPC), which is an "international organization of libraries and other organizations established to coordinate efforts to preserve internet content for the future", according to Wikipedia; it includes members such as the US Library of Congress and the Internet Archive. The latter uses the WARC format internally in its Java-based [Heritrix crawler][13].
|
||||
|
||||
A WARC file aggregates multiple resources like HTTP headers, file contents, and other metadata in a single compressed archive. Conveniently, Wget actually supports the file format with the `--warc` parameter. Unfortunately, web browsers cannot render WARC files directly, so a viewer or some conversion is necessary to access the archive. The simplest such viewer I have found is [pywb][14], a Python package that runs a simple webserver to offer a Wayback-Machine-like interface to browse the contents of WARC files. The following set of commands will render a WARC file on `http://localhost:8080/`:
|
||||
|
||||
```
|
||||
$ pip install pywb
|
||||
$ wb-manager init example
|
||||
$ wb-manager add example crawl.warc.gz
|
||||
$ wayback
|
||||
|
||||
```
|
||||
|
||||
This tool was, incidentally, built by the folks behind the [Webrecorder][15] service, which can use a web browser to save dynamic page contents.
|
||||
|
||||
Unfortunately, pywb has trouble loading WARC files generated by Wget because it [followed][16] an [inconsistency in the 1.0 specification][17], which was [fixed in the 1.1 specification][18]. Until Wget or pywb fix those problems, WARC files produced by Wget are not reliable enough for my uses, so I have looked at other alternatives. A crawler that got my attention is simply called [crawl][19]. Here is how it is invoked:
|
||||
|
||||
```
|
||||
$ crawl https://example.com/
|
||||
|
||||
```
|
||||
|
||||
(It does say "very simple" in the README.) The program does support some command-line options, but most of its defaults are sane: it will fetch page requirements from other domains (unless the `-exclude-related` flag is used), but does not recurse out of the domain. By default, it fires up ten parallel connections to the remote site, a setting that can be changed with the `-c` flag. But, best of all, the resulting WARC files load perfectly in pywb.
|
||||
|
||||
### Future work and alternatives
|
||||
|
||||
There are plenty more [resources][20] for using WARC files. In particular, there's a Wget drop-in replacement called [Wpull][21] that is specifically designed for archiving web sites. It has experimental support for [PhantomJS][22] and [youtube-dl][23] integration that should allow downloading more complex JavaScript sites and streaming multimedia, respectively. The software is the basis for an elaborate archival tool called [ArchiveBot][24], which is used by the "loose collective of rogue archivists, programmers, writers and loudmouths" at [ArchiveTeam][25] in its struggle to "save the history before it's lost forever". It seems that PhantomJS integration does not work as well as the team wants, so ArchiveTeam also uses a rag-tag bunch of other tools to mirror more complex sites. For example, [snscrape][26] will crawl a social media profile to generate a list of pages to send into ArchiveBot. Another tool the team employs is [crocoite][27], which uses the Chrome browser in headless mode to archive JavaScript-heavy sites.
|
||||
|
||||
This article would also not be complete without a nod to the [HTTrack][28] project, the "website copier". Working similarly to Wget, HTTrack creates local copies of remote web sites but unfortunately does not support WARC output. Its interactive aspects might be of more interest to novice users unfamiliar with the command line.
|
||||
|
||||
In the same vein, during my research I found a full rewrite of Wget called [Wget2][29] that has support for multi-threaded operation, which might make it faster than its predecessor. It is [missing some features][30] from Wget, however, most notably reject patterns, WARC output, and FTP support but adds RSS, DNS caching, and improved TLS support.
|
||||
|
||||
Finally, my personal dream for these kinds of tools would be to have them integrated with my existing bookmark system. I currently keep interesting links in [Wallabag][31], a self-hosted "read it later" service designed as a free-software alternative to [Pocket][32] (now owned by Mozilla). But Wallabag, by design, creates only a "readable" version of the article instead of a full copy. In some cases, the "readable version" is actually [unreadable][33] and Wallabag sometimes [fails to parse the article][34]. Instead, other tools like [bookmark-archiver][35] or [reminiscence][36] save a screenshot of the page along with full HTML but, unfortunately, no WARC file that would allow an even more faithful replay.
|
||||
|
||||
The sad truth of my experiences with mirrors and archival is that data dies. Fortunately, amateur archivists have tools at their disposal to keep interesting content alive online. For those who do not want to go through that trouble, the Internet Archive seems to be here to stay and Archive Team is obviously [working on a backup of the Internet Archive itself][37].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://anarc.at/blog/2018-10-04-archiving-web-sites/
|
||||
|
||||
作者:[Anarcat][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://anarc.at
|
||||
[1]: https://anarc.at/blog
|
||||
[2]: https://drupal.org
|
||||
[3]: https://www.gnu.org/software/wget/
|
||||
[4]: https://blog.archive.org/2017/04/17/robots-txt-meant-for-search-engines-dont-work-well-for-web-archives/
|
||||
[5]: https://en.wikipedia.org/wiki/Progressive_enhancement
|
||||
[6]: https://noscript.net/
|
||||
[7]: https://github.com/gorhill/uMatrix
|
||||
[8]: https://pamplemousse.ca/
|
||||
[9]: https://archive.org
|
||||
[10]: http://www.archive.org/web/researcher/ArcFileFormat.php
|
||||
[11]: https://iipc.github.io/warc-specifications/
|
||||
[12]: https://en.wikipedia.org/wiki/International_Internet_Preservation_Consortium
|
||||
[13]: https://github.com/internetarchive/heritrix3/wiki
|
||||
[14]: https://github.com/webrecorder/pywb
|
||||
[15]: https://webrecorder.io/
|
||||
[16]: https://github.com/webrecorder/pywb/issues/294
|
||||
[17]: https://github.com/iipc/warc-specifications/issues/23
|
||||
[18]: https://github.com/iipc/warc-specifications/pull/24
|
||||
[19]: https://git.autistici.org/ale/crawl/
|
||||
[20]: https://archiveteam.org/index.php?title=The_WARC_Ecosystem
|
||||
[21]: https://github.com/chfoo/wpull
|
||||
[22]: http://phantomjs.org/
|
||||
[23]: http://rg3.github.io/youtube-dl/
|
||||
[24]: https://www.archiveteam.org/index.php?title=ArchiveBot
|
||||
[25]: https://archiveteam.org/
|
||||
[26]: https://github.com/JustAnotherArchivist/snscrape
|
||||
[27]: https://github.com/PromyLOPh/crocoite
|
||||
[28]: http://www.httrack.com/
|
||||
[29]: https://gitlab.com/gnuwget/wget2
|
||||
[30]: https://gitlab.com/gnuwget/wget2/wikis/home
|
||||
[31]: https://wallabag.org/
|
||||
[32]: https://getpocket.com/
|
||||
[33]: https://github.com/wallabag/wallabag/issues/2825
|
||||
[34]: https://github.com/wallabag/wallabag/issues/2914
|
||||
[35]: https://pirate.github.io/bookmark-archiver/
|
||||
[36]: https://github.com/kanishka-linux/reminiscence
|
||||
[37]: http://iabak.archiveteam.org
|
@ -0,0 +1,190 @@
|
||||
Functional programming in Python: Immutable data structures
|
||||
======
|
||||
Immutability can help us better understand our code. Here's how to achieve it without sacrificing performance.
|
||||
|
||||

|
||||
|
||||
In this two-part series, I will discuss how to import ideas from the functional programming methodology into Python in order to have the best of both worlds.
|
||||
|
||||
This first post will explore how immutable data structures can help. The second part will explore higher-level functional programming concepts in Python using the **toolz** library.
|
||||
|
||||
Why functional programming? Because mutation is hard to reason about. If you are already convinced that mutation is problematic, great. If you're not convinced, you will be by the end of this post.
|
||||
|
||||
Let's begin by considering squares and rectangles. If we think in terms of interfaces, neglecting implementation details, are squares a subtype of rectangles?
|
||||
|
||||
The definition of a subtype rests on the [Liskov substitution principle][1]. In order to be a subtype, it must be able to do everything the supertype does.
|
||||
|
||||
How would we define an interface for a rectangle?
|
||||
|
||||
```
|
||||
from zope.interface import Interface
|
||||
|
||||
class IRectangle(Interface):
|
||||
def get_length(self):
|
||||
"""Squares can do that"""
|
||||
def get_width(self):
|
||||
"""Squares can do that"""
|
||||
def set_dimensions(self, length, width):
|
||||
"""Uh oh"""
|
||||
```
|
||||
|
||||
If this is the definition, then squares cannot be a subtype of rectangles; they cannot respond to a `set_dimensions` method if the length and width are different.
|
||||
|
||||
A different approach is to choose to make rectangles immutable.
|
||||
|
||||
```
|
||||
class IRectangle(Interface):
|
||||
def get_length(self):
|
||||
"""Squares can do that"""
|
||||
def get_width(self):
|
||||
"""Squares can do that"""
|
||||
def with_dimensions(self, length, width):
|
||||
"""Returns a new rectangle"""
|
||||
```
|
||||
|
||||
Now, a square can be a rectangle. It can return a new rectangle (which would not usually be a square) when `with_dimensions` is called, but it would not stop being a square.
|
||||
|
||||
This might seem like an academic problem—until we consider that squares and rectangles are, in a sense, a container for their sides. After we understand this example, the more realistic case this comes into play with is more traditional containers. For example, consider random-access arrays.
|
||||
|
||||
We have `ISquare` and `IRectangle`, and `ISquare` is a subtype of `IRectangle`.
|
||||
|
||||
We want to put rectangles in a random-access array:
|
||||
|
||||
```
|
||||
class IArrayOfRectangles(Interface):
|
||||
def get_element(self, i):
|
||||
"""Returns Rectangle"""
|
||||
def set_element(self, i, rectangle):
|
||||
"""'rectangle' can be any IRectangle"""
|
||||
```
|
||||
|
||||
We want to put squares in a random-access array too:
|
||||
|
||||
```
|
||||
class IArrayOfSquare(Interface):
|
||||
def get_element(self, i):
|
||||
"""Returns Square"""
|
||||
def set_element(self, i, square):
|
||||
"""'square' can be any ISquare"""
|
||||
```
|
||||
|
||||
Even though `ISquare` is a subtype of `IRectangle`, no array can implement both `IArrayOfSquare` and `IArrayOfRectangle`.
|
||||
|
||||
Why not? Assume `bucket` implements both.
|
||||
|
||||
```
|
||||
>>> rectangle = make_rectangle(3, 4)
|
||||
>>> bucket.set_element(0, rectangle) # This is allowed by IArrayOfRectangle
|
||||
>>> thing = bucket.get_element(0) # That has to be a square by IArrayOfSquare
|
||||
>>> assert thing.height == thing.width
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
AssertionError
|
||||
```
|
||||
|
||||
Being unable to implement both means that neither is a subtype of the other, even though `ISquare` is a subtype of `IRectangle`. The problem is the `set_element` method: If we had a read-only array, `IArrayOfSquare` would be a subtype of `IArrayOfRectangle`.
|
||||
|
||||
Mutability, in both the mutable `IRectangle` interface and the mutable `IArrayOf*` interfaces, has made thinking about types and subtypes much more difficult—and giving up on the ability to mutate meant that the intuitive relationships we expected to have between the types actually hold.
|
||||
|
||||
Mutation can also have non-local effects. This happens when a shared object between two places is mutated by one. The classic example is one thread mutating a shared object with another thread, but even in a single-threaded program, sharing between places that are far apart is easy. Consider that in Python, most objects are reachable from many places: as a module global, or in a stack trace, or as a class attribute.
|
||||
|
||||
If we cannot constrain the sharing, we might think about constraining the mutability.
|
||||
|
||||
Here is an immutable rectangle, taking advantage of the [attrs][2] library:
|
||||
|
||||
```
|
||||
@attr.s(frozen=True)
|
||||
class Rectange(object):
|
||||
length = attr.ib()
|
||||
width = attr.ib()
|
||||
@classmethod
|
||||
def with_dimensions(cls, length, width):
|
||||
return cls(length, width)
|
||||
```
|
||||
|
||||
Here is a square:
|
||||
|
||||
```
|
||||
@attr.s(frozen=True)
|
||||
class Square(object):
|
||||
side = attr.ib()
|
||||
@classmethod
|
||||
def with_dimensions(cls, length, width):
|
||||
return Rectangle(length, width)
|
||||
```
|
||||
|
||||
Using the `frozen` argument, we can easily have `attrs`-created classes be immutable. All the hard work of writing `__setitem__` correctly has been done by others and is completely invisible to us.
|
||||
|
||||
It is still easy to modify objects; it's just nigh impossible to mutate them.
|
||||
|
||||
```
|
||||
too_long = Rectangle(100, 4)
|
||||
reasonable = attr.evolve(too_long, length=10)
|
||||
```
|
||||
|
||||
The [Pyrsistent][3] package allows us to have immutable containers.
|
||||
|
||||
```
|
||||
# Vector of integers
|
||||
a = pyrsistent.v(1, 2, 3)
|
||||
# Not a vector of integers
|
||||
b = a.set(1, "hello")
|
||||
```
|
||||
|
||||
While `b` is not a vector of integers, nothing will ever stop `a` from being one.
|
||||
|
||||
What if `a` was a million elements long? Is `b` going to copy 999,999 of them? Pyrsistent comes with "big O" performance guarantees: All operations take `O(log n)` time. It also comes with an optional C extension to improve performance beyond the big O.
|
||||
|
||||
For modifying nested objects, it comes with a concept of "transformers:"
|
||||
|
||||
```
|
||||
blog = pyrsistent.m(
|
||||
title="My blog",
|
||||
links=pyrsistent.v("github", "twitter"),
|
||||
posts=pyrsistent.v(
|
||||
pyrsistent.m(title="no updates",
|
||||
content="I'm busy"),
|
||||
pyrsistent.m(title="still no updates",
|
||||
content="still busy")))
|
||||
new_blog = blog.transform(["posts", 1, "content"],
|
||||
"pretty busy")
|
||||
```
|
||||
|
||||
`new_blog` will now be the immutable equivalent of
|
||||
|
||||
```
|
||||
{'links': ['github', 'twitter'],
|
||||
'posts': [{'content': "I'm busy",
|
||||
'title': 'no updates'},
|
||||
{'content': 'pretty busy',
|
||||
'title': 'still no updates'}],
|
||||
'title': 'My blog'}
|
||||
```
|
||||
|
||||
But `blog` is still the same. This means anyone who had a reference to the old object has not been affected: The transformation had only local effects.
|
||||
|
||||
This is useful when sharing is rampant. For example, consider default arguments:
|
||||
|
||||
```
|
||||
def silly_sum(a, b, extra=v(1, 2)):
|
||||
extra = extra.extend([a, b])
|
||||
return sum(extra)
|
||||
```
|
||||
|
||||
In this post, we have learned why immutability can be useful for thinking about our code, and how to achieve it without an extravagant performance price. Next time, we will learn how immutable objects allow us to use powerful programming constructs.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/10/functional-programming-python-immutable-data-structures
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[1]: https://en.wikipedia.org/wiki/Liskov_substitution_principle
|
||||
[2]: https://www.attrs.org/en/stable/
|
||||
[3]: https://pyrsistent.readthedocs.io/en/latest/
|
@ -0,0 +1,181 @@
|
||||
PyTorch 1.0 Preview Release: Facebook’s newest Open Source AI
|
||||
======
|
||||
Facebook already uses its own Open Source AI, PyTorch quite extensively in its own artificial intelligence projects. Recently, they have gone a league ahead by releasing a pre-release preview version 1.0.
|
||||
|
||||
For those who are not familiar, [PyTorch][1] is a Python-based library for Scientific Computing.
|
||||
|
||||
PyTorch harnesses the [superior computational power of Graphical Processing Units (GPUs)][2] for carrying out complex [Tensor][3] computations and implementing [deep neural networks][4]. So, it is used widely across the world by numerous researchers and developers.
|
||||
|
||||
This new ready-to-use [Preview Release][5] was announced at the [PyTorch Developer Conference][6] at [The Midway][7], San Francisco, CA on Tuesday, October 2, 2018.
|
||||
|
||||
### Highlights of PyTorch 1.0 Release Candidate
|
||||
|
||||
![PyTorhc is Python based open source AI framework from Facebook][8]
|
||||
|
||||
Some of the main new features in the release candidate are:
|
||||
|
||||
#### 1\. JIT
|
||||
|
||||
JIT is a set of compiler tools to bring research close to production. It includes a Python-based language called Torch Script and also ways to make existing code compatible with itself.
|
||||
|
||||
#### 2\. New torch.distributed library: “C10D”
|
||||
|
||||
“C10D” enables asynchronous operation on different backends with performance improvements on slower networks and more.
|
||||
|
||||
#### 3\. C++ frontend (experimental)
|
||||
|
||||
Though it has been specifically mentioned as an unstable API (expected in a pre-release), this is a pure C++ interface to the PyTorch backend that follows the API and architecture of the established Python frontend to enable research in high performance, low latency and C++ applications installed directly on hardware.
|
||||
|
||||
To know more, you can take a look at the complete [update notes][9] on GitHub.
|
||||
|
||||
The first stable version PyTorch 1.0 will be released in summer.
|
||||
|
||||
### Installing PyTorch on Linux
|
||||
|
||||
To install PyTorch v1.0rc0, the developers recommend using [conda][10] while there also other ways to do that as shown on their [local installation page][11] where they have documented everything necessary in detail.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
* Linux
|
||||
* Pip
|
||||
* Python
|
||||
* [CUDA][12] (For Nvidia GPU owners)
|
||||
|
||||
|
||||
|
||||
As we recently showed you [how to install and use Pip][13], let’s get to know how we can install PyTorch with it.
|
||||
|
||||
Note that PyTorch has GPU and CPU-only variants. You should install the one that suits your hardware.
|
||||
|
||||
#### Installing old and stable version of PyTorch
|
||||
|
||||
If you want the stable release (version 0.4) for your GPU, use:
|
||||
|
||||
```
|
||||
pip install torch torchvision
|
||||
|
||||
```
|
||||
|
||||
Use these two commands in succession for a CPU-only stable release:
|
||||
|
||||
```
|
||||
pip install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp27-cp27mu-linux_x86_64.whl
|
||||
pip install torchvision
|
||||
|
||||
```
|
||||
|
||||
#### Installing PyTorch 1.0 Release Candidate
|
||||
|
||||
You install PyTorch 1.0 RC GPU version with this command:
|
||||
|
||||
```
|
||||
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu92/torch_nightly.html
|
||||
|
||||
```
|
||||
|
||||
If you do not have a GPU and would prefer a CPU-only version, use:
|
||||
|
||||
```
|
||||
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
|
||||
|
||||
```
|
||||
|
||||
#### Verifying your PyTorch installation
|
||||
|
||||
Startup the python console on a terminal with the following simple command:
|
||||
|
||||
```
|
||||
python
|
||||
|
||||
```
|
||||
|
||||
Now enter the following sample code line by line to verify your installation:
|
||||
|
||||
```
|
||||
from __future__ import print_function
|
||||
import torch
|
||||
x = torch.rand(5, 3)
|
||||
print(x)
|
||||
|
||||
```
|
||||
|
||||
You should get an output like:
|
||||
|
||||
```
|
||||
tensor([[0.3380, 0.3845, 0.3217],
|
||||
[0.8337, 0.9050, 0.2650],
|
||||
[0.2979, 0.7141, 0.9069],
|
||||
[0.1449, 0.1132, 0.1375],
|
||||
[0.4675, 0.3947, 0.1426]])
|
||||
|
||||
```
|
||||
|
||||
To check whether you can use PyTorch’s GPU capabilities, use the following sample code:
|
||||
|
||||
```
|
||||
import torch
|
||||
torch.cuda.is_available()
|
||||
|
||||
```
|
||||
|
||||
The resulting output should be:
|
||||
|
||||
```
|
||||
True
|
||||
|
||||
```
|
||||
|
||||
Support for AMD GPUs for PyTorch is still under development, so complete test coverage is not yet provided as reported [here][14], suggesting this [resource][15] in case you have an AMD GPU.
|
||||
|
||||
Lets now look into some research projects that extensively use PyTorch:
|
||||
|
||||
### Ongoing Research Projects based on PyTorch
|
||||
|
||||
* [Detectron][16]: Facebook AI Research’s software system to intelligently detect and classify objects. It is based on Caffe2. Earlier this year, Caffe2 and PyTorch [joined forces][17] to create a Research + Production enabled PyTorch 1.0 we talk about.
|
||||
* [Unsupervised Sentiment Discovery][18]: Such methods are extensively used with social media algorithms.
|
||||
* [vid2vid][19]: Photorealistic video-to-video translation
|
||||
* [DeepRecommender][20] (We covered how such systems work on our past [Netflix AI article][21])
|
||||
|
||||
|
||||
|
||||
Nvidia, leading GPU manufacturer covered more on this with their own [update][22] on this recent development where you can also read about ongoing collaborative research endeavours.
|
||||
|
||||
### How should we react to such PyTorch capabilities?
|
||||
|
||||
To think Facebook applies such amazingly innovative projects and more in its social media algorithms, should we appreciate all this or get alarmed? This is almost [Skynet][23]! This newly improved production-ready pre-release of PyTorch will certainly push things further ahead! Feel free to share your thoughts with us in the comments below!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/pytorch-open-source-ai-framework/
|
||||
|
||||
作者:[Avimanyu Bandyopadhyay][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/avimanyu/
|
||||
[1]: https://pytorch.org/
|
||||
[2]: https://en.wikipedia.org/wiki/General-purpose_computing_on_graphics_processing_units
|
||||
[3]: https://en.wikipedia.org/wiki/Tensor
|
||||
[4]: https://www.techopedia.com/definition/32902/deep-neural-network
|
||||
[5]: https://code.fb.com/ai-research/facebook-accelerates-ai-development-with-new-partners-and-production-capabilities-for-pytorch-1-0
|
||||
[6]: https://pytorch.fbreg.com/
|
||||
[7]: https://www.themidwaysf.com/
|
||||
[8]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/10/pytorch.jpeg
|
||||
[9]: https://github.com/pytorch/pytorch/releases/tag/v1.0rc0
|
||||
[10]: https://conda.io/
|
||||
[11]: https://pytorch.org/get-started/locally/
|
||||
[12]: https://www.pugetsystems.com/labs/hpc/How-to-install-CUDA-9-2-on-Ubuntu-18-04-1184/
|
||||
[13]: https://itsfoss.com/install-pip-ubuntu/
|
||||
[14]: https://github.com/pytorch/pytorch/issues/10657#issuecomment-415067478
|
||||
[15]: https://rocm.github.io/install.html#installing-from-amd-rocm-repositories
|
||||
[16]: https://github.com/facebookresearch/Detectron
|
||||
[17]: https://caffe2.ai/blog/2018/05/02/Caffe2_PyTorch_1_0.html
|
||||
[18]: https://github.com/NVIDIA/sentiment-discovery
|
||||
[19]: https://github.com/NVIDIA/vid2vid
|
||||
[20]: https://github.com/NVIDIA/DeepRecommender/
|
||||
[21]: https://itsfoss.com/netflix-open-source-ai/
|
||||
[22]: https://news.developer.nvidia.com/pytorch-1-0-accelerated-on-nvidia-gpus/
|
||||
[23]: https://en.wikipedia.org/wiki/Skynet_(Terminator)
|
@ -0,0 +1,133 @@
|
||||
Dbxfs – Mount Dropbox Folder Locally As Virtual File System In Linux
|
||||
======
|
||||
|
||||

|
||||
|
||||
A while ago, we summarized all the possible ways to **[mount Google drive locally][1]** as a virtual file system and access the files stored in the google drive from your Linux operating system. Today, we are going to learn to mount Dropbox folder in your local file system using **dbxfs** utility. The dbxfs is used to mount your Dropbox folder locally as a virtual filesystem in Unix-like operating systems. While it is easy to [**install Dropbox client**][2] in Linux, this approach slightly differs from the official method. It is a command line dropbox client and requires no disk space for access. The dbxfs application is free, open source and written for Python 3.5+.
|
||||
|
||||
### Installing dbxfs
|
||||
|
||||
The dbxfs officially supports Linux and Mac OS. However, it should work on any POSIX system that provides a **FUSE-compatible library** or has the ability to mount **SMB** shares. Since it is written for Python 3.5, it can installed using **pip3** package manager. Refer the following guide if you haven’t installed PIP yet.
|
||||
|
||||
And, install FUSE library as well.
|
||||
|
||||
On Debian-based systems, run the following command to install FUSE:
|
||||
|
||||
```
|
||||
$ sudo apt install libfuse2
|
||||
|
||||
```
|
||||
|
||||
On Fedora:
|
||||
|
||||
```
|
||||
$ sudo dnf install fuse
|
||||
|
||||
```
|
||||
|
||||
Once you installed all required dependencies, run the following command to install dbxfs utility:
|
||||
|
||||
```
|
||||
$ pip3 install dbxfs
|
||||
|
||||
```
|
||||
|
||||
### Mount Dropbox folder locally
|
||||
|
||||
Create a mount point to mount your dropbox folder in your local file system.
|
||||
|
||||
```
|
||||
$ mkdir ~/mydropbox
|
||||
|
||||
```
|
||||
|
||||
Then, mount the dropbox folder locally using dbxfs utility as shown below:
|
||||
|
||||
```
|
||||
$ dbxfs ~/mydropbox
|
||||
|
||||
```
|
||||
|
||||
You will be asked to generate an access token:
|
||||
|
||||

|
||||
|
||||
To generate an access token, just navigate to the URL given in the above output from your web browser and click **Allow** to authenticate Dropbox access. You need to log in to your dropbox account to complete authorization process.
|
||||
|
||||
A new authorization code will be generated in the next screen. Copy the code and head back to your Terminal and paste it into cli-dbxfs prompt to finish the process.
|
||||
|
||||
You will be then asked to save the credentials for future access. Type **Y** or **N** whether you want to save or decline. And then, you need to enter a passphrase twice for the new access token.
|
||||
|
||||
Finally, click **Y** to accept **“/home/username/mydropbox”** as the default mount point. If you want to set different path, type **N** and enter the location of your choice.
|
||||
|
||||
[![Generate access token 2][3]][4]
|
||||
|
||||
All done! From now on, you can see your Dropbox folder is locally mounted in your filesystem.
|
||||
|
||||

|
||||
|
||||
### Change Access Token Storage Path
|
||||
|
||||
By default, the dbxfs application will store your Dropbox access token in the system keyring or an encrypted file. However, you might want to store it in a **gpg** encrypted file or something else. If so, get an access token by creating a personal app on the [Dropbox developers app console][5].
|
||||
|
||||

|
||||
|
||||
Once the app is created, click **Generate** button in the next button. This access token can be used to access your Dropbox account via the API. Don’t share your access token with anyone.
|
||||
|
||||

|
||||
|
||||
Once you created an access token, encrypt it using any encryption tools of your choice, such as [**Cryptomater**][6], [**Cryptkeeper**][7], [**CryptGo**][8], [**Cryptr**][9], [**Tomb**][10], [**Toplip**][11] and [**GnuPG**][12] etc., and store it in your preferred location.
|
||||
|
||||
Next edit the dbxfs configuration file and add the following line in it:
|
||||
|
||||
```
|
||||
"access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"]
|
||||
|
||||
```
|
||||
|
||||
You can find the dbxfs configuration file by running the following command:
|
||||
|
||||
```
|
||||
$ dbxfs --print-default-config-file
|
||||
|
||||
```
|
||||
|
||||
For more details, refer dbxfs help section:
|
||||
|
||||
```
|
||||
$ dbxfs -h
|
||||
|
||||
```
|
||||
|
||||
As you can see, mounting Dropfox folder locally in your file system using Dbxfs utility is no big deal. As far tested, dbxfs just works fine as expected. Give it a try if you’re interested to see how it works and let us know about your experience in the comment section below.
|
||||
|
||||
And, that’s all for now. Hope this was useful. More good stuff to come. Stay tuned!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-file-system-in-linux/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/sk/
|
||||
[1]: https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file-system-in-linux/
|
||||
[2]: https://www.ostechnix.com/install-dropbox-in-ubuntu-18-04-lts-desktop/
|
||||
[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[4]: http://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-2.png
|
||||
[5]: https://dropbox.com/developers/apps
|
||||
[6]: https://www.ostechnix.com/cryptomator-open-source-client-side-encryption-tool-cloud/
|
||||
[7]: https://www.ostechnix.com/how-to-encrypt-your-personal-foldersdirectories-in-linux-mint-ubuntu-distros/
|
||||
[8]: https://www.ostechnix.com/cryptogo-easy-way-encrypt-password-protect-files/
|
||||
[9]: https://www.ostechnix.com/cryptr-simple-cli-utility-encrypt-decrypt-files/
|
||||
[10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/
|
||||
[11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/
|
||||
[12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/
|
@ -0,0 +1,107 @@
|
||||
How to use Kolibri to access educational material offline
|
||||
======
|
||||
Kolibri makes digital educational materials available to students without internet access.
|
||||
|
||||

|
||||
|
||||
While the internet has thoroughly transformed the availability of educational content for much of the world, many people still live in places where online access is poor or even nonexistent. [Kolibri][1] is a great solution for these communities. It's an app that creates an offline server to deliver high-quality educational resources to learners. You can set up Kolibri on a wide range of [hardware][2], including low-cost Windows, MacOS, and Linux (including Raspberry Pi) computers. A version for Android tablets is in the works.
|
||||
|
||||
Because it's open source, free to use, works without broadband access (after initial setup), and includes a wide range of educational content, it gives students in rural schools, refugee camps, orphanages, informal schools, prisons, and other places without reliable internet service access to many of the same resources used by students all over the world.
|
||||
|
||||
In addition to being simple to install, it's easy to customize Kolibri for various educational missions and needs, including literacy building, general reference materials, and life skills training. Kolibri includes content from sources including [OpenStax,][3] [CK-12][4], [Khan Academy][5], and [EngageNY][6]; once these packages are "seeded" by connecting the Kolibri serving device to a robust internet connection, they are immediately available for offline access on client devices through a compatible browser.
|
||||
|
||||
### Installation and setup
|
||||
|
||||
I installed Kolibri on an Intel i3-based laptop running Fedora 28. I chose the **pip install** method, which is very easy. Here's how to do it.
|
||||
|
||||
Open a terminal and enter:
|
||||
|
||||
```
|
||||
$ sudo pip install kolibri
|
||||
|
||||
```
|
||||
|
||||
Start Kolibri by entering **$** **kolibri** **start** in the terminal.
|
||||
|
||||
Find your Kolibri installation's URL in the terminal.
|
||||
|
||||

|
||||
|
||||
Open your browser and point it to that URL, being sure to append port **8080**.
|
||||
|
||||
Select the default language—options include English, Spanish, French, Arabic, Portuguese, Hindi, Farsi, Burmese, and Bengali. (I chose English.)
|
||||
|
||||
Name your facility, i.e., your classroom, library, or home. (I named mine Test.)
|
||||
|
||||

|
||||
|
||||
Tell Kolibri what type of facility you're setting up—self-managed, admin-managed, or informal. (I chose self-managed.)
|
||||
|
||||

|
||||
|
||||
Create an admin account.
|
||||
|
||||

|
||||
|
||||
### Add content
|
||||
|
||||
You can add Kolibri-curated content channels while you are connected to broadband service. Explore and add content from the menu at the top-left of the browser.
|
||||
|
||||

|
||||
|
||||
Choose Device and Import.
|
||||
|
||||

|
||||
|
||||
Selecting English as the default language provides access to 29 content channels including Touchable Earth, Global Digital Library, Khan Academy, OpenStax, CK-12, EngageNY, Blockly games, and more.
|
||||
|
||||
Select a channel you're interested in. You have the option to download the entire channel (which might take a long time) or to select the specific content you want to download.
|
||||
|
||||

|
||||
|
||||
To access your content, return to the top-left menu and select Learn.
|
||||
|
||||

|
||||
|
||||
### Add users
|
||||
|
||||
User accounts can be set up as learners, coaches, or admins. Users can access the Kolibri server from most web browsers on any Linux, MacOS, Windows, Android, or iOS device on the same network, even if the network isn't connected to the internet. Admins can set up classes on the device, assign coaches and learners to classes, and see every user's interaction and how much time they spend with the content.
|
||||
|
||||
If your Kolibri server is set up as self-managed, users can create their own accounts by entering the Kolibri URL in their browser and following the prompts. For information on setting up users on an admin-managed server, check out Kolibri's [documentation][7].
|
||||
|
||||

|
||||
|
||||
After logging in, the user can access content right away to begin learning.
|
||||
|
||||
### Learn more
|
||||
|
||||
Kolibri is a very powerful learning resource, especially for people who don't have a robust connection to the internet. Its [documentation][8] is very complete, and a [demo][9] site maintained by the project allows you to try it out.
|
||||
|
||||
Kolibri is open source under the [MIT License][10]. The project, which is managed by the nonprofit organization Learning Equality, is looking for developers—if you would like to get involved, be sure to check out them on [GitHub][11]. To learn more, follow Learning Equality and Kolibri on its [blog][12], [Twitter][13], and [Facebook][14] pages.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/10/getting-started-kolibri
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/don-watkins
|
||||
[1]: https://learningequality.org/kolibri/
|
||||
[2]: https://drive.google.com/file/d/0B9ZzDms8cSNgVWRKdUlPc2lkTkk/view
|
||||
[3]: https://openstax.org/
|
||||
[4]: https://www.ck12.org/
|
||||
[5]: https://www.khanacademy.org/
|
||||
[6]: https://www.engageny.org/
|
||||
[7]: https://kolibri.readthedocs.io/en/latest/manage.html#create-a-new-user-account
|
||||
[8]: https://learningequality.org/documentation/
|
||||
[9]: http://kolibridemo.learningequality.org/learn/#/topics
|
||||
[10]: https://github.com/learningequality/kolibri/blob/develop/LICENSE
|
||||
[11]: https://github.com/learningequality/
|
||||
[12]: https://blog.learningequality.org/
|
||||
[13]: https://twitter.com/LearnEQ/
|
||||
[14]: https://www.facebook.com/learningequality
|
188
sources/tech/20181005 Open Source Logging Tools for Linux.md
Normal file
188
sources/tech/20181005 Open Source Logging Tools for Linux.md
Normal file
@ -0,0 +1,188 @@
|
||||
Open Source Logging Tools for Linux
|
||||
======
|
||||
|
||||

|
||||
|
||||
If you’re a Linux systems administrator, one of the first tools you will turn to for troubleshooting are log files. These files hold crucial information that can go a long way to help you solve problems affecting your desktops and servers. For many sysadmins (especially those of an old-school sort), nothing beats the command line for checking log files. But for those who’d rather have a more efficient (and possibly modern) approach to troubleshooting, there are plenty of options.
|
||||
|
||||
In this article, I’ll highlight a few such tools available for the Linux platform. I won’t be getting into logging tools that might be specific to a certain service (such as Kubernetes or Apache), and instead will focus on tools that work to mine the depths of all that magical information written into /var/log.
|
||||
|
||||
Speaking of which…
|
||||
|
||||
### What is /var/log?
|
||||
|
||||
If you’re new to Linux, you might not know what the /var/log directory contains. However, the name is very telling. Within this directory is housed all of the log files from the system and any major service (such as Apache, MySQL, MariaDB, etc.) installed on the operating system. Open a terminal window and issue the command cd /var/log. Follow that with the command ls and you’ll see all of the various systems that have log files you can view (Figure 1).
|
||||
|
||||
![/var/log/][2]
|
||||
|
||||
Figure 1: Our ls command reveals the logs available in /var/log/.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
Say, for instance, you want to view the syslog log file. Issue the command less syslog and you can scroll through all of the gory details of that particular log. But what if the standard terminal isn’t for you? What options do you have? Plenty. Let’s take a look at few such options.
|
||||
|
||||
### Logs
|
||||
|
||||
If you use the GNOME desktop (or other, as Logs can be installed on more than just GNOME), you have at your fingertips a log viewer that mainly just adds the slightest bit of GUI goodness over the log files to create something as simple as it is effective. Once installed (from the standard repositories), open Logs from the desktop menu, and you’ll be treated to an interface (Figure 2) that allows you to select from various types of logs (Important, All, System, Security, and Hardware), as well as select a boot period (from the top center drop-down), and even search through all of the available logs.
|
||||
|
||||
![Logs tool][5]
|
||||
|
||||
Figure 2: The GNOME Logs tool is one of the easiest GUI log viewers you’ll find for Linux.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
Logs is a great tool, especially if you’re not looking for too many bells and whistles getting in the way of you viewing crucial log entries, so you can troubleshoot your systems.
|
||||
|
||||
### KSystemLog
|
||||
|
||||
KSystemLog is to KDE what Logs is to GNOME, but with a few more features to add into the mix. Although both make it incredibly simple to view your system log files, only KSystemLog includes colorized log lines, tabbed viewing, copy log lines to the desktop clipboard, built-in capability for sending log messages directly to the system, read detailed information for each log line, and more. KSystemLog views all the same logs found in GNOME Logs, only with a different layout.
|
||||
|
||||
From the main window (Figure 3), you can view any of the different log (from System Log, Authentication Log, X.org Log, Journald Log), search the logs, filter by Date, Host, Process, Message, and select log priorities.
|
||||
|
||||
![KSystemLog][7]
|
||||
|
||||
Figure 3: The KSystemLog main window.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
If you click on the Window menu, you can open a new tab, where you can select a different log/filter combination to view. From that same menu, you can even duplicate the current tab. If you want to manually add a log to a file, do the following:
|
||||
|
||||
1. Open KSystemLog.
|
||||
|
||||
2. Click File > Add Log Entry.
|
||||
|
||||
3. Create your log entry (Figure 4).
|
||||
|
||||
4. Click OK
|
||||
|
||||
|
||||
![log entry][9]
|
||||
|
||||
Figure 4: Creating a manual log entry with KSystemLog.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
KSystemLog makes viewing logs in KDE an incredibly easy task.
|
||||
|
||||
### Logwatch
|
||||
|
||||
Logwatch isn’t a fancy GUI tool. Instead, logwatch allows you to set up a logging system that will email you important alerts. You can have those alerts emailed via an SMTP server or you can simply view them on the local machine. Logwatch can be found in the standard repositories for almost every distribution, so installation can be done with a single command, like so:
|
||||
|
||||
```
|
||||
sudo apt-get install logwatch
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```
|
||||
sudo dnf install logwatch
|
||||
```
|
||||
|
||||
During the installation, you will be required to select the delivery method for alerts (Figure 5). If you opt to go the local mail delivery only, you’ll need to install the mailutils app (so you can view mail locally, via the mail command).
|
||||
|
||||
![ Logwatch][11]
|
||||
|
||||
Figure 5: Configuring Logwatch alert sending method.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
All Logwatch configurations are handled in a single file. To edit that file, issue the command sudo nano /usr/share/logwatch/default.conf/logwatch.conf. You’ll want to edit the MailTo = option. If you’re viewing this locally, set that to the Linux username you want the logs sent to (such as MailTo = jack). If you are sending these logs to an external email address, you’ll also need to change the MailFrom = option to a legitimate email address. From within that same configuration file, you can also set the detail level and the range of logs to send. Save and close that file.
|
||||
Once configured, you can send your first mail with a command like:
|
||||
|
||||
```
|
||||
logwatch --detail Med --mailto ADDRESS --service all --range today
|
||||
Where ADDRESS is either the local user or an email address.
|
||||
|
||||
```
|
||||
|
||||
For more information on using Logwatch, issue the command man logwatch. Read through the manual page to see the different options that can be used with the tool.
|
||||
|
||||
### Rsyslog
|
||||
|
||||
Rsyslog is a convenient way to send remote client logs to a centralized server. Say you have one Linux server you want to use to collect the logs from other Linux servers in your data center. With Rsyslog, this is easily done. Rsyslog has to be installed on all clients and the centralized server (by issuing a command like sudo apt-get install rsyslog). Once installed, create the /etc/rsyslog.d/server.conf file on the centralized server, with the contents:
|
||||
|
||||
```
|
||||
# Provide UDP syslog reception
|
||||
$ModLoad imudp
|
||||
$UDPServerRun 514
|
||||
|
||||
# Provide TCP syslog reception
|
||||
$ModLoad imtcp
|
||||
$InputTCPServerRun 514
|
||||
|
||||
# Use custom filenaming scheme
|
||||
$template FILENAME,"/var/log/remote/%HOSTNAME%.log"
|
||||
*.* ?FILENAME
|
||||
|
||||
$PreserveFQDN on
|
||||
|
||||
```
|
||||
|
||||
Save and close that file. Now, on every client machine, create the file /etc/rsyslog.d/client.conf with the contents:
|
||||
|
||||
```
|
||||
$PreserveFQDN on
|
||||
$ActionQueueType LinkedList
|
||||
$ActionQueueFileName srvrfwd
|
||||
$ActionResumeRetryCount -1
|
||||
$ActionQueueSaveOnShutdown on
|
||||
*.* @@SERVER_IP:514
|
||||
|
||||
```
|
||||
|
||||
Where SERVER_IP is the IP address of your centralized server. Save and close that file. Restart rsyslog on all machines with the command:
|
||||
|
||||
```
|
||||
sudo systemctl restart rsyslog
|
||||
|
||||
```
|
||||
|
||||
You can now view the centralized log files with the command (run on the centralized server):
|
||||
|
||||
```
|
||||
tail -f /var/log/remote/*.log
|
||||
|
||||
```
|
||||
|
||||
The tail command allows you to view those files as they are written to, in real time. You should see log entries appear that include the client hostname (Figure 6).
|
||||
|
||||
![Rsyslog][13]
|
||||
|
||||
Figure 6: Rsyslog showing entries for a connected client.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
Rsyslog is a great tool for creating a single point of entry for viewing the logs of all of your Linux servers.
|
||||
|
||||
### More where that came from
|
||||
|
||||
This article only scratched the surface of the logging tools to be found on the Linux platform. And each of the above tools is capable of more than what is outlined here. However, this overview should give you a place to start your long day's journey into the Linux log file.
|
||||
|
||||
Learn more about Linux through the free ["Introduction to Linux" ][14]course from The Linux Foundation and edX.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/learn/intro-to-linux/2018/10/open-source-logging-tools-linux
|
||||
|
||||
作者:[JACK WALLEN][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linux.com/users/jlwallen
|
||||
[1]: /files/images/logs1jpg
|
||||
[2]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/logs_1.jpg?itok=8yO2q1rW (/var/log/)
|
||||
[3]: /licenses/category/used-permission
|
||||
[4]: /files/images/logs2jpg
|
||||
[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/logs_2.jpg?itok=kF6V46ZB (Logs tool)
|
||||
[6]: /files/images/logs3jpg
|
||||
[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/logs_3.jpg?itok=PhrIzI1N (KSystemLog)
|
||||
[8]: /files/images/logs4jpg
|
||||
[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/logs_4.jpg?itok=OxsGJ-TJ (log entry)
|
||||
[10]: /files/images/logs5jpg
|
||||
[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/logs_5.jpg?itok=GeAR551e (Logwatch)
|
||||
[12]: /files/images/logs6jpg
|
||||
[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/logs_6.jpg?itok=ira8UZOr (Rsyslog)
|
||||
[14]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
@ -1,63 +0,0 @@
|
||||
从过时的 Windows 机器迁移到 Linux
|
||||
======
|
||||
|
||||

|
||||
|
||||
每天当我在 ONLYOFFICE 的市场部门工作的时候,我都能看到 Linux 用户在网上讨论我们的办公效率软件。
|
||||
我们的产品在 Linux 用户中很受欢迎,这使得我对使用 Linux 作为日常工具的体验非常好奇。
|
||||
我的老旧的 Windows XP 机器在性能上非常差,因此我决定了解 Linux 系统(特别是 Ubuntu )并且决定去尝试使用它。
|
||||
我的两个同事加入了我的计划。
|
||||
|
||||
### 为何选择 Linux ?
|
||||
|
||||
我们必须做出改变,首先,我们的老系统在性能方面不够用:我们经历过频繁的崩溃,每当超过两个应用在运行机器就会负载过度,关闭机器时有一半的几率冻结等等。
|
||||
这很容易让我们从工作中分心,意味着我们没有我们应有的工作效率了。
|
||||
|
||||
升级到 Windows 更新的版本也是一种选择,但这样可能会带来额外的开销,而且我们的软件本身也是要与 Microsoft 的办公软件竞争。
|
||||
因此我们在这方面也存在意识形态的问题。
|
||||
|
||||
其次,就像我之前提过的, ONLYOFFICE 产品在 Linux 社区内非常受欢迎。
|
||||
通过阅读 Linux 用户在使用我们的软件时的体验,我们也对加入他们很感兴趣。
|
||||
|
||||
在我们要求转换到 Linux 系统一周后,我们拿到了崭新的装好了 [Kubuntu][1] 的机器。
|
||||
我们选择了 16.04 版本,因为这个版本支持 KDE Plasma 5.5 和包括 Dolphin 在内的很多 KDE 应用,同时也包括 LibreOffice 5.1 和 Firefox 45 。
|
||||
|
||||
### Linux 让人喜欢的地方
|
||||
|
||||
我相信 Linux 最大的优势是它的运行速度,比如,从按下机器的电源按钮到开始工作只需要几秒钟时间。
|
||||
从一开始,一切看起来都超乎寻常地快:总体的响应速度,图形界面,甚至包括系统更新的速度。
|
||||
|
||||
另一个使我惊奇的事情是跟 Windows 相比, Linux 几乎能让你配置任何东西,包括整个桌面的外观。
|
||||
在设置里面,我发现了如何修改各种栏目、按钮和字体的颜色和形状,也可以重新布置任意桌面组件的位置,组合桌面的小工具(甚至包括漫画和颜色选择器)
|
||||
我相信我还仅仅只是了解了基本的选项,之后还需要探索这个系统更多著名的定制化选项。
|
||||
|
||||
Linux 发行版通常是一个非常安全的环境。
|
||||
人们很少在 Linux 系统中使用防病毒的软件,因为很少有人会写病毒程序来攻击 Linux 系统。
|
||||
因此你可以拥有很好的系统速度,并且节省了时间和金钱。
|
||||
|
||||
总之, Linux 已经改变了我们的日常生活,用一系列的新选项和功能大大震惊了我们。
|
||||
仅仅通过短时间的使用,我们已经可以给它总结出以下特性:
|
||||
|
||||
* 操作很快很顺畅
|
||||
* 高度可定制
|
||||
* 对新手很友好
|
||||
* 了解基本组件很有挑战性,但回报丰厚
|
||||
* 安全可靠
|
||||
* 对所有想改变工作场所的人来说都是一次绝佳的体验
|
||||
|
||||
你已经从 Windows 或 MacOS 系统换到 Kubuntu 或其他 Linux 变种了么?
|
||||
或者你是否正在考虑做出改变?
|
||||
请分享你想要采用 Linux 系统的原因,连同你对开源的印象一起写在评论中。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/1/move-to-linux-old-windows
|
||||
|
||||
作者:[Michael Korotaev][a]
|
||||
译者:[bookug](https://github.com/bookug)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/michaelk
|
||||
[1]:https://kubuntu.org/
|
@ -0,0 +1,134 @@
|
||||
# 2018 年最好的 Linux 发行版
|
||||
|
||||

|
||||
Jack Wallen 分享他挑选的 2018 年最好的 Linux 发行版。
|
||||
|
||||
这是新的一年,Linux仍有无限可能。而且许多 Linux 在 2017 年都带来了许多重大的改变,我相信在 2018 年它在服务器和桌面上将会带来更加稳定的系统和市场份额的增长。
|
||||
|
||||
对于那些期待迁移到开源平台(或是那些想要切换到)的人对于即将到来的一年,什么是最好的选择?如果你去 [Distrowatch][14] 找一下,你可能会因为众多的发行版而感到头晕,其中一些的排名在上升,而还有一些则恰恰相反。
|
||||
|
||||
因此,哪个 Linux 发行版将在 2018 年得到偏爱?我有我的看法。事实上,我现在就要和你们分享它。
|
||||
|
||||
跟我做的 [去年清单][15] 相似,我将会打破那张清单,使任务更加轻松。普通的 Linux 用户,至少包含以下几个类别:系统管理员,轻量级发行版,桌面,为物联网和服务器发行的版本。
|
||||
|
||||
根据这些,让我们开始 2018 年最好的 Linux 发行版清单吧。
|
||||
|
||||
### 对系统管理员最好的发行版
|
||||
|
||||
[Debian][16] 不常出现在“最好的”列表中。但他应该出现,为什么呢?如果了解到 Ubuntu 是基于 Debian 构建的(其实有很多的发行版都基于 Debian),你就很容易理解为什么这个发行版应该在许多“最好”清单中。但为什么是对管理员最好的呢?我想这是由于两个非常重要的原因:
|
||||
|
||||
* 容易使用
|
||||
* 非常稳定
|
||||
|
||||
因为 Debain 使用 dpkg 和 apt 包管理,它使得使用环境非常简单。而且因为 Debian 提供了最稳定的 Linux 平台之一,它为许多事物提供了理想的环境:桌面,服务器,测试,开发。虽然 Debian 可能不包括去年获奖者发现的大量应用程序,但添加完成任务所需的任何/所有必要应用程序都非常容易。而且因为 Debian 可以根据你的选择安装桌面(Cinnamon, GNOME, KDE, LXDE, Mate, 或者 Xfce),你可以确定满足你需要的桌面。
|
||||
|
||||

|
||||
图1:在 Debian 9.3 上运行的 GNOME 桌面。[使用][1]
|
||||
|
||||
同时,Debain 在 Distrowatch 上名列第二。下载,安装,然后让它为你的工作而服务吧。Debain 尽管不那么华丽,但是对于管理员的工作来说十分有用。
|
||||
|
||||
### 最轻量级的发行版
|
||||
|
||||
轻量级的发行版对于一些老旧或是性能底下的机器有很好的支持。但是这不意味着这些发行版仅仅只为了老旧的硬件机器而生。如果你想要的是运行速度,你可能会想知道在你的现代机器上,这类发行版的运行速度。
|
||||
|
||||
在 2018 年上榜的最轻量级的发行版是 [Lubuntu][18]。尽管在这个类别里还有很多选择,而且尽管 Lubuntu 的大小与 Puppy Linux 相接近,但得益于它是 Ubuntu 家庭的一员,这弥补了它在易用性上的一些不足。但是不要担心,Lubuntu 对于硬件的要求并不高:
|
||||
|
||||
+ CPU:奔腾 4 或者 奔腾 M 或者 AMD K8 以上
|
||||
+ 对于本地应用,512 MB 的内存就可以了,对于网络使用(Youtube,Google+,Google Drive, Facebook),建议 1 GB 以上。
|
||||
|
||||
Lubuntu 使用的是 LXDE 桌面,这意味着用户在初次使用这个 Linux 发行版时不会有任何问题。这份短清单中包含的应用(例如:Abiword, Gnumeric, 和 Firefox)都是非常轻量,且对用户友好的。
|
||||
|
||||
### [lubuntu,jpg][8]
|
||||

|
||||
图2:LXDE桌面。[使用][2]
|
||||
|
||||
Lubuntu 能让十年以上的电脑如获新生。
|
||||
|
||||
### 最好的桌面发行版
|
||||
|
||||
[Elementary OS][19] 连续两年都是我清单中最好的桌面发行版。对于许多人,[Linux Mint][20] 都是桌面发行版的领导。但是,与我来说,它在易用性和稳定性上很难打败 Elementary OS。例如,我确信 [Ubuntu][21] 17.10 的发布会让我迁移回 Canonical 的发行版。不久之后我会迁移到 新的使用 GNOME 桌面的 Ubuntu,但是我发现我少了 Elementary OS 外观,可用性和感觉。在使用 Ubuntu 两周以后,我又换回了 Elementary OS。
|
||||
|
||||
### [elementaros.jpg][9]
|
||||
|
||||

|
||||
图3:Pantheon 桌面是一件像艺术品一样的桌面。[使用][3]
|
||||
|
||||
任何使用 Elementary OS 的感觉很好。Pantheon 桌面是缺省和用户友好做的最完美的桌面。每次更新,它都会变得更好。
|
||||
|
||||
尽管 Elementary OS 在 Distrowatch 中排名第六,但我预计到 2018 年第,它将至少上升至第三名。Elementary 开发人员非常关注用户的需求。他们倾听并且改进,他们目前的状态是如此之好,似乎所有他们都可以做的更好。 如果您需要一个具有出色可靠性和易用性的桌面,Elementary OS 就是你的发行版。
|
||||
|
||||
### 能够证明自己的最好的发行版
|
||||
|
||||
很长一段时间内,[Gentoo][22]都稳坐“展现你技能”的发行版的首座。但是,我认为现在 Gentoo 是时候让出“证明自己”的宝座给 [Linux From Svratch][23]。你可能认为这不公平,因为 LFS 实际上不是一个发行版,而是一个帮助用户创建自己的 Linux 发行版的项目。但是,有什么能比你自己创建一个自己的发行版更能证明自己所学的 Linux 知识的呢?在 LFS 项目中,你可以从头开始构建自定义的 Linux 系统。 所以,如果你真的有需要证明的东西,请下载 [Linux From Scratch Book][24] 并开始构建。
|
||||
|
||||
### 对于物联网最好的发行版
|
||||
|
||||
[Ubuntu Core][25] 已经是第二年赢得了该项的冠军。Ubuntu Core 是 Ubuntu 的一个小型版本,专为嵌入式和物联网设备而构建。使Ubuntu Core 如此完美的物联网的原因在于它将重点放在快照包 - 通用包上,可以安装到平台上,而不会干扰基本系统。这些快照包包含它们运行所需的所有内容(包括依赖项),因此不必担心安装会破坏操作系统(或任何其他已安装的软件)。 此外,快照非常容易升级并在隔离的沙箱中运行,这使它们成为物联网的理想解决方案。
|
||||
|
||||
Ubuntu Core 内置的另一个安全领域是登录机制。Ubuntu Core使用Ubuntu One ssh密钥,这样登录系统的唯一方法是通过上传的ssh密钥到[Ubuntu One帐户][26]。这为你的物联网设备提供了更高的安全性。
|
||||
|
||||
### [ubuntucore.jpg][10]
|
||||

|
||||
图4:Ubuntu Core屏幕指示通过Ubuntu One用户启用远程访问。[使用][3]
|
||||
|
||||
### 最好的服务器发行版
|
||||
|
||||
这让事情变得有些混乱。 主要原因是支持。 如果你需要商业支持,乍一看,你最好的选择可能是 [Red Hat Enterprise Linux][27]。红帽年复一年地证明了自己不仅是全球最强大的企业服务器平台之一,而且是单一最赚钱的开源业务(年收入超过20亿美元)。
|
||||
|
||||
但是,Red Hat 并不是唯一的服务器发行版。 实际上,Red Hat 甚至不支持企业服务器计算的各个方面。如果你关注亚马逊 Elastic Compute Cloud 上的云统计数据,Ubuntu 就会打败红帽企业Linux。根据[云市场][28],EC2 统计数据显示 RHEL 的部署率低于 10 万,而 Ubuntu 的部署量超过 20 万。
|
||||
|
||||
最终的结果是,Ubuntu 几乎已经成为云计算的领导者。如果你将它与 Ubuntu 易于使用和管理容器结合起来,就会发现 Ubuntu Server 是服务器类别的明显赢家。而且,如果你需要商业支持,Canonical 将为你提供 [Ubuntu Advantage][29]。
|
||||
|
||||
对使用 Ubuntu Server 的一个警告是它默认为纯文本界面。如果需要,你可以安装 GUI,但使用Ubuntu Server 命令行非常简单(每个Linux管理员都应该知道)。
|
||||
|
||||
### [ubuntuserver.jpg][11]
|
||||
|
||||

|
||||
图5:Ubuntu 服务器登录,通知更新。[使用][3]
|
||||
|
||||
### 你最好的选择
|
||||
|
||||
正如我之前所说,这些选择都非常主观,但如果你正在寻找一个好的开始,那就试试这些发行版。每一个都可以用于非常特定的目的,并且比大多数做得更好。虽然你可能不同意我的特定选择,但你可能会同意 Linux 在每个方面都提供了惊人的可能性。并且,请继续关注下周更多“最佳发行版”选秀。
|
||||
|
||||
通过 Linux 基金会和 edX 的免费[“Linux 简介”][13]课程了解有关Linux的更多信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/learn/intro-to-linux/2018/1/best-linux-distributions-2018
|
||||
|
||||
作者:[JACK WALLEN ][a]
|
||||
译者:[dianbanjiu](https://github.com/dianbanjiu)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linux.com/users/jlwallen
|
||||
[1]:https://www.linux.com/licenses/category/used-permission
|
||||
[2]:https://www.linux.com/licenses/category/used-permission
|
||||
[3]:https://www.linux.com/licenses/category/used-permission
|
||||
[4]:https://www.linux.com/licenses/category/used-permission
|
||||
[5]:https://www.linux.com/licenses/category/used-permission
|
||||
[6]:https://www.linux.com/licenses/category/creative-commons-zero
|
||||
[7]:https://www.linux.com/files/images/debianjpg
|
||||
[8]:https://www.linux.com/files/images/lubuntujpg-2
|
||||
[9]:https://www.linux.com/files/images/elementarosjpg
|
||||
[10]:https://www.linux.com/files/images/ubuntucorejpg
|
||||
[11]:https://www.linux.com/files/images/ubuntuserverjpg-1
|
||||
[12]:https://www.linux.com/files/images/linux-distros-2018jpg
|
||||
[13]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
||||
[14]:https://distrowatch.com/
|
||||
[15]:https://www.linux.com/news/learn/sysadmin/best-linux-distributions-2017
|
||||
[16]:https://www.debian.org/
|
||||
[17]:https://www.parrotsec.org/
|
||||
[18]:http://lubuntu.me/
|
||||
[19]:https://elementary.io/
|
||||
[20]:https://linuxmint.com/
|
||||
[21]:https://www.ubuntu.com/
|
||||
[22]:https://www.gentoo.org/
|
||||
[23]:http://www.linuxfromscratch.org/
|
||||
[24]:http://www.linuxfromscratch.org/lfs/download.html
|
||||
[25]:https://www.ubuntu.com/core
|
||||
[26]:https://login.ubuntu.com/
|
||||
[27]:https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux
|
||||
[28]:http://thecloudmarket.com/stats#/by_platform_definition
|
||||
[29]:https://buy.ubuntu.com/?_ga=2.177313893.113132429.1514825043-1939188204.1510782993
|
@ -0,0 +1,108 @@
|
||||
一个简单,美观和跨平台的播客应用程序
|
||||
======
|
||||
|
||||

|
||||
|
||||
播客在过去几年中变得非常流行。 播客就是所谓的“信息娱乐”,它们通常是轻松的,但它通常会为你提供有价值的信息。 播客在过去几年中已经非常火爆了,如果你喜欢某些东西,很可能存在一个相关的播客。 Linux 桌面版上有很多播客播放器,但是如果你想要一些视觉上美观,有光滑动画并且可以在每个平台上运行的东西,那就并没有很多替代品可以替代 **CPod** 了。 CPod(以前称为 **Cumulonimbus**)是一个开源的最简单的播客应用程序,适用于 Linux,MacOS 和 Windows。
|
||||
|
||||
CPod 运行在一个名为 **Electron** 的东西上 - 这个工具允许开发人员构建跨平台(例如 Windows,MacOs 和 Linux)的桌面图形化应用程序。 在本简要指南中,我们将讨论如何在 Linux 中安装和使用 CPod 播客应用程序。
|
||||
|
||||
### 安装 CPod
|
||||
|
||||
转到 CPod 的[**发布页面**][1]。 下载并安装所选平台的二进制文件。 如果你使用 Ubuntu / Debian,你只需从发布页面下载并安装 .deb 文件,如下所示。
|
||||
|
||||
```
|
||||
$ wget https://github.com/z-------------/CPod/releases/download/v1.25.7/CPod_1.25.7_amd64.deb
|
||||
|
||||
$ sudo apt update
|
||||
|
||||
$ sudo apt install gdebi
|
||||
|
||||
$ sudo gdebi CPod_1.25.7_amd64.deb
|
||||
```
|
||||
|
||||
如果你使用任何其他发行版,你可能需要在发行版页面中使用 **AppImage**。
|
||||
|
||||
从发布页面下载 AppImage 文件。
|
||||
|
||||
打开终端,然后转到存储 AppImage 文件的目录。 更改权限以允许执行:
|
||||
|
||||
```
|
||||
$ chmod +x CPod-1.25.7-x86_64.AppImage
|
||||
```
|
||||
|
||||
执行 AppImage 文件:
|
||||
|
||||
```
|
||||
$ ./CPod-1.25.7-x86_64.AppImage
|
||||
```
|
||||
|
||||
你将看到一个对话框询问是否将应用程序与系统集成。 如果要执行此操作,请单击**是**。
|
||||
|
||||
### 特征
|
||||
|
||||
**探索标签页**
|
||||
|
||||

|
||||
|
||||
CPod 使用 Apple iTunes 数据库查找播客。 这很好,因为 iTunes 数据库是最大的数据库。 如果那里有一个播客,很可能是在 iTunes 上。 要查找播客,只需使用探索部分中的顶部搜索栏即可。 探索部分还展示了一些受欢迎的播客。
|
||||
|
||||
**主标签页**
|
||||
|
||||

|
||||
|
||||
主标签页在打开应用程序时是默认打开的。 主标签页显示你已订阅的所有播客的所有剧集的时间顺序列表。
|
||||
|
||||
在主页选项卡中,你可以:
|
||||
|
||||
1. 标记剧集阅读。
|
||||
2. 下载它们进行离线播放
|
||||
3. 将它们添加到播放队列中。
|
||||
|
||||

|
||||
|
||||
**订阅标签页**
|
||||
|
||||

|
||||
|
||||
你当然可以订阅你喜欢的播客。 你可以在订阅标签页中执行的其他一些操作是:
|
||||
|
||||
1.刷新播客艺术作品
|
||||
2.导出订阅到 .OPML 文件中,从 .OPML 文件中导入订阅。
|
||||
|
||||
|
||||
**播放器**
|
||||
|
||||

|
||||
|
||||
播放器可能是 CPod 最美观的部分。 该应用程序根据播客的横幅更改整体外观。 底部有一个声音可视化器。 在右侧,你可以查看和搜索此播客的其他剧集。
|
||||
|
||||
**缺点/缺失功能**
|
||||
|
||||
虽然我喜欢这个应用程序,但 CPod 确实有一些特性和缺点:
|
||||
|
||||
1. 可怜的 MPRIS 集成 - 你可以从桌面环境的媒体播放器对话框中播放或者暂停播客,但这是不够的。 播客的名称未显示,你可以转到下一个或者上一个剧集。
|
||||
2. 不支持章节。
|
||||
3. 没有自动下载 - 你必须手动下载剧集。
|
||||
4. 使用过程中的 CPU 使用率非常高(即使对于 Electron 应用程序)。
|
||||
|
||||
|
||||
### Verdict
|
||||
|
||||
虽然它确实有它的缺点,但 CPod 显然是最美观的播客播放器应用程序,并且它具有最基本的功能。 如果你喜欢使用视觉上美观的应用程序,并且不需要高级功能,那么这就是你的完美款 app。 我知道我马上就要使用它。
|
||||
|
||||
你喜欢 CPod 吗? 请将你的意见发表在下面的评论中。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/cpod-a-simple-beautiful-and-cross-platform-podcast-app/
|
||||
|
||||
作者:[EDITOR][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[Flowsnow](https://github.com/Flowsnow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.ostechnix.com/author/editor/
|
||||
[1]: https://github.com/z-------------/CPod/releases
|
@ -0,0 +1,315 @@
|
||||
|
||||
Linux 系统上 swap 空间的介绍
|
||||
======
|
||||
|
||||

|
||||
|
||||
当今无论什么操作系统 Swap 空间是非常常见的。Linux 使用 Swap 空间来增加主机可用的虚拟内存。它可以是常规文件或逻辑卷上使用一个或多个专用swap 分区或 swap 文件。
|
||||
|
||||
典型计算机中有两种基本类型的内存。第一种类型,随机存取存储器 (RAM),用于存储计算机使用的数据和程序。只有程序和数据存储在 RAM 中,计算机才能使用它们。随机存储器是易失性存储器;也就是说,如果计算机关闭了,存储在 RAM 中的数据就会丢失。
|
||||
|
||||
|
||||
硬盘是用于长期存储数据和程序的磁性介质。该磁介质可以很好的保存数据;即使计算机断电,存储在磁盘上的数据也会保留下来。CPU (中央处理器)不能直接访问硬盘上的程序和数据;他们必须首先复制到 RAM 中,RAM 是 CPU 访问代码指令和操作数据的地方。在引导过程中,计算机将特定的操作系统程序(如内核、init 或 systemd )以及硬盘上的数据复制到 RAM 中,在 RAM 中,计算机的处理器 CPU 可以直接访问这些数据。
|
||||
|
||||
### Swap 空间
|
||||
|
||||
Swap 空间是现代 Linux 系统中的第二种内存类型。Swap 空间的主要功能是当全部的 RAM 被占用并且需要更多内存时,用磁盘空间代替 RAM 内存。
|
||||
|
||||
例如,假设你有一个 8GB RAM 的计算机。如果你启动的程序没有填满 RAM,一切好,不需要 Swap。假设你在处理电子表格,当添加更多的行时,你电子表格会增长,加上所有正在运行的程序,将会占用全部的 RAM 。如果这时没有可用的 Swap 空间,你将不得不停止处理电子表格,直到关闭一些其他程序来释放一些 RAM 。
|
||||
|
||||
内核使用一个内存管理程序来检测最近没有使用的内存块,也就是内存页面。内存管理程序将这些相对不经常使用的内存页交换到硬盘上专门指定用于“分页”或 swap 的特殊分区。释放 RAM ,为输入电子表格更多数据腾出了空间。那些换出到硬盘的内存页面被内核的内存管理代码跟踪,如果需要,可以被分页回 RAM。
|
||||
|
||||
Linux 计算机中的内存总量是 RAM + swap 分区,swap 分区被称为虚拟内存.
|
||||
|
||||
### Linux swap 分区类型
|
||||
|
||||
Linux 提供了两种类型的 swap 空间。默认情况下,大多数 Linux 在安装时都会创建一个 swap 分区,但是也可以使用一个特殊配置的文件作为 swap 文件。swap 分区顾名思义就是一个标准磁盘分区,由 `mkswap` 命令指定 swap 空间。
|
||||
|
||||
如果没有可用磁盘空间来创建新的 swap 分区,或者卷组中没有空间为 swap 空间创建逻辑卷,则可以使用 swap 文件。这只是一个创建并预分配指定大小的常规文件。然后运行 `mkswap` 命令将其配置为 swap 空间。除非绝对必要,否则我不建议使用文件来做 swap 空间。
|
||||
|
||||
### 频繁交换
|
||||
|
||||
当总虚拟内存( RAM 和 swap 空间 )变得快满时,可能会发生频繁交换 。系统花了太多时间在 swap 空间和 RAM 之间做内存块页面切换,以至于几乎没有时间用于实际工作。这种情况是显而易见的:系统变得缓慢或完全无反应,硬盘指示灯几乎持续亮起。
|
||||
|
||||
使用 `free` 的命令来显示 CPU 负载和内存使用情况,你会发现 CPU 负载非常高,可能达到系统中 CPU 内核数量的30到40倍。另一个情况是 RAM 和 swap 空间几乎完全被分配了。
|
||||
|
||||
|
||||
事实上,查看 SAR (系统活动报告)数据也可以显示这些内容。在我的每个系统上都安装 SAR ,并将这些用于数据分析。
|
||||
|
||||
|
||||
### swap 空间的正确大小是多少?
|
||||
|
||||
许多年前,硬盘上分配给 swap 空间大小是计算机上的 RAM 的两倍(当然,这是大多数计算机的 RAM 以 KB 或 MB 为单位的时候)。因此,如果一台计算机有 64KB 的 RAM,应该分配 128KB 的 swap 分区。该规则考虑到了这样的事实情况,即 RAM 大小在当时非常小,分配超过2倍的 RAM 用于 swap 空间并不能提高性能。使用超过两倍的 RAM 进行交换,比实际执行有用的工作的时候,大多数系统将花费更多的时间。
|
||||
|
||||
|
||||
RAM 现在已经很便宜了,如今大多数计算机的 RAM 都达到了几十亿字节。我的大多数新电脑至少有 8GB 内存,一台有32GB 内存,我的主工作站有 64GB 内存。我的旧电脑有4到 8GB 的内存。
|
||||
|
||||
|
||||
当操作具有大 RAM 的计算机时,swap 空间的限制性能系数远低于 2倍。[Fedora 28在线安装指南][1] 定义了当前关于 swap 空间分配的方法。下面内容是我提出的建议。
|
||||
|
||||
下表根据系统中的 RAM 大小以及是否有足够的内存让系统休眠,提供了交换分区的推荐大小。建议的 swap 分区大小是在安装过程中自动建立的。但是,为了满足系统休眠,您需要在自定义分区阶段编辑 swap 空间。
|
||||
|
||||
_表 1: Fedora 28文档中推荐的系统 swap 空间_
|
||||
|
||||
| **系统内存大小 ** | **推荐 swap 空间 ** | **建议 swap 大小用休眠模式 ** |
|
||||
|--------------------------|-----------------------------|---------------------------------------|
|
||||
| 小于 2 GB | 2倍 RAM | 3 倍 RAM |
|
||||
| 2 GB - 8 GB | 等于 RAM 大小 | 2 倍 RAM |
|
||||
| 8 GB - 64 GB | 0.5 倍 RAM | 1.5 倍 RAM |
|
||||
| 大于 64 GB | 工作量相关 | 不建议休眠模式 |
|
||||
|
||||
|
||||
在上面列出的每个范围之间的边界(例如,具有 2GB、8GB 或 64GB 的系统 RAM),请根据所选 swap 空间和支持休眠功能请谨慎使用。如果你的系统资源允许,增加 swap 空间可能会带来更好的性能。
|
||||
|
||||
当然,大多数 Linux 管理员对多大的 swap 空间量有自己的想法。下面的表2包含了基于我在多种环境中的个人经历所做出的建议。这些可能不适合你,但是和表1一样,它们可能对你有所帮助。
|
||||
|
||||
|
||||
_表 2: 作者推荐的系统 swap 空间_
|
||||
|
||||
| RAM 大小 | 推荐 swap 空间 |
|
||||
|---------------|------------------------|
|
||||
| ≤ 2GB | 2X RAM |
|
||||
| 2GB – 8GB | = RAM |
|
||||
| >8GB | 8GB |
|
||||
|
||||
|
||||
这两个表中共同点,随着 RAM 数量的增加,超过某一点增加更多 swap 空间只会导致在 swap 空间几乎被全部使用之前就发生频繁交换。根据以上建议,则应尽可能添加更多 RAM,而不是增加更多 swap 空间。如类似影响系统性能的情况一样,请使用最适合你的建议。根据 Linux 环境中的条件进行测试和更改是需要时间和精力的。
|
||||
|
||||
|
||||
### 向非 LVM 磁盘环境添加更多 swap 空间
|
||||
|
||||
面对已安装 Linux 的主机并对 swap 空间的需求不断变化,有时有必要修改系统定义的 swap 空间的大小。此过程可用于需要增加 swap 空间大小的任何情况。它假设有足够的可用磁盘空间。此过程还假设磁盘在 “raw” EXT4 和 swap 分区中分区,并且不使用逻辑卷 (LVM)。
|
||||
|
||||
|
||||
|
||||
要基本步骤很简单:
|
||||
|
||||
1. 关闭现有的 swap 空间。
|
||||
|
||||
2. 创建所需大小的新 swap 分区。
|
||||
|
||||
3. 重读分区表。
|
||||
|
||||
4. 将分区配置为 swap 空间。
|
||||
|
||||
5. 添加新分区到 /etc/fstab。
|
||||
|
||||
6. 打开 swap 空间。
|
||||
|
||||
|
||||
不应需要重新启动机器。
|
||||
|
||||
|
||||
为了安全起见,在关闭 swap 空间前,至少你应该确保没有应用程序在运行,也没有 swap 空间在使用。`free` 或 `top` 命令可以告诉你 swap 空间是否在使用中。为了更安全,您可以恢复到运行级别1或单用户模式。
|
||||
|
||||
使用关闭所有 swap 空间的命令关闭 swap 分区:
|
||||
|
||||
```
|
||||
swapoff -a
|
||||
|
||||
```
|
||||
|
||||
现在查看硬盘上的现有分区。
|
||||
|
||||
```
|
||||
fdisk -l
|
||||
|
||||
```
|
||||
|
||||
这将显示每个驱动器上的分区表。按编号标识当前的 swap 分区。
|
||||
|
||||
|
||||
使用以下命令在交互模式下启动 `fdisk`:
|
||||
|
||||
```
|
||||
fdisk /dev/<device name>
|
||||
|
||||
```
|
||||
|
||||
例如:
|
||||
|
||||
```
|
||||
fdisk /dev/sda
|
||||
|
||||
```
|
||||
|
||||
此时,`fdisk` 是交互方式的,只在指定的磁盘驱动器上进行操作。
|
||||
|
||||
使用 fdisk `p` 子命令验证磁盘上是否有足够的可用空间来创建新的 swap 分区。硬盘上的空间以 512字节 以及起始和结束柱面编号的形式显示,因此您可能需要做一些计算来确定分配分区之间和末尾的可用空间。
|
||||
|
||||
使用 `n` 子命令创建新的交换分区。fdisk 会问你开始柱面。默认情况下,它选择编号最低的可用柱面。如果你想改变这一点,输入开始柱面的编号。
|
||||
|
||||
`fdisk` 命令允许你以多种格式输入分区的大小,包括最后一个柱面号或字节、KB 或 MB 的大小。键入 4000M ,这将在新分区上提供大约 4GB 的空间(例如),然后按 Enter 键。
|
||||
|
||||
使用 `p` 子命令来验证分区是否按照指定的方式创建的。请注意,除非使用结束柱面编号,否则分区可能与你指定的不完全相同。`fdisk` 命令只能在整个柱面上增量的分配磁盘空间,因此你的分区可能比你指定的稍小或稍大。如果分区不是您想要的,你可以删除它并重新创建它。
|
||||
|
||||
现在指定新分区是 swap 分区了 。子命令 `t` 允许你指定定分区的类型。所以输入 `t`,指定分区号,当它要求十六进制分区类型时,输入82,这是Linux swap 分区类型,然后按 Enter。
|
||||
|
||||
|
||||
当你对创建的分区感到满意时,使用 `w` 子命令将新的分区表写入磁盘。`fdisk` 程序将退出,并在完成修改后的分区表的编写后返回命令提示符。当`fdisk` 完成写入新分区表时,会收到以下消息:
|
||||
|
||||
```
|
||||
The partition table has been altered!
|
||||
Calling ioctl() to re-read partition table.
|
||||
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
|
||||
The kernel still uses the old table.
|
||||
The new table will be used at the next reboot.
|
||||
Syncing disks.
|
||||
```
|
||||
|
||||
|
||||
此时,你使用 `partprobe` 命令强制内核重新读取分区表,这样就不需要执行重新启动机器。
|
||||
|
||||
```
|
||||
partprobe
|
||||
```
|
||||
|
||||
|
||||
使用命令 `fdisk -l` 列出分区,新 swap 分区应该在列出的分区中。确保新的分区类型是 “Linux swap”。
|
||||
|
||||
修改 /etc/fstab 文件以指向新的 swap 分区。如下所示:
|
||||
|
||||
```
|
||||
LABEL=SWAP-sdaX swap swap defaults 0 0
|
||||
|
||||
```
|
||||
|
||||
其中 `X` 是分区号。根据新 swap 分区的位置,添加以下内容:
|
||||
|
||||
```
|
||||
/dev/sdaY swap swap defaults 0 0
|
||||
|
||||
```
|
||||
|
||||
请确保使用正确的分区号。现在,可以执行创建 swap 分区的最后一步。使用 `mkswap` 命令将分区定义为 swap 分区。
|
||||
|
||||
```
|
||||
mkswap /dev/sdaY
|
||||
|
||||
```
|
||||
|
||||
最后一步是使用以下命令启用 swap 空间:
|
||||
|
||||
```
|
||||
swapon -a
|
||||
|
||||
```
|
||||
|
||||
你的新 swap 分区现在与以前存在的 swap 分区一起在线。您可以使用 `free` 或`top` 命令来验证这一点。
|
||||
|
||||
#### 在 LVM 磁盘环境中添加 swap 空间
|
||||
|
||||
如果你的磁盘使用 LVM ,更改 swap 空间将相当容易。同样,假设当前 swap 卷所在的卷组中有可用空间。默认情况下,LVM 环境中的 Fedora Linux 在安装过程将 swap 分区创建为逻辑卷。您可以非常简单地增加 swap 卷的大小。
|
||||
|
||||
以下是在 LVM 环境中增加 swap 空间大小的步骤:
|
||||
|
||||
1. 关闭所有 swap 。
|
||||
|
||||
2. 增加指定用于 swap 的逻辑卷的大小。
|
||||
|
||||
3. 为 swap 空间调整大小的卷配置。
|
||||
|
||||
4. 启用 swap。
|
||||
|
||||
|
||||
|
||||
首先,让我们使用 `lvs` 命令(列出逻辑卷)来验证 swap 是否存在以及 swap 是否是逻辑卷。
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# lvs
|
||||
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
|
||||
home fedora_studentvm1 -wi-ao---- 2.00g
|
||||
pool00 fedora_studentvm1 twi-aotz-- 2.00g 8.17 2.93
|
||||
root fedora_studentvm1 Vwi-aotz-- 2.00g pool00 8.17
|
||||
swap fedora_studentvm1 -wi-ao---- 8.00g
|
||||
tmp fedora_studentvm1 -wi-ao---- 5.00g
|
||||
usr fedora_studentvm1 -wi-ao---- 15.00g
|
||||
var fedora_studentvm1 -wi-ao---- 10.00g
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
你可以看到当前的 swap 大小为 8GB。在这种情况下,我们希望将 2GB 添加到此 swap 卷中。首先,停止现有的 swap 。如果 swap 空间正在使用,终止正在运行的程序。
|
||||
|
||||
|
||||
```
|
||||
swapoff -a
|
||||
|
||||
```
|
||||
|
||||
现在增加逻辑卷的大小。
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# lvextend -L +2G /dev/mapper/fedora_studentvm1-swap
|
||||
Size of logical volume fedora_studentvm1/swap changed from 8.00 GiB (2048 extents) to 10.00 GiB (2560 extents).
|
||||
Logical volume fedora_studentvm1/swap successfully resized.
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
运行 `mkswap` 命令将整个 10GB 分区变成 swap 空间。
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# mkswap /dev/mapper/fedora_studentvm1-swap
|
||||
mkswap: /dev/mapper/fedora_studentvm1-swap: warning: wiping old swap signature.
|
||||
Setting up swapspace version 1, size = 10 GiB (10737414144 bytes)
|
||||
no label, UUID=3cc2bee0-e746-4b66-aa2d-1ea15ef1574a
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
重新启用 swap 。
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# swapon -a
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
现在,使用 `lsblk ` 命令验证新 swap 空间是否存在。同样,不需要重新启动机器。
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:0 0 60G 0 disk
|
||||
|-sda1 8:1 0 1G 0 part /boot
|
||||
`-sda2 8:2 0 59G 0 part
|
||||
|-fedora_studentvm1-pool00_tmeta 253:0 0 4M 0 lvm
|
||||
| `-fedora_studentvm1-pool00-tpool 253:2 0 2G 0 lvm
|
||||
| |-fedora_studentvm1-root 253:3 0 2G 0 lvm /
|
||||
| `-fedora_studentvm1-pool00 253:6 0 2G 0 lvm
|
||||
|-fedora_studentvm1-pool00_tdata 253:1 0 2G 0 lvm
|
||||
| `-fedora_studentvm1-pool00-tpool 253:2 0 2G 0 lvm
|
||||
| |-fedora_studentvm1-root 253:3 0 2G 0 lvm /
|
||||
| `-fedora_studentvm1-pool00 253:6 0 2G 0 lvm
|
||||
|-fedora_studentvm1-swap 253:4 0 10G 0 lvm [SWAP]
|
||||
|-fedora_studentvm1-usr 253:5 0 15G 0 lvm /usr
|
||||
|-fedora_studentvm1-home 253:7 0 2G 0 lvm /home
|
||||
|-fedora_studentvm1-var 253:8 0 10G 0 lvm /var
|
||||
`-fedora_studentvm1-tmp 253:9 0 5G 0 lvm /tmp
|
||||
sr0 11:0 1 1024M 0 rom
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
您也可以使用`swapon -s` 命令或 `top` 、`free` 或其他几个命令来验证这一点。
|
||||
|
||||
```
|
||||
[root@studentvm1 ~]# free
|
||||
total used free shared buff/cache available
|
||||
Mem: 4038808 382404 2754072 4152 902332 3404184
|
||||
Swap: 10485756 0 10485756
|
||||
[root@studentvm1 ~]#
|
||||
```
|
||||
|
||||
请注意,不同的命令以不同的形式显示或要求输入设备文件。在 /dev 目录中访问特定设备有多种方式。在我的文章[Managing Devices in Linux][2] 中有更多关于 /dev 目录及其内容说明。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/9/swap-space-linux-systems
|
||||
|
||||
作者:[David Both][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[heguangzhi](https://github.com/heguangzhi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/dboth
|
||||
[1]: https://docs.fedoraproject.org/en-US/fedora/f28/install-guide/
|
||||
[2]: https://opensource.com/article/16/11/managing-devices-linux
|
Loading…
Reference in New Issue
Block a user