From 46645ece2bd57ef51c4ed9dc65d0547c19337c9a Mon Sep 17 00:00:00 2001 From: songshunqiang Date: Thu, 24 May 2018 16:50:27 +0800 Subject: [PATCH 01/84] submit tech/20180510 Creating small containers with Buildah.md --- ... Creating small containers with Buildah.md | 100 ------------------ ... Creating small containers with Buildah.md | 98 +++++++++++++++++ 2 files changed, 98 insertions(+), 100 deletions(-) delete mode 100644 sources/tech/20180510 Creating small containers with Buildah.md create mode 100644 translated/tech/20180510 Creating small containers with Buildah.md diff --git a/sources/tech/20180510 Creating small containers with Buildah.md b/sources/tech/20180510 Creating small containers with Buildah.md deleted file mode 100644 index 9b8a550e7e..0000000000 --- a/sources/tech/20180510 Creating small containers with Buildah.md +++ /dev/null @@ -1,100 +0,0 @@ -pinewall translating - -Creating small containers with Buildah -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open%20source_collaboration_0.png?itok=YEl_GXbv) -I recently joined Red Hat after many years working for another tech company. In my previous job, I developed a number of different software products that were successful but proprietary. Not only were we legally compelled to not share the software outside of the company, we often didn’t even share it within the company. At the time, that made complete sense to me: The company spent time, energy, and budget developing the software, so they should protect and claim the rewards it garnered. - -Fast-forward to a year ago, when I joined Red Hat and developed a completely different mindset. One of the first things I jumped into was the [Buildah project][1]. It facilitates building Open Container Initiative (OCI) images, and it is especially good at allowing you to tailor the size of the image that is created. At that time Buildah was in its very early stages, and there were some warts here and there that weren’t quite production-ready. - -Being new to the project, I made a few minor changes, then asked where the company’s internal git repository was so that I could push my changes. The answer: Nothing internal, just push your changes to GitHub. I was baffled—sending my changes out to GitHub would mean anyone could look at that code and use it for their own projects. Plus, the code still had a few warts, so that just seemed so counterintuitive. But being the new guy, I shook my head in wonder and pushed the changes out. - -A year later, I’m now convinced of the power and value of open source software. I’m still working on Buildah, and we recently had an issue that illustrates that power and value. The issue, titled [Buildah images not so small?][2] , was raised by Tim Dudgeon (@tdudgeon). To summarize, he noted that images created by Buildah were bigger than those created by Docker, even though the Buildah images didn’t contain the extra "fluff" he saw in the Docker images. - -For comparison he first did: -``` -$ docker pull centos:7 -$ docker images -REPOSITORY            TAG              IMAGE ID                 CREATED             SIZE -docker.io/centos          7                   2d194b392dd1        2 weeks ago         195 MB -``` - -He noted that the size of the Docker image was 195MB. Tim then created a minimal (scratch) image using Buildah, with only the `coreutils` and `bash` packages added to the image, using the following script: -``` -$ cat  ./buildah-base.sh -#!/bin/bash - -set -x - -# build a minimal image -newcontainer=$(buildah from scratch) -scratchmnt=$(buildah mount $newcontainer) - -# install the packages -yum install --installroot $scratchmnt bash coreutils --releasever 7 --setopt install_weak_deps=false -y -yum clean all -y --installroot $scratchmnt --releasever 7 - -sudo buildah config --cmd /bin/bash $newcontainer - -# set some config info -buildah config --label name=centos-base $newcontainer - -# commit the image -buildah unmount $newcontainer -buildah commit $newcontainer centos-base - -$ sudo ./buildah-base.sh - -$ sudo buildah images -IMAGE ID               IMAGE NAME                                             CREATED AT            SIZE -8379315d3e3e     docker.io/library/centos-base:latest           Mar 25, 2018 17:08   212.1 MB -``` - -Tim wondered why the image was 17MB larger, because `python` and `yum` were not installed in the Buildah image, whereas they were installed in the Docker image. This set off quite the discussion in the GitHub issue, as it was not at all an expected result. - -What was great about the discussion was that not only were Red Hat folks involved, but several others from outside as well. In particular, a lot of great discussion and investigation was led by GitHub user @pixdrift, who noted that the documentation and locale-archive were chewing up a little more than 100MB of space in the Buildah image. Pixdrift suggested forcing locale in the yum installer and provided this updated `buildah-bash.sh` script with those changes: -``` -#!/bin/bash - -set -x - -# build a minimal image -newcontainer=$(buildah from scratch) -scratchmnt=$(buildah mount $newcontainer) - -# install the packages -yum install --installroot $scratchmnt bash coreutils --releasever 7 --setopt=install_weak_deps=false --setopt=tsflags=nodocs --setopt=override_install_langs=en_US.utf8 -y -yum clean all -y --installroot $scratchmnt --releasever 7 - -sudo buildah config --cmd /bin/bash $newcontainer - -# set some config info -buildah config --label name=centos-base $newcontainer - -# commit the image -buildah unmount $newcontainer -buildah commit $newcontainer centos-base -``` - -When Tim ran this new script, the image size shrank to 92MB, shedding 120MB from the original Buildah image size and getting closer to the expected size; however, engineers being engineers, a size savings of 56% wasn’t enough. The discussion went further, involving how to remove individual locale packages to save even more space. To see more details of the discussion, click the [Buildah images not so small?][2] link. Who knows—maybe you’ll have a helpful tip, or better yet, become a contributor for Buildah. On a side note, this solution illustrates how the Buildah software can be used to quickly and easily create a minimally sized container that's loaded only with the software that you need to do your job efficiently. As a bonus, it doesn’t require a daemon to be running. - -This image-sizing issue drove home the power of open source software for me. A number of people from different companies all collaborated to solve a problem through open discussion in a little over a day. Although no code changes were created to address this particular issue, there have been many code contributions to Buildah from contributors outside of Red Hat, and this has helped to make the project even better. These contributions have served to get a wider variety of talented people to look at the code than ever would have if it were a proprietary piece of software stuck in a private git repository. It’s taken only a year to convert me to the [open source way][3], and I don’t think I could ever go back. - -This article was originally posted at [Project Atomic][4]. Reposted with permission. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/5/containers-buildah - -作者:[Tom Sweeney][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/tomsweeneyredhat -[1]:https://github.com/projectatomic/buildah -[2]:https://github.com/projectatomic/buildah/issues/532 -[3]:https://twitter.com/opensourceway -[4]:http://www.projectatomic.io/blog/2018/04/open-source-what-a-concept/ diff --git a/translated/tech/20180510 Creating small containers with Buildah.md b/translated/tech/20180510 Creating small containers with Buildah.md new file mode 100644 index 0000000000..9e15770d4f --- /dev/null +++ b/translated/tech/20180510 Creating small containers with Buildah.md @@ -0,0 +1,98 @@ +使用 Buildah 创建小体积的容器 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open%20source_collaboration_0.png?itok=YEl_GXbv) +我最近加入了 Red Hat,在这之前我在另外一家科技公司工作了很多年。在我的上一份工作岗位上,我开发了不少不同类型的软件产品,这些产品是成功的,但都有版权保护。不仅法规限制了我们不能在公司外将软件共享,而且我们在公司内部也基本不进行共享。在那时,我觉得这很有道理:公司花费了时间、精力和预算用于开发软件,理应保护并要求软件涉及的利益。 + +时间如梭,去年我加入 Red Hat 并培养出一种完全不同的理念。[Buildah 项目][1]是我最早加入的项目之一,该项目用于构建 OCI (Open Container Initiative) 标准的镜像,特别擅长让你精简已创建镜像的体积。那时 Buildah 还处于非常早期的阶段,包含一些瑕疵,不适合用于生产环境。 + +刚接触项目不久,我做了一些小变更,然后询问公司内部 git 仓库地址,以便提交我做的变更。收到的回答是:没有内部仓库,直接将变更提交到 GitHub 上。这让我感到困惑,将我的变更提交到 GitHub 意味着:任何人都可以查看这部分代码并在他们自己的项目中使用。况且代码还有一些瑕疵,这样做简直有悖常理。但作为一个新人,我只是惊讶地摇了摇头并提交了变更。 + +一年后,我终于相信了开源软件的力量和价值。我仍为 Buildah 项目工作,我们最近遇到的一个主题很形象地说明了这种力量和价值。标题为 [Buildah 镜像体积并不小?][2] 的主题由 Tim Dudgeon (@tdudgeon) 提出。简而言之,他发现使用 Buildah 创建的镜像比使用 Docker 创建的镜像体积更大,而且 Buildah 镜像中并不包含一些额外应用,但 Docker 镜像中却包含它们。 + +为了比较,他首先操作如下: +``` +$ docker pull centos:7 +$ docker images +REPOSITORY            TAG              IMAGE ID                 CREATED             SIZE +docker.io/centos          7                   2d194b392dd1        2 weeks ago         195 MB +``` + +他发现 Docker 镜像的体积为 195MB。Tim 接着使用 Buildah 创建了一个(基于 scratch 的)最小化镜像,仅仅将 `coreutils` 和 `bash` 软件包加入到镜像中,使用的脚本如下: +``` +$ cat  ./buildah-base.sh +#!/bin/bash + +set -x + +# build a minimal image +newcontainer=$(buildah from scratch) +scratchmnt=$(buildah mount $newcontainer) + +# install the packages +yum install --installroot $scratchmnt bash coreutils --releasever 7 --setopt install_weak_deps=false -y +yum clean all -y --installroot $scratchmnt --releasever 7 + +sudo buildah config --cmd /bin/bash $newcontainer + +# set some config info +buildah config --label name=centos-base $newcontainer + +# commit the image +buildah unmount $newcontainer +buildah commit $newcontainer centos-base + +$ sudo ./buildah-base.sh + +$ sudo buildah images +IMAGE ID               IMAGE NAME                                             CREATED AT            SIZE +8379315d3e3e     docker.io/library/centos-base:latest           Mar 25, 2018 17:08   212.1 MB +``` + +Tim 想知道为何 Buildah 镜像体积反而大 17MB,毕竟 `python` 和 `yum` 软件包都没有安装到 Buildah 镜像中,而这些软件已经安装到 Docker 镜像中。这个结果并不符合预期,在 Github 的相关主题中引发了广泛的讨论。 + +不仅 Red Hat 的员工参与了讨论,还有不少公司外人士也加入了讨论,这很有意义。值得一提的是,GitHub 用户 @pixdrift 主导了很多重要的讨论并提出很多发现,他指出在 Buildah 镜像中文档和语言包就占据了比 100MB 略多一点的空间。Pixdrift 建议在 yum 安装器中强制指定语言,据此提出如下修改过的 `buildah-bash.sh` 脚本: +``` +#!/bin/bash + +set -x + +# build a minimal image +newcontainer=$(buildah from scratch) +scratchmnt=$(buildah mount $newcontainer) + +# install the packages +yum install --installroot $scratchmnt bash coreutils --releasever 7 --setopt=install_weak_deps=false --setopt=tsflags=nodocs --setopt=override_install_langs=en_US.utf8 -y +yum clean all -y --installroot $scratchmnt --releasever 7 + +sudo buildah config --cmd /bin/bash $newcontainer + +# set some config info +buildah config --label name=centos-base $newcontainer + +# commit the image +buildah unmount $newcontainer +buildah commit $newcontainer centos-base +``` + +Tim 运行这个新脚本,得到的镜像体积缩减至 92MB,相比之前的 Buildah 镜像体积减少了 120MB,这比较接近我们的预期;然而,c出于工程师的天性,56% 的体积缩减不能让他们满足。讨论继续深入下去,涉及如何移除个人语言包以节省更多空间。如果想了解讨论细节,点击 [Buildah 镜像体积并不小?][2] 链接。说不定你也能给出有帮助的点子,甚至更进一步成为 Buildah 项目的贡献者。这个主题的解决从一个侧面告诉我们,Buildah 软件可以多么快速和容易地创建体积最小化的容器,该容器仅包含你高效运行任务所需的软件。额外的好处是,你无需运行一个守护进程。 + +这个镜像体积缩减的主题让我意识到开源软件的力量。来自不同公司的大量开发者,在一天多的时间内,以开放讨论的形式进行合作解决问题。虽然解决这个具体问题并没有修改已有代码,但 Red Hat 公司外开发者对 Buildah 做了很多代码贡献,进而帮助项目变得更好。这些贡献也吸引了更多人才关注项目代码;如果像之前那样,代码作为版权保护软件的一部分放置在私有 git 仓库中,不会获得上述好处。我只用了一年的时间就转向拥抱 [开源方式][3],而且可能不会再转回去了。 + +文章最初发表于 [Project Atomic][4],已获得转载许可。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/5/containers-buildah + +作者:[Tom Sweeney][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[pinewall](https://github.com/pinewall) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/tomsweeneyredhat +[1]:https://github.com/projectatomic/buildah +[2]:https://github.com/projectatomic/buildah/issues/532 +[3]:https://twitter.com/opensourceway +[4]:http://www.projectatomic.io/blog/2018/04/open-source-what-a-concept/ From 48e8210b0e43045743e036f713c3fb94eed1d03a Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 24 May 2018 17:29:19 +0800 Subject: [PATCH 02/84] =?UTF-8?q?=E9=80=89=E9=A2=98:=20MapTool:=20A=20robu?= =?UTF-8?q?st,=20flexible=20virtual=20tabletop=20for=20RPGs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ust, flexible virtual tabletop for RPGs.md | 216 ++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 sources/tech/20180514 MapTool- A robust, flexible virtual tabletop for RPGs.md diff --git a/sources/tech/20180514 MapTool- A robust, flexible virtual tabletop for RPGs.md b/sources/tech/20180514 MapTool- A robust, flexible virtual tabletop for RPGs.md new file mode 100644 index 0000000000..4786da0b50 --- /dev/null +++ b/sources/tech/20180514 MapTool- A robust, flexible virtual tabletop for RPGs.md @@ -0,0 +1,216 @@ +MapTool: A robust, flexible virtual tabletop for RPGs +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rpg_gaming_maptool.jpg?itok=l7hT-Ohv) + +When I was looking for a virtual tabletop for role-playing games (RPGs), either for local play or for playing on a network with family and friends around the world, I had several criteria. First, I wanted a platform I could use offline while I prepped a campaign. Second, I didn't want something that came with the burden of being a social network. I wanted the equivalent of a [Sword Coast][1] campaign-setting [boxed set][2] that I could put on my digital "shelf" and use when I wanted, how I wanted. + +I looked at it this way: I purchased [AD&D 2nd edition][3] as a hardcover book, so even though there have since been many great releases, I can still play AD&D 2nd edition today. The same goes for my digital life. When I want to use my digital maps and tokens or go back to an old campaign, I want access to them regardless of circumstance. + +![](https://opensource.com/sites/default/files/u128651/fullscreen.jpg) + +### Virtual tabletop + +[MapTool][4] is the flagship product of the RPTools software suite. It's a Java application, so it runs on any operating system that can run Java, which is basically every computer. It's also open source and costs nothing to use, although RPTools accepts [donations][5] if you're so inclined. + +### Installing MapTool + +Download MapTool from [rptools.net][6]. + +It's likely that you already have Java installed; if not, download and install it from [java.net][7]. If you're not sure whether you have it installed or not, you can download MapTool first, try to run it, and install Java if it fails to run. + +### Using MapTool + +If you're a game master (GM), MapTool is a great way to provide strategic maps for battles and exploration without investing in physical maps, tokens, or miniatures. + +MapTool is a full-featured virtual tabletop. You can load maps into it, import custom tokens, track initiative order and health, and save campaigns. You can use it locally at your game table, or you can share your session with remote gamers so they can follow along. There are other virtual tabletops out there, but MapTool is the only one you own, part and parcel. + +To load a map into MapTool, all you need is a PNG or JPEG version of a map. + + 1. Launch MapTool, then go to the **Map** menu and select **New Map**. + 2. In the **Map Properties** window that appears, click the **Map** button. + 3. Click the **Filesystem** button in the bottom-left corner to locate your map graphic on your hard drive. + + + +If you have no digital maps yet, there are dozens of map packs available from [Open Gaming Store][8], so you're sure to find a map regardless of where your adventure path may take you. + +MapTool, like most virtual tabletops, expects a PNG or JPEG. I maintain a simple [Image Magick][9] script to convert maps from PDF to PNG. The script runs on Linux, BSD, or Mac and is probably also easily adapted to PowerShell. +``` +#!/usr/bin/env bash + +#GNU All-Permissive http://www.gnu.org/licenses + + + +CMD=`which convert` || echo "Image Magick not found in PATH." + +ARG=("${@}") + +ARRAYSIZE=${#ARG[*]} + + + +while [ True ]; do + +  for item in "${ARG[@]}"; do + +$CMD "${item}" `basename "${item}" .pdf`.jpg || \ + +$CMD "${item}" `basename "${item}" .PDF`.jpg + +  done + + done + +exit + +``` + +If running code like that scares you, there are plenty of PDF-to-image converters, like [GIMP][10], for manually converting a PDF to PNG or JPEG on an as-needed basis. + +#### Adding tokens + +Now that you have a map loaded, it's time to add player characters (PCs) and non-player characters (NPCs). MapTool ships with a modest selection of token graphics, but you can always create and use your own or download more from the internet. In fact, the RPTools website recently linked to [ImmortalNights][11], a website by artist Devin Night, with over 100 tokens for free and purchase. + + 1. Click the **Tokens** folder icon in the MapTool **Resource Library** panel. + 2. In the panel just beneath the **Resource Library** panel, the default tokens appear. You can add your own tokens using the **Add resources to library** option in the **File** menu. + 3. In the **New token** pop-up dialogue box, give the token a name and PC or NPC designation. + +![](https://opensource.com/sites/default/files/u128651/token.png) + + 4. Once the token is on the map, it should align perfectly with the map grid. If it doesn't, you can adjust the grid. + 5. Right-click on the token to adjust its rotation, size, and other attributes. + + + +#### Adjusting the grid + +By default, MapTool provides an invisible 50x50 square grid over any map. If your map graphic already has a grid on it, you can adjust MapTool's grid to match your graphic. + + 1. Select **Adjust grid** in the **Map** menu. A grid overlay appears over your map. + 2. Click and drag the overlay grid so one overlay square sits inside one of your map graphic's grid squares. + 3. Adjust the **Grid Size** pixel value in the property box in the top-right corner of the MapTool window. + 4. When finished, click the property box's **Close** button. + + + +You can set the default grid size using the **Preferences** selection in the **Edit** menu. For instance, I do this for [Paizo][12] maps on my 96dpi screen. + +MapTool's default assumes each grid block is a five-foot square, but you can adjust that if you're using a wide area representing long-distance travel or if you've drawn a custom map to your own scale. + +### Sharing the screen locally + +While you can use MapTool solely as a GM tool to help keep track of character positions, you can also share it with your players. + +If you're using MapTool as a digital replacement for physical maps at your game table, you can just plug your computer into your TV. That's the simplest way to share the map with everyone at your table. + +Another alternative is to use MapTool's built-in server. If your players are physically sitting in the same room and on the same network, select **Start server** from the **File** menu. + +The only required field is a name for the GM. The default port is 51234. If you don't know what that means, that's OK; a port is just a flag identifying where a service like MapTool is running. + +Once your MapTool server is started, players can connect by selecting **Connect to server** in the **File** menu. + +![](https://opensource.com/sites/default/files/u128651/connect_0.png) + +A name is required, but no password is needed unless the GM has set one when starting the server. + +The IP address is your local IP address, so it starts with either 192.168 or 10. If you don't know your local IP address, you can check it from your computer's networking control panel. On Linux, you can also find it by typing: +``` +$ ip -4 -ts a + +``` + +And on BSD or Mac: +``` +$ ifconfig + +``` + +On Windows, open PowerShell from your **Start** menu and type: +``` +ipconfig + +``` + +![](https://opensource.com/sites/default/files/u128651/powershell.jpg) + +If your players have trouble connecting, there are two likely causes: + + * You forgot to start the server. Start it and have your players try again. + * You have a firewall running on your computer. If you're on your home network, it's safe to deactivate your firewall or to tell it to permit traffic on port 51234. If you're in a public gaming space, you should not lower your firewall, but it's safe to permit traffic on port 51234 as long as you have set a password for your MapTool server. + +![](https://opensource.com/sites/default/files/u128651/connect_0.png) + +### Sharing the screen worldwide + +If you're playing remotely with people all over the world, letting them into your private MapTool server is a little more complex to set up, but you only have to do it once and then you're set. + +#### Router + +The first device that needs to be adjusted is your home router. This is the box you got from your internet service provider. You might also call it your modem. + +Every device is different, so there's no way for me to definitively tell you what you need to click on to adjust your settings. Generally, you access your home router through a web browser. Your router's address is often printed on the bottom of the router and begins with either 192.168 or 10. + +Navigate to the router address and log in with the credentials you were provided when you got your internet service. It's often as simple as `admin` with a numeric password (sometimes this password is printed on the router, too). If you don't know the login, call your internet provider and ask for details. + +Different routers use different terms for the same thing; keywords to look for are **Port forwarding** , **Virtual server** , and **Firewall**. Whatever your router calls it, you want to accept traffic coming to port 51234 of your router and forward that traffic to the same port of your personal computer's IP address. + +![](https://opensource.com/sites/default/files/u128651/router.png) + +If you're confused, search the internet for the term "port forwarding" and your router's brand name. This isn't an uncommon task for PC gamers, so instructions are out there. + +#### Finding your external IP address + +Now you're allowing traffic through the MapTool port, so you need to tell your players where to go. + + 1. Get your worldwide IP address at [icanhazip.com][13]. + 2. Start the MapTool server from the **File** menu. Set a password for safety. + 3. Have players select **Connect to server** from the **File** menu. + 4. In the **Connect to server** window, have players click the **Direct** tab and enter a username, password, and your IP address. + +![](https://opensource.com/sites/default/files/u128651/remote.png) + +### Features a-plenty + +This has been a brief overview of things you can do with MapTool. It has many other features, including an initiative tracker, adjustable tokens visibility (hide treasure and monsters from your players!), impersonation, line-of-sight (conceal hidden doors behind statues or other structures!), and fog of war. + +It can serve just as a digital battle map, or it can be the centerpiece of your tabletop game. + +![](https://opensource.com/sites/default/files/u128651/fog.jpg) + +### Why MapTool? + +Before you comment about them: Yes, there are a few virtual tabletop services online, and some of them are very good. They provide a good supply of games looking for players and players looking for games. If you can't find your fellow gamers locally, online tabletops are a great solution. + +By contrast, some people are not fans of social networking, so we shy away from sites that excitedly "bring people together." I've got friends to game with, and we're happy to build and set up our own infrastructure. We don't need to sign up for yet another site; we don't need to throw our hats into a great big online bucket and register when and how we game. + +Ultimately, I like MapTool because I have it with me whether or not I'm online. I can plan a campaign, populate it with graphics, and set up all my maps in advance without depending on having internet access. It's almost like doing the frontend programming for a video game, knowing that the backend "technology" will all happen in the player's minds on game night. + +If you're looking for a robust and flexible virtual tabletop, try MapTool! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/5/maptool + +作者:[Seth Kenlon][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/seth +[1]:https://en.wikibooks.org/wiki/Dungeons_%26_Dragons/Commercial_settings/Forgotten_Realms/Sword_Coast +[2]:https://en.wikipedia.org/wiki/Dungeons_%26_Dragons_campaign_settings +[3]:https://en.wikipedia.org/wiki/Editions_of_Dungeons_%26_Dragons#Advanced_Dungeons_&_Dragons_2nd_edition +[4]:http://www.rptools.net/toolbox/maptool/ +[5]:http://www.rptools.net/donate/ +[6]:http://www.rptools.net/downloadsw/ +[7]:http://jdk.java.net/8 +[8]:https://www.opengamingstore.com/search?q=map +[9]:http://www.imagemagick.org/script/index.php +[10]:http://gimp.org +[11]:http://immortalnights.com/tokenpage.html +[12]:http://paizo.com/ +[13]:http://icanhazip.com/ From 43e49f418dda3b370c7f36b5281759dd9eedc6f0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 May 2018 17:49:34 +0800 Subject: [PATCH 03/84] PRF:20180328 Build a baby monitor with a Raspberry Pi.md @qhwdw --- ...uild a baby monitor with a Raspberry Pi.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20180328 Build a baby monitor with a Raspberry Pi.md b/translated/tech/20180328 Build a baby monitor with a Raspberry Pi.md index b0a647d958..bad0539ae3 100644 --- a/translated/tech/20180328 Build a baby monitor with a Raspberry Pi.md +++ b/translated/tech/20180328 Build a baby monitor with a Raspberry Pi.md @@ -1,7 +1,10 @@ 使用树莓派构建一个婴儿监视器 ====== +> 比一般的视频监控还要好,这种 DIY 型号还有婴儿房间的自动室温控制功能。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby-chick-egg.png?itok=RcFfqdbA) + 香港很湿热,即便是晚上,许多人为了更舒适,在家里也使用空调。当我的大儿子还是一个小婴儿的时候,他卧室的空调还是需要手动控制的,没有温度自动调节的功能。它的控制器只有开或者关,让空调整个晚上持续运行会导致房间过冷,并且也浪费能源和钱。 我决定使用一个基于 [树莓派][2] 的 [物联网][1] 解决方案去修复这个问题。后来我进一步为它添加了一个[婴儿监视器][3]插件。在这篇文章中,我将解释我是如何做的,它的代码在 [我的 GitHub][4] 页面上。 @@ -10,17 +13,17 @@ 解决我的问题的第一个部分是使用了一个 Orvibo S20 [可通过 WiFi 连接的智能插头][5]和智能手机应用程序。虽然这样可以让我通过远程来控制空调,但是它还是手动处理的,而我希望尝试让它自动化。我在 [Instructables][6] 上找到了一个满足我的需求的项目:他使用树莓派从一个 [AM2302 传感器][7] 上测量附近的温度和湿度,并将它们记录到一个 MySQL 数据库中。 -使用圧接头将温度/湿度传感器连接到树莓派的相应 GPIO 针脚上。幸运的是,AM2302 传感器有一个用于读取的 [开源软件][8],并且同时提供了 [Python][9] 示例。 +使用压接头将温度/湿度传感器连接到树莓派的相应 GPIO 针脚上。幸运的是,AM2302 传感器有一个用于读取的 [开源软件][8],并且同时提供了 [Python][9] 示例。 -与我的项目放在一起的用于 [AM2302 传感器][10] 接口的软件已经更新了,并且我使用的原始代码现在已经被认为是过时的而停止维护了。这个代码是由一个小的二进制组成,用于连接到传感器以及解释阅读和返回正确值的 Python 脚本。 +与我的项目放在一起的用于 [AM2302 传感器][10] 接口的软件已经更新了,并且我使用的原始代码现在应该已经过时了,停止维护了。这个代码是由一个小的二进制组成,用于连接到传感器以及解释读取并返回正确值的 Python 脚本。 ![Raspberry Pi, sensor, and Python code][12] -树莓派、传感器、以及用于构建温度/湿度监视器的 Python 代码。 +*树莓派、传感器、以及用于构建温度/湿度监视器的 Python 代码。* -将传感器连接到树莓派,这些 Python 代码能够正确地返回温度和湿度读数。将 Python 连接到 MySQL 数据库很简单,并且也有大量的使用 `python-``mysql` 绑定的代码示例。因为我需要持续地监视温度和湿度,所以我写软件来实现这些。 +将传感器连接到树莓派,这些 Python 代码能够正确地返回温度和湿度读数。将 Python 连接到 MySQL 数据库很简单,并且也有大量的使用 python-mysql 绑定的代码示例。因为我需要持续地监视温度和湿度,所以我写软件来实现这些。 -事实上,最终我用了两个解决方案,一是作为一个持续运行的进程,周期性(一般是间隔一分钟)地获取传感器数据,另一种是让 Python 脚本运行一次然后退出。我决定使用第二种方法,并使用 cron 去每分钟调用一次这个脚本。之所以选择这种方法的主要原因是,(通过循环实现的)持续的脚本偶尔会不返回读数,这将导致尝试读取传感器的进程出现聚集,最终可能会导致系统挂起而缺乏可用资源。 +事实上,最终我用了两个解决方案,一是作为一个持续运行的进程,周期性(一般是间隔一分钟)地获取传感器数据,另一种是让 Python 脚本运行一次然后退出。我决定使用第二种方法,并使用 cron 去每分钟调用一次这个脚本。之所以选择这种方法的主要原因是,(通过循环实现的)持续的脚本偶尔会不返回读数,这将导致尝试读取传感器的进程出现堆积,最终可能会导致系统挂起而缺乏可用资源。 我也找到了可以用程序来控制我的智能插头的一个 [Perl 脚本][13]。它是解决这种问题所需的一部分,因此当某些温度/湿度达到触发条件,将触发这个 Perl 脚本。在做了一些测试之后,我决定去设计一个独立的 `checking` 脚本,从 MySQL 去拉取最新的数据,然后根据返回的值去设置智能开关为开或关。将插头控制逻辑与传感器读取脚本分开,意味着它们是各自独立运行的,就算是传感器读取脚本写的有问题也没事。 @@ -30,7 +33,7 @@ ![Temperature and humidity chart][16] -过去六小时内测量到的温度和湿度 +*过去六小时内测量到的温度和湿度* ### 添加一个婴儿监视摄像头 @@ -46,7 +49,7 @@ ### 做最后的修饰 -没有哪个树莓派项目都已经完成了还没有为它选择一个合适的外壳,并且它有各种零件。在大量搜索和比较之后,有了一个明确的 [赢家][20]:SmartPi 的乐高积木式外壳。乐高的兼容性可以让我去安装温度/湿度传感器和摄像头。下面是最终的成果图: +没有哪个树莓派项目都已经完成了还没有为它选择一个合适的外壳,并且它有各种零件。在大量搜索和比较之后,有了一个显然的 [赢家][20]:SmartPi 的乐高积木式外壳。乐高的兼容性可以让我去安装温度/湿度传感器和摄像头。下面是最终的成果图: ![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/pibabymonitor_case.png?itok=_ofyN73a) @@ -61,8 +64,6 @@ * 我因此为我的第二个孩子设计了另外一个监视器。 * 因为没有时间去折腾,我为我的第三个孩子购买了夜用摄像头。 - - 想学习更多的东西吗?所有的代码都在 [我的 GitHub][4] 页面上。 想分享你的树莓派项目吗?[将你的故事和创意发送给我们][24]。 @@ -73,7 +74,7 @@ via: https://opensource.com/article/18/3/build-baby-monitor-raspberry-pi 作者:[Jonathan Ervine][a] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4c514cfdd4d5acc5bcf2f00b8d55e6ce5f2c1f78 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 May 2018 17:50:13 +0800 Subject: [PATCH 04/84] PUB:20180328 Build a baby monitor with a Raspberry Pi.md @qhwdw https://linux.cn/article-9677-1.html --- .../20180328 Build a baby monitor with a Raspberry Pi.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180328 Build a baby monitor with a Raspberry Pi.md (100%) diff --git a/translated/tech/20180328 Build a baby monitor with a Raspberry Pi.md b/published/20180328 Build a baby monitor with a Raspberry Pi.md similarity index 100% rename from translated/tech/20180328 Build a baby monitor with a Raspberry Pi.md rename to published/20180328 Build a baby monitor with a Raspberry Pi.md From 76b1e39b1f2ba7298592598e198d22ba5e57bb20 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Thu, 24 May 2018 20:00:19 +0800 Subject: [PATCH 05/84] Update 20180507 4 Firefox extensions to install now.md --- sources/tech/20180507 4 Firefox extensions to install now.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20180507 4 Firefox extensions to install now.md b/sources/tech/20180507 4 Firefox extensions to install now.md index 77032f0345..50acaba725 100644 --- a/sources/tech/20180507 4 Firefox extensions to install now.md +++ b/sources/tech/20180507 4 Firefox extensions to install now.md @@ -1,3 +1,6 @@ +Translating by MjSeven + + 4 Firefox extensions to install now ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna) From d003e2f9f86fd085cd9d73ea0a74df3bd2d6d0a1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 May 2018 08:49:31 +0800 Subject: [PATCH 06/84] translated --- ...17 How to find your IP address in Linux.md | 57 ------------------- ...17 How to find your IP address in Linux.md | 55 ++++++++++++++++++ 2 files changed, 55 insertions(+), 57 deletions(-) delete mode 100644 sources/tech/20180517 How to find your IP address in Linux.md create mode 100644 translated/tech/20180517 How to find your IP address in Linux.md diff --git a/sources/tech/20180517 How to find your IP address in Linux.md b/sources/tech/20180517 How to find your IP address in Linux.md deleted file mode 100644 index ff523101d2..0000000000 --- a/sources/tech/20180517 How to find your IP address in Linux.md +++ /dev/null @@ -1,57 +0,0 @@ -translating---geekpi - -How to find your IP address in Linux -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/satellite_radio_location.jpg?itok=KJUKSB6x) -Internet Protocol (IP) needs no introduction—we all use it daily. Even if you don't use it directly, when you type website-name.com on your web browser, it looks up the IP address of that URL and then loads the website. - -Let's divide IP addresses into two categories: private and public. Private IP addresses are the ones your WiFi box (and company intranet) provide. They are in the range of 10.x.x.x, 172.16.x.x-172.31.x.x, and 192.168.x.x, where x=0 to 255. Public IP addresses, as the name suggests, are "public" and you can reach them from anywhere in the world. Every website has a unique IP address that can be reached by anyone and from anywhere; that is considered a public IP address. - -Furthermore, there are two types of IP addresses: IPv4 and IPv6. - -IPv4 addresses have the format x.x.x.x, where x=0 to 255. There are 2^32 (approximately 4 billion) possible IPv4 addresses. - -IPv6 addresses have a more complex format using hex numbers. The total number of bits is 128, which means there are 2^128—340 undecillion!—possible IPv6 addresses. IPv6 was introduced to tackle the foreseeable exhaustion of IPv4 addresses in the near future. - -As a network engineer, I recommend not sharing your machine’s public IP address with anyone. Your WiFi router has a public IP, which is the WAN (wide-area network) IP address, and it will be the same for any device connected to that WiFi. All the devices connected to the same WiFi have private IP addresses locally identified by the range provided above. For example, my laptop is connected with the IP address 192.168.0.5, and my phone is connected with 192.168.0.8. These are private IP addresses, but both would have the same public IP address. - -The following commands will get you the IP address list to find public IP addresses for your machine: - - 1. `ifconfig.me` - 2. `curl -4/-6 icanhazip.com` - 3. `curl ipinfo.io/ip` - 4. `curl api.ipify.org` - 5. `curl checkip.dyndns.org` - 6. `dig +short myip.opendns.com @resolver1.opendns.com` - 7. `host myip.opendns.com resolver1.opendns.com` - 8. `curl ident.me` - 9. `curl bot.whatismyipaddress.com` - 10. `curl ipecho.net/plain` - - - -The following commands will get you the private IP address of your interfaces: - - 1. `ifconfig -a` - 2. `ip addr (ip a)` - 3. `hostname -I | awk ‘{print $1}’` - 4. `ip route get 1.2.3.4 | awk '{print $7}'` - 5. `(Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen` - 6. `nmcli -p device show` - - - -_Note: Some utilities need to be installed on your system based on the Linux distro you are using. Also, some of the noted commands use a third-party website to get the IP_ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/5/how-find-ip-address-linux - -作者:[Archit Modi][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/architmodi diff --git a/translated/tech/20180517 How to find your IP address in Linux.md b/translated/tech/20180517 How to find your IP address in Linux.md new file mode 100644 index 0000000000..1450fb3c8c --- /dev/null +++ b/translated/tech/20180517 How to find your IP address in Linux.md @@ -0,0 +1,55 @@ +如何在 Linux 中找到你的 IP 地址 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/satellite_radio_location.jpg?itok=KJUKSB6x) +互联网协议(IP)不需要介绍 - 我们每天都在使用它。即使你不直接使用它,当你在浏览器上输入 website-name.com 时,它会查找该 URL 的 IP 地址,然后加载该网站。 + +我们将 IP 地址分为两类:私有和公共。私有 IP 地址是你的无线路由(和公司内网)提供的私有 IP 地址。它们的范围是 10.xxx、172.16.xx-172.31.xx 和 192.168.xx,其中 x=0 到 255。公有 IP 地址,顾名思义,是“公共”的,你可以在世界上任何地方访问它。每个网站都有一个唯一的 IP 地址,任何人可在任何地点访问,这可被视为公共 IP 地址。 + +此外,还有两种类型的 IP 地址:IPv4 和 IPv6。 + +IPv4 地址格式为 x.x.x.x,其中 x=0 到 255。有 2^32(大约 40 亿个)可能的 IPv4 地址。 + +IPv6 地址使用更复杂的十六进制。总的比特数是 128,这意味着有 2^128-340 后面有 36 个零! - 可能的 IPv6 地址。IPv6 已经被引入解决了可预见的 IPv4 地址耗尽问题。 + +作为网络工程师,我建议不要与任何人共享你机器的公有 IP 地址。你的 WiFi 路由器有公共 IP,即 WAN(广域网)IP 地址,并且连接到该 WiFi 的任何设备都是相同的。连接到相同 WiFi 的所有设备都有上面所说的私有 IP 地址。例如,我的笔记本电脑的 IP 地址 192.168.0.5,而我的电话是 192.168.0.8。这些是私有 IP 地址,但两者都有相同的公有 IP 地址。 + +以下命令将列出IP地址列表,以查找你计算机的公有 IP 地址: + + 1. `ifconfig.me` + 2. `curl -4/-6 icanhazip.com` + 3. `curl ipinfo.io/ip` + 4. `curl api.ipify.org` + 5. `curl checkip.dyndns.org` + 6. `dig +short myip.opendns.com @resolver1.opendns.com` + 7. `host myip.opendns.com resolver1.opendns.com` + 8. `curl ident.me` + 9. `curl bot.whatismyipaddress.com` + 10. `curl ipecho.net/plain` + + + +以下命令将为你提供接口的私有 IP 地址: + + 1. `ifconfig -a` + 2. `ip addr (ip a)` + 3. `hostname -I | awk ‘{print $1}’` + 4. `ip route get 1.2.3.4 | awk '{print $7}'` + 5. `(Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen` + 6. `nmcli -p device show` + + + +_注意:一些工具需要根据你正在使用的 Linux 发行版安装在你的系统上。另外,一些提到的命令使用第三方网站来获取 IP_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/5/how-find-ip-address-linux + +作者:[Archit Modi][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/architmodi From 660672f7128e664518dbccf32fe17e5b8b25f827 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 May 2018 08:53:46 +0800 Subject: [PATCH 07/84] translating --- ...80521 Audacity quick tip- quickly remove background noise.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180521 Audacity quick tip- quickly remove background noise.md b/sources/tech/20180521 Audacity quick tip- quickly remove background noise.md index 25ca446a9d..c4943ba7ba 100644 --- a/sources/tech/20180521 Audacity quick tip- quickly remove background noise.md +++ b/sources/tech/20180521 Audacity quick tip- quickly remove background noise.md @@ -1,3 +1,5 @@ +translating---geekpi + Audacity quick tip: quickly remove background noise ====== From 4f2fc63468594b48a71791aada9d88b9d6f97354 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:07:00 +0800 Subject: [PATCH 08/84] =?UTF-8?q?20180525-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...get a core dump for a segfault on Linux.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 sources/tech/20180428 How to get a core dump for a segfault on Linux.md diff --git a/sources/tech/20180428 How to get a core dump for a segfault on Linux.md b/sources/tech/20180428 How to get a core dump for a segfault on Linux.md new file mode 100644 index 0000000000..71a272c5d4 --- /dev/null +++ b/sources/tech/20180428 How to get a core dump for a segfault on Linux.md @@ -0,0 +1,194 @@ +How to get a core dump for a segfault on Linux +============================================================ + +This week at work I spent all week trying to debug a segfault. I’d never done this before, and some of the basic things involved (get a core dump! find the line number that segfaulted!) took me a long time to figure out. So here’s a blog post explaining how to do those things! + +At the end of this blog post, you should know how to go from “oh no my program is segfaulting and I have no idea what is happening” to “well I know what its stack / line number was when it segfaulted at at least!“. + +### what’s a segfault? + +A “segmentation fault” is when your program tries to access memory that it’s not allowed to access, or tries to . This can be caused by: + +* trying to dereference a null pointer (you’re not allowed to access the memory address `0`) + +* trying to dereference some other pointer that isn’t in your memory + +* a C++ vtable pointer that got corrupted and is pointing to the wrong place, which causes the program to try to execute some memory that isn’t executable + +* some other things that I don’t understand, like I think misaligned memory accesses can also segfault + +This “C++ vtable pointer” thing is what was happening to my segfaulting program. I might explain that in a future blog post because I didn’t know any C++ at the beginning of this week and this vtable lookup thing was a new way for a program to segfault that I didn’t know about. + +But! This blog post isn’t about C++ bugs. Let’s talk about the basics, like, how do we even get a core dump? + +### step 1: run valgrind + +I found the easiest way to figure out why my program is segfaulting was to use valgrind: I ran + +``` +valgrind -v your-program + +``` + +and this gave me a stack trace of what happened. Neat! + +But I wanted also wanted to do a more in-depth investigation and find out more than just what valgrind was telling me! So I wanted to get a core dump and explore it. + +### How to get a core dump + +A core dump is a copy of your program’s memory, and it’s useful when you’re trying to debug what went wrong with your problematic program. + +When your program segfaults, the Linux kernel will sometimes write a core dump to disk. When I originally tried to get a core dump, I was pretty frustrated for a long time because – Linux wasn’t writing a core dump!! Where was my core dump???? + +Here’s what I ended up doing: + +1. Run `ulimit -c unlimited` before starting my program + +2. Run `sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t` + +### ulimit: set the max size of a core dump + +`ulimit -c` sets the maximum size of a core dump. It’s often set to 0, which means that the kernel won’t write core dumps at all. It’s in kilobytes. ulimits are per process – you can see a process’s limits by running `cat /proc/PID/limit` + +For example these are the limits for a random Firefox process on my system: + +``` +$ cat /proc/6309/limits +Limit Soft Limit Hard Limit Units +Max cpu time unlimited unlimited seconds +Max file size unlimited unlimited bytes +Max data size unlimited unlimited bytes +Max stack size 8388608 unlimited bytes +Max core file size 0 unlimited bytes +Max resident set unlimited unlimited bytes +Max processes 30571 30571 processes +Max open files 1024 1048576 files +Max locked memory 65536 65536 bytes +Max address space unlimited unlimited bytes +Max file locks unlimited unlimited locks +Max pending signals 30571 30571 signals +Max msgqueue size 819200 819200 bytes +Max nice priority 0 0 +Max realtime priority 0 0 +Max realtime timeout unlimited unlimited us + +``` + +The kernel uses the soft limit (in this case, “max core file size = 0”) when deciding how big of a core file to write. You can increase the soft limit up to the hard limit using the `ulimit` shell builtin (`ulimit -c unlimited`!) + +### kernel.core_pattern: where core dumps are written + +`kernel.core_pattern` is a kernel parameter or a “sysctl setting” that controls where the Linux kernel writes core dumps to disk. + +Kernel parameters are a way to set global settings on your system. You can get a list of every kernel parameter by running `sysctl -a`, or use `sysctl kernel.core_pattern` to look at the `kernel.core_pattern` setting specifically. + +So `sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t` will write core dumps to `/tmp/core-` + +If you want to know more about what these `%e`, `%p` parameters read, see [man core][1]. + +It’s important to know that `kernel.core_pattern` is a global settings – it’s good to be a little careful about changing it because it’s possible that other systems depend on it being set a certain way. + +### kernel.core_pattern & Ubuntu + +By default on Ubuntu systems, this is what `kernel.core_pattern` is set to + +``` +$ sysctl kernel.core_pattern +kernel.core_pattern = |/usr/share/apport/apport %p %s %c %d %P + +``` + +This caused me a lot of confusion (what is this apport thing and what is it doing with my core dumps??) so here’s what I learned about this: + +* Ubuntu uses a system called “apport” to report crashes in apt packages + +* Setting `kernel.core_pattern=|/usr/share/apport/apport %p %s %c %d %P`means that core dumps will be piped to `apport` + +* apport has logs in /var/log/apport.log + +* apport by default will ignore crashes from binaries that aren’t part of an Ubuntu packages + +I ended up just overriding this Apport business and setting `kernel.core_pattern` to `sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t` because I was on a dev machine, I didn’t care whether Apport was working on not, and I didn’t feel like trying to convince Apport to give me my core dumps. + +### So you have a core dump. Now what? + +Okay, now we know about ulimits and `kernel.core_pattern` and you have actually have a core dump file on disk in `/tmp`. Amazing! Now what??? We still don’t know why the program segfaulted! + +The next step is to open the core file with `gdb` and get a backtrace. + +### Getting a backtrace from gdb + +You can open a core file with gdb like this: + +``` +$ gdb -c my_core_file + +``` + +Next, we want to know what the stack was when the program crashed. Running `bt` at the gdb prompt will give you a backtrace. In my case gdb hadn’t loaded symbols for the binary, so it was just like `??????`. Luckily, loading symbols fixed it. + +Here’s how to load debugging symbols. + +``` +symbol-file /path/to/my/binary +sharedlibrary + +``` + +This loads symbols from the binary and from any shared libraries the binary uses. Once I did that, gdb gave me a beautiful stack trace with line numbers when I ran `bt`!!! + +If you want this to work, the binary should be compiled with debugging symbols. Having line numbers in your stack traces is extremely helpful when trying to figure out why a program crashed :) + +### look at the stack for every thread + +Here’s how to get the stack for every thread in gdb! + +``` +thread apply all bt full + +``` + +### gdb + core dumps = amazing + +If you have a core dump & debugging symbols and gdb, you are in an amazing situation!! You can go up and down the call stack, print out variables, and poke around in memory to see what happened. It’s the best. + +If you are still working on being a gdb wizard, you can also just print out the stack trace with `bt` and that’s okay :) + +### ASAN + +Another path to figuring out your segfault is to do one compile the program with AddressSanitizer (“ASAN”) (`$CC -fsanitize=address`) and run it. I’m not going to discuss that in this post because this is already pretty long and anyway in my case the segfault disappeared with ASAN turned on for some reason, possibly because the ASAN build used a different memory allocator (system malloc instead of tcmalloc). + +I might write about ASAN more in the future if I ever get it to work :) + +### getting a stack trace from a core dump is pretty approachable! + +This blog post sounds like a lot and I was pretty confused when I was doing it but really there aren’t all that many steps to getting a stack trace out of a segfaulting program: + +1. try valgrind + +if that doesn’t work, or if you want to have a core dump to investigate: + +1. make sure the binary is compiled with debugging symbols + +2. set `ulimit` and `kernel.core_pattern` correctly + +3. run the program + +4. open your core dump with `gdb`, load the symbols, and run `bt` + +5. try to figure out what happened!! + +I was able using gdb to figure out that there was a C++ vtable entry that is pointing to some corrupt memory, which was somewhat helpful and helped me feel like I understood C++ a bit better. Maybe we’ll talk more about how to use gdb to figure things out another day! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/04/28/debugging-a-segfault-on-linux/ + +作者:[Julia Evans ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://jvns.ca/about/ +[1]:http://man7.org/linux/man-pages/man5/core.5.html From 1c02a0ff1c65535443eb4b9a0c8f93ee8a695a69 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:14:10 +0800 Subject: [PATCH 09/84] =?UTF-8?q?20180525-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0205 Writing eBPF tracing tools in Rust.md | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 sources/tech/20180205 Writing eBPF tracing tools in Rust.md diff --git a/sources/tech/20180205 Writing eBPF tracing tools in Rust.md b/sources/tech/20180205 Writing eBPF tracing tools in Rust.md new file mode 100644 index 0000000000..18b8eb5742 --- /dev/null +++ b/sources/tech/20180205 Writing eBPF tracing tools in Rust.md @@ -0,0 +1,258 @@ +Writing eBPF tracing tools in Rust +============================================================ + +tl;dr: I made an experimental Rust repository that lets you write BPF tracing tools from Rust! It’s at [https://github.com/jvns/rust-bcc][4] or [https://crates.io/crates/bcc][5], and has a couple of hopefully easy to understand examples. It turns out that writing BPF-based tracing tools in Rust is really easy (in some ways easier than doing the same things in Python). In this post I’ll explain why I think this is useful/important. + +For a long time I’ve been interested in the [BPF compiler collection][6], a C -> BPF compiler, C library, and Python bindings to make it easy to write tools like: + +* [opensnoop][1] (spies on which files are being opened) + +* [tcplife][2] (track length of TCP connections) + +* [cpudist][3] (count how much time every program spends on- and off-CPU) + +and a lot more. The list of available tools in [the /tools directory][7] is really impressive and I could write a whole blog post about that. If you’re familiar with dtrace – the idea is that BCC is a little bit like dtrace, and in fact there’s a dtrace-like language [named ply][8] implemented with BPF. + +This blog post isn’t about `ply` or the great BCC tools though – it’s about what tools we need to build more complicated/powerful BPF-based programs. + +### What does the BPF compiler collection let you do? + +Here’s a quick overview of what BCC lets you do: + +* compile BPF programs from C into eBPF bytecode. + +* attach this eBPF bytecode to a userspace function or kernel function (as a “uprobe” / “kprobe”) or install it as XDP + +* communicate with the eBPF bytecode to get information with it + +A basic example of using BCC is this [strlen_count.py][9] program and I think it’s useful to look at this program to understand how BCC works and how you might be able to implement more advanced tools. + +First, there’s an eBPF program. This program is going to be attached to the `strlen` function from libc (the C standard library) – every time we call `strlen`, this code will be run. + +This eBPF program + +* gets the first argument to the `strlen` function (the address of a string) + +* reads the first 80 characters of that string (using `bpf_probe_read`) + +* increments a counter in a hashmap (basically `counts[str] += 1`) + +The result is that you can count every call to `strlen`. Here’s the eBPF program: + +``` +struct key_t { + char c[80]; +}; +BPF_HASH(counts, struct key_t); +int count(struct pt_regs *ctx) { + if (!PT_REGS_PARM1(ctx)) + return 0; + struct key_t key = {}; + u64 zero = 0, *val; + bpf_probe_read(&key.c, sizeof(key.c), (void *)PT_REGS_PARM1(ctx)); + val = counts.lookup_or_init(&key, &zero); + (*val)++; + return 0; +}; + +``` + +After that program is compiled, there’s a Python part which does `b.attach_uprobe(name="c", sym="strlen", fn_name="count")` – it tells the Linux kernel to actually attach the compiled BPF to the `strlen` function so that it runs every time `strlen` runs. + +The really exciting thing about eBPF is what comes next – there’s no use keeping a hashmap of string counts if you can’t access it! BPF has a number of data structures that let you share information between BPF programs (that run in the kernel / in uprobes) and userspace. + +So in this case the Python program accesses this `counts` data structure. + +### BPF data structures: hashmaps, buffers, and more! + +There’s a great list of available BPF data structures in the [BCC reference guide][10]. + +There are basically 2 kinds of BPF data structures – data structures suitable for storing statistics (BPF_HASH, BPF_HISTOGRAM etc), and data structures suitable for storing events (like BPF_PERF_MAP) where you send a stream of events to a userspace program which then displays them somehow. + +There are a lot of interesting BPF data structures (like a trie!) and I haven’t fully worked out what all of the possibilities are with them yet :) + +### What I’m interested in: BPF for profiling & tracing + +Okay!! We’re done with the background, let’s talk about why I’m interested in BCC/BPF right now. + +I’m interested in using BPF to implement profiling/tracing tools for dynamic programming languages, specifically tools to do things like “trace all memory allocations in this Ruby program”. I think it’s exciting that you can say “hey, run this tiny bit of code every time a Ruby object is allocated” and get data back about ongoing allocations! + +### Rust: a way to build more powerful BPF-based tools + +The issue I see with the Python BPF libraries (which are GREAT, of course) is that while they’re perfect for building tools like `tcplife` which track tcp connnection lengths, once you want to start doing more complicated experiments like “stream every memory allocation from this Ruby program, calculate some metadata about it, query the original process to find out the class name for that address, and display a useful summary”, Python doesn’t really cut it. + +So I decided to spend 4 days trying to build a BCC library for Rust that lets you attach + interact with BPF programs from Rust! + +Basically I worked on porting [https://github.com/iovisor/gobpf][11] (a go BCC library) to Rust. + +The easiest and most exciting way to explain this is to show an example of what using the library looks like. + +### Rust example 1: strlen + +Let’s start with the strlen example from above. Here’s [strlen.rs][12] from the examples! + +Compiling & attaching the `strlen` code is easy: + +``` +let mut module = BPF::new(code)?; +let uprobe_code = module.load_uprobe("count")?; +module.attach_uprobe("/lib/x86_64-linux-gnu/libc.so.6", "strlen", uprobe_code, -1 /* all PIDs */)?; +let table = module.table("counts"); + +``` + +This table contains a hashmap mapping strings to counts. So we need to iterate over that table and print out the keys and values. This is pretty simple: it looks like this. + +``` +let iter = table.into_iter(); +for e in iter { + // key and value are each a Vec so we need to transform them into a string and + // a u64 respectively + let key = get_string(&e.key); + let value = Cursor::new(e.value).read_u64::().unwrap(); + println!("{:?} {:?}", key, value); +} + +``` + +Basically all the data that comes out of a BPF program is an opaque `Vec`right now, so you need to figure out how to decode them yourself. Luckily decoding binary data is something that Rust is quite good at – the `byteorder`crate lets you easily decode `u64`s, and translating a vector of bytes into a String is easy (I wrote a quick `get_string` helper function to do that). + +I thought this was really nice because the code for this program in Rust is basically exactly the same as the corresponding Python version. So it very pretty approachable to start doing experiments and seeing what’s possible. + +### Reading perf events from Rust + +The next thing I wanted to do after getting this `strlen` example to work in rust was to handle events!! + +Events are a little different / more complicated. The way you stream events in a BCC program is – it uses `perf_event_open` to create a ring buffer where the events get stored. + +Dealing with events from a perf ring buffer normally is a huge pain because perf has this complicated data structure. The C BCC library makes this easier for you by letting you specify a C callback that gets called on every new event, and it handles dealing with perf. This is super helpful. To make this work with Rust, the `rust-bcc` library lets you pass in a Rust closure to run on every event. + +### Rust example 2: opensnoop.rs (events!!) + +To make sure reading BPF events actually worked, I implemented a basic version of `opensnoop.py` from the iovisor bcc tools: [opensnoop.rs][13]. + +I won’t walk through the [C code][14] in this case because there’s a lot of it but basically the eBPF C part generates an event every time a file is opened on the system. I copied the C code verbatim from [opensnoop.py][15]. + +Here’s the type of the event that’s generated by the BPF code: + +``` +#[repr(C)] +struct data_t { + id: u64, // pid + thread id + ts: u64, + ret: libc::c_int, + comm: [u8; 16], // process name + fname: [u8; 255], // filename +} + +``` + +The Rust part starts out by compiling BPF code & attaching kprobes (to the `open`system call in the kernel, `do_sys_open`). I won’t paste that code here because it’s basically the same as the `strlen` example. What happens next is the new part: we install a callback with a Rust closure on the `events` table, and then call `perf_map.poll(200)` in a loop. The design of the BCC library is a little confusing to me still, but you need to repeatedly poll the perf reader objects to make sure that the callbacks you installed actually get called. + +``` +let table = module.table("events"); +let mut perf_map = init_perf_map(table, perf_data_callback)?; +loop { + perf_map.poll(200); +} + +``` + +This is the callback code I wrote, that gets called every time. Again, it takes an opaque `Vec` event and translates it into a `data_t` struct to print it out. Doing this is kind of annoying (I actually called `libc::memcpy` which is Not Encouraged Rust Practice), I need to figure out a less gross/unsafe way to do that. The really nice thing is that if you put `#[repr(C)]` on your Rust structs it represents them in memory the exact same way C will represent that struct. So it’s quite easy to share data structures between Rust and C. + +``` +fn perf_data_callback() -> Box)> { + Box::new(|x| { + // This callback + let data = parse_struct(&x); + println!("{:-7} {:-16} {}", data.id >> 32, get_string(&data.comm), get_string(&data.fname)); + }) +} + +``` + +You might notice that this is actually a weird function that returns a callback – this is because I needed to install 4 callbacks (1 per CPU), and in stable Rust you can’t copy closures yet. + +output + +Here’s what the output of that `opensnoop` program looks like! + +This is kind of meta – these are the files that were being opened on my system when I saved this blog post :). You can see that git is looking at some files, vim is saving a file, and my static site generator Hugo is opening the changed file so that it can update the site. Neat! + +``` +PID COMMAND FILENAME + 8519 git /home/bork/work/homepage/.gitmodules + 8519 git /home/bork/.gitconfig + 8519 git .git/config + 22877 vim content/post/2018-02-05-writing-ebpf-programs-in-rust.markdown + 22877 vim . + 7312 hugo /home/bork/work/homepage/content/post/2018-02-05-writing-ebpf-programs-in-rust.markdown + 7312 hugo /home/bork/work/homepage/content/post/2018-02-05-writing-ebpf-programs-in-rust.markdown + +``` + +### using rust-bcc to implement Ruby experiments + +Now that I have this basic library that I can use I can get counts + stream events in Rust, I’m excited about doing some experiments with making BCC programs in Rust that talk to Ruby programs! + +The first experiment (that I blogged about last week) is [count-ruby-allocs.rs][16]which prints out a live count of current allocation activity. Here’s an example of what it prints out: (the numbers are counts of the number of objects allocated of that type so far). + +``` + RuboCop::Token 53 + RuboCop::Token 112 + MatchData 246 +Parser::Source::Rang 255 + Proc 323 + Enumerator 328 + Hash 475 + Range 1210 + ??? 1543 + String 3410 + Array 7879 +Total allocations since we started counting: 16932 +Allocations this second: 954 + +``` + +### Related work + +Geoffrey Couprie is interested in building more advanced BPF tracing tools with Rust too and wrote a great blog post with a cool proof of concept: [Compiling to eBPF from Rust][17]. + +I think the idea of not requiring the user to compile the BPF program is exciting, because you could imagine distributing a statically linked Rust binary (which links in libcc.so) with a pre-compiled BPF program that the binary just installs and then uses to do cool stuff. + +Also there’s another Rust BCC library at [https://bitbucket.org/photoszzt/rust-bpf/][18] at which has a slightly different set of capabilities than [jvns/rust-bcc][19] (going to spend some time looking at that one later, I just found about it like 30 minutes ago :)). + +### that’s it for now + +This crate is still extremely sketchy and there are bugs & missing features but I wanted to put it on the internet because I think the examples of what you can do with it are really exciting!! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/02/05/rust-bcc/ + +作者:[Julia Evans ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://jvns.ca/about/ +[1]:https://github.com/iovisor/bcc/blob/master/tools/opensnoop.py +[2]:https://github.com/iovisor/bcc/blob/master/tools/tcplife.py +[3]:https://github.com/iovisor/bcc/blob/master/tools/cpudist.py +[4]:https://github.com/jvns/rust-bcc +[5]:https://crates.io/crates/bcc +[6]:https://github.com/iovisor/bcc +[7]:https://github.com/iovisor/bcc/tree/master/tools +[8]:https://github.com/iovisor/ply +[9]:https://github.com/iovisor/bcc/blob/master/examples/tracing/strlen_count.py +[10]:https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#maps +[11]:https://github.com/iovisor/gobpf +[12]:https://github.com/jvns/rust-bcc/blob/f15d2983ddbe349aac3d2fcaeacf924a66db4be7/examples/strlen.rs +[13]:https://github.com/jvns/rust-bcc/blob/f15d2983ddbe349aac3d2fcaeacf924a66db4be7/examples/opensnoop.rs +[14]:https://github.com/jvns/rust-bcc/blob/f15d2983ddbe349aac3d2fcaeacf924a66db4be7/examples/opensnoop.c +[15]:https://github.com/iovisor/bcc/blob/master/tools/opensnoop.py +[16]:https://github.com/jvns/ruby-mem-watcher-demo/blob/dd189b178a2813e6445063f0f84063e6e978ee79/src/bin/count-ruby-allocs.rs +[17]:https://unhandledexpression.com/2018/02/02/poc-compiling-to-ebpf-from-rust/ +[18]:https://bitbucket.org/photoszzt/rust-bpf/ +[19]:https://github.com/jvns/rust-bcc From 8f6cda8552a240a997472ee955bdb071dce61df8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 May 2018 09:16:31 +0800 Subject: [PATCH 10/84] PRF:20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md @pinewall --- ...der To Download Media From 80- Websites.md | 79 ++++++++++--------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/translated/tech/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md b/translated/tech/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md index 089169c66b..d17282260a 100644 --- a/translated/tech/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md +++ b/translated/tech/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md @@ -1,11 +1,11 @@ -You-Get - 支持 80+ 网站的命令行多媒体下载器 +You-Get:支持 80 多个网站的命令行多媒体下载器 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/05/you-get-1-720x340.jpg) -你们大多数人可能用过或听说过 **Youtube-dl**,这个命令行程序可以从包括 Youtube 在内的 100+ 网站下载视频。我偶然发现了一个类似的工具,名字叫做 **"You-Get"**。这是一个 Python 编写的命令行下载器,可以让你从 Youtube,Facebook,Twitter 等很多热门网站下载图片,音频和视频。目前该下载器支持 80+ 站点,点击[**这里**][1]查看所有支持的网站。 +你们大多数人可能用过或听说过 **Youtube-dl**,这个命令行程序可以从包括 Youtube 在内的 100+ 网站下载视频。我偶然发现了一个类似的工具,名字叫做 **You-Get**。这是一个 Python 编写的命令行下载器,可以让你从 Youtube、Facebook、Twitter 等很多热门网站下载图片,音频和视频(LCTT 译注:首先,它们得是存在的网站)。目前该下载器支持 80+ 站点,点击[这里][1]查看所有支持的网站。 -You-Get 不仅仅是一个下载器,它还可以将在线视频导流至你的视频播放器。更进一步,它还允许你在 Google 上搜索视频,只要给出搜索项,You-Get 使用 Google 搜索并下载相关度最高的视频。另外值得一提的特性是,它允许你暂停和恢复下载过程。它是一个完全自由、开源及跨平台的应用,适用于 Linux,MacOS 及 Windows。 +You-Get 不仅仅是一个下载器,它还可以将在线视频导流至你的视频播放器。更进一步,它还允许你在 Google 上搜索视频,只要给出搜索项,You-Get 使用 Google 搜索并下载相关度最高的视频。另外值得一提的特性是,它允许你暂停和恢复下载过程。它是一个完全自由、开源及跨平台的应用,适用于 Linux、MacOS 及 Windows。 ### 安装 You-Get @@ -17,35 +17,36 @@ You-Get 不仅仅是一个下载器,它还可以将在线视频导流至你的 有多种方式安装 You-Get,其中官方推荐采用 pip 包管理器安装。如果你还没有安装 pip,可以参考如下链接: -[如何使用 pip 管理 Python 软件包][2] +- [如何使用 pip 管理 Python 软件包][2] -需要注意的是,你需要安装 Python 3 版本的 pip。 +需要注意的是,你需要安装 Python 3 版本的 `pip`。 接下来,运行如下命令安装 You-Get: + ``` $ pip3 install you-get - ``` 可以使用命令升级 You-Get 至最新版本: + ``` $ pip3 install --upgrade you-get - ``` ### 开始使用 You-Get 使用方式与 Youtube-dl 工具基本一致。 -**下载视频** +#### 下载视频 下载视频,只需运行: + ``` $ you-get https://www.youtube.com/watch?v=HXaglTFJLMc - ``` 输出示例: + ``` site: YouTube title: The Last of The Mohicans by Alexandro Querevalú @@ -58,22 +59,22 @@ stream: Downloading The Last of The Mohicans by Alexandro Querevalú.mp4 ... 100% ( 56.9/ 56.9MB) ├███████████████████████████████████████████████████████┤[1/1] 752 kB/s - ``` -下载视频前,你可能希望查看视频的细节信息。You-Get 提供了 **“–info”** 或 **“-i”** 参数,使用该参数可以获得给定视频所有可用的分辨率和格式。 +下载视频前,你可能希望查看视频的细节信息。You-Get 提供了 `–info` 或 `-i` 参数,使用该参数可以获得给定视频所有可用的分辨率和格式。 + ``` $ you-get -i https://www.youtube.com/watch?v=HXaglTFJLMc - ``` 或者 + ``` $ you-get --info https://www.youtube.com/watch?v=HXaglTFJLMc - ``` 输出示例如下: + ``` site: YouTube title: The Last of The Mohicans by Alexandro Querevalú @@ -121,18 +122,18 @@ streams: # Available quality and codecs quality: hd720 size: 56.9 MiB (59654303 bytes) # download-with: you-get --itag=22 [URL] - ``` -默认情况下,You-Get 会下载标记为 **DEFAULT** 的格式。如果你对格式或分辨率不满意,可以选择你喜欢的格式,使用格式对应的 itag 值即可。 +默认情况下,You-Get 会下载标记为 “DEFAULT” 的格式。如果你对格式或分辨率不满意,可以选择你喜欢的格式,使用格式对应的 itag 值即可。 + ``` $ you-get --itag=244 https://www.youtube.com/watch?v=HXaglTFJLMc - ``` -**下载音频** +#### 下载音频 执行下面的命令,可以从 soundcloud 网站下载音频: + ``` $ you-get 'https://soundcloud.com/uiceheidd/all-girls-are-same-999-prod-nick-mira' Site: SoundCloud.com @@ -145,30 +146,30 @@ Downloading ALL GIRLS ARE THE SAME (PROD. NICK MIRA).mp3 ... ``` -查看音频文件细节,使用 **-i** 参数: +查看音频文件细节,使用 `-i` 参数: + ``` $ you-get -i 'https://soundcloud.com/uiceheidd/all-girls-are-same-999-prod-nick-mira' - ``` -**下载图片** +#### 下载图片 运行如下命令下载图片: + ``` $ you-get https://pixabay.com/en/mountain-crumpled-cyanus-montanus-3393209/ - ``` You-Get 也可以下载网页中的全部图片: -You-Get can also download all images from a web page. + ``` $ you-get https://www.ostechnix.com/pacvim-a-cli-game-to-learn-vim-commands/ - ``` -**搜索视频** +#### 搜索视频 + +你只需向 You-Get 传递一个任意的搜索项,而无需给出有效的 URL;You-Get 会使用 Google 搜索并下载与你给出搜索项最相关的视频。(LCTT 译注:Google 的机器人检测机制可能导致 503 报错导致该功能无法使用)。 -你只需向 You-Get 传递一个任意的搜索项,而无需给出有效的 URL;You-Get 会使用 Google 搜索并下载与你给出搜索项最相关的视频。(译者注:Google 的机器人检测机制可能导致 503 报错导致该功能无法使用)。 ``` $ you-get 'Micheal Jackson' Google Videos search: @@ -184,53 +185,53 @@ stream: Downloading Michael Jackson - Beat It (Official Video).webm ... 100% ( 29.4/ 29.4MB) ├███████████████████████████████████████████████████████┤[1/1] 2 MB/s - ``` -**观看视频** +#### 观看视频 + +You-Get 可以将在线视频导流至你的视频播放器或浏览器,跳过广告和评论部分。(LCTT 译注:使用 `-p` 参数需要对应的 vlc/chrominum 命令可以调用,一般适用于具有图形化界面的操作系统)。 -You-Get 可以将在线视频导流至你的视频播放器或浏览器,跳过广告和评论部分。(译者注:使用 -p 参数需要对应的 vlc/chrominum 命令可以调用,一般适用于具有图形化界面的操作系统)。 以 VLC 视频播放器为例,使用如下命令在其中观看视频: + ``` $ you-get -p vlc https://www.youtube.com/watch?v=HXaglTFJLMc - ``` 或者 + ``` $ you-get --player vlc https://www.youtube.com/watch?v=HXaglTFJLMc - ``` 类似地,将视频导流至以 chromium 为例的浏览器中,使用如下命令: + ``` $ you-get -p chromium https://www.youtube.com/watch?v=HXaglTFJLMc - ``` ![][3] 在上述屏幕截图中,可以看到并没有广告和评论部分,只是一个包含视频的简单页面。 -**设置下载视频的路径及文件名** +#### 设置下载视频的路径及文件名 + +默认情况下,使用视频标题作为默认文件名,下载至当前工作目录。当然,你可以按照你的喜好进行更改,使用 `–output-dir` 或 `-o` 参数可以指定路径,使用 `–output-filename` 或 `-O` 参数可以指定下载文件的文件名。 -默认情况下,使用视频标题作为默认文件名,下载至当前工作目录。当然,你可以按照你的喜好进行更改,使用 **–output-dir/-o** 参数可以指定路径,使用 **–output-filename/-O** 参数可以指定下载文件的文件名。 ``` $ you-get -o ~/Videos -O output.mp4 https://www.youtube.com/watch?v=HXaglTFJLMc - ``` -**暂停和恢复下载** +#### 暂停和恢复下载 -按 **CTRL+C** 可以取消下载。一个以 **.download** 为扩展名的临时文件会保存至输出路径。下次你使用相同的参数下载时,下载过程将延续上一次的过程。 +按 `CTRL+C` 可以取消下载。一个以 `.download` 为扩展名的临时文件会保存至输出路径。下次你使用相同的参数下载时,下载过程将延续上一次的过程。 -当文件下载完成后,以 .download 为扩展名的临时文件会自动消失。如果这时你使用同样参数下载,You-Get 会跳过下载;如果你想强制重新下载,可以使用 **–force/-f** 参数。 +当文件下载完成后,以 `.download` 为扩展名的临时文件会自动消失。如果这时你使用同样参数下载,You-Get 会跳过下载;如果你想强制重新下载,可以使用 `–force` 或 `-f` 参数。 查看命令的帮助部分可以获取更多细节,命令如下: + ``` $ you-get --help - ``` 这次的分享到此结束,后续还会介绍更多的优秀工具,敬请期待! @@ -246,7 +247,7 @@ via: https://www.ostechnix.com/you-get-a-cli-downloader-to-download-media-from-8 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[pinewall](https://github.com/pinewall) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 35bb8974db3465af30c41e2df687d2bd08d5e43f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 May 2018 09:16:55 +0800 Subject: [PATCH 11/84] PUB:20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md @pinewall https://linux.cn/article-9678-1.html --- ...-Get - A CLI Downloader To Download Media From 80- Websites.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md (100%) diff --git a/translated/tech/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md b/published/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md similarity index 100% rename from translated/tech/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md rename to published/20180516 You-Get - A CLI Downloader To Download Media From 80- Websites.md From 72b1618cddcc3d26089fb0f94e058535b710422a Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:17:08 +0800 Subject: [PATCH 12/84] =?UTF-8?q?20180525-3=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w to Enable Click to Minimize On Ubuntu.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20180522 How to Enable Click to Minimize On Ubuntu.md diff --git a/sources/tech/20180522 How to Enable Click to Minimize On Ubuntu.md b/sources/tech/20180522 How to Enable Click to Minimize On Ubuntu.md new file mode 100644 index 0000000000..50d68ad445 --- /dev/null +++ b/sources/tech/20180522 How to Enable Click to Minimize On Ubuntu.md @@ -0,0 +1,102 @@ +How to Enable Click to Minimize On Ubuntu +============================================================ + + + _Brief: This quick tutorial shows you how to enable click to minimize option on Ubuntu 18.04 and Ubuntu 16.04._ + +The launcher at the left hand side in [Ubuntu][7] is a handy tool for quickly accessing applications. When you click on an icon in the launcher, the application window appears in focus. + +If you click again on the icon of an application already in focus, the default behavior is to do nothing. This may bother you if you expect the application window to be minimized on the second click. + +Perhaps this GIF will be better in explaining the click on minimize behavior on Ubuntu. + +[video](https://giphy.com/gifs/linux-ubuntu-itsfoss-52FlrSIMxnZ1qq9koP?utm_source=iframe&utm_medium=embed&utm_campaign=Embeds&utm_term=https%3A%2F%2Fitsfoss.com%2Fclick-to-minimize-ubuntu%2F%3Futm_source%3Dnewsletter&%3Butm_medium=email&%3Butm_campaign=new_linux_laptop_ubuntu_1804_flavor_reviews_meltdown_20_and_other_linux_stuff&%3Butm_term=2018-05-23) + +In my opinion, this should be the default behavior but apparently Ubuntu doesn’t think so. So what? Customization is one of the main reason [why I use Linux][8] and this behavior can also be easily changed. + +In this quick tutorial, I’ll show you how to enable click to minimize on Ubuntu 18.04 and 16.04\. I’ll show both command line and the GUI methods here. + + +### Enable click to minimize on Ubuntu using command line (recommended) + + _This method is for Ubuntu 18.04 and 17.10 users with [GNOME desktop environment][1]_ . + +The first option is using the terminal. I recommend this way to ‘minimize on click’ even if you are not comfortable with the command line. + +It’s not at all complicated. Open a terminal using Ctrl+Alt+T shortcut or searching for it in the menu. All you need is to copy paste the command below in the terminal. + +``` +gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize' +``` + +No need of restarting your system or any thing of that sort. You can test the minimize on click behavior immediately after it. + +If you do not like ‘click to minimize’ behavior, you can set it back to default using the command below: + +``` +gsettings reset org.gnome.shell.extensions.dash-to-dock click-action +``` + +### Enable click to minimize on Ubuntu using GUI tool + +You can do the same steps mentioned above using a GUI tool called [Dconf Editor][10]. It is a powerful tool that allows you to change many hidden aspects of your Linux desktop. I avoid recommending it because one wrong click here and there may screw up your desktop settings. So be careful while using this tool keeping in mind that it works on single click and changes are applied immediately. + +You can find and install Dconf Editor in the Ubuntu Software Center. + +![dconf editor in Ubuntu software center](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/dconf-editor-ubuntu-800x250.png) + +Once installed, launch Dconf Editor and go to org -> gnome -> shell -> extensions -> dash-to-dock. Scroll down a bit until you find click-action. Click on it to access the click action settings. + +In here, turn off the Use default value option and change the Custom Valueto ‘minimize’. + +![Enable minmize to click on Ubuntu using dconf editor](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/enable-minimize-click-dconf-800x425.png) + +You can see that the minimize on click behavior has been applied instantly. + +### Enable click to minimize on Ubuntu 16.04 Unity + +If you are using Unity desktop environment, you can easily d it using Unity Tweak Tool. If you have not installed it already, look for Unity Tweak Tool in Software Center and install it. + +Once installed, launch Unity Tweak Tool and click on Launcher here. + +![Enable minmize to click using Unity Tweak Tool](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/minimiz-click-ubuntu-unity-1.png) + +Check the “Minimize single window application on click” option here. + +![Enable minmize to click using Unity Tweak Tool](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/minimiz-click-ubuntu-unity.png) + +That’s all. The change takes into effect right away. + +### Did it work for you? + +I hope this quick tip helped you to enable the minimize on click feature in Ubuntu. If you are using Ubuntu 18.04, I suggest reading [GNOME customization tips][11] for more such options. + +If you have any questions or suggestions, please leave a comment. If it helped you, perhaps you could share this article on various social media platforms such as Reddit and Twitter. + + +#### 关于作者 + +I am a professional software developer, and founder of It's FOSS. I am an avid Linux lover and Open Source enthusiast. I use Ubuntu and believe in sharing knowledge. Apart from Linux, I love classic detective mysteries. I'm a huge fan of Agatha Christie's work. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/click-to-minimize-ubuntu/ + +作者:[Abhishek Prakash ][a] +译者:[译者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/abhishek/ +[1]:https://www.gnome.org/ +[2]:https://itsfoss.com/author/abhishek/ +[3]:https://itsfoss.com/click-to-minimize-ubuntu/#comments +[4]:https://itsfoss.com/category/how-to/ +[5]:https://itsfoss.com/tag/quick-tip/ +[6]:https://itsfoss.com/tag/ubuntu-18-04/ +[7]:https://www.ubuntu.com/ +[8]:https://itsfoss.com/reasons-switch-linux-windows-xp/ +[9]:https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[10]:https://wiki.gnome.org/Projects/dconf +[11]:https://itsfoss.com/gnome-tricks-ubuntu/ From 75ed29e145396faaececaea596438524c1899c9f Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:18:42 +0800 Subject: [PATCH 13/84] =?UTF-8?q?20180525-4=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...a Stunning Makeover With Xenlism Themes.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20180515 Give Your Linux Desktop a Stunning Makeover With Xenlism Themes.md diff --git a/sources/tech/20180515 Give Your Linux Desktop a Stunning Makeover With Xenlism Themes.md b/sources/tech/20180515 Give Your Linux Desktop a Stunning Makeover With Xenlism Themes.md new file mode 100644 index 0000000000..f76a483199 --- /dev/null +++ b/sources/tech/20180515 Give Your Linux Desktop a Stunning Makeover With Xenlism Themes.md @@ -0,0 +1,92 @@ +Give Your Linux Desktop a Stunning Makeover With Xenlism Themes +============================================================ + + + _Brief: Xenlism theme pack provides an aesthetically pleasing GTK theme, colorful icons, and minimalist wallpapers to transform your Linux desktop into an eye-catching setup._ + +It’s not every day that I dedicate an entire article to a theme unless I find something really awesome. I used to cover themes and icons regularly. But lately, I preferred having lists of [best GTK themes][6] and icon themes. This is more convenient for me and for you as well as you get to see many beautiful themes in one place. + +After [Pop OS theme][7] suit, Xenlism is another theme that has left me awestruck by its look.  + +![Xenlism GTK theme for Ubuntu and Other Linux](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/xenlishm-minimalism-gtk-theme-800x450.jpeg) + +Xenlism GTK theme is based on the Arc theme, an inspiration behind so many themes these days. The GTK theme provides Windows buttons similar to macOS which I neither like nor dislike. The GTK theme has a flat, minimalist layout and I like that. + +There are two icon themes in the Xenlism suite. Xenlism Wildfire is an old one and had already made to our list of [best icon themes][8]. + +![Beautiful Xenlism Wildfire theme for Ubuntu and Other Linux](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/xenlism-wildfire-theme-800x450.jpeg) +Xenlism Wildfire Icons + +Xenlsim Storm is the relatively new icon theme but is equally beautiful. + +![Beautiful Xenlism Storm theme for Ubuntu and Other Linux](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/xenlism-storm-theme-1-800x450.jpeg) +Xenlism Storm Icons + +Xenlism themes are open source under GPL license. + +### How to install Xenlism theme pack on Ubuntu 18.04 + +Xenlism dev provides an easier way of installing the theme pack through a PPA. Though the PPA is available for Ubuntu 16.04, I found the GTK theme wasn’t working with Unity. It works fine with the GNOME desktop in Ubuntu 18.04. + +Open a terminal (Ctrl+Alt+T) and use the following commands one by one: + +``` +sudo add-apt-repository ppa:xenatt/xenlism +sudo apt update +``` + +This PPA offers four packages: + +* xenlism-finewalls: for a set of wallpapers that will be available directly in the wallpaper section of Ubuntu. One of the wallpapers has been used in the screenshot. + +* xenlism-minimalism-theme: GTK theme + +* xenlism-storm: an icon theme (see previous screenshots) + +* xenlism-wildfire-icon-theme: another icon theme with several color variants (folder colors get changed in the variants) + +You can decide on your own what theme component you want to install. Personally, I don’t see any harm in installing all the components. + +``` +sudo apt install xenlism-minimalism-theme xenlism-storm-icon-theme xenlism-wildfire-icon-theme xenlism-finewalls +``` + +You can use GNOME Tweaks for changing the theme and icons. If you are not familiar with the procedure already, I suggest reading this tutorial to learn [how to install themes in Ubuntu 18.04 GNOME][9]. + +### Getting Xenlism themes in other Linux distributions + +You can install Xenlism themes on other Linux distributions as well. Installation instructions for various Linux distributions can be found on its website: + +[Install Xenlism Themes][10] + +### What do you think? + +I know not everyone would agree with me but I loved this theme. I think you are going to see the glimpse of Xenlism theme in the screenshots in future tutorials on It’s FOSS. + +Did you like Xenlism theme? If not, what theme do you like the most? Share your opinion in the comment section below. + +#### 关于作者 + +I am a professional software developer, and founder of It's FOSS. I am an avid Linux lover and Open Source enthusiast. I use Ubuntu and believe in sharing knowledge. Apart from Linux, I love classic detective mysteries. I'm a huge fan of Agatha Christie's work. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/xenlism-theme/ + +作者:[Abhishek Prakash ][a] +译者:[译者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/abhishek/ +[1]:https://itsfoss.com/author/abhishek/ +[2]:https://itsfoss.com/xenlism-theme/#comments +[3]:https://itsfoss.com/category/desktop/ +[4]:https://itsfoss.com/tag/themes/ +[5]:https://itsfoss.com/tag/xenlism/ +[6]:https://itsfoss.com/best-gtk-themes/ +[7]:https://itsfoss.com/pop-icon-gtk-theme-ubuntu/ +[8]:https://itsfoss.com/best-icon-themes-ubuntu-16-04/ +[9]:https://itsfoss.com/install-themes-ubuntu/ +[10]:http://xenlism.github.io/minimalism/#install From 824aeb76dbe6556c3c4a216458cb47d9919963c4 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:21:09 +0800 Subject: [PATCH 14/84] =?UTF-8?q?20180525-5=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ncy Malware Found on Ubuntus Snap Store.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md diff --git a/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md b/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md new file mode 100644 index 0000000000..7d7479c31c --- /dev/null +++ b/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md @@ -0,0 +1,118 @@ +What You Need to Know About Cryptocurrency ‘Malware’ Found on Ubuntu’s Snap Store +============================================================ + +Recently, it was discovered that a couple of apps in the Ubuntu Snaps store contained cryptocurrency mining software. Canonical swiftly removed the offending apps, but several questions are left unanswered. + +### Discovery of Crypto Miner on Snap Store + +![Crypto Miner Malware on Ubuntu Snap Store](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/ubuntu-snap-malware-800x450.jpeg) + +On May 11, a user named [tarwirdur][8] opened a new issue on the [snapcraft.io repository][9]. In the issue, he noted that a snap entitled 2048buntu created by Nicolas Tomb contained a cryptocurrency miner. He asked how he could “complain about the application” for security reasons. tarwirdur later posted to say that all the others snaps created by Nicolas Tomb also contained cryptocurrency miners. + +It appears that the snaps used systemd to automatically launch the code at boot and run it in the background with the user none the wiser. + +{For those unfamiliar with the terminology, a cryptocurrency miner is a piece of software that uses a computer’s main processor or graphics processor to “mine” digital currency. “Mining” usually involves solving a mathematical equation. In this case, if you were running the 2048buntu game, the game used additional processing power for cryptocurrency mining.} + +The Snapcraft team responded by quickly removing all apps created by the offender. They also started an investigation. + +### The Man Behind the Mask Speaks + +On May 13, a Disqus user named Nicolas Tomb [posted a comment][10] on OMGUbuntu’s coverage of the news. In this comment, he stated that he added the cryptocurrency miner to monetize the snaps. He apologized for his actions and promised to send any funds that had been mined to the Ubuntu foundation. + +We can’t say for sure if this comment was posted by the same Nicolas Tomb since the Disqus account was just recently created and only has one comment associated with it. For now, we’ll assume that it is. + +### Canonical Makes a Statement + +On May 15, Canonical issued a statement on the situation. Entitled [“Trust and security in the Snap Store”][11], the post starts out by restating the situation. They add that the snaps have been [reissued with the cryptocurrency mining code removed][12]. + +Canonical then attempts to examine the motives of Nicolas Tomb. They note that he told them he did it in an attempt to monetize the apps (as stated above) and stopped doing it when confronted. They also note that “mining cryptocurrency is not illegal or unethical by itself”. They are however unhappy about the fact that he did not disclose the cryptocurrency miner in the snap description. + +From there Canonical moves to the subject of reviewing software. According to the post, the Snap Store uses a quality control system similar to iOS, Android, and Windows: “automated checkpoints that packages must go through before they are accepted, and manual reviews by a human when specific issues are flagged”. + +However, Canonical says “it’s impossible for a large scale repository to only accept software after every individual file has been reviewed in detail”. Therefore, they need to trust the source, not the content. After all, that is what the current Ubuntu repo system is based on. + +Canonical follows this up by talking about the future of snaps. They acknowledge that the current system is not perfect. They are continually working to improve it. They have “very interesting security features in the works that will improve the safety of the system and also the experience of people handling software deployments in servers and desktops”. + +One of the features they are working on is the ability to see if a publisher is verified. Other improvements include: “upstreaming of all the AppArmor kernel patches” and other under-the-hood fixes. + +### Thoughts on the ‘Snap store malware’ + +Based on all that I’ve read, I’ve got a few thoughts and questions of my own. + +### How Long Was This Running? + +First of all, how long have these mining snaps been available on the Snap Store? Since they have all been removed, we don’t have that data. I was able to grab an image of the 2048buntu page from the Google cache, but it doesn’t show much of anything. Depending on how long it ran, how many systems it got installed on, and what cryptocurrency was being mined, we could either be talks about a little bit of money or a pile. A further question is: would Canonical have been able to catch this in the future? + +### Was it Really a Malware? + +A lot of news sites are reporting this as a malware infection. I think I might have even seen this incident referred to as Linux’s first malware. I’m not sure that term is accurate. Dictionary.com defines [malware][13] as: “software intended to damage a computer, mobile device, computer system, or computer network, or to take partial control over its operation”. + +The snaps in question did not damage or take control of the computers involved. it also did not infect other computers. It couldn’t have because all snaps are sandboxed. At the most, they leached processor power, that’s about it. So, I wouldn’t call it malware. + +### Nothing Like a Loophole + +The one defense that Nicolas Tomb uses is that the Snap Store didn’t have any rules against cryptocurrency mining when he uploaded the snaps. {I can bet you that they are rectifying that problem right now.} They didn’t have that rule for the simple reason that no one had done it before. If Tomb was trying to do things correctly, he should have asked if this kind of behavior was allowed. The fact that he didn’t seems to point to the fact that he knew they would probably say no. At the very least, they would have told him to put it in the description. + +### +![](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/2048buntu.png) + +### Something Looks Hinkey + +As I said before, I got a screenshot of the 2048buntu page from Google cache. Just looking at it raises several red flags. First, there is almost no real description. This is all it says “Game like 2048\. This game is clone popular game – 2048 with ubuntu colors.” Wow. {That’ll bring in the suckers.} When I read something as empty as that, I get nervous. + +Another thing to notice is the size of it. Version 1.0 of the 2048buntu snap weighs almost 140 MB. Why would a game this simple need that much space? There are browser versions written in Javascript that probably use less than a quarter of that. There other snaps of 2048 games on the Snap Store and none of them has half the file size. + +Then, you have the license. This is a clone of a popular game using Ubuntu colors. How can it be considered proprietary? I’m sure that legit devs in the audience would have uploaded it with a FOSS (Free and Open Source Software) license just because of the content. + +These factors alone should have made this snap, in particular, stand out and call for a review. + +### Who is Nicolas Tomb? + +After first reading about this, I decided to see what I could find out about the guy who started this mess. When I searched for Nicolas Tomb, I found nothing, zip, nada, zilch. All I found were a bunch of news articles about the cryptocurrency mining snaps and information about taking a trip to the tomb of St. Nicolas. There is no sign of Nicolas Tomb on Twitter or Github either. This seems like a name created just to upload these snaps. + +This also leads to a point in the Canonical blog post about verifying publishers. The last time I looked, quite a few snaps were not published by the maintainers of the applications. This makes me nervous. I would be more willing to trust a snap of say Firefox if it was published by Mozilla, instead of Leonard Borsch. If it’s too much work for the application maintainer to also take care of the snap, there should be a way for the maintainer to put their stamp of approval on the snap for their program. Something like Firefox snap published by Fredrick Ham, approved by Mozilla Foundation. Just something to give the user more confidence in what they are downloading. + +### Snap Store Definitely has Room to Improve + +It seems to me that one of the first features that the Snap Store team should have implemented was a way to report suspicious snaps. tarwirdur had to find the site’s Github page. The average user would not have thought of that. If the Snap Store can’t review every line of code, enabling the users to reports problems is the next best thing. Even rating system would not be a bad addition. I’m sure there would have been a couple people who would have given 2048buntu a low rating for using too many system resources. + +### Conclusion + +From all the I have seen, I think that someone created a number of simple apps, embedded a cryptocurrency miner in each, and uploaded them to the Snap Store with the goal of raking in piles of money. Once they got caught, they claimed it was only to monetize the snaps. If that was true, they would have mentioned it in the snap description. Hidden crypto miners are nothing [new][14]. They are generally a method of computing power theft. + +I wish that Canonical already have features in place to combat this problem and I hope they appear quickly. + +What do you think of the Snap Store ‘malware episode’? What would you do to improve it? Let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media. + +#### 关于作者 + +My name is John Paul Wohlscheid. I'm an aspiring mystery writer who loves to play with technology, especially Linux. You can catch up with me at [my personal website][15] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/snapstore-cryptocurrency-saga/ + +作者:[John Paul][a] +译者:[译者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/john/ +[1]:https://itsfoss.com/author/john/ +[2]:https://itsfoss.com/snapstore-cryptocurrency-saga/#comments +[3]:https://itsfoss.com/category/news/ +[4]:https://itsfoss.com/category/opinion/ +[5]:https://itsfoss.com/tag/canonical/ +[6]:https://itsfoss.com/tag/cryptocurrency/ +[7]:https://itsfoss.com/tag/snaps/ +[8]:https://github.com/tarwirdur +[9]:https://github.com/canonical-websites/snapcraft.io/issues/651 +[10]:https://disqus.com/home/discussion/omgubuntu/malware_found_on_the_ubuntu_snap_store/#comment-3899153046 +[11]:https://blog.ubuntu.com/2018/05/15/trust-and-security-in-the-snap-store +[12]:https://forum.snapcraft.io/t/action-against-snap-store-malware/5417/8 +[13]:http://www.dictionary.com/browse/malware?s=t +[14]:https://krebsonsecurity.com/2018/03/who-and-what-is-coinhive/ +[15]:http://johnpaulwohlscheid.work/ From efa8c788f24a61414bfa8981257f62c8f5b8d7b4 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:21:54 +0800 Subject: [PATCH 15/84] Delete 20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md --- ...ncy Malware Found on Ubuntus Snap Store.md | 118 ------------------ 1 file changed, 118 deletions(-) delete mode 100644 sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md diff --git a/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md b/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md deleted file mode 100644 index 7d7479c31c..0000000000 --- a/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md +++ /dev/null @@ -1,118 +0,0 @@ -What You Need to Know About Cryptocurrency ‘Malware’ Found on Ubuntu’s Snap Store -============================================================ - -Recently, it was discovered that a couple of apps in the Ubuntu Snaps store contained cryptocurrency mining software. Canonical swiftly removed the offending apps, but several questions are left unanswered. - -### Discovery of Crypto Miner on Snap Store - -![Crypto Miner Malware on Ubuntu Snap Store](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/ubuntu-snap-malware-800x450.jpeg) - -On May 11, a user named [tarwirdur][8] opened a new issue on the [snapcraft.io repository][9]. In the issue, he noted that a snap entitled 2048buntu created by Nicolas Tomb contained a cryptocurrency miner. He asked how he could “complain about the application” for security reasons. tarwirdur later posted to say that all the others snaps created by Nicolas Tomb also contained cryptocurrency miners. - -It appears that the snaps used systemd to automatically launch the code at boot and run it in the background with the user none the wiser. - -{For those unfamiliar with the terminology, a cryptocurrency miner is a piece of software that uses a computer’s main processor or graphics processor to “mine” digital currency. “Mining” usually involves solving a mathematical equation. In this case, if you were running the 2048buntu game, the game used additional processing power for cryptocurrency mining.} - -The Snapcraft team responded by quickly removing all apps created by the offender. They also started an investigation. - -### The Man Behind the Mask Speaks - -On May 13, a Disqus user named Nicolas Tomb [posted a comment][10] on OMGUbuntu’s coverage of the news. In this comment, he stated that he added the cryptocurrency miner to monetize the snaps. He apologized for his actions and promised to send any funds that had been mined to the Ubuntu foundation. - -We can’t say for sure if this comment was posted by the same Nicolas Tomb since the Disqus account was just recently created and only has one comment associated with it. For now, we’ll assume that it is. - -### Canonical Makes a Statement - -On May 15, Canonical issued a statement on the situation. Entitled [“Trust and security in the Snap Store”][11], the post starts out by restating the situation. They add that the snaps have been [reissued with the cryptocurrency mining code removed][12]. - -Canonical then attempts to examine the motives of Nicolas Tomb. They note that he told them he did it in an attempt to monetize the apps (as stated above) and stopped doing it when confronted. They also note that “mining cryptocurrency is not illegal or unethical by itself”. They are however unhappy about the fact that he did not disclose the cryptocurrency miner in the snap description. - -From there Canonical moves to the subject of reviewing software. According to the post, the Snap Store uses a quality control system similar to iOS, Android, and Windows: “automated checkpoints that packages must go through before they are accepted, and manual reviews by a human when specific issues are flagged”. - -However, Canonical says “it’s impossible for a large scale repository to only accept software after every individual file has been reviewed in detail”. Therefore, they need to trust the source, not the content. After all, that is what the current Ubuntu repo system is based on. - -Canonical follows this up by talking about the future of snaps. They acknowledge that the current system is not perfect. They are continually working to improve it. They have “very interesting security features in the works that will improve the safety of the system and also the experience of people handling software deployments in servers and desktops”. - -One of the features they are working on is the ability to see if a publisher is verified. Other improvements include: “upstreaming of all the AppArmor kernel patches” and other under-the-hood fixes. - -### Thoughts on the ‘Snap store malware’ - -Based on all that I’ve read, I’ve got a few thoughts and questions of my own. - -### How Long Was This Running? - -First of all, how long have these mining snaps been available on the Snap Store? Since they have all been removed, we don’t have that data. I was able to grab an image of the 2048buntu page from the Google cache, but it doesn’t show much of anything. Depending on how long it ran, how many systems it got installed on, and what cryptocurrency was being mined, we could either be talks about a little bit of money or a pile. A further question is: would Canonical have been able to catch this in the future? - -### Was it Really a Malware? - -A lot of news sites are reporting this as a malware infection. I think I might have even seen this incident referred to as Linux’s first malware. I’m not sure that term is accurate. Dictionary.com defines [malware][13] as: “software intended to damage a computer, mobile device, computer system, or computer network, or to take partial control over its operation”. - -The snaps in question did not damage or take control of the computers involved. it also did not infect other computers. It couldn’t have because all snaps are sandboxed. At the most, they leached processor power, that’s about it. So, I wouldn’t call it malware. - -### Nothing Like a Loophole - -The one defense that Nicolas Tomb uses is that the Snap Store didn’t have any rules against cryptocurrency mining when he uploaded the snaps. {I can bet you that they are rectifying that problem right now.} They didn’t have that rule for the simple reason that no one had done it before. If Tomb was trying to do things correctly, he should have asked if this kind of behavior was allowed. The fact that he didn’t seems to point to the fact that he knew they would probably say no. At the very least, they would have told him to put it in the description. - -### -![](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/2048buntu.png) - -### Something Looks Hinkey - -As I said before, I got a screenshot of the 2048buntu page from Google cache. Just looking at it raises several red flags. First, there is almost no real description. This is all it says “Game like 2048\. This game is clone popular game – 2048 with ubuntu colors.” Wow. {That’ll bring in the suckers.} When I read something as empty as that, I get nervous. - -Another thing to notice is the size of it. Version 1.0 of the 2048buntu snap weighs almost 140 MB. Why would a game this simple need that much space? There are browser versions written in Javascript that probably use less than a quarter of that. There other snaps of 2048 games on the Snap Store and none of them has half the file size. - -Then, you have the license. This is a clone of a popular game using Ubuntu colors. How can it be considered proprietary? I’m sure that legit devs in the audience would have uploaded it with a FOSS (Free and Open Source Software) license just because of the content. - -These factors alone should have made this snap, in particular, stand out and call for a review. - -### Who is Nicolas Tomb? - -After first reading about this, I decided to see what I could find out about the guy who started this mess. When I searched for Nicolas Tomb, I found nothing, zip, nada, zilch. All I found were a bunch of news articles about the cryptocurrency mining snaps and information about taking a trip to the tomb of St. Nicolas. There is no sign of Nicolas Tomb on Twitter or Github either. This seems like a name created just to upload these snaps. - -This also leads to a point in the Canonical blog post about verifying publishers. The last time I looked, quite a few snaps were not published by the maintainers of the applications. This makes me nervous. I would be more willing to trust a snap of say Firefox if it was published by Mozilla, instead of Leonard Borsch. If it’s too much work for the application maintainer to also take care of the snap, there should be a way for the maintainer to put their stamp of approval on the snap for their program. Something like Firefox snap published by Fredrick Ham, approved by Mozilla Foundation. Just something to give the user more confidence in what they are downloading. - -### Snap Store Definitely has Room to Improve - -It seems to me that one of the first features that the Snap Store team should have implemented was a way to report suspicious snaps. tarwirdur had to find the site’s Github page. The average user would not have thought of that. If the Snap Store can’t review every line of code, enabling the users to reports problems is the next best thing. Even rating system would not be a bad addition. I’m sure there would have been a couple people who would have given 2048buntu a low rating for using too many system resources. - -### Conclusion - -From all the I have seen, I think that someone created a number of simple apps, embedded a cryptocurrency miner in each, and uploaded them to the Snap Store with the goal of raking in piles of money. Once they got caught, they claimed it was only to monetize the snaps. If that was true, they would have mentioned it in the snap description. Hidden crypto miners are nothing [new][14]. They are generally a method of computing power theft. - -I wish that Canonical already have features in place to combat this problem and I hope they appear quickly. - -What do you think of the Snap Store ‘malware episode’? What would you do to improve it? Let us know in the comments below. - -If you found this article interesting, please take a minute to share it on social media. - -#### 关于作者 - -My name is John Paul Wohlscheid. I'm an aspiring mystery writer who loves to play with technology, especially Linux. You can catch up with me at [my personal website][15] - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/snapstore-cryptocurrency-saga/ - -作者:[John Paul][a] -译者:[译者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/john/ -[1]:https://itsfoss.com/author/john/ -[2]:https://itsfoss.com/snapstore-cryptocurrency-saga/#comments -[3]:https://itsfoss.com/category/news/ -[4]:https://itsfoss.com/category/opinion/ -[5]:https://itsfoss.com/tag/canonical/ -[6]:https://itsfoss.com/tag/cryptocurrency/ -[7]:https://itsfoss.com/tag/snaps/ -[8]:https://github.com/tarwirdur -[9]:https://github.com/canonical-websites/snapcraft.io/issues/651 -[10]:https://disqus.com/home/discussion/omgubuntu/malware_found_on_the_ubuntu_snap_store/#comment-3899153046 -[11]:https://blog.ubuntu.com/2018/05/15/trust-and-security-in-the-snap-store -[12]:https://forum.snapcraft.io/t/action-against-snap-store-malware/5417/8 -[13]:http://www.dictionary.com/browse/malware?s=t -[14]:https://krebsonsecurity.com/2018/03/who-and-what-is-coinhive/ -[15]:http://johnpaulwohlscheid.work/ From 9d14b8800783ecc95cf6181d10207363851d260c Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:22:40 +0800 Subject: [PATCH 16/84] =?UTF-8?q?=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改文件名 --- ...now About Cryptocurrency Malware Found on Ubuntus Snap Store.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/tech/{20180517 What You Need to Know About Cryptocurrency ‘Malware- Found on Ubuntu-s Snap Store.md => 20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md} (100%) diff --git a/sources/tech/20180517 What You Need to Know About Cryptocurrency ‘Malware- Found on Ubuntu-s Snap Store.md b/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md similarity index 100% rename from sources/tech/20180517 What You Need to Know About Cryptocurrency ‘Malware- Found on Ubuntu-s Snap Store.md rename to sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md From 1f9d13c1dfa54fb533f872d01327ea6a5ad5e0cb Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:25:17 +0800 Subject: [PATCH 17/84] =?UTF-8?q?=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改文件名 --- ... Migrating the debichem group subversion repository to Git.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/tech/{20180131 [erfahrungen, meinungen, halluzinationen]- Migrating the debichem group subversion repository to Git.md => 20180131 Migrating the debichem group subversion repository to Git.md} (100%) diff --git a/sources/tech/20180131 [erfahrungen, meinungen, halluzinationen]- Migrating the debichem group subversion repository to Git.md b/sources/tech/20180131 Migrating the debichem group subversion repository to Git.md similarity index 100% rename from sources/tech/20180131 [erfahrungen, meinungen, halluzinationen]- Migrating the debichem group subversion repository to Git.md rename to sources/tech/20180131 Migrating the debichem group subversion repository to Git.md From 8e5c17f4c15e5a29a836bbc6eeb4d7cf238ac08a Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 09:25:51 +0800 Subject: [PATCH 18/84] =?UTF-8?q?=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改文件名 --- ...y explained.md => 20171101 -dev-urandom- entropy explained.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/tech/{20171101 -dev-[u]random- entropy explained.md => 20171101 -dev-urandom- entropy explained.md} (100%) diff --git a/sources/tech/20171101 -dev-[u]random- entropy explained.md b/sources/tech/20171101 -dev-urandom- entropy explained.md similarity index 100% rename from sources/tech/20171101 -dev-[u]random- entropy explained.md rename to sources/tech/20171101 -dev-urandom- entropy explained.md From ea4d684005fec4da9fcab4d36539afba7660e7af Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 May 2018 10:30:42 +0800 Subject: [PATCH 19/84] PRF:20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md @MjSeven --- ...ze Apache on Ubuntu - ThisHosting.Rocks.md | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/translated/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md b/translated/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md index b7ac346ec9..49f679fe86 100644 --- a/translated/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md +++ b/translated/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md @@ -3,7 +3,7 @@ 这是我们的 LAMP 系列教程的开始:如何在 Ubuntu 上安装 Apache web 服务器。 -这些说明适用于任何基于 Ubuntu 的发行版,包括 Ubuntu 14.04, Ubuntu 16.04, [Ubuntu 18.04][1],甚至非 LTS 的 Ubuntu 发行版,例如 Ubuntu 17.10。这些说明经过测试并为 Ubuntu 16.04 编写。 +这些说明适用于任何基于 Ubuntu 的发行版,包括 Ubuntu 14.04、 Ubuntu 16.04、 [Ubuntu 18.04][1],甚至非 LTS 的 Ubuntu 发行版,例如 Ubuntu 17.10。这些说明经过测试并为 Ubuntu 16.04 编写。 Apache (又名 httpd) 是最受欢迎和使用最广泛的 web 服务器,所以这应该对每个人都有用。 @@ -11,9 +11,9 @@ Apache (又名 httpd) 是最受欢迎和使用最广泛的 web 服务器,所 在我们开始之前,这里有一些要求和说明: - * Apache 可能已经在你的服务器上安装了,所以开始之前首先检查一下。你可以使用 "apachectl -V" 命令来显示你正在使用的 Apache 的版本和一些其他信息。 - * 你需要一个 Ubuntu 服务器。你可以从 [Vultr][2] 购买一个,它们是[最便宜的云托管服务商][3]之一。它们的服务器价格每月 2.5 美元起。 - * 你需要有 root 用户或具有 sudo 访问权限的用户。下面的所有命令都由 root 用户自行,所以我们不必为每个命令都添加 'sudo'。 + * Apache 可能已经在你的服务器上安装了,所以开始之前首先检查一下。你可以使用 `apachectl -V` 命令来显示你正在使用的 Apache 的版本和一些其他信息。 + * 你需要一个 Ubuntu 服务器。你可以从 [Vultr][2] 购买一个,它们是[最便宜的云托管服务商][3]之一。它们的服务器价格每月 2.5 美元起。(LCTT 译注:广告 ≤_≤ ) + * 你需要有 root 用户或具有 sudo 访问权限的用户。下面的所有命令都由 root 用户执行,所以我们不必为每个命令都添加 `sudo`。 * 如果你使用 Ubuntu,则需要[启用 SSH][4],如果你使用 Windows,则应该使用类似 [MobaXterm][5] 的 SSH 客户端。 这就是全部要求和注释了,让我们进入安装过程。 @@ -21,16 +21,19 @@ Apache (又名 httpd) 是最受欢迎和使用最广泛的 web 服务器,所 ### 在 Ubuntu 上安装 Apache 你需要做的第一件事就是更新 Ubuntu,这是在你做任何事情之前都应该做的。你可以运行: + ``` apt-get update && apt-get upgrade ``` 接下来,安装 Apache,运行以下命令: + ``` apt-get install apache2 ``` 如果你愿意,你也可以安装 Apache 文档和一些 Apache 实用程序。对于我们稍后将要安装的一些模块,你将需要一些 Apache 实用程序。 + ``` apt-get install apache2-doc apache2-utils ``` @@ -46,6 +49,7 @@ apt-get install apache2-doc apache2-utils #### 检查 Apache 是否正在运行 默认情况下,Apache 设置为在机器启动时自动启动,因此你不必手动启用它。你可以使用以下命令检查它是否正在运行以及其他相关信息: + ``` systemctl status apache2 ``` @@ -53,6 +57,7 @@ systemctl status apache2 [![check if apache is running][6]][6] 并且你可以检查你正在使用的版本: + ``` apachectl -V ``` @@ -64,6 +69,7 @@ apachectl -V 如果你使用防火墙(你应该使用它),则可能需要更新防火墙规则并允许访问默认端口。Ubuntu 上最常用的防火墙是 UFW,因此以下说明使用于 UFW。 要允许通过 80(http)和 443(https)端口的流量,运行以下命令: + ``` ufw allow 'Apache Full' ``` @@ -76,18 +82,21 @@ ufw allow 'Apache Full' PageSpeed 模块将自动优化并加速你的 Apache 服务器。 -首先,进入 [PageSpeed 下载页][7]并选择你需要的的文件。我们使用的是 64 位 Ubuntu 服务器,所以我们安装最新的稳定版本。使用 wget 下载它: +首先,进入 [PageSpeed 下载页][7]并选择你需要的的文件。我们使用的是 64 位 Ubuntu 服务器,所以我们安装最新的稳定版本。使用 `wget` 下载它: + ``` wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb ``` 然后,使用以下命令安装它: + ``` dpkg -i mod-pagespeed-stable_current_amd64.deb apt-get -f install ``` 重启 Apache 以使更改生效: + ``` systemctl restart apache2 ``` @@ -95,6 +104,7 @@ systemctl restart apache2 ##### 使用 mod_rewrite 模块启动重写/重定向 顾名思义,该模块用于重写(重定向)。如果你使用 WordPress 或任何其他 CMS 来处理此问题,你就需要它。要安装它,只需运行: + ``` a2enmod rewrite ``` @@ -104,11 +114,13 @@ a2enmod rewrite ##### 使用 ModSecurity 模块保护你的 Apache 顾名思义,ModSecurity 是一个用于安全性的模块,它基本上起着防火墙的作用,它可以监控你的流量。要安装它,运行以下命令: + ``` apt-get install libapache2-modsecurity ``` 再次重启 Apache: + ``` systemctl restart apache2 ``` @@ -118,40 +130,46 @@ ModSecurity 自带了一个默认的设置,但如果你想扩展它,你可 ##### 使用 mod_evasive 模块抵御 DDoS 攻击 尽管 mod_evasive 在防止攻击方面有多大用处值得商榷,但是你可以使用它来阻止和防止服务器上的 DDoS 攻击。要安装它,使用以下命令: + ``` apt-get install libapache2-mod-evasive ``` 默认情况下,mod_evasive 是禁用的,要启用它,编辑以下文件: + ``` nano /etc/apache2/mods-enabled/evasive.conf ``` -取消注释所有行(即删除 #),根据你的要求进行配置。如果你不知道要编辑什么,你可以保持原样。 +取消注释所有行(即删除 `#`),根据你的要求进行配置。如果你不知道要编辑什么,你可以保持原样。 [![mod_evasive][9]][9] 创建一个日志文件: + ``` mkdir /var/log/mod_evasive chown -R www-data:www-data /var/log/mod_evasive ``` 就是这样。现在重启 Apache 以使更改生效。 + ``` systemctl restart apache2 ``` -你可以安装和配置[附加模块][10],但完全取决于你和你使用的软件。它们通常不是必需的。甚至我们上面包含的4个模块也不是必需的。如果特定应用需要模块,那么它们可能会注意到这一点。 +你可以安装和配置[附加模块][10],但完全取决于你和你使用的软件。它们通常不是必需的。甚至我们上面包含的 4 个模块也不是必需的。如果特定应用需要模块,那么它们可能会注意到这一点。 #### 用 Apache2Buddy 脚本优化 Apache Apache2Buddy 是一个可以自动调整 Apache 配置的脚本。你唯一需要做的就是运行下面的命令,脚本会自动完成剩下的工作: + ``` curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl ``` -如果你没有安装 curl,那么你可能需要安装它。使用以下命令来安装 curl: +如果你没有安装 `curl`,那么你可能需要安装它。使用以下命令来安装 `curl`: + ``` apt-get install curl ``` @@ -165,15 +183,17 @@ apt-get install curl 现在我们已经完成了所有的调优工作,让我们开始创建一个实际的网站。按照我们的指示创建一个简单的 HTML 页面和一个在 Apache 上运行的虚拟主机。 你需要做的第一件事是为你的网站创建一个新的目录。运行以下命令来执行此操作: + ``` mkdir -p /var/www/example.com/public_html ``` -当然,将 example.com 替换为你所需的域名。你可以从 [Namecheap][11] 获得一个便宜的域名。 +当然,将 `example.com` 替换为你所需的域名。你可以从 [Namecheap][11] 获得一个便宜的域名。 -不要忘记在下面的所有命令中替换 example.com。 +不要忘记在下面的所有命令中替换 `example.com`。 接下来,创建一个简单的静态网页。创建 HTML 文件: + ``` nano /var/www/example.com/public_html/index.html ``` @@ -193,17 +213,20 @@ nano /var/www/example.com/public_html/index.html 保存并关闭文件。 配置目录的权限: + ``` chown -R www-data:www-data /var/www/example.com chmod -R og-r /var/www/example.com ``` 为你的网站创建一个新的虚拟主机: + ``` nano /etc/apache2/sites-available/example.com.conf ``` 粘贴以下内容: + ```      ServerAdmin admin@example.com @@ -217,32 +240,31 @@ nano /etc/apache2/sites-available/example.com.conf ``` -这是一个基础的虚拟主机。根据你的设置,你可能需要更高级的 .conf 文件。 +这是一个基础的虚拟主机。根据你的设置,你可能需要更高级的 `.conf` 文件。 在更新所有内容后保存并关闭文件。 现在,使用以下命令启用虚拟主机: + ``` a2ensite example.com.conf ``` 最后,重启 Apache 以使更改生效: + ``` systemctl restart apache2 ``` 这就是全部了,你做完了。现在你可以访问 example.com 并查看你的页面。 - - - -------------------------------------------------------------------------------- via: https://thishosting.rocks/how-to-install-optimize-apache-ubuntu/ 作者:[ThisHosting][a] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 66fcefe9879d5803455667632b563390243b242f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 May 2018 10:31:11 +0800 Subject: [PATCH 20/84] PUB:20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md @MjSeven https://linux.cn/article-9679-1.html --- ...o Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md (100%) diff --git a/translated/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md b/published/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md similarity index 100% rename from translated/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md rename to published/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md From 4259598053487ad89d03ed9d40f7f337a8c30e1a Mon Sep 17 00:00:00 2001 From: MZZZ Date: Fri, 25 May 2018 11:10:26 +0800 Subject: [PATCH 21/84] Delete 20180305 What-s next in IT automation- 6 trends to watch.md --- ...ext in IT automation- 6 trends to watch.md | 132 ------------------ 1 file changed, 132 deletions(-) delete mode 100644 sources/talk/20180305 What-s next in IT automation- 6 trends to watch.md diff --git a/sources/talk/20180305 What-s next in IT automation- 6 trends to watch.md b/sources/talk/20180305 What-s next in IT automation- 6 trends to watch.md deleted file mode 100644 index 557bcb494c..0000000000 --- a/sources/talk/20180305 What-s next in IT automation- 6 trends to watch.md +++ /dev/null @@ -1,132 +0,0 @@ -translating by MZqk - -What’s next in IT automation: 6 trends to watch -====== - -![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/cio_ai_artificial_intelligence.png?itok=o0csm9l2) - -We’ve recently covered the [factors fueling IT automation][1], the [current trends][2] to watch as adoption grows, and [helpful tips][3] for those organizations just beginning to automate certain processes. - -Oh, and we also shared expert advice on [how to make the case for automation][4] in your company, as well as [keys for long-term success][5]. - -Now, there’s just one question: What’s next? We asked a range of experts to share a peek into the not-so-distant future of [automation][6]. Here are six trends they advise IT leaders to monitor closely. - -### 1. Machine learning matures - -For all of the buzz around [machine learning][7] (and the overlapping phrase “self-learning systems”), it’s still very early days for most organizations in terms of actual implementations. Expect that to change, and for machine learning to play a significant role in the next waves of IT automation. - -Mehul Amin, director of engineering for [Advanced Systems Concepts, Inc.][8], points to machine learning as one of the next key growth areas for IT automation. - -“With the data that is developed, automation software can make decisions that otherwise might be the responsibility of the developer,” Amin says. “For example, the developer builds what needs to be executed, but identifying the best system to execute the processes might be [done] by software using analytics from within the system.” - -That extends elsewhere in this same hypothetical system; Amin notes that machine learning can enable automated systems to provision additional resources when necessary to meet timelines or SLAs, as well as retire those resources when they’re no longer needed, and other possibilities. - -Amin is certainly not alone. - -“IT automation is moving towards self-learning,” says Kiran Chitturi, CTO architect at [Sungard Availability Services][9]. “Systems will be able to test and monitor themselves, enhancing business processes and software delivery.” - -Chitturi points to automated testing as an example; test scripts are already in widespread adoption, but soon those automated testing processes may be more likely to learn as they go, developing, for example, wider recognition of how new code or code changes will impact production environments. - -### 2. Artificial intelligence spawns automation opportunities - -The same principles above hold true for the related (but separate) field of [artificial intelligence][10]. Depending on your definition of AI, it seems likely that machine learning will have the more significant IT impact in the near term (and we’re likely to see a lot of overlapping definitions and understandings of the two fields). Assume that emerging AI technologies will spawn new automation opportunities, too. - -“The integration of artificial intelligence (AI) and machine learning capabilities is widely perceived as critical for business success in the coming years,” says Patrick Hubbard, head geek at [SolarWinds][11]. - -### 3. That doesn’t mean people are obsolete - -Let’s try to calm those among us who are now hyperventilating into a paper bag: The first two trends don’t necessarily mean we’re all going to be out of a job. - -It is likely to mean changes to various roles – and the creation of [new roles][12] altogether. - -But in the foreseeable future, at least, you don’t need to practice bowing to your robot overlords. - -“A machine can only consider the environment variables that it is given – it can’t choose to include new variables, only a human can do this today,” Hubbard explains. “However, for IT professionals this will necessitate the cultivation of AI- and automation-era skills such as programming, coding, a basic understanding of the algorithms that govern AI and machine learning functionality, and a strong security posture in the face of more sophisticated cyberattacks.” - -Hubbard shares the example of new tools or capabilities such as AI-enabled security software or machine-learning applications that remotely spot maintenance needs in an oil pipeline. Both might improve efficiency and effectiveness; neither automatically replaces the people necessary for information security or pipeline maintenance. - -“Many new functionalities still require human oversight,” Hubbard says. “In order for a machine to determine if something ‘predictive’ could become ‘prescriptive,’ for example, human management is needed.” - -The same principle holds true even if you set machine learning and AI aside for a moment and look at IT automation more generally, especially in the software development lifecycle. - -Matthew Oswalt, lead architect for automation at [Juniper Networks][13], points out that the fundamental reason IT automation is growing is that it is creating immediate value by reducing the amount of manual effort required to operate infrastructure. - -Rather than responding to an infrastructure issue at 3 a.m. themselves, operations engineers can use event-driven automation to define their workflows ahead of time, as code. - -“It also sets the stage for treating their operations workflows as code rather than easily outdated documentation or tribal knowledge,” Oswalt explains. “Operations staff are still required to play an active role in how [automation] tooling responds to events. The next phase of adopting automation is to put in place a system that is able to recognize interesting events that take place across the IT spectrum and respond in an autonomous fashion. Rather than responding to an infrastructure issue at 3 a.m. themselves, operations engineers can use event-driven automation to define their workflows ahead of time, as code. They can rely on this system to respond in the same way they would, at any time.” - -### 4. Automation anxiety will decrease - -Hubbard of SolarWinds notes that the term “automation” itself tends to spawn a lot of uncertainty and concern, not just in IT but across professional disciplines, and he says that concern is legitimate. But some of the attendant fears may be overblown, and even perpetuated by the tech industry itself. Reality might actually be the calming force on this front: When the actual implementation and practice of automation helps people realize #3 on this list, then we’ll see #4 occur. - -“This year we’ll likely see a decrease in automation anxiety and more organizations begin to embrace AI and machine learning as a way to augment their existing human resources,” Hubbard says. “Automation has historically created room for more jobs by lowering the cost and time required to accomplish smaller tasks and refocusing the workforce on things that cannot be automated and require human labor. The same will be true of AI and machine learning.” - -Automation will also decrease some anxiety around the topic most likely to increase an IT leader’s blood pressure: Security. As Matt Smith, chief architect, [Red Hat][14], recently [noted][15], automation will increasingly help IT groups reduce the security risks associated with maintenance tasks. - -His advice: “Start by documenting and automating the interactions between IT assets during maintenance activities. By relying on automation, not only will you eliminate tasks that historically required much manual effort and surgical skill, you will also be reducing the risks of human error and demonstrating what’s possible when your IT organization embraces change and new methods of work. Ultimately, this will reduce resistance to promptly applying security patches. And it could also help keep your business out of the headlines during the next major security event.” - -**[ Read the full article: [12 bad enterprise security habits to break][16]. ] ** - -### 5. Continued evolution of scripting and automation tools - -Many organizations see the first steps toward increasing automation – usually in the form of scripting or automation tools (sometimes referred to as configuration management tools) – as "early days" work. - -But views of those tools are evolving as the use of various automation technologies grows. - -“There are many processes in the data center environment that are repetitive and subject to human error, and technologies such as [Ansible][17] help to ameliorate those issues,” says Mark Abolafia, chief operating officer at [DataVision][18]. “With Ansible, one can write a specific playbook for a set of actions and input different variables such as addresses, etc., to automate long chains of process that were previously subject to human touch and longer lead times.” - -**[ Want to learn more about this aspect of Ansible? Read the related article:[Tips for success when getting started with Ansible][19]. ]** - -Another factor: The tools themselves will continue to become more advanced. - -“With advanced IT automation tools, developers will be able to build and automate workflows in less time, reducing error-prone coding,” says Amin of ASCI. “These tools include pre-built, pre-tested drag-and-drop integrations, API jobs, the rich use of variables, reference functionality, and object revision history.” - -### 6. Automation opens new metrics opportunities - -As we’ve said previously in this space, automation isn’t IT snake oil. It won’t fix busted processes or otherwise serve as some catch-all elixir for what ails your organization. That’s true on an ongoing basis, too: Automation doesn’t eliminate the need to measure performance. - -**[ See our related article[DevOps metrics: Are you measuring what matters?][20] ]** - -In fact, automation should open up new opportunities here. - -“As more and more development activities – source control, DevOps pipelines, work item tracking – move to the API-driven platforms – the opportunity and temptation to stitch these pieces of raw data together to paint the picture of your organization's efficiency increases,” says Josh Collins, VP of architecture at [Janeiro Digital][21]. - -Collins thinks of this as a possible new “development organization metrics-in-a-box.” But don’t mistake that to mean machines and algorithms can suddenly measure everything IT does. - -“Whether measuring individual resources or the team in aggregate, these metrics can be powerful – but should be balanced with a heavy dose of context,” Collins says. “Use this data for high-level trends and to affirm qualitative observations – not to clinically grade your team.” - -**Want more wisdom like this, IT leaders?[Sign up for our weekly email newsletter][22].** - --------------------------------------------------------------------------------- - -via: https://enterprisersproject.com/article/2018/3/what-s-next-it-automation-6-trends-watch - -作者:[Kevin Casey][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://enterprisersproject.com/user/kevin-casey -[1]:https://enterprisersproject.com/article/2017/12/5-factors-fueling-automation-it-now -[2]:https://enterprisersproject.com/article/2017/12/4-trends-watch-it-automation-expands -[3]:https://enterprisersproject.com/article/2018/1/getting-started-automation-6-tips -[4]:https://enterprisersproject.com/article/2018/1/how-make-case-it-automation -[5]:https://enterprisersproject.com/article/2018/1/it-automation-best-practices-7-keys-long-term-success -[6]:https://enterprisersproject.com/tags/automation -[7]:https://enterprisersproject.com/article/2018/2/how-spot-machine-learning-opportunity -[8]:https://www.advsyscon.com/en-us/ -[9]:https://www.sungardas.com/en/ -[10]:https://enterprisersproject.com/tags/artificial-intelligence -[11]:https://www.solarwinds.com/ -[12]:https://enterprisersproject.com/article/2017/12/8-emerging-ai-jobs-it-pros -[13]:https://www.juniper.net/ -[14]:https://www.redhat.com/en?intcmp=701f2000000tjyaAAA -[15]:https://enterprisersproject.com/article/2018/2/12-bad-enterprise-security-habits-break -[16]:https://enterprisersproject.com/article/2018/2/12-bad-enterprise-security-habits-break?sc_cid=70160000000h0aXAAQ -[17]:https://opensource.com/tags/ansible -[18]:https://datavision.com/ -[19]:https://opensource.com/article/18/2/tips-success-when-getting-started-ansible?intcmp=701f2000000tjyaAAA -[20]:https://enterprisersproject.com/article/2017/7/devops-metrics-are-you-measuring-what-matters?sc_cid=70160000000h0aXAAQ -[21]:https://www.janeirodigital.com/ -[22]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ From ae25455e998179555aee8dfe88823b4325b36991 Mon Sep 17 00:00:00 2001 From: MZZZ Date: Fri, 25 May 2018 11:12:36 +0800 Subject: [PATCH 22/84] translated --- ...s next in IT automation- 6 trends to watch | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 translated/talk/20180305 What-s next in IT automation- 6 trends to watch diff --git a/translated/talk/20180305 What-s next in IT automation- 6 trends to watch b/translated/talk/20180305 What-s next in IT automation- 6 trends to watch new file mode 100644 index 0000000000..f5e93d0a0c --- /dev/null +++ b/translated/talk/20180305 What-s next in IT automation- 6 trends to watch @@ -0,0 +1,130 @@ +IT自动化的下一步是什么: 6 大趋势 +====== + +![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/cio_ai_artificial_intelligence.png?itok=o0csm9l2) + +我们最近介绍了 [促进自动化的因素][1] ,目前正在被人们采用的 [趋势][2], 以及那些刚开始使用自动化部分流程组织 [有用的技巧][3] 。 + +噢, 我们也分享了在你的公司[如何使用自动化的案例][4] , 以及 [长期成功的关键][5]. + +现在, 只有一个问题: 自动化的下一步是什么? 我们邀请一系列专家分享一下 [自动化][6]不远的将来。 以下是他们建议IT领域领导需密切关注的六大趋势。 + +### 1. 机器学习的成熟 + +对于关于 [机器学习][7]的讨论 (与“自我学习系统”相似的定义),对于绝大多数组织的项目来说,实际执行起来它仍然为时过早。但预计这将发生变化,机器学习将在下一次IT自动化浪潮中将扮演着至关重要的角色。 + +[Advanced Systems Concepts, Inc.][8]公司工程总监 Mehul Amin 指出机器学习是IT自动化下一个关键增长领域之一。 + +“随着数据化的发展, 自动化软件理应可以自我决策,否则这就是开发人员的责任了”, Amin 说。 “例如, 开发者需要执行构建内容, 但是识别系统最佳执行流程的,可能是由系统内软件分析完成。” + +假设将这个系统延伸到其他地方中。Amin 指出,机器学习可以使自动化系统在必要的时候提供额外的资源,以需要满足时间线或SLA,同样在不需要资源的时候退出以及其他的可能性。 + +显然不只有 Amin 一个人这样认为。 + +[Sungard Availability Services][9] 公司首席架构师 Kiran Chitturi 表示,“IT自动化正在走向自我学习的方向” 。“系统将会能测试和监控自己,加强业务流程和软件交付能力。” + +Chitturi 指出自动化测试就是个例子。脚本测试已经被广泛采用,但很快这些自动化测试流程将会更容易学习,更快发展,例如开发出新的代码或将更为广泛地影响生产环境。 + +### 2. 人工智能催生的自动化 + +上述原则同样适合 [人工智能][10](但是为独立)的领域。假定新兴的人工智能技术将也会产生新的自动化机会。根据对人工智能的定义,机器学习在短时间内可能会对IT领域产生巨大的影响(并且我们可能会看到这两个领域的许多重叠的定义和理解)。 + +[SolarWinds][11]公司技术负责人 Patrick Hubbard说,“人工智能(AI)和机器学习的整合普遍被认为对未来几年的商业成功起至关重要的作用。” + +### 3. 这并不意味着不再需要人力 + +让我们试着安慰一下那些不知所措的人:前两种趋势并不一定意味着我们将失去工作。 + +这很可能意味着各种角色的改变以及[全新角色][12]的创造。 + +但是在可预见的将来,至少,你不必需要机器人鞠躬。 + +“一台机器只能运行在给定的环境变量中它不能选择包含新的变量,在今天只有人类可以这样做,” Hubbard 解释说。“但是,对于IT专业人员来说,这将是需要培养AI和自动化技能的时代。如对程序设计、编程、管理人工智能和机器学习功能算法的基本理解,以及用强大的安全状态面对更复杂的网络攻击。” + +Hubbard 分享一些新的工具或功能例子,例如支持人工智能的安全软件或机器学习的应用程序,这些应用程序可以远程发现石油管道中的维护需求。两者都可以提高效益和效果,自然不会代替需要信息安全或管道维护的人员。 + +“许多新功能仍需要人工监控,”Hubbard 说。“例如,为了让机器确定一些‘预测’是否可能成为‘规律’,人为的管理是必要的。” + +即使你把机器学习和AI先放在一边,看待一般地IT自动化,同样原理也是成立的,尤其是在软件开发生命周期中。 + +[Juniper Networks][13]公司自动化首席架构师 Matthew Oswalt ,指出IT自动化增长的根本原因是它通过减少操作基础设施所需的人工工作量来创造直接价值。 + +在代码上,操作工程师可以使用事件驱动的自动化提前定义他们的工作流程,而不是在凌晨3点来应对基础设施的问题。 + +“它也将操作工作流程作为代码而不再是容易过时的文档或系统知识阶段,”Oswalt解释说。“操作人员仍然需要在[自动化]工具响应事件方面后发挥积极作用。采用自动化的下一个阶段是建立一个能够跨IT频谱识别发生的有趣事件的系统,并以自主方式进行响应。在代码上,操作工程师可以使用事件驱动的自动化提前定义他们的工作流程,而不是在凌晨3点来应对基础设施的问题。他们可以依靠这个系统在任何时候以同样的方式作出回应。” + +### 4. 对自动化的焦虑将会减少 + +SolarWinds公司的 Hubbard 指出,“自动化”一词本身就产生大量的不确定性和担忧,不仅仅是在IT领域,而且是跨专业领域,他说这种担忧是合理的。但一些随之而来的担忧可能被夸大了,甚至是科技产业本身。现实可能实际上是这方面的镇静力:当自动化的实际实施和实践帮助人们认识到这个列表中的“3”时,我们将看到“4”的出现。 + +“今年我们可能会看到对自动化焦虑的减少,更多的组织开始接受人工智能和机器学习作为增加现有人力资源的一种方式,”Hubbard说。“自动化历史上的今天为更多的工作创造了空间,通过降低成本和时间来完成较小任务,并将劳动力重新集中到无法自动化并需要人力的事情上。人工智能和机器学习也是如此。” + +自动化还将减少IT领导者神经紧张主题的一些焦虑:安全。正如[红帽][14]公司首席架构师 Matt Smith 最近[指出][15]的那样,自动化将越来越多地帮助IT部门降低与维护任务相关的安全风险。 + +他的建议是:“首先在维护活动期间记录和自动化IT资产之间的交互。通过依靠自动化,您不仅可以消除历史上需要大量手动操作和手术技巧的任务,还可以降低人为错误的风险,并展示当您的IT组织采纳变更和新工作方法时可能发生的情况。最终,这将迅速减少对应用安全补丁的抵制。而且它还可以帮助您的企业在下一次重大安全事件中摆脱头条新闻。” + +**[ 阅读全文: [12个企业安全坏习惯要打破。][16] ] ** + +### 5. 脚本和自动化工具将持续发展 + +看到许多组织增加自动化的第一步 - 通常以脚本或自动化工具(有时称为配置管理工具)的形式 - 作为“早期”工作。 + +但是随着各种自动化技术的使用,对这些工具的观点也在不断发展。 + +[DataVision][18]首席运营官 Mark Abolafia 表示:“数据中心环境中存在很多重复性过程,容易出现人为错误,[Ansible][17]等技术有助于缓解这些问题。“通过 Ansible ,人们可以为一组操作编写特定的步骤,并输入不同的变量,例如地址等,使过去长时间的过程链实现自动化,而这些过程以前都需要人为触摸和更长的交货时间。” + +**[想了解更多关于Ansible这个方面的知识吗?阅读相关文章:[使用Ansible时的成功秘诀][19]。 ]** + +另一个因素是:工具本身将继续变得更先进。 + +“使用先进的IT自动化工具,开发人员将能够在更短的时间内构建和自动化工作流程,减少易出错的编码,” ASCI 公司的 Amin 说。“这些工具包括预先构建的,预先测试过的拖放式集成,API作业,丰富的变量使用,参考功能和对象修订历史记录。” + +### 6. 自动化开创了新的指标机会 + +正如我们在此前所说的那样,IT自动化不是万能的。它不会修复被破坏的流程,或者以其他方式为您的组织提供全面的灵丹妙药。这也是持续不断的:自动化并不排除衡量性能的必要性。 + +**[ 参见我们的相关文章 [DevOps指标:你在衡量什么重要吗?][20] ]** + +实际上,自动化应该打开新的机会。 + +[Janeiro Digital][21]公司架构师总裁 Josh Collins 说,“随着越来越多的开发活动 - 源代码管理,DevOps管道,工作项目跟踪 - 转向API驱动的平台 - 将这些原始数据拼接在一起以描绘组织效率提升的机会和图景”。 + +Collins 认为这是一种可能的新型“开发组织度量指标”。但不要误认为这意味着机器和算法可以突然预测IT所做的一切。 + +“无论是衡量个人资源还是整体团队,这些指标都可以很强大 - 但应该用大量的背景来衡量。”Collins说,“将这些数据用于高层次趋势并确认定性观察 - 而不是临床评级你的团队。” + +**想要更多这样知识, IT领导者?[注册我们的每周电子邮件通讯][22]。** + +-------------------------------------------------------------------------------- + +via: https://enterprisersproject.com/article/2018/3/what-s-next-it-automation-6-trends-watch + +作者:[Kevin Casey][a] +译者:[MZqk](https://github.com/MZqk) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://enterprisersproject.com/user/kevin-casey +[1]:https://enterprisersproject.com/article/2017/12/5-factors-fueling-automation-it-now +[2]:https://enterprisersproject.com/article/2017/12/4-trends-watch-it-automation-expands +[3]:https://enterprisersproject.com/article/2018/1/getting-started-automation-6-tips +[4]:https://enterprisersproject.com/article/2018/1/how-make-case-it-automation +[5]:https://enterprisersproject.com/article/2018/1/it-automation-best-practices-7-keys-long-term-success +[6]:https://enterprisersproject.com/tags/automation +[7]:https://enterprisersproject.com/article/2018/2/how-spot-machine-learning-opportunity +[8]:https://www.advsyscon.com/en-us/ +[9]:https://www.sungardas.com/en/ +[10]:https://enterprisersproject.com/tags/artificial-intelligence +[11]:https://www.solarwinds.com/ +[12]:https://enterprisersproject.com/article/2017/12/8-emerging-ai-jobs-it-pros +[13]:https://www.juniper.net/ +[14]:https://www.redhat.com/en?intcmp=701f2000000tjyaAAA +[15]:https://enterprisersproject.com/article/2018/2/12-bad-enterprise-security-habits-break +[16]:https://enterprisersproject.com/article/2018/2/12-bad-enterprise-security-habits-break?sc_cid=70160000000h0aXAAQ +[17]:https://opensource.com/tags/ansible +[18]:https://datavision.com/ +[19]:https://opensource.com/article/18/2/tips-success-when-getting-started-ansible?intcmp=701f2000000tjyaAAA +[20]:https://enterprisersproject.com/article/2017/7/devops-metrics-are-you-measuring-what-matters?sc_cid=70160000000h0aXAAQ +[21]:https://www.janeirodigital.com/ +[22]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ From 9efdf1d320f226a0c542b2c3f63fe34b0a259ad0 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Fri, 25 May 2018 11:57:03 +0800 Subject: [PATCH 23/84] Translated by qhwdw --- ...RP systems to consider - Opensource.com.md | 157 ------------------ ...RP systems to consider - Opensource.com.md | 156 +++++++++++++++++ 2 files changed, 156 insertions(+), 157 deletions(-) delete mode 100644 sources/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md create mode 100644 translated/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md diff --git a/sources/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md b/sources/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md deleted file mode 100644 index ec5592056a..0000000000 --- a/sources/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md +++ /dev/null @@ -1,157 +0,0 @@ -Translating by qhwdw -Top 9 open source ERP systems to consider | Opensource.com -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_orgchart1.png?itok=tukiFj89) -Businesses with more than a handful of employees have a lot to balance including pricing, product planning, accounting and finance, managing payroll, dealing with inventory, and more. Stitching together a set of disparate tools to handle those jobs is a quick, cheap, and dirty way to get things done. - -That approach isn't scalable. It's difficult to efficiently move data between the various pieces of such an ad-hoc system. As well, it can be difficult to maintain. - -Instead, most growing businesses turn to an [enterprise resource planning][1] (ERP) system. - -The big guns in that space are Oracle, SAP, and Microsoft Dynamics. Their offerings are comprehensive, but also expensive. What happens if your business can't afford one of those big implementations or if your needs are simple? You turn to the open source alternatives. - -### What to look for in an ERP system - -Obviously, you want a system that suits your needs. Depending on those needs, more features doesn't always mean better. However, your needs might change as your business grows, so you'll want to find an ERP system that can expand to meet your new needs. That could mean the system has additional modules or just supports plugins and add-ons. - -Most open source ERP systems are web applications. You can download and install them on your server. But if you don't want (or don't have the skills or staff) to maintain a system yourself, then make sure there's a hosted version of the application available. - -Finally, you'll want to make sure the application has good documentation and good support—either in the form of paid support or an active user community. - -There are a number of flexible, feature-rich, and cost-effective open source ERP systems out there. Here are nine to check out if you're in the market for such a system. - -### ADempiere - -Like most other open source ERP solutions, [ADempiere][2] is targeted at small and midsized businesses. It's been around awhile—the project was formed in 2006 as a fork from the Compiere ERP software. - -Its Italian name means to achieve or satisfy, and its "multidimensional" ERP features aim to help businesses satisfy a wide range of needs. It adds supply chain management (SCM) and customer relationship management (CRM) features to its ERP suite to help manage sales, purchasing, inventory, and accounting processes in one piece of software. Its latest release, v.3.9.0, updated its user interface, point-of-sale, HR, payroll, and other features. - -As a multiplatform, Java-based cloud solution, ADempiere is accessible on Linux, Unix, Windows, MacOS, smartphones, and tablets. It is licensed under [GPLv2][3]. If you'd like to learn more, take its [demo][4] for a test run or access its [source code][5] on GitHub. - -### Apache OFBiz - -[Apache OFBiz][6]'s suite of related business tools is built on a common architecture that enables organizations to customize the ERP to their needs. As a result, it's best suited for midsize or large enterprises that have the internal development resources to adapt and integrate it within their existing IT and business processes. - -OFBiz is a mature open source ERP system; its website says it's been a top-level Apache project for a decade. [Modules][7] are available for accounting, manufacturing, HR, inventory management, catalog management, CRM, and e-commerce. You can also try out its e-commerce web store and backend ERP applications on its [demo page][8]. - -Apache OFBiz's source code can be found in the [project's repository][9]. It is written in Java and licensed under an [Apache 2.0 license][10]. - -### Dolibarr - -[Dolibarr][11] offers end-to-end management for small and midsize businesses—from keeping track of invoices, contracts, inventory, orders, and payments to managing documents and supporting electronic point-of-sale system. It's all wrapped in a fairly clean interface. - -If you're wondering what Dolibarr can't do, [here's some documentation about that][12]. - -In addition to an [online demo][13], Dolibarr also has an [add-ons store][14] where you can buy software that extends its features. You can check out its [source code][15] on GitHub; it's licensed under [GPLv3][16] or any later version. - -### ERPNext - -[ERPNext][17] is one of those classic open source projects; in fact, it was [featured on Opensource.com][18] way back in 2014. It was designed to scratch a particular itch, in this case replacing a creaky and expensive proprietary ERP implementation. - -ERPNext was built for small and midsized businesses. It includes modules for accounting, managing inventory, sales, purchase, and project management. The applications that make up ERPNext are form-driven—you fill information in a set of fields and let the application do the rest. The whole suite is easy to use. - -If you're interested, you can request a [demo][19] before taking the plunge and [downloading it][20] or [buying a subscription][21] to the hosted service. - -### Metasfresh - -[Metasfresh][22]'s name reflects its commitment to keeping its code "fresh." It's released weekly updates since late 2015, when its founders forked the code from the ADempiere project. Like ADempiere, it's an open source ERP based on Java targeted at the small and midsize business market. - -While it's a younger project than most of the other software described here, it's attracted some early, positive attention, such as being named a finalist for the Initiative Mittelstand "best of open source" IT innovation award. - -Metasfresh is free when self-hosted or for one user via the cloud, or on a monthly subscription fee basis as a cloud-hosted solution for 1-100 users. Its [source code][23] is available under the [GPLv2][24] license at GitHub and its cloud version is licensed under GPLv3. - -### Odoo - -[Odoo][25] is an integrated suite of applications that includes modules for project management, billing, accounting, inventory management, manufacturing, and purchasing. Those modules can communicate with each other to efficiently and seamlessly exchange information. - -While ERP can be complex, Odoo makes it friendlier with a simple, almost spartan interface. The interface is reminiscent of Google Drive, with just the functions you need visible. You can [give Odoo a try][26] before you decide to sign up. - -Odoo is a web-based tool. Subscriptions to individual modules will set you back $20 (USD) a month for each one. You can also [download it][27] or grab the [source code][28] from GitHub. It's licensed under [LGPLv3][29]. - -### Opentaps - -[Opentaps][30], one of the few open source ERP solutions designed for larger businesses, packs a lot of power and flexibility. This is no surprise because it's built on top of Apache OFBiz. - -You get the expected set of modules that help you manage inventory, manufacturing, financials, and purchasing. You also get an analytics feature that helps you analyze all aspects of your business. You can use that information to better plan into the future. Opentaps also packs a powerful reporting function. - -On top of that, you can [buy add-ons and additional modules][31] to enhance Opentaps' capabilities. They include integration with Amazon Marketplace Services and FedEx. Before you [download Opentaps][32], give the [online demo][33] a try. It's licensed under [GPLv3][34]. - -### WebERP - -[WebERP][35] is exactly as it sounds: An ERP system that operates through a web browser. The only other software you need is a PDF reader to view reports. - -Specifically, its an accounting and business management solution geared toward wholesale, distribution, and manufacturing businesses. It also integrates with [third-party business software][36], including a point-of-sale system for multi-branch retail management, an e-commerce module, and wiki software for building a business knowledge base. It's written in PHP and aims to be a low-footprint, efficient, fast, and platform-independent system that's easy for general business users. - -WebERP is actively being developed and has an active [forum][37], where you can ask questions or learn more about using the application. You can also try a [demo][38] or download the [source code][39] (licensed under [GPLv2][40]) on GitHub. - -### xTuple PostBooks - -If your manufacturing, distribution, or e-commerce business has outgrown its small business roots and is looking for an ERP to grow with you, you may want to check out [xTuple PostBooks][41]. It's a comprehensive solution built around its core ERP, accounting, and CRM features that adds inventory, distribution, purchasing, and vendor reporting capabilities. - -xTuple is available under the Common Public Attribution License ([CPAL][42]), and the project welcomes developers to fork it to create other business software for inventory-based manufacturers. Its web app core is written in JavaScript, and its [source code][43] can be found on GitHub. To see if it's right for you, register for a free [demo][44] on xTuple's website. - -There are many other open source ERP options you can choose from—others you might want to check out include [Tryton][45], which is written in Python and uses the PostgreSQL database engine, or the Java-based [Axelor][46], which touts users' ability to create or modify business apps with a drag-and-drop interface. And, if your favorite open source ERP solution isn't on the list, please share it with us in the comments. You might also check out our list of top [supply chain management tools][47]. - -This article is updated from a [previous version][48] authored by Opensource.com moderator [Scott Nesbitt][49]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/tools/enterprise-resource-planning - -作者:[Opensource.com][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com -[1]:http://en.wikipedia.org/wiki/Enterprise_resource_planning -[2]:http://www.adempiere.net/welcome -[3]:http://wiki.adempiere.net/License -[4]:http://www.adempiere.net/web/guest/demo -[5]:https://github.com/adempiere/adempiere -[6]:http://ofbiz.apache.org/ -[7]:https://ofbiz.apache.org/business-users.html#UsrModules -[8]:http://ofbiz.apache.org/ofbiz-demos.html -[9]:http://ofbiz.apache.org/source-repositories.html -[10]:http://www.apache.org/licenses/LICENSE-2.0 -[11]:http://www.dolibarr.org/ -[12]:http://wiki.dolibarr.org/index.php/What_Dolibarr_can%27t_do -[13]:http://www.dolibarr.org/onlinedemo -[14]:http://www.dolistore.com/ -[15]:https://github.com/Dolibarr/dolibarr -[16]:https://github.com/Dolibarr/dolibarr/blob/develop/COPYING -[17]:https://erpnext.com/ -[18]:https://opensource.com/business/14/11/building-open-source-erp -[19]:https://frappe.erpnext.com/request-a-demo -[20]:https://erpnext.com/download -[21]:https://erpnext.com/pricing -[22]:http://metasfresh.com/en/ -[23]:https://github.com/metasfresh/metasfresh -[24]:https://github.com/metasfresh/metasfresh/blob/master/LICENSE.md -[25]:https://www.odoo.com/ -[26]:https://www.odoo.com/page/start -[27]:https://www.odoo.com/page/download -[28]:https://github.com/odoo -[29]:https://github.com/odoo/odoo/blob/11.0/LICENSE -[30]:http://www.opentaps.org/ -[31]:http://shop.opentaps.org/ -[32]:http://www.opentaps.org/products/download -[33]:http://www.opentaps.org/products/online-demo -[34]:https://www.gnu.org/licenses/agpl-3.0.html -[35]:http://www.weberp.org/ -[36]:http://www.weberp.org/Links.html -[37]:http://www.weberp.org/forum/ -[38]:http://www.weberp.org/weberp/ -[39]:https://github.com/webERP-team/webERP -[40]:https://github.com/webERP-team/webERP#legal -[41]:https://xtuple.com/ -[42]:https://xtuple.com/products/license-options#cpal -[43]:http://xtuple.github.io/ -[44]:https://xtuple.com/free-demo -[45]:http://www.tryton.org/ -[46]:https://www.axelor.com/ -[47]:https://opensource.com/tools/supply-chain-management -[48]:https://opensource.com/article/16/3/top-4-open-source-erp-systems -[49]:https://opensource.com/users/scottnesbitt diff --git a/translated/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md b/translated/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md new file mode 100644 index 0000000000..d992352a2c --- /dev/null +++ b/translated/tech/20180410 Top 9 open source ERP systems to consider - Opensource.com.md @@ -0,0 +1,156 @@ +可以考虑的 9 个开源 ERP 系统 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_orgchart1.png?itok=tukiFj89) +拥有一定数量员工的企业就需要大量的协调工作,包括价格、生产计划、帐务和财务、管理支出、管理存货等等。把一套截然不同的工具拼接到一起去处理这些工作,是一种粗制滥造和无价值的做法。 + +那种方法没有任何弹性。并且那样在各种各样的自组织系统之间高效移动数据是非常困难的。同样,它也很难维护。 + +因此,大多数成长型企业都转而使用一个 [企业资源计划][1] (ERP) 系统。 + +在这个行业中的大咖有 Oracle、SAP、以及 Microsoft Dynamics。它们都提供了一个综合的系统,但同时也很昂贵。如果你的企业支付不起如此昂贵的大系统,或者你仅需要一个简单的系统,怎么办呢?你可以使用开源的产品来作为替代。 + +### 一个 ERP 系统中有什么东西 + +显然,你希望有一个满足你需要的系统。基于那些需要,更多的功能并不意味着就更好。但是,你的需要会根据你的业务的增长而变化的,因此,你希望能够找到一个 ERP 系统,它能够根据你新的需要而扩展它。那就意味着系统有额外的模块或者支持插件和附加功能。 + +大多数的开源 ERP 系统都是 web 应用程序。你可以下载并将它们安装到你的服务器上。但是,如果你不希望(或者没有相应技能或者人员)自己去维护系统,那么应该确保它们的应用程序提供托管版本。 + +最后,你还应该确保应用程序有良好的文档和支持 —— 要么是付费支持或者有一个活跃的用户社区。 + +有很多弹性很好的、功能丰富的、很划算的开源 ERP 系统。如果你正打算购买这样的系统,这里有我们挑选出来的 9 个。 + +### ADempiere + +像大多数其它开源 ERP 解决方案,[ADempiere][2] 的目标客户是中小企业。它已经存在一段时间了— 这个项目出现于 2006,它是 Compiere ERP 软件的一个分支。 + +它的意大利语名字的意思是“实现”或者“满足”,它“涉及多个方面”的 ERP 特性旨在帮企业去满足各种需求。它在 ERP 中增加了供应链管理(SCM)和客户关系管理(CRM)功能,能够让 ERP 套件在一个软件中去管理销售、采购、库存、以及帐务处理。它的最新版本是 v.3.9.0,更新了用户界面、销售点、人力资源、工资、以及其它的特性。 + +因为是一个跨平台的、基于 Java 的云解决方案,ADempiere 可以运行在Linux、Unix、Windows、MacOS、智能手机、平板电脑上。它使用 [GPLv2][3] 授权。如果你想了解更多信息,这里有一个用于测试的 [demo][4],或者也可以在 GitHub 上查看它的 [源代码][5]。 + +### Apache OFBiz + +[Apache OFBiz][6] 的业务相关的套件是构建在通用的架构上的,它允许企业根据自己的需要去定制 ERP。因此,它是有内部开发资源的大中型企业去修改和集成它到它们现有的 IT 和业务流程的最佳套件。 + +OFBiz 是一个成熟的开源 ERP 系统;它的网站上说它是一个有十年历史的顶级 Apache 项目。可用的 [模块][7] 有帐务、生产制造、人力资源、存货管理、目录管理、客户关系管理、以及电子商务。你可以在它的 [demo 页面][8] 上试用电子商务的网上商店以及后端的 ERP 应用程序。 + +Apache OFBiz 的源代码能够在它的 [项目仓库][9] 中找到。它是用 Java 写的,它在 [Apache 2.0 license][10] 下可用。 + +### Dolibarr + +[Dolibarr][11] 提供了中小型企业端到端的业务管理,从发票跟踪、合同、存货、订单、以及支付,到文档管理和电子化 POS 系统支持。它的全部功能封装在一个清晰的界面中。 + +如果你担心不会使用 Dolibarr,[这里有一些关于它的文档][12]。 + +另外,还有一个 [在线演示][13],Dolibarr 也有一个 [插件商店][14],你可以在那是购买一些软件来扩展它的功能。你可以在 GitHub 上查看它的 [源代码][15];它在 [GPLv3][16] 或者任何它的最新版本许可下面使用。 + +### ERPNext + +[ERPNext][17] 是这类开源项目中的其中一个;实际上它最初 [出现在 Opensource.com][18]。它被设计用于打破一个陈旧而昂贵的专用 ERP 系统的垄断局面。 + +ERPNext 适合于中小型企业。它包含的模块有帐务、存货管理、销售、采购、以及项目管理。ERPNext 是表单驱动的应用程序 — 你可以在一组字段中填入信息,然后让应用程序去完成剩余部分。整个套件非常易用。 + +如果你感兴趣,在你考虑参与之前,你可以请求获取一个 [demo][19],去 [下载它][20] 或者在托管服务上 [购买一个订阅][21]。 + +### Metasfresh + +[Metasfresh][22] 的名字表示它承诺软件的代码始终保持“新鲜”。它自 2015 年以来每周发行一个更新版本,那时,它的代码是由创始人从 ADempiere 项目中 fork 的。与 ADempiere 一样,它是一个基于 Java 的开源 ERP,目标客户是中小型企业。 + +虽然,相比在这里介绍的其它软件来说,它是一个很 “年青的” 项目,但是它早早就引起了一起人的注意,获得很多积极的评价,比如,被提名为“最佳开源”的 IT 创新奖入围者。 + +Metasfresh 在自托管系统上或者在云上单用户使用时是免费的,或者可以按月交纳订阅费用。它的 [源代码][23] 在 GitHub 上,可以在遵守 [GPLv2][24] 许可的情况下使用,它的云版本是以 GPLv3 方式授权使用。 + +### Odoo + +[Odoo][25] 是一个应用程序集成解决方案,它包含的模块有项目管理、帐单、存货管理、生产制造、以及采购。这些模块之间可以相互通讯,实现高效平滑地信息交换。 + +虽然 ERP 可能很复杂,但是,Odoo 通过简单的,甚至是简洁的界面使它变得很友好。这个界面让人联想到谷歌云盘,它只让你需要的功能可见。在你决定签定采购合同之前,你可以 [得到一个 Odoo 去试用][26]。 + +Odoo 是基于 web 的工具。按单个模块来订阅的话,每个模块每月需要支付 20 美元。你也可以 [下载它][27],或者可以从 GitHub 上获得 [源代码][28],它以 [LGPLv3][29] 方式授权。 + +### Opentaps + +[Opentaps][30] 是专为大型业务设计的几个开源 ERP 解决方案之一,它的功能强大而灵活。这并不奇怪,因为它是在 Apache OFBiz 基础之上构建的。 + +你可以得到你所希望的模块组合,来帮你管理存货、生产制造、财务、以及采购。它也有分析功能,帮你去分析业务的各个方面。你可以借助这些信息让未来的计划做的更好。Opentaps 也包含一个强大的报表功能。 + +在它的基础之上,你还可以 [购买一些插件和附加模块][31] 去增强 Opentaps 的功能。包括与 Amazon Marketplace Services 和 FedEx 的集成等。在你 [下载 Opentaps][32] 之前,你可以到 [在线 demo][33] 上试用一下。它遵守 [GPLv3][34] 许可。 + +### WebERP + +[WebERP][35] 是一个如它的名字所表示的那样:一个通过 Web 浏览器来使用的 ERP 系统。另外还需要的其它软件只有一个,那就是查看报告所使用的 PDF 阅读器。 + +具体来说,它是一个面向批发、分销、生产制造业务的账务和业务管理解决方案。它也可以与 [第三方的业务软件][36] 集成,包括多地点零售管理的销售点系统、电子商务模块、以及构建业务知识库的 wiki 软件。它是用 PHP 写的,并且它致力于成为低资源占用、高效、快速、以及平台无关的、普通商业用户易于使用的 ERP 系统。 + +WebERP 正在积极地进行开发,并且它有一个活跃的 [论坛][37],在那里你可以咨询问题或者学习关于如何使用这个应用程序的相关知识。你也可以试用一个 [demo][38],或者在 GitHub 上下载它的 [源代码][39](遵守 [GPLv2][40] 许可) + +### xTuple PostBooks + +如果你的生产制造、分销、电子商务业务已经从小规模业务成长起来了,并且正在寻找一个适合你的成长型企业的 ERP 系统,那么,你可以去了解一下 [xTuple PostBooks][41]。它是围绕核心 ERP 功能、帐务、以及可以添加存货、分销、采购、以及供应商报告等 CRM 功能构建的全面解决方案的系统。 + +xTuple 在通用公共属性许可证([CPAL][42])下使用,并且这个项目欢迎开发者去 fork 它,然后为基于存货的生产制造型企业开发其它的业务软件。它的基于 web 的核心是用 JavaScript 写的,它的 [源代码][43] 可以在 GitHub 上找到。你可以去在 xTuple 的网站上注册一个免费的 [demo][44] 去了解它。 + +还有许多其它的开源 ERP 可供你选择 — 另外你可以去了解的还有 [Tryton][45],它是用 Python 写的,并且使用的是 PostgreSQL 数据库引擎,或者基于 Java 的 [Axelor][46],它的好处是用户可以使用拖放界面来创建或者修改业务应用。如果还有在这里没有列出的你喜欢的开源 ERP 解决方案,请在下面的评论区共享出来。你也可以去查看我们的 [供应链管理工具][47] 榜单。 + +这篇文章是 [以前版本][48] 的一个更新版,它是由 Opensource.com 的主席 [Scott Nesbitt][49] 所写。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/tools/enterprise-resource-planning + +作者:[Opensource.com][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) +选题:[lujun9972](https://github.com/lujun9972) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com +[1]:http://en.wikipedia.org/wiki/Enterprise_resource_planning +[2]:http://www.adempiere.net/welcome +[3]:http://wiki.adempiere.net/License +[4]:http://www.adempiere.net/web/guest/demo +[5]:https://github.com/adempiere/adempiere +[6]:http://ofbiz.apache.org/ +[7]:https://ofbiz.apache.org/business-users.html#UsrModules +[8]:http://ofbiz.apache.org/ofbiz-demos.html +[9]:http://ofbiz.apache.org/source-repositories.html +[10]:http://www.apache.org/licenses/LICENSE-2.0 +[11]:http://www.dolibarr.org/ +[12]:http://wiki.dolibarr.org/index.php/What_Dolibarr_can%27t_do +[13]:http://www.dolibarr.org/onlinedemo +[14]:http://www.dolistore.com/ +[15]:https://github.com/Dolibarr/dolibarr +[16]:https://github.com/Dolibarr/dolibarr/blob/develop/COPYING +[17]:https://erpnext.com/ +[18]:https://opensource.com/business/14/11/building-open-source-erp +[19]:https://frappe.erpnext.com/request-a-demo +[20]:https://erpnext.com/download +[21]:https://erpnext.com/pricing +[22]:http://metasfresh.com/en/ +[23]:https://github.com/metasfresh/metasfresh +[24]:https://github.com/metasfresh/metasfresh/blob/master/LICENSE.md +[25]:https://www.odoo.com/ +[26]:https://www.odoo.com/page/start +[27]:https://www.odoo.com/page/download +[28]:https://github.com/odoo +[29]:https://github.com/odoo/odoo/blob/11.0/LICENSE +[30]:http://www.opentaps.org/ +[31]:http://shop.opentaps.org/ +[32]:http://www.opentaps.org/products/download +[33]:http://www.opentaps.org/products/online-demo +[34]:https://www.gnu.org/licenses/agpl-3.0.html +[35]:http://www.weberp.org/ +[36]:http://www.weberp.org/Links.html +[37]:http://www.weberp.org/forum/ +[38]:http://www.weberp.org/weberp/ +[39]:https://github.com/webERP-team/webERP +[40]:https://github.com/webERP-team/webERP#legal +[41]:https://xtuple.com/ +[42]:https://xtuple.com/products/license-options#cpal +[43]:http://xtuple.github.io/ +[44]:https://xtuple.com/free-demo +[45]:http://www.tryton.org/ +[46]:https://www.axelor.com/ +[47]:https://opensource.com/tools/supply-chain-management +[48]:https://opensource.com/article/16/3/top-4-open-source-erp-systems +[49]:https://opensource.com/users/scottnesbitt From f1dc4944970367c56e0816c4119933a91f803bb1 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 14:05:37 +0800 Subject: [PATCH 24/84] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E5=90=8E=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...> 20180305 What-s next in IT automation- 6 trends to watch.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/talk/{20180305 What-s next in IT automation- 6 trends to watch => 20180305 What-s next in IT automation- 6 trends to watch.md} (100%) diff --git a/translated/talk/20180305 What-s next in IT automation- 6 trends to watch b/translated/talk/20180305 What-s next in IT automation- 6 trends to watch.md similarity index 100% rename from translated/talk/20180305 What-s next in IT automation- 6 trends to watch rename to translated/talk/20180305 What-s next in IT automation- 6 trends to watch.md From aa2ad98b62d6bdf92ff34430b1cdbf3a4666ed76 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 25 May 2018 14:11:40 +0800 Subject: [PATCH 25/84] =?UTF-8?q?20180525-6=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How CERN Is Using Linux and Open Source.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20180524 How CERN Is Using Linux and Open Source.md diff --git a/sources/tech/20180524 How CERN Is Using Linux and Open Source.md b/sources/tech/20180524 How CERN Is Using Linux and Open Source.md new file mode 100644 index 0000000000..958a255997 --- /dev/null +++ b/sources/tech/20180524 How CERN Is Using Linux and Open Source.md @@ -0,0 +1,67 @@ +How CERN Is Using Linux and Open Source +============================================================ + +![CERN](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/atlas-cern.jpg?itok=IRLUYCNQ "CERN") +>CERN relies on open source technology to handle huge amounts of data generated by the Large Hadron Collider. The ATLAS (shown here) is a general-purpose detector that probes for fundamental particles. (Image courtesy: CERN)[Used with permission][2] + +[CERN][3] + +[CERN][6] really needs no introduction. Among other things, the European Organization for Nuclear Research created the World Wide Web and the Large Hadron Collider (LHC), the world’s largest particle accelerator, which was used in discovery of the [Higgs boson][7].  Tim Bell, who is responsible for the organization’s  IT Operating Systems and Infrastructure group, says the goal of his team is “to provide the compute facility for 13,000 physicists around the world to analyze those collisions, understand what the universe is made of and how it works.” + +CERN is conducting hardcore science, especially with the LHC, which [generates massive amounts of data][8] when it’s operational. “CERN currently stores about 200 petabytes of data, with over 10 petabytes of data coming in each month when the accelerator is running. This certainly produces extreme challenges for the computing infrastructure, regarding storing this large amount of data, as well as the having the capability to process it in a reasonable timeframe. It puts pressure on the networking and storage technologies and the ability to deliver an efficient compute framework,” Bell said. + +### [tim-bell-cern.png][4] + +![Tim Bell](https://www.linux.com/sites/lcom/files/styles/floated_images/public/tim-bell-cern.png?itok=5eUOpip- "Tim Bell") +Tim Bell, CERN[Used with permission][1]Swapnil Bhartiya + +The scale at which LHC operates and the amount of data it generates pose some serious challenges. But CERN is not new to such problems. Founded in 1954, CERN has been around for about 60 years. “We've always been facing computing challenges that are difficult problems to solve, but we have been working with open source communities to solve them,” Bell said. “Even in the 90s, when we invented the World Wide Web, we were looking to share this with the rest of humanity in order to be able to benefit from the research done at CERN and open source was the right vehicle to do that.” + +### Using OpenStack and CentOS + +Today, CERN is a heavy user of OpenStack, and Bell is one of the Board Members of the OpenStack Foundation. But CERN predates OpenStack. For several years, they have been using various open source technologies to deliver services through Linux servers. + +“Over the past 10 years, we've found that rather than taking our problems ourselves, we find upstream open source communities with which we can work, who are facing similar challenges and then we contribute to those projects rather than inventing everything ourselves and then having to maintain it as well,” said Bell. + +A good example is Linux itself. CERN used to be a Red Hat Enterprise Linux customer. But, back in 2004, they worked with Fermilab to  build their own Linux distribution called [Scientific Linux][9]. Eventually they realized that, because they were not modifying the kernel, there was no point in spending time spinning up their own distribution; so they migrated to CentOS. Because CentOS is a fully open source and community driven project, CERN could collaborate with the project and contribute to how CentOS is built and distributed. + +CERN helps CentOS with infrastructure and they also organize CentOS DoJo at CERN where engineers can get together to improve the CentOS packaging. + +In addition to OpenStack and CentOS, CERN is a heavy user of other open source projects, including Puppet for configuration management, Grafana and  influxDB for monitoring, and is involved in many more. + +“We collaborate with around 170 labs around the world. So every time that we find an improvement in an open source project, other labs can easily take that and use it,” said Bell, “At the same time, we also learn from others. When large scale installations like eBay and Rackspace make changes to improve scalability of solutions, it benefits us and allows us to scale.” + +### Solving realistic problems + +Around 2012, CERN was looking at ways to scale computing for the LHC, but the challenge was people rather than technology. The number of staff that CERN employs is fixed. “We had to find ways in which we can scale the compute without requiring a large number of additional people in order to administer that,” Bell said. “OpenStack provided us with an automated API-driven, software-defined infrastructure.” OpenStack also allowed CERN to look at problems related to the delivery of services and then automate those, without having to scale the staff. + +“We're currently running about 280,000 cores and 7,000 servers across two data centers in Geneva and in Budapest. We are  using software-defined infrastructure to automate everything, which allows us to continue to add additional servers while remaining within the same envelope of staff,” said Bell. + +As time progresses, CERN will be dealing with even bigger challenges. Large Hadron Collider has a roadmap out to 2035, including a number of significant upgrades. “We run the accelerator for three to four years and then have a period of 18 months or two years when we upgrade the infrastructure. This maintenance period allows us to also do some computing planning,” said Bell. CERN is also  planning High Luminosity Large Hadron Collider upgrade, which will allow for beams with higher luminosity. The upgrade would mean about 60 times more compute requirement compared to what CERN has today. + +“With Moore's Law, we will maybe get one quarter of the way there, so we have to find ways under which we can be scaling the compute and the storage infrastructure correspondingly  and finding automation and solutions such as OpenStack will help that,” said Bell. + +“When we started off the large Hadron collider and looked at how we would deliver the computing, it was clear that we couldn't put everything into the data center at CERN, so we devised a distributed grid structure, with tier zero at CERN and then a cascading structure around that,” said Bell. “There are around 12 large tier one centers and then 150 small universities and labs around the world. They receive samples at the data from the LHC in order to assist the physicists to understand and analyze the data.” + +That structure means CERN is collaborating internationally, with hundreds of countries contributing toward the analysis of that data. It boils down to the fundamental principle that open source is not just about sharing code, it’s about collaboration among people to share knowledge and achieve what no single individual, organization, or company can achieve alone. That’s the Higgs boson of the open source world. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/2018/5/how-cern-using-linux-open-source + +作者:[SWAPNIL BHARTIYA ][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/arnieswap +[1]:https://www.linux.com/licenses/category/used-permission +[2]:https://www.linux.com/licenses/category/used-permission +[3]:https://home.cern/about/experiments/atlas +[4]:https://www.linux.com/files/images/tim-bell-cernpng +[5]:https://www.linux.com/files/images/atlas-cernjpg +[6]:https://home.cern/ +[7]:https://home.cern/topics/higgs-boson +[8]:https://home.cern/about/computing +[9]:https://www.scientificlinux.org/ From 3bc690f4590fbc8facedbb968acc79f23d3074b7 Mon Sep 17 00:00:00 2001 From: KevinSJ Date: Fri, 25 May 2018 17:19:32 -0500 Subject: [PATCH 26/84] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20180504 A Beginners Guide To Cron Jobs.md | 231 ------------------ ...20180504 A Beginners Guide To Cron Jobs.md | 227 +++++++++++++++++ ...0 How To Display Images In The Terminal.md | 0 3 files changed, 227 insertions(+), 231 deletions(-) delete mode 100644 sources/tech/20180504 A Beginners Guide To Cron Jobs.md create mode 100644 translated/tech/20180504 A Beginners Guide To Cron Jobs.md rename {sources => translated}/tech/20180510 How To Display Images In The Terminal.md (100%) diff --git a/sources/tech/20180504 A Beginners Guide To Cron Jobs.md b/sources/tech/20180504 A Beginners Guide To Cron Jobs.md deleted file mode 100644 index 58cf8611fd..0000000000 --- a/sources/tech/20180504 A Beginners Guide To Cron Jobs.md +++ /dev/null @@ -1,231 +0,0 @@ -KevinSJ Translating -A Beginners Guide To Cron Jobs -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/05/cron-jobs1-720x340.jpg) -**Cron** is one of the most useful utility that you can find in any Unix-like operating system. It is used to schedule commands at a specific time. These scheduled commands or tasks are known as “Cron Jobs”. Cron is generally used for running scheduled backups, monitoring disk space, deleting files (for example log files) periodically which are no longer required, running system maintenance tasks and a lot more. In this brief guide, we will see the basic usage of Cron Jobs in Linux. - -### The Beginners Guide To Cron Jobs - -The typical format of a cron job is: -``` -Minute(0-59) Hour(0-24) Day_of_month(1-31) Month(1-12) Day_of_week(0-6) Command_to_execute - -``` - -Just memorize the cron job format or print the following illustration and keep it in your desk. - -![][2] - -In the above picture, the asterisks refers the specific blocks of time. - -To display the contents of the **crontab** file of the currently logged in user: -``` -$ crontab -l - -``` - -To edit the current user’s cron jobs, do: -``` -$ crontab -e - -``` - -If it is the first time, you will be asked to editor to edit the jobs. -``` -no crontab for sk - using an empty one - -Select an editor. To change later, run 'select-editor'. - 1. /bin/nano <---- easiest - 2. /usr/bin/vim.basic - 3. /usr/bin/vim.tiny - 4. /bin/ed - -Choose 1-4 [1]: - -``` - -Choose any one that suits you. Here it is how a sample crontab file looks like. - -![][3] - -In this file, you need to add your cron jobs. - -To edit the crontab of a different user, for example ostechnix, do: -``` -$ crontab -u ostechnix -e - -``` - -Let us see some examples. - -To run a cron job **every minute** , the format should be like below. -``` -* * * * * - -``` - -To run cron job every 5 minute, add the following in your crontab file. -``` -*/5 * * * * - -``` - -To run a cron job at every quarter hour (every 15th minute), add this: -``` -*/15 * * * * - -``` - -To run a cron job every hour at 30 minutes, run: -``` -30 * * * * - -``` - -You can also define multiple time intervals separated by commas. For example, the following cron job will run three times every hour, at minutes 0, 5 and 10: -``` -0,5,10 * * * * - -``` - -Run a cron job every half hour: -``` -*/30 * * * * - -``` - -Run a job every hour: -``` -0 * * * * - -``` - -Run a job every 2 hours: -``` -0 */2 * * * - -``` - -Run a job every day (It will run at 00:00): -``` -0 0 * * * - -``` - -Run a job every day at 3am: -``` -0 3 * * * - -``` - -Run a job every sunday: -``` -0 0 * * SUN - -``` - -Or, -``` -0 0 * * 0 - -``` - -It will run at exactly at 00:00 on Sunday. - -Run a job on every day-of-week from Monday through Friday i.e every weekday: -``` -0 0 * * 1-5 - -``` - -The job will start at 00:00. - -Run a job every month: -``` -0 0 1 * * - -``` - -Run a job at 16:15 on day-of-month 1: -``` -15 16 1 * * - -``` - -Run a job at every quarter i.e on day-of-month 1 in every 3rd month: -``` -0 0 1 */3 * - -``` - -Run a job on a specific month at a specific time: -``` -5 0 * 4 * - -``` - -The job will start at 00:05 in April. - -Run a job every 6 months: -``` -0 0 1 */6 * - -``` - -This cron job will start at 00:00 on day-of-month 1 in every 6th month. - -Run a job every year: -``` -0 0 1 1 * - -``` - -This cron job will start at 00:00 on day-of-month 1 in January. - -We can also use the following strings to define job. - -@reboot Run once, at startup. @yearly Run once a year. @annually (same as @yearly). @monthly Run once a month. @weekly Run once a week. @daily Run once a day. @midnight (same as @daily). @hourly Run once an hour. - -For example, to run a job every time the server is rebooted, add this line in your crontab file. -``` -@reboot - -``` - -To remove all cron jobs for the current user: -``` -$ crontab -r - -``` - -There is also a dedicated website named [**crontab.guru**][4] for learning cron jobs examples. This site provides a lot of cron job examples. - -For more details, check man pages. -``` -$ man crontab - -``` - -And, that’s all for now. At this point, you might have a basic understanding of cron jobs and how to use them in real time. More good stuffs to come. Stay tuned!! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/a-beginners-guide-to-cron-jobs/ - -作者:[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]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-job-format-1.png -[3]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-jobs-1.png -[4]:https://crontab.guru/ diff --git a/translated/tech/20180504 A Beginners Guide To Cron Jobs.md b/translated/tech/20180504 A Beginners Guide To Cron Jobs.md new file mode 100644 index 0000000000..fb7185506c --- /dev/null +++ b/translated/tech/20180504 A Beginners Guide To Cron Jobs.md @@ -0,0 +1,227 @@ +Cron 任务入门指南 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/05/cron-任务s1-720x340.jpg) +** Cron **是您可以在任何类 Unix 操作系统中找到的最有用的实用程序之一。它用于安排命令在特定时间执行。这些预定的命令或任务被称为 “Cron 任务”。Cron 通常用于运行计划备份,监视磁盘空间,定期删除不再需要的文件(例如日志文件),运行系统维护任务等等。在本简要指南中,我们将看到 Linux 中 Cron 任务 的基本用法。 + +Cron 任务入门指南 + +cron 任务的典型格式是: +``` +Minute(0-59) Hour(0-24) Day_of_month(1-31) Month(1-12) Day_of_week(0-6) Command_to_execute +``` + +只需记住 cron 任务的格式或打印下面的插图并将其放在你桌面上即可。 + +![][2] + +在上图中,星号表示特定的时间块。 + +要显示当前登录用户的 ** crontab ** 文件的内容: +``` +$ crontab -l + +``` + +要编辑当前用户的 cron 任务,请执行以下操作: +``` +$ crontab -e +``` + +如果这是第一次编辑此文件,你将需要使用编辑器来编辑此文件。 +``` +no crontab for sk - using an empty one + +Select an editor. To change later, run 'select-editor'. +1. /bin/nano <---- easiest +2. /usr/bin/vim.basic +3. /usr/bin/vim.tiny +4. /bin/ed + +Choose 1-4 [1]: + +``` + +选择适合你的编辑器。这里是一个示例crontab文件的样子。 + +![][3] + +在这个文件中,你需要添加你的 cron 任务s。 + +要编辑其他用户的crontab,例如 ostechnix,请执行: +``` +$ crontab -u ostechnix -e +``` + +让我们看看一些例子。 + +要 **每分钟** 执行一次 cron 任务 , 需使用如下格式. +``` +* * * * * + +``` + +要每5分钟运行一次cron 任务,请在crontab文件中添加以下内容。 +``` +*/5 * * * * + +``` + +要在每 1/4 个小时(每15分钟)运行一次 cron 任务,请添加以下内容: +``` +*/15 * * * * + +``` + +要每小时的第30分钟运行一次 cron 任务,请运行: +``` +30 * * * * + +``` + +您还可以使用逗号定义多个时间间隔。例如,以下 cron 任务 每小时运行三次,分别在第 0, 5 和 10 分钟运行: +``` +0,5,10 * * * * + +``` + +每半小时运行一次 cron 任务: +``` +*/30 * * * * + +``` + +每小时运行一次: +``` +0 * * * * + +``` + +每2小时运行一次: +``` +0 */2 * * * + +``` + +每天运行一项(在00:00运行): +``` +0 0 * * * + +``` + +每天凌晨3点运行: +``` +0 3 * * * + +``` + +每周日运行: +``` +0 0 * * SUN + +``` + +或使用, +``` +0 0 * * 0 + +``` + +它将在每周日的午夜 00:00 运行。 + +星期一至星期五每天运行一次,亦即每个工作日运行一次: +``` +0 0 * * 1-5 + +``` + +这项工作将于00:00开始。 + +每个月运行一次: +``` +0 0 1 * * + +``` + +于每月第1天的16:15运行: +``` +15 16 1 * * + +``` + +每季度运行一次,亦即每隔3个月的第1天运行: +``` +0 0 1 */3 * + +``` + +在特定月份的特定时间运行: +``` +5 0 * 4 * + +``` + +每个四月的 00:05 运行。 + +每6个月运行: +``` +0 0 1 */6 * + +``` + +这个定时任务将在每六个月的第一天的 00:00 运行。 + +每年运行: +``` +0 0 1 1 * + +``` + +这项 cron 任务将于 1 月份的第一天的 00:00 运行。 + +我们也可以使用以下字符串来定义任务。 + +@reboot 在每次启动时运行一次。 @yearly 每年运行一次。 @annually(和 @yearly 一样)。 @monthly 每月运行一次。 @weekly 每周运行一次。 @daily 每天运行一次。 @midnight (和 @daily 一样)。 @hourly 每小时运行一次。 + +例如,要在每次重新启动服务器时运行任务,请将此行添加到您的 crontab 文件中。 +``` +@reboot + +``` + +要删除当前用户的所有 cron 任务: +``` +$ crontab -r + +``` + +还有一个名为 [** crontab.guru **] [4] 的专业网站,用于学习 cron 任务示例。这个网站提供了很多 cron 任务的例子。 + +有关更多详细信息,请查看手册页。 +``` +$ man crontab + +``` + +那么,就是这样。到此为止,您应该对 cron 任务以及如何在世使用它们有了一个基本的了解。后续还会介绍更多的优秀工具。敬请关注!! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/a-beginners-guide-to-cron-任务s/ + +作者:[SK][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[译者KevinSJ](https://github.com/KevinSJ) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.ostechnix.com/author/sk/ +[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-任务-format-1.png +[3]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-任务s-1.png +[4]:https://crontab.guru/ \ No newline at end of file diff --git a/sources/tech/20180510 How To Display Images In The Terminal.md b/translated/tech/20180510 How To Display Images In The Terminal.md similarity index 100% rename from sources/tech/20180510 How To Display Images In The Terminal.md rename to translated/tech/20180510 How To Display Images In The Terminal.md From 33cee8462cf7d08265ed5d2a23befca245ad3519 Mon Sep 17 00:00:00 2001 From: Kevin Sicong Jiang Date: Fri, 25 May 2018 17:23:47 -0500 Subject: [PATCH 27/84] Update 20180524 How CERN Is Using Linux and Open Source.md --- .../tech/20180524 How CERN Is Using Linux and Open Source.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180524 How CERN Is Using Linux and Open Source.md b/sources/tech/20180524 How CERN Is Using Linux and Open Source.md index 958a255997..fd2437f251 100644 --- a/sources/tech/20180524 How CERN Is Using Linux and Open Source.md +++ b/sources/tech/20180524 How CERN Is Using Linux and Open Source.md @@ -1,3 +1,5 @@ +KevinSJ translating + How CERN Is Using Linux and Open Source ============================================================ From bb25533938f4bc6a74ac31c636af84163f56f22a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 May 2018 07:11:12 +0800 Subject: [PATCH 28/84] PRF:20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md @pinewall --- ...test Python3 Package On CentOS 6 System.md | 174 +++++++++--------- 1 file changed, 86 insertions(+), 88 deletions(-) diff --git a/translated/tech/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md b/translated/tech/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md index 984dbd3c31..ed2379552f 100644 --- a/translated/tech/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md +++ b/translated/tech/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md @@ -1,14 +1,13 @@ 在 CentOS 6 系统上安装最新版 Python3 软件包的 3 种方法 ====== + CentOS 克隆自 RHEL,无需付费即可使用。CentOS 是一个企业级标准的、前沿的操作系统,被超过 90% 的网络主机托管商采用,因为它提供了技术领先的服务器控制面板 cPanel/WHM。 该控制面板使得用户无需进入命令行即可通过其管理一切。 众所周知,RHEL 提供长期支持,出于稳定性考虑,不提供最新版本的软件包。 -如果你想安装的最新版本软件包不在默认源中,你需要手动编译源码安装。 - -但手动编译安装的方式有不小的风险,即如果出现新版本,无法升级手动安装的软件包;你不得不重新手动安装。 +如果你想安装的最新版本软件包不在默认源中,你需要手动编译源码安装。但手动编译安装的方式有不小的风险,即如果出现新版本,无法升级手动安装的软件包;你不得不重新手动安装。 那么在这种情况下,安装最新版软件包的推荐方法和方案是什么呢?是的,可以通过为系统添加所需的第三方源来达到目的。 @@ -18,19 +17,20 @@ CentOS 克隆自 RHEL,无需付费即可使用。CentOS 是一个企业级标 在本教程中,我们将向你展示,如何在 CentOS 6 操作系统上安装最新版本的 Python 3 软件包。 -### 方法 1:使用 Software Collections 源 (SCL) +### 方法 1:使用 Software Collections 源 (SCL) SCL 源目前由 CentOS SIG 维护,除了重新编译构建 Red Hat 的 Software Collections 外,还额外提供一些它们自己的软件包。 -该源中包含不少程序的更高版本,可以在不改变原有旧版本程序包的情况下安装,使用时需要通过 scl 命令调用。 +该源中包含不少程序的更高版本,可以在不改变原有旧版本程序包的情况下安装,使用时需要通过 `scl` 命令调用。 运行如下命令可以在 CentOS 上安装 SCL 源: + ``` # yum install centos-release-scl - ``` 检查可用的 Python 3 版本: + ``` # yum info rh-python35 Loaded plugins: fastestmirror, security @@ -38,149 +38,148 @@ Loading mirror speeds from cached hostfile * epel: ewr.edge.kernel.org * remi-safe: mirror.team-cymru.com Available Packages -Name : rh-python35 -Arch : x86_64 -Version : 2.0 -Release : 2.el6 -Size : 0.0 -Repo : installed -From repo : centos-sclo-rh -Summary : Package that installs rh-python35 -License : GPLv2+ +Name : rh-python35 +Arch : x86_64 +Version : 2.0 +Release : 2.el6 +Size : 0.0 +Repo : installed +From repo : centos-sclo-rh +Summary : Package that installs rh-python35 +License : GPLv2+ Description : This is the main package for rh-python35 Software Collection. - ``` -运行如下命令从 scl 源安装可用的最新版 python 3: +运行如下命令从 `scl` 源安装可用的最新版 python 3: + ``` # yum install rh-python35 - ``` -运行如下特殊的 scl 命令,在当前 shell 中启用安装的软件包: +运行如下特殊的 `scl` 命令,在当前 shell 中启用安装的软件包: + ``` # scl enable rh-python35 bash - ``` 运行如下命令检查安装的 python3 版本: + ``` # python --version Python 3.5.1 - ``` 运行如下命令获取系统已安装的 SCL 软件包列表: + ``` # scl -l rh-python35 - ``` -### 方法 2:使用 EPEL 源 (Extra Packages for Enterprise Linux) +### 方法 2:使用 EPEL 源 (Extra Packages for Enterprise Linux) -EPEL 是 Extra Packages for Enterprise Linux 的缩写,该源由 Fedora SIG (Special Interest Group) 维护。 +EPEL 是 Extra Packages for Enterprise Linux 的缩写,该源由 Fedora SIG (Special Interest Group)维护。 -该 SIG 为企业级 Linux 创建、维护并管理一系列高品质补充软件包,受益的企业级 Linux 发行版包括但不限于红帽企业级 Linux (RHEL), CentOS, Scientific Linux (SL) 和 Oracle Linux (OL)等。 +该 SIG 为企业级 Linux 创建、维护并管理了一系列高品质补充软件包,受益的企业级 Linux 发行版包括但不限于红帽企业级 Linux (RHEL)、 CentOS、 Scientific Linux (SL) 和 Oracle Linux (OL)等。 EPEL 通常基于 Fedora 对应代码提供软件包,不会与企业级 Linux 发行版中的基础软件包冲突或替换其中的软件包。 **推荐阅读:** [在 RHEL, CentOS, Oracle Linux 或 Scientific Linux 上安装启用 EPEL 源][1] EPEL 软件包位于 CentOS 的 Extra 源中,已经默认启用,故我们只需运行如下命令即可: + ``` # yum install epel-release - ``` 检查可用的 python 3 版本: + ``` # yum --disablerepo="*" --enablerepo="epel" info python34 Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * epel: ewr.edge.kernel.org Available Packages -Name : python34 -Arch : x86_64 -Version : 3.4.5 -Release : 4.el6 -Size : 50 k -Repo : epel -Summary : Version 3 of the Python programming language aka Python 3000 -URL : http://www.python.org/ -License : Python +Name : python34 +Arch : x86_64 +Version : 3.4.5 +Release : 4.el6 +Size : 50 k +Repo : epel +Summary : Version 3 of the Python programming language aka Python 3000 +URL : http://www.python.org/ +License : Python Description : Python 3 is a new version of the language that is incompatible with the 2.x - : line of releases. The language is mostly the same, but many details, especially - : how built-in objects like dictionaries and strings work, have changed - : considerably, and a lot of deprecated features have finally been removed. - - + : line of releases. The language is mostly the same, but many details, especially + : how built-in objects like dictionaries and strings work, have changed + : considerably, and a lot of deprecated features have finally been removed. ``` 运行如下命令从 EPEL 源安装可用的最新版 python 3 软件包: + ``` # yum --disablerepo="*" --enablerepo="epel" install python34 - ``` -默认情况下并不会安装 pip 和 setuptools,我们需要运行如下命令手动安装: +默认情况下并不会安装 `pip` 和 `setuptools`,我们需要运行如下命令手动安装: + ``` # curl -O https://bootstrap.pypa.io/get-pip.py - % Total % Received % Xferd Average Speed Time Time Time Current - Dload Upload Total Spent Left Speed -100 1603k 100 1603k 0 0 2633k 0 --:--:-- --:--:-- --:--:-- 4816k + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed +100 1603k 100 1603k 0 0 2633k 0 --:--:-- --:--:-- --:--:-- 4816k # /usr/bin/python3.4 get-pip.py Collecting pip - Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl + Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl Collecting setuptools - Downloading https://files.pythonhosted.org/packages/8c/10/79282747f9169f21c053c562a0baa21815a8c7879be97abd930dbcf862e8/setuptools-39.1.0-py2.py3-none-any.whl (566kB) - 100% |████████████████████████████████| 573kB 4.0MB/s + Downloading https://files.pythonhosted.org/packages/8c/10/79282747f9169f21c053c562a0baa21815a8c7879be97abd930dbcf862e8/setuptools-39.1.0-py2.py3-none-any.whl (566kB) + 100% |████████████████████████████████| 573kB 4.0MB/s Collecting wheel - Downloading https://files.pythonhosted.org/packages/1b/d2/22cde5ea9af055f81814f9f2545f5ed8a053eb749c08d186b369959189a8/wheel-0.31.0-py2.py3-none-any.whl (41kB) - 100% |████████████████████████████████| 51kB 8.0MB/s + Downloading https://files.pythonhosted.org/packages/1b/d2/22cde5ea9af055f81814f9f2545f5ed8a053eb749c08d186b369959189a8/wheel-0.31.0-py2.py3-none-any.whl (41kB) + 100% |████████████████████████████████| 51kB 8.0MB/s Installing collected packages: pip, setuptools, wheel Successfully installed pip-10.0.1 setuptools-39.1.0 wheel-0.31.0 - ``` 运行如下命令检查已安装的 python3 版本: + ``` # python3 --version Python 3.4.5 - ``` ### 方法 3:使用 IUS 社区源 -IUS 社区是 CentOS 社区批准的第三方 RPM 源,为企业级 Linux (RHEL 和 CentOS) 5, 6 和 7 版本提供最新上游版本的 PHP, Python, MySQL 等软件包。 +IUS 社区是 CentOS 社区批准的第三方 RPM 源,为企业级 Linux (RHEL 和 CentOS) 5、 6 和 7 版本提供最新上游版本的 PHP、 Python、 MySQL 等软件包。 IUS 社区源依赖于 EPEL 源,故我们需要先安装 EPEL 源,然后再安装 IUS 社区源。按照下面的步骤安装启用 EPEL 源和 IUS 社区源,利用该 RPM 系统安装软件包。 **推荐阅读:** [在 RHEL 或 CentOS 上安装启用 IUS 社区源][2] EPEL 软件包位于 CentOS 的 Extra 源中,已经默认启用,故我们只需运行如下命令即可: + ``` # yum install epel-release - ``` 下载 IUS 社区源安装脚本: + ``` # curl 'https://setup.ius.io/' -o setup-ius.sh - % Total % Received % Xferd Average Speed Time Time Time Current - Dload Upload Total Spent Left Speed -100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k - + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed +100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k ``` 安装启用 IUS 社区源: + ``` # sh setup-ius.sh - ``` 检查可用的 python 3 版本: + ``` # yum --enablerepo=ius info python36u Loaded plugins: fastestmirror, security @@ -189,46 +188,45 @@ Loading mirror speeds from cached hostfile * ius: mirror.team-cymru.com * remi-safe: mirror.team-cymru.com Available Packages -Name : python36u -Arch : x86_64 -Version : 3.6.5 -Release : 1.ius.centos6 -Size : 55 k -Repo : ius -Summary : Interpreter of the Python programming language -URL : https://www.python.org/ -License : Python +Name : python36u +Arch : x86_64 +Version : 3.6.5 +Release : 1.ius.centos6 +Size : 55 k +Repo : ius +Summary : Interpreter of the Python programming language +URL : https://www.python.org/ +License : Python Description : Python is an accessible, high-level, dynamically typed, interpreted programming - : language, designed with an emphasis on code readability. - : It includes an extensive standard library, and has a vast ecosystem of - : third-party libraries. - : - : The python36u package provides the "python3.6" executable: the reference - : interpreter for the Python language, version 3. - : The majority of its standard library is provided in the python36u-libs package, - : which should be installed automatically along with python36u. - : The remaining parts of the Python standard library are broken out into the - : python36u-tkinter and python36u-test packages, which may need to be installed - : separately. - : - : Documentation for Python is provided in the python36u-docs package. - : - : Packages containing additional libraries for Python are generally named with - : the "python36u-" prefix. - + : language, designed with an emphasis on code readability. + : It includes an extensive standard library, and has a vast ecosystem of + : third-party libraries. + : + : The python36u package provides the "python3.6" executable: the reference + : interpreter for the Python language, version 3. + : The majority of its standard library is provided in the python36u-libs package, + : which should be installed automatically along with python36u. + : The remaining parts of the Python standard library are broken out into the + : python36u-tkinter and python36u-test packages, which may need to be installed + : separately. + : + : Documentation for Python is provided in the python36u-docs package. + : + : Packages containing additional libraries for Python are generally named with + : the "python36u-" prefix. ``` 运行如下命令从 IUS 源安装最新可用版本的 python 3 软件包: + ``` # yum --enablerepo=ius install python36u - ``` 运行如下命令检查已安装的 python3 版本: + ``` # python3.6 --version Python 3.6.5 - ``` -------------------------------------------------------------------------------- @@ -238,7 +236,7 @@ via: https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-cen 作者:[PRAKASH SUBRAMANIAN][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[pinewall](https://github.com/pinewall) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4764932195e961d8855ddd5b3e3739b348e2ec64 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 May 2018 07:11:39 +0800 Subject: [PATCH 29/84] PUB:20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md @pinewall https://linux.cn/article-9680-1.html --- ...ethods To Install Latest Python3 Package On CentOS 6 System.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md (100%) diff --git a/translated/tech/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md b/published/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md similarity index 100% rename from translated/tech/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md rename to published/20180509 3 Methods To Install Latest Python3 Package On CentOS 6 System.md From 05f75c63aaf91ad6a0084e0d30704ef2debab876 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 May 2018 08:06:41 +0800 Subject: [PATCH 30/84] PRF:20180327 Loop better- A deeper look at iteration in Python.md @MjSeven --- ...r- A deeper look at iteration in Python.md | 360 +++++------------- 1 file changed, 105 insertions(+), 255 deletions(-) diff --git a/translated/tech/20180327 Loop better- A deeper look at iteration in Python.md b/translated/tech/20180327 Loop better- A deeper look at iteration in Python.md index 32cd9842e7..e5de0dea0c 100644 --- a/translated/tech/20180327 Loop better- A deeper look at iteration in Python.md +++ b/translated/tech/20180327 Loop better- A deeper look at iteration in Python.md @@ -1,9 +1,11 @@ -Loop better:更深入的理解Python 中的迭代 +更深入的理解 Python 中的迭代 ==== +> 深入探讨 Python 的 `for` 循环来看看它们在底层如何工作,以及为什么它们会按照它们的方式工作。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pez-candy.png?itok=tRoOn_iy) -Python 的 `for` 循环不会像其他语言中的 `for` 循环那样工作。在这篇文章中,我们将深入探讨 Python 的 `for` 循环来看看它们如何在底层工作,以及为什么它们会按照它们的方式工作。 +Python 的 `for` 循环不会像其他语言中的 `for` 循环那样工作。在这篇文章中,我们将深入探讨 Python 的 `for` 循环来看看它们在底层如何工作,以及为什么它们会按照它们的方式工作。 ### 循环的问题 @@ -12,27 +14,24 @@ Python 的 `for` 循环不会像其他语言中的 `for` 循环那样工作。 #### 问题 1:循环两次 假设我们有一个数字列表和一个生成器,生成器会返回这些数字的平方: + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> squares = (n**2 for n in numbers) - ``` 我们可以将生成器对象传递给 `tuple` 构造器,从而使其变为一个元组: + ``` >>> tuple(squares) - (1, 4, 9, 25, 49) - ``` -如果我们使用相同的生成器对象并将其传给 `sum` 函数,我们可能会期望得到这些数的和,即 88。 +如果我们使用相同的生成器对象并将其传给 `sum` 函数,我们可能会期望得到这些数的和,即 `88`。 + ``` >>> sum(squares) - 0 - ``` 但是我们得到了 `0`。 @@ -40,6 +39,7 @@ Python 的 `for` 循环不会像其他语言中的 `for` 循环那样工作。 #### 问题 2:包含的检查 让我们使用相同的数字列表和相同的生成器对象: + ``` >>> numbers = [1, 2, 3, 5, 7] @@ -48,15 +48,12 @@ Python 的 `for` 循环不会像其他语言中的 `for` 循环那样工作。 ``` 如果我们询问 `9` 是否在 `squares` 生成器中,Python 将会告诉我们 9 在 `squares` 中。但是如果我们再次询问相同的问题,Python 会告诉我们 9 不在 `squares` 中。 + ``` >>> 9 in squares - True - >>> 9 in squares - False - ``` 我们询问相同的问题两次,Python 给了两个不同的答案。 @@ -64,57 +61,51 @@ False #### 问题 3 :拆包 这个字典有两个键值对: + ``` >>> counts = {'apples': 2, 'oranges': 1} - ``` 让我们使用多个变量来对这个字典进行拆包: + ``` >>> x, y = counts - ``` 你可能会期望当我们对这个字典进行拆包时,我们会得到键值对或者得到一个错误。 但是解包字典不会引发错误,也不会返回键值对。当你解包一个字典时,你会得到键: + ``` >>> x - 'apples' - ``` -### 回顾:Python 的 __for__ 循环 +### 回顾:Python 的 for 循环 在我们了解一些关于这些 Python 片段的逻辑之后,我们将回到这些问题。 Python 没有传统的 `for` 循环。为了解释我的意思,让我们看一看另一种编程语言的 `for` 循环。 这是一种传统 C 风格的 `for` 循环,用 JavaScript 编写: + ``` let numbers = [1, 2, 3, 5, 7]; - for (let i = 0; i < numbers.length; i += 1) { -     print(numbers[i]) - } - ``` -JavaScript, C, C++, Java, PHP, 和一大堆其他编程语言都有这种风格的 `for` 循环,但是 Python **确实没**。 +JavaScript、 C、 C++、 Java、 PHP 和一大堆其他编程语言都有这种风格的 `for` 循环,但是 Python **确实没有**。 -Python **确实没** 有传统 C 风格的 `for` 循环。在 Python 中确实有一些我们称之为 `for` 循环的东西,但是它的工作方式类似于 [foreach loop][1]。 +Python **确实没有** 传统 C 风格的 `for` 循环。在 Python 中确实有一些我们称之为 `for` 循环的东西,但是它的工作方式类似于 [foreach 循环][1]。 这是 Python 的 `for` 循环的风格: + ``` numbers = [1, 2, 3, 5, 7] - for n in numbers: -     print(n) - ``` 与传统 C 风格的 `for` 循环不同,Python 的 `for` 循环没有索引变量,没有索引变量初始化,边界检查,或者索引递增。Python 的 `for` 循环完成了对我们的 `numbers` 列表进行遍历的所有工作。 @@ -126,98 +117,75 @@ for n in numbers: 既然我们已经解决了 Python 世界中无索引的 `for` 循环,那么让我们在此之外来看一些定义。 **可迭代**是任何你可以用 Python 中的 `for` 循环遍历的东西。可迭代意味着可以遍历,任何可以遍历的东西都是可迭代的。 + ``` for item in some_iterable: -     print(item) - ``` 序列是一种非常常见的可迭代类型,列表,元组和字符串都是序列。 + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> coordinates = (4, 5, 7) - >>> words = "hello there" - ``` 序列是可迭代的,它有一些特定的特征集。它们可以从 `0` 开始索引,以小于序列的长度结束,它们有一个长度并且它们可以被切分。列表,元组,字符串和其他所有序列都是这样工作的。 + ``` >>> numbers[0] - 1 - >>> coordinates[2] - 7 - >>> words[4] - 'o' - ``` -Python 中很多东西都是可迭代的,但不是所有可迭代的东西都是序列。集合,字典,文件和生成器都是可迭代的,但是它们都不是序列。 +Python 中很多东西都是可迭代的,但不是所有可迭代的东西都是序列。集合、字典、文件和生成器都是可迭代的,但是它们都不是序列。 + ``` >>> my_set = {1, 2, 3} - >>> my_dict = {'k1': 'v1', 'k2': 'v2'} - >>> my_file = open('some_file.txt') - >>> squares = (n**2 for n in my_set) - ``` 因此,任何可以用 `for` 循环遍历的东西都是可迭代的,序列只是一种可迭代的类型,但是 Python 也有许多其他种类的迭代器。 -### Python 的 __for__ 循环不使用索引 +### Python 的 for 循环不使用索引 + +你可能认为,Python 的 `for` 循环在底层使用了索引进行循环。在这里我们使用 `while` 循环和索引手动遍历: -你可能认为,在 hood 下的 `for` 循环中使用索引进行循环。在这里我们使用 `while` 循环和索引手动遍历: ``` numbers = [1, 2, 3, 5, 7] - i = 0 - while i < len(numbers): -     print(numbers[i]) -     i += 1 - ``` 这适用于列表,但它不会对所有东西都起作用。这种循环方式**只适用于序列**。 如果我们尝试用索引去手动遍历一个集合,我们会得到一个错误: + ``` >>> fruits = {'lemon', 'apple', 'orange', 'watermelon'} - >>> i = 0 - >>> while i < len(fruits): - ...     print(fruits[i]) - ...     i += 1 - ... - Traceback (most recent call last): - File "", line 2, in - TypeError: 'set' object does not support indexing - ``` 集合不是序列,所以它们不支持索引。 我们不能使用索引手动对 Python 中的每一个迭代对象进行遍历。对于那些不是序列的迭代器来说,这是行不通的。 -### 迭代器驱动 __for__ 循环 +### 迭代器驱动 for 循环 因此,我们已经看到,Python 的 `for` 循环在底层不使用索引。相反,Python 的 `for` 循环使用**迭代器**。 @@ -226,148 +194,116 @@ TypeError: 'set' object does not support indexing 让我们来看看它是如何工作的。 这里有三个可迭代对象:一个集合,一个元组和一个字符串。 + ``` >>> numbers = {1, 2, 3, 5, 7} - >>> coordinates = (4, 5, 7) - >>> words = "hello there" - ``` 我们可以使用 Python 的内置 `iter` 函数来访问这些迭代器,将一个迭代器传递给 `iter` 函数总会给我们返回一个迭代器,无论我们正在使用哪种类型的迭代器。 + ``` >>> iter(numbers) - - >>> iter(coordinates) - - >>> iter(words) - - ``` 一旦我们有了迭代器,我们可以做的事情就是通过将它传递给内置的 `next` 函数来获取它的下一项。 ``` >>> numbers = [1, 2, 3] - >>> my_iterator = iter(numbers) - >>> next(my_iterator) - 1 - >>> next(my_iterator) - 2 - ``` 迭代器是有状态的,这意味着一旦你从它们中消耗了一项,它就消失了。 如果你从迭代器中请求 `next` 项,但是其中没有更多的项了,你将得到一个 `StopIteration` 异常: + ``` >>> next(my_iterator) - 3 - >>> next(my_iterator) - Traceback (most recent call last): -   File "", line 1, in - StopIteration - ``` 所以你可以从每个迭代中获得一个迭代器,迭代器唯一能做的事情就是用 `next` 函数请求它们的下一项。如果你将它们传递给 `next`,但它们没有下一项了,那么就会引发 `StopIteration` 异常。 -你可以将迭代器想象成 Pez 分配器(译注:Pez 是一个结合玩具的独特复合式糖果),不能重新分配。你可以把 Pez 拿出去,但是一旦 Pez 被移走,它就不能被放回去,一旦分配器空了,它就没用了。 +你可以将迭代器想象成 Pez 分配器(LCTT 译注:Pez 是一个结合玩具的独特复合式糖果),不能重新分配。你可以把 Pez 拿出去,但是一旦 Pez 被移走,它就不能被放回去,一旦分配器空了,它就没用了。 -### 没有 __for__ 的循环 +### 没有 for 的循环 既然我们已经了解了迭代器和 `iter` 以及 `next` 函数,我们将尝试在不使用 `for` 循环的情况下手动遍历迭代器。 我们将通过尝试将这个 `for` 循环变为 `while` 循环: + ``` def funky_for_loop(iterable, action_to_do): -     for item in iterable: -         action_to_do(item) - ``` 为了做到这点,我们需要: + 1. 从给定的可迭代对象中获得迭代器 2. 反复从迭代器中获得下一项 3. 如果我们成功获得下一项,就执行 `for` 循环的主体 4. 如果我们在获得下一项时得到了一个 `StopIteration` 异常,那么就停止循环 - - ``` + def funky_for_loop(iterable, action_to_do): -     iterator = iter(iterable) -     done_looping = False -     while not done_looping: -         try: -             item = next(iterator) -         except StopIteration: -             done_looping = True -         else: -             action_to_do(item) - ``` 我们只是通过使用 `while` 循环和迭代器重新定义了 `for` 循环。 上面的代码基本上定义了 Python 在底层循环的工作方式。如果你理解内置的 `iter` 和 `next` 函数的遍历循环的工作方式,那么你就会理解 Python 的 `for` 循环是如何工作的。 -事实上,你不仅仅会理解 `for` 循环在 Python 中式如何工作的,所有形式的遍历一个可迭代对象都是这样工作的。 +事实上,你不仅仅会理解 `for` 循环在 Python 中是如何工作的,所有形式的遍历一个可迭代对象都是这样工作的。 -**迭代器协议** 是一种很好的方式,它表示 "在 Python 中遍历迭代器是如何工作的"。它本质上是对 `iter` 和 `next` 函数在 Python 中是如何工作的定义。Python 中所有形式的迭代都是由迭代器协议驱动的。 +迭代器协议iterator protocol 是一种很好表示 “在 Python 中遍历迭代器是如何工作的”的方式。它本质上是对 `iter` 和 `next` 函数在 Python 中是如何工作的定义。Python 中所有形式的迭代都是由迭代器协议驱动的。 迭代器协议被 `for` 循环使用(正如我们已经看到的那样): + ``` for n in numbers: -     print(n) - ``` 多重赋值也使用迭代器协议: + ``` x, y, z = coordinates - ``` 星型表达式也是用迭代器协议: + ``` a, b, *rest = numbers - print(*numbers) - ``` 许多内置函数依赖于迭代器协议: + ``` unique_numbers = set(numbers) - ``` 在 Python 中任何与迭代器一起工作的东西都可能以某种方式使用迭代器协议。每当你在 Python 中遍历一个可迭代对象时,你将依赖于迭代器协议。 @@ -379,41 +315,31 @@ unique_numbers = set(numbers) 我有消息告诉你:在 Python 中直接使用迭代器是很常见的。 这里的 `squares` 对象是一个生成器: + ``` >>> numbers = [1, 2, 3] - >>> squares = (n**2 for n in numbers) - ``` 生成器是迭代器,这意味着你可以在生成器上调用 `next` 来获得它的下一项: + ``` >>> next(squares) - 1 - >>> next(squares) - 4 - ``` 但是如果你以前用过生成器,你可能也知道可以循环遍历生成器: + ``` >>> squares = (n**2 for n in numbers) - >>> for n in squares: - ...     print(n) - ... - 1 - 4 - 9 - ``` 如果你可以在 Python 中循环遍历某些东西,那么它就是**可迭代的**。 @@ -424,90 +350,84 @@ unique_numbers = set(numbers) 所以在我之前解释迭代器如何工作时,我跳过了它们的某些重要的细节。 -**生成器是可迭代的。** +#### 生成器是可迭代的 我再说一遍:Python 中的每一个迭代器都是可迭代的,意味着你可以循环遍历迭代器。 因为迭代器也是可迭代的,所以你可以使用内置 `next` 函数从可迭代对象中获得迭代器: + ``` >>> numbers = [1, 2, 3] - >>> iterator1 = iter(numbers) - >>> iterator2 = iter(iterator1) - ``` 请记住,当我们在可迭代对象上调用 `iter` 时,它会给我们返回一个迭代器。 当我们在迭代器上调用 `iter` 时,它会给我们返回它自己: + ``` >>> iterator1 is iterator2 - True - ``` 迭代器是可迭代的,所有的迭代器都是它们自己的迭代器。 + ``` def is_iterator(iterable): -     return iter(iterable) is iterable - ``` 迷惑了吗? 让我们回顾一些这些措辞。 + * 一个**可迭代对象**是你可以迭代的东西 -* 一个**可迭代对象**是一种可以迭代遍历迭代的代理 -(这句话不是很理解) +* 一个**迭代对象器**是一种实际上遍历可迭代对象的代理 此外,在 Python 中迭代器也是可迭代的,它们充当它们自己的迭代器。 所以迭代器是可迭代的,但是它们没有一些可迭代对象拥有的各种特性。 迭代器没有长度,它们不能被索引: + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> iterator = iter(numbers) - >>> len(iterator) - TypeError: object of type 'list_iterator' has no len() - >>> iterator[0] - TypeError: 'list_iterator' object is not subscriptable - ``` 从我们作为 Python 程序员的角度来看,你可以使用迭代器来做的唯一有用的事情是将其传递给内置的 `next` 函数,或者对其进行循环遍历: + ``` >>> next(iterator) - 1 - >>> list(iterator) - [2, 3, 5, 7] - ``` 如果我们第二次循环遍历迭代器,我们将一无所获: + ``` >>> list(iterator) - [] - ``` 你可以把迭代器看作是**惰性迭代器**,它们是**一次性使用**,这意味着它们只能循环遍历一次。 正如你在下面的真值表中所看到的,可迭代对象并不总是迭代器,但是迭代器总是可迭代的: -可迭代对象?迭代器?可迭代的? ✔️ ❓ 迭代器 ✔️ ✔️ 生成器 ✔️ ✔️ 列表 ✔️ ❌ + +对象 | 可迭代? | 迭代器? +---------|---------|------ +可迭代对象 | V | ? +迭代器 | V | V +生成器 | V | V +列表 | V | X + ### 全部的迭代器协议 @@ -535,45 +455,33 @@ TypeError: 'list_iterator' object is not subscriptable ### 迭代器无处不在 你已经在 Python 中看到过许多迭代器,我也提到过生成器是迭代器。Python 的许多内置类型也是迭代器。例如,Python 的 `enumerate` 和 `reversed` 对象就是迭代器。 + ``` >>> letters = ['a', 'b', 'c'] - >>> e = enumerate(letters) - >>> e - - >>> next(e) - (0, 'a') - ``` 在 Python 3 中,`zip`, `map` 和 `filter` 也是迭代器。 + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> letters = ['a', 'b', 'c'] - >>> z = zip(numbers, letters) - >>> z - - >>> next(z) - (1, 'a') - ``` -Python 中的 文件对象也是迭代器。 +Python 中的文件对象也是迭代器。 + ``` >>> next(open('hello.txt')) - 'hello world\n' - ``` 在 Python 标准库和第三方库中内置了大量的迭代器。这些迭代器首先惰性迭代器一样,延迟工作直到你请求它们下一项。 @@ -584,51 +492,37 @@ Python 中的 文件对象也是迭代器。 知道你已经在使用迭代器是很有用的,但是我希望你也知道,你可以创建自己的迭代器和你自己的惰性迭代器。 下面这个类构造了一个迭代器接受一个可迭代的数字,并在循环结束时提供每个数字的平方。 + ``` class square_all: -     def __init__(self, numbers): -         self.numbers = iter(numbers) -     def __next__(self): -         return next(self.numbers) * 2 -     def __iter__(self): -         return self - ``` 但是在我们开始对该类的实例进行循环遍历之前,没有任何工作要做。 这里,我们有一个无限长的可迭代对象 `count`,你可以看到 `square_all` 接受 `count` 而不用完全循环遍历这个无限长的迭代: + ``` >>> from itertools import count - >>> numbers = count(5) - >>> squares = square_all(numbers) - >>> next(squares) - 25 - >>> next(squares) - 36 - ``` 这个迭代器类是有效的,但我们通常不会这样做。通常,当我们想要做一个定制的迭代器时,我们会生成一个生成器函数: + ``` def square_all(numbers): - for n in numbers: - yield n**2 - ``` 这个生成器函数等价于我们上面所做的类,它的工作原理是一样的。 @@ -636,14 +530,13 @@ def square_all(numbers): 这种 `yield` 语句似乎很神奇,但它非常强大:`yield` 允许我们在调用 `next` 函数之间暂停生成器函数。`yield` 语句是将生成器函数与常规函数分离的东西。 另一种实现相同迭代器的方法是使用生成器表达式。 + ``` def square_all(numbers): - return (n**2 for n in numbers) - ``` -这和我们的生成器函数确实是一样的,但是它使用的语法看起来[像列表一样容易理解][2]。如果你需要在代码中使用惰性迭代,请考虑迭代器,并考虑使用生成器函数或生成器表达式。 +这和我们的生成器函数确实是一样的,但是它使用的语法看起来[像是一个列表推导一样][2]。如果你需要在代码中使用惰性迭代,请考虑迭代器,并考虑使用生成器函数或生成器表达式。 ### 迭代器如何改进你的代码 @@ -652,33 +545,24 @@ def square_all(numbers): #### 惰性求和 这是一个 `for` 循环,它对 Django queryset 中的所有工作时间求和: + ``` hours_worked = 0 - for event in events: - if event.is_billable(): - hours_worked += event.duration - ``` 下面是使用生成器表达式进行惰性评估的代码: + ``` billable_times = ( - event.duration - for event in events - if event.is_billable() - ) - - hours_worked = sum(billable_times) - ``` 请注意,我们代码的形状发生了巨大变化。 @@ -688,27 +572,21 @@ hours_worked = sum(billable_times) #### 惰性和打破循环 这段代码打印出日志文件的前 10 行: + ``` for i, line in enumerate(log_file): - if i >= 10: - break - print(line) - ``` 这段代码做了同样的事情,但是我们使用的是 `itertools.islice` 函数来惰性地抓取文件中的前 10 行: + ``` from itertools import islice - first_ten_lines = islice(log_file, 10) - for line in first_ten_lines: - print(line) - ``` 我们定义的 `first_ten_lines` 变量是迭代器,同样,使用迭代器允许我们给以前未命名的东西命名(`first_ten_lines`)。命名事物可以使我们的代码更具描述性,更具可读性。 @@ -722,15 +600,12 @@ for line in first_ten_lines: 你可以在标准库和第三方库中找到用于循环的辅助函数,但你也可以自己创建! 这段代码列出了序列中连续值之间的差值列表。 + ``` current = readings[0] - for next_item in readings[1:]: - differences.append(next_item - current) - current = next_item - ``` 请注意,这段代码中有一个额外的变量,我们每次循环时都要指定它。还要注意,这段代码只适用于我们可以切片的东西,比如序列。如果 `readings` 是一个生成器,一个 zip 对象或其他任何类型的迭代器,那么这段代码就会失败。 @@ -738,47 +613,36 @@ for next_item in readings[1:]: 让我们编写一个辅助函数来修复代码。 这是一个生成器函数,它为给定的迭代中的每个项目提供了当前项和下一项: + ``` def with_next(iterable): - """Yield (current, next_item) tuples for each item in iterable.""" - iterator = iter(iterable) - current = next(iterator) - for next_item in iterator: - yield current, next_item - current = next_item - ``` 我们从可迭代对象中手动获取一个迭代器,在它上面调用 `next` 来获取第一项,然后循环遍历迭代器获取后续所有的项目,跟踪后一个项目。这个函数不仅适用于序列,而且适用于任何类型迭代。 -这段代码和以前代码是一样的,但是我们使用的是辅助函数而不是手动跟踪 `next_item`: +这段代码和以前代码是一样的,但是我们使用的是辅助函数而不是手动跟踪 `next_item`: + ``` differences = [] - for current, next_item in with_next(readings): - differences.append(next_item - current) - ``` 请注意,这段代码不会挂在我们循环周围的 `next_item` 上,`with_next` 生成器函数处理跟踪 `next_item` 的工作。 -还要注意,这段代码已足够紧凑,如果我们愿意,我们甚至可以[将方法复制到列表中来理解][2]。 +还要注意,这段代码已足够紧凑,如果我们愿意,我们甚至可以[将方法复制到列表推导中来][2]。 + ``` differences = [ - (next_item - current) - for current, next_item in with_next(readings) - ] - ``` ### 再次回顾循环问题 @@ -787,40 +651,34 @@ differences = [ #### 问题 1:耗尽的迭代器 -这里我们有一个生成器对象 `squares`: +这里我们有一个生成器对象 `squares`: + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> squares = (n**2 for n in numbers) - ``` 如果我们把这个生成器传递给 `tuple` 构造函数,我们将会得到它的一个元组: + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> squares = (n**2 for n in numbers) - >>> tuple(squares) - (1, 4, 9, 25, 49) - ``` -如果我们试着计算这个生成器中数字的和,使用 `sum`,我们就会得到 `0`: +如果我们试着计算这个生成器中数字的和,使用 `sum`,我们就会得到 `0`: + ``` >>> sum(squares) - 0 - ``` 这个生成器现在是空的:我们已经把它耗尽了。如果我们试着再次创建一个元组,我们会得到一个空元组: + ``` >>> tuple(squares) - () - ``` 生成器是迭代器,迭代器是一次性的。它们就像 Hello Kitty Pez 分配器那样不能重新加载。 @@ -828,43 +686,35 @@ differences = [ #### 问题 2:部分消耗一个迭代器 再次使用那个生成器对象 `squares`: + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> squares = (n**2 for n in numbers) - ``` -如果我们询问 `9` 是否在 `squares` 生成器中,我们会得到 `True`: +如果我们询问 `9` 是否在 `squares` 生成器中,我们会得到 `True`: + ``` >>> 9 in squares - True - ``` -但是我们再次询问相同的问题,我们会得到 `False`: +但是我们再次询问相同的问题,我们会得到 `False`: + ``` >>> 9 in squares - False - ``` 当我们询问 `9` 是否在迭代器中时,Python 必须对这个生成器进行循环遍历来找到 `9`。如果我们在检查了 `9` 之后继续循环遍历,我们只会得到最后两个数字,因为我们已经在找到 9 之前消耗了这些数字: + ``` >>> numbers = [1, 2, 3, 5, 7] - >>> squares = (n**2 for n in numbers) - >>> 9 in squares - True - >>> list(squares) - [25, 49] - ``` 询问迭代器中是否包含某些东西将会部分地消耗迭代器。如果没有循环遍历迭代器,那么是没有办法知道某个东西是否在迭代器中。 @@ -872,36 +722,29 @@ True #### 问题 3:拆包是迭代 当你在字典上循环时,你会得到键: + ``` >>> counts = {'apples': 2, 'oranges': 1} - >>> for key in counts: - ... print(key) - ... - apples - oranges - ``` 当你对一个字典进行拆包时,你也会得到键: + ``` >>> x, y = counts - >>> x, y - ('apples', 'oranges') - ``` 循环依赖于迭代器协议,可迭代对象拆包也依赖于有迭代器协议。拆包一个字典与在字典上循环遍历是一样的,两者都使用迭代器协议,所以在这两种情况下都得到相同的结果。 ### 回顾 -序列是迭代器,但是不是所有的迭代器都是序列。当有人说“迭代器”这个词时,你只能假设他们的意思是“你可以迭代的东西”。不要假设迭代器可以被循环遍历两次,询问它们的长度,或者索引。 +序列是迭代器,但是不是所有的迭代器都是序列。当有人说“迭代器”这个词时,你只能假设他们的意思是“你可以迭代的东西”。不要假设迭代器可以被循环遍历两次、询问它们的长度或者索引。 迭代器是 Python 中最基本的可迭代形式。如果你想在代码中做一个惰性迭代,请考虑迭代器,并考虑使用生成器函数或生成器表达式。 @@ -909,8 +752,15 @@ oranges 这里有一些我推荐的相关文章和视频: -本文是基于作者去年在 [DjangoCon AU][6], [PyGotham][7] 和 [North Bay Python][8] 中发表的 Loop Better 演讲。有关更多内容,请参加将于 2018 年 5 月 9 日至 17 日在 Columbus, Ohio 举办的 [PYCON][9]。 +- [Loop Like a Native](https://nedbatchelder.com/text/iter.html), Ned Batchelder 在 PyCon 2013 的讲演 +- [Loop Better](https://www.youtube.com/watch?v=V2PkkMS2Ack) ,这篇文章是基于这个讲演的 +- [The Iterator Protocol: How For Loops Work](http://treyhunner.com/2016/12/python-iterator-protocol-how-for-loops-work/),我写的关于迭代器协议的短文 +- [Comprehensible Comprehensions](https://www.youtube.com/watch?v=5_cJIcgM7rw),关于推导和迭代器表达器的讲演 +- [Python: Range is Not an Iterator](http://treyhunner.com/2018/02/python-range-is-not-an-iterator/),我关于范围和迭代器的文章 +- [Looping Like a Pro in Python](https://www.youtube.com/watch?v=u8g9scXeAcI),DB 的 PyCon 2017 讲演 + +本文是基于作者去年在 [DjangoCon AU][6]、 [PyGotham][7] 和 [North Bay Python][8] 中发表的 Loop Better 演讲。有关更多内容,请参加将于 2018 年 5 月 9 日至 17 日在 Columbus, Ohio 举办的 [PYCON][9]。 -------------------------------------------------------------------------------- @@ -919,7 +769,7 @@ via: https://opensource.com/article/18/3/loop-better-deeper-look-iteration-pytho 作者:[Trey Hunner][a] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d819f0cea762cc51d090d1aa642e15b433e2ee8b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 May 2018 08:07:16 +0800 Subject: [PATCH 31/84] PUB:20180327 Loop better- A deeper look at iteration in Python.md @MjSeven https://linux.cn/article-9681-1.html --- .../20180327 Loop better- A deeper look at iteration in Python.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180327 Loop better- A deeper look at iteration in Python.md (100%) diff --git a/translated/tech/20180327 Loop better- A deeper look at iteration in Python.md b/published/20180327 Loop better- A deeper look at iteration in Python.md similarity index 100% rename from translated/tech/20180327 Loop better- A deeper look at iteration in Python.md rename to published/20180327 Loop better- A deeper look at iteration in Python.md From a0781242f17d21fed497e0d4538f99eec6beac9d Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Sat, 26 May 2018 10:43:00 +0800 Subject: [PATCH 32/84] Create 20180424 Things You Should Know About Ubuntu 18.04.md --- ...ings You Should Know About Ubuntu 18.04.md | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md diff --git a/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md b/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md new file mode 100644 index 0000000000..1e5ce8c6af --- /dev/null +++ b/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md @@ -0,0 +1,166 @@ +你应该知道关于 Ubuntu 18.04 的一些事 +====== + +[Ubuntu 18.04 版本][1] 即将到来。我可以在各种 Facebook 群组和论坛中看到许多来自 Ubuntu 用户的提问。我还在 Facebook 和 Instagram 上组织了 Q&A 会议,以了解 Ubuntu 用户对 Ubuntu 18.04 的想法。 + +我试图在这里回答关于 Ubuntu 18.04 的常见问题。如果您有任何疑问,我希望这能帮助您解决疑问。如果您仍有问题,请随时在下面的评论区提问。 + +### Ubuntu 18.04 中有什么值得期待 + +![Ubuntu 18.04 Frequently Asked Questions][2] + +解释一下,这里的一些问答会受到我个人的影响。如果您是一位经验丰富或了解 Ubuntu 的用户,其中一些问题可能对您而言很简单。如果是这样的话,就请忽略这些问题。 + +#### 我能够在 Ubuntu 18.04 中安装 Unity 吗? + +当然能够哦! + +Canonical 公司知道有些人喜欢 Unity。这就是为什么它已经在 Universe 软件库(LCTT译者注:社区维护的软件库)中提供了 Unity 7。但这是一个社区维护版,官方并不直接参与开发。 + +但我建议是使用默认的 GNOME,除非您真的无法容忍它,再在 [Ubuntu 18.04 上安装 Unity][3]。 + +#### GNOME 是什么版本? + +在这次发行的 Ubuntu 18.04 版本中,GNOME 版本号是 3.28。 + +#### 我能够安装 vanilla GNOME? + +当然没问题! + +因为存在一些 GNOME 用户可能不喜欢 Ubuntu 18.04 中的 Unity 风格。在 Ubuntu 中的 main(LCTT译者注:官方支持的软件库)和 universe 软件库有安装包可安装,能使您在 [Ubuntu 18.04 中安装 vanilla GNOME][4]。 + +#### GNOME中的内存泄漏已修复了吗? + +已经修复了。[GNOME 3.28 中臭名昭着的内存泄漏][5] 已经被修复了,并且 [Ubuntu 官方已经在测试这个修复程序][6]。 + +澄清一点,内存泄漏不是由 Ubuntu 系统引起的。它影响了所有使用 GNOME 3.28 的 Linux 发行版。GNOME 3.28.1 发布了一个新的补丁修复内存泄漏问题。 + +#### Ubuntu 18.04 将会被支持多久? + +这是一个长期支持(LTS)版本,与任何 LTS 版本一样,官方会支持五年。这意味着 Ubuntu 18.04 将在 2023 年 4 月之前能获得安全和维护更新。这对于除 Ubuntu Studio 之外的所有基于 Ubuntu 的 Linux 发行版也一样。 + +#### Ubuntu 18.04 什么时候会发布? + +Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行版,如 Kubuntu,Lubuntu,Xubuntu,Budgie,MATE 等都会在同一天发布其 18.04 版本。 + +不过 [Ubuntu Studio 不会有 18.04 的 LTS 版本][7]。 + +#### 是否能从16.04/17.10升级到 Ubuntu 18.04?我可以从使用 Unity 的 Ubuntu 16.04 升级到使用 GNOME 的 Ubuntu 18.04 吗? + +绝对没问题。当 Ubuntu 18.04 LTS 发布后,您可以很容易的升级到最新版。 + +如果您使用的是 Ubuntu 17.10,请确保在软件和更新->更新中,将“有新版本时通知我”设置为“适用任何新版本”。 + + +![Get notified for a new version in Ubuntu][8] + +如果您使用的是 Ubuntu 16.04,请确保在软件和更新->更新中,将“有新版本时通知我”设置为“适用长期支持版本”。 + + +![Ubuntu 18.04 upgrade from Ubuntu 16.04][9] + +然后您应该能获得有关新版本更新的系统通知。之后,升级到 Ubuntu 18.04 只需要点击几下鼠标而已。 + +即使 Ubuntu 16.04 使用的是 Unity,但您仍然可以 [升级到使用 GNOME 的 Ubuntu 18.04][10]。 + + +#### 升级到 Ubuntu 18.04 意味着什么?我会丢失数据吗? + + +如果您使用的是 Ubuntu 17.10 或 Ubuntu 16.04,系统会提示您可升级到 Ubuntu 18.04。如果您从互联网上下载 1.5 Gb 的数据不成问题,则只需点击几下鼠标,即可在 30 分钟内升级到 Ubuntu 18.04。 + +您不需要通过 U 盘来重装系统。升级过程完成后,您将可以使用新的 Ubuntu 版本。 + +通常,您的数据和文档等在升级过程中是安全的。但是,对重要文档进行备份始终是一个好的习惯。 + +#### 我什么时候能升级到 Ubuntu 18.04? + +如果您使用的是 Ubuntu 17.10 并且正确设置(设置方法在之前提到的问题中),那么在 Ubuntu 18.04 发布的几天内应该会通知您升级到 Ubuntu 18.04。为避免 Ubuntu 服务器在发布日期负载量过大,因此不是每个人都会在同一天收到升级提示。 + +对于 Ubuntu 16.04 用户,可能需要几周时间才能正式收到 Ubuntu 18.04 升级提示。通常,这将在第一次发布 Ubuntu 18.04.1 之后提示。该版本修复了 18.04 中发现的新 bug。 + +#### 如果我升级到 Ubuntu 18.04,我可以降级到 17.10/16.04? + +抱歉,并不行。尽管升级到新版本很容易,但没有降级的选项。如果您想回到 Ubuntu 16.04,只能重新安装。 + +#### 我能使用 Ubuntu 18.04 在 32 位系统上吗? + +可以,但最好不要这样做。 + +如果您已经在使用 32 位版本的 Ubuntu 16.04 或 17.10,您依旧可以升级到 Ubuntu 18.04。 但是,您找到不到 32 位的 Ubuntu 18.04 ISO 镜像。换句话说,您无法安装 32 位版本的 Ubuntu 18.04。 + + +有一个好消息是,Ubuntu MATE,Lubuntu 等其他官方版本仍然具有其新版本的 32 位 ISO 镜像。 + +无论如何,如果您使用一个 32 位系统,那么很可能您的计算机硬件性能过低。在这样的电脑上使用轻量级 [Ubuntu MATE][11] 或 [Lubuntu][12] 系统会更好。 + + +#### 我可以在哪下载 Ubuntu 18.04? + +一旦发布了 18.04,您可以从其网站获得 Ubuntu 18.04 的 ISO 镜像。您既可以直接官网下载,也能用种子下载。其他官方版本将在其官方网站上提供下载。 + + +#### 我应该重新安装 Ubuntu 18.04 还是从 16.04/17.10 升级上来? + +如果您有重新安装的机会,建议备份您的数据并重新安装 Ubuntu 18.04。 + +从现有版本升级到 18.04 是一个方便的选择。不过,就我个人而言,它仍然保留了旧版本的依赖包。重新安装还是比较干净。 + +对于重新安装来说,我应该安装 Ubuntu 16.04 还是 Ubuntu 18.04? + +如果您要在计算机上安装 Ubuntu,请尽量使用 Ubuntu 18.04 而不是 16.04。 + +他们都是长期支持版本,并被支持很长一段时间。Ubuntu 16.04 会获得维护和安全更新服务直到 2021 年,而 18.04 则会到 2023 年。 + +不过,我建议您使用 Ubuntu 18.04。任何 LTS 版本都会在 [一段时间内获得硬件更新支持][13](我认为是两年半的时间内)。之后,它只获得维护更新。如果您有更新的硬件,您将在 18.04 获得更好的支持。 + +此外,许多应用程序开发人员将很快开始关注 Ubuntu 18.04。新创建的 PPA 可能仅在几个月内支持 18.04。所以使用 18.04 比 16.04 更好。 + + +#### 安装打印机-扫描仪驱动程序比使用 CLI 安装会更容易吗? + +在打印机方面,我不是专家,所以我的观点是基于我在这方面有限的知识。大多数新打印机都支持 [IPP协议][14],因此它们应该在 Ubuntu 18.04 中能够获到很好的支持。 然而对较旧的打印机我则无法保证。 + +#### Ubuntu 18.04 是否对 Realtek 和其他 WiFi 适配器有更好的支持? + +抱歉,没有关于这部分的具体信息。 + +#### Ubuntu 18.04 的系统要求? + + +对于默认的 GNOME 版本,最好您应该有 [4 GB 的内存以便正常使用][15]。使用过去 8 年中发布的处理器也可以运行。但任何比这性能更差的硬件建议使用 [轻量级 Linux 发行版][16],例如 [Lubuntu][12]。 + + + +#### 有关 Ubuntu 18.04 的其问题? + +如果还有其他疑问,请随时在下方评论区留言。如果您认为应将其他信息添加到列表中,请告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-18-04-faq/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wyxplus](https://github.com/wyxplus) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://itsfoss.com/ubuntu-18-04-release-features/ +[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/ubuntu-18-04-faq-800x450.png +[3]:https://itsfoss.com/use-unity-ubuntu-17-10/ +[4]:https://itsfoss.com/vanilla-gnome-ubuntu/ +[5]:https://feaneron.com/2018/04/20/the-infamous-gnome-shell-memory-leak/ +[6]:https://community.ubuntu.com/t/help-test-memory-leak-fixes-in-18-04-lts/5251 +[7]:https://www.omgubuntu.co.uk/2018/04/ubuntu-studio-plans-to-reboot +[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/03/upgrade-ubuntu-2.jpeg +[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/ubuntu-18-04-upgrade-settings-800x379.png +[10]:https://itsfoss.com/upgrade-ubuntu-version/ +[11]:https://ubuntu-mate.org/ +[12]:https://lubuntu.net/ +[13]:https://www.ubuntu.com/info/release-end-of-life +[14]:https://www.pwg.org/ipp/everywhere.html +[15]:https://help.ubuntu.com/community/Installation/SystemRequirements +[16]:https://itsfoss.com/lightweight-linux-beginners/ From 84058374d25b91e91af603c6e2f019c73b7cd3fc Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Sat, 26 May 2018 10:43:33 +0800 Subject: [PATCH 33/84] Delete 20180424 Things You Should Know About Ubuntu 18.04.md --- ...ings You Should Know About Ubuntu 18.04.md | 155 ------------------ 1 file changed, 155 deletions(-) delete mode 100644 sources/tech/20180424 Things You Should Know About Ubuntu 18.04.md diff --git a/sources/tech/20180424 Things You Should Know About Ubuntu 18.04.md b/sources/tech/20180424 Things You Should Know About Ubuntu 18.04.md deleted file mode 100644 index c8f958c900..0000000000 --- a/sources/tech/20180424 Things You Should Know About Ubuntu 18.04.md +++ /dev/null @@ -1,155 +0,0 @@ -translating by wyxplus -Things You Should Know About Ubuntu 18.04 -====== -[Ubuntu 18.04 release][1] is just around the corner. I can see lots of questions from Ubuntu users in various Facebook groups and forums. I also organized Q&A sessions on Facebook and Instagram to know what Ubuntu users are wondering about Ubuntu 18.04. - -I have tried to answer those frequently asked questions about Ubuntu 18.04 here. I hope it helps clear your doubts if you had any. And if you still have questions, feel free to ask in the comment section below. - -### What to expect in Ubuntu 18.04 - -![Ubuntu 18.04 Frequently Asked Questions][2] - -Just for clarification, some of the answers here are influenced by my personal opinion. If you are an experienced/aware Ubuntu user, some of the questions may sound silly to you. If that’s case, just ignore those questions. - -#### Can I install Unity on Ubuntu 18.04? - -Yes, you can. - -Canonical knows that there are people who simply loved Unity. This is why it has made Unity 7 available in the Universe repository. This is a community maintained edition and Ubuntu doesn’t develop it directly. - -I advise using the default GNOME first and if you really cannot tolerate it, then go on [installing Unity on Ubuntu 18.04][3]. - -#### What GNOME version does it have? - -At the time of its release, Ubuntu 18.04 has GNOME 3.28. - -#### Can I install vanilla GNOME on it? - -Yes, you can. - -Existing GNOME users might not like the Unity resembling, customized GNOME desktop in Ubuntu 18.04. There are some packages available in Ubuntu’s main and universe repositories that allows you to [install vanilla GNOME on Ubuntu 18.04][4]. - -#### Has the memory leak in GNOME fixed? - -Yes. The [infamous memory leak in GNOME 3.28][5] has been fixed and [Ubuntu is already testing the fix][6]. - -Just to clarify, the memory leak was not caused by Ubuntu. It was/is impacting all Linux distributions that use GNOME 3.28. A new patch was released under GNOME 3.28.1 to fix this memory leak. - -#### How long will Ubuntu 18.04 be supported? - -It is a long-term support (LTS) release and like any LTS release, it will be supported for five years. Which means that Ubuntu 18.04 will get security and maintenance updates until April 2023. This is also true for all participating flavors except Ubuntu Studio. - -#### When will Ubuntu 18.04 be released? - -Ubuntu 18.04 LTS has been released on 26th April. All the participating flavors like Kubuntu, Lubuntu, Xubuntu, Budgie, MATE etc will have their 18.04 release available on the same day. - -It seems [Ubuntu Studio will not have 18.04 as LTS release][7]. - -#### Is it possible to upgrade to Ubuntu 18.04 from 16.04/17.10? Can I upgrade from Ubuntu 16.04 with Unity to Ubuntu 18.04 with GNOME? - -Yes, absolutely. Once Ubuntu 18.04 LTS is released, you can easily upgrade to the new version. - -If you are using Ubuntu 17.10, make sure that in Software & Updates -> Updates, the ‘Notify me of a new Ubuntu version’ is set to ‘For any new version’. - -![Get notified for a new version in Ubuntu][8] - -If you are using Ubuntu 16.04, make sure that in Software & Updates -> Updates, the ‘Notify me of a new Ubuntu version’ is set to ‘For long-term support versions’. - -![Ubuntu 18.04 upgrade from Ubuntu 16.04][9] - -You should get system notification about the availability of the new versions. After that, upgrading to Ubuntu 18.04 is a matter of clicks. - -Even if Ubuntu 16.04 was Unity, you can still [upgrade to Ubuntu 18.04][10] GNOME. - -#### What does upgrading to Ubuntu 18.04 mean? Will I lose my data? - -If you are using Ubuntu 17.10 or Ubuntu 16.04, sooner or later, Ubuntu will notify you that Ubuntu 18.04 is available. If you have a good internet connection that can download 1.5 Gb of data, you can upgrade to Ubuntu 18.04 in a few clicks and in under 30 minutes. - -You don’t need to create a new USB and do a fresh install. Once the upgrade procedure finishes, you’ll have the new Ubuntu version available. - -Normally, your data, documents etc are safe in the upgrade procedure. However, keeping a backup of your important documents is always a good idea. - -#### When will I get to upgrade to Ubuntu 18.04? - -If you are using Ubuntu 17.10 and have correct update settings in place (as mentioned in the previous section), you should be notified for upgrading to Ubuntu 18.04 within a few days of Ubuntu 18.04 release. Since Ubuntu servers encounter heavy load on the release day, not everyone gets the upgrade the same day. - -For Ubuntu 16.04 users, it may take some weeks before they are officially notified of the availability of Ubuntu 18.04. Usually, this will happen after the first point release Ubuntu 18.04.1. This point release fixes the newly discovered bugs in 18.04. - -#### If I upgrade to Ubuntu 18.04 can I downgrade to 17.10 or 16.04? - -No, you cannot. While upgrading to the newer version is easy, there is no option to downgrade. If you want to go back to Ubuntu 16.04, you’ll have to do a fresh install. - -#### Can I use Ubuntu 18.04 on 32-bit systems? - -Yes and no. - -If you are already using the 32-bit version of Ubuntu 16.04 or 17.10, you may still get to upgrade to Ubuntu 18.04. However, you won’t find Ubuntu 18.04 bit ISO in 32-bit format anymore. In other words, you cannot do a fresh install of the 32-bit version of Ubuntu 18.04 GNOME. - -The good news here is that other official flavors like Ubuntu MATE, Lubuntu etc still have the 32-bit ISO of their new versions. - -In any case, if you have a 32-bit system, chances are that your system is weak on hardware. You’ll be better off using lightweight [Ubuntu MATE][11] or [Lubuntu][12] on such system. - -#### Where can I download Ubuntu 18.04? - -Once 18.04 is released, you can get the ISO image of Ubuntu 18.04 from its website. You have both direct download and torrent options. Other official flavors will be available on their official websites. - -#### Should I do a fresh install of Ubuntu 18.04 or upgrade to it from 16.04/17.10? - -If you have a choice, make a backup of your data and do a fresh install of Ubuntu 18.04. - -Upgrading to 18.04 from an existing version is a convenient option. However, in my opinion, it still keeps some traces/packages of the older version. A fresh install is always cleaner. - -For a fresh install, should I install Ubuntu 16.04 or Ubuntu 18.04? - -If you are going to install Ubuntu on a system, go for Ubuntu 18.04 instead of 16.04. - -Both of them are long-term support release and will be supported for a long time. Ubuntu 16.04 will get maintenance and security updates until 2021 and 18.04 until 2023. - -However, I would suggest that you use Ubuntu 18.04. Any LTS release gets [hardware updates for a limited time][13] (two and a half years I think). After that, it only gets maintenance updates. If you have newer hardware, you’ll get better support in 18.04. - -Also, many application developers will start focusing on Ubuntu 18.04 soon. Newly created PPAs might only support 18.04 in a few months. Using 18.04 has its advantages over 16.04. - -#### Will it be easier to install printer-scanner drivers instead of using the CLI? - -I am not an expert when it comes to printers so my opinion is based on my limited knowledge in this field. Most of the new printers support [IPP protocol][14] and thus they should be well supported in Ubuntu 18.04. I cannot say the same about older printers. - -#### Does Ubuntu 18.04 have better support for Realtek and other WiFi adapters? - -No specific information on this part. - -#### What are the system requirements for Ubuntu 18.04? - -For the default GNOME version, you should have [4 GB of RAM for a comfortable use][15]. A processor released in last 8 years will work as well. Anything older than that should use a [lightweight Linux distribution][16] such as [Lubuntu][12]. - -#### Any other questions about Ubuntu 18.04? - -If you have any other doubts regarding Ubuntu 18.04, please feel free to leave a comment below. If you think some other information should be added to the list, please let me know. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ubuntu-18-04-faq/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://itsfoss.com/author/abhishek/ -[1]:https://itsfoss.com/ubuntu-18-04-release-features/ -[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/ubuntu-18-04-faq-800x450.png -[3]:https://itsfoss.com/use-unity-ubuntu-17-10/ -[4]:https://itsfoss.com/vanilla-gnome-ubuntu/ -[5]:https://feaneron.com/2018/04/20/the-infamous-gnome-shell-memory-leak/ -[6]:https://community.ubuntu.com/t/help-test-memory-leak-fixes-in-18-04-lts/5251 -[7]:https://www.omgubuntu.co.uk/2018/04/ubuntu-studio-plans-to-reboot -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/03/upgrade-ubuntu-2.jpeg -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/ubuntu-18-04-upgrade-settings-800x379.png -[10]:https://itsfoss.com/upgrade-ubuntu-version/ -[11]:https://ubuntu-mate.org/ -[12]:https://lubuntu.net/ -[13]:https://www.ubuntu.com/info/release-end-of-life -[14]:https://www.pwg.org/ipp/everywhere.html -[15]:https://help.ubuntu.com/community/Installation/SystemRequirements -[16]:https://itsfoss.com/lightweight-linux-beginners/ From 479373f7de994a3ac4cd14aa658f2909398f73a4 Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Sat, 26 May 2018 10:54:56 +0800 Subject: [PATCH 34/84] Update 20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md --- ...ow to Install and Configure KVM on Ubuntu 18.04 LTS Server.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md b/sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md index 051ca46bc1..34e2527b4f 100644 --- a/sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md +++ b/sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md @@ -1,3 +1,4 @@ +translating by wyxplus How to Install and Configure KVM on Ubuntu 18.04 LTS Server ====== **KVM** (Kernel-based Virtual Machine) is an open source full virtualization solution for Linux like systems, KVM provides virtualization functionality using the virtualization extensions like **Intel VT** or **AMD-V**. Whenever we install KVM on any linux box then it turns it into the hyervisor by loading the kernel modules like **kvm-intel.ko** ( for intel based machines) and **kvm-amd.ko** ( for amd based machines). From 5b69251f80c7795521a9a1aae2ecebc710489744 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Sat, 26 May 2018 14:53:38 +0800 Subject: [PATCH 35/84] Delete 20180507 4 Firefox extensions to install now.md --- ...507 4 Firefox extensions to install now.md | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 sources/tech/20180507 4 Firefox extensions to install now.md diff --git a/sources/tech/20180507 4 Firefox extensions to install now.md b/sources/tech/20180507 4 Firefox extensions to install now.md deleted file mode 100644 index 50acaba725..0000000000 --- a/sources/tech/20180507 4 Firefox extensions to install now.md +++ /dev/null @@ -1,78 +0,0 @@ -Translating by MjSeven - - -4 Firefox extensions to install now -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna) -As I mentioned in my [original article][1] on Firefox extensions, the web browser has become a critical component of the computing experience for many users. Modern browsers have evolved into powerful and extensible platforms, and extensions can add or modify their functionality. Extensions for Firefox are built using the WebExtensions API, a cross-browser development system. - -In the first article, I asked readers: "Which extensions should you install?" To reiterate, that decision largely comes down to how you use your browser, your views on privacy, how much you trust extension developers, and other personal preferences. Since that article was published, one extension I recommended (Xmarks) has been discontinued. Additionally, that article received a ton of feedback that has been taken into account for this update. - -Once again, I'd like to point out that browser extensions often require the ability to read and/or change everything on the web pages you visit. You should consider the ramifications of this very carefully. If an extension has modify access to all the web pages you visit, it could act as a keylogger, intercept credit card information, track you online, insert advertisements, and perform a variety of other nefarious activities. That doesn't mean every extension will surreptitiously do these things, but you should carefully consider the installation source, the permissions involved, your risk profile, and other factors before you install any extension. Keep in mind you can use profiles to manage how an extension impacts your attack surface—for example, using a dedicated profile with no extensions to perform tasks such as online banking. - -With that in mind, here are four open source Firefox extensions you may want to consider. - -### uBlock Origin - -![ublock origin ad blocker screenshot][2] - -My first recommendation remains unchanged. [uBlock Origin][3] is a fast, low memory, wide-spectrum blocker that allows you to not only block ads but also enforce your own content filtering. The default behavior of uBlock Origin is to block ads, trackers, and malware sites using multiple, predefined filter lists. From there it allows you to arbitrarily add lists and rules, or even lock down to a default-deny mode. Despite being powerful, the extension has proven to be efficient and performant. It continues to be updated regularly and is one of the best options available for this functionality. - -### Privacy Badger - -![privacy badger ad blocker][4] - -My second recommendation also remains unchanged. If anything, privacy has been brought even more to the forefront since my previous article, making this extension an easy recommendation. As the name indicates, [Privacy Badger][5] is a privacy-focused extension that blocks ads and other third-party trackers. It's a project of the Electronic Freedom Foundation, which says: - -> "Privacy Badger was born out of our desire to be able to recommend a single extension that would automatically analyze and block any tracker or ad that violated the principle of user consent; which could function well without any settings, knowledge, or configuration by the user; which is produced by an organization that is unambiguously working for its users rather than for advertisers; and which uses algorithmic methods to decide what is and isn't tracking." - -Why is Privacy Badger on this list when the previous item may seem similar? A couple reasons. The first is that it fundamentally works differently than uBlock Origin. The second is that a practice of defense in depth is a sound policy to follow. Speaking of defense in depth, the EFF also maintains [HTTPS Everywhere][6] to automatically ensure https is used for many major websites. When you're installing Privacy Badger, you may want to consider HTTPS Everywhere as well. - -In case you were starting to think this article was simply going to be a rehash of the last one, here's where my recommendations diverge. - -### Bitwarden - -![Bitwarden][7] - -When recommending LastPass in the previous article, I mentioned it was likely going to be a controversial selection. That certainly proved true. Whether you should use a password manager at all—and if you do, whether you should choose one that has a browser plugin—is a hotly debated topic, and the answer very much depends on your personal risk profile. I asserted that most casual computer users should use one because it's much better than the most common alternative: using the same weak password everywhere. I still believe that. - -[Bitwarden][8] has really matured since the last time I checked it out. Like LastPass, it is user-friendly, supports two-factor authentication, and is reasonably secure. Unlike LastPass, it is [open source][9]. It can be used with or without the browser plugin and supports importing from other solutions including LastPass. The core functionality is completely free, and there is a premium version that is $10/year. - -### Vimium-FF - -![Vimium][10] - -[Vimium][11] is another open source extension that provides Firefox keyboard shortcuts for navigation and control in the spirit of Vim. They call it "The Hacker's Browser." Modifier keys are specified as **< c-x>**, **< m-x>**, and **< a-x>** for Ctrl+x, Meta+x, and Alt+x, respectively, and the defaults can be easily customized. Once you have Vimium installed, you can see this list of key bindings at any time by typing **?**. Note that if you prefer Emacs, there are also a couple of extensions for those keybindings as well. Either way, I think keyboard shortcuts are an underutilized productivity booster. - -### Bonus: Grammarly - -Not everyone is lucky enough to write a column on Opensource.com—although you should seriously consider writing for the site; if you have questions, are interested, or would like a mentor, reach out and let's chat. But even without a column to write, proper grammar is beneficial in a large variety of situations. Enter [Grammarly][12]. This extension is not open source, unfortunately, but it does make sure everything you type is clear, effective, and mistake-free. It does this by scanning your text for common and complex grammatical mistakes, spanning everything from subject-verb agreement to article use to modifier placement. Basic functionality is free, with a premium version with additional checks available for a monthly charge. I used it for this article and it caught multiple errors that my proofreading didn't. - -Again, Grammarly is the only extension included on this list that is not open source, so if you know of a similar high-quality open source replacement, let us know in the comments. - -These extensions are ones I've found useful and recommend to others. Let me know in the comments what you think of the updated recommendations. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/5/firefox-extensions - -作者:[Jeremy Garcia][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/jeremy-garcia -[1]:https://opensource.com/article/18/1/top-5-firefox-extensions -[2]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/ublock.png?itok=_QFEbDmq (ublock origin ad blocker screenshot) -[3]:https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/ -[4]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/privacy_badger_1.0.1.png?itok=qZXQeKtc (privacy badger ad blocker screenshot) -[5]:https://www.eff.org/privacybadger -[6]:https://www.eff.org/https-everywhere -[7]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/bitwarden.png?itok=gZPrCYoi (Bitwarden) -[8]:https://bitwarden.com/ -[9]:https://github.com/bitwarden -[10]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/vimium.png?itok=QRESXjWG (Vimium) -[11]:https://addons.mozilla.org/en-US/firefox/addon/vimium-ff/ -[12]:https://www.grammarly.com/ From 2a56f7bf7bf0cb5f4c24bd7268cb0555e926315b Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Sat, 26 May 2018 14:54:10 +0800 Subject: [PATCH 36/84] Create 20180507 4 Firefox extensions to install now.md --- ...507 4 Firefox extensions to install now.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 translated/tech/20180507 4 Firefox extensions to install now.md diff --git a/translated/tech/20180507 4 Firefox extensions to install now.md b/translated/tech/20180507 4 Firefox extensions to install now.md new file mode 100644 index 0000000000..db97507357 --- /dev/null +++ b/translated/tech/20180507 4 Firefox extensions to install now.md @@ -0,0 +1,77 @@ +4 个 Firefox 扩展 +===== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/redpanda_firefox_pet_animal.jpg?itok=aSpKsyna) +正如我在关于 Firefox 扩展的[原创文章][1]中提到的,web 浏览器已成为许多用户计算(机)验的关键组件。现代浏览器已经发展成为功能强大且可扩展的平台,扩展可以添加或修改其功能。Firefox 的扩展是使用 WebExtensions API(一种跨浏览器开发系统)构建的。 + +在第一篇文章中,我问读者:“你应该安装哪些扩展?” 重申一下,这一决定主要取决于你如何使用浏览器,你对隐私的看法,你对扩展程序开发人员的信任程度以及其他个人偏好。自文章发表以来,我推荐的一个扩展(Xmarks)已经停止。另外,该文章收到了大量的反馈,在这篇更新中,这些反馈已经被考虑到。 + +我想再次指出,浏览器扩展通常需要能够阅读和(或)更改你访问的网页上的所有内容。你应该仔细考虑这一点。如果扩展程序修改了你访问的所有网页的访问权限,那么它可能充当键盘记录程序,拦截信用卡信息,在线跟踪,插入广告以及执行各种其他恶意活动。这并不意味着每个扩展程序都会暗中执行这些操作,但在安装任何扩展程序之前,你应该仔细考虑安装源,涉及的权限,风险配置文件以及其他因素。请记住,你可以使用配置文件来管理扩展如何影响你的攻击面 - 例如,使用没有扩展的专用配置文件来 执行网上银行等任务。 + +考虑到这一点,这里有你可能想要考虑的四个开源 Firefox 扩展。 + +### uBlock Origin + +![ublock origin ad blocker screenshot][2] + +我的第一个建议保持不变。[uBlock Origin][3] 是一款快速,低内存,广泛的拦截器,它不仅可以拦截广告,而且还可以执行你自己的内容过滤。 uBlock Origin 的默认行为是使用多个预定义的过滤器列表来拦截广告,跟踪器和恶意软件站点。它允许你任意添加列表和规则,甚至可以锁定到默认拒绝模式。尽管它很强大,但它已被证明是高效和高性能的。它将继续定期更新,并且是该功能的最佳选择之一。 + +### Privacy Badger + +![privacy badger ad blocker][4] + +我的第二个建议也保持不变。如果说有什么区别的话,那就是自从我上一篇文章发表以来,隐私问题就一直被带到最前沿,这使得这个扩展成为一个简单的建议。顾名思义,[Privacy Badger][5] 是一个专注于隐私的扩展,可以拦截广告和其他第三方跟踪器。这是 Electronic Freedom (to 校正者:这里 Firefox 添加此扩展后,弹出页面译为电子前哨基金会)基金会的一个项目,他们说: + +> Privacy Badger 诞生于我们希望能够推荐一个单独的扩展,它可以自动分析和拦截任何违反用户同意原则的追踪器或广告;在用户没有任何设置、有关知识或配置的情况下,它可以很好地运行;它是由一个明确为其用户而不是为广告商工作的组织所产生的;它使用了算法的方法来决定什么是什么,什么是不跟踪的。” + +为什么 Privacy Badger 会出现在这个列表上,它的功能与上一个扩展看起来很类似?因为一些原因。首先,它从根本上工作原理与 uBlock Origin 不同。其次,深度防御的实践是一项合理的策略。说到深度防御,EFF 还维护着 [HTTPS Everywhere][6] 扩展,它自动确保 https 用于许多主流网站。当你安装 Privacy Badger 时,你也可以考虑使用 HTTPS Everywhere。 + +如果你开始认为这篇文章只是对上一篇文章的重新讨论,那么以下是我的建议分歧。 + +### Bitwarden + +![Bitwarden][7] + +在上一篇文章中推荐 LastPass 时,我提到这可能是一个有争议的选择。这无疑属实。无论你是否应该使用密码管理器 - 如果你使用,那么是否应该选择带有浏览器插件的密码管理器 - 这是一个备受争议的话题,答案很大程度上取决于你的个人风险状况。我认为大多数普通的计算机用户应该使用一个,因为它比最常见的选择要好得多:在任何地方都使用相同的弱密码。我仍然相信这一点。 + +[Bitwarden][8] 自从我上次审视以后确实成熟了。像 LastPass 一样,它对用户友好,支持双因素身份验证,并且相当安全。与 LastPass 不同的是,它是[开源的][9]。它可以使用或不使用浏览器插件,并支持从其他解决方案(包括 LastPass)导入。它的核心功能完全免费,它还有一个 10 美元/年的高级版本。 + +### Vimium-FF + +![Vimium][10] + +[Vimium][11] 是另一个开源的扩展,它为 Firefox 键盘快捷键提供了类似 Vim 一样的导航和控制,其称之为“黑客的浏览器”。对于 Ctrl+x, Meta+x 和 Alt+x,分别对应 **< c-x>**, **< m-x>** 和 **< a-x>**,默认值可以轻松定制。一旦你安装了 Vimium,你可以随时键入 **?** 来查看键盘绑定列表。请注意,如果你更喜欢 Emacs,那么也有一些针对这些键绑定的扩展。无论哪种方式,我认为键盘快捷键是未充分利用的生产力推动力。 + +### 额外福利: Grammarly + +不是每个人都有幸在 Opensource.com 上撰写专栏 - 尽管你应该认真考虑为网站撰写文章;如果你有问题,有兴趣,或者想要一个导师,伸出手,让我们聊天吧。但是,即使没有专栏撰写,正确的语法在各种各样的情况下都是有益的。试一下 [Grammarly][12]。不幸的是,这个扩展不是开源的,但它确实可以确保你输入的所有东西都是清晰的,有效的并且没有错误。它通过扫描你文本中的常见的和复杂的语法错误来实现这一点,涵盖了从主谓一致到文章使用到修饰词的放置这些所有内容。它的基本功能是免费的,它有一个高级版本,每月收取额外的费用。我在这篇文章中使用了它,它发现了许多我的校对没有发现的错误。 + +再次说明,Grammarly 是这个列表中包含的唯一不是开源的扩展,因此如果你知道类似的高质量开源替代品,请在评论中告诉我们。 + +这些扩展是我发现有用并推荐给其他人的扩展。请在评论中告诉我你对更新建议的看法。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/5/firefox-extensions + +作者:[Jeremy Garcia][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jeremy-garcia +[1]:https://opensource.com/article/18/1/top-5-firefox-extensions +[2]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/ublock.png?itok=_QFEbDmq (ublock origin ad blocker screenshot) +[3]:https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/ +[4]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/images/life-uploads/privacy_badger_1.0.1.png?itok=qZXQeKtc (privacy badger ad blocker screenshot) +[5]:https://www.eff.org/privacybadger +[6]:https://www.eff.org/https-everywhere +[7]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/bitwarden.png?itok=gZPrCYoi (Bitwarden) +[8]:https://bitwarden.com/ +[9]:https://github.com/bitwarden +[10]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/vimium.png?itok=QRESXjWG (Vimium) +[11]:https://addons.mozilla.org/en-US/firefox/addon/vimium-ff/ +[12]:https://www.grammarly.com/ From f99ec735029a88805c142d1348edb53ac4e1ea3f Mon Sep 17 00:00:00 2001 From: FelixYFZ <33593534+FelixYFZ@users.noreply.github.com> Date: Sat, 26 May 2018 17:09:46 +0800 Subject: [PATCH 37/84] Delete 20180107 7 leadership rules for the DevOps age.md --- ...7 7 leadership rules for the DevOps age.md | 124 ------------------ 1 file changed, 124 deletions(-) delete mode 100644 sources/talk/20180107 7 leadership rules for the DevOps age.md diff --git a/sources/talk/20180107 7 leadership rules for the DevOps age.md b/sources/talk/20180107 7 leadership rules for the DevOps age.md deleted file mode 100644 index fd875cc63b..0000000000 --- a/sources/talk/20180107 7 leadership rules for the DevOps age.md +++ /dev/null @@ -1,124 +0,0 @@ -Translating by FelixYFZ 7 leadership rules for the DevOps age -====== - -![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/CIO_DigitalAcumen_2.png?itok=TGeMQYs4) - -If [DevOps][1] is ultimately more about culture than any particular technology or platform, then remember this: There isn't a finish line. It's about continuous change and improvement - and the C-suite doesn't get a pass. - -Rather, leaders need to [revise some of their traditional approaches][2] if they expect DevOps to help drive the outcomes they seek. Let's consider seven ideas for more effective IT leadership in the DevOps era. - -### 1. Say "yes" to failure - -The word "failure" has long had very specific connotations in IT, and they're almost universally bad: server failure, backup failure, hard drive failure - you get the picture. - -A healthy DevOps culture, however, depends upon redefining failure - IT leaders should rewrite their thesaurus to make the word synonymous with "opportunity." - -"Prior to DevOps, we had a culture of punishing failure," says Robert Reeves, CTO and co-founder of [Datical][3]. "The only learning we had was to avoid mistakes. The number one way to avoid mistakes in IT is to not change anything: Don't accelerate the release schedule, don't move to the cloud, don't do anything differently!" - -That's a playbook for a bygone era and, as Reeves puts plainly, it doesn't work. In fact, that kind of stasis is actual failure. - -"Companies that release slowly and avoid the cloud are paralyzed by fear - and they will fail," Reeves says. "IT leaders must embrace failure as an opportunity. Humans not only learn from their mistakes, they learn from others' mistakes. A culture of openness and ['psychological safety'][4] fosters learning and improvement." - -**[ Related article: [Why agile leaders must move beyond talking about "failure."][5] ]** - -### 2. Live, eat, and breathe DevOps in the C-suite - -While DevOps culture can certainly grow organically in all directions, companies that are shifting from monolithic, siloed IT practices - and likely encountering headwinds en route - need total buy-in from executive leadership. Without it, you're sending mixed messages and likely emboldening those who'd rather push a _but this is the way we 've always done things_ agenda. [Culture change is hard][6]; people need to see leadership fully invested in that change for it to actually happen. - -"Top management must fully support DevOps in order for it to be successful in delivering the benefits," says Derek Choy, CIO at [Rainforest QA][7]. - -Becoming a DevOps shop. Choy notes, touches pretty much everything in the organization, from technical teams to tools to processes to roles and responsibilities. - -"Without unified sponsorship from top management, DevOps implementation will not be successful," Choy says. "Therefore, it is important to have leaders aligned at the top level before transitioning to DevOps." - -### 3. Don 't just declare "DevOps" - define it - -Even in IT organizations that have welcomed DevOps with open arms, it's possible that's not everyone's on the same page. - -**[Read our related article,**[ **3 areas where DevOps and CIOs must get on the same page**][8] **.]** - -One fundamental reason for such disconnects: People might be operating with different definitions for what the term even means. - -"DevOps can mean different things to different people," Choy says. "It is important for C-level [and] VP-level execs to define the goals of DevOps, clearly stating the expected outcome, understand how this outcome can benefit the business and be able to measure and report on success along the way." - -Indeed, beyond the baseline definition and vision, DevOps requires ongoing and frequent communication, not just in the trenches but throughout the organization. IT leaders must make that a priority. - -"Inevitably, there will be hiccups, there will be failures and disruptions to the business," Choy says. "Leaders need to clearly communicate the journey to the rest of the company and what they can expect as part of the process." - -### 4.DevOps is as much about business as technology - -IT leaders running successful DevOps shops have embraced its culture and practices as a business strategy as much as an approach to building and operating software. DevOps culture is a great enabler of IT's shift from support arm to strategic business unit. - -"IT leaders must shift their thinking and approach from being cost/service centers to driving business outcomes, and a DevOps culture helps speed up those outcomes via automation and stronger collaboration," says Mike Kail, CTO and co-founder at [CYBRIC][9]. - -Indeed, this is a strong current that runs through much of these new "rules" for leading in the age of DevOps. - -"Promoting innovation and encouraging team members to take smart risks is a key part of a DevOps culture and IT leaders need to clearly communicate that on a continuous basis," Kail says. - -"An effective IT leader will need to be more engaged with the business than ever before," says Evan Callendar, director, performance services at [West Monroe Partners][10]. "Gone are the days of yearly or quarterly reviews - you need to welcome the [practice of] [bi-weekly backlog grooming][11]. The ability to think strategically at the year level, but interact at the sprint level, will be rewarded when business expectations are met." - -### 5. Change anything that hampers DevOps goals - - -While DevOps veterans generally agree that DevOps is much more a matter of culture than technology, success does depend on enabling that culture with the right processes and tools. Declaring your department a DevOps shop while resisting the necessary changes to processes or technologies is like buying a Ferrari but keeping the engine from your 20-year-old junker that billows smoke each time you turn the key. - -Exhibit A: [Automation][12]. It's critical parallel strategy for DevOps success. - -"IT leadership has to put an emphasis on automation," Callendar says. "This will be an upfront investment, but without it, DevOps simply will engulf itself with inefficiency and lack of delivery." - -Automation is a fundamental, but change doesn't stop there. - -"Leaders need to push for automation, monitoring, and a continuous delivery process. This usually means changes to many existing practices, processes, team structures, [and] roles," Choy says. "Leaders need to be willing to change anything that'll hinder the team's ability to fully automate the process." - -### 6. Rethink team structure and performance metrics - -While we're on the subject of change...if that org chart collecting dust on your desktop is the same one you've been plugging names into for the better part of a decade (or more), it's time for an overhaul. - -"IT executives need to take a completely different approach to organizational structure in this new era of DevOps culture," Kail says. "Remove strict team boundaries, which tend to hamper collaboration, and allow for the teams to be self-organizing and agile." - -Kail says this kind of rethinking can and should extend to other areas in the DevOps age, too, including how you measure individual and team success, and even how you interact with people. - -"Measure initiatives in terms of business outcomes and overall positive impact," Kail advises. "Finally, and something that I believe to be the most important aspect of management: Be empathetic." - -Beware easily collected measurements that are not truly DevOps metrics, writes [Red Hat ][13]technology evangelist Gordon Haff. "DevOps metrics should be tied to business outcomes in some manner," he notes. "You probably don't really care about how many lines of code your developers write, whether a server had a hardware failure overnight, or how comprehensive your test coverage is. In fact, you may not even directly care about the responsiveness of your website or the rapidity of your updates. But you do care to the degree such metrics can be correlated with customers abandoning shopping carts or leaving for a competitor." See his full article, [DevOps metrics: Are you measuring what matters?][14] - -### 7. Chuck conventional wisdom out the window - -If the DevOps age requires new ways of thinking about IT leadership, it follows that some of the old ways need to be retired. But which ones? - -"To be honest, all of them," Kail says. "Get rid of the 'because that's the way we've always done things' mindset. The transition to a culture of DevOps is a complete paradigm shift, not a few subtle changes to the old days of Waterfall and Change Advisory Boards." - -Indeed, IT leaders recognize that real transformation requires more than minor touch-ups to old approaches. Often, it requires a total reboot of a previous process or strategy. - -Callendar of West Monroe Partners shares a parting example of legacy leadership thinking that hampers DevOps: Failing to embrace hybrid IT models and modern infrastructure approaches such as containers and microservices. - -"One of the big rules I see going out the window is architecture consolidation, or the idea that long-term maintenance is cheaper if done within a homogenous environment," Callendar says. - -**Want more wisdom like this, IT leaders? [Sign up for our weekly email newsletter][15].** - --------------------------------------------------------------------------------- - -via: https://enterprisersproject.com/article/2018/1/7-leadership-rules-devops-age - -作者:[Kevin Casey][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://enterprisersproject.com/user/kevin-casey -[1]:https://enterprisersproject.com/tags/devops -[2]:https://enterprisersproject.com/article/2017/7/devops-requires-dumping-old-it-leadership-ideas -[3]:https://www.datical.com/ -[4]:https://rework.withgoogle.com/guides/understanding-team-effectiveness/steps/foster-psychological-safety/ -[5]:https://enterprisersproject.com/article/2017/10/why-agile-leaders-must-move-beyond-talking-about-failure?sc_cid=70160000000h0aXAAQ -[6]:https://enterprisersproject.com/article/2017/10/how-beat-fear-and-loathing-it-change -[7]:https://www.rainforestqa.com/ -[8]:https://enterprisersproject.com/article/2018/1/3-areas-where-devops-and-cios-must-get-same-page -[9]:https://www.cybric.io/ -[10]:http://www.westmonroepartners.com/ -[11]:https://www.scrumalliance.org/community/articles/2017/february/product-backlog-grooming -[12]:https://www.redhat.com/en/topics/automation?intcmp=701f2000000tjyaAAA -[13]:https://www.redhat.com/en?intcmp=701f2000000tjyaAAA -[14]:https://enterprisersproject.com/article/2017/7/devops-metrics-are-you-measuring-what-matters -[15]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ From 03ec9c19481b653b82b39d7e8ae7893984da340c Mon Sep 17 00:00:00 2001 From: FelixYFZ <33593534+FelixYFZ@users.noreply.github.com> Date: Sat, 26 May 2018 17:10:35 +0800 Subject: [PATCH 38/84] Create 20180107 7 leadership rules for the DevOps age.md --- ...7 7 leadership rules for the DevOps age.md | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 translated/talk/20180107 7 leadership rules for the DevOps age.md diff --git a/translated/talk/20180107 7 leadership rules for the DevOps age.md b/translated/talk/20180107 7 leadership rules for the DevOps age.md new file mode 100644 index 0000000000..587d7761fb --- /dev/null +++ b/translated/talk/20180107 7 leadership rules for the DevOps age.md @@ -0,0 +1,119 @@ +DevOps时代的7个领导准则 +====== + +![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/CIO_DigitalAcumen_2.png?itok=TGeMQYs4) + +如果[DevOps]最终更多的是关于文化而不是任何其他的技术或者平台,那么请记住:没有终点线。而是继续改变和提高--而且最高管理层并没有通过。 + +然而,如果期望DevOps能够帮助获得更多的成果,领导者需要[修订他们的一些传统的方法][2]让我们考虑7个在DevOps时代更有效的IT领导的想法。 + +### 1. 向失败说“是的” + +“失败”这个词在IT领域中一直包含着特殊的内涵,而且通常是糟糕的意思:服务器失败,备份失败,硬盘驱动器失败-你得了解这些情况。 + +然而一种健康的DevOps文化取决于重新定义失败-IT领导者在他们的字典里应该重新定义这个单词将它的含义和“机会”对等起来。 + +“在DevOps之前,我们曾有一种惩罚失败者的文化,”罗伯特·里夫斯说,[Datical][3]的首席技术官兼联合创始人。“我们学到的仅仅是去避免错误。在IT领域避免错误的首要措施就是不要去改变任何东西:不要加速版本迭代的日程,不要迁移到云中,不要去做任何不同的事” + +那是过去的一个时代的剧本,里夫斯坦诚的说,它已经不起作用了,事实上,那种停滞是失败的。 + +“那些缓慢的释放并逃避云的公司被恐惧所麻痹-他们将会走向失败,”里夫斯说道。“IT领导者必须拥抱失败并把它当做成一个机遇。人们不仅仅从他们的过错中学习,也会从其他的错误中学习。一种开放和[安全心里][4]的文化促进学习和提高” +**[相关文章:[为什么敏捷领导者谈论“失败”必须超越它本义]] +### 2. 在管理层渗透开发运营的理念 + +尽管DevOps文化可以在各个方向有机的发展,那些正在从整体中转变,孤立的IT实践,而且可能遭遇逆风的公司-需要执行领导层的全面支持。你正在传达模糊的信息 +而且可能会鼓励那些愿意推一把的人,这是我们一贯的做事方式。[改变文化是困难的][6];人们需要看到领导层完全投入进去并且知道改变已经实际发生了。 + +“为了成功的实现利益的兑现高层管理必须全力支持DevOps,”来自[Rainforest QA][7]的首席技术官说道。 + +成为一个DevOps商店。德里克指出,涉及到公司的一切,从技术团队到工具到进程到规则和责任。 + +"没有高层管理的统一赞助支持,DevOps的实施将很难成功,"德里克说道。"因此,在转变到DevOps之前在高层中有支持的领导同盟是很重要的。" + +### 3. 不要只是声明“DevOps”-要明确它 +即使IT公司也已经开始拥抱欢迎DevOps,每个人可能不是在同一个进程上。 +**[参考我们的相关文章,**][**3 阐明了DevOps和首席技术官们必须在同一进程上**][8] **.]** + +造成这种脱节的一个根本原因是:人们对这个术语的有着不同的定义理解。 + +“DevOps 对不同的人可能意味着不同的含义,”德里克解释道。“对高管层和副总裁层来说,执行明确的DevOps的目标,清楚的声明期望的成果,充分理解带来的成果将如何使公司的商业受益并且能够衡量和报告成功的过程。” + +事实上,在基线和视野之上,DevOps要求正在进行频繁的交流,不是仅仅在小团队里,而是要贯穿到整个组织。IT领导者必须为它设置优先级。 + +“不可避免的,将会有些阻碍,在商业中将会存在失败和破坏,”德里克说道。“领导者名需要清楚的将这个过程向公司的其他人阐述清楚告诉他们他们作为这个过程的一份子能够期待的结果。” + +### 4. DevOps和技术同样重要 + +IT领导者们成功的将DevOps商店的这种文化和实践当做一项商业策略,与构建和运营软件的方法相结合。DevOps是将IT从支持部门转向战略部门的推动力。 + +IT领导者们必须转变他们的思想和方法,从成本和服务中心转变到驱动商业成果,而且DevOps的文化能够通过自动化和强大的协作加速收益。来自[CYBRIC][9]的首席技术官和联合创始人迈克说道。 + +事实上,这是一个强烈的趋势通过更多的这些规则在DevOps时代走在前沿。 + +“促进创新并且鼓励团队成员去聪明的冒险是DevOps文化的一个关键部分,IT领导者们需要在一个持续的基础上清楚的和他们交流,”凯尔说道。 + +“一个高效的IT领导者需要比以往任何时候都要积极的参与到商业中去,”来自[West Monroe Partners][10]的性能服务部门的主任埃文说道。“每年或季度回顾的日子一去不复返了-你需要欢迎每两周一次的待办事项。[11]你需要有在年度水平上的思考战略能力,在冲刺阶段的互动能力,在商业期望满足时将会被给予一定的奖励。” + +### 5. 改变妨碍DevOps目标的任何事情 + +虽然DevOps的老兵们普遍认为DevOps更多的是一种文化而不是技术,成功取决于通过正确的过程和工具激活文化。当你声称自己的部门是一个DevOps商店却拒绝对进程或技术做必要的改变,这就是你买了辆法拉利却使用了用过20年的引擎,每次转动钥匙都会冒烟。 + +展览 A: [自动化][12].这是DevOps成功的重要并行策略。 + +“IT领导者需要重点强调自动化,”卡伦德说。“这将是DevOps的前期投资,但是如果没有它,DevOps将会很容易被低效吞噬自己而且将会无法完整交付。” + +自动化是基石,但改变不止于此。 + +“领导者们需要推动自动化,监控和持续的交付过程。这意着对现有的实践,过程,团队架构以及规则的很多改变,”Choy说。“领导者们需要改变一切会阻碍隐藏团队去全利实现自动化的因素。” + +### 6. 重新思考团队架构和能力指标 + +当你想改变时...如果你桌面上的组织结构图和你过去大部分时候嵌入的名字都是一样的,那么你是时候该考虑改革了。 + +“在这个DevOps的新时代文化中,IT执行者需要采取一个全新的方法来组织架构。”Kail说。“消除组织的边界限制,它会阻碍团队间的合作,允许团队自我组织,敏捷管理。” + +Kail告诉我们在DevOps时代,这种反思也应该拓展应用到其他领域,包括你怎样衡量个人或者团队的成功,甚至是你和人们的互动。 + +“根据业务成果和总体的积极影响来衡量主动性,”Kail建议。“最后,我认为管理中最重要的一个方面是:有同理心。” + +注意很容易收集的到测量值不是DevOps真正的指标,[Red Hat]的技术专员Gardon Half写到,“DevOps应该把指标以某种形式和商业成果绑定在一起,”他指出。“你可能真的不在乎开发者些了多少代码,是否有一台服务器在深夜硬件损坏,或者是你的测试是多么的全面。你甚至都不直接关注你的网站的响应情况或者是你更新的速度。但是你要注意的是这些指标可能和顾客放弃购物车去竞争对手那里有关,”参考他的文章,[DevOps 指标:你在测量什么?] + +### 7. 丢弃传统的智慧 + +如果DevOps时代要求关于IT领导能力的新的思考方式,那么也就意味着一些旧的方法要被淘汰。但是是哪些呢? + +“是实话,是全部,”Kail说道。“要摆脱‘因为我们一直都是以这种方法做事的’的心态。过渡到DevOps文化是一种彻底的思维模式的转变,不是对瀑布式的过去和变革委员会的一些细微改变。” + +事实上,IT领导者们认识到真正的变革要求的不只是对旧方法的小小接触。它更多的是要求对之前的进程或者策略的一个重新启动。 + +West Monroe Partners的卡伦德分享了一个阻碍DevOps的领导力的例子:未能拥抱IT混合模型和现代的基础架构比如说容器和微服务 + +“我所看到的一个大的规则就是架构整合,或者认为在一个同质的环境下长期的维护会更便宜,”卡伦德说。 + +**想要更多像这样的智慧吗?[注册我们的每周邮件新闻报道][15].** +-------------------------------------------------------------------------------- + +via: https://enterprisersproject.com/article/2018/1/7-leadership-rules-devops-age + +作者:[Kevin Casey][a] +译者:[译者FelixYFZ](https://github.com/FelixYFZ) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://enterprisersproject.com/user/kevin-casey +[1]:https://enterprisersproject.com/tags/devops +[2]:https://enterprisersproject.com/article/2017/7/devops-requires-dumping-old-it-leadership-ideas +[3]:https://www.datical.com/ +[4]:https://rework.withgoogle.com/guides/understanding-team-effectiveness/steps/foster-psychological-safety/ +[5]:https://enterprisersproject.com/article/2017/10/why-agile-leaders-must-move-beyond-talking-about-failure?sc_cid=70160000000h0aXAAQ +[6]:https://enterprisersproject.com/article/2017/10/how-beat-fear-and-loathing-it-change +[7]:https://www.rainforestqa.com/ +[8]:https://enterprisersproject.com/article/2018/1/3-areas-where-devops-and-cios-must-get-same-page +[9]:https://www.cybric.io/ +[10]:http://www.westmonroepartners.com/ +[11]:https://www.scrumalliance.org/community/articles/2017/february/product-backlog-grooming +[12]:https://www.redhat.com/en/topics/automation?intcmp=701f2000000tjyaAAA +[13]:https://www.redhat.com/en?intcmp=701f2000000tjyaAAA +[14]:https://enterprisersproject.com/article/2017/7/devops-metrics-are-you-measuring-what-matters +[15]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ From 315f5190b20681fb0867d8c669bb488a7319dae7 Mon Sep 17 00:00:00 2001 From: FelixYFZ <33593534+FelixYFZ@users.noreply.github.com> Date: Sat, 26 May 2018 17:13:10 +0800 Subject: [PATCH 39/84] Update 20180115 Why DevSecOps matters to IT leaders.md Translating by FelixYFZ --- sources/talk/20180115 Why DevSecOps matters to IT leaders.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20180115 Why DevSecOps matters to IT leaders.md b/sources/talk/20180115 Why DevSecOps matters to IT leaders.md index e731013e2b..bb9ec99360 100644 --- a/sources/talk/20180115 Why DevSecOps matters to IT leaders.md +++ b/sources/talk/20180115 Why DevSecOps matters to IT leaders.md @@ -1,4 +1,4 @@ -Why DevSecOps matters to IT leaders + Translating by FelixYFZ Why DevSecOps matters to IT leaders ====== ![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/TEP_SecurityTraining1_620x414_1014.png?itok=zqxqJGDG) From 6061b5c21d34a04aa9db67d2fcd50d5bc8213ee3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 May 2018 22:59:16 +0800 Subject: [PATCH 40/84] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0180327 Loop better- A deeper look at iteration in Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180327 Loop better- A deeper look at iteration in Python.md b/published/20180327 Loop better- A deeper look at iteration in Python.md index e5de0dea0c..715d84867a 100644 --- a/published/20180327 Loop better- A deeper look at iteration in Python.md +++ b/published/20180327 Loop better- A deeper look at iteration in Python.md @@ -258,8 +258,8 @@ def funky_for_loop(iterable, action_to_do): 2. 反复从迭代器中获得下一项 3. 如果我们成功获得下一项,就执行 `for` 循环的主体 4. 如果我们在获得下一项时得到了一个 `StopIteration` 异常,那么就停止循环 -``` +``` def funky_for_loop(iterable, action_to_do):     iterator = iter(iterable)     done_looping = False From 1193cf57fbdfc637f421d6bbe54bfc7b1c6e376a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 May 2018 23:47:04 +0800 Subject: [PATCH 41/84] PRF:20171122 How DevOps eliminated bottlenecks for Ranger community.md @qhwdw --- ...inated bottlenecks for Ranger community.md | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/translated/tech/20171122 How DevOps eliminated bottlenecks for Ranger community.md b/translated/tech/20171122 How DevOps eliminated bottlenecks for Ranger community.md index a231fcefce..e795016475 100644 --- a/translated/tech/20171122 How DevOps eliminated bottlenecks for Ranger community.md +++ b/translated/tech/20171122 How DevOps eliminated bottlenecks for Ranger community.md @@ -1,8 +1,11 @@ -DevOps 如何消除掉 Ranger 社区的瓶颈 +DevOps 如何消除了 Ranger 社区的瓶颈 ====== + +> 拥抱 DevOps 让 Ranger 成员们变得更灵活、快捷和成为开发者社区更有价值的成员。 + ![配图](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/traffic-light-go.png?itok=nC_851ys) -Visual Studio Application Lifecycle Management(ALM)项目 —— [Ranger][1] 是一个志愿者社区,它提供专业的指导、实践经验、以及开发者社区的漏洞修补解决方案。它创建于 2006 年,作为微软内部社区去 "connect the product group with the field and remove adoption blockers"。 在 2009 时,社区已经有超过 200 位成员,这导致了协作和计划面临很大的挑战,在依赖和手工流程上产生了瓶颈,并导致了开发者社区不断增加的延迟和各种报怨。在 2010 时,计划进一步去扩充包括微软最有价值专家(MVP)在内的分布在全球的社区。 +Visual Studio 的应用周期管理Application Lifecycle Management(ALM)项目 —— [Ranger][1] 是一个志愿者社区,它提供专业的指导、实践经验、以及开发者社区的漏洞修补解决方案。它创建于 2006 年,作为微软内部社区去 “将产品组与大家相连接,并去除推广阻力”。 在 2009 时,社区已经有超过 200 位成员,这导致了协作和计划面临很大的挑战,在依赖和手工流程上产生了瓶颈,并导致了开发者社区不断增加的延迟和各种报怨。在 2010 时,计划进一步去扩充包括微软最有价值专家(MVP)在内的分布在全球的社区。 这个社区被分割成十几个活跃的团队。每个团队都致力于通过它的生命周期去设计、构建和支持一个指导或处理项目。在以前,团队的瓶颈在团队管理级别上,原因是严格的、瀑布式的流程和高度依赖一个或多个项目经理。在制作、发布和“为什么、做什么、和怎么做”驱动的决定上,项目经理都要介入其中。另外,缺乏一个实时的指标阻止了团队对他们的解决方案效率的监控,以及对来自社区的关于 bug 和常见问题的关注。 @@ -10,21 +13,21 @@ Visual Studio Application Lifecycle Management(ALM)项目 —— [Ranger][1 ### DevOps 去“灭火” -> "DevOps 是人员、流程、和产品的结合,使我们的最终用户能够持续传递价值。" --[Donovan Brown][2] +> “DevOps 是人员、流程和产品的结合,使我们的最终用户能够持续传递价值。” --[Donovan Brown][2] -为解决这些挑战,社区停止了所有对新项目的冲刺,去探索敏捷实践和新产品。致力于使社区重新活跃起来,为找到促进自治、掌控、和目标的方法,正如在 Daniel H. Pink 的书 —— [Drive][3] 中所说的那样,对僵化的流程和产品进行彻底的改革。 +为解决这些挑战,社区停止了所有对新项目的冲刺,去探索敏捷实践和新产品。致力于使社区重新活跃起来,为找到促进自治、掌控、和目标的方法,正如在 Daniel H. Pink 的书《[Drive][3]》中所说的那样,对僵化的流程和产品进行彻底的改革。 -> “成熟的自组织、自管理、和跨职能团队,在自治、掌控、和目标上茁壮成长。" --Drive, Daniel H. Pink. +> “成熟的自组织、自管理和跨职能团队,在自治、掌控和目标上茁壮成长。" --Drive, Daniel H. Pink. 从文化开始 —— 人 —— 第一步是去拥抱 DevOps。社区实现了 [Scrum][4] 框架,使用 [kanban][5] 去提升工程化流程,并且通过可视化去提升透明度、意识和最重要的东西 —— 信任。使用自组织团队后,传统的等级制度和指挥系统消失了。自管理促使团队去积极监视和设计它们自己的流程。 -在 2010 年 4 月份,社区再次实施了另外的关键一步,切换并提交它们的文化、流程、以及产品到云上。虽然开放的”为社区而社区“的核心 [解决方案][6] 仍然是指导和补充,但是在开源解决方案(OSS)上大量增加投资去研究和共享 DevOps 转换的成就。 +在 2010 年 4 月份,社区再次实施了另外的关键一步,切换并提交它们的文化、流程、以及产品到云上。虽然开放的“为社区而社区”的核心 [解决方案][6] 仍然是指导和补充,但是在开源解决方案(OSS)上大量增加投资去研究和共享 DevOps 转换的成就。 持续集成(CI)和持续交付(CD)使用自动化流水线代替了死板的人工流程。这使得团队在不受来自项目经理的干预的情况下为早期问题和早期应用者部署解决方案。增加遥测技术可以使团队关注他们的解决方案,以及在用户注意到它们之前,检测和处理未知的问题。 -DevOps 转变是一个持续进化的过程,通过实验去探索和验证人、流程、和产品的改革。最新的试验引入了流水线革新,它可以持续提升价值流。自动扫描组件、持续地、以及静默地检查安全、协议、和开源组件的品质。部署环和特性标志允许团队对所有或者特定用户进行更细粒度的控制。 +DevOps 转变是一个持续进化的过程,通过实验去探索和验证人、流程和产品的改革。最新的试验引入了流水线革新,它可以持续提升价值流。自动扫描组件、持续地以及静默地检查安全、协议和开源组件的品质。部署环和特性标志允许团队对所有或者特定用户进行更细粒度的控制。 -在 2017 年 10 月,社区将大部分的私有版本控制仓库转移到 [GitHub][7] 上。对所有仓库转移所有者和管理职责到 ALM DevOps Rangers 社区,给团队提供自治和机会,去激励更多的社区对开源解决方案作贡献。团队被授权向他们的最终用户交付质量和价值。 +在 2017 年 10 月,社区将大部分的私有版本控制仓库转移到 [GitHub][7] 上。将所有仓库转移所有者和管理职责到 ALM DevOps Rangers 社区,给团队提供自治和机会,去激励更多的社区对开源解决方案作贡献。团队被授权向他们的最终用户交付质量和价值。 ### 好处和成就 @@ -32,7 +35,7 @@ DevOps 转变是一个持续进化的过程,通过实验去探索和验证人 下面是从这个转变中观察到的一个列表,排列没有特定的顺序: - * 自治、掌控、和目标是核心。 + * 自治、掌控和目标是核心。 * 从可触摸的和可迭代的东西开始 —— 避免摊子铺的过大。 * 可触摸的和可操作的指标很重要 —— 确保不要掺杂其它东西。 * 人(文化)的转变是最具挑战的部分。 @@ -42,10 +45,22 @@ DevOps 转变是一个持续进化的过程,通过实验去探索和验证人 * 使用工程化流程去强化预期行为。 +转换变化表: -转换变化表:~~(致核对:以下是表格,格式转换造成错乱了。)~~ - -PAST CURRENT ENVISIONED Branching Servicing and release isolation Feature Master Build Manual and error prone Automated and consistent Issue detection Call from user Proactive telemetry Issue resolution Days to weeks Minutes to days Minutes Planning Detailed design Prototyping and storyboards Program management 2 program managers (PM) 0.25 PM 0.125 PM Release cadence 6 to 12 months 3 to 5 sprints Every sprint Release Manual and error prone Automated and consistent Sprints 1 month 3 weeks Team size 10 to 15 2 to 5 Time to build Hours Seconds Time to release Days Minutes +| | 过去 | 当前 | 想象 | +|---|------|---------|-----------| +| 分支 | 服务于发布隔离 | 特性 | 主分支 | +| 构建 |手动且易错 | 自动而一致 | | +| 问题检测 | 来自用户 | 主动感知 | +| 问题解决 | 几天到几周 | 几分钟到几天 | 几分钟 | +| 计划 | 详细的设计 | 原型与故事板 | | +| 流程管理 | 2 个流程经理(PM) | 0.25 个 PM | 0.125 个 PM | +| 发布终止 | 6 到 12 个月 | 3 到 5 周期 | 每个周期 | +| 发布 | 手动且易错 | 自动而一致 || +| 周期 | 1 个月 | 3 周 || +| 团队规模 | 10 到 15 | 2 到 5 || +| 构建时间 | 几小时 | 几秒钟 || +| 发布时间 | 几天 | 几分钟 || 但是,我们还没有做完,相反,我们就是一个令人兴奋的、持续不断的、几乎从不结束的转变的一部分。 @@ -57,7 +72,7 @@ via: https://opensource.com/article/17/11/devops-rangers-transformation 作者:[Willy Schaub][a] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3bf24a4ef5f9f62b49f72d92329646c1d9e0a9b9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 May 2018 23:47:43 +0800 Subject: [PATCH 42/84] PUB:20171122 How DevOps eliminated bottlenecks for Ranger community.md @qhwdw https://linux.cn/article-9682-1.html --- ...1122 How DevOps eliminated bottlenecks for Ranger community.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171122 How DevOps eliminated bottlenecks for Ranger community.md (100%) diff --git a/translated/tech/20171122 How DevOps eliminated bottlenecks for Ranger community.md b/published/20171122 How DevOps eliminated bottlenecks for Ranger community.md similarity index 100% rename from translated/tech/20171122 How DevOps eliminated bottlenecks for Ranger community.md rename to published/20171122 How DevOps eliminated bottlenecks for Ranger community.md From 5bb64c9f680e768f0de0082117f8add75eddeca9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 May 2018 07:03:00 +0800 Subject: [PATCH 43/84] PRF:20180517 How to find your IP address in Linux.md @geekpi --- ...0180517 How to find your IP address in Linux.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/tech/20180517 How to find your IP address in Linux.md b/translated/tech/20180517 How to find your IP address in Linux.md index 1450fb3c8c..3c171b5a33 100644 --- a/translated/tech/20180517 How to find your IP address in Linux.md +++ b/translated/tech/20180517 How to find your IP address in Linux.md @@ -1,7 +1,11 @@ 如何在 Linux 中找到你的 IP 地址 ====== + +> 每个网站都有一个独有的公开 IP 地址,可供任何人从任何地方访问。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/satellite_radio_location.jpg?itok=KJUKSB6x) -互联网协议(IP)不需要介绍 - 我们每天都在使用它。即使你不直接使用它,当你在浏览器上输入 website-name.com 时,它会查找该 URL 的 IP 地址,然后加载该网站。 + +互联网协议Internet Protocol(IP)不需要介绍 —— 我们每天都在使用它。即使你不直接使用它,当你在浏览器上输入 website-name.com 时,它会查找该 URL 的 IP 地址,然后加载该网站。 我们将 IP 地址分为两类:私有和公共。私有 IP 地址是你的无线路由(和公司内网)提供的私有 IP 地址。它们的范围是 10.xxx、172.16.xx-172.31.xx 和 192.168.xx,其中 x=0 到 255。公有 IP 地址,顾名思义,是“公共”的,你可以在世界上任何地方访问它。每个网站都有一个唯一的 IP 地址,任何人可在任何地点访问,这可被视为公共 IP 地址。 @@ -9,7 +13,7 @@ IPv4 地址格式为 x.x.x.x,其中 x=0 到 255。有 2^32(大约 40 亿个)可能的 IPv4 地址。 -IPv6 地址使用更复杂的十六进制。总的比特数是 128,这意味着有 2^128-340 后面有 36 个零! - 可能的 IPv6 地址。IPv6 已经被引入解决了可预见的 IPv4 地址耗尽问题。 +IPv6 地址使用更复杂的十六进制。总的比特数是 128,这意味着有 2^128 (340 后面有 36 个零!)个可能的 IPv6 地址。IPv6 已经被引入解决了可预见的 IPv4 地址耗尽问题。 作为网络工程师,我建议不要与任何人共享你机器的公有 IP 地址。你的 WiFi 路由器有公共 IP,即 WAN(广域网)IP 地址,并且连接到该 WiFi 的任何设备都是相同的。连接到相同 WiFi 的所有设备都有上面所说的私有 IP 地址。例如,我的笔记本电脑的 IP 地址 192.168.0.5,而我的电话是 192.168.0.8。这些是私有 IP 地址,但两者都有相同的公有 IP 地址。 @@ -26,8 +30,6 @@ IPv6 地址使用更复杂的十六进制。总的比特数是 128,这意味 9. `curl bot.whatismyipaddress.com` 10. `curl ipecho.net/plain` - - 以下命令将为你提供接口的私有 IP 地址: 1. `ifconfig -a` @@ -37,8 +39,6 @@ IPv6 地址使用更复杂的十六进制。总的比特数是 128,这意味 5. `(Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen` 6. `nmcli -p device show` - - _注意:一些工具需要根据你正在使用的 Linux 发行版安装在你的系统上。另外,一些提到的命令使用第三方网站来获取 IP_ -------------------------------------------------------------------------------- @@ -48,7 +48,7 @@ via: https://opensource.com/article/18/5/how-find-ip-address-linux 作者:[Archit Modi][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f074503cc041c95ab29f39a4f953fb138ba66f72 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 May 2018 07:03:38 +0800 Subject: [PATCH 44/84] PUB:20180517 How to find your IP address in Linux.md @geekpi https://linux.cn/article-9683-1.html --- .../20180517 How to find your IP address in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180517 How to find your IP address in Linux.md (100%) diff --git a/translated/tech/20180517 How to find your IP address in Linux.md b/published/20180517 How to find your IP address in Linux.md similarity index 100% rename from translated/tech/20180517 How to find your IP address in Linux.md rename to published/20180517 How to find your IP address in Linux.md From 0e803cc8b546d6f0581ab281c9d773a1c1937414 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 May 2018 07:19:43 +0800 Subject: [PATCH 45/84] PRF:20180502 zzupdate - Single Command To Upgrade Ubuntu.md @XiatianSummer --- ...date - Single Command To Upgrade Ubuntu.md | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/translated/tech/20180502 zzupdate - Single Command To Upgrade Ubuntu.md b/translated/tech/20180502 zzupdate - Single Command To Upgrade Ubuntu.md index e9ed956d9e..abd1a4be19 100644 --- a/translated/tech/20180502 zzupdate - Single Command To Upgrade Ubuntu.md +++ b/translated/tech/20180502 zzupdate - Single Command To Upgrade Ubuntu.md @@ -1,5 +1,6 @@ -zzupdate —— 升级 Ubuntu 的简单命令 +zzupdate:单条命令升级 Ubuntu 18.04 LTS ====== + Ubuntu 18.04 版本已经发布,并得到各个社区的一致好评,因为 Ubuntu 18.04 可能是 Ubuntu 多年来最令人兴奋的版本。 通常情况下,Ubuntu 及其衍生版可以使用命令从一个版本升级到最新版本或者其它版本,这也是官方推荐的升级方式。 @@ -16,20 +17,21 @@ Ubuntu 18.04 版本已经发布,并得到各个社区的一致好评,因为 - 笔记本电脑在使用电池供电时会在无操作 20 分钟后自动待机 - 不再提供 32 位的 Ubuntu 桌面安装程序映像 +注意: -**注意:** 1. 不要忘记备份重要数据。如果升级出现问题,我们将重新安装并恢复数据。 2. 安装所需时间取决于您的网络状况和安装的程序。 ### zzupdate 是什么? -我们可以通过使用 [zzupdate][2] 工具中的单个命令将 Ubuntu PC/Server 从一个版本升级到另一个版本。它是一个免费的开源工具,使用它不需要任何脚本知识,因为它只需要配置文件即可运行。 +我们可以只通过一条命令使用 [zzupdate][2] 工具中将 Ubuntu PC/Server 从一个版本升级到另一个版本。它是一个自由开源工具,使用它不需要任何脚本知识,因为它只需要配置文件即可运行。 工具中提供两个默认 shell 文件。`setup.sh` 自动安装、更新代码,将脚本转换为一个简单的 zzupdate shell 命令。`zzupdate.sh` 将执行版本间的升级。 -### 如何安装 zzipdate? +### 如何安装 zzupdate? + +要安装 `zzupdate`,只需执行以下命令: -要安装 zzupdate,只需执行以下命令。 ``` $ curl -s https://raw.githubusercontent.com/TurboLabIt/zzupdate/master/setup.sh | sudo sh . @@ -46,24 +48,24 @@ Already up-to-date. Setup completed! ---------------- See https://github.com/TurboLabIt/zzupdate for the quickstart guide. - ``` -将 Ubuntu 系统从一个版本升级到另一个版本,您不需要输入很多命令,也不需要重新启动,只需要运行下面的 zzupdate 命令并坐下喝杯咖啡就可以了。 +将 Ubuntu 系统从一个版本升级到另一个版本,您不需要输入很多命令,也不需要重新启动,只需要运行下面的 `zzupdate` 命令并坐下喝杯咖啡就可以了。 请注意,当您远程升级系统时,建议您使用以下的工具来帮助您在任何断开连接时重新连接会话。 -**建议阅读:** [如何让一个进程/命令在 SSH 连接断开后继续运行][3] +建议阅读: [如何让一个进程/命令在 SSH 连接断开后继续运行][3] ### 如何配置 zzupdate(可选) -默认情况下,zzupdate 可以直接使用,不需要配置任何东西。当然,如果您想要自己配置一些内容,可以的。复制提供的实例配置文件 `zzupdate.default.conf` 到 `zzupdate.conf` 并在 `zzupdate.conf` 中配置您的首选项。 +默认情况下,`zzupdate` 可以开箱即用,不需要配置任何东西。当然,如果您想要自己配置一些内容也是可以的。复制提供的示例配置文件 `zzupdate.default.conf` 到 `zzupdate.conf`,并在 `zzupdate.conf` 中配置您的首选项。 + ``` $ sudo cp /usr/local/turbolab.it/zzupdate/zzupdate.default.conf /etc/turbolab.it/zzupdate.conf - ``` 打开文件,默认配置如下。 + ``` $ sudo nano /etc/turbolab.it/zzupdate.conf @@ -73,19 +75,18 @@ VERSION_UPGRADE=1 VERSION_UPGRADE_SILENT=0 COMPOSER_UPGRADE=1 SWITCH_PROMPT_TO_NORMAL=0 - ``` - * **`REBOOT=1 :`**系统在更新完成后自动重启 - * **`REBOOT_TIMEOUT=15 :`**重启的默认超时值 - * **`VERSION_UPGRADE=1 :`**执行从一个版本到另一个版本的版本升级 - * **`VERSION_UPGRADE_SILENT=0 :`**禁用自动升级 - * **`COMPOSER_UPGRADE=1 :`**自动升级 - * **`SWITCH_PROMPT_TO_NORMAL=0 :`**如果值为 `0`,将寻找相同种类的版本升级。例如您正在运行 LTS 的版本,那么将寻找 LTS 的版本升级,而不是用于正常版本升级。如果值为 `1`,那么无论您是运行 LTS 还是正常版本,都会查找最新版本 + * `REBOOT=1`:系统在更新完成后自动重启 + * `REBOOT_TIMEOUT=15`:重启的默认超时值 + * `VERSION_UPGRADE=1`:执行从一个版本到另一个版本的版本升级 + * `VERSION_UPGRADE_SILENT=0`:禁用自动升级 + * `COMPOSER_UPGRADE=1`:自动升级 + * `SWITCH_PROMPT_TO_NORMAL=0`:如果值为 `0`,将寻找相同种类的版本升级。例如您正在运行 LTS 的版本,那么将寻找 LTS 的版本升级,而不是用于正常版本升级。如果值为 `1`,那么无论您是运行 LTS 还是正常版本,都会查找最新版本 +我现在正在使用 Ubuntu 17.10 ,查看一下详细信息。 -我现在使用 Ubuntu 17.10 并查看详细信息。 ``` $ cat /etc/*-release DISTRIB_ID=Ubuntu @@ -107,7 +108,8 @@ UBUNTU_CODENAME=artful ``` -要升级 Ubuntu 到最新版本,只需要执行以下命令。 +要升级 Ubuntu 到最新版本,只需要执行以下命令: + ``` $ sudo zzupdate @@ -181,10 +183,10 @@ Fetched 0 B in 6s (0 B/s) Reading package lists... Done Building dependency tree Reading state information... Done - ``` -我们需要按下 `Enter` 按钮禁用 `Third Party` 仓库以继续升级。 +我们需要按下回车键禁用第三方仓库以继续升级。 + ``` Updating repository information @@ -209,10 +211,10 @@ Reading state information... Done Calculating the changes Calculating the changes - ``` 开始下载 `Ubuntu 18.04 LTS` 软件包,所需时间取决于您的网络状况,一般情况下这将需要几分钟。 + ``` Do you want to start the upgrade? @@ -244,10 +246,10 @@ Get:1480 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 usb-modeswitch am Get:1481 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 usb-modeswitch-data all 20170806-2 [30.7 kB] Get:1482 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 xbrlapi amd64 5.5-4ubuntu2 [61.8 kB] Fetched 999 MB in 6s (721 kB/s) - ``` 安装新软件包时,很少有服务需要重新启动。 点击 `Yes` 按钮,它会自动重启所需的服务。 + ``` Upgrading Inhibiting until Ctrl+C is pressed... @@ -279,7 +281,8 @@ Progress: [ 95%] ``` -现在删除旧版的、系统不再需要的包。点击 `y` 以删除。 +现在删除旧版的、系统不再需要的包。点击 `y` 以删除。 + ``` Searching for obsolete software ing package lists... 97% @@ -312,7 +315,8 @@ Fetched 0 B in 0s (0 B/s) ``` -升级成功,需要重启系统。点击 `Y` 以重启系统。 +升级成功,需要重启系统。点击 `y` 以重启系统。 + ``` System upgrade is complete. @@ -325,9 +329,10 @@ Continue [yN]y ``` -**注意:** 少数情况下,会要求您确认配置文件替换以继续安装。 +注意: 少数情况下,会要求您确认配置文件替换以继续安装。 + +查看升级后的系统详情: -查看升级后的系统详情。 ``` $ cat /etc/*-release DISTRIB_ID=Ubuntu @@ -346,7 +351,6 @@ BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic - ``` -------------------------------------------------------------------------------- @@ -356,7 +360,7 @@ via: https://www.2daygeek.com/zzupdate-single-command-to-upgrade-ubuntu-18-04/ 作者:[PRAKASH SUBRAMANIAN][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[XiatianSummer](https://github.com/XiatianSummer) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7e17f628861d8d8d93d03dba37d93799bef61cdd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 May 2018 07:20:09 +0800 Subject: [PATCH 46/84] PUB: 20180502 zzupdate - Single Command To Upgrade Ubuntu.md @XiatianSummer https://linux.cn/article-9684-1.html --- .../20180502 zzupdate - Single Command To Upgrade Ubuntu.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180502 zzupdate - Single Command To Upgrade Ubuntu.md (100%) diff --git a/translated/tech/20180502 zzupdate - Single Command To Upgrade Ubuntu.md b/published/20180502 zzupdate - Single Command To Upgrade Ubuntu.md similarity index 100% rename from translated/tech/20180502 zzupdate - Single Command To Upgrade Ubuntu.md rename to published/20180502 zzupdate - Single Command To Upgrade Ubuntu.md From e6c9b95a757379919fbccbbbf16c97d60670406d Mon Sep 17 00:00:00 2001 From: paperzhang <31605464+paperzhang@users.noreply.github.com> Date: Sun, 27 May 2018 11:08:18 +0800 Subject: [PATCH 47/84] Delete 20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md --- ...ncy Malware Found on Ubuntus Snap Store.md | 107 ------------------ 1 file changed, 107 deletions(-) delete mode 100644 sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md diff --git a/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md b/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md deleted file mode 100644 index dae40507ac..0000000000 --- a/sources/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md +++ /dev/null @@ -1,107 +0,0 @@ -What You Need to Know About Cryptocurrency ‘Malware’ Found on Ubuntu’s Snap Store -====== -Recently, it was discovered that a couple of apps in the Ubuntu Snaps store contained cryptocurrency mining software. Canonical swiftly removed the offending apps, but several questions are left unanswered. - -### Discovery of Crypto Miner on Snap Store - -![Crypto Miner Malware on Ubuntu Snap Store][1] - -On May 11, a user named [tarwirdur][2] opened a new issue on the [snapcraft.io repository][3]. In the issue, he noted that a snap entitled 2048buntu created by Nicolas Tomb contained a cryptocurrency miner. He asked how he could “complain about the application” for security reasons. tarwirdur later posted to say that all the others snaps created by Nicolas Tomb also contained cryptocurrency miners. - -It appears that the snaps used systemd to automatically launch the code at boot and run it in the background with the user none the wiser. - -{For those unfamiliar with the terminology, a cryptocurrency miner is a piece of software that uses a computer’s main processor or graphics processor to “mine” digital currency. “Mining” usually involves solving a mathematical equation. In this case, if you were running the 2048buntu game, the game used additional processing power for cryptocurrency mining.} - -The Snapcraft team responded by quickly removing all apps created by the offender. They also started an investigation. - -### The Man Behind the Mask Speaks - -On May 13, a Disqus user named Nicolas Tomb [posted a comment][4] on OMGUbuntu’s coverage of the news. In this comment, he stated that he added the cryptocurrency miner to monetize the snaps. He apologized for his actions and promised to send any funds that had been mined to the Ubuntu foundation. - -We can’t say for sure if this comment was posted by the same Nicolas Tomb since the Disqus account was just recently created and only has one comment associated with it. For now, we’ll assume that it is. - -### Canonical Makes a Statement - -On May 15, Canonical issued a statement on the situation. Entitled [“Trust and security in the Snap Store”][5], the post starts out by restating the situation. They add that the snaps have been [reissued with the cryptocurrency mining code removed][6]. - -Canonical then attempts to examine the motives of Nicolas Tomb. They note that he told them he did it in an attempt to monetize the apps (as stated above) and stopped doing it when confronted. They also note that “mining cryptocurrency is not illegal or unethical by itself”. They are however unhappy about the fact that he did not disclose the cryptocurrency miner in the snap description. - -From there Canonical moves to the subject of reviewing software. According to the post, the Snap Store uses a quality control system similar to iOS, Android, and Windows: “automated checkpoints that packages must go through before they are accepted, and manual reviews by a human when specific issues are flagged”. - -However, Canonical says “it’s impossible for a large scale repository to only accept software after every individual file has been reviewed in detail”. Therefore, they need to trust the source, not the content. After all, that is what the current Ubuntu repo system is based on. - -Canonical follows this up by talking about the future of snaps. They acknowledge that the current system is not perfect. They are continually working to improve it. They have “very interesting security features in the works that will improve the safety of the system and also the experience of people handling software deployments in servers and desktops”. - -One of the features they are working on is the ability to see if a publisher is verified. Other improvements include: “upstreaming of all the AppArmor kernel patches” and other under-the-hood fixes. - -### Thoughts on the ‘Snap store malware’ - -Based on all that I’ve read, I’ve got a few thoughts and questions of my own. - -#### How Long Was This Running? - -First of all, how long have these mining snaps been available on the Snap Store? Since they have all been removed, we don’t have that data. I was able to grab an image of the 2048buntu page from the Google cache, but it doesn’t show much of anything. Depending on how long it ran, how many systems it got installed on, and what cryptocurrency was being mined, we could either be talks about a little bit of money or a pile. A further question is: would Canonical have been able to catch this in the future? - -#### Was it Really a Malware? - -A lot of news sites are reporting this as a malware infection. I think I might have even seen this incident referred to as Linux’s first malware. I’m not sure that term is accurate. Dictionary.com defines [malware][7] as: “software intended to damage a computer, mobile device, computer system, or computer network, or to take partial control over its operation”. - -The snaps in question did not damage or take control of the computers involved. it also did not infect other computers. It couldn’t have because all snaps are sandboxed. At the most, they leached processor power, that’s about it. So, I wouldn’t call it malware. - -#### Nothing Like a Loophole - -The one defense that Nicolas Tomb uses is that the Snap Store didn’t have any rules against cryptocurrency mining when he uploaded the snaps. {I can bet you that they are rectifying that problem right now.} They didn’t have that rule for the simple reason that no one had done it before. If Tomb was trying to do things correctly, he should have asked if this kind of behavior was allowed. The fact that he didn’t seems to point to the fact that he knew they would probably say no. At the very least, they would have told him to put it in the description. - -![][8] - -#### Something Looks Hinkey - -As I said before, I got a screenshot of the 2048buntu page from Google cache. Just looking at it raises several red flags. First, there is almost no real description. This is all it says “Game like 2048. This game is clone popular game – 2048 with ubuntu colors.” Wow. {That’ll bring in the suckers.} When I read something as empty as that, I get nervous. - -Another thing to notice is the size of it. Version 1.0 of the 2048buntu snap weighs almost 140 MB. Why would a game this simple need that much space? There are browser versions written in Javascript that probably use less than a quarter of that. There other snaps of 2048 games on the Snap Store and none of them has half the file size. - -Then, you have the license. This is a clone of a popular game using Ubuntu colors. How can it be considered proprietary? I’m sure that legit devs in the audience would have uploaded it with a FOSS (Free and Open Source Software) license just because of the content. - -These factors alone should have made this snap, in particular, stand out and call for a review. - -#### Who is Nicolas Tomb? - -After first reading about this, I decided to see what I could find out about the guy who started this mess. When I searched for Nicolas Tomb, I found nothing, zip, nada, zilch. All I found were a bunch of news articles about the cryptocurrency mining snaps and information about taking a trip to the tomb of St. Nicolas. There is no sign of Nicolas Tomb on Twitter or Github either. This seems like a name created just to upload these snaps. - -This also leads to a point in the Canonical blog post about verifying publishers. The last time I looked, quite a few snaps were not published by the maintainers of the applications. This makes me nervous. I would be more willing to trust a snap of say Firefox if it was published by Mozilla, instead of Leonard Borsch. If it’s too much work for the application maintainer to also take care of the snap, there should be a way for the maintainer to put their stamp of approval on the snap for their program. Something like Firefox snap published by Fredrick Ham, approved by Mozilla Foundation. Just something to give the user more confidence in what they are downloading. - -#### Snap Store Definitely has Room to Improve - -It seems to me that one of the first features that the Snap Store team should have implemented was a way to report suspicious snaps. tarwirdur had to find the site’s Github page. The average user would not have thought of that. If the Snap Store can’t review every line of code, enabling the users to reports problems is the next best thing. Even rating system would not be a bad addition. I’m sure there would have been a couple people who would have given 2048buntu a low rating for using too many system resources. - -#### Conclusion - -From all the I have seen, I think that someone created a number of simple apps, embedded a cryptocurrency miner in each, and uploaded them to the Snap Store with the goal of raking in piles of money. Once they got caught, they claimed it was only to monetize the snaps. If that was true, they would have mentioned it in the snap description. Hidden crypto miners are nothing [new][9]. They are generally a method of computing power theft. - -I wish that Canonical already have features in place to combat this problem and I hope they appear quickly. - -What do you think of the Snap Store ‘malware episode’? What would you do to improve it? Let us know in the comments below. - -If you found this article interesting, please take a minute to share it on social media. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/snapstore-cryptocurrency-saga/ - -作者:[John Paul][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/john/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/ubuntu-snap-malware-800x450.jpeg -[2]:https://github.com/tarwirdur -[3]:https://github.com/canonical-websites/snapcraft.io/issues/651 -[4]:https://disqus.com/home/discussion/omgubuntu/malware_found_on_the_ubuntu_snap_store/#comment-3899153046 -[5]:https://blog.ubuntu.com/2018/05/15/trust-and-security-in-the-snap-store -[6]:https://forum.snapcraft.io/t/action-against-snap-store-malware/5417/8 -[7]:http://www.dictionary.com/browse/malware?s=t -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/2048buntu.png -[9]:https://krebsonsecurity.com/2018/03/who-and-what-is-coinhive/ From 357db7bd61b667b54eef472a7b8517a785dcb5d3 Mon Sep 17 00:00:00 2001 From: paperzhang <31605464+paperzhang@users.noreply.github.com> Date: Sun, 27 May 2018 11:09:10 +0800 Subject: [PATCH 48/84] =?UTF-8?q?Cryptocurrency=20Malware=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ncy Malware Found on Ubuntus Snap Store.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md diff --git a/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md b/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md new file mode 100644 index 0000000000..dc314d5758 --- /dev/null +++ b/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md @@ -0,0 +1,107 @@ +关于在 Ubuntu Snap 应用商店上发现的加密货币 ‘恶意软件’ 需要了解的内容 +====== +最近,有发现称一些 Ubuntu Snaps 应用商店上的应用包含加密货币挖矿程序。Canonical 公司迅速下架了这些违规的应用,但是留下了几个有待回答的问题。 + +### 在 Snap 应用商店上发现了加密矿工 + +![Crypto Miner Malware on Ubuntu Snap Store][1] + +5月11号,一位名叫 [tarwirdur][2] 的用户在 [snapcraft.io repository][3] 开了一个新的 issue ,他提到一个由 Nicolas Tomb 开发,叫做 2048buntu 的 snap 应用包含加密货币矿工。tarwirdur 询问他怎样才能因为安全原因“抱怨应用” 。tarwirdur 后来发表说其他由 Nicolas Tomb 开发的 snap 应用都包含加密货币矿工。 + +看起来 snap 应用使用了 systemd 在系统启动时自动地运行代码,并在用户不知情的情况下在后台运行。 + +{对那些不熟悉相关术语的人来说,加密货币矿工是一段占用计算机主处理器或者图形处理器来“挖掘”数字货币的程序。“挖矿”通常涉及到解决一个数学等式。在这种情况下,如果你在运行 2048buntu 游戏,这个游戏将会使用处理器额外的计算能力去进行加密货币的挖掘。} + +Snapcraft 团队迅速地下架了所有由违规者开发的应用来做出回应。他们同时也开展了调查。 + +### 隐匿者发声 + +5月13号,一位同名为 Nicolas Tomb 的 Disqus 用户在 OMGUbuntu 的新闻报道上发表了[评论][4],他在评论中称自己向 snap 应用中添加了加密货币矿工,从而获取收益。他为他的行为道歉,同时承诺将所有挖矿所得的收益送给 Ubuntu 基金会。 + +我们不能确认这个评论就是由 Nicolas Tomb 发表的,因为这个 Disqus 账户最近才被创建,也只有一条评论与之相关联。现在,我们假设是的。 + +### Canonical 公司发表了声明 + +5月15号,Canonical 公司在这种情况下发表了一份声明。标题为 [“Trust and security in the Snap Store”][5],声明开头重申了当下的情况。他们也补充道[重新发布的 snap 应用中加密货币挖矿程序已经被删除了][6]。 + +Canonical 公司随后尝试检测 Nicolas Tomb 的动机。他们指出到他称自己这样做是为了通过应用赚钱(如上所诉),而在真的面对赚钱时就停止了。他们也指出“挖掘加密货币本身是不合法也是不道德的”。然而,他们对实际情况仍旧是不满意的,因为 Nicolas Tomb 没有在 snap 应用的描述中透露加密货币矿工。 + +随后 Canonical 公司将主题转移到审核软件上。根据这份申明,Snap 应用商店将会采用一种类似 iOS,Android,Windows 的质量控制系统,这个系统将“自动化检查点,安装包必须在被接受前通过检查,同时在特殊问题被标记时会进行人工审核”。 + +然而,Canonical 公司声称“对巨大而弹性的软件仓库来说,只接受每个单独文件都被仔细审核的软件是不可能的”。因此,他们需要相信软件源而不是基于源开发的应用。毕竟,软件源是现在 Ubuntu 软件仓库系统的基础。 + +Canonical 公司紧接着谈到了 snap 应用的未来。他们承认现在的系统是不完美的。他们也在不断工作进行改善。他们“在目前的工作中有非常有趣的安全功能,这些功能将会改善系统安全性同时提升人们在服务器或桌面上进行软件开发的体验”。 + +其中一个他们正在开发的功能是查看一个软件发布者是否已通过验证。Other improvements include: “upstreaming of all the AppArmor kernel patches” and other under-the-hood fixes.(不确定,under-the-hood 指实现是不透明的,[quora回答](https://www.quora.com/What-does-under-the-hood-mean-in-programming) ,其他的改善包括:“所有 AppArmor 内核补丁的上游”和其他黑盒服务都被修复了。) + +### 一些关于'Snap 应用商店恶意软件'的想法 + +基于我读过的所有内容,我产生了了一些想法和问题。 + +#### 这种挖矿软件运行多久了? + +首先,这些挖矿软件存在于 Snap 应用商店多久了?因为它们已经被下架了,我们没有这样的数据。我可以通过 Google 快照抓取一些 2048buntu 页面的图片,但这没有提供任何可用的信息。根据软件运行时间,多少系统安装过,什么加密货币被挖掘出了,我们可以谈谈违规者获取的一点钱或一笔钱。一个更长远的问题是:Canonical 公司将来有能力捕捉到这样的违规情况吗? + +#### 这真的是一个恶意软件吗? + +许多新闻网站将之报道为恶意软件感染。我想我甚至可以看到这个事件被称为 Linux 的第一个恶意软件。我不确定这个术语是否精确。Dictionary.com 这样定义 [恶意软件][7]:“意图损害计算机、移动设备、计算机系统或者计算机网络,或者对其运作进行部分控制的软件”。 + +有问题的 snap 应用并没有损害或者控制涉及到的计算机。它同样没有感染其他计算机。它也不能这样做,因为所有的 snap 应用位于沙盒之中。它们最多利用了处理器的计算能力,就是这样。所以,我不会称之为恶意软件。 + +#### Nothing Like a Loophole(无孔不入?) + +Nicolas Tomb 使用的一个辩解是在他上传应用的时候 Snap 应用商店没有任何反对加密货币挖矿的规则。{我敢向你打赌他们正在纠正这个错误。}他们之所以没有这样的规则,原因很简单,之前没有人做过这种事。如果 Tomb 想正确地做事,他应该提前询问是否允许这种行为。而事实是他似乎没有指出他知道 Canonical 公司可能会拒绝的事实。至少,Canonical 公司会告诉他将这些写在软件的描述中。 + +![][8] + +#### Something Looks Hinkey(不会翻译) + +如我之前说的,我从 Google 快照获取了一个 2048buntu 的页面截图。仅仅看它就会感觉到一些危险的信号。首先,截图中几乎没有真实的描述。它是这样描述的“类似2048的游戏。这个游戏用 ubuntu 主题克隆了流行的游戏 — 2048。”哇,{这将会引来容易上当受骗的人。}当我读到类似空洞的描述时,我会多考虑下。 + +我注意到的另一件事是软件的大小。2048buntu 的 1.0 版本大小将近 140 MB。一个简单的游戏怎么需要这么多的空间?有用 Javascript 写的浏览器版本大概只用了不到它的四分之一。其他 snap 应用商店的 2048 游戏的大小没有一个达到了这个软件的一半。 + +然后,你有许可证。这是一个使用了 Ubuntu 主题的流行游戏的克隆。它如何被认为是专有的?我确信,其他合法的开发者会因为内容而使用了 FOSS (自由开源软件)许可证来上传它。 + +单是这些因素就使得这个 snap 应用很特殊,并呼吁进行审核。 + +#### 谁是 Nicolas Tomb? + +当第一次读到这些之后,我决定看看我能否找出造成这一团混乱的人。当我搜索 Nicolas Tomb 的时候,我什么都没找到,zip,nada,zilch(感觉是错误,不太明白这几个单词在这里的意思)。所有我找到的只是一大堆关于加密货币挖矿 snap 应用的新闻和文章,以及去 tomb of St. Nicolas 旅游的信息。在 Twiter 和 Github 上都没有 Nicolas Tomb 的标志。看起来似乎是为了上传这些 snap 应用才创建的名称。 + +这同样引出了 Canonical 公司发表的申明中的一点,关于验证发布者。上一次我查看的时候,相当多的 snap 应用不是由应用的维护者发布的。这让我感到担忧。我更乐意相信 firefox 的 snap 应用是由 Mozilla 基金会发布的,而不是 Leonard Borsch。如果对应用维护者来说关注应用的 snap 版本太耗费精力,应该有办法让维护者在他们软件的 snap 版本上贴上批准的标签。就像是 Firefox 的 snap 版本由 Fredrick 发布,经 Mozilla 基金会批准。只是为了让用户对下载的内容更放心。 + +#### Snap 应用商店无疑有改善的空间 + +在我看来,Snap 应用商店团队应该实现的第一个特性是报告可疑应用的方式。tarwirdur 必须找到该网站的 Github 页面。大多数用户不会想到这一点。如果 Snap 应用商店不能审核每一行代码,使用户能够报告问题是下一个最好的事情。即使评分系统也不会是一个坏的补充。我确信一定有部分人因为 2048buntu 使用了太多系统资源而给它很低的评分。 + +#### 结论 + +从我所见过的来说,我认为某个人开发了一些简单的应用,在每个应用中嵌入了加密货币矿工,之后将这些应用上传到 Snap 应用商店,想着捞一笔钱。一旦他们被抓了,他们就声称这仅仅为了通过应用程序获利。如果这是真的,他们应该已经在 snap 应用的描述中提到了。隐藏加密矿工并不是什么[新鲜事][9]。他们通常是一种盗取计算能力的方法。 + +我希望 Canonical 公司已经具备了解决这个问题的功能,盼望这些功能能很快出来。 + +你对 Snap 应用商店的‘恶意软件风波’有什么看法?你将如何改善这种情况?请在下面的评论中告诉我们。 + +如果你觉得这篇文章有趣,请花费一点时间将它分享到社交媒体上。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/snapstore-cryptocurrency-saga/ + +作者:[John Paul][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[paperzhang](https://github.com/paperzhang) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/ubuntu-snap-malware-800x450.jpeg +[2]:https://github.com/tarwirdur +[3]:https://github.com/canonical-websites/snapcraft.io/issues/651 +[4]:https://disqus.com/home/discussion/omgubuntu/malware_found_on_the_ubuntu_snap_store/#comment-3899153046 +[5]:https://blog.ubuntu.com/2018/05/15/trust-and-security-in-the-snap-store +[6]:https://forum.snapcraft.io/t/action-against-snap-store-malware/5417/8 +[7]:http://www.dictionary.com/browse/malware?s=t +[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/2048buntu.png +[9]:https://krebsonsecurity.com/2018/03/who-and-what-is-coinhive/ \ No newline at end of file From 221354fce37b8fa220dc2225d8695bbdadea4c6d Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sun, 27 May 2018 11:24:56 +0800 Subject: [PATCH 49/84] Translated by qhwdw --- ...0423 An introduction to Python bytecode.md | 156 ------------------ ...0423 An introduction to Python bytecode.md | 155 +++++++++++++++++ 2 files changed, 155 insertions(+), 156 deletions(-) delete mode 100644 sources/tech/20180423 An introduction to Python bytecode.md create mode 100644 translated/tech/20180423 An introduction to Python bytecode.md diff --git a/sources/tech/20180423 An introduction to Python bytecode.md b/sources/tech/20180423 An introduction to Python bytecode.md deleted file mode 100644 index fc6661e6d0..0000000000 --- a/sources/tech/20180423 An introduction to Python bytecode.md +++ /dev/null @@ -1,156 +0,0 @@ -Translating by qhwdw -An introduction to Python bytecode -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82) -If you've ever written, or even just used, Python, you're probably used to seeing Python source code files; they have names ending in `.py`. And you may also have seen another type of file, with a name ending in `.pyc`, and you may have heard that they're Python "bytecode" files. (These are a bit harder to see on Python 3—instead of ending up in the same directory as your `.py` files, they go into a subdirectory called `__pycache__`.) And maybe you've heard that this is some kind of time-saver that prevents Python from having to re-parse your source code every time it runs. - -But beyond "oh, that's Python bytecode," do you really know what's in those files and how Python uses them? - -If not, today's your lucky day! I'll take you through what Python bytecode is, how Python uses it to execute your code, and how knowing about it can help you. - -### How Python works - -Python is often described as an interpreted language—one in which your source code is translated into native CPU instructions as the program runs—but this is only partially correct. Python, like many interpreted languages, actually compiles source code to a set of instructions for a virtual machine, and the Python interpreter is an implementation of that virtual machine. This intermediate format is called "bytecode." - -So those `.pyc` files Python leaves lying around aren't just some "faster" or "optimized" version of your source code; they're the bytecode instructions that will be executed by Python's virtual machine as your program runs. - -Let's look at an example. Here's a classic "Hello, World!" written in Python: -``` -def hello() - -    print("Hello, World!") - -``` - -And here's the bytecode it turns into (translated into a human-readable form): -``` -2           0 LOAD_GLOBAL              0 (print) - -            2 LOAD_CONST               1 ('Hello, World!') - -            4 CALL_FUNCTION            1 - -``` - -If you type up that `hello()` function and use the [CPython][1] interpreter to run it, the above listing is what Python will execute. It might look a little weird, though, so let's take a deeper look at what's going on. - -### Inside the Python virtual machine - -CPython uses a stack-based virtual machine. That is, it's oriented entirely around stack data structures (where you can "push" an item onto the "top" of the structure, or "pop" an item off the "top"). - -CPython uses three types of stacks: - - 1. The **call stack**. This is the main structure of a running Python program. It has one item—a "frame"—for each currently active function call, with the bottom of the stack being the entry point of the program. Every function call pushes a new frame onto the call stack, and every time a function call returns, its frame is popped off. - 2. In each frame, there's an **evaluation stack** (also called the **data stack** ). This stack is where execution of a Python function occurs, and executing Python code consists mostly of pushing things onto this stack, manipulating them, and popping them back off. - 3. Also in each frame, there's a **block stack**. This is used by Python to keep track of certain types of control structures: loops, `try`/`except` blocks, and `with` blocks all cause entries to be pushed onto the block stack, and the block stack gets popped whenever you exit one of those structures. This helps Python know which blocks are active at any given moment so that, for example, a `continue` or `break` statement can affect the correct block. - - - -Most of Python's bytecode instructions manipulate the evaluation stack of the current call-stack frame, although there are some instructions that do other things (like jump to specific instructions or manipulate the block stack). - -To get a feel for this, suppose we have some code that calls a function, like this: `my_function(my_variable, 2)`. Python will translate this into a sequence of four bytecode instructions: - - 1. A `LOAD_NAME` instruction that looks up the function object `my_function` and pushes it onto the top of the evaluation stack - 2. Another `LOAD_NAME` instruction to look up the variable `my_variable` and push it on top of the evaluation stack - 3. A `LOAD_CONST` instruction to push the literal integer value `2` on top of the evaluation stack - 4. A `CALL_FUNCTION` instruction - - - -The `CALL_FUNCTION` instruction will have an argument of 2, which indicates that Python needs to pop two positional arguments off the top of the stack; then the function to call will be on top, and it can be popped as well (for functions involving keyword arguments, a different instruction—`CALL_FUNCTION_KW`—is used, but with a similar principle of operation, and a third instruction, `CALL_FUNCTION_EX`, is used for function calls that involve argument unpacking with the `*` or `**` operators). Once Python has all that, it will allocate a new frame on the call stack, populate the local variables for the function call, and execute the bytecode of `my_function` inside that frame. Once that's done, the frame will be popped off the call stack, and in the original frame the return value of `my_function` will be pushed on top of the evaluation stack. - -### Accessing and understanding Python bytecode - -If you want to play around with this, the `dis` module in the Python standard library is a huge help; the `dis` module provides a "disassembler" for Python bytecode, making it easy to get a human-readable version and look up the various bytecode instructions. [The documentation for the `dis` module][2] goes over its contents and provides a full list of bytecode instructions along with what they do and what arguments they take. - -For example, to get the bytecode listing for the `hello()` function above, I typed it into a Python interpreter, then ran: -``` -import dis - -dis.dis(hello) - -``` - -The function `dis.dis()` will disassemble a function, method, class, module, compiled Python code object, or string literal containing source code and print a human-readable version. Another handy function in the `dis` module is `distb()`. You can pass it a Python traceback object or call it after an exception has been raised, and it will disassemble the topmost function on the call stack at the time of the exception, print its bytecode, and insert a pointer to the instruction that raised the exception. - -It's also useful to look at the compiled code objects Python builds for every function since executing a function makes use of attributes of those code objects. Here's an example looking at the `hello()` function: -``` ->>> hello.__code__ - -", line 1> - ->>> hello.__code__.co_consts - -(None, 'Hello, World!') - ->>> hello.__code__.co_varnames - -() - ->>> hello.__code__.co_names - -('print',) - -``` - -The code object is accessible as the attribute `__code__` on the function and carries a few important attributes: - - * `co_consts` is a tuple of any literals that occur in the function body - * `co_varnames` is a tuple containing the names of any local variables used in the function body - * `co_names` is a tuple of any non-local names referenced in the function body - - - -Many bytecode instructions—particularly those that load values to be pushed onto the stack or store values in variables and attributes—use indices in these tuples as their arguments. - -So now we can understand the bytecode listing of the `hello()` function: - - 1. `LOAD_GLOBAL 0`: tells Python to look up the global object referenced by the name at index 0 of `co_names` (which is the `print` function) and push it onto the evaluation stack - 2. `LOAD_CONST 1`: takes the literal value at index 1 of `co_consts` and pushes it (the value at index 0 is the literal `None`, which is present in `co_consts` because Python function calls have an implicit return value of `None` if no explicit `return` statement is reached) - 3. `CALL_FUNCTION 1`: tells Python to call a function; it will need to pop one positional argument off the stack, then the new top-of-stack will be the function to call. - - - -The "raw" bytecode—as non-human-readable bytes—is also available on the code object as the attribute `co_code`. You can use the list `dis.opname` to look up the names of bytecode instructions from their decimal byte values if you'd like to try to manually disassemble a function. - -### Putting bytecode to use - -Now that you've read this far, you might be thinking "OK, I guess that's cool, but what's the practical value of knowing this?" Setting aside curiosity for curiosity's sake, understanding Python bytecode is useful in a few ways. - -First, understanding Python's execution model helps you reason about your code. People like to joke about C being a kind of "portable assembler," where you can make good guesses about what machine instructions a particular chunk of C source code will turn into. Understanding bytecode will give you the same ability with Python—if you can anticipate what bytecode your Python source code turns into, you can make better decisions about how to write and optimize it. - -Second, understanding bytecode is a useful way to answer questions about Python. For example, I often see newer Python programmers wondering why certain constructs are faster than others (like why `{}` is faster than `dict()`). Knowing how to access and read Python bytecode lets you work out the answers (try it: `dis.dis("{}")` versus `dis.dis("dict()")`). - -Finally, understanding bytecode and how Python executes it gives a useful perspective on a particular kind of programming that Python programmers don't often engage in: stack-oriented programming. If you've ever used a stack-oriented language like FORTH or Factor, this may be old news, but if you're not familiar with this approach, learning about Python bytecode and understanding how its stack-oriented programming model works is a neat way to broaden your programming knowledge. - -### Further reading - -If you'd like to learn more about Python bytecode, the Python virtual machine, and how they work, I recommend these resources: - - * [Inside the Python Virtual Machine][3] by Obi Ike-Nwosu is a free online book that does a deep dive into the Python interpreter, explaining in detail how Python actually works. - * [A Python Interpreter Written in Python][4] by Allison Kaptur is a tutorial for building a Python bytecode interpreter in—what else—Python itself, and it implements all the machinery to run Python bytecode. - * Finally, the CPython interpreter is open source and you can [read through it on GitHub][1]. The implementation of the bytecode interpreter is in the file `Python/ceval.c`. [Here's that file for the Python 3.6.4 release][5]; the bytecode instructions are handled by the `switch` statement beginning on line 1266. - - - -To learn more, attend James Bennett's talk, [A Bit about Bytes: Understanding Python Bytecode][6], at [PyCon Cleveland 2018][7]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/4/introduction-python-bytecode - -作者:[James Bennett][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/ubernostrum -[1]:https://github.com/python/cpython -[2]:https://docs.python.org/3/library/dis.html -[3]:https://leanpub.com/insidethepythonvirtualmachine -[4]:http://www.aosabook.org/en/500L/a-python-interpreter-written-in-python.html -[5]:https://github.com/python/cpython/blob/d48ecebad5ac78a1783e09b0d32c211d9754edf4/Python/ceval.c -[6]:https://us.pycon.org/2018/schedule/presentation/127/ -[7]:https://us.pycon.org/2018/ diff --git a/translated/tech/20180423 An introduction to Python bytecode.md b/translated/tech/20180423 An introduction to Python bytecode.md new file mode 100644 index 0000000000..c27346bc91 --- /dev/null +++ b/translated/tech/20180423 An introduction to Python bytecode.md @@ -0,0 +1,155 @@ +Python 字节码介绍 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82) +如果你从没有写过 Python,或者甚至只是使用过 Python,你或许已经习惯于看 Python 源代码文件;它们的名字以 `.py` 结尾。你可能还看到过其它类型的文件,比如使用 `.pyc` 结尾的文件,或许你可能听说过,它们就是 Python 的 "字节码" 文件。(在 Python 3 上这些可能不容易看到 — 因为它们与你的 `.py` 文件不在同一个目录下,它们在一个叫 `__pycache__` 的子目录中)或者你也听说过,这是节省时间的一种方法,它可以避免每次运行 Python 时去重新解析源代码。 + +但是,除了 “噢,原来这就是 Python 字节码” 之外,你还知道这些文件能做什么吗?以及 Python 是如何使用它们的? + +如果你不知道,那你走运了!今天我将带你了解 Python 的字节码是什么,Python 如何使用它去运行你的代码,以及知道它是如何帮助你的。 + +### Python 如何工作 + +Python 经常被介绍为它是一个解释型语言 — 其中一个原因是程序运行时,你的源代码被转换成 CPU 的原生指令 — 但这样认为只是部分正确。Python 与大多数解释型语言一样,确实是将源代码编译为一组虚拟机指令,并且 Python 解释器是针对相应的虚拟机实现的。这种中间格式被称为 “字节码”。 + +因此,这些 `.pyc` 文件是 Python 悄悄留下的,是为了让它们运行的 “更快”,或者是针对你的源代码的 “优化” 版本;它们是你的程序在 Python 虚拟机上运行的字节码指令。 + +我们来看一个示例。这里是用 Python 写的经典程序 "Hello, World!": +``` +def hello() + +    print("Hello, World!") + +``` + +下面是转换后的字节码(转换为人类可读的格式): +``` +2           0 LOAD_GLOBAL              0 (print) + +            2 LOAD_CONST               1 ('Hello, World!') + +            4 CALL_FUNCTION            1 + +``` + +如果你输入那个 `hello()` 函数,然后使用 [CPython][1] 解释器去运行它,上面的 Python 程序将会运行。它看起来可能有点奇怪,因此,我们来深入了解一下它都做了些什么。 + +### Python 虚拟机内幕 + +CPython 使用一个基于栈的虚拟机。也就是说,它完全面向栈数据结构的(你可以 “推入” 一个东西到栈 “顶”,或者,从栈 “顶” 上 “弹出” 一个东西来)。 + +CPython 使用三种类型的栈: + + 1. **调用栈**。这是运行 Python 程序的主要结构。它为每个当前活动的函数调用使用了一个东西 — "帧“,栈底是程序的入口点。每个函数调用推送一个新帧到调用栈,每当函数调用返回后,这个帧被销毁。 + 2. 在每个帧中,有一个 **计算栈** (也称为 **数据栈**)。这个栈就是 Python 函数运行的地方,运行的 Python 代码大多数是由推入到这个栈中的东西组成的,操作它们,然后在返回后销毁它们。 + 3. 在每个帧中,还有一个 **块栈**。它被 Python 用于去跟踪某些类型的控制结构:loops、`try`/`except` 块、以及 `with` 块,全部推入到块栈中,当你退出这些控制结构时,块栈被销毁。这将帮助 Python 了解任意给定时刻哪个块是活动的,比如,一个 `continue` 或者 `break` 语句可能影响正确的块。 + + + +大多数 Python 字节码指令操作的是当前调用栈帧的计算栈,虽然,还有一些指令可以做其它的事情(比如跳转到指定指令,或者操作块栈)。 + +为了更好地理解,假设我们有一些调用函数的代码,比如这个:`my_function(my_variable, 2)`。Python 将转换为一系列字节码指令: + + 1. 一个 `LOAD_NAME` 指令去查找函数对象 `my_function`,然后将它推入到计算栈的顶部 + 2. 另一个 `LOAD_NAME` 指令去查找变量 `my_variable`,然后将它推入到计算栈的顶部 + 3. 一个 `LOAD_CONST` 指令去推入一个实整数值 `2` 到计算栈的顶部 + 4. 一个 `CALL_FUNCTION` 指令 + + + +这个 `CALL_FUNCTION` 指令将有 2 个参数,它表示那个 Python 需要从栈顶弹出两个位置参数;然后函数将在它上面进行调用,并且它也同时被弹出(对于函数涉及的关键字参数,它使用另一个不同的指令 — `CALL_FUNCTION_KW`,但使用的操作原则类似,以及第三个指令 — `CALL_FUNCTION_EX`,它适用于函数调用涉及到使用 `*` 或 `**` 操作符的情况)。一旦 Python 拥有了这些之后,它将在调用栈上分配一个新帧,填充到函数调用的本地变量上,然后,运行那个帧内的 `my_function` 字节码。运行完成后,这个帧将被调用栈销毁,最初的帧内返回的 `my_function` 将被推入到计算栈的顶部。 + +### 访问和理解 Python 字节码 + +如果你想玩转字节码,那么,Python 标准库中的 `dis` 模块将对你有非常大的帮助;`dis` 模块为 Python 字节码提供了一个 "反汇编",它可以让你更容易地得到一个人类可读的版本,以及查找各种字节码指令。[`dis` 模块的文档][2] 可以让你遍历它的内容,并且提供一个字节码指令能够做什么和有什么样的参数的完整清单。 + +例如,获取上面的 `hello()` 函数的列表,可以在一个 Python 解析器中输入如下内容,然后运行它: +``` +import dis + +dis.dis(hello) + +``` + +函数 `dis.dis()` 将反汇编一个函数、方法、类、模块、编译过的 Python 代码对象、或者字符串包含的源代码,以及显示出一个人类可读的版本。`dis` 模块中另一个方便的功能是 `distb()`。你可以给它传递一个 Python 追溯对象,或者发生预期外情况时调用它,然后它将反汇编发生预期外情况时在调用栈上最顶端的函数,并显示它的字节码,以及插入一个指向到引发意外情况的指令的指针。 + +它也可以用于查看 Python 为每个函数构建的编译后的代码对象,因为运行一个函数将会用到这些代码对象的属性。这里有一个查看 `hello()` 函数的示例: +``` +>>> hello.__code__ + +", line 1> + +>>> hello.__code__.co_consts + +(None, 'Hello, World!') + +>>> hello.__code__.co_varnames + +() + +>>> hello.__code__.co_names + +('print',) + +``` + +代码对象在函数中可以作为属性 `__code__` 来访问,并且携带了一些重要的属性: + + * `co_consts` 是存在于函数体内的任意实数的元组 + * `co_varnames` 是函数体内使用的包含任意本地变量名字的元组 + * `co_names` 是在函数体内引用的任意非本地名字的元组 + + + +许多字节码指令 — 尤其是那些推入到栈中的加载值,或者在变量和属性中的存储值 — 在这些用作它们参数的元组中使用索引。 + +因此,现在我们能够理解 `hello()` 函数中所列出的字节码: + + 1. `LOAD_GLOBAL 0`:告诉 Python 通过 `co_names` (它是 `print` 函数)的索引 0 上的名字去查找它指向的全局对象,然后将它推入到计算栈 + 2. `LOAD_CONST 1`:带入 `co_consts` 在索引 1 上的实数值,并将它推入(索引 0 上的实数值是 `None`,它表示在 `co_consts` 中,因为 Python 函数调用有一个隐式的返回值 `None`,如果没有显式的返回表达式,就返回这个隐式的值 )。 + 3. `CALL_FUNCTION 1`:告诉 Python 去调用一个函数;它需要从栈中弹出一个位置参数,然后,新的栈顶将被函数调用。 + + + +"原始的" 字节码 — 是非人类可读格式的字节 — 也可以在代码对象上作为 `co_code` 属性可用。如果你有兴趣尝试手工反汇编一个函数时,你可以从它们的十进制字节值中,使用列出 `dis.opname` 的方式去查看字节码指令的名字。 + +### 字节码的用处 + +现在,你已经了解的足够多了,你可能会想 ” OK,我认为它很酷,但是知道这些有什么实际价值呢?“由于对它很好奇,我们去了解它,但是除了好奇之外,Python 字节码在几个方面还是非常有用的。 + +首先,理解 Python 的运行模型可以帮你更好地理解你的代码。人们都开玩笑说,C 将成为一个 ”便携式汇编器“,在那里你可以很好地猜测出一段 C 代码转换成什么样的机器指令。理解 Python 字节码之后,你在使用 Python 时也具备同样的能力 — 如果你能预料到你的 Python 源代码将被转换成什么样的字节码,那么你可以知道如何更好地写和优化 Python 源代码。 + +第二,理解字节码可以帮你更好地回答有关 Python 的问题。比如,我经常看到一些 Python 新手困惑为什么某些结构比其它结构运行的更快(比如,为什么 `{}` 比 `dict()` 快)。知道如何去访问和阅读 Python 字节码将让你很容易回答这样的问题(尝试对比一下: `dis.dis("{}")` 与 `dis.dis("dict()")` 就会明白)。 + +最后,理解字节码和 Python 如何运行它,为 Python 程序员不经常使用的一种特定的编程方式提供了有用的视角:面向栈的编程。如果你以前从来没有使用过像 FORTH 或 Fator 这样的面向栈的编程语言,它们可能有些古老,但是,如果你不熟悉这种方法,学习有关 Python 字节码的知识,以及理解面向栈的编程模型是如何工作的,将有助你开拓你的编程视野。 + +### 延伸阅读 + +如果你想进一步了解有关 Python 字节码、Python 虚拟机、以及它们是如何工作的更多知识,我推荐如下的这些资源: + + * [Python 虚拟机内幕][3],它是 Obi Ike-Nwosu 写的一本免费在线电子书,它深入 Python 解析器,解释了 Python 如何工作的细节。 + * [一个用 Python 编写的 Python 解析器][4],它是由 Allison Kaptur 写的一个教程,它是用 Python 构建的 Python 字节码解析器,并且它实现了运行 Python 字节码的全部构件。 + * 最后,CPython 解析器是一个开源软件,你可以在 [GitHub][1] 上阅读它。它在文件 `Python/ceval.c` 中实现了字节码解析器。[这是 Python 3.6.4 发行版中那个文件的链接][5];字节码指令是由第 1266 行开始的 `switch` 语句来处理的。 + + + +学习更多内容,参与到 James Bennett 的演讲,[有关字节的知识:理解 Python 字节码][6],将在 [PyCon Cleveland 2018][7] 召开。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/4/introduction-python-bytecode + +作者:[James Bennett][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/ubernostrum +[1]:https://github.com/python/cpython +[2]:https://docs.python.org/3/library/dis.html +[3]:https://leanpub.com/insidethepythonvirtualmachine +[4]:http://www.aosabook.org/en/500L/a-python-interpreter-written-in-python.html +[5]:https://github.com/python/cpython/blob/d48ecebad5ac78a1783e09b0d32c211d9754edf4/Python/ceval.c +[6]:https://us.pycon.org/2018/schedule/presentation/127/ +[7]:https://us.pycon.org/2018/ From 5261230d65d79d40979627693fe6220f04932538 Mon Sep 17 00:00:00 2001 From: zsy Date: Sun, 27 May 2018 11:44:47 +0800 Subject: [PATCH 50/84] [Translated] 20171121 How to Kill The Largest Process In An Unresponsive Linux System --- ...Process In An Unresponsive Linux System.md | 140 ------------------ ...Process In An Unresponsive Linux System.md | 138 +++++++++++++++++ 2 files changed, 138 insertions(+), 140 deletions(-) delete mode 100644 sources/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md create mode 100644 translated/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md diff --git a/sources/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md b/sources/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md deleted file mode 100644 index e87a206d61..0000000000 --- a/sources/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md +++ /dev/null @@ -1,140 +0,0 @@ -translating by cizezsy - -How To Kill The Largest Process In An Unresponsive Linux System -====== -![](https://www.ostechnix.com/wp-content/uploads/2017/11/Kill-The-Largest-Process-720x340.png) - -I, as a blog writer, have bookmarked many blogs, websites and forums to refer Linux and Unix related notes. Sometimes, I had a lot of open tabs in my browser, so my system goes unresponsive for several minutes. I couldn't move the mouse cursor, or kill a process or close any opened tabs. At that times, I had no choice but to forcibly reset the system. Of course, I use **OneTab** and The **Great Suspender** extensions, but they didn 't help much either. I often ran out of memory. This is where **Early OOM** comes in help. For those wondering, it will kill the largest process in an unresponsive system when it has absolutely no other choices. Early OOM checks the amount of available memory and free swap 10 times a second. If both are below 10%, it will kill the largest process. - -### Why Early OOM? Why not built-in OOM killer? - -Before going into further, let me you give a short explanation of OOM killer, also known as **O** ut **O** f **M** emory killer. OOM killer is a process that the Kernel uses when the system is critically low on memory. The main task of OOM killer is to continue killing processes until enough memory is freed for the smooth functioning of the rest of the process that the Kernel is attempting to run. OOM killer will choose the best processes that are least important to the system and free up maximum memory and kill them. We can view the oom_score of each process in **/proc** directory under **pid** section. - -Example: -``` -$ cat /proc/10299/oom_score -1 -``` - -The higher the value of oom_score of any process, the higher is its likelihood of getting killed by the OOM Killer when the system is running out of memory. - -The developer of Early OOM claims that it has one big advantage over the in-kernel OOM killer. As I stated earlier, the Linux oom killer kills the process with the highest score, so the Chrome browser will always be the first victim of the oom killer. To avoid this, Early OOM uses **/proc/*/status** instead of **echo f > /proc/sysrq-trigger**. He also claims that triggering the oom killer manually may not work at all in latest Linux Kernel. - -### Installing Early OOM - -Early OOM is available in AUR, so you can install it using any AUR helper programs in Arch Linux and its derivatives. - -Using [**Pacaur**][1]: -``` -pacaur -S earlyoom -``` - -Using [**Packer**][2]: -``` -packer -S earlyoom -``` - -Using [**Yaourt**][3]: -``` -yaourt -S earlyoom -``` - -Enable and start Early OOM daemon: -``` -sudo systemctl enable earlyoom -``` -``` -sudo systemctl start earlyoom -``` - -On other Linux distributions, compile and install it manually as shown below. -``` -git clone https://github.com/rfjakob/earlyoom.git -cd earlyoom -make -sudo make install -``` - -### Early OOM - Kill The Largest Process In An Unresponsive Linux System - -Run the following command to start Early OOM: -``` -earlyoom -``` - -If you compiled it from source, run the following command to start Early OOM: -``` -./earlyoom -``` - -The sample output would be: -``` -earlyoom 0.12 -mem total: 3863 MiB, min: 386 MiB (10 %) -swap total: 2047 MiB, min: 204 MiB (10 %) -mem avail: 1770 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1772 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1772 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1771 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) -mem avail: 1784 MiB (46 %), swap free: 2047 MiB (99 %) -[...] -``` - -As you see in the above output, Early OOM will display how much memory and swap you have, what the minimum is, how much memory is available and how much swap is free. Remember it will keep running until you manually stop by pressing CTRL+C. - -If both memory and swap reaches below 10%, Early OOM will automatically kill the largest processes until the system has enough memory to run smoothly. You can also configure the minimum percentage value as per your requirement. - -To set available memory minimum to PERCENT of total, run:`` -``` -earlyoom -m -``` - -To set available swap minimum to PERCENT of total, run:`` -``` -earlyoom -s -``` - -For more details, refer the help section. -``` -$ earlyoom -h -earlyoom 0.12 -Usage: earlyoom [OPTION]... - - -m PERCENT set available memory minimum to PERCENT of total (default 10 %) - -s PERCENT set free swap minimum to PERCENT of total (default 10 %) - -M SIZE set available memory minimum to SIZE KiB - -S SIZE set free swap minimum to SIZE KiB - -k use kernel oom killer instead of own user-space implementation - -i user-space oom killer should ignore positive oom_score_adj values - -d enable debugging messages - -v print version information and exit - -r INTERVAL memory report interval in seconds (default 1), set to 0 to - disable completely - -p set niceness of earlyoom to -20 and oom_score_adj to -1000 - -h this help text -``` - -Now, you don't need to worry about highest memory consumption processes. Hope this helps. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/kill-largest-process-unresponsive-linux-system/ - -作者:[Aditya Goturu][a] -译者:[译者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 -[1]:https://www.ostechnix.com/install-pacaur-arch-linux/ -[2]:https://www.ostechnix.com/install-packer-arch-linux-2/ -[3]:https://www.ostechnix.com/install-yaourt-arch-linux/ diff --git a/translated/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md b/translated/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md new file mode 100644 index 0000000000..042cd39684 --- /dev/null +++ b/translated/tech/20171121 How To Kill The Largest Process In An Unresponsive Linux System.md @@ -0,0 +1,138 @@ +如何在无响应的 Linux 系统中杀掉最大的进程 +====== +![](https://www.ostechnix.com/wp-content/uploads/2017/11/Kill-The-Largest-Process-720x340.png) + +作为一名博客作者,我收藏了很多博客、网站和论坛用来标记 Linux 和 Unix 相关的内容。有时候,我在浏览器中开启了非常多的标签页,导致操作系统会无响应好几分钟。我不能移动我的鼠标去杀掉一个进程或关闭任何开启的标签页。在这种情况下,我别无选择,只能强制重启系统。当然我也用了 **OneTab** (译者注:OneTab 是一个 Chrome 的 Extension, 可以将标签页转化成一个列表保存。)和 **Greate Suspender** (译者注:Great Suspender 是一个 Chrome 的 Extension, 可以自动冻结标签页)这样浏览器拓展,但它们在这里也起不到太大的作用。 我经常耗尽我的内存。而这就是 **Early OOM** 起作用的时候了。在情况严重,它会杀掉一个未响应系统中的最大的进程。Early OOM 每秒会检测可用内存和空余交换区 10 次,一旦两者都低于 10%,它就会把最大的进程杀死。 + +### 为什么用 Early OOM?为什么不用系统内置的 OOM killer? + +在继续讨论下去之前,我想先简短的介绍下 OOM killer,也就是 **O** ut **O** f **M** emory killer。OOM killer 是一个由内核在可用内存非常低的时候使用的进程。它的主要任务是不断的杀死进程,直到释放出足够的内存,是内核正在运行的进程的其余部分能顺利运行。OOM killer 会找到系统中最不重要并且能释放出最多内存的进程,然后杀掉他们。在 **/proc** 目录下的 **pid** 目录中,我们可以看到每个进程的 oom_score。 + +示例: +``` +$ cat /proc/10299/oom_score +1 +``` + +一个进程的 oom_score 的值越高,这个进程越有可能在系统内存耗尽的时候被 OOM killer 杀死。 + +Early OOM 的开发者表示,相对于内置的 OOM killer,Early OOM 有一个很大的优点。就像我之前说的那样,OOM killer 会杀掉 oom_score 最高的进程,而这也导致 Chrome 浏览器总是会成为第一个被杀死的进程。为了避免这种情况发生,Early OOM 使用 **/proc/*/status** 而不是 **echo f > /proc/sysrq-trigger**(译者注:这条命令会调用 OOM killer 杀死进程)。开发者还表示,手动触发 OOM killer 在最新版本的 Linux 内核中很可能不会起作用。 + +### 安装 Early OOM + +Early OOM 在AUR(Arch User Repository)中可以被找到,所以你可以在 Arch 和它的衍生版本中使用任何 AUR 工具安装它。 + +使用 [**Pacaur**][1]: +``` +pacaur -S earlyoom +``` + +使用 [**Packer**][2]: +``` +packer -S earlyoom +``` + +使用 [**Yaourt**][3]: +``` +yaourt -S earlyoom +``` + +启用并启动 Early OOM daemon: +``` +sudo systemctl enable earlyoom +``` +``` +sudo systemctl start earlyoom +``` + +在其它的 Linux 发行版中,可以按如下方法编译安装它 +``` +git clone https://github.com/rfjakob/earlyoom.git +cd earlyoom +make +sudo make install +``` + +### Early OOM - Kill The Largest Process In An Unresponsive Linux System杀掉无响应 Linux 系统中的最大的进程 + +运行如下命令启动 Early OOM: +``` +earlyoom +``` + +如果是通过编译源代码安装的, 运行如下命令启动 Early OOM: +``` +./earlyoom +``` + +示例输出: +``` +earlyoom 0.12 +mem total: 3863 MiB, min: 386 MiB (10 %) +swap total: 2047 MiB, min: 204 MiB (10 %) +mem avail: 1770 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1772 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1772 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1771 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1773 MiB (45 %), swap free: 2047 MiB (99 %) +mem avail: 1784 MiB (46 %), swap free: 2047 MiB (99 %) +[...] +``` + +就像你在上面的输出中可以看到的,Early OOM 将会显示你有多少内存和交换区,以及有多少可用的内存和交换区。记住它会一直保持运行,直到你按下 CTRL+C。 + +如果可用的内存和交换区大小都低于 10%,Early OOM 将会自动杀死最大的进程,直到系统有足够的内存可以流畅的运行。你也可以根据你的需求配置最小百分比值。 + +设置最小的可用内存百分比,运行: +``` +earlyoom -m +``` + +设置最小可用交换区百分比, 运行: +``` +earlyoom -s +``` + +在帮助部分,可以看到更多详细信息: +``` +$ earlyoom -h +earlyoom 0.12 +Usage: earlyoom [OPTION]... + + -m PERCENT set available memory minimum to PERCENT of total (default 10 %) + -s PERCENT set free swap minimum to PERCENT of total (default 10 %) + -M SIZE set available memory minimum to SIZE KiB + -S SIZE set free swap minimum to SIZE KiB + -k use kernel oom killer instead of own user-space implementation + -i user-space oom killer should ignore positive oom_score_adj values + -d enable debugging messages + -v print version information and exit + -r INTERVAL memory report interval in seconds (default 1), set to 0 to + disable completely + -p set niceness of earlyoom to -20 and oom_score_adj to -1000 + -h this help text +``` + +现在,你再也不用担心内存消耗最高的进程了。希望这能给你帮助。更多的好内容将会到来,敬请期待。 + +谢谢! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/kill-largest-process-unresponsive-linux-system/ + +作者:[Aditya Goturu][a] +译者:[cizezsy](https://github.com/cizezsy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.ostechnix.com +[1]:https://www.ostechnix.com/install-pacaur-arch-linux/ +[2]:https://www.ostechnix.com/install-packer-arch-linux-2/ +[3]:https://www.ostechnix.com/install-yaourt-arch-linux/ From ecdda35d078fbd5eeecbb54f7d46a8c48fa676e7 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sun, 27 May 2018 13:49:15 +0800 Subject: [PATCH 51/84] Translated by qhwdw --- ...ith The Unbreakable Linux Network (ULN).md | 71 +++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) rename {sources => translated}/tech/20180406 How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN).md (75%) diff --git a/sources/tech/20180406 How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN).md b/translated/tech/20180406 How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN).md similarity index 75% rename from sources/tech/20180406 How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN).md rename to translated/tech/20180406 How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN).md index 34e6c36401..92c8407884 100644 --- a/sources/tech/20180406 How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN).md +++ b/translated/tech/20180406 How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN).md @@ -1,58 +1,57 @@ -Translating by qhwdw -How To Register The Oracle Linux System With The Unbreakable Linux Network (ULN) +Oracle Linux 系统如何去注册使用坚不可摧 Linux 网络(ULN) ====== -Most of us knows about RHEL subscription but only few of them knows about Oracle subscription and its details. +大多数人都知道 RHEL 的订阅 ,但是知道 Oracle 订阅及细节的人却很少。 -Even i don’t know the information about this and i recently came to know about this and wants to share this with others so, i’m going to write a article which will guide you to register the Oracle Linux system with the Unbreakable Linux Network (ULN). +甚至我也不知道关于它的信息,我是最近才了解了有关它的信息,想将这些内容共享给其他人。因此写了这篇文章,它将指导你去注册 Oracle Linux 系统去使用坚不可摧 Linux 网络(ULN) 。 -This allows the register systems to get software update and other patches ASAP. +这将允许你去注册系统以获得软件更新和其它的 ASAP 补丁。 -### What Is Unbreakable Linux Network +### 什么是坚不可摧 Linux 网络 -ULN stands for Unbreakable Linux Network which is owned by Oracle. If you have a active subscription to Oracle OS Support, you can register your system with Unbreakable Linux Network (ULN). +ULN 代表坚不可摧 Linux 网络,它是由 Oracle 所拥有的。如果你去 Oracle OS 支持中去激活这个订阅,你就可以注册你的系统去使用坚不可摧 Linux 网络(ULN)。 -ULN offers software patches, updates, and fixes for Oracle Linux and Oracle VM, as well as information on yum, Ksplice, and support policies. You can also download useful packages that are not included in the original distribution. +ULN 为 Oracle Linux 和 Oracle VM 提供软件补丁、更新、以及修复,此外还有在 yum、Ksplice、以及支持策略上的信息。你也可以通过它来下载原始发行版中没有包含的有用的安装包。 -The ULN Alert Notification Tool periodically checks with ULN and alerts you when updates are available. +ULN 的告警提示工具周期性地使用 ULN 去检查,当有更新的时候它给你发送警报信息。 -If you want to use ULN repository with yum to manage your systems, make sure your system should registered with ULN and subscribe each system to one or more ULN channels. When you register a system with ULN, automatically it will choose latest version of channel based on the system architecture and OS. +如果你想在 yum 上使用 ULN 仓库去管理你的系统,需要确保你的系统已经注册到 ULN 上,并且订阅了一个或多个 ULN 频道。当你注册一个系统使用 ULN,它将基于你的系统架构和操作系统去自动选择频道中最新的版本。 -### How To Register As A ULN User +### 如何注册为一个 ULN 用户 -To register as a ULN user, make sure you have a valid customer support identifier (CSI) for Oracle Linux support or Oracle VM support. +去注册为一个 ULN 用户,需要你有一个 Oracle Linux 支持或者 Oracle VM 支持的有效客户支持代码(CSI)。 -Follow the below steps to register as a ULN user. +请按以下步骤去注册为一个 ULN 用户。 -Visit @ [linux.oracle.com][1] +请访问 [linux.oracle.com][1] ![][3] -If you already have an SSO account, click Sign On. +如果你已经有一个 SSO 帐户,请点击 “Sign On”。 ![][4] -If you don’t have a account, click Create New Single Signon Account and follow the onscreen instructions to create one. +如果你没有帐户,点击 “Create New Single Signon Account” 然后按屏幕上的要求去创建一个帐户。 ![][5] -Verify your email address to complete your account setup. +验证你的电子邮件地址以完成帐户设置。 -Log in using your SSO user name and password. On the Create New ULN User page, enter your CSI and click Create New User. +使用你的 SSO 帐户的用户名和密码去登入。在 “Create New ULN User” 页面上,输入你的 CSI 然后点击 “Create New User”。 ![][6] -**Note :** +**注意:** - * If no administrator is currently assigned to manage the CSI, you are prompted to click Confirm to become the CSI administrator. - * If your user name already exists on the system, you are prompted to proceed to ULN by clicking the link Unbreakable Linux Network. + * 如果当前没有分配管理员去管理 CSI,将会提示你去点击确认让你成为 CSI 管理员。 + * 如果你的用户名已经在系统上存在,你将被提示通过点击坚不可摧 Linux 网络的链接去操作 ULN。 -### How To Register The Oracle Linux 6/7 System With ULN +### 如何注册 Oracle Linux 6/7 系统使用 ULN -Just run the below command and follow the instruction to register the system. +只需要运行下列的命令,并按随后的指令提示去注册系统。 ``` # uln_register ``` -Make sure your system is having active internet connection. Also keep ready your Oracle Single Sign-On Login & password (SSO) details then hit `Next`. +确保你的系统有一个活动的因特网连接。同时准备好你的 Oracle 单点登陆帐户(SSO)的用户名和密码,然后点击 `Next`。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -78,7 +77,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -Input your login information for Unbreakable Linux Network, then hit `Next`. +输入你的 ULN 登陆信息,然后点击 `Next`。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -101,7 +100,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -Register a System Profile – Hardware information, then hit `Next`. +注册一个系统概要 – 硬件信息,然后点击 `Next`。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -130,7 +129,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -Register a System Profile – Packages configuration, then hit `Next`. +注册一个系统概要 – 包配置,然后点击 `Next`。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -168,7 +167,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -Press “Next” to send this System Profile to Unbreakable Linux Network. +按下 “Next” 去发送系统概要到 ULN。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -188,7 +187,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -Sending Profile to Unbreakable Linux Network is under processing. +发送概要到 ULN 是如下的一个过程。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -202,7 +201,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -ULN registration has been done and review system subscription details. If everything is fine, then hit `ok`. +ULN 注册做完后,重新回顾系统订阅的详细情况。如果一切正确,然后点击 `ok`。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -237,7 +236,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -Finally hit `Finish` to complete the registration. +最后点击 `Finish` 完成注册。 ``` Copyright © 2006--2010 Red Hat, Inc. All rights reserved. @@ -256,7 +255,7 @@ Copyright © 2006--2010 Red Hat, Inc. All rights reserved. ``` -ULN registration has been done successfully, in order to get repository from ULN run the following command. +ULN 注册已经成功,为了从 ULN 中得到仓库,运行如下的命令。 ``` # yum repolist Loaded plugins: aliases, changelog, presto, refresh-packagekit, rhnplugin, security, tmprepo, ulninfo, verify, versionlock @@ -271,13 +270,13 @@ repolist: 40,966 ``` -Also, you can check the same in ULN website. Go to the `System` tab to view the list of registered systems. +另外,你也可以在 ULN 网站上查看到相同的信息。转到 `System` 标签页去查看已注册的系统列表。 ![][7] -To view list of the enabled repositories. Go to the `System` tab then hit the corresponding system. Also, you can able to see the available updates for the system for errata. +去查看已经启用的仓库列表。转到 `System` 标签页,然后点击相应的系统。另外,你也能够看到系统勘误及可用更新。 ![][8] -To manage subscription channel. Go to the `System` tab, then hit appropriate `system name` and finally hit `Manage Subscriptions`. +去管理订阅的频道。转到 `System` 标签页,然后点击有关的 `system name`,最后点击 `Manage Subscriptions`。 ![][9] -------------------------------------------------------------------------------- @@ -285,7 +284,7 @@ To manage subscription channel. Go to the `System` tab, then hit appropriate `sy via: https://www.2daygeek.com/how-to-register-the-oracle-linux-system-with-the-unbreakable-linux-network-uln/ 作者:[Vinoth Kumar][a] -译者:[译者ID](https://github.com/译者ID) +译者:[qhwdw](https://github.com/qhwdw) 校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) From c9c082cad0cb828138341e92348492216d62b091 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 May 2018 17:25:48 +0800 Subject: [PATCH 52/84] PRF:20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @paperzhang 整体翻译的不错。遇到个别俚语,可以查阅俚语字典,比如: https://www.internetslang.com/HINKEY-meaning-definition.asp --- ...ncy Malware Found on Ubuntus Snap Store.md | 67 ++++++++++--------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md b/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md index dc314d5758..5ed1a9fa7f 100644 --- a/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md +++ b/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md @@ -1,86 +1,87 @@ -关于在 Ubuntu Snap 应用商店上发现的加密货币 ‘恶意软件’ 需要了解的内容 +在 Ubuntu Snap 应用商店上发现的加密货币 ‘恶意软件’ 是怎么回事? ====== -最近,有发现称一些 Ubuntu Snaps 应用商店上的应用包含加密货币挖矿程序。Canonical 公司迅速下架了这些违规的应用,但是留下了几个有待回答的问题。 + +最近,有发现称一些 Ubuntu Snap 应用商店上的应用包含加密货币挖矿程序。Canonical 公司迅速下架了这些违规的应用,但是留下了几个有待回答的问题。 ### 在 Snap 应用商店上发现了加密矿工 ![Crypto Miner Malware on Ubuntu Snap Store][1] -5月11号,一位名叫 [tarwirdur][2] 的用户在 [snapcraft.io repository][3] 开了一个新的 issue ,他提到一个由 Nicolas Tomb 开发,叫做 2048buntu 的 snap 应用包含加密货币矿工。tarwirdur 询问他怎样才能因为安全原因“抱怨应用” 。tarwirdur 后来发表说其他由 Nicolas Tomb 开发的 snap 应用都包含加密货币矿工。 +5 月 11 号,一位名叫 [tarwirdur][2] 的用户在 [snapcraft.io repository][3] 开了一个新的工单 ,他提到一个由 Nicolas Tomb 开发,叫做 2048buntu 的 snap 应用包含加密货币矿工。tarwirdur 询问,他怎样才能出于安全的原因而“投诉该应用” 。tarwirdur 后来发表说其它由 Nicolas Tomb 开发的 snap 应用也都包含加密货币矿工。 -看起来 snap 应用使用了 systemd 在系统启动时自动地运行代码,并在用户不知情的情况下在后台运行。 +看起来该 snap 应用使用了 systemd 在系统启动时自动地运行代码,并在用户不知情的情况下在后台运行。 -{对那些不熟悉相关术语的人来说,加密货币矿工是一段占用计算机主处理器或者图形处理器来“挖掘”数字货币的程序。“挖矿”通常涉及到解决一个数学等式。在这种情况下,如果你在运行 2048buntu 游戏,这个游戏将会使用处理器额外的计算能力去进行加密货币的挖掘。} +> 对那些不熟悉相关术语的人来说,加密货币cryptocurrency矿工miner是一段使用计算机的主处理器或者图形处理器来“挖掘”数字货币的程序。“挖矿”通常涉及到解决一个数学等式。在这种情况下,如果你在运行 2048buntu 游戏,这个游戏将会额外使用处理器的计算能力去进行加密货币的挖掘。 -Snapcraft 团队迅速地下架了所有由违规者开发的应用来做出回应。他们同时也开展了调查。 +Snapcraft 团队迅速地下架了所有由该违规者开发的应用来做出回应。他们同时也开展了调查。 ### 隐匿者发声 -5月13号,一位同名为 Nicolas Tomb 的 Disqus 用户在 OMGUbuntu 的新闻报道上发表了[评论][4],他在评论中称自己向 snap 应用中添加了加密货币矿工,从而获取收益。他为他的行为道歉,同时承诺将所有挖矿所得的收益送给 Ubuntu 基金会。 +5 月 13 号,一位同名为 Nicolas Tomb 的 Disqus 用户在 OMGUbuntu 的新闻报道上发表了[评论][4],他在评论中称自己向 snap 应用中添加了加密货币矿工,从而获取收益。他为他的行为道歉,同时承诺将所有挖矿所得的收益送给 Ubuntu 基金会。 -我们不能确认这个评论就是由 Nicolas Tomb 发表的,因为这个 Disqus 账户最近才被创建,也只有一条评论与之相关联。现在,我们假设是的。 +我们不能确认这个评论就是由 Nicolas Tomb 发表的,因为这个 Disqus 账户最近才被创建,也只有一条评论与之相关联。现在,我们假设他是。 ### Canonical 公司发表了声明 -5月15号,Canonical 公司在这种情况下发表了一份声明。标题为 [“Trust and security in the Snap Store”][5],声明开头重申了当下的情况。他们也补充道[重新发布的 snap 应用中加密货币挖矿程序已经被删除了][6]。 +5 月 15 号,Canonical 公司在这种情况下发表了一份声明。标题为 [“在 Snap 应用商店中的信任与安全”][5],声明开头重申了当下的情况。他们也补充道[重新发布的 snap 应用中已经被删除了加密货币挖矿程序][6]。 -Canonical 公司随后尝试检测 Nicolas Tomb 的动机。他们指出到他称自己这样做是为了通过应用赚钱(如上所诉),而在真的面对赚钱时就停止了。他们也指出“挖掘加密货币本身是不合法也是不道德的”。然而,他们对实际情况仍旧是不满意的,因为 Nicolas Tomb 没有在 snap 应用的描述中透露加密货币矿工。 +Canonical 公司随后尝试调查 Nicolas Tomb 的动机。他们指出,他告诉他们说自己这样做是为了通过应用赚钱(如上所诉),而当面对质疑时就停止了。他们也指出“挖掘加密货币本身并非不合法和不道德的”。然而,他们仍对他没有在 snap 应用描述中披露加密矿工这件事表示了不满意。 -随后 Canonical 公司将主题转移到审核软件上。根据这份申明,Snap 应用商店将会采用一种类似 iOS,Android,Windows 的质量控制系统,这个系统将“自动化检查点,安装包必须在被接受前通过检查,同时在特殊问题被标记时会进行人工审核”。 +随后 Canonical 公司将话题转移到审核软件上。根据这份申明,Snap 应用商店将会采用一种类似 iOS、Android、Windows 的质量控制系统,这个系统将有“自动化的检查点,安装包必须在被接受前通过检查,同时在特殊问题被标记时会进行人工审核”。 -然而,Canonical 公司声称“对巨大而弹性的软件仓库来说,只接受每个单独文件都被仔细审核的软件是不可能的”。因此,他们需要相信软件源而不是基于源开发的应用。毕竟,软件源是现在 Ubuntu 软件仓库系统的基础。 +然后,Canonical 公司声称“对大规模的软件仓库来说,只接受每个单独文件都被仔细审核过的软件是不可能的”。因此,他们需要信任软件源而不是内容。毕竟,软件源是现在 Ubuntu 软件仓库系统的基础。 -Canonical 公司紧接着谈到了 snap 应用的未来。他们承认现在的系统是不完美的。他们也在不断工作进行改善。他们“在目前的工作中有非常有趣的安全功能,这些功能将会改善系统安全性同时提升人们在服务器或桌面上进行软件开发的体验”。 +Canonical 公司紧接着谈到了 Snap 应用的未来。他们承认现在的系统是不完美的。他们也在不断地进行改善。他们“在开发非常有趣的安全功能,这些功能将会在改善系统安全性同时提升人们在服务器或桌面上进行软件开发的体验”。 -其中一个他们正在开发的功能是查看一个软件发布者是否已通过验证。Other improvements include: “upstreaming of all the AppArmor kernel patches” and other under-the-hood fixes.(不确定,under-the-hood 指实现是不透明的,[quora回答](https://www.quora.com/What-does-under-the-hood-mean-in-programming) ,其他的改善包括:“所有 AppArmor 内核补丁的上游”和其他黑盒服务都被修复了。) +其中一个他们正在开发的功能是查看一个软件发布者是否已通过验证。其他的改进包括:“将所有 AppArmor 内核补丁递交到上游”和其它底层修复。 -### 一些关于'Snap 应用商店恶意软件'的想法 +### 一些关于“Snap 应用商店中的恶意软件”的想法 -基于我读过的所有内容,我产生了了一些想法和问题。 +基于我所了解的所有内容,我产生了一些想法和问题。 #### 这种挖矿软件运行多久了? -首先,这些挖矿软件存在于 Snap 应用商店多久了?因为它们已经被下架了,我们没有这样的数据。我可以通过 Google 快照抓取一些 2048buntu 页面的图片,但这没有提供任何可用的信息。根据软件运行时间,多少系统安装过,什么加密货币被挖掘出了,我们可以谈谈违规者获取的一点钱或一笔钱。一个更长远的问题是:Canonical 公司将来有能力捕捉到这样的违规情况吗? +首先,这些挖矿软件存在于 Snap 应用商店多久了?因为它们已经被下架了,我们没有这样的数据。我可以通过 Google 快照抓取一些 2048buntu 页面的图片,但这没有提供任何可用的信息。根据该软件运行时间,多少系统安装过,挖掘出了什么加密货币,我们能否知道违规者获取的是一点钱还是一笔钱。一个更长远的问题是:Canonical 公司将来有能力捕捉到这样的违规情况吗? #### 这真的是一个恶意软件吗? 许多新闻网站将之报道为恶意软件感染。我想我甚至可以看到这个事件被称为 Linux 的第一个恶意软件。我不确定这个术语是否精确。Dictionary.com 这样定义 [恶意软件][7]:“意图损害计算机、移动设备、计算机系统或者计算机网络,或者对其运作进行部分控制的软件”。 -有问题的 snap 应用并没有损害或者控制涉及到的计算机。它同样没有感染其他计算机。它也不能这样做,因为所有的 snap 应用位于沙盒之中。它们最多利用了处理器的计算能力,就是这样。所以,我不会称之为恶意软件。 +这个有问题的 snap 应用并没有损害或者控制涉及到的计算机。它同样没有感染其他计算机。它也不能这样做,因为所有的 snap 应用位于沙盒之中。它们最多利用了处理器的计算能力,就是这样。所以,我不会称之为恶意软件。 -#### Nothing Like a Loophole(无孔不入?) +#### 无孔不入 -Nicolas Tomb 使用的一个辩解是在他上传应用的时候 Snap 应用商店没有任何反对加密货币挖矿的规则。{我敢向你打赌他们正在纠正这个错误。}他们之所以没有这样的规则,原因很简单,之前没有人做过这种事。如果 Tomb 想正确地做事,他应该提前询问是否允许这种行为。而事实是他似乎没有指出他知道 Canonical 公司可能会拒绝的事实。至少,Canonical 公司会告诉他将这些写在软件的描述中。 +Nicolas Tomb 使用的一个辩解是在他上传应用的时候 Snap 应用商店没有任何反对加密货币挖矿的规则。(我敢向你打赌他们正在纠正这个错误。)他们之所以没有这样的规则,原因很简单,之前没有人做过这种事。如果 Tomb 想正确地做事,他应该提前询问是否允许这种行为。而事实是他似乎没有指出他知道 Canonical 公司可能会拒绝的事实。至少,Canonical 公司会告诉他将这些写在软件的描述中。 + +#### 一看就不对劲 ![][8] -#### Something Looks Hinkey(不会翻译) - -如我之前说的,我从 Google 快照获取了一个 2048buntu 的页面截图。仅仅看它就会感觉到一些危险的信号。首先,截图中几乎没有真实的描述。它是这样描述的“类似2048的游戏。这个游戏用 ubuntu 主题克隆了流行的游戏 — 2048。”哇,{这将会引来容易上当受骗的人。}当我读到类似空洞的描述时,我会多考虑下。 +如我之前说的,我从 Google 快照获取了一个 2048buntu 的页面截图。仅仅看它就会感觉到一些危险的信号。首先,截图中几乎没有真实的描述。它是这样描述的“类似 2048 的游戏。这个游戏用 ubuntu 主题克隆了流行的游戏 2048。”哇,这将会引来容易上当受骗的人。当我读到类似空洞的描述时,我会多考虑下。 我注意到的另一件事是软件的大小。2048buntu 的 1.0 版本大小将近 140 MB。一个简单的游戏怎么需要这么多的空间?有用 Javascript 写的浏览器版本大概只用了不到它的四分之一。其他 snap 应用商店的 2048 游戏的大小没有一个达到了这个软件的一半。 -然后,你有许可证。这是一个使用了 Ubuntu 主题的流行游戏的克隆。它如何被认为是专有的?我确信,其他合法的开发者会因为内容而使用了 FOSS (自由开源软件)许可证来上传它。 +然后,它有个许可证。这是一个使用了 Ubuntu 主题的流行游戏的克隆。它怎么能被认为是专有软件?我确信,其他合法的开发者会因为该内容而使用了 FOSS (自由开源软件)许可证来上传它。 -单是这些因素就使得这个 snap 应用很特殊,并呼吁进行审核。 +单是这些因素就使得这个 snap 应用很特殊,应该进行审核。 #### 谁是 Nicolas Tomb? -当第一次读到这些之后,我决定看看我能否找出造成这一团混乱的人。当我搜索 Nicolas Tomb 的时候,我什么都没找到,zip,nada,zilch(感觉是错误,不太明白这几个单词在这里的意思)。所有我找到的只是一大堆关于加密货币挖矿 snap 应用的新闻和文章,以及去 tomb of St. Nicolas 旅游的信息。在 Twiter 和 Github 上都没有 Nicolas Tomb 的标志。看起来似乎是为了上传这些 snap 应用才创建的名称。 +当第一次了解到这些之后,我决定看看我能否找出造成这些混乱的人。当我搜索 Nicolas Tomb 的时候,我什么都没找到。所有我找到的只是一大堆关于加密货币挖矿 snap 应用的新闻和文章,以及去 tomb of St. Nicolas 旅游的信息。在 Twiter 和 Github 上都没有 Nicolas Tomb 的标志。看起来似乎是为了上传这些 snap 应用才创建的名称。 -这同样引出了 Canonical 公司发表的申明中的一点,关于验证发布者。上一次我查看的时候,相当多的 snap 应用不是由应用的维护者发布的。这让我感到担忧。我更乐意相信 firefox 的 snap 应用是由 Mozilla 基金会发布的,而不是 Leonard Borsch。如果对应用维护者来说关注应用的 snap 版本太耗费精力,应该有办法让维护者在他们软件的 snap 版本上贴上批准的标签。就像是 Firefox 的 snap 版本由 Fredrick 发布,经 Mozilla 基金会批准。只是为了让用户对下载的内容更放心。 +这同样引出了 Canonical 公司发表的申明中的一点,关于验证发布者。上一次我查看的时候,相当多的 snap 应用不是由应用的维护者发布的。这让我感到担忧。我更乐意相信由 Mozilla 基金会发布的 firefox 的 snap 应用,而不是 Leonard Borsch。如果对应用维护者来说关注应用的 snap 版本太耗费精力,应该有办法让维护者在他们软件的 snap 版本上贴上批准的标签。就像是 Firefox 的 snap 版本由 Fredrick 发布,经 Mozilla 基金会批准。这样才能让用户对下载的内容更放心。 -#### Snap 应用商店无疑有改善的空间 +#### 无疑 Snap 应用商店还有改善的空间 -在我看来,Snap 应用商店团队应该实现的第一个特性是报告可疑应用的方式。tarwirdur 必须找到该网站的 Github 页面。大多数用户不会想到这一点。如果 Snap 应用商店不能审核每一行代码,使用户能够报告问题是下一个最好的事情。即使评分系统也不会是一个坏的补充。我确信一定有部分人因为 2048buntu 使用了太多系统资源而给它很低的评分。 +在我看来,Snap 应用商店团队应该实现的第一个特性是报告可疑应用的方式。tarwirdur 必须找到该网站的 Github 页面才行。而大多数用户不会想到这一点。如果 Snap 应用商店不能审核每一行代码,那么使用户能够报告问题是退而求其次的办法。即使评分系统也是一个不差的补充。我确信一定有部分人因为 2048buntu 使用了太多系统资源而给它很低的评分。 -#### 结论 +### 结论 -从我所见过的来说,我认为某个人开发了一些简单的应用,在每个应用中嵌入了加密货币矿工,之后将这些应用上传到 Snap 应用商店,想着捞一笔钱。一旦他们被抓了,他们就声称这仅仅为了通过应用程序获利。如果这是真的,他们应该已经在 snap 应用的描述中提到了。隐藏加密矿工并不是什么[新鲜事][9]。他们通常是一种盗取计算能力的方法。 +从我所知道的情况来说,我认为这是某个人创建了一些简单的应用,在每个应用中嵌入了加密货币矿工,之后将这些应用上传到 Snap 应用商店,想着捞一笔钱。一旦他们被抓了,他们就声称这仅仅为了通过应用程序获利。如果真的是这样,他们应该在 snap 应用的描述中提到才对。隐藏加密矿工并不是什么[新鲜事][9]。他们通常是一种盗取计算能力的方法。 我希望 Canonical 公司已经具备了解决这个问题的功能,盼望这些功能能很快出来。 -你对 Snap 应用商店的‘恶意软件风波’有什么看法?你将如何改善这种情况?请在下面的评论中告诉我们。 +你对 Snap 应用商店的“恶意软件风波”有什么看法?你将如何改善这种情况?请在下面的评论中告诉我们。 如果你觉得这篇文章有趣,请花费一点时间将它分享到社交媒体上。 @@ -91,7 +92,7 @@ via: https://itsfoss.com/snapstore-cryptocurrency-saga/ 作者:[John Paul][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[paperzhang](https://github.com/paperzhang) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e81e0741d066651db7b58f3fa832937f6f89bda5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 May 2018 17:26:18 +0800 Subject: [PATCH 53/84] PUB:https://www.internetslang.com/HINKEY-meaning-definition.asp @paperzhang https://linux.cn/article-9686-1.html --- ...ow About Cryptocurrency Malware Found on Ubuntus Snap Store.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md (100%) diff --git a/translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md b/published/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md similarity index 100% rename from translated/tech/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md rename to published/20180517 What You Need to Know About Cryptocurrency Malware Found on Ubuntus Snap Store.md From ff491155758239815cdd715e1871d6f69dc88ed6 Mon Sep 17 00:00:00 2001 From: ShenYu Zheng Date: Sun, 27 May 2018 19:23:04 +0800 Subject: [PATCH 54/84] Update 20180412 Getting started with Jenkins Pipelines.md --- sources/tech/20180412 Getting started with Jenkins Pipelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180412 Getting started with Jenkins Pipelines.md b/sources/tech/20180412 Getting started with Jenkins Pipelines.md index 8fa216396c..bf8a65002e 100644 --- a/sources/tech/20180412 Getting started with Jenkins Pipelines.md +++ b/sources/tech/20180412 Getting started with Jenkins Pipelines.md @@ -1,4 +1,4 @@ -translating by kennethXia +translating by Getting started with Jenkins Pipelines ====== From 1bde6bca676cff9061b3c37f673bac06e2dbf511 Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Sun, 27 May 2018 23:14:40 +0800 Subject: [PATCH 55/84] Create 20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md --- ...onfigure KVM on Ubuntu 18.04 LTS Server.md | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 translated/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md diff --git a/translated/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md b/translated/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md new file mode 100644 index 0000000000..a39d5be591 --- /dev/null +++ b/translated/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md @@ -0,0 +1,224 @@ +如何在 Ubuntu 18.04 服务器上安装和配置 KVM + +====== + +**KVM**(基于内核的虚拟机)是一款为类 Linux 系统提供的开源全虚拟化解决方案,KVM 使用虚拟化扩展(如 **Intel VT** 或 **AMD-V**)提供虚拟化功能。无论何时我们在任何 Linux 机器上安装 KVM,都会通过加载诸如 kvm-intel.ko(基于 Intel 的机器)和 kvm-amd.ko(基于 amd 的机器)的内核模块,使其成为管理程序hyervisor(LCTT 译者注:一种监控和管理虚拟机运行的核心软件层)。 + +KVM 允许我们安装和运行多个虚拟机(Windows 和 Linux)。我们可以通过 **virt-manager** 的图形用户界面或使用 **virt-install** 和 **virsh** 命令在命令行界面来创建和管理基于 KVM 的虚拟机。 + +在本文中,我们将讨论如何在Ubuntu 18.04 LTS 服务器上安装和配置 **KVM 管理程序**。我假设你已经在你的服务器上安装了 Ubuntu 18.04 LTS 。接下来登录到您的服务器执行以下步骤。 + +### 第一步:确认您的硬件是否支持虚拟化 + +执行 egrep 命令以验证您的服务器的硬件是否支持虚拟化, + +``` +linuxtechi@kvm-ubuntu18-04:~$ egrep -c '(vmx|svm)' /proc/cpuinfo +1 +linuxtechi@kvm-ubuntu18-04:~$ + +``` + +如果输出结果大于 0,就意味着您的硬件支持虚拟化。重启,进入 BIOS 设置中启用 VT 技术。 + +现在使用下面的命令安装“ **kvm-ok** ”实用程序,该程序用于确定您的服务器是否能够运行硬件加速的 KVM 虚拟机 + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo apt install cpu-checker + +``` + +运行 kvm-ok 命令确认输出结果, + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo kvm-ok +INFO: /dev/kvm exists +KVM acceleration can be used +linuxtechi@kvm-ubuntu18-04:~$ + +``` + +### 第二步:安装 KVM 及其依赖包 + + +运行下面的 apt 命令安装 KVM 及其依赖项 +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo apt update +linuxtechi@kvm-ubuntu18-04:~$ sudo apt install qemu qemu-kvm libvirt-bin  bridge-utils  virt-manager +``` + +只要上图相应的软件包安装成功,那么你的本地用户(对于我来说是 linuxtechi)将被自动添加到 libvirtd 群组。 + +### 第三步:启动并启用 libvirtd 服务 + +我们在 Ubuntu 18.04 服务器上安装 qemu 和 libvirtd 软件包之后,它就会自动启动并启用 libvirtd 服务,如果 libvirtd 服务没有开启,则运行以下命令开启, + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo service libvirtd start +linuxtechi@kvm-ubuntu18-04:~$ sudo update-rc.d libvirtd enable + +``` + +现在使用下面的命令确认 libvirtd 服务的状态, + +``` +linuxtechi@kvm-ubuntu18-04:~$ service libvirtd status + +``` + +输出结果如下所示: + +[![libvirtd-command-ubuntu18-04][1]![libvirtd-command-ubuntu18-04][2]][3] + +### 第四步:为 KVM 虚拟机配置桥接网络 + +只有通过桥接网络,KVM 虚拟机才能访问外部的 KVM 管理程序或主机。在Ubuntu 18.04中,网络由 netplan 实用程序管理,每当我们新安装一个 Ubuntu 18.04 系统时,会自动创建一个名称为 “**/etc/netplan/50-cloud-init.yaml**” 文件,其配置了静态 IP 和桥接网络,netplan 实用工具将引用这个文件。 + +截至目前,我已经在此文件配置了静态 IP,文件的具体内容如下: + +``` +network: +    ethernets: +        ens33: +            addresses: [192.168.0.51/24] +            gateway4: 192.168.0.1 +            nameservers: +              addresses: [192.168.0.1] +            dhcp4: no +            optional: true +    version: 2 + +``` + +我们在这个文件中添加桥接网络的配置信息, + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo vi /etc/netplan/50-cloud-init.yaml + +network: +  version: 2 +  ethernets: +    ens33: +      dhcp4: no +      dhcp6: no + +  bridges: +    br0: +      interfaces: [ens33] +      dhcp4: no +      addresses: [192.168.0.51/24] +      gateway4: 192.168.0.1 +      nameservers: +        addresses: [192.168.0.1] + +``` + +正如你所看到的,我们已经从接口(ens33)中删除了 IP 地址,并将该 IP 添加到 '**br0**' 中,并且还将接口(ens33)添加到 br0。使用下面的 netplan 命令使更改生效, + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo netplan apply +linuxtechi@kvm-ubuntu18-04:~$ + +``` + +如果您想查看 debug 日志请使用以下命令, + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo netplan --debug  apply + +``` + +现在使用以下方法确认网络桥接状态: + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo networkctl status -a + +``` + +[![networkctl-command-output-ubuntu18-04][1]![networkctl-command-output-ubuntu18-04][4]][4] +``` +linuxtechi@kvm-ubuntu18-04:~$ ifconfig + +``` + +[![ifconfig-command-output-ubuntu18-04][1]![ifconfig-command-output-ubuntu18-04][5]][5] + +### 第五步:创建虚拟机(使用 virt-manager 或 virt-install 命令) + +有两种方式创建虚拟机: + + * virt-manager(图形化工具) + * virt-install(命令行工具) + + +**使用 virt-manager 创建虚拟机:** + +通过执行下面的命令启动 virt-manager, + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo virt-manager + +``` + +[![Start-Virt-Manager-Ubuntu18-04][1]![Start-Virt-Manager-Ubuntu18-04][6]][6] + +创建一个新的虚拟机 + +[![ISO-file-Virt-Manager][1]![ISO-file-Virt-Manager][7]][7] + +点击下一步然后选择 ISO 镜像文件,我使用的是 RHEL 7.3 iso 镜像。 + +[![Select-ISO-file-virt-manager-Ubuntu18-04-Server][1]![Select-ISO-file-virt-manager-Ubuntu18-04-Server][8]][8] + +点击下一步 + +在接下来的几个窗口中,系统会提示要求您为 VM 分配内存,处理器数量和磁盘空间。 + +并指定虚拟机名字和桥接网络名, + +[![VM-Name-Network-Virt-Manager-Ubuntu18-04][1]![VM-Name-Network-Virt-Manager-Ubuntu18-04][9]][9] + +点击结束 + +[![RHEL7-3-Installation-Virt-Manager][1]![RHEL7-3-Installation-Virt-Manager][10]][10] + +接下来只需要按照屏幕指示安装系统, + +**使用virt-install命令从命令行界面创建虚拟机,** + +使用下面的 virt-install 命令从终端创建一个虚拟机,它将在命令行界面中开始安装,并根据您对虚拟机的名字,说明,ISO 文件位置和桥接配置的设置创建虚拟机。 + +``` +linuxtechi@kvm-ubuntu18-04:~$ sudo virt-install  -n DB-Server  --description "Test VM for Database"  --os-type=Linux  --os-variant=rhel7  --ram=1096  --vcpus=1  --disk path=/var/lib/libvirt/images/dbserver.img,bus=virtio,size=10  --network bridge:br0 --graphics none  --location /home/linuxtechi/rhel-server-7.3-x86_64-dvd.iso --extra-args console=ttyS0 + +``` + +本文到此为止,我希望这篇文章能帮助你能够在 Ubuntu 18.04 服务器上成功安装 KVM。 除此之外,KVM 也是 Openstack 默认的管理程序。 + + +阅读更多:“[**如何使用 virsh 命令创建,还原和删除 KVM 虚拟机快照**][11]” + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-configure-kvm-ubuntu-18-04-server/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wyxplus](https://github.com/wyxplus) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ +[1]:https://www.linuxtechi.com/wp-content/plugins/lazy-load/images/1x1.trans.gif +[2]:https://www.linuxtechi.com/wp-content/uploads/2018/05/libvirtd-command-ubuntu18-04-1024x339.jpg +[3]:https://www.linuxtechi.com/wp-content/uploads/2018/05/libvirtd-command-ubuntu18-04.jpg +[4]:https://www.linuxtechi.com/wp-content/uploads/2018/05/networkctl-command-output-ubuntu18-04.jpg +[5]:https://www.linuxtechi.com/wp-content/uploads/2018/05/ifconfig-command-output-ubuntu18-04.jpg +[6]:https://www.linuxtechi.com/wp-content/uploads/2018/05/Start-Virt-Manager-Ubuntu18-04.jpg +[7]:https://www.linuxtechi.com/wp-content/uploads/2018/05/ISO-file-Virt-Manager.jpg +[8]:https://www.linuxtechi.com/wp-content/uploads/2018/05/Select-ISO-file-virt-manager-Ubuntu18-04-Server.jpg +[9]:https://www.linuxtechi.com/wp-content/uploads/2018/05/VM-Name-Network-Virt-Manager-Ubuntu18-04.jpg +[10]:https://www.linuxtechi.com/wp-content/uploads/2018/05/RHEL7-3-Installation-Virt-Manager.jpg +[11]:https://www.linuxtechi.com/create-revert-delete-kvm-virtual-machine-snapshot-virsh-command/ From fd09c169b9ede6e37919a8b0e35c73142e6f6c5d Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Sun, 27 May 2018 23:15:18 +0800 Subject: [PATCH 56/84] Delete 20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md --- ...onfigure KVM on Ubuntu 18.04 LTS Server.md | 210 ------------------ 1 file changed, 210 deletions(-) delete mode 100644 sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md diff --git a/sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md b/sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md deleted file mode 100644 index 34e2527b4f..0000000000 --- a/sources/tech/20180521 How to Install and Configure KVM on Ubuntu 18.04 LTS Server.md +++ /dev/null @@ -1,210 +0,0 @@ -translating by wyxplus -How to Install and Configure KVM on Ubuntu 18.04 LTS Server -====== -**KVM** (Kernel-based Virtual Machine) is an open source full virtualization solution for Linux like systems, KVM provides virtualization functionality using the virtualization extensions like **Intel VT** or **AMD-V**. Whenever we install KVM on any linux box then it turns it into the hyervisor by loading the kernel modules like **kvm-intel.ko** ( for intel based machines) and **kvm-amd.ko** ( for amd based machines). - -KVM allows us to install and run multiple virtual machines (Windows & Linux). We can create and manage KVM based virtual machines either via **virt-manager** graphical user interface or **virt-install** & **virsh** cli commands. - -In this article we will discuss how to install and configure **KVM hypervisor** on Ubuntu 18.04 LTS server. I am assuming you have already installed Ubuntu 18.04 LTS server on your system. Login to your server and perform the following steps. - -### Step:1 Verify Whether your system support hardware virtualization - -Execute below egrep command to verify whether your system supports hardware virtualization or not, -``` -linuxtechi@kvm-ubuntu18-04:~$ egrep -c '(vmx|svm)' /proc/cpuinfo -1 -linuxtechi@kvm-ubuntu18-04:~$ - -``` - -If the output is greater than 0 then it means your system supports Virtualization else reboot your system, then go to BIOS settings and enable VT technology. - -Now Install “ **kvm-ok** ” utility using below command, it is used to determine if your server is capable of running hardware accelerated KVM virtual machines -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo apt install cpu-checker - -``` - -Run kvm-ok command and verify the output, -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo kvm-ok -INFO: /dev/kvm exists -KVM acceleration can be used -linuxtechi@kvm-ubuntu18-04:~$ - -``` - -### Step:2 Install KVM and its required packages - -Run the below apt commands to install KVM and its dependencies -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo apt update -linuxtechi@kvm-ubuntu18-04:~$ sudo apt install qemu qemu-kvm libvirt-bin  bridge-utils  virt-manager - -``` - -Once the above packages are installed successfully, then your local user (In my case linuxtechi) will be added to the group libvirtd automatically. - -### Step:3 Start & enable libvirtd service - -Whenever we install qemu & libvirtd packages in Ubuntu 18.04 Server then it will automatically start and enable libvirtd service, In case libvirtd service is not started and enabled then run beneath commands, -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo service libvirtd start -linuxtechi@kvm-ubuntu18-04:~$ sudo update-rc.d libvirtd enable - -``` - -Now verify the status of libvirtd service using below command, -``` -linuxtechi@kvm-ubuntu18-04:~$ service libvirtd status - -``` - -Output would be something like below: - -[![libvirtd-command-ubuntu18-04][1]![libvirtd-command-ubuntu18-04][2]][3] - -### Step:4 Configure Network Bridge for KVM virtual Machines - -Network bridge is required to access the KVM based virtual machines outside the KVM hypervisor or host. In Ubuntu 18.04, network is managed by netplan utility, whenever we freshly installed Ubuntu 18.04 server then a file with name “ **/etc/netplan/50-cloud-init.yaml** ” is created automatically, to configure static IP and bridge, netplan utility will refer this file. - -As of now I have already configured the static IP via this file and content of this file is below: -``` -network: -    ethernets: -        ens33: -            addresses: [192.168.0.51/24] -            gateway4: 192.168.0.1 -            nameservers: -              addresses: [192.168.0.1] -            dhcp4: no -            optional: true -    version: 2 - -``` - -Let’s add the network bridge definition in this file, -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo vi /etc/netplan/50-cloud-init.yaml - -network: -  version: 2 -  ethernets: -    ens33: -      dhcp4: no -      dhcp6: no - -  bridges: -    br0: -      interfaces: [ens33] -      dhcp4: no -      addresses: [192.168.0.51/24] -      gateway4: 192.168.0.1 -      nameservers: -        addresses: [192.168.0.1] - -``` - -As you can see we have removed the IP address from interface(ens33) and add the same IP to the bridge ‘ **br0** ‘ and also added interface (ens33) to the bridge br0. Apply these changes using below netplan command, -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo netplan apply -linuxtechi@kvm-ubuntu18-04:~$ - -``` - -If you want to see the debug logs then use the below command, -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo netplan --debug  apply - -``` - -Now Verify the bridge status using following methods: -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo networkctl status -a - -``` - -[![networkctl-command-output-ubuntu18-04][1]![networkctl-command-output-ubuntu18-04][4]][4] -``` -linuxtechi@kvm-ubuntu18-04:~$ ifconfig - -``` - -[![ifconfig-command-output-ubuntu18-04][1]![ifconfig-command-output-ubuntu18-04][5]][5] - -### Start:5 Creating Virtual machine (virt-manager or virt-install command ) - -There are two ways to create virtual machine: - - * virt-manager (GUI utility) - * virt-install command (cli utility) - - - -**Creating Virtual machine using virt-manager:** - -Start the virt-manager by executing the beneath command, -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo virt-manager - -``` - -[![Start-Virt-Manager-Ubuntu18-04][1]![Start-Virt-Manager-Ubuntu18-04][6]][6] - -Create a new virtual machine - -[![ISO-file-Virt-Manager][1]![ISO-file-Virt-Manager][7]][7] - -Click on forward and select the ISO file, in my case I am using RHEL 7.3 iso file. - -[![Select-ISO-file-virt-manager-Ubuntu18-04-Server][1]![Select-ISO-file-virt-manager-Ubuntu18-04-Server][8]][8] - -Click on Forward - -In the next couple of windows, you will be prompted to specify the RAM, CPU and disk for the VM. - -Now Specify the Name of the Virtual Machine and network, - -[![VM-Name-Network-Virt-Manager-Ubuntu18-04][1]![VM-Name-Network-Virt-Manager-Ubuntu18-04][9]][9] - -Click on Finish - -[![RHEL7-3-Installation-Virt-Manager][1]![RHEL7-3-Installation-Virt-Manager][10]][10] - -Now follow the screen instruction and complete the installation, - -**Creating Virtual machine from CLI using virt-install command,** - -Use the below virt-install command to create a VM from terminal, it will start the installation in CLI, replace the name of the VM, description, location of ISO file and network bridge as per your setup. -``` -linuxtechi@kvm-ubuntu18-04:~$ sudo virt-install  -n DB-Server  --description "Test VM for Database"  --os-type=Linux  --os-variant=rhel7  --ram=1096  --vcpus=1  --disk path=/var/lib/libvirt/images/dbserver.img,bus=virtio,size=10  --network bridge:br0 --graphics none  --location /home/linuxtechi/rhel-server-7.3-x86_64-dvd.iso --extra-args console=ttyS0 - -``` - -That’s conclude the article, I hope this article help you to install KVM on your Ubuntu 18.04 Server. Apart from this, KVM is the default hypervisor for Openstack. - -Read More On : “[ **How to Create, Revert and Delete KVM Virtual machine (domain) snapshot with virsh command**][11]“ - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/install-configure-kvm-ubuntu-18-04-server/ - -作者:[Pradeep Kumar][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linuxtechi.com/author/pradeep/ -[1]:https://www.linuxtechi.com/wp-content/plugins/lazy-load/images/1x1.trans.gif -[2]:https://www.linuxtechi.com/wp-content/uploads/2018/05/libvirtd-command-ubuntu18-04-1024x339.jpg -[3]:https://www.linuxtechi.com/wp-content/uploads/2018/05/libvirtd-command-ubuntu18-04.jpg -[4]:https://www.linuxtechi.com/wp-content/uploads/2018/05/networkctl-command-output-ubuntu18-04.jpg -[5]:https://www.linuxtechi.com/wp-content/uploads/2018/05/ifconfig-command-output-ubuntu18-04.jpg -[6]:https://www.linuxtechi.com/wp-content/uploads/2018/05/Start-Virt-Manager-Ubuntu18-04.jpg -[7]:https://www.linuxtechi.com/wp-content/uploads/2018/05/ISO-file-Virt-Manager.jpg -[8]:https://www.linuxtechi.com/wp-content/uploads/2018/05/Select-ISO-file-virt-manager-Ubuntu18-04-Server.jpg -[9]:https://www.linuxtechi.com/wp-content/uploads/2018/05/VM-Name-Network-Virt-Manager-Ubuntu18-04.jpg -[10]:https://www.linuxtechi.com/wp-content/uploads/2018/05/RHEL7-3-Installation-Virt-Manager.jpg -[11]:https://www.linuxtechi.com/create-revert-delete-kvm-virtual-machine-snapshot-virsh-command/ From ba40c834552630dfec523fec871aa3b3523adad9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 May 2018 00:45:45 +0800 Subject: [PATCH 57/84] PRF:20180504 A Beginners Guide To Cron Jobs.md @KevinSJ --- ...20180504 A Beginners Guide To Cron Jobs.md | 108 +++++++++--------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/translated/tech/20180504 A Beginners Guide To Cron Jobs.md b/translated/tech/20180504 A Beginners Guide To Cron Jobs.md index fb7185506c..c9e1fb2a92 100644 --- a/translated/tech/20180504 A Beginners Guide To Cron Jobs.md +++ b/translated/tech/20180504 A Beginners Guide To Cron Jobs.md @@ -1,14 +1,16 @@ Cron 任务入门指南 ====== -![](https://www.ostechnix.com/wp-content/uploads/2018/05/cron-任务s1-720x340.jpg) -** Cron **是您可以在任何类 Unix 操作系统中找到的最有用的实用程序之一。它用于安排命令在特定时间执行。这些预定的命令或任务被称为 “Cron 任务”。Cron 通常用于运行计划备份,监视磁盘空间,定期删除不再需要的文件(例如日志文件),运行系统维护任务等等。在本简要指南中,我们将看到 Linux 中 Cron 任务 的基本用法。 +![](https://www.ostechnix.com/wp-content/uploads/2018/05/cron-jobs1-720x340.jpg) -Cron 任务入门指南 +**Cron** 是您可以在任何类 Unix 操作系统中找到的最有用的实用程序之一。它用于安排命令在特定时间执行。这些预定的命令或任务被称为 “Cron 任务”。Cron 通常用于运行计划备份、监视磁盘空间、定期删除不再需要的文件(例如日志文件)、运行系统维护任务等等。在本简要指南中,我们将看到 Linux 中 Cron 任务的基本用法。 + +### Cron 任务入门指南 cron 任务的典型格式是: + ``` -Minute(0-59) Hour(0-24) Day_of_month(1-31) Month(1-12) Day_of_week(0-6) Command_to_execute +分钟(0-59) 小时(0-24) 日(1-31) 月(1-12) 星期(0-6) 要执行的命令 ``` 只需记住 cron 任务的格式或打印下面的插图并将其放在你桌面上即可。 @@ -17,18 +19,20 @@ Minute(0-59) Hour(0-24) Day_of_month(1-31) Month(1-12) Day_of_week(0-6) Command_ 在上图中,星号表示特定的时间块。 -要显示当前登录用户的 ** crontab ** 文件的内容: +要显示当前登录用户的 crontab 文件的内容: + ``` $ crontab -l - ``` 要编辑当前用户的 cron 任务,请执行以下操作: + ``` $ crontab -e ``` -如果这是第一次编辑此文件,你将需要使用编辑器来编辑此文件。 +如果这是第一次编辑此文件,会询问你使用哪个编辑器来编辑此文件。 + ``` no crontab for sk - using an empty one @@ -39,168 +43,168 @@ Select an editor. To change later, run 'select-editor'. 4. /bin/ed Choose 1-4 [1]: - ``` -选择适合你的编辑器。这里是一个示例crontab文件的样子。 +选择适合你的编辑器。这里是一个示例 crontab 文件的样子。 ![][3] -在这个文件中,你需要添加你的 cron 任务s。 +在这个文件中,你需要添加你的 cron 任务。 + +要编辑其他用户的 crontab,例如 ostechnix,请执行: -要编辑其他用户的crontab,例如 ostechnix,请执行: ``` $ crontab -u ostechnix -e ``` 让我们看看一些例子。 -要 **每分钟** 执行一次 cron 任务 , 需使用如下格式. +要 **每分钟** 执行一次 cron 任务,需使用如下格式。 + ``` * * * * * - ``` -要每5分钟运行一次cron 任务,请在crontab文件中添加以下内容。 +要每 5 分钟运行一次 cron 任务,请在 crontab 文件中添加以下内容。 + ``` */5 * * * * - ``` -要在每 1/4 个小时(每15分钟)运行一次 cron 任务,请添加以下内容: +要在每 1/4 个小时(每 15 分钟)运行一次 cron 任务,请添加以下内容: + ``` */15 * * * * - ``` -要每小时的第30分钟运行一次 cron 任务,请运行: +要每小时的第 30 分钟运行一次 cron 任务,请运行: + ``` 30 * * * * - ``` -您还可以使用逗号定义多个时间间隔。例如,以下 cron 任务 每小时运行三次,分别在第 0, 5 和 10 分钟运行: +您还可以使用逗号定义多个时间间隔。例如,以下 cron 任务每小时运行三次,分别在第 0、 5 和 10 分钟运行: + ``` 0,5,10 * * * * - ``` 每半小时运行一次 cron 任务: + ``` */30 * * * * - ``` 每小时运行一次: + ``` 0 * * * * - ``` -每2小时运行一次: +每 2 小时运行一次: + ``` 0 */2 * * * - ``` -每天运行一项(在00:00运行): +每天运行一项(在 00:00 运行): + ``` 0 0 * * * - ``` -每天凌晨3点运行: +每天凌晨 3 点运行: + ``` 0 3 * * * - ``` 每周日运行: + ``` 0 0 * * SUN - ``` 或使用, + ``` 0 0 * * 0 - ``` 它将在每周日的午夜 00:00 运行。 星期一至星期五每天运行一次,亦即每个工作日运行一次: + ``` 0 0 * * 1-5 - ``` -这项工作将于00:00开始。 +这项工作将于 00:00 开始。 每个月运行一次: + ``` 0 0 1 * * - ``` -于每月第1天的16:15运行: +于每月第 1 天的 16:15 运行: + ``` 15 16 1 * * - ``` -每季度运行一次,亦即每隔3个月的第1天运行: +每季度运行一次,亦即每隔 3 个月的第 1 天运行: + ``` 0 0 1 */3 * - ``` 在特定月份的特定时间运行: + ``` 5 0 * 4 * - ``` 每个四月的 00:05 运行。 -每6个月运行: +每 6 个月运行: + ``` 0 0 1 */6 * - ``` 这个定时任务将在每六个月的第一天的 00:00 运行。 每年运行: + ``` 0 0 1 1 * - ``` 这项 cron 任务将于 1 月份的第一天的 00:00 运行。 我们也可以使用以下字符串来定义任务。 -@reboot 在每次启动时运行一次。 @yearly 每年运行一次。 @annually(和 @yearly 一样)。 @monthly 每月运行一次。 @weekly 每周运行一次。 @daily 每天运行一次。 @midnight (和 @daily 一样)。 @hourly 每小时运行一次。 +`@reboot` 在每次启动时运行一次。 `@yearly` 每年运行一次。 `@annually`(和 `@yearly` 一样)。 `@monthly` 每月运行一次。 `@weekly` 每周运行一次。 `@daily` 每天运行一次。 `@midnight` (和 `@daily` 一样)。 `@hourly` 每小时运行一次。 例如,要在每次重新启动服务器时运行任务,请将此行添加到您的 crontab 文件中。 + ``` @reboot - ``` 要删除当前用户的所有 cron 任务: + ``` $ crontab -r - ``` -还有一个名为 [** crontab.guru **] [4] 的专业网站,用于学习 cron 任务示例。这个网站提供了很多 cron 任务的例子。 +还有一个名为 [crontab.guru] [4] 的专业网站,用于学习 cron 任务示例。这个网站提供了很多 cron 任务的例子。 有关更多详细信息,请查看手册页。 + ``` $ man crontab - ``` 那么,就是这样。到此为止,您应该对 cron 任务以及如何在世使用它们有了一个基本的了解。后续还会介绍更多的优秀工具。敬请关注!! @@ -211,17 +215,17 @@ $ man crontab -------------------------------------------------------------------------------- -via: https://www.ostechnix.com/a-beginners-guide-to-cron-任务s/ +via: https://www.ostechnix.com/a-beginners-guide-to-cron-jobs/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者KevinSJ](https://github.com/KevinSJ) -校对:[校对者ID](https://github.com/校对者ID) +译者:[KevinSJ](https://github.com/KevinSJ) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.ostechnix.com/author/sk/ [1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-任务-format-1.png -[3]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-任务s-1.png +[2]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-job-format-1.png +[3]:http://www.ostechnix.com/wp-content/uploads/2018/05/cron-jobs-1.png [4]:https://crontab.guru/ \ No newline at end of file From 61b514faf975af5dc6032afb68e38bb1382817f0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 May 2018 00:46:20 +0800 Subject: [PATCH 58/84] PUB:20180504 A Beginners Guide To Cron Jobs.md @KevinSJ --- .../tech => published}/20180504 A Beginners Guide To Cron Jobs.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180504 A Beginners Guide To Cron Jobs.md (100%) diff --git a/translated/tech/20180504 A Beginners Guide To Cron Jobs.md b/published/20180504 A Beginners Guide To Cron Jobs.md similarity index 100% rename from translated/tech/20180504 A Beginners Guide To Cron Jobs.md rename to published/20180504 A Beginners Guide To Cron Jobs.md From bf57092c8e4056c106e7b7b1c549a5b126742c31 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 May 2018 08:55:08 +0800 Subject: [PATCH 59/84] translated --- .../20180521 Starting user software in X.md | 82 ------------------- .../20180521 Starting user software in X.md | 80 ++++++++++++++++++ 2 files changed, 80 insertions(+), 82 deletions(-) delete mode 100644 sources/tech/20180521 Starting user software in X.md create mode 100644 translated/tech/20180521 Starting user software in X.md diff --git a/sources/tech/20180521 Starting user software in X.md b/sources/tech/20180521 Starting user software in X.md deleted file mode 100644 index 148127c817..0000000000 --- a/sources/tech/20180521 Starting user software in X.md +++ /dev/null @@ -1,82 +0,0 @@ -translating---geekpi - -Starting user software in X -====== - -There are currently many ways of starting software when a user session starts. - -This is an attempt to collect a list of pointers to piece the big picture together. It's partial and some parts might be imprecise or incorrect, but it's a start, and I'm happy to keep it updated if I receive corrections. - -### x11-common - -`man xsession` - - * Started by the display manager for example, `/usr/share/lightdm/lightdm.conf.d/01_debian.conf` or `/etc/gdm3/Xsession` - * Debian specific - * Runs scripts in `/etc/X11/Xsession.d/` - * `/etc/X11/Xsession.d/40x11-common_xsessionrc` sources `~/.xsessionrc` which can do little more than set env vars, because it is run at the beginning of X session startup - * At the end, it starts the session manager (`gnome-session`, `xfce4-session`, and so on) - - - -### systemd --user - - * - * Started by `pam_systemd`, so it might not have a DISPLAY variable set in the environment yet - * Manages units in: - * `/usr/lib/systemd/user/` where units provided by installed packages belong. - * `~/.local/share/systemd/user/` where units of packages that have been installed in the home directory belong. - * `/etc/systemd/user/` where system-wide user units are placed by the system administrator. - * `~/.config/systemd/user/` where the users put their own units. - * A trick to start a systemd user unit when the X session has been set up and the DISPLAY variable is available, is to call `systemctl start` from a `.desktop` autostart file. - - - -### dbus activation - - * - * A user process making a dbus request can trigger starting a server program - * For systems debugging, is there a way of monitoring what services are getting dbus activated? - - - -### X session manager - - * - * Run by `x11-common`'s `Xsession.d` - * Runs freedesktop autostart .desktop files - * Runs Desktop Environment specific software - - - -### xdg autostart - - * - * Run by the session manager - * If `/etc/xdg/autostart/foo.desktop` and `~/.config/autostart/foo.desktop` exist then only the file `~/.config/autostart/foo.desktop` will be used because `~/.config/autostart/` is more important than `/etc/xdg/autostart/` - * Is there an ordering or is it all in parallel? - - - -### Other startup notes - -#### ~/.Xauthority - -To connect to an X server, a client needs to send a token from `~/.Xauthority`, which proves that they can read the user's provate data. - -`~/.Xauthority` contains a token generated by display manager and communicated to X at startup. - -To view its contents, use `xauth -i -f ~/.Xauthority list` - --------------------------------------------------------------------------------- - -via: http://www.enricozini.org/blog/2018/debian/starting-user-software/ - -作者:[Enrico Zini][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.enricozini.org/ diff --git a/translated/tech/20180521 Starting user software in X.md b/translated/tech/20180521 Starting user software in X.md new file mode 100644 index 0000000000..fe7c906ba7 --- /dev/null +++ b/translated/tech/20180521 Starting user software in X.md @@ -0,0 +1,80 @@ +在 X 中启动用户软件 +====== + +目前有很多方法可以在开启用户会话时启动软件。 + +这是一篇试图将所有方法聚集在一起的文章。某些部分可能不精确或不正确,但这是一个开始,如果我收到更正,我很乐意保持更新。 + +### x11-common + +`man xsession` + + * 由显示管理器启动,如 `/usr/share/lightdm/lightdm.conf.d/01_debian.conf` 或 `/etc/gdm3/Xsession`。 + * Debian 特定。 + * 在 `/etc/X11/Xsession.d/` 中运行脚本。 + * `/etc/X11/Xsession.d/40x11-common_xsessionrc` 引用 `~/.xsessionrc` ,它只比设置环境变量能做的多一点,因为它在 X 会话启动时运行。 + * 最后,它启动会话管理器(`gnome-session`、`xfce4-session` 等等)。 + + + +### systemd --user + + * + * 由 `pam_systemd` 启动,所以它可能在环境变量中没有 DISPLAY 变量设置。 + * 管理单元: + * `/usr/lib/systemd/user/` 由已安装的软件包提供的单元。 + * `~/.local/share/systemd/user/` 由安装在家目录的软件包提供的单元。 + * `/etc/systemd/user/` 由系统管理员提供的系统范围的用户的单元。 + * `~/.config/systemd/user/` ,用户自己放置的单元。 + * 设置 X 会话并使用 DISPLAY 变量时,启动 systemd 用户单元的技巧是从 `.desktop` 自启动文件调用 `systemctl start`。 + + + +### dbus activation + + * + * 进行 dbus 请求的用户进程可以触发启动服务器程序。 + * 对于系统调试,有没有一种方法可以监控哪些服务正在启动 dbus? + + + +### X 会话管理器 + + * + * 由 `x11-common` 的 `Xsession.d` 运行。 + * 运行 freedesktop autostart .desktop 文件。 + * 运行桌面环境特定的软件。 + + + +### xdg autostart + + * + * 由会话管理器运行 + * 如果存在 `/etc/xdg/autostart/foo.desktop` 和 `~/.config/autostart/foo.desktop` ,那么只会使用 `~/.config/autostart/foo.desktop`,因为 `~/.config/autostart/` 比 `/etc/xdg/autostart/` 更重要。 + * 是否有顺序或者并行? + + + +### 其他启动笔记 + +#### ~/.Xauthority + +要连接到 X 服务器,客户端需要从 `~/.Xauthority` 发送一个令牌,这证明他们可以读取用户的隐私数据。 + +`~/.Xauthority` 包含显示管理器生成的一个令牌,并在启动时传递给 X。 + +要查看它的内容,请使用 `xauth -i -f ~/.Xauthority list`。 + +-------------------------------------------------------------------------------- + +via: http://www.enricozini.org/blog/2018/debian/starting-user-software/ + +作者:[Enrico Zini][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.enricozini.org/ From a6c58bf530d671969f9b306835149cb69fbdad62 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 May 2018 08:58:33 +0800 Subject: [PATCH 60/84] translating --- sources/tech/20171101 -dev-urandom- entropy explained.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20171101 -dev-urandom- entropy explained.md b/sources/tech/20171101 -dev-urandom- entropy explained.md index c89ba22465..e510eab29e 100644 --- a/sources/tech/20171101 -dev-urandom- entropy explained.md +++ b/sources/tech/20171101 -dev-urandom- entropy explained.md @@ -1,3 +1,5 @@ +translating---geekpi + /dev/[u]random: entropy explained ====== ### Entropy From f57292a2ba3fc24646a3a8cff2d9f57f35b85e7b Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Mon, 28 May 2018 09:15:03 +0800 Subject: [PATCH 61/84] Update 20180522 How to Run Your Own Git Server.md --- sources/tech/20180522 How to Run Your Own Git Server.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180522 How to Run Your Own Git Server.md b/sources/tech/20180522 How to Run Your Own Git Server.md index bb2d6bfe1f..9a1ee8509a 100644 --- a/sources/tech/20180522 How to Run Your Own Git Server.md +++ b/sources/tech/20180522 How to Run Your Own Git Server.md @@ -1,3 +1,4 @@ +translating by wyxplus How to Run Your Own Git Server ====== **Learn how to set up your own Git server in this tutorial from our archives.** From c073190c04e7f153c8aaaf9369ab661017b2b33f Mon Sep 17 00:00:00 2001 From: qhwdw Date: Mon, 28 May 2018 13:30:02 +0800 Subject: [PATCH 62/84] Translated by qhwdw --- ... Common Concurrent Programming Mistakes.md | 430 ------------------ ... Common Concurrent Programming Mistakes.md | 429 +++++++++++++++++ 2 files changed, 429 insertions(+), 430 deletions(-) delete mode 100644 sources/tech/20180415 Some Common Concurrent Programming Mistakes.md create mode 100644 translated/tech/20180415 Some Common Concurrent Programming Mistakes.md diff --git a/sources/tech/20180415 Some Common Concurrent Programming Mistakes.md b/sources/tech/20180415 Some Common Concurrent Programming Mistakes.md deleted file mode 100644 index 6553b96f54..0000000000 --- a/sources/tech/20180415 Some Common Concurrent Programming Mistakes.md +++ /dev/null @@ -1,430 +0,0 @@ -Translating by qhwdw -Some Common Concurrent Programming Mistakes -============================================================ - -Go is a language supporting built-in concurrent programming. By using the `go` keyword to create goroutines (light weight threads) and by [using][8] [channels][9] and [other concurrency][10] [synchronization techniques][11] provided in Go, concurrent programming becomes easy, flexible and enjoyable. - -One the other hand, Go doesn't prevent Go programmers from making some concurrent programming mistakes which are caused by either carelessnesses or lacking of experiences. The remaining of the current article will show some common mistakes in Go concurrent programming, to help Go programmers avoid making such mistakes. - -### No Synchronizations When Synchronizations Are Needed - -Code lines may be [not executed by the appearance orders][2]. - -There are two mistakes in the following program. - -* First, the read of `b` in the main goroutine and the write of `b` in the new goroutine might cause data races. - -* Second, the condition `b == true` can't ensure that `a != nil` in the main goroutine. Compilers and CPUs may make optimizations by [reordering instructions][1] in the new goroutine, so the assignment of `b`may happen before the assignment of `a` at run time, which makes that slice `a` is still `nil` when the elements of `a` are modified in the main goroutine. - -``` -package main - -import ( - "time" - "runtime" -) - -func main() { - var a []int // nil - var b bool // false - - // a new goroutine - go func () { - a = make([]int, 3) - b = true // write b - }() - - for !b { // read b - time.Sleep(time.Second) - runtime.Gosched() - } - a[0], a[1], a[2] = 0, 1, 2 // might panic -} - -``` - -The above program may run well on one computer, but may panic on another one. Or it may run well for  _N_ times, but may panic at the  _(N+1)_ th time. - -We should use channels or the synchronization techniques provided in the `sync` standard package to ensure the memory orders. For example, - -``` -package main - -func main() { - var a []int = nil - c := make(chan struct{}) - - // a new goroutine - go func () { - a = make([]int, 3) - c <- struct{}{} - }() - - <-c - a[0], a[1], a[2] = 0, 1, 2 -} - -``` - -### Use `time.Sleep` Calls To Do Synchronizations - -Let's view a simple example. - -``` -ppackage main - -import ( - "fmt" - "time" -) - -func main() { - var x = 123 - - go func() { - x = 789 // write x - }() - - time.Sleep(time.Second) - fmt.Println(x) // read x -} - -``` - -We expect the program to print `789`. If we run it, it really prints `789`, almost always. But is it a program with good syncrhonization? No! The reason is Go runtime doesn't guarantee the write of `x` happens before the read of `x` for sure. Under certain conditions, such as most CPU resources are cunsumed by other programs running on same OS, the write of `x` might happen after the read of `x`. This is why we should never use `time.Sleep` calls to do syncrhonizations in formal projects. - -Let's view another example. - -``` -package main - -import ( - "fmt" - "time" -) - -var x = 0 - -func main() { - var num = 123 - var p = &num - - c := make(chan int) - - go func() { - c <- *p + x - }() - - time.Sleep(time.Second) - num = 789 - fmt.Println(<-c) -} - -``` - -What do you expect the program will output? `123`, or `789`? In fact, the output is compiler dependent. For the standard Go compiler 1.10, it is very possible the program will output `123`. But in theory, it might output `789`, or another random number. - -Now, let's change `c <- *p + x` to `c <- *p` and run the program again. You will find the output becomes to `789` (for the he standard Go compiler 1.10). Again, the output is compiler dependent. - -Yes, there are data races in the above program. The expression `*p` might be evaluated before, after, or when the assignment `num = 789` is processed. The `time.Sleep` call can't guarantee the evaluation of `*p`happens before the assignment is processed. - -For this specified example, we should store the value to be sent in a temporary value before creating the new goroutine and send the temporary value instead in the new goroutine to remove the data races. - -``` -... - tmp := *p + x - go func() { - c <- tmp - }() -... - -``` - -### Leave Goroutines Hanging - -Hanging goroutines are the goroutines staying in blocking state for ever. There are many reasons leading goroutines into hanging. For example, - -* a goroutine tries to receive a value from a nil channel or from a channel which no more other goroutines will send values to. - -* a goroutine tries to send a value to nil channel or to a channel which no more other goroutines will receive values from. - -* a goroutine is dead locked by itself. - -* a group of goroutines are dead locked by each other. - -* a goroutine is blocked when executing a `select` code block without `default` branch, and all the channel operations following the `case` keywords in the `select` code block keep blocking for ever. - -Except sometimes we deliberately let the main goroutine in a program hanging to avoid the program exiting, most other hanging goroutine cases are unexpected. It is hard for Go runtime to judge whether or not a goroutine in blocking state is hanging or stays in blocking state temporarily. So Go runtime will never release the resources consumed by a hanging goroutine. - -In the [first-response-wins][12] channel use case, if the capacity of the channel which is used a future is not large enough, some slower response goroutines will hang when trying to send a result to the future channel. For example, if the following function is called, there will be 4 goroutines stay in blocking state for ever. - -``` -func request() int { - c := make(chan int) - for i := 0; i < 5; i++ { - i := i - go func() { - c <- i // 4 goroutines will hang here. - }() - } - return <-c -} - -``` - -To avoid the four goroutines hanging, the capacity of channel `c` must be at least `4`. - -In [the second way to implement the first-response-wins][13] channel use case, if the channel which is used as a future is an unbufferd channel, it is possible that the channel reveiver will never get a response and hang. For example, if the following function is called in a goroutine, the goroutine might hang. The reason is, if the five try-send operations all happen before the receive operation `<-c` is ready, then all the five try-send operations will fail to send values so that the caller goroutine will never receive a value. - -``` -func request() int { - c := make(chan int) - for i := 0; i < 5; i++ { - i := i - go func() { - select { - case c <- i: - default: - } - }() - } - return <-c -} - -``` - -Changing the channel `c` as a buffered channel will guarantee at least one of the five try-send operations succeed so that the caller goroutine will never hang in the above function. - -### Copy Values Of The Types In The `sync` Standard Package - -In practice, values of the types in the `sync` standard package shouldn't be copied. We should only copy pointers of such values. - -The following is bad concurrent programming example. In this example, when the `Counter.Value` method is called, a `Counter` receiver value will be copied. As a field of the receiver value, the respective `Mutex` field of the `Counter` receiver value will also be copied. The copy is not synchronized, so the copied `Mutex` value might be corrupt. Even if it is not corrupt, what it protects is the accessment of the copied `Counter` receiver value, which is meaningless generally. - -``` -import "sync" - -type Counter struct { - sync.Mutex - n int64 -} - -// This method is okay. -func (c *Counter) Increase(d int64) (r int64) { - c.Lock() - c.n += d - r = c.n - c.Unlock() - return -} - -// The method is bad. When it is called, a Counter -// receiver value will be copied. -func (c Counter) Value() (r int64) { - c.Lock() - r = c.n - c.Unlock() - return -} - -``` - -We should change the reveiver type of the `Value` method to the poiner type `*Counter` to avoid copying `Mutex` values. - -The `go vet` command provided in the official Go SDK will report potential bad value copies. - -### Call Methods Of `sync.WaitGroup` At Wrong Places - -Each `sync.WaitGroup` value maintains a counter internally, The initial value of the counter is zero. If the counter of a `WaitGroup` value is zero, a call to the `Wait` method of the `WaitGroup` value will not block, otherwise, the call blocks until the counter value becomes zero. - -To make the uses of `WaitGroup` value meaningful, when the counter of a `WaitGroup` value is zero, a call to the `Add` method of the `WaitGroup` value must happen before the corresponding call to the `Wait` method of the `WaitGroup` value. - -For example, in the following program, the `Add` method is called at an improper place, which makes that the final printed number is not always `100`. In fact, the final printed number of the program may be an arbitrary number in the range `[0, 100)`. The reason is none of the `Add` method calls are guaranteed to happen before the `Wait` method call. - -``` -package main - -import ( - "fmt" - "sync" - "sync/atomic" -) - -func main() { - var wg sync.WaitGroup - var x int32 = 0 - for i := 0; i < 100; i++ { - go func() { - wg.Add(1) - atomic.AddInt32(&x, 1) - wg.Done() - }() - } - - fmt.Println("To wait ...") - wg.Wait() - fmt.Println(atomic.LoadInt32(&x)) -} - -``` - -To make the program behave as expected, we should move the `Add` method calls out of the new goroutines created in the `for` loop, as the following code shown. - -``` -... - for i := 0; i < 100; i++ { - wg.Add(1) - go func() { - atomic.AddInt32(&x, 1) - wg.Done() - }() - } -... - -``` - -### Use Channels As Futures Improperly - -From the article [channel use cases][14], we know that some functions will return [channels as futures][15]. Assume `fa` and `fb` are two such functions, then the following call uses future arguments improperly. - -``` -doSomethingWithFutureArguments(<-fa(), <-fb()) - -``` - -In the above code line, the two channel receive operations are processed in sequentially, instead of concurrently. We should modify it as the following to process them concurrently. - -``` -ca, cb := fa(), fb() -doSomethingWithFutureArguments(<-c1, <-c2) - -``` - -### Close Channels Not From The Last Active Sender Goroutine - -A common mistake made by Go programmers is closing a channel when there are still some other goroutines will potentially send values to the channel later. When such a potential send (to the closed channel) really happens, a panic will occur. - -This mistake was ever made in some famous Go projects, such as [this bug][3] and [this bug][4] in the kubernetes project. - -Please read [this article][5] for explanations on how to safely and gracefully close channels. - -### Do 64-bit Atomic Operations On Values Which Are Not Guaranteed To Be 64-bit Aligned - -Up to now (Go 1.10), for the standard Go compiler, the address of the value involved in a 64-bit atomic operation is required to be 64-bit aligned. Failure to do so may make the current goroutine panic. For the standard Go compiler, such failure can only happen on 32-bit architectures. Please read [memory layouts][6] to get how to guarantee the addresses of 64-bit word 64-bit aligned on 32-bit OSes. - -### Not Pay Attention To Too Many Resources Are Consumed By Calls To The `time.After` Function - -The `After` function in the `time` standard package returns [a channel for delay notification][7]. The function is convenient, however each of its calls will create a new value of the `time.Timer` type. The new created `Timer` value will keep alive in the duration specified by the passed argument to the `After` function. If the function is called many times in the duration, there will be many `Timer` values alive and consuming much memory and computation. - -For example, if the following `longRunning` function is called and there are millions of messages coming in one minute, then there will be millions of `Timer` values alive in a certain period, even if most of these `Timer`values have already become useless. - -``` -import ( - "fmt" - "time" -) - -// The function will return if a message arrival interval -// is larger than one minute. -func longRunning(messages <-chan string) { - for { - select { - case <-time.After(time.Minute): - return - case msg := <-messages: - fmt.Println(msg) - } - } -} - -``` - -To avoid too many `Timer` values being created in the above code, we should use a single `Timer` value to do the same job. - -``` -func longRunning(messages <-chan string) { - timer := time.NewTimer(time.Minute) - defer timer.Stop() - - for { - select { - case <-timer.C: - return - case msg := <-messages: - fmt.Println(msg) - if !timer.Stop() { - <-timer.C - } - } - - // The above "if" block can also be put here. - - timer.Reset(time.Minute) - } -} - -``` - -### Use `time.Timer` Values Incorrectly - -An idiomatic use example of a `time.Timer` value has been shown in the last section. One detail which should be noted is that the `Reset` method should always be invoked on stopped or expired `time.Timer`values. - -At the end of the first `case` branch of the `select` block, the `time.Timer` value has expired, so we don't need to stop it. But we must stop the timer in the second branch. If the `if` code block in the second branch is missing, it is possible that a send (by the Go runtime) to the channel `timer.C` races with the `Reset`method call, and it is possible that the `longRunning` function returns earlier than expected, for the `Reset`method will only reset the internal timer to zero, it will not clear (drain) the value which has been sent to the `timer.C` channel. - -For example, the following program is very possible to exit in about one second, instead of ten seconds. and more importantly, the program is not data race free. - -``` -package main - -import ( - "fmt" - "time" -) - -func main() { - start := time.Now() - timer := time.NewTimer(time.Second/2) - select { - case <-timer.C: - default: - time.Sleep(time.Second) // go here - } - timer.Reset(time.Second * 10) - <-timer.C - fmt.Println(time.Since(start)) // 1.000188181s -} - -``` - -A `time.Timer` value can be leaved in non-stopping status when it is not used any more, but it is recommended to stop it in the end. - -It is bug prone and not recommended to use a `time.Timer` value concurrently in multiple goroutines. - -We should not rely on the return value of a `Reset` method call. The return result of the `Reset` method exists just for compatibility purpose. - --------------------------------------------------------------------------------- - -via: https://go101.org/article/concurrent-common-mistakes.html - -作者:[go101.org ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:go101.org -[1]:https://go101.org/article/memory-model.html -[2]:https://go101.org/article/memory-model.html -[3]:https://github.com/kubernetes/kubernetes/pull/45291/files?diff=split -[4]:https://github.com/kubernetes/kubernetes/pull/39479/files?diff=split -[5]:https://go101.org/article/channel-closing.html -[6]:https://go101.org/article/memory-layout.html -[7]:https://go101.org/article/channel-use-cases.html#timer -[8]:https://go101.org/article/channel-use-cases.html -[9]:https://go101.org/article/channel.html -[10]:https://go101.org/article/concurrent-atomic-operation.html -[11]:https://go101.org/article/concurrent-synchronization-more.html -[12]:https://go101.org/article/channel-use-cases.html#first-response-wins -[13]:https://go101.org/article/channel-use-cases.html#first-response-wins-2 -[14]:https://go101.org/article/channel-use-cases.html -[15]:https://go101.org/article/channel-use-cases.html#future-promise diff --git a/translated/tech/20180415 Some Common Concurrent Programming Mistakes.md b/translated/tech/20180415 Some Common Concurrent Programming Mistakes.md new file mode 100644 index 0000000000..9b47185d88 --- /dev/null +++ b/translated/tech/20180415 Some Common Concurrent Programming Mistakes.md @@ -0,0 +1,429 @@ +一些常见的并发编程错误 +============================================================ + +Go 是一个内置支持并发编程的语言。借助使用 `go` 关键字去创建 goroutines(轻量级线程)和在 Go 中提供的 [使用][8] [信道][9] 和 [其它的并发][10] [同步方法][11],使得并发编程变得很容易、很灵活和很有趣。 + +另一方面,Go 并不会阻止一些因 Go 程序员粗心大意或者缺乏经验而造成的并发编程错误。在本文的下面部分将展示一些在 Go 编程中常见的并发编程错误,以帮助 Go 程序员们避免再犯类似的错误。 + +### 需要同步的时候没有同步 + +代码行或许 [没有按出现的顺序运行][2]。 + +在下面的程序中有两个错误。 + +* 第一,在 main goroutine 中读取 `b` 和在新的 goroutine 中写入 `b` 可能导致数据争用。 + +* 第二,条件 `b == true` 并不能保证在 main goroutine 中的 `a != nil`。在新的 goroutine 中编译器和 CPU 可能会通过 [重排序指令][1] 进行优化,因此,在运行时 `b` 赋值可能发生在 `a` 赋值之前,在 main goroutine 中当 `a` 被修改后,它将会让部分 `a` 一直保持为 `nil`。 + +``` +package main + +import ( + "time" + "runtime" +) + +func main() { + var a []int // nil + var b bool // false + + // a new goroutine + go func () { + a = make([]int, 3) + b = true // write b + }() + + for !b { // read b + time.Sleep(time.Second) + runtime.Gosched() + } + a[0], a[1], a[2] = 0, 1, 2 // might panic +} + +``` + +上面的程序或者在一台计算机上运行的很好,但是在另一台上可能会引发异常。或者它可能运行了 _N_ 次都很好,但是可能在第 _(N+1)_ 次引发了异常。 + +我们将使用 `sync` 标准包中提供的信道或者同步方法去确保内存中的顺序。例如, + +``` +package main + +func main() { + var a []int = nil + c := make(chan struct{}) + + // a new goroutine + go func () { + a = make([]int, 3) + c <- struct{}{} + }() + + <-c + a[0], a[1], a[2] = 0, 1, 2 +} + +``` + +### 使用 `time.Sleep` 调用去做同步 + +我们先来看一个简单的例子。 + +``` +ppackage main + +import ( + "fmt" + "time" +) + +func main() { + var x = 123 + + go func() { + x = 789 // write x + }() + + time.Sleep(time.Second) + fmt.Println(x) // read x +} + +``` + +我们预期程序将打印出 `789`。如果我们运行它,通常情况下,它确定打印的是 `789`。但是,这个程序使用的同步方式好吗?No!原因是 Go 运行时并不保证 `x` 的写入一定会发生在 `x` 的读取之前。在某些条件下,比如在同一个操作系统上,大部分 CPU 资源被其它运行的程序所占用的情况下,写入 `x` 可能就会发生在读取 `x` 之后。这就是为什么我们在正式的项目中,从来不使用 `time.Sleep` 调用去实现同步的原因。 + +我们来看一下另外一个示例。 + +``` +package main + +import ( + "fmt" + "time" +) + +var x = 0 + +func main() { + var num = 123 + var p = &num + + c := make(chan int) + + go func() { + c <- *p + x + }() + + time.Sleep(time.Second) + num = 789 + fmt.Println(<-c) +} + +``` + +你认为程序的预期输出是什么?`123` 还是 `789`?事实上它的输出与编译器有关。对于标准的 Go 编译器 1.10 来说,这个程序很有可能输出是 `123`。但是在理论上,它可能输出的是 `789`,或者其它的随机数。 + +现在,我们来改变 `c <- *p + x` 为 `c <- *p`,然后再次运行这个程序。你将会发现输出变成了 `789` (使用标准的 Go 编译器 1.10)。这再次说明它的输出是与编译器相关的。 + +是的,在上面的程序中存在数据争用。表达式 `*p` 可能会被先计算、后计算、或者在处理赋值语句 `num = 789` 时计算。`time.Sleep` 调用并不能保证 `*p` 发生在赋值语句处理之前进行。 + +对于这个特定的示例,我们将在新的 goroutine 创建之前,将值保存到一个临时值中,然后在新的 goroutine 中使用临时值去消除数据争用。 + +``` +... + tmp := *p + x + go func() { + c <- tmp + }() +... + +``` + +### 使 Goroutines 挂起 + +挂起 goroutines 是指让 goroutines 一直处于阻塞状态。导致 goroutines 被挂起的原因很多。比如, + +* 一个 goroutine 尝试从一个 nil 信道中或者从一个没有其它 goroutines 给它发送值的信道中检索数据。 + +* 一个 goroutine 尝试去发送一个值到 nil 信道,或者发送到一个没有其它的 goroutines 接收值的信道中。 + +* 一个 goroutine 被它自己死锁。 + +* 一组 goroutines 彼此死锁。 + +* 当运行一个没有 `default` 分支的 `select` 代码块时,一个 goroutine 被阻塞,以及在 `select` 代码块中  `case` 关键字后的所有信道操作保持阻塞状态。 + +除了有时我们为了避免程序退出,特意让一个程序中的 main goroutine 保持挂起之外,大多数其它的 goroutine 挂起都是意外情况。Go 运行时很难判断一个 goroutine 到底是处于挂起状态还是临时阻塞。因此,Go 运行时并不会去释放一个挂起的 goroutine 所占用的资源。 + +在 [谁先响应谁获胜][12] 的信道使用案例中,如果使用的 Future 信道容量不够大,当尝试向 Future 信道发送结果时,一些响应较慢的信道将被挂起。比如,如果调用下面的函数,将有 4 个 goroutine 处于永远阻塞状态。 + +``` +func request() int { + c := make(chan int) + for i := 0; i < 5; i++ { + i := i + go func() { + c <- i // 4 goroutines will hang here. + }() + } + return <-c +} + +``` + +为避免这 4 个 goroutines 一直处于挂起状态, `c` 信道的容量必须至少是  `4`。 + +在 [实现谁先响应谁获胜的第二种方法][13] 的信道使用案例中,如果将 future 信道用做非缓冲信道,那么有可能这个信息将永远也不会有响应并挂起。例如,如果在一个 goroutine 中调用下面的函数,goroutine 可能会挂起。原因是,如果接收操作  `<-c` 准备就绪之前,五个发送操作全部尝试发送,那么所有的尝试发送的操作将全部失败,因此那个调用者 goroutine 将永远也不会接收到值。 + +``` +func request() int { + c := make(chan int) + for i := 0; i < 5; i++ { + i := i + go func() { + select { + case c <- i: + default: + } + }() + } + return <-c +} + +``` + +将信道 `c` 变成缓冲信道将保证五个发送操作中的至少一个操作会发送成功,这样,上面函数中的那个调用者 goroutine 将不会被挂起。 + +### 在 `sync` 标准包中拷贝类型值 + +在实践中,`sync` 标准包中的类型值不会被拷贝。我们应该只拷贝这个值的指针。 + +下面是一个错误的并发编程示例。在这个示例中,当调用 `Counter.Value` 方法时,将拷贝一个 `Counter` 接收值。作为接收值的一个字段,`Counter` 接收值的各个 `Mutex` 字段也会被拷贝。拷贝不是同步发生的,因此,拷贝的 `Mutex` 值可能会出错。即便是没有错误,拷贝的 `Counter` 接收值的访问保护也是没有意义的。 + +``` +import "sync" + +type Counter struct { + sync.Mutex + n int64 +} + +// This method is okay. +func (c *Counter) Increase(d int64) (r int64) { + c.Lock() + c.n += d + r = c.n + c.Unlock() + return +} + +// The method is bad. When it is called, a Counter +// receiver value will be copied. +func (c Counter) Value() (r int64) { + c.Lock() + r = c.n + c.Unlock() + return +} + +``` + +我们只需要改变 `Value` 接收类型方法为指针类型 `*Counter`,就可以避免拷贝 `Mutex` 值。 + +在官方的 Go SDK 中提供的 `go vet` 命令将会报告潜在的错误值拷贝。 + +### 在错误的地方调用 `sync.WaitGroup` 的方法 + +每个 `sync.WaitGroup` 值维护一个内部计数器,这个计数器的初始值为 0。如果一个 `WaitGroup` 计数器的值也是 0,调用 `WaitGroup` 值的 `Wait` 方法不会被阻塞,否则,在计数器值为 0 之前,这个调用会一直被阻塞。 + +为了让 `WaitGroup` 值的使用有意义,当一个 `WaitGroup` 计数器值为 0 时,必须在相应的 `WaitGroup` 值的  `Wait` 方法调用之前,去调用 `WaitGroup` 值的 `Add` 方法。 + +例如,下面的程序中,在不正确位置调用了 `Add` 方法,这将使最后打印出的数字不总是 `100`。事实上,这个程序最后打印的数字可能是在 `[0, 100)` 范围内的一个随意数字。原因就是 `Add` 方法的调用并不保证一定会发生在 `Wait` 方法调用之前。 + +``` +package main + +import ( + "fmt" + "sync" + "sync/atomic" +) + +func main() { + var wg sync.WaitGroup + var x int32 = 0 + for i := 0; i < 100; i++ { + go func() { + wg.Add(1) + atomic.AddInt32(&x, 1) + wg.Done() + }() + } + + fmt.Println("To wait ...") + wg.Wait() + fmt.Println(atomic.LoadInt32(&x)) +} + +``` + +为让程序的表现符合预期,在 `for` 循环中,我们将把 `Add` 方法的调用移动到创建的新 goroutines 的范围之外,修改后的代码如下。 + +``` +... + for i := 0; i < 100; i++ { + wg.Add(1) + go func() { + atomic.AddInt32(&x, 1) + wg.Done() + }() + } +... + +``` + +### 不正确使用 Futures 信道 + +在 [信道使用案例][14] 的文章中,我们知道一些函数将返回 [futures 信道][15]。假设 `fa` 和 `fb` 就是这样的两个函数,那么下面的调用就使用了不正确的 future 参数。 + +``` +doSomethingWithFutureArguments(<-fa(), <-fb()) + +``` + +在上面的代码行中,两个信道接收操作是顺序进行的,而不是并发的。我们做如下修改使它变成并发操作。 + +``` +ca, cb := fa(), fb() +doSomethingWithFutureArguments(<-c1, <-c2) + +``` + +### 没有等 Goroutine 的最后的活动的发送结束就关闭信道 + +Go 程序员经常犯的一个错误是,还有一些其它的 goroutine 可能会发送值到以前的信道时,这个信道就已经被关闭了。当这样的发送(发送到一个已经关闭的信道)真实发生时,将引发一个异常。 + +这种错误在一些以往的著名 Go 项目中也有发生,比如在 Kubernetes 项目中的 [这个 bug][3] 和 [这个 bug][4]。 + +如何安全和优雅地关闭信道,请阅读 [这篇文章][5]。 + +### 在值上做 64 位原子操作时没有保证值地址 64 位对齐 + +到目前为止(Go 1.10),在标准的 Go 编译器中,在一个 64 位原子操作中涉及到的值的地址要求必须是 64 位对齐的。如果没有对齐则导致当前的 goroutine 异常。对于标准的 Go 编译器来说,这种失败仅发生在 32 位的架构上。请阅读 [内存布局][6] 去了解如何在一个 32 位操作系统上保证 64 位对齐。 + +### 没有注意到大量的资源被 `time.After` 函数调用占用 + +在 `time` 标准包中的 `After` 函数返回 [一个延迟通知的信道][7]。这个函数在某些情况下用起来很便捷,但是,每次调用它将创建一个 `time.Timer` 类型的新值。这个新创建的 `Timer` 值在通过传递参数到  `After` 函数指定期间保持激活状态,如果在这个期间过多的调用了该函数,可能会有太多的 `Timer` 值保持激活,这将占用大量的内存和计算资源。 + +例如,如果调用了下列的 `longRunning` 函数,将在一分钟内产生大量的消息,然后在某些周期内将有大量的 `Timer` 值保持激活,即便是大量的这些 `Timer` 值已经没用了也是如此。 + +``` +import ( + "fmt" + "time" +) + +// The function will return if a message arrival interval +// is larger than one minute. +func longRunning(messages <-chan string) { + for { + select { + case <-time.After(time.Minute): + return + case msg := <-messages: + fmt.Println(msg) + } + } +} + +``` + +为避免在上述代码中创建过多的 `Timer` 值,我们将使用一个单一的 `Timer` 值去完成同样的任务。 + +``` +func longRunning(messages <-chan string) { + timer := time.NewTimer(time.Minute) + defer timer.Stop() + + for { + select { + case <-timer.C: + return + case msg := <-messages: + fmt.Println(msg) + if !timer.Stop() { + <-timer.C + } + } + + // The above "if" block can also be put here. + + timer.Reset(time.Minute) + } +} + +``` + +### 不正确地使用 `time.Timer` 值 + +在最后,我们将展示一个符合语言使用习惯的 `time.Timer` 值的使用示例。需要注意的一个细节是,那个 `Reset` 方法总是在停止或者 `time.Timer` 值释放时被使用。 + +在 `select` 块的第一个 `case` 分支的结束部分,`time.Timer` 值被释放,因此,我们不需要去停止它。但是必须在第二个分支中停止定时器。如果在第二个分支中 `if` 代码块缺失,它可能至少在 `Reset` 方法调用时,会(通过 Go 运行时)发送到 `timer.C` 信道,并且那个 `longRunning` 函数可能会早于预期返回,对于 `Reset` 方法来说,它可能仅仅是重置内部定时器为 0,它将不会清理(耗尽)那个发送到 `timer.C` 信道的值。 + +例如,下面的程序很有可能在一秒内而不是十秒时退出。并且更重要的是,这个程序并不是 DRF 的(译者注:data race free,多线程程序的一种同步程度)。 + +``` +package main + +import ( + "fmt" + "time" +) + +func main() { + start := time.Now() + timer := time.NewTimer(time.Second/2) + select { + case <-timer.C: + default: + time.Sleep(time.Second) // go here + } + timer.Reset(time.Second * 10) + <-timer.C + fmt.Println(time.Since(start)) // 1.000188181s +} + +``` + +当 `time.Timer` 的值不再被其它任何一个东西使用时,它的值可能被停留在一种非停止状态,但是,建议在结束时停止它。 + +在多个 goroutines 中如果不按建议使用 `time.Timer` 值并发,可能会有 bug 隐患。 + +我们不应该依赖一个 `Reset` 方法调用的返回值。`Reset` 方法返回值的存在仅仅是为了兼容性目的。 + +-------------------------------------------------------------------------------- + +via: https://go101.org/article/concurrent-common-mistakes.html + +作者:[go101.org ][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:go101.org +[1]:https://go101.org/article/memory-model.html +[2]:https://go101.org/article/memory-model.html +[3]:https://github.com/kubernetes/kubernetes/pull/45291/files?diff=split +[4]:https://github.com/kubernetes/kubernetes/pull/39479/files?diff=split +[5]:https://go101.org/article/channel-closing.html +[6]:https://go101.org/article/memory-layout.html +[7]:https://go101.org/article/channel-use-cases.html#timer +[8]:https://go101.org/article/channel-use-cases.html +[9]:https://go101.org/article/channel.html +[10]:https://go101.org/article/concurrent-atomic-operation.html +[11]:https://go101.org/article/concurrent-synchronization-more.html +[12]:https://go101.org/article/channel-use-cases.html#first-response-wins +[13]:https://go101.org/article/channel-use-cases.html#first-response-wins-2 +[14]:https://go101.org/article/channel-use-cases.html +[15]:https://go101.org/article/channel-use-cases.html#future-promise From 77a46b1b7290b3e176d85a66b9206cbbd707a3ba Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 May 2018 21:55:32 +0800 Subject: [PATCH 63/84] PRF:20180521 Starting user software in X.md @geekpi --- .../20180521 Starting user software in X.md | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/translated/tech/20180521 Starting user software in X.md b/translated/tech/20180521 Starting user software in X.md index fe7c906ba7..377c28dc51 100644 --- a/translated/tech/20180521 Starting user software in X.md +++ b/translated/tech/20180521 Starting user software in X.md @@ -1,4 +1,4 @@ -在 X 中启动用户软件 +如何在 X 中启动用户软件 ====== 目前有很多方法可以在开启用户会话时启动软件。 @@ -7,56 +7,48 @@ ### x11-common -`man xsession` +``` +man xsession +``` * 由显示管理器启动,如 `/usr/share/lightdm/lightdm.conf.d/01_debian.conf` 或 `/etc/gdm3/Xsession`。 * Debian 特定。 * 在 `/etc/X11/Xsession.d/` 中运行脚本。 - * `/etc/X11/Xsession.d/40x11-common_xsessionrc` 引用 `~/.xsessionrc` ,它只比设置环境变量能做的多一点,因为它在 X 会话启动时运行。 + * `/etc/X11/Xsession.d/40x11-common_xsessionrc` 引用 `~/.xsessionrc` ,它能比设置环境变量能做的多一点,因为它在 X 会话启动时运行。 * 最后,它启动会话管理器(`gnome-session`、`xfce4-session` 等等)。 - - ### systemd --user * - * 由 `pam_systemd` 启动,所以它可能在环境变量中没有 DISPLAY 变量设置。 + * 由 `pam_systemd` 启动,所以在环境变量中可能没有设置 `DISPLAY` 变量。 * 管理单元: * `/usr/lib/systemd/user/` 由已安装的软件包提供的单元。 * `~/.local/share/systemd/user/` 由安装在家目录的软件包提供的单元。 * `/etc/systemd/user/` 由系统管理员提供的系统范围的用户的单元。 * `~/.config/systemd/user/` ,用户自己放置的单元。 - * 设置 X 会话并使用 DISPLAY 变量时,启动 systemd 用户单元的技巧是从 `.desktop` 自启动文件调用 `systemctl start`。 + * 当设置 X 会话和 `DISPLAY` 变量时,启动 systemd 用户单元的技巧是从 `.desktop` 自启动文件调用 `systemctl start`。 - - -### dbus activation +### dbus 激活 * * 进行 dbus 请求的用户进程可以触发启动服务器程序。 - * 对于系统调试,有没有一种方法可以监控哪些服务正在启动 dbus? - - + * 对于系统调试,有没有一种方法可以监控哪些服务正在启动 dbus ? ### X 会话管理器 * * 由 `x11-common` 的 `Xsession.d` 运行。 - * 运行 freedesktop autostart .desktop 文件。 + * 运行 freedesktop 自动启动的 `.desktop` 文件。 * 运行桌面环境特定的软件。 - - -### xdg autostart +### xdg 自动启动 * - * 由会话管理器运行 + * 由会话管理器运行。 * 如果存在 `/etc/xdg/autostart/foo.desktop` 和 `~/.config/autostart/foo.desktop` ,那么只会使用 `~/.config/autostart/foo.desktop`,因为 `~/.config/autostart/` 比 `/etc/xdg/autostart/` 更重要。 - * 是否有顺序或者并行? + * 是顺序的还是并行? - - -### 其他启动笔记 +### 其他启动注意事项 #### ~/.Xauthority @@ -73,7 +65,7 @@ via: http://www.enricozini.org/blog/2018/debian/starting-user-software/ 作者:[Enrico Zini][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ab3ae6a1f6e65f6d9ffbdfa076a7d5d205e6fff3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 May 2018 21:55:59 +0800 Subject: [PATCH 64/84] PUB:20180521 Starting user software in X.md @geekpi https://linux.cn/article-9688-1.html --- .../tech => published}/20180521 Starting user software in X.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180521 Starting user software in X.md (100%) diff --git a/translated/tech/20180521 Starting user software in X.md b/published/20180521 Starting user software in X.md similarity index 100% rename from translated/tech/20180521 Starting user software in X.md rename to published/20180521 Starting user software in X.md From 9673a3e2a485fe902585e756a7f94fde4ed8f86b Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Mon, 28 May 2018 21:56:24 +0800 Subject: [PATCH 65/84] Update 20180427 3 Python template libraries compared.md --- sources/tech/20180427 3 Python template libraries compared.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20180427 3 Python template libraries compared.md b/sources/tech/20180427 3 Python template libraries compared.md index 18a434150b..fbbdb47da0 100644 --- a/sources/tech/20180427 3 Python template libraries compared.md +++ b/sources/tech/20180427 3 Python template libraries compared.md @@ -1,3 +1,6 @@ +Translating by MjSeven + + 3 Python template libraries compared ====== From 635acb96feb3e699a6de6911a99505bb23b052a9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 May 2018 07:07:33 +0800 Subject: [PATCH 66/84] PRF:20180510 How To Display Images In The Terminal.md @KevinSJ --- ...0 How To Display Images In The Terminal.md | 74 ++++++++++--------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/translated/tech/20180510 How To Display Images In The Terminal.md b/translated/tech/20180510 How To Display Images In The Terminal.md index 92f874f1fe..02839fe5db 100644 --- a/translated/tech/20180510 How To Display Images In The Terminal.md +++ b/translated/tech/20180510 How To Display Images In The Terminal.md @@ -1,44 +1,46 @@ -如何在终端中显示图片 +如何在终端中显示图片 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/05/fim-2-720x340.png) -Linux 上用许多 GUI 图片浏览器。但我尚未听说或使用过任何在终端中显示图片的应用程序。幸运的是,我刚刚发现了一个可用于在终端中显示图像的名叫 ** FIM ** 的图像查看器。FIM 引起了我的注意,是因为与大多数 GUI 图片浏览器相比,它非常轻巧。毫不迟疑,让我们来看看它能做什么。 -###使用FIM在终端中显示图像 +Linux 上有许多 GUI 图片浏览器。但我尚未听说或使用过任何在终端中显示图片的应用程序。幸运的是,我刚刚发现了一个可用于在终端中显示图像的名叫 **FIM** 的图像查看器。FIM 引起了我的注意,是因为与大多数 GUI 图片浏览器相比,它非常轻巧。毫不迟疑,让我们来看看它能做什么。 -**FIM** stands for **F**bi **IM**proved. 对于那些不知道的人,**Fbi**是指 linux 中的 **f**rame **b**uffer **i**mageviewer。它使用系统的帧缓冲器直接从命令行显示图像。默认情况下,它能用终端显示bmp,gif,jpeg,PhotoCD,png,ppm,tiff 和 xwd。对于其他格式,它会尝试使用 ImageMagick 的转换。 +### 使用 FIM 在终端中显示图像 -FIM 基于 Fbi,它是一款高度可高度定制及脚本化的图像浏览器,非常适合使用 Vim 文本编辑器或 Mutt 等软件的用户。它会以全屏显示图像,并可通过键盘快捷键控制(如调整大小,翻转,缩放)。与fbi不同的是,FIM 是通用的:它可以打开许多文件格式,并且可以在以下视频模式下显示图片: +**FIM** 意即 **F**bi **IM**proved。对于那些不知道的人,**Fbi** 是指 Linux 中的 **f**rame **b**uffer **i**mageviewer。它使用系统的帧缓冲器直接从命令行显示图像。默认情况下,它能用终端显示 bmp、gif、jpeg、PhotoCD、png、ppm、tiff 和 xwd。对于其他格式,它会尝试使用 ImageMagick 的转换。 -*使用 Linux framebuffer 设备,以图形方式呈现 -*在 X / Xorg 下,使用 SDL 库。以图形方式呈现 -*在 X / Xorg 下,使用 Imlib2 库。以图形方式呈现。 -*在任何文本控制台中使用 AAlib 库呈现为 ASCII 字符画 。 +FIM 基于 Fbi,它是一款高度可高度定制及脚本化的图像浏览器,非常适合使用 Vim 文本编辑器或 Mutt 等软件的用户。它会以全屏显示图像,并可通过键盘快捷键控制(如调整大小、翻转、缩放)。与 Fbi 不同的是,FIM 是通用的:它可以打开许多文件格式,并且可以在以下视频模式下显示图片: +* 使用 Linux framebuffer 设备,以图形方式呈现 +* 在 X / Xorg 下,使用 SDL 库,以图形方式呈现 +* 在 X / Xorg 下,使用 Imlib2 库,以图形方式呈现。 +* 在任何文本控制台中使用 AAlib 库呈现为 ASCII 字符画 +FIM 是完全免费且开源的。 -FIM是完全免费且开源的。 +### 安装 FIM -###安装FIM - -基于 DEB 的系统,如 Ubuntu,Linux Mint, 可从默认的仓库中获取 FIM 图像查看器。因此,你可以使用如下命令安装fbi: +基于 DEB 的系统,如 Ubuntu、Linux Mint, 可从默认的仓库中获取 FIM 图像查看器。因此,你可以使用如下命令安装fbi: ``` $ sudo apt-get install fim ``` 如果它在你使用的 Linux 发行版的仓库中不包含 FIM,则可以下载源代码进行编译和安装,如下所示。 + ``` wget http://download.savannah.nongnu.org/releases/fbi-improved/fim-0.6-trunk.tar.gz wget http://download.savannah.nongnu.org/releases/fbi-improved/fim-0.6-trunk.tar.gz.sig gpg --search 'dezperado autistici org' #按照屏幕上的说明,从密钥服务器导入密钥 gpg --verify fim-0.6-trunk.tar.gz.sig +``` +``` tar xzf fim-0.6-trunk.tar.gz cd fim-0.6-trunk ./configure --help=short -#阅读./configure --help = short的输出:你可以在 ./configure 中添加选项 +#阅读./configure --help=short 的输出:你可以在 ./configure 中添加选项 ./configure make su -c“make install” @@ -47,6 +49,7 @@ su -c“make install” ### FIM用法 安装完成后,您可以使用以下命令以“自动缩放”显示的图像: + ``` $ fim -a dog.jpg ``` @@ -57,45 +60,48 @@ $ fim -a dog.jpg 正如你在上面的屏幕截图中看到的,FIM 没有使用任何外部 GUI 图片浏览器。相反,它使用我们系统的帧缓冲器来显示图像。 -如果当前目录中有多个.jpg文件,可以使用通配符打开所有文件,如下所示。 +如果当前目录中有多个 .jpg 文件,可以使用通配符打开所有文件,如下所示。 + ``` $ fim -a * .jpg ``` -要打开目录中的所有图像,例如 **Pictures**,请运行: +要打开目录中的所有图像,例如 `Pictures`,请运行: + ``` $ fim Pictures/ ``` 我们也可以在文件夹及其子文件夹中递归地打开图像,然后像下面那样对列表进行排序。 + ``` $ fim -R Pictures/ --sort ``` -要以 ASCII 格式渲染图像,可以使用 **-t** 标志。 +要以 ASCII 格式渲染图像,可以使用 `-t` 标志。 + ``` $ fim -t dog.jpg ``` -要退出 Fim,请按 **ESC** 或 **q**。 +要退出 Fim,请按 `ESC` 或 `q`。 -**键盘快捷键** - -您可以使用各种键盘快捷键来管理图像。例如,要加载下一张图像和之前的图像,请按下 PgUp / PgDown 键。成倍放大或缩小,请使用 +/- 键。以下是用于在FIM中控制图像的常用按键。 - -* **PageUp/Down**:上一张/下一张图片 -* **+/-**:放大/缩小 -* **a**:自动缩放 -* **w**:自适应宽度 -* **h**:自适应高度 -* **j/k**:平移/向上 -* **f/m**:翻转/镜像 -* **r/R**:旋转(顺时针/逆时针) -* **ESC/q**:退出 +#### 键盘快捷键 +您可以使用各种键盘快捷键来管理图像。例如,要加载下一张图像和之前的图像,请按下 `PgUp` / `PgDown` 键。成倍放大或缩小,请使用 `+` / `-` 键。以下是用于在FIM中控制图像的常用按键。 +* `PageUp` / `Down`:上一张/下一张图片 +* `+` / `-` :放大/缩小 +* `a`:自动缩放 +* `w`:自适应宽度 +* `h`:自适应高度 +* `j` / `k`:平移/向上 +* `f` / `m`:翻转/镜像 +* `r` / `R`:旋转(顺时针/逆时针) +* `ESC` / `q`:退出 有关完整详细信息,请参阅手册页。 + ``` $ man fim ``` @@ -104,16 +110,14 @@ $ man fim 干杯! - - -------------------------------------------------- ------------------------------ via: https://www.ostechnix.com/how-to-display-images-in-the-terminal/ 作者:[SK] [A] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者KevinSJ](https://github.com/KevinSJ) -校对:[校对者ID](https://github.com/校对者ID) +译者:[KevinSJ](https://github.com/KevinSJ) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 11968d6b7245321474c79452cb8578b9acd96ef0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 May 2018 07:07:56 +0800 Subject: [PATCH 67/84] PUB:20180510 How To Display Images In The Terminal.md @KevinSJ https://linux.cn/article-9690-1.html --- .../20180510 How To Display Images In The Terminal.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180510 How To Display Images In The Terminal.md (100%) diff --git a/translated/tech/20180510 How To Display Images In The Terminal.md b/published/20180510 How To Display Images In The Terminal.md similarity index 100% rename from translated/tech/20180510 How To Display Images In The Terminal.md rename to published/20180510 How To Display Images In The Terminal.md From 5653ce30509c1fe6fd31cd6a59eede24fda0cde0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 May 2018 07:30:33 +0800 Subject: [PATCH 68/84] PRF:20171009 What-s next in DevOps- 5 trends to watch.md @qhwdw --- ...hat-s next in DevOps- 5 trends to watch.md | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/translated/tech/20171009 What-s next in DevOps- 5 trends to watch.md b/translated/tech/20171009 What-s next in DevOps- 5 trends to watch.md index d6d7ecce7f..0ef2ea5dcb 100644 --- a/translated/tech/20171009 What-s next in DevOps- 5 trends to watch.md +++ b/translated/tech/20171009 What-s next in DevOps- 5 trends to watch.md @@ -1,67 +1,69 @@ -DevOps 接下来会发生什么:观察到的 5 个趋势 +DevOps 接下来会发生什么:要关注的 5 个趋势 ====== +> 专家们权衡了 DevOps 团队最近会有何期望。 + ![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/CIO%20Magnifying%20Glass%20Code.png?itok=IqZsJCEH) -"DevOps" 一词通常认为是来源于 [2008 年关于敏捷基础设施和运营的介绍][1]。现在的 IT 词汇中,它无处不在,这个“混搭”的词汇出现还不到 10 年:我们还在研究它在 IT 中更现代化的工作方法。 +“DevOps” 一词通常认为是来源于 [这篇 2008 年关于敏捷基础设施和运营的讲演中][1]。现在的 IT 词汇中,它无处不在,这个“混搭”的词汇出现还不到 10 年:我们还在研究它在 IT 中更现代化的工作方法。 -当然,多年来一直在 “从事 DevOps" 的人积累了丰富的知识。但是大多数的 DevOps 环境 —— 人与 [文化][2] 、流程与方法、工具与技术的融合 —— 还远远没有成熟。 +诚然,多年来一直在 “从事 DevOps” 的人积累了丰富的知识。但是大多数的 DevOps 环境 —— 人与 [文化][2] 、流程与方法、工具与技术的融合 —— 还远远没有成熟。 -更多的变化即将到来。Robert Reeves 说 ”DevOps 是一个过程,一种算法“,他是 [Datical][3] 的 CTO, "它的绝对目标就是随着时间进行改变和演进”,这就是重点。 +更多的变化即将到来。Robert Reeves 说 “DevOps 是一个过程,一种算法”,他是 [Datical][3] 的 CTO, “它的绝对目标就是随着时间进行改变和演进”,这就是重点。 那我们预计接下来会发生什么呢?这里有一些专家们观察到的重要趋势。 -### 1. 预计 DevOps、容器、以及微服务之间的相互依赖会增强 +### 1、 预计 DevOps、容器、以及微服务之间的相互依赖会增强 -驱动 DevOps 发展的文化本身可能会演进。当然,DevOps 仍然将在根本上摧毁传统的 IT 站点和瓶颈,但这样做的理由可能会变得更加急迫。展示(证据) A & B: [对容器和微服务的兴趣][4] 与日俱增。这个技术组合很强大、可连续扩展、与规划和 [持续进行的管理][5]配合最佳。 +驱动 DevOps 发展的文化本身可能会演进。当然,DevOps 仍然将在根本上摧毁传统的 IT 孤岛和瓶颈,但这样做的理由可能会变得更加急迫。证据 A & B: [对容器和微服务的兴趣][4] 与日俱增。这个技术组合很强大、可连续扩展、与规划和 [持续进行的管理][5]配合最佳。 -Arvind Soni 说 "影响 DevOps 的其中一个主要因素是向微服务转变“,它是 [Netsil][6] 的产品副总裁,添加容器和业务流程,使开发者打包和交付的速度越来越快。DevOps 团队的任务可能是帮助去加速打包并管理越来越复杂的微服务弹性架构。 +Arvind Soni 说 “影响 DevOps 的其中一个主要因素是向微服务转变”,他是 [Netsil][6] 的产品副总裁,补充道,容器和业务流程,使开发者打包和交付的速度越来越快。DevOps 团队的任务可能是帮助去加速打包并管理越来越复杂的微服务弹性架构。 -### 2. 预计 ”安全网“ 更少 +### 2、 预计 ”安全网“ 更少 -DevOps 使团队可以更快更敏捷地去构建软件,部署速度也更快更频繁、同时还能提升软件质量和稳定性。但是好的 IT 领导通常都不会忽视管理风险,因此,早期大量的 DevOps 迭代都是使用了安全防护 —— 从后备的不重要业务开始的。为了实现更快的速度和敏捷性,越来越多的团队将抛弃他们的 ”辅助轮“(译者注:意思说减少了安全防护措施)。 +DevOps 使团队可以更快更敏捷地去构建软件,部署速度也更快更频繁、同时还能提升软件质量和稳定性。但是好的 IT 领导通常都不会忽视管理风险,因此,早期大量的 DevOps 迭代都是使用了安全防护 —— 从后备的不重要业务开始的。为了实现更快的速度和敏捷性,越来越多的团队将抛弃他们的 ”辅助轮“(LCTT 译注:意思说减少了安全防护措施)。 -Nic Grange 说 "随着团队的成熟,他们决定不再需要一些早期增加的安全 ”防护栏“ 了”,他是 [Retriever Communications][7] 的 CTO。Grange 给出了一个展示服务器的示例:随着 DevOps 团队的成熟,他们决定不再需要了,尤其是他们很少在试生产环境中发现问题。(Grange 指出,这一举措对于缺乏 DevOps 经验的团队来说,不可轻易效仿) +Nic Grange 说 “随着团队的成熟,他们决定不再需要一些早期增加的安全 ‘防护栏’ 了”,他是 [Retriever Communications][7] 的 CTO。Grange 给出了一个阶段展示的服务器的示例:随着 DevOps 团队的成熟,他们决定不再需要阶段展示的服务器了,尤其是他们很少在试生产环境中发现问题。(Grange 指出,这一举措对于缺乏 DevOps 经验的团队来说,不可轻易效仿) -Grange 说 "这个团队可能在监视和发现并解决生产系统中出现的问题的能力上有足够的信心“,"部署过程和测试阶段,如果没有任何证据证明它的价值,那么它可能会把整个进度拖慢”。 +Grange 说 “这个团队可能在监视和发现并解决生产系统中出现的问题的能力上有足够的信心”,“部署过程和测试阶段,如果没有任何证据证明它的价值,那么它可能会把整个进度拖慢”。 -### 3. 预计 DevOps 将在其它领域大面积展开 +### 3、 预计 DevOps 将在其它领域大面积展开 -DevOps 将两个传统的 IT 组(开发和运营)结合的更紧密。越来越多的公司看到了这种结合的好处,这种文化可能会传播开来。这种情况在一些组织中已经出现,在 “DevSecOps” 一词越来越多出现的情况下,它反映出了在软件开发周期中有意地、越来越早地包含了安全性。 +DevOps 将两个传统的 IT 部门(开发和运营)结合的更紧密。越来越多的公司看到了这种结合的好处,这种文化可能会传播开来。这种情况在一些组织中已经出现,在 “DevSecOps” 一词越来越多出现的情况下,它反映出了在软件开发周期中有意地、越来越早地包含了安全性。 -Derek Weeks 说 "DevSecOps 不仅是一个工具,它是将安全思维更早地集成到开发实践中“,它是 [Sonatype][8] 的副总裁和 DevOps 拥挤者。 +Derek Weeks 说 “DevSecOps 不仅是一个工具,它是将安全思维更早地集成到开发实践中”,它是 [Sonatype][8] 的副总裁和 DevOps 拥挤者。 - [Red Hat][9] 的安全策略师 Kirsten Newcomer 说,这种做法并不是一个技术挑战,而是一个文化挑战。 +[Red Hat][9] 的安全策略师 Kirsten Newcomer 说,这种做法并不是一个技术挑战,而是一个文化挑战。 -Newcomer 说 "从历史来看,安全团队都是从开发团队中分离出来的 —— 每个团队在它们不同的 IT 领域中形成了各自的专长” ,"它并不需要这种方法。每个关心安全性的企业也关心他们通过软件快速交付业务价值的能力,这些企业正在寻找方法,将安全放进应用程序的开发周期中。它们采用 DevSecOps 通过 CI/CD 流水线去集成安全实践、工具、和自动化。为了做的更好,他们整合他们的团队 —— 将安全专家整合到应用程序开发团队中,参与到从设计到产品部署的全过程中。这种做法使双方都看到了价值 —— 每个团队都扩充了它们的技能和知识,使他们成为更有价值的技术专家。DevOps 做对了—— 或者说是 DevSecOps —— 提升了 IT 安全性。“ +Newcomer 说 “从历史来看,安全团队都是从开发团队中分离出来的 —— 每个团队在它们不同的 IT 领域中形成了各自的专长” ,“它并不需要这种方法。每个关心安全性的企业也关心他们通过软件快速交付业务价值的能力,这些企业正在寻找方法,将安全放进应用程序的开发周期中。它们采用 DevSecOps 通过 CI/CD 流水线去集成安全实践、工具和自动化。为了做的更好,他们整合他们的团队 —— 将安全专家整合到应用程序开发团队中,参与到从设计到产品部署的全过程中。这种做法使双方都看到了价值 —— 每个团队都扩充了它们的技能和知识,使他们成为更有价值的技术专家。DevOps 做对了 —— 或者说是 DevSecOps —— 提升了 IT 安全性。” -除了安全以外,让 DevOps 扩展到其它领域,比如数据库团队、QA、甚至是 IT 以外的潜在领域。 +除了安全以外,还可以让 DevOps 扩展到其它领域,比如数据库团队、QA,甚至是 IT 以外的潜在领域。 -Datical 的 Reeves 说 "这是一件非常 DevOps 化的事情:发现相互掣肘的地方并解决它们”,"对于以前采用 DevOps 的企业来说,安全和数据库是他们面临的最大瓶颈。“ +Datical 的 Reeves 说 “这是一件非常 DevOps 化的事情:发现相互掣肘的地方并解决它们”,“对于以前采用 DevOps 的企业来说,安全和数据库是他们面临的最大瓶颈。” -### 4. 预计 ROI 将会增加 +### 4、 预计 ROI 将会增加 -Eric Schabell 说,”由于公司深入推进他们的 DevOps 工作,IT 团队在方法、流程、容器、和微服务方面的投资将得到更多的回报。“ 他是 Red Hat 的全球技术传播总监,Schabell 说 "Holy Grail 将移动的更快、完成的更多、并且变得更灵活。由于这些组件找到了更宽阔的天地,组织在应用程序中更有归属感时,结果就会出现。” +Eric Schabell 说,“由于公司深入推进他们的 DevOps 工作,IT 团队在方法、流程、容器和微服务方面的投资将得到更多的回报。” 他是 Red Hat 的全球技术传播总监,Schabell 说 “‘圣杯’将移动的更快、完成的更多、并且变得更灵活。由于这些组件找到了更宽阔的天地,组织在应用程序中更有归属感时,结果就会出现。” -"每当新兴技术获得我们的关注时,任何事都有一个令人兴奋的学习曲线,但当认识到它应用很困难的时候,同时也会经历一个从兴奋到幻灭的低谷。最终,我们将开始看到从低谷中爬出来,并收获到应用 DevOps、容器、和微服务的好处。“ +“每当新兴技术获得我们的关注时,任何事都有一个令人兴奋的学习曲线,但当认识到它应用很困难的时候,同时也会经历一个从兴奋到幻灭的低谷。最终,我们将开始看到从低谷中爬出来,并收获到应用 DevOps、容器、和微服务的好处。” -### 5. 预计成功的指标将持续演进 +### 5、 预计成功的指标将持续演进 -Mike Kail 说 "我相信 DevOps 文化的两个核心原则 —— 自动化和可衡量是从来不会变的”,它是 [CYBRIC][10] 的 CTO,也是 Yahoo 前 CIO。“总是有办法去自动化一个任务,或者提升一个已经自动化的解决方案,而随着时间的推移,重要的事情是测量可能的变化和扩展。这个成熟的过程是一个永不停步的旅行,而不是一个目的地或者已完成的任务。” +Mike Kail 说 “我相信 DevOps 文化的两个核心原则 —— 自动化和可衡量是从来不会变的”,它是 [CYBRIC][10] 的 CTO,也是 Yahoo 前 CIO。“总是有办法去自动化一个任务,或者提升一个已经自动化的解决方案,而随着时间的推移,重要的事情是测量可能的变化和扩展。这个成熟的过程是一个永不停步的旅行,而不是一个目的地或者已完成的任务。” 在 DevOps 的精神中,成熟和学习也与协作者和分享精神有关。Kail 认为,对于敏捷方法和 DevOps 文化来说,它仍然为时尚早,这意味着它们还有足够的增长空间。 -Kail 说 "随着越来越多的成熟组织持续去测量可控指标,我相信(希望) —— 这些经验应该被广泛的分享,以便我们去学习并改善它们。“ +Kail 说 “随着越来越多的成熟组织持续去测量可控指标,我相信(希望) —— 这些经验应该被广泛的分享,以便我们去学习并改善它们。” -作为 Red Hat 技术传播专家 [Gordon Haff][11] 最近注意到,组织使用业务成果相关的因素去改善他们的 DevOps 指标的工作越来越困难。 [Haff 写道][12] "你或许并不真正关心你的开发者写了多少行代码、服务器是否在一夜之间出现了硬件故障、或者你的测试覆盖面是否全面”。事实上,你可能并不直接关心你的网站的响应速度和更新快慢。但是你要注意的是,这些指标可能与消费者放弃购物车或者转到你的竞争对手那里有关。“ +作为 Red Hat 技术传播专家,[Gordon Haff][11] 最近注意到,组织使用业务成果相关的因素去改善他们的 DevOps 指标的工作越来越困难。 [Haff 写道][12] “你或许并不真正关心你的开发者写了多少行代码、服务器是否在一夜之间出现了硬件故障、或者你的测试覆盖面是否全面”。事实上,你可能并不直接关心你的网站的响应速度和更新快慢。但是你要注意的是,这些指标可能与消费者放弃购物车或者转到你的竞争对手那里有关。” -与业务成果相关的一些 DevOps 指标的例子包括,消费者交易金额(作为消费者花销统计的指标)和净推荐值(消费者推荐公司产品和服务的意愿)。关于这个主题更多的内容,请查看这篇完整的文章—— [DevOps 指标:你是否测量了重要的东西 ][12]。 +与业务成果相关的一些 DevOps 指标的例子包括,消费者交易金额(作为消费者花销统计的指标)和净推荐值(消费者推荐公司产品和服务的意愿)。关于这个主题更多的内容,请查看这篇完整的文章—— [DevOps 指标:你是否测量了重要的东西][12]。 ### 唯一不变的就是改变 顺利说一句,如果你希望这件事一蹴而就,那你就要倒霉了。 -Reeves 说 "如果你认为今天发布非常快,那你就什么也没有看到”,“这就是为什么要让相关者包括数据库团队进入到 DevOps 中的重要原因。因为今天这两组人员的冲突会随着发布速度的提升而呈指数级增长。” +Reeves 说 “如果你认为今天发布非常快,那你就什么也没有看到”,“这就是为什么要让相关者包括数据库团队进入到 DevOps 中的重要原因。因为今天这两组人员的冲突会随着发布速度的提升而呈指数级增长。” -------------------------------------------------------------------------------- @@ -69,7 +71,7 @@ via: https://enterprisersproject.com/article/2017/10/what-s-next-devops-5-trends 作者:[Kevin Casey][a] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3c282e6f365c6b4d3bdbc462fc24deed5b6d2570 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 May 2018 07:30:54 +0800 Subject: [PATCH 69/84] PUB:20171009 What-s next in DevOps- 5 trends to watch.md @qhwdw https://linux.cn/article-9691-1.html --- .../20171009 What-s next in DevOps- 5 trends to watch.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171009 What-s next in DevOps- 5 trends to watch.md (100%) diff --git a/translated/tech/20171009 What-s next in DevOps- 5 trends to watch.md b/published/20171009 What-s next in DevOps- 5 trends to watch.md similarity index 100% rename from translated/tech/20171009 What-s next in DevOps- 5 trends to watch.md rename to published/20171009 What-s next in DevOps- 5 trends to watch.md From ba2232d9e2763624a56fd3b5ed3d672ebe610e03 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 May 2018 08:55:49 +0800 Subject: [PATCH 70/84] translated --- ...How To Install Ncurses Library In Linux.md | 92 ------------------- ...How To Install Ncurses Library In Linux.md | 90 ++++++++++++++++++ 2 files changed, 90 insertions(+), 92 deletions(-) delete mode 100644 sources/tech/20180518 How To Install Ncurses Library In Linux.md create mode 100644 translated/tech/20180518 How To Install Ncurses Library In Linux.md diff --git a/sources/tech/20180518 How To Install Ncurses Library In Linux.md b/sources/tech/20180518 How To Install Ncurses Library In Linux.md deleted file mode 100644 index 472d389a11..0000000000 --- a/sources/tech/20180518 How To Install Ncurses Library In Linux.md +++ /dev/null @@ -1,92 +0,0 @@ -translating---geekpi - -How To Install Ncurses Library In Linux -====== -![](https://www.ostechnix.com/wp-content/uploads/2018/05/install-ncurses-720x340.png) - -**GNU Ncurses** is a programming library that allows the users to write text-based user interfaces(TUI). Many text-based games are created using this library. One popular example is [**PacVim**][1], a CLI game to learn VIM commands. In this brief guide, I will be explaining how to install Ncurses library in Unix-like operating systems. - -### Install Ncurses Library In Linux - -Ncurses is available in the default repositories of most Linux distributions. For instance, you can install it on Arch-based systems using the following command: -``` -$ sudo pacman -S ncurses - -``` - -On RHEL, CentOS: -``` -$ sudo yum install ncurses-devel - -``` - -On Fedora 22 and newer versions: -``` -$ sudo dnf install ncurses-devel - -``` - -On Debian, Ubuntu, Linux Mint: -``` -$ sudo apt-get install libncurses5-dev libncursesw5-dev - -``` - -The GNU ncureses might be bit old in the default repositories. If you want a most recent stable version, you can compile and install from the source as shown below. - -Download the latest ncurses version from [**here**][2]. As of writing this guide, the latest version was 6.1. -``` -$ wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz - -``` - -Extract the tar file: -``` -$ tar xzf ncurses-6.1.tar.gz - -``` - -This will create a folder named ncurses-6.1 in the current directory. Cd to the directory: -``` -$ cd ncurses-6.1 - -$ ./configure --prefix=/opt/ncurses - -``` - -Finally, compile and install using the following commands: -``` -$ make - -$ sudo make install - -``` - -Verify the installation using command: -``` -$ ls -la /opt/ncurses - -``` - -That’s it. Ncurses have been installed on the Linux distribution. Go ahead and create your nice looking TUIs using Ncurses. - -More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-install-ncurses-library-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/pacvim-a-cli-game-to-learn-vim-commands/ -[2]:https://ftp.gnu.org/pub/gnu/ncurses/ diff --git a/translated/tech/20180518 How To Install Ncurses Library In Linux.md b/translated/tech/20180518 How To Install Ncurses Library In Linux.md new file mode 100644 index 0000000000..47f094de34 --- /dev/null +++ b/translated/tech/20180518 How To Install Ncurses Library In Linux.md @@ -0,0 +1,90 @@ +如何在 Linux 中安装 Ncurses 库 +====== +![](https://www.ostechnix.com/wp-content/uploads/2018/05/install-ncurses-720x340.png) + +**GNU Ncurses** 是一个允许用户编写基于文本的用户界面(TUI)的编程库。许多基于文本的游戏都是使用这个库创建的。一个受欢迎的例子是 [**PacVim**][1],这是一款学习 VIM 命令的 CLI 游戏。在这篇简要的指南中,我将解释如何在类 Unix 操作系统中安装 Ncurses 库。 + +### 在 Linux 中安装 Ncurses 库 + +Ncurses 在大多数 Linux 发行版的默认仓库中都有。例如,你可以使用以下命令将其安装在基于 Arch 的系统上: +``` +$ sudo pacman -S ncurses + +``` + +在RHEL、CentOS 上: +``` +$ sudo yum install ncurses-devel + +``` + +在 Fedora 22 和更新版本上: +``` +$ sudo dnf install ncurses-devel + +``` + +在 Debian、Ubuntu、Linux Mint 上: +``` +$ sudo apt-get install libncurses5-dev libncursesw5-dev + +``` + +默认仓库中的 GNU ncureses 可能有点老了。如果你想要最新的稳定版本,可以从源代码进行编译和安装,如下所示。 + +从[**这里**][2]下载最新的 ncurses 版本。在写这篇文章时,最新版本是 6.1。 +``` +$ wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz + +``` + +解压 tar 文件: +``` +$ tar xzf ncurses-6.1.tar.gz + +``` + +这将在当前目录中创建一个名为 ncurses-6.1 的文件夹。cd 到该目录: +``` +$ cd ncurses-6.1 + +$ ./configure --prefix=/opt/ncurses + +``` + +最后,使用以下命令进行编译和安装: +``` +$ make + +$ sudo make install + +``` + +使用命令验证安装: +``` +$ ls -la /opt/ncurses + +``` + +就是这样。Ncurses 已经安装在 Linux 发行版上。继续使用 Ncurses 创建漂亮的 TUI。 + +还会有更多的好东西。敬请关注! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-install-ncurses-library-in-linux/ + +作者:[SK][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/pacvim-a-cli-game-to-learn-vim-commands/ +[2]:https://ftp.gnu.org/pub/gnu/ncurses/ From 0b8d3e28d241b429fb6a20fde39a7190d9918949 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 May 2018 08:58:52 +0800 Subject: [PATCH 71/84] translating --- ...Pidgin- An open source replacement for Skype for Business.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180426 Get started with Pidgin- An open source replacement for Skype for Business.md b/sources/talk/20180426 Get started with Pidgin- An open source replacement for Skype for Business.md index 9521ac92e2..2e2eb1ffac 100644 --- a/sources/talk/20180426 Get started with Pidgin- An open source replacement for Skype for Business.md +++ b/sources/talk/20180426 Get started with Pidgin- An open source replacement for Skype for Business.md @@ -1,3 +1,5 @@ +translating----geekpi + Get started with Pidgin: An open source replacement for Skype for Business ====== From acdf06b65243d930f0232746e308b43d725175c9 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Tue, 29 May 2018 19:06:02 +0800 Subject: [PATCH 72/84] Delete 20180427 3 Python template libraries compared.md --- ...27 3 Python template libraries compared.md | 138 ------------------ 1 file changed, 138 deletions(-) delete mode 100644 sources/tech/20180427 3 Python template libraries compared.md diff --git a/sources/tech/20180427 3 Python template libraries compared.md b/sources/tech/20180427 3 Python template libraries compared.md deleted file mode 100644 index fbbdb47da0..0000000000 --- a/sources/tech/20180427 3 Python template libraries compared.md +++ /dev/null @@ -1,138 +0,0 @@ -Translating by MjSeven - - -3 Python template libraries compared -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/library-libraries-search.png?itok=xH8xSU_G) -In my day job, I spend a lot of time wrangling data from various sources into human-readable information. While a lot of the time this just takes the form of a spreadsheet or some type of chart or other data visualization, there are other times when it makes sense to present the data instead in a written format. - -But a pet peeve of mine is copying and pasting. If you’re moving data from its source to a standardized template, you shouldn’t be copying and pasting either. It’s error-prone, and honestly, it’s not a good use of your time. - -So for any piece of information I send out regularly which follows a common pattern, I tend to find some way to automate at least a chunk of it. Maybe that involves creating a few formulas in a spreadsheet, a quick shell script, or some other solution to autofill a template with information pulled from an outside source. - -But lately, I’ve been exploring Python templating to do much of the work of creating reports and graphs from other datasets. - -Python templating engines are hugely powerful. My use case of simplifying report creation only scratches the surface of what they can be put to work for. Many developers are making use of these tools to build full-fledged web applications and content management systems. But you don’t have to have a grand vision of a complicated web app to make use of Python templating tools. - -### Why templating? - -Each templating tool is a little different, and you should read the documentation to understand the exact usage. But let’s create a hypothetical example. Let’s say I’d like to create a short page listing all of the Python topics I've written about recently. Something like this: -``` -html> - -  head> - -    title>/title> - -  /head> - -  body> - -    p>/p> - -    ul> - -      li>/li> - -      li>/li> - -      li>/li> - -    /ul> - -  /body> - -/html>My Python articlesThese are some of the things I have written about Python:Python GUIsPython IDEsPython web scrapers - -``` - -Simple enough to maintain when it’s just these three items. But what happens when I want to add a fourth, or fifth, or sixty-seventh? Rather than hand-coding this page, could I generate it from a CSV or other data file containing a list of all of my pages? Could I easily create duplicates of this for every topic I've written on? Could I programmatically change the text or title or heading on each one of those pages? That's where a templating engine can come into play. - -There are many different options to choose from, and today I'll share with you three, in no particular order: [Mako][6], [Jinja2][7], and [Genshi][8]. - -### Mako - -[Mako][6] is a Python templating tool released under the MIT license that is designed for fast performance (not unlike Jinja2). Mako has been used by Reddit to power their web pages, as well as being the default templating language for web frameworks like Pyramid and Pylons. It's also fairly simple and straightforward to use; you can design templates with just a couple of lines of code. Supporting both Python 2.x and 3.x, it's a powerful and feature-rich tool with [good documentation][9], which I consider a must. Features include filters, inheritance, callable blocks, and a built-in caching system, which could be import for large or complex web projects. - -### Jinja2 - -Jinja2 is another speedy and full-featured option, available for both Python 2.x and 3.x under a BSD license. Jinja2 has a lot of overlap from a feature perspective with Mako, so for a newcomer, your choice between the two may come down to which formatting style you prefer. Jinja2 also compiles your templates to bytecode, and has features like HTML escaping, sandboxing, template inheritance, and the ability to sandbox portions of templates. Its users include Mozilla, SourceForge, NPR, Instagram, and others, and also features [strong documentation][10]. Unlike Mako, which uses Python inline for logic inside your templates, Jinja2 uses its own syntax. - -### Genshi - -[Genshi][8] is the third option I'll mention. It's really an XML tool which has a strong templating component, so if the data you are working with is already in XML format, or you need to work with formatting beyond a web page, Genshi might be a good solution for you. HTML is basically a type of XML (well, not precisely, but that's beyond the scope of this article and a bit pedantic), so formatting them is quite similar. Since a lot of the data I work with commonly is in one flavor of XML or another, I appreciated working with a tool I could use for multiple things. - -The release version currently only supports Python 2.x, although Python 3 support exists in trunk, I would caution you that it does not appear to be receiving active development. Genshi is made available under a BSD license. - -### Example - -So in our hypothetical example above, rather than update the HTML file every time I write about a new topic, I can update it programmatically. I can create a template, which might look like this: -``` -html> - -  head> - -    title>/title> - -  /head> - -  body> - -    p>/p> - -    ul> - -      %for topic in topics: - -      li>/li> - -      %endfor - -    /ul> - -  /body> - -/html>My Python articlesThese are some of the things I have written about Python:%for topic in topics:${topic}%endfor - -``` - -And then I can iterate across each topic with my templating library, in this case, Mako, like this: -``` -from mako.template import Template - - - -mytemplate = Template(filename='template.txt') - -print(mytemplate.render(topics=("Python GUIs","Python IDEs","Python web scrapers"))) - -``` - -Of course, in a real-world usage, rather than listing the contents manually in a variable, I would likely pull them from an outside data source, like a database or an API. - -These are not the only Python templating engines out there. If you’re starting down the path of creating a new project which will make heavy use of templates, you’ll want to consider more than just these three. Check out this much more comprehensive list on the [Python wiki][11] for more projects that are worth considering. - --------------------------------------------------------------------------------- - -via: https://opensource.com/resources/python/template-libraries - -作者:[Jason Baker][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/jason-baker -[1]:https://opensource.com/resources/python?intcmp=7016000000127cYAAQ -[2]:https://opensource.com/resources/python/ides?intcmp=7016000000127cYAAQ -[3]:https://opensource.com/resources/python/gui-frameworks?intcmp=7016000000127cYAAQ -[4]:https://opensource.com/tags/python?intcmp=7016000000127cYAAQ -[5]:https://developers.redhat.com/?intcmp=7016000000127cYAAQ -[6]:http://www.makotemplates.org/ -[7]:http://jinja.pocoo.org/ -[8]:https://genshi.edgewall.org/ -[9]:http://docs.makotemplates.org/en/latest/ -[10]:http://jinja.pocoo.org/docs/2.10/ -[11]:https://wiki.python.org/moin/Templating From 09cecda598d0bd879d343910a05639cdbd33694e Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Tue, 29 May 2018 19:06:29 +0800 Subject: [PATCH 73/84] Create 20180427 3 Python template libraries compared.md --- ...27 3 Python template libraries compared.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 translated/tech/20180427 3 Python template libraries compared.md diff --git a/translated/tech/20180427 3 Python template libraries compared.md b/translated/tech/20180427 3 Python template libraries compared.md new file mode 100644 index 0000000000..cae93421c1 --- /dev/null +++ b/translated/tech/20180427 3 Python template libraries compared.md @@ -0,0 +1,112 @@ +3 个 Python 模板库比较 +===== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/library-libraries-search.png?itok=xH8xSU_G) +在我的日常工作中,我花费大量的时间将各种来源的数据转化为可读的信息。虽然很多时候这只是电子表格或某种类型的图表或其他数据可视化的形式,但也有其他时候,将数据以书面形式呈现是有意义的。 + +但我的一个 pet peeve (to 校正:不知道该怎么翻译)正在复制和粘贴。如果你要将数据从源头移动到标准化模板,则不应该复制和粘贴。这很容易出错,说实话,这会浪费你的时间。 + +因此,对于我定期发送的任何信息都遵循一个共同的模式,我倾向于找到某种方法来自动化至少一部分信息。也许这涉及到在电子表格中创建一些公式,一个快速 shell 脚本或其他解决方案,以便使用从外部源提取的信息自动填充模板。 + +但最近,我一直在探索 Python 模板来完成从其他数据集创建报告和图表的大部分工作。 + +Python 模板引擎非常强大。我简化创建报告的使用案例仅仅触及了它们可以用来工作的皮毛。许多开发人员正在利用这些工具来构建完整的 web 应用程序和内容管理系统。但是,你不需要有一个复杂的 web 应用程序来使用 Python 模板工具。 + +### 为什么选择模板? + +每个模板工具都不甚相同,你应该阅读文档以了解其确切的用法。但让我们创建一个假设的例子。假设我想创建一个简短的页面,列出我最近编写的所有 Python 主题。就像这样: +``` + +  +    My Python articles +  +  + +   

These are some of the things I have written about Python:

+   
    +     
  • Python GUIs
  • +     
  • Python IDEs
  • +     
  • Python web scrapers
  • +   
+ +  + + +``` + +当它仅仅是这三个项目时,足够简单地维护它。但是当我想添加第四个,第五个或第六十七个时会发生什么?我可以从包含我所有页面列表的 CSV 文件或其他数据文件生成它,而不是手动编码此页面吗?我可以轻松地为我写的每个主题创建重复内容吗?我可以以编程方式更改每个页面上的文本标题吗?这就是模板引擎可以发挥作用的地方。 + +有许多不同的选择,今天我将与你其中分享三个,顺序不分先后:[Mako][6], [Jinja2][7] 和 [Genshi][8]。 + +### Mako + +[Mako][6] 是根据 MIT 许可证发布的 Python 模板工具,专为快速展现而设计的(与Jinja2不同)。Reddit 已经使用 Mako 为他们的网页提供动力,它同时也是 Pyramid 和 Pylons 等 web 框架的默认模板语言。它相当简单且易于使用。你可以使用几行代码来设计模板;支持Python 2.x 和 3.x,它是一个功能强大且功能丰富的工具,具有[良好的文档][9],这一点我认为是必须的。其功能包括过滤器,继承,可调用块和内置缓存系统,这些系统可以被大型或复杂的 web 项目导入。 + +### Jinja2 + +Jinja2 是另一个快速且功能全面的选项,可用于 Python 2.x 和 3.x,遵循 BSD 许可证。Jinja2 从功能角度与 Mako 有很多重叠,因此对于新手来说,你在两者之间的选择可能会归结为你喜欢的格式化风格。Jinja2 还将模板编译为字节码,并具有 HTML 转义,沙盒,模板继承和模板沙盒部分的功能。其用户包括 Mozilla, SourceForge, NPR, Instagram 等,并且还具有[强大的文档][10]。与 Mako 在模板内部使用 Python 逻辑不同的是,Jinja2 使用自己的语法。 + +### Genshi + +[Genshi][8] 是我会提到的第三个选项。它是一个 XML 工具,具有强大的模板组件,所以如果你使用的数据已经是 XML 格式,或者你需要使用网页以外的格式,Genshi 可能成为你的一个很好的解决方案。HTML 基本上是一种 XML(好吧,不是精确的,但这超出了本文的范围,有点卖弄学问了),因此格式化它们非常相似。由于我通常使用的很多数据都是 XML 或其他类型的数据,因此我非常喜欢使用我可以用于多种事物的工具。 + +发行版目前仅支持 Python 2.x,尽管 Python 3 支持存在于主干中,但我提醒你,它看起来并没有得到有效的开发。Genshi 遵循 BSD 许可证提供。 + +### 示例 + +因此,在上面的假设示例中,我不会每次写新主题时都更新 HTML 文件,而是通过编程方式对其进行更新。我可以创建一个模板,如下所示: +``` + + + My Python articles + + + +

These are some of the things I have written about Python:

+
    + %for topic in topics: +
  • ${topic}
  • + %endfor +
+ + + +``` + +然后我可以使用我的模板库来迭代每个主题,比如使用 Mako,像这样: +``` +from mako.template import Template + +mytemplate = Template(filename='template.txt') +print(mytemplate.render(topics=("Python GUIs","Python IDEs","Python web scrapers"))) + +``` + +当然,在现实世界的用法中,我不会将这些内容手动地列在变量中,而是将它们从外部数据源(如数据库或API)中提取出来。 + +这些不是唯一的 Python 模板引擎。如果你正在开始创建一个将大量使用模板的新项目,那么你考虑的可能不仅仅是这三种选择。在[ Python 维基][11]上查看更全面的列表,以获得更多值得考虑的项目。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/resources/python/template-libraries + +作者:[Jason Baker][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jason-baker +[1]:https://opensource.com/resources/python?intcmp=7016000000127cYAAQ +[2]:https://opensource.com/resources/python/ides?intcmp=7016000000127cYAAQ +[3]:https://opensource.com/resources/python/gui-frameworks?intcmp=7016000000127cYAAQ +[4]:https://opensource.com/tags/python?intcmp=7016000000127cYAAQ +[5]:https://developers.redhat.com/?intcmp=7016000000127cYAAQ +[6]:http://www.makotemplates.org/ +[7]:http://jinja.pocoo.org/ +[8]:https://genshi.edgewall.org/ +[9]:http://docs.makotemplates.org/en/latest/ +[10]:http://jinja.pocoo.org/docs/2.10/ +[11]:https://wiki.python.org/moin/Templating From a4c5954a7387409420ff73d282cf5b704affc7a6 Mon Sep 17 00:00:00 2001 From: songshunqiang Date: Tue, 29 May 2018 22:13:12 +0800 Subject: [PATCH 74/84] submit tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md --- ... Distributions, and the Future of Linux.md | 90 ------------------- ... Distributions, and the Future of Linux.md | 88 ++++++++++++++++++ 2 files changed, 88 insertions(+), 90 deletions(-) delete mode 100644 sources/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md create mode 100644 translated/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md diff --git a/sources/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md b/sources/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md deleted file mode 100644 index 1fa68f3778..0000000000 --- a/sources/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md +++ /dev/null @@ -1,90 +0,0 @@ -pinewall translating - -Containerization, Atomic Distributions, and the Future of Linux -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/atomic-distro.jpg?itok=SjBeCDtq) -Linux has come a long way since Linus Torvalds announced it in 1991. It has become the dominant operating system in the enterprise space. And, although we’ve seen improvements and tweaks in the desktop environment space, the model of a typical Linux distribution has largely remained the same over the past 25+ years. The traditional package management based model has dominated both the desktop and server space. - -However, things took an interesting turn when Google launched Linux-based Chrome OS, which deployed an image-based model. Core OS (now owned by Red Hat) came out with an operating system (Container Linux) that was inspired by Google but targeted at enterprise customers. - -Container Linux changed the way operating systems update. It changed the way applications were delivered and updated. Is this the future of Linux distributions? Will it replace the traditional package-based distribution model? - -### Three models - -Matthias Eckermann, Director of Product Management for SUSE Linux Enterprise, thinks there are not two but three models. “Outside of the traditional (RHEL/SLE) and the image-based model (RH Atomic Host), there is a third model: transactional. This is where [SUSE CaaS Platform][1] and its SUSE MicroOS lives,” said Eckermann. - -### What’s the difference? - -Those who live in Linux land are very well aware of the traditional model. It’s made up of single packages and shared libraries. This model has its own benefit as application developers don’t have to worry about bundling libraries with their apps. There is no duplication, which keeps the system lean and thin. It also saves bandwidth as users don’t have to download a lot of packages. Distributions have total control over packages so security issues can be fixed easily by pushing updates at the system level. - -“Traditional packaging continues to provide the opportunity to carefully craft and tune an operating system to support mission-critical workloads that need to stand the test of time,” said Ron Pacheco, Director of Product Management at Red Hat Enterprise Linux. - -But the traditional model has some disadvantages, too. App developers must restrict themselves to the libraries shipped with the distro, which means they can’t take advantage of new packages for their apps if the distro doesn’t support them. It could also lead to conflict between two different versions. As a result, it creates administration challenges as they are often difficult to keep updated and in sync. - -### Image-based Model - -That’s where the image based model comes to the rescue. “The image-based model solves the problems of the traditional model as it replaces the operating system at every reiteration and doesn't work with single packages,” said Eckermann. - -“When we talk about the operating system as an image, what we’re really talking about is developing and deploying in a programmatic way and with better integrated life cycle management,” said Pacheco, giving the example of OpenShift, which is built on top of Red Hat Enterprise Linux. - -Pacheco sees the image-based OS as a continuum, from hand-tooling a deployed image to a heavily automated infrastructure that can be managed at a large scale; regardless of where a customer is on this range, the same applications have to run. “You don't want to create a silo by using a wholly different deployment model,” he said. - -The image-based model replaces the entire OS with new libraries and packages, which introduces its own set of problems. The image-based model has to be reconstructed to meet the needs of specific environments. For example, if the user has a specific need for installing a specific hardware driver or low-level monitoring option, the image model fails, or options to have finer granularity have to be re-invented. - -### Transactional model - -The third model is transactional updates, which follows the traditional package-based updates, but instead handles all packages as if they were images, updating all the packages that belong together in one shot like an image. - -“The difference is because they are single packages that are grouped together as well as on descending and the installation, the customer has the option to influence this if necessary. This gives the user extra flexibility by combining the benefits of both and avoiding the disadvantages associated with the traditional or image model,” said Eckermann. - -Pacheco said that it’s becoming increasingly common for carefully crafted workloads to be deployed as images in order to deploy consistently, reliably, and to do so with elasticity. “This is what we see our customers do today when they create and deploy virtual machines on premises or on public/private clouds as well as on traditional bare metal deployments,” he said. - -Pacheco suggests that we should not look at these models as strictly a “compare and contrast scenario,” but rather as an evolution and expansion of the operating system’s role. - -### Arrival of Atomic Updates - -Google’s Chrome OS and the Core OS popularized the concept of transactional updates, a model followed by both Red Hat and SUSE. - -“The real problem is the operating system underlining the container host operating system is not in focus anymore -- at least not in a way the administrator should care about. Both RH Atomic Host and SUSE CaaS Platform solve this problem similarly from a user experience perspective,” said Eckermann. - -[Immutable infrastructure][2], such as that provided by SUSE CaaS Platform, Red Hat Atomic Host, and Container Linux (formerly Core OS), encourages the use of transactional updates. “Having a model where the host always moves to a ‘known good’ state enables better confidence with updates, which in turn enables a faster flow of features, security benefits, and an easier-to-adopt operational model,” said Ben Breard, senior technology product manager, Red Hat. - -These newer OSes isolate the applications from the underlying host with Linux containers thereby removing many of the traditional limitations associated with infrastructure updates. - -“The real power and benefits are realized when the orchestration layer is intelligently handling the updates, deployments, and, ultimately, seamless operations,” added Breard. - -### The Future - -What does the future hold for Linux? The answer really depends on who you ask. Container players will say the future belongs to containerized OS, but Linux vendors who still have a huge market may disagree. - -When asked if, in the long run, atomic distros will replace traditional distributions, Eckermann said, “If I say yes, then I am following the trend; if I say no, I will be considered old-fashioned. Nevertheless, I say no: atomic distros will not replace traditional distros in the long run -- but traditional workloads and containerized workloads will live together in data centers as well as private and public cloud environments.” - -Pacheco maintained that the growth in Linux deployments, in general, makes it difficult to imagine one model replacing the other. He said that instead of looking at them as competing models, we should look at atomic distributions as part of the evolution and deployment of the operating system. - -Additionally, there are many use-cases that may need a mix of both species of Linux distributions. “Imagine the large number of PL/1 and Cobol systems in banks and insurance companies. Think about in-memory databases and core data bus systems,” said Eckermann. - -Most of these applications can’t be containerized. As much as we would like to think, containerization is not a silver bullet that solves every problem. There will always be a mix of different technologies. - -Eckermann believes that over time, a huge number of new developments and deployments will go into containerization, but there is still good reason to keep traditional deployment methods and applications in the enterprise. - -“Customers need to undergo business, design, and cultural transformations in order to maximize the advantages that container-based deployments are delivering. The good news is that the industry understands this, as a similar transformation at scale occurred with the historical moves from mainframes to UNIX to x86 to virtualization,” said Pacheco. - -### Conclusion - -It’s apparent that the volume of containerized workloads will increase in the future, which translates into more demand for atomic distros. In the meantime, a substantial percentage of workloads may remain on traditional distros that will keep them running. What really matters is that both players have invested heavily in new models and are ready to tweak their strategy as the market evolves. An external observer can clearly see that the future belongs to transactional/atomic models. We have seen the evolution of datacenter; we have come a long way from one application per server to function-as-a-service model. It is not far fetched to see Linux distros entering the atomic phase. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/2018/4/containerization-atomic-distributions-and-future-linux - -作者:[SWAPNIL BHARTIYA][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/arnieswap -[1]:https://www.suse.com/products/caas-platform/ -[2]:https://www.digitalocean.com/community/tutorials/what-is-immutable-infrastructure diff --git a/translated/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md b/translated/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md new file mode 100644 index 0000000000..2a75db4754 --- /dev/null +++ b/translated/tech/20180404 Containerization, Atomic Distributions, and the Future of Linux.md @@ -0,0 +1,88 @@ +容器化,原子化发行版以及 Linux 的未来 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/atomic-distro.jpg?itok=SjBeCDtq) +自从 Linus Torvalds 在 1991 年发布 Linux 以来,Linux 已历经漫长的岁月。它已经成为企业级领域的主流操作系统。同时,我们看到桌面级领域出现了很多改进和调整,但在过去的 25+ 年,主流 Linux 发行版的模式很大程度上保持不变。基于软件包管理的传统模式依然统治着桌面级和服务器级市场。 + +但随着 Google 发布了基于 Linux 的 Chrome-OS,情况出现了微妙的转变,Chrome-OS 采用镜像模式。Core OS (目前归属于 Red Hat) 受 Google 启发推出了一款操作系统 Container Linux,主要面向企业级用户。 + +Container Linux 改变了操作系统更新的方式,也改变了应用分发和更新的方式。这会是 Linux 发行版的未来吗?这是否会取代基于软件包的传统发行版模式呢? + +### 三种模式 + +SLE (SUSE Linux Enterprise) 的产品管理总监 Matthias Eckermann 认为目前存在 3 种模式,而不是 2 种。Eckermann 提到:“除了传统模式 (RHEL/SLE) 和镜像模式 (RH Atomic Host),还存在第三种模型:事务模式。[SUSE CaaS 平台][1] 及 SUSE MicroOS 就采用这种模型。” + +### 差异有哪些 + +Linux 用户对传统模式非常熟悉,它由独立的软件包和共享库组成。这种模式有独特的优势,让应用开发者无需将共享库捆绑在应用中。由于库不会多次引入,使得系统简洁和轻便。这也让用户无需下载很多软件包,节省了带宽。发行版对软件包全权负责,通过推送系统级别的更新,可以轻松地解决安全隐患。 + +RHEL (Red Hat Enterprise Linux) 的产品管理总监 Ron Pacheco 表示,“传统的打包方式继续为我们提供精心构建和优化操作系统的机会,以便支持需要经过时间考验的任务关键型工作负载。” + +但传统模式也有一些弊端。应用开发者受限使用发行版包含的库,使其无法从发行版不支持的新软件中获益。这也可能导致不同版本之间相互冲突。最终,传统模式给管理员增加了挑战,使其难以让软件包一直处于最新版本状态。 + +### 镜像模式 + +镜像模式应运而生。Eckermann 表示,“镜像模式解决了传统模式遇到的问题,它在每次迭代更新时替换整个操作系统,其中也不包含独立的软件包”。 + +Pacheco 表示,“当我们用镜像作为操作系统的代名词进行讨论时,我们真正关心的是可编程式的开发部署以及更好的集成式生命周期管理”,基于 RHEL 搭建的 OpenShift 被他用作示例。 + +Pacheco 认为基于镜像的操作系统是一种延续,从手工打造并部署镜像,到可大规模管理的高度自动化基础设施;无论客户使用哪种类型,都需要运行同样的应用。他说,“你肯定不希望使用一个完全不同的部署模式,这需要重做很多工作”。 + +镜像模式替代了使用新库和软件包的完整操作系统,但也面临一系列问题。在镜像模式中,需要重建镜像才能适应特殊环境的需求。例如,用户有特殊需求,需要安装特定硬件的驱动或安装底层监控功能,镜像模式无法满足,需要重新设计功能以实现细粒度操作。 + +### 事务模式 + +第三种模式采用事务更新,基于传统的软件包更新,但将全部的软件包视为一个镜像,就像镜像那样在一次操作中更新全部软件包。 + +Eckermann 表示,“由于安装或回滚时操作对象是打包在一起的独立软件包,用户在需要时能够做相应的调整,这就是差别所在。结合传统模式和镜像模式的优点,避免两种模式的缺点,事务模式给用户提供了额外的灵活性。” + +Pacheco 表示,将精心构造的工作负载部署成镜像的做法越来越成为主流,因为这种部署方式具有一致性和可靠性,而且可以弹性部署。“这正是我们用户目前的做法,部署环境包括在预置设备或公有/私有云上创建并部署的虚拟机,或在传统的裸机上” + +Pacheco 建议我们将这几种模式视为操作系统角色的进化和扩展,而不是仅仅“使用场景的比较和对比“。 + +### 原子化更新的问世 + +Google 的 Chrome OS 和 Core OS 为我们普及了事务更新的概念,该模型也被 Red Hat 和 SUSE 采用。 + +Eckermann 表示,”我们必须认识到,用于容器主机的操作系统已经不再是关注点 —— 至少不是管理员的关注点。RH Atomic 主机和 SUSE CaaS 平台都解决了该问题,实现方式在用户看来很相似。“ + +SUSE CaaS 平台、Red Hat Atomic Host和 Container Linux (前身是 Core OS)提供的[不可变基础设施Immutable infrastructure][2] 推广了事务更新的使用。Red Hat 高级技术产品经理 Ben Breard 表示,”在事务模式中,主机总是会变更到已确认正确的新状态,这让我们更有信心执行更新,进而实现更快速的功能流、安全优势以及易于采用的操作模式“。 + +这些新型操作系统使用 Linux 容器将应用与底层系统隔离,解除了传统模式中基础设施更新的诸多限制。 + +Breard 补充道,“当编排层可以智能处理更新、部署,甚至最终实现无缝操作时,我们才会真正意识到该模式的威力和好处”。 + +### 展望未来 + +Linux 的未来会是什么样子?不同的人会给出不同的回答。容器支持者认为未来属于容器化的操作系统,但依然拥有庞大市场的 Linux 供应商显然不这么认为。 + +当被问到原子化发行版是否在很久以后将替换传统发行版时,Eckermann 表示,“如果我回答肯定的,那么表示我顺应潮流;如果回答是否的的,意味着我还是站在传统阵营。然而,我的回答是否定的,即 atomic 发行版在很久以后也不会替换传统发行版,传统负载和容器化负载将在数据中心、私有云以及公有云环境中共存。” + +Pacheco 认为,从 Linux 的部署增长情况来看,一般情况下很难想象一种模式替换另一种模式。与其将多种模式视为相互竞争的关系,不如将原子化发行版视为操作系统进化和部署的一部分。 + +此外,在一些使用案例中,我们需要同时使用多种 Linux 发行版。Eckermann 表示,“想一想银行和保险公司中大量的 PL/1 和 Cobol 系统。再想一想内存数据库和核心数据总线系统”。 + +这些应用大多数无法进行容器化。就我们目前来看,容器化不是解决所有问题的万金油。总是会同时存在多种不同的技术。 + +Eckermann 相信,随着时间的推移,大量新的开发和部署将采用容器化,但仍然有不错的理由,促使我们在企业级环境中保留传统的部署方式和应用。 + +Pacheco 认为,“用户需要经历业务、设计和文化的转型,才能最大化基于容器的部署带来的优势。好消息是业界已经认识到并开始大规模转变,就像历史上大型机转变成 UNIX,UNIX 转变成 x86,x86 转变成虚拟化那样”。 + +### 结论 + +很明显,未来容器化负载的使用量会持续增长,也就意味着原子化发行版的需求量持续增长。与此同时,仍会有不少工作负载运行在传统发行版中。重要的是,这两类用户都在新模式上大规模投入,以便市场改变时可以做相应的策略改变。从外部观察者的视角来看,未来属于事务/原子化模式。我们已经见证了数据中心的发展,我们花了很长时间完成了从每个服务器一个应用到函数即服务模型的转变。Linux 发行版进入原子化时代的日子也不会太远了。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/2018/4/containerization-atomic-distributions-and-future-linux + +作者:[SWAPNIL BHARTIYA][a] +译者:[pinewall](https://github.com/pinewall) +校对:[校对者ID](https://github.com/校对者ID) +选题:[lujun9972](https://github.com/lujun9972) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/arnieswap +[1]:https://www.suse.com/products/caas-platform/ +[2]:https://www.digitalocean.com/community/tutorials/what-is-immutable-infrastructure From d82ff5d2c7cb1bb974d4c3f84ab05a499d60e1bf Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:20:01 +0800 Subject: [PATCH 75/84] PRF:20180104 4 Tools for Network Snooping on Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wyxplus 翻译很用心。 --- ...4 4 Tools for Network Snooping on Linux.md | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/translated/tech/20180104 4 Tools for Network Snooping on Linux.md b/translated/tech/20180104 4 Tools for Network Snooping on Linux.md index cd9a21f0dd..a82e59dd34 100644 --- a/translated/tech/20180104 4 Tools for Network Snooping on Linux.md +++ b/translated/tech/20180104 4 Tools for Network Snooping on Linux.md @@ -1,13 +1,15 @@ -四个Linux网络嗅探工具 +四个 Linux 上的网络嗅探工具 ====== -在计算机网络中,数据是暴露的,因为数据包传输是无法隐藏的,所以让我们来使用 `whois`,`dig`,`nmcli` 和 `nmap` 这四个工具来嗅探网络吧。 +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/1280px-eudyptula_minor_family_exiting_burrow.jpg?itok=kGZ53AzN) -请注意,不要运行 `nmap` 在不属于自己的网络上,因为这有可能会被其他人解读成为恶意攻击。 +在计算机网络中,数据是暴露的,因为数据包传输是无法隐藏的,所以让我们来使用 `whois`、`dig`、`nmcli` 和 `nmap` 这四个工具来嗅探网络吧。 + +请注意,不要在不属于自己的网络上运行 `nmap` ,因为这有可能会被其他人认为恶意攻击。 ### 精简和详细域名信息查询 -您可能已经注意到,之前我们用心爱的 `whois` 命令查询域名信息,但现如今似乎没有提供同过去一样的详细程度。我们使用该命令查询 Linux.com 域名描述信息: +您可能已经注意到,之前我们用常用的老式 `whois` 命令查询域名信息,但现如今似乎没有提供同过去一样的详细程度。我们使用该命令查询 linux.com 的域名描述信息: ``` $ whois linux.com @@ -30,19 +32,19 @@ DNSSEC: unsigned [...] ``` -有很多令人讨厌的法律声明。但在哪有联系信息呢?该网站位于 whois.namecheap.com 站点上(见上面输出的第三行): +有很多令人讨厌的法律声明。但在哪有联系信息呢?该网站位于 `whois.namecheap.com` 站点上(见上面输出的第三行): ``` $ whois -h whois.namecheap.com linux.com - ``` -我就不复制出来,因为这实在太长了,包含了注册人,管理员和技术人员的联系信息。怎么回事啊,露西尔?(LCTT 译注:《行尸走肉》中尼根的棒子)有一些注册表,比如.com和.net是精简注册表,保存了一部分有限的域名信息。为了获取完整信息请使用 `-h` 或 `--host` 参数,该参数便会从域名的 `注册服务机构` 中获取。 -大部分顶级域名是需要详细的注册信息,如.info。试着使用`whois blockchain.info`命令来查看。 +我就不复制出来了,因为这实在太长了,包含了注册人,管理员和技术人员的联系信息。怎么回事啊,露西尔?(LCTT 译注:《行尸走肉》中尼根的棒子)有一些注册库,比如 .com 和 .net 是精简注册库,保存了一部分有限的域名信息。为了获取完整信息请使用 `-h` 或 `--host` 参数,该参数便会从域名的 `注册服务机构` 中获取。 + +大部分顶级域名是有详细的注册信息,如 .info。试着使用 `whois blockchain.info` 命令来查看。 想要摆脱这些烦人的法律声明?使用 `-H` 参数。 -### DNS解析 +### DNS 解析 使用 `dig` 命令比较从不同的域名服务器返回的查询结果,去除陈旧的信息。域名服务器记录缓存各地的解析信息,并且不同的域名服务器有不同的刷新间隔。以下是一个简单的用法: @@ -69,19 +71,18 @@ linux.com. 10800 IN A 151.101.193.5 ;; SERVER: 127.0.1.1#53(127.0.1.1) ;; WHEN: Tue Jan 16 15:17:04 PST 2018 ;; MSG SIZE rcvd: 102 - ``` -注意下靠近末尾的这行信息:SERVER: 127.0.1.1#53(127.0.1.1),这是您默认的缓存解析器。当地址是本地时,就相当于在您的电脑上安装DNS服务。在我看来这就是一个Dnsmasq工具(LCTT 译注:是一个小巧且方便地用于配置DNS和DHCP的工具),该工具被用作网络管理: + +注意下靠近末尾的这行信息:`SERVER: 127.0.1.1#53(127.0.1.1)`,这是您默认的缓存解析器。当地址是本地时,就表明您的电脑上安装了 DNS 服务。在我看来这就是一个 Dnsmasq 工具(LCTT 译注:是一个小巧且方便地用于配置 DNS 和 DHCP 的工具),该工具被用作网络管理: ``` $ ps ax|grep dnsmasq 2842 ? S 0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address=127.0.1.1 - ``` - `dig` 命令默认是返回A记录,也就是域名。IPv6则有AAAA记录: +`dig` 命令默认是返回 A 记录,也就是域名。IPv6 则有 AAAA 记录: ``` $ $ dig linux.com AAAA @@ -92,48 +93,44 @@ linux.com. 60 IN AAAA 64:ff9b::9765:4105 linux.com. 60 IN AAAA 64:ff9b::9765:8105 linux.com. 60 IN AAAA 64:ff9b::9765:c105 [...] - ``` -仔细检查下,发现Linux.com有IPv6地址。很好!如果您的网络服务支持IPv6那么您就可以用IPv6连接。(令人难过的是,我的移动宽带则没提供IPv6) +仔细检查下,发现 linux.com 有 IPv6 地址。很好!如果您的网络服务支持 IPv6 那么您就可以用 IPv6 连接。(令人难过的是,我的移动宽带则没提供 IPv6) - -假设您能使DNS改变您的域名,又或是您使用 `dig` 查询的结果有误。试着用一个公共DNS,如OpenNIC: +假设您能对您的域名做一些 DNS 改变,又或是您使用 `dig` 查询的结果有误。试着用一个公共 DNS,如 OpenNIC: ``` $ dig @69.195.152.204 linux.com [...] ;; Query time: 231 msec ;; SERVER: 69.195.152.204#53(69.195.152.204) - ``` + `dig` 回应您正在的查询是来自 69.195.152.204。您可以查询各种服务并且比较结果。 ### 上游域名服务器 -我想知道我的上游域名服务器是谁。为了查询,我首先看下`/etc/resolv/conf` 的配置信息: +我想知道我的上游域名服务器(LCTT 译注:此处指解析器)是谁。为了查询,我首先看下 `/etc/resolv/conf` 的配置信息: ``` $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 - ``` -很幸运,不过我是已经知道。您的Linux发行版可能配置不同,您会看到您的上游服务器。接下来我们来试试网络管理器命令行工具 `nmcli`: +好吧,不过我已经知道了。您的 Linux 发行版可能配置不同,您会看到您的上游服务器。接下来我们来试试网络管理器命令行工具 `nmcli`: ``` $ nmcli dev show | grep DNS IP4.DNS[1]: 192.168.1.1 - ``` -很好,现在我们已经知道了,其实那是我的移动热点,并且我已经确认那是我的热点。我能够登录到简易管理面板,来查询上游服务器。然而许多消费者互联网网关不会让您看到或改变这些设置,因此只能尝试其他的方法,如 [我的域名服务器是什么?][1] +很好,现在我们已经知道了,其实那是我的移动热点,我能确认。我能够登录到简易管理面板,来查询上游服务器。然而许多用户级互联网网关不会让您看到或改变这些设置,因此只能尝试其他的方法,如 [我的域名服务器是什么?][1] -### 查找在您的网络中IPv4地址 +### 查找在您的网络中 IPv4 地址 -您的网络上有哪些IPv4地址已启用并正在使用中? +您的网络上有哪些 IPv4 地址已启用并正在使用中? ``` $ nmap -sn 192.168.1.0/24 @@ -145,8 +142,8 @@ Host is up (0.000071s latency). Nmap scan report for nellybly (192.168.1.3) Host is up (0.015s latency) Nmap done: 256 IP addresses (2 hosts up) scanned in 2.23 seconds - ``` + 每个人都想去扫描自己的局域网中开放的端口。下面的例子是寻找服务和他们的版本号: ``` @@ -171,10 +168,9 @@ Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 256 IP addresses (2 hosts up) scanned in 11.65 seconds - ``` -这些是有趣的结果。让我们尝试从不同的网络帐户进行相同的操作,以查看这些服务是否暴露于互联网中。如果您有智能手机,相当于您有第二个网络。您可以下载应用程序,还可以为您的Linux电脑提供热点。从热点控制面板获取广域网IP地址,然后重试: +这些是有趣的结果。让我们尝试从不同的互联网连接进行相同的操作,以查看这些服务是否暴露于互联网中。如果您有智能手机,相当于您有第二个网络。您可以下载应用程序,还可以为您的 Linux 电脑提供热点。从热点控制面板获取广域网IP地址,然后重试: ``` $ nmap -sV 12.34.56.78 @@ -183,13 +179,11 @@ Starting Nmap 7.01 ( https://nmap.org ) at 2018-01-14 17:05 PST Nmap scan report for 12.34.56.78 Host is up (0.0061s latency). All 1000 scanned ports on 12.34.56.78 are closed - ``` -果然不出所料,结果和我想象的一样。可以用手册来查询这些命令,以便了解更多有趣的嗅探技术。 +果然不出所料,结果和我想象的一样(LCTT 译注:这些服务和信息没有被暴露在公网上)。可以用手册来查询这些命令,以便了解更多有趣的嗅探技术。 -了解更多Linux的相关知识可以从Linux基金会和edX(LCTT译者注:edX是麻省理工和哈佛大学于2012年4月联手创建的大规模开放在线课堂平台)中获取免费的 ["介绍Linux" ][2]课程。 - +了解更多 Linux 的相关知识可以从 Linux 基金会和 edX(LCTT译注:edX 是麻省理工和哈佛大学于 2012 年 4 月联手创建的大规模开放在线课堂平台)中获取免费的 [“介绍 Linux”][2]课程。 -------------------------------------------------------------------------------- @@ -197,7 +191,7 @@ via: https://www.linux.com/learn/intro-to-linux/2018/1/4-tools-network-snooping- 作者:[Carla Schroder][a] 译者:[wyxplus](https://github.com/wyxplus) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ed87748648960e479ee24ed870fb0dbfc72a629f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:21:08 +0800 Subject: [PATCH 76/84] PUB:20180104 4 Tools for Network Snooping on Linux.md @wyxplus https://linux.cn/article-9692-1.html --- .../20180104 4 Tools for Network Snooping on Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180104 4 Tools for Network Snooping on Linux.md (100%) diff --git a/translated/tech/20180104 4 Tools for Network Snooping on Linux.md b/published/20180104 4 Tools for Network Snooping on Linux.md similarity index 100% rename from translated/tech/20180104 4 Tools for Network Snooping on Linux.md rename to published/20180104 4 Tools for Network Snooping on Linux.md From b9be02e00ac9cd8fbd76349934bb00e0f73ef287 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:26:25 +0800 Subject: [PATCH 77/84] PRF:20180518 How To Install Ncurses Library In Linux.md @geekpi --- ...How To Install Ncurses Library In Linux.md | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/translated/tech/20180518 How To Install Ncurses Library In Linux.md b/translated/tech/20180518 How To Install Ncurses Library In Linux.md index 47f094de34..0678c5a5be 100644 --- a/translated/tech/20180518 How To Install Ncurses Library In Linux.md +++ b/translated/tech/20180518 How To Install Ncurses Library In Linux.md @@ -1,69 +1,68 @@ 如何在 Linux 中安装 Ncurses 库 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2018/05/install-ncurses-720x340.png) -**GNU Ncurses** 是一个允许用户编写基于文本的用户界面(TUI)的编程库。许多基于文本的游戏都是使用这个库创建的。一个受欢迎的例子是 [**PacVim**][1],这是一款学习 VIM 命令的 CLI 游戏。在这篇简要的指南中,我将解释如何在类 Unix 操作系统中安装 Ncurses 库。 +**GNU Ncurses** 是一个允许用户编写基于文本的用户界面(TUI)的编程库。许多基于文本的游戏都是使用这个库创建的。一个受欢迎的例子是 [PacVim][1],这是一款学习 VIM 命令的 CLI 游戏。在这篇简要的指南中,我将解释如何在类 Unix 操作系统中安装 Ncurses 库。 ### 在 Linux 中安装 Ncurses 库 Ncurses 在大多数 Linux 发行版的默认仓库中都有。例如,你可以使用以下命令将其安装在基于 Arch 的系统上: + ``` $ sudo pacman -S ncurses - ``` 在RHEL、CentOS 上: + ``` $ sudo yum install ncurses-devel - ``` 在 Fedora 22 和更新版本上: + ``` $ sudo dnf install ncurses-devel - ``` 在 Debian、Ubuntu、Linux Mint 上: + ``` $ sudo apt-get install libncurses5-dev libncursesw5-dev - ``` 默认仓库中的 GNU ncureses 可能有点老了。如果你想要最新的稳定版本,可以从源代码进行编译和安装,如下所示。 -从[**这里**][2]下载最新的 ncurses 版本。在写这篇文章时,最新版本是 6.1。 +从[这里][2]下载最新的 ncurses 版本。在写这篇文章时,最新版本是 6.1。 + ``` $ wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz - ``` 解压 tar 文件: + ``` $ tar xzf ncurses-6.1.tar.gz - ``` 这将在当前目录中创建一个名为 ncurses-6.1 的文件夹。cd 到该目录: + ``` $ cd ncurses-6.1 - $ ./configure --prefix=/opt/ncurses - ``` 最后,使用以下命令进行编译和安装: + ``` $ make - $ sudo make install - ``` 使用命令验证安装: + ``` $ ls -la /opt/ncurses - ``` 就是这样。Ncurses 已经安装在 Linux 发行版上。继续使用 Ncurses 创建漂亮的 TUI。 @@ -73,7 +72,6 @@ $ ls -la /opt/ncurses 干杯! - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-install-ncurses-library-in-linux/ @@ -81,7 +79,7 @@ via: https://www.ostechnix.com/how-to-install-ncurses-library-in-linux/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5b0ce17dfec2cd479e94e0b34adff44447bf45e6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:26:50 +0800 Subject: [PATCH 78/84] PUB:20180518 How To Install Ncurses Library In Linux.md @geekpi https://linux.cn/article-9693-1.html --- .../20180518 How To Install Ncurses Library In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180518 How To Install Ncurses Library In Linux.md (100%) diff --git a/translated/tech/20180518 How To Install Ncurses Library In Linux.md b/published/20180518 How To Install Ncurses Library In Linux.md similarity index 100% rename from translated/tech/20180518 How To Install Ncurses Library In Linux.md rename to published/20180518 How To Install Ncurses Library In Linux.md From 164b7dd3d41aecba43357c6b9f3ebefbe6728a02 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:38:54 +0800 Subject: [PATCH 79/84] PRF:20180424 Things You Should Know About Ubuntu 18.04.md @wyxplus --- ...ings You Should Know About Ubuntu 18.04.md | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md b/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md index 1e5ce8c6af..68953dd4b6 100644 --- a/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md +++ b/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md @@ -1,7 +1,7 @@ 你应该知道关于 Ubuntu 18.04 的一些事 ====== -[Ubuntu 18.04 版本][1] 即将到来。我可以在各种 Facebook 群组和论坛中看到许多来自 Ubuntu 用户的提问。我还在 Facebook 和 Instagram 上组织了 Q&A 会议,以了解 Ubuntu 用户对 Ubuntu 18.04 的想法。 +[Ubuntu 18.04 版本][1] 已经到来。我可以在各种 Facebook 群组和论坛中看到许多来自 Ubuntu 用户的提问。我还在 Facebook 和 Instagram 上组织了 Q&A 会议,以了解 Ubuntu 用户对 Ubuntu 18.04 的想法。 我试图在这里回答关于 Ubuntu 18.04 的常见问题。如果您有任何疑问,我希望这能帮助您解决疑问。如果您仍有问题,请随时在下面的评论区提问。 @@ -17,19 +17,19 @@ Canonical 公司知道有些人喜欢 Unity。这就是为什么它已经在 Universe 软件库(LCTT译者注:社区维护的软件库)中提供了 Unity 7。但这是一个社区维护版,官方并不直接参与开发。 -但我建议是使用默认的 GNOME,除非您真的无法容忍它,再在 [Ubuntu 18.04 上安装 Unity][3]。 +不过我建议是使用默认的 GNOME,除非您真的无法容忍它,再在 [Ubuntu 18.04 上安装 Unity][3]。 #### GNOME 是什么版本? 在这次发行的 Ubuntu 18.04 版本中,GNOME 版本号是 3.28。 -#### 我能够安装 vanilla GNOME? +#### 我能够安装原装的 GNOME 吗? 当然没问题! -因为存在一些 GNOME 用户可能不喜欢 Ubuntu 18.04 中的 Unity 风格。在 Ubuntu 中的 main(LCTT译者注:官方支持的软件库)和 universe 软件库有安装包可安装,能使您在 [Ubuntu 18.04 中安装 vanilla GNOME][4]。 +因为存在一些 GNOME 用户可能不喜欢 Ubuntu 18.04 中的 Unity 风格。在 Ubuntu 中的 main(LCTT译者注:官方支持的软件库)和 universe 软件库有安装包可安装,能使您在 [Ubuntu 18.04 中安装原装的 GNOME][4]。 -#### GNOME中的内存泄漏已修复了吗? +#### GNOME 中的内存泄漏已修复了吗? 已经修复了。[GNOME 3.28 中臭名昭着的内存泄漏][5] 已经被修复了,并且 [Ubuntu 官方已经在测试这个修复程序][6]。 @@ -39,23 +39,21 @@ Canonical 公司知道有些人喜欢 Unity。这就是为什么它已经在 Uni 这是一个长期支持(LTS)版本,与任何 LTS 版本一样,官方会支持五年。这意味着 Ubuntu 18.04 将在 2023 年 4 月之前能获得安全和维护更新。这对于除 Ubuntu Studio 之外的所有基于 Ubuntu 的 Linux 发行版也一样。 -#### Ubuntu 18.04 什么时候会发布? +#### Ubuntu 18.04 什么时候发布的? -Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行版,如 Kubuntu,Lubuntu,Xubuntu,Budgie,MATE 等都会在同一天发布其 18.04 版本。 +Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行版,如 Kubuntu、Lubuntu、Xubuntu、Budgie、MATE 等都会在同一天发布其 18.04 版本。 不过 [Ubuntu Studio 不会有 18.04 的 LTS 版本][7]。 -#### 是否能从16.04/17.10升级到 Ubuntu 18.04?我可以从使用 Unity 的 Ubuntu 16.04 升级到使用 GNOME 的 Ubuntu 18.04 吗? +#### 是否能从 16.04/17.10 升级到 Ubuntu 18.04?我可以从使用 Unity 的 Ubuntu 16.04 升级到使用 GNOME 的 Ubuntu 18.04 吗? 绝对没问题。当 Ubuntu 18.04 LTS 发布后,您可以很容易的升级到最新版。 -如果您使用的是 Ubuntu 17.10,请确保在软件和更新->更新中,将“有新版本时通知我”设置为“适用任何新版本”。 - +如果您使用的是 Ubuntu 17.10,请确保在“软件和更新”->“更新”中,将“有新版本时通知我”设置为“适用任何新版本”。 ![Get notified for a new version in Ubuntu][8] -如果您使用的是 Ubuntu 16.04,请确保在软件和更新->更新中,将“有新版本时通知我”设置为“适用长期支持版本”。 - +如果您使用的是 Ubuntu 16.04,请确保在“软件和更新”->“更新”中,将“有新版本时通知我”设置为“适用长期支持版本”。 ![Ubuntu 18.04 upgrade from Ubuntu 16.04][9] @@ -63,10 +61,8 @@ Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行 即使 Ubuntu 16.04 使用的是 Unity,但您仍然可以 [升级到使用 GNOME 的 Ubuntu 18.04][10]。 - #### 升级到 Ubuntu 18.04 意味着什么?我会丢失数据吗? - 如果您使用的是 Ubuntu 17.10 或 Ubuntu 16.04,系统会提示您可升级到 Ubuntu 18.04。如果您从互联网上下载 1.5 Gb 的数据不成问题,则只需点击几下鼠标,即可在 30 分钟内升级到 Ubuntu 18.04。 您不需要通过 U 盘来重装系统。升级过程完成后,您将可以使用新的 Ubuntu 版本。 @@ -75,7 +71,7 @@ Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行 #### 我什么时候能升级到 Ubuntu 18.04? -如果您使用的是 Ubuntu 17.10 并且正确设置(设置方法在之前提到的问题中),那么在 Ubuntu 18.04 发布的几天内应该会通知您升级到 Ubuntu 18.04。为避免 Ubuntu 服务器在发布日期负载量过大,因此不是每个人都会在同一天收到升级提示。 +如果您使用的是 Ubuntu 17.10 并且正确设置(设置方法在之前提到的问题中),那么在 Ubuntu 18.04 发布的几天内应该会通知您升级到 Ubuntu 18.04。为避免 Ubuntu 服务器在发布时的负载量过大,因此不是每个人都会在同一天收到升级提示。 对于 Ubuntu 16.04 用户,可能需要几周时间才能正式收到 Ubuntu 18.04 升级提示。通常,这将在第一次发布 Ubuntu 18.04.1 之后提示。该版本修复了 18.04 中发现的新 bug。 @@ -89,16 +85,13 @@ Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行 如果您已经在使用 32 位版本的 Ubuntu 16.04 或 17.10,您依旧可以升级到 Ubuntu 18.04。 但是,您找到不到 32 位的 Ubuntu 18.04 ISO 镜像。换句话说,您无法安装 32 位版本的 Ubuntu 18.04。 - -有一个好消息是,Ubuntu MATE,Lubuntu 等其他官方版本仍然具有其新版本的 32 位 ISO 镜像。 +有一个好消息是,Ubuntu MATE、Lubuntu 等其他官方版本仍然具有其新版本的 32 位 ISO 镜像。 无论如何,如果您使用一个 32 位系统,那么很可能您的计算机硬件性能过低。在这样的电脑上使用轻量级 [Ubuntu MATE][11] 或 [Lubuntu][12] 系统会更好。 - #### 我可以在哪下载 Ubuntu 18.04? -一旦发布了 18.04,您可以从其网站获得 Ubuntu 18.04 的 ISO 镜像。您既可以直接官网下载,也能用种子下载。其他官方版本将在其官方网站上提供下载。 - +18.04 已经发布了,您可以从其网站获得 Ubuntu 18.04 的 ISO 镜像。您既可以直接官网下载,也能用种子下载。其他官方版本将在其官方网站上提供下载。 #### 我应该重新安装 Ubuntu 18.04 还是从 16.04/17.10 升级上来? @@ -106,7 +99,7 @@ Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行 从现有版本升级到 18.04 是一个方便的选择。不过,就我个人而言,它仍然保留了旧版本的依赖包。重新安装还是比较干净。 -对于重新安装来说,我应该安装 Ubuntu 16.04 还是 Ubuntu 18.04? +#### 对于重新安装来说,我应该安装 Ubuntu 16.04 还是 Ubuntu 18.04? 如果您要在计算机上安装 Ubuntu,请尽量使用 Ubuntu 18.04 而不是 16.04。 @@ -116,7 +109,6 @@ Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行 此外,许多应用程序开发人员将很快开始关注 Ubuntu 18.04。新创建的 PPA 可能仅在几个月内支持 18.04。所以使用 18.04 比 16.04 更好。 - #### 安装打印机-扫描仪驱动程序比使用 CLI 安装会更容易吗? 在打印机方面,我不是专家,所以我的观点是基于我在这方面有限的知识。大多数新打印机都支持 [IPP协议][14],因此它们应该在 Ubuntu 18.04 中能够获到很好的支持。 然而对较旧的打印机我则无法保证。 @@ -127,15 +119,14 @@ Ubuntu 18.04 LTS 在 4 月 26 日发布。 所有基于 Ubuntu 的 Linux 发行 #### Ubuntu 18.04 的系统要求? - 对于默认的 GNOME 版本,最好您应该有 [4 GB 的内存以便正常使用][15]。使用过去 8 年中发布的处理器也可以运行。但任何比这性能更差的硬件建议使用 [轻量级 Linux 发行版][16],例如 [Lubuntu][12]。 - - #### 有关 Ubuntu 18.04 的其问题? 如果还有其他疑问,请随时在下方评论区留言。如果您认为应将其他信息添加到列表中,请告诉我。 +(LCTT 译注:本文原文写于 Ubuntu 18.04 LTS 发布之前,译文翻译于发布之后,因此对部分内容做了修改。) + -------------------------------------------------------------------------------- via: https://itsfoss.com/ubuntu-18-04-faq/ @@ -143,12 +134,12 @@ via: https://itsfoss.com/ubuntu-18-04-faq/ 作者:[Abhishek Prakash][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[wyxplus](https://github.com/wyxplus) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://itsfoss.com/author/abhishek/ -[1]:https://itsfoss.com/ubuntu-18-04-release-features/ +[1]:https://linux.cn/article-9583-1.html [2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/ubuntu-18-04-faq-800x450.png [3]:https://itsfoss.com/use-unity-ubuntu-17-10/ [4]:https://itsfoss.com/vanilla-gnome-ubuntu/ From 35b3bc2dfcb73acc66231a401d8b4fe001b45b17 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:39:31 +0800 Subject: [PATCH 80/84] PUB:20180424 Things You Should Know About Ubuntu 18.04.md @wyxplus https://linux.cn/article-9694-1.html --- .../20180424 Things You Should Know About Ubuntu 18.04.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180424 Things You Should Know About Ubuntu 18.04.md (100%) diff --git a/translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md b/published/20180424 Things You Should Know About Ubuntu 18.04.md similarity index 100% rename from translated/tech/20180424 Things You Should Know About Ubuntu 18.04.md rename to published/20180424 Things You Should Know About Ubuntu 18.04.md From ae00d25c0b6545de2f54a6805d44b371c1df533f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:58:38 +0800 Subject: [PATCH 81/84] PRF:20180131 Microservices vs. monolith How to choose.md @qhwdw --- ...icroservices vs. monolith How to choose.md | 66 +++++++------------ 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/translated/tech/20180131 Microservices vs. monolith How to choose.md b/translated/tech/20180131 Microservices vs. monolith How to choose.md index f6d389fab2..9f2d1b6984 100644 --- a/translated/tech/20180131 Microservices vs. monolith How to choose.md +++ b/translated/tech/20180131 Microservices vs. monolith How to choose.md @@ -1,13 +1,11 @@ 微服务 vs. 整体服务:如何选择 ============================================================ -### 任何一种架构都是有利有弊的,而能满足你组织的独特需要的决策才是正确的选择。 - +> 任何一种架构都是有利有弊的,而能满足你组织的独特需要的决策才是正确的选择。 ![Microservices vs. monolith: How to choose](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/building_architecture_design.jpg?itok=lB_qYv-I "Microservices vs. monolith: How to choose") -Image by :  -Onasill ~ Bill Badzo on [Flickr][11]. [CC BY-NC-SA 2.0][12]. Modified by Opensource.com. +Image by : Onasill ~ Bill Badzo on [Flickr][11]. [CC BY-NC-SA 2.0][12]. Modified by Opensource.com. 对于许多初创公司来说,传统的知识认为,从单一整体架构开始,而不是使用微服务。但是,我们还有别的选择吗? @@ -17,37 +15,30 @@ Onasill ~ Bill Badzo on [Flickr][11]. [CC BY-NC-SA 2.0][12]. Modified by Open ### 理解范围 -更多有关微服务的内容 - -* [如何向你的 CEO 解释微服务][1] - -* [免费电子书:微服务 vs. 面向服务的架构][2] - -* [DevOps 确保微服务安全][3] - 首先,我们先来准确定义我们所谓的 “整体服务” 和 “微服务” 是什么。 -微服务是一种方法,它开发一个单一的应用程序来作为构成整体服务的小服务,每个小服务都运行在它自己的进程中,并且使用一个轻量级的机制进行通讯,通常是一个 HTTP 资源 API。这些服务都围绕业务能力来构建,并且可依赖全自动部署机制来独立部署。 +微服务是一种方法,它开发一个单一的应用程序来作为构成整体服务的小服务,每个小服务都运行在它自己的进程中,并且使用一个轻量级的机制进行通讯,通常是一个 HTTP 资源的 API。这些服务都围绕业务能力来构建,并且可依赖全自动部署机制来独立部署。 -一个整体应用程序是按单个的、统一的单元来构建,并且,通常情况下它是基于一个大量的代码来实现的。一般来说,一个整体服务是由三部分组成的:一个数据库、一个客户端用户界面(由 HTML 页面和/或运行在浏览器中的 JavaScript 组成)、以及一个服务器端应用程序。 +一个整体应用程序是按单个的、统一的单元来构建,并且,通常情况下它是基于一个大量的代码来实现的。一般来说,一个整体服务是由三部分组成的:数据库、客户端用户界面(由 HTML 页面和/或运行在浏览器中的 JavaScript 组成)、以及服务器端应用程序。 -“系统架构处于一个范围之中”,Zachary Crockett,[Particle][14] 的 CTO,在一次访谈中,他说,”在讨论微服务时,人们倾向于关注这个范围的一端:许多极小的应用程序给其它应用程序传递了过多的信息。在另一端,有一个巨大的整体服务做了太多的事情。在任何现实中的系统上,在这两个极端之间有很多合适的面向服务的架构“。 +“系统架构处于一个范围之中”,Zachary Crockett,[Particle][14] 的 CTO,在一次访谈中,他说,“在讨论微服务时,人们倾向于关注这个范围的一端:许多极小的应用程序给其它应用程序传递了过多的信息。在另一端,有一个巨大的整体服务做了太多的事情。在任何现实中的系统上,在这两个极端之间有很多合适的面向服务的架构”。 根据你的情况不同,不论是使用整体服务还是微服务都有很多很好的理由。 -"我们希望为每个服务使用最好的工具”,Julien Lemoine 说,他是 Algolia 的 CTO。 +“我们希望为每个服务使用最好的工具”,Julien Lemoine 说,他是 Algolia 的 CTO。 与很多人的想法正好相反,整体服务并不是过去遗留下来的过时的架构。在某些情况下,整体服务是非常理想的。我采访了 Steven Czerwinski 之后,更好地理解了这一点,他是 [Scaylr][15] 的工程主管,前谷歌员工。 “尽管我们在谷歌时有使用微服务的一些好的经验,我们现在 [在 Scalyr] 却使用的是整体服务的架构,因为一个整体服务架构意味着我们的工作量更少,我们只有两位工程师。“ 他解释说。(采访他时,Scaylr 正处于早期阶段) -但是,如果你的团队使用微服务的经验很丰富,并且你对你们的发展方向有明确的想法,微服务可能是一个很好的 替代者。 +但是,如果你的团队使用微服务的经验很丰富,并且你对你们的发展方向有明确的想法,微服务可能是一个很好的替代者。 -Julien Lemoine,[Algolia][16] 的 CTO,在这个问题上,他认为:”我们通常从使用微服务开始,主要目的是我们可以使用不同的技术来构建我们的服务,因为如下的两个主要原因: +Julien Lemoine,[Algolia][16] 的 CTO,在这个问题上,他认为:“我们通常从使用微服务开始,主要目的是我们可以使用不同的技术来构建我们的服务,因为如下的两个主要原因: -* 我们想为每个服务使用最好的工具。我们的搜索 API 是在底层做过高度优化的,而 C++ 是非常适合这项工作的。他说,在任何地方都使用 C++ 是一种生产力的浪费,尤其是在构建仪表板方面。 +* 我们想为每个服务使用最好的工具。我们的搜索 API 是在底层做过高度优化的,而 C++ 是非常适合这项工作的。他说,在任何其它地方都使用 C++ 是一种生产力的浪费,尤其是在构建仪表板方面。 +* 我们希望使用最好的人才,而只使用一种技术将极大地限制我们的选择。这就是为什么在公司中有不同语言的原因。 -* 我们希望使用最好的人才,而只使用一种技术将极大地限制我们的选择。这就是为什么在公司中有不同语言的原因。“ +” 如果你的团队已经准备好从一开始就使用微服务,这样你的组织从一开始就可以适应微服务环境的开发节奏。 @@ -57,36 +48,29 @@ Julien Lemoine,[Algolia][16] 的 CTO,在这个问题上,他认为:”我 ### 整体服务 -### 优点: +#### 优点: * **很少担心横向联系:** 大多数应用程序开发者都担心横向联系,比如,日志、速度限制、以及像审计跟踪和 DoS 防护这样的安全特性。当所有的东西都运行在同一个应用程序中时,通过组件钩子来处理这些关注点就非常容易了。 - * **运营开销很少:** 只需要为一个应用程序设置日志、监视、以及测试。一般情况下,部署也相对要简单。 - * **性能:** 一个整体的架构可能会有更好的性能,因为共享内存的访问速度要比进程间通讯(IPC)更快。 -### 缺点: - -* **紧耦合:** 整体服务的应用程序倾向于紧耦合,并且应用程序是整体进化,分离特定用途的服务是非常困难的,比如,独立扩展或者代码维护。 +#### 缺点: +* **紧耦合:** 整体服务的应用程序倾向于紧耦合,并且应用程序是整体进化的,分离特定用途的服务是非常困难的,比如,独立扩展或者代码维护。 * **理解起来很困难:** 当你想查看一个特定的服务或者控制器时,因为依赖、副作用、和其它的不可预见因素,整体架构理解起来更困难。 ### 微服务 -### 优点: +#### 优点: * **非常好组织:** 微服务架构一般很好组织它们,因为每个微服务都有一个特定的工作,并且还不用考虑其它组件的工作。 - * **解耦合:** 解耦合的服务是能够非常容易地进行重组织和重配置,以服务于不同的应用程序(比如,同时向 Web 客户端和公共 API 提供服务)。它们在一个大的集成系统中,也允许快速、独立分发单个部分。 - * **性能:** 根据组织的情况,微服务可以提供更好的性能,因为你可以分离热点服务,并根据其余应用程序的情况来扩展它们。 - * **更少的错误:** 微服务允许系统中的不同部分,在维护良好边界的前提下进行并行开发。这样将使连接不该被连接的部分变得更困难,比如,需要连接的那些紧耦合部分。 -### 缺点: +#### 缺点: * **跨每个服务的横向联系点:** 由于你构建了一个新的微服务架构,你可能会发现在设计时没有预料到的很多横向联系的问题。这也将导致需要每个横向联系点的独立模块(比如,测试)的开销增加,或者在其它服务层面因封装横向联系点,所导致的所有流量都需要路由。最终,即便是整体服务架构也倾向于通过横向联系点的外部服务层来路由流量,但是,如果使用整体架构,在项目更加成熟之前,也不过只是推迟了工作成本。 - * **更高的运营开销:** 微服务在它所属的虚拟机或容器上部署非常频繁,导致虚拟机争用激增。这些任务都是使用容器管理工具进行频繁的自动化部署的。 ### 决策时刻 @@ -109,7 +93,7 @@ David Strauss,[Pantheon][17] 的 CTO,他解释说:"[以前],你使用整 ### 评估业务风险 -技术力量雄厚的初创公司为追求较高的目标,可以考虑使用微服务。但是微服务可能会带来业务风险。Strauss 解释说,”许多团队一开始就过度构建他们的项目。每个人都认为,他们的公司会成为下一个 “独角兽”,因此,他们使用微服务构建任何一个东西,或者一些其它的高扩展性的基础设施。但是这通常是一种错误的做法“。Strauss 说,在那种情况下,他们认为需要扩大规模的领域往往并不是一开始真正需要扩展的领域,最后的结果是浪费了时间和努力。 +技术力量雄厚的初创公司为追求较高的目标,可以考虑使用微服务。但是微服务可能会带来业务风险。Strauss 解释说,“许多团队一开始就过度构建他们的项目。每个人都认为,他们的公司会成为下一个 ‘独角兽’,因此,他们使用微服务构建任何一个东西,或者一些其它的高扩展性的基础设施。但是这通常是一种错误的做法”。Strauss 说,在那种情况下,他们认为需要扩大规模的领域往往并不是一开始真正需要扩展的领域,最后的结果是浪费了时间和努力。 ### 态势感知 @@ -118,36 +102,30 @@ David Strauss,[Pantheon][17] 的 CTO,他解释说:"[以前],你使用整 #### 什么时候使用整体服务 * **你的团队还在创建阶段:** 你的团队很小 —— 也就是说,有 2 到 5 位成员 —— 还无法应对大范围、高成本的微服务架构。 - * **你正在构建的是一个未经证实的产品或者概念验证:** 如果你将一个全新的产品推向市场,随着时间的推移,它有可能会成功,而对于一个快速迭代的产品,整体架构是最合适的。这个提示也同样适用于概念验证,你的目标是尽可能快地学习,即便最终你可能会放弃它。 - * **你没有使用微服务的经验:** 除非你有合理的理由证明早期学习阶段的风险可控,否则,一个整体的架构更适用于一个没有经验的团队。 #### 什么时候开始使用微服务 * **你需要快速、独立的分发服务:** 微服务允许在一个大的集成系统中快速、独立分发单个部分。请注意,根据你的团队规模,获取与整体服务的比较优势,可能需要一些时间。 - * **你的平台中的某些部分需要更高效:** 如果你的业务要求集中处理 PB 级别的日志卷,你可能需要使用一个像 C++ 这样的更高效的语言来构建这个服务,尽管你的用户仪表板或许还是用 [Ruby on Rails][5] 构建的。 - * **计划扩展你的团队:** 使用微服务,将让你的团队从一开始就开发独立的小服务,而服务边界独立的团队更易于按需扩展。 要决定整体服务还是微服务更适合你的组织,要坦诚并正确认识自己的环境和能力。这将有助于你找到业务成长的最佳路径。 -### 主题 - - [微服务][21]、 [DevOps][22] - ### 关于作者 - [![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/profile_15.jpg?itok=EaSRMCN-)][18] jakelumetta - Jake 是 ButterCMS 的 CEO,它是一个 [API-first CMS][6]。他喜欢搅动出黄油双峰,以及构建让开发者工作更舒适的工具,喜欢他的更多内容,请在 Twitter 上关注 [@ButterCMS][7],订阅 [他的博客][8]。[关于他的更多信息][9] + [![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/profile_15.jpg?itok=EaSRMCN-)][18] + +jakelumetta - Jake 是 ButterCMS 的 CEO,它是一个 [API-first CMS][6]。他喜欢搅动出黄油双峰,以及构建让开发者工作更舒适的工具,喜欢他的更多内容,请在 Twitter 上关注 [@ButterCMS][7],订阅 [他的博客][8]。[关于他的更多信息][9]…… -------------------------------------------------------------------------------- via: https://opensource.com/article/18/1/how-choose-between-monolith-microservices -作者:[jakelumetta ][a] +作者:[jakelumetta][a] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d2f0ab2f8b6c7165af43bdb06d9bb19810816f71 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 May 2018 05:59:15 +0800 Subject: [PATCH 82/84] PUB:20180131 Microservices vs. monolith How to choose.md @qhwdw https://linux.cn/article-9695-1.html --- .../20180131 Microservices vs. monolith How to choose.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180131 Microservices vs. monolith How to choose.md (100%) diff --git a/translated/tech/20180131 Microservices vs. monolith How to choose.md b/published/20180131 Microservices vs. monolith How to choose.md similarity index 100% rename from translated/tech/20180131 Microservices vs. monolith How to choose.md rename to published/20180131 Microservices vs. monolith How to choose.md From 8ad580cc38cc8d4fe3a1e18205b8f094ff90f2e4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 May 2018 08:42:23 +0800 Subject: [PATCH 83/84] translated --- ...ck tip- quickly remove background noise.md | 55 ------------------- ...ck tip- quickly remove background noise.md | 53 ++++++++++++++++++ 2 files changed, 53 insertions(+), 55 deletions(-) delete mode 100644 sources/tech/20180521 Audacity quick tip- quickly remove background noise.md create mode 100644 translated/tech/20180521 Audacity quick tip- quickly remove background noise.md diff --git a/sources/tech/20180521 Audacity quick tip- quickly remove background noise.md b/sources/tech/20180521 Audacity quick tip- quickly remove background noise.md deleted file mode 100644 index c4943ba7ba..0000000000 --- a/sources/tech/20180521 Audacity quick tip- quickly remove background noise.md +++ /dev/null @@ -1,55 +0,0 @@ -translating---geekpi - -Audacity quick tip: quickly remove background noise -====== - -![](https://fedoramagazine.org/wp-content/uploads/2018/03/audacity-noise-816x345.png) -When recording sounds on a laptop — say for a simple first screencast — many users typically use the built-in microphone. However, these small microphones also capture a lot of background noise. In this quick tip, learn how to use [Audacity][1] in Fedora to quickly remove the background noise from audio files. - -### Installing Audacity - -Audacity is an application in Fedora for mixing, cutting, and editing audio files. It supports a wide range of formats out of the box on Fedora — including MP3 and OGG. Install Audacity from the Software application. - -![][2] - -If the terminal is more your speed, use the command: -``` -sudo dnf install audacity - -``` - -### Import your Audio, sample background noise - -After installing Audacity, open the application, and import your sound using the **File > Import** menu item. This example uses a [sound bite from freesound.org][3] to which noise was added: - -Next, take a sample of the background noise to be filtered out. With the tracks imported, select an area of the track that contains only the background noise. Then choose **Effect > Noise Reduction** from the menu, and press the **Get Noise Profile** button. - -![][4] - -### Filter the Noise - -Next, select the area of the track you want to filter the noise from. Do this either by selecting with the mouse, or **Ctrl + a** to select the entire track. Finally, open the **Effect > Noise Reduction** dialog again, and click OK to apply the filter. - -![][5] - -Additionally, play around with the settings until your tracks sound better. Here is the original file again, followed by the noise reduced track for comparison (using the default settings): - -https://ryanlerch.fedorapeople.org/sidebyside.ogg?_=2 - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/audacity-quick-tip-quickly-remove-background-noise/ - -作者:[Ryan Lerch][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/introducing-flatpak/ -[1]:https://www.audacityteam.org/ -[2]:https://fedoramagazine.org/wp-content/uploads/2018/03/audacity-software.jpg -[3]:https://freesound.org/people/levinj/sounds/8323/ -[4]:https://fedoramagazine.org/wp-content/uploads/2018/03/select-noise-profile.gif -[5]:https://fedoramagazine.org/wp-content/uploads/2018/03/apply-filter.gif diff --git a/translated/tech/20180521 Audacity quick tip- quickly remove background noise.md b/translated/tech/20180521 Audacity quick tip- quickly remove background noise.md new file mode 100644 index 0000000000..0765199582 --- /dev/null +++ b/translated/tech/20180521 Audacity quick tip- quickly remove background noise.md @@ -0,0 +1,53 @@ +Audacity 快速指南:快速消除背景噪音 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/03/audacity-noise-816x345.png) +当在笔记本电脑上录制声音时 - 比如首次简单地录屏 - 许多用户通常使用内置麦克风。但是,这些小型麦克风也会捕获很多背景噪音。在这个快速指南中,我们会学习如何使用 Fedora 中的 [Audacity][1] 快速移除音频文件中的背景噪音。 + +### 安装 Audacity + +Audacity 是 Fedora 中用于混合、剪切和编辑音频文件的程序。在 Fedora 上它支持各种开箱即用的格式 - 包括 MP3 和 OGG。从软件中心安装 Audacity。 + +![][2] + +如果你更喜欢终端,请使用以下命令: +``` +sudo dnf install audacity + +``` + +### 导入您的音频、样本背景噪音 + +安装 Audacity 后,打开程序,使用 **File > Import** 菜单项导入你的声音。这个例子使用了一个[来自 freesound.org 添加了噪音的声音][3]: + +接下来,采样要滤除的背景噪音。导入音轨后,选择仅包含背景噪音的音轨区域。然后从菜单中选择 **Effect > Noise Reduction**,然后按下 **Get Noise Profile** 按钮。 + +![][4] + +### 过滤噪音 + +接下来,选择你要过滤噪音的音轨区域。通过使用鼠标进行选择,或者按 **Ctrl + a** 来选择整个音轨。最后,再次打开 **Effect > Noise Reduction** 对话框,然后单击确定以应用滤镜。 + +![][5] + +此外,调整设置,直到你的音轨听起来更好。这里是原始文件,接下来是用于比较的降噪音轨(使用默认设置): + +https://ryanlerch.fedorapeople.org/sidebyside.ogg?_=2 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/audacity-quick-tip-quickly-remove-background-noise/ + +作者:[Ryan Lerch][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/introducing-flatpak/ +[1]:https://www.audacityteam.org/ +[2]:https://fedoramagazine.org/wp-content/uploads/2018/03/audacity-software.jpg +[3]:https://freesound.org/people/levinj/sounds/8323/ +[4]:https://fedoramagazine.org/wp-content/uploads/2018/03/select-noise-profile.gif +[5]:https://fedoramagazine.org/wp-content/uploads/2018/03/apply-filter.gif From 1995354eea17f0af59c8efefbc6a549f456fed13 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 May 2018 08:45:18 +0800 Subject: [PATCH 84/84] translating --- ...ing Stratis to manage Linux storage from the command line.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180522 Using Stratis to manage Linux storage from the command line.md b/sources/tech/20180522 Using Stratis to manage Linux storage from the command line.md index 2bed178d85..9d1919c689 100644 --- a/sources/tech/20180522 Using Stratis to manage Linux storage from the command line.md +++ b/sources/tech/20180522 Using Stratis to manage Linux storage from the command line.md @@ -1,3 +1,5 @@ +translating----geekpi + Using Stratis to manage Linux storage from the command line ======