2
0
mirror of https://github.com/LCTT/TranslateProject.git synced 2025-03-27 02:30:10 +08:00

Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu.Wang 2018-07-28 22:23:40 +08:00
commit b5401891ca
8 changed files with 453 additions and 425 deletions

View File

@ -1,12 +1,15 @@
如何提升自动化的 ROI4 个小提示
======
> 想要在你的自动化项目上达成强 RIO采取如下步骤来规避失败。
![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/cio_it_investments_2.png?itok=Ut1XIIBN)
在过去的几年间有关自动化技术的讨论已经很多了。COO 们和运营团队(事实上还有其它的业务部门)对成本随着工作量的增加而增加的这一事实可以重新定义而感到震惊。
机器人流程自动化RPA似乎预示着运营的圣杯Holy Grail“我们提供了开箱即用的功能来满足你的日常操作所需 —— 检查电子邮件、保存附件、取数据、更新表格、生成报告、文件以及目录操作。构建一个机器人就像配置这些功能一样简单,然后用机器人将这些操作链接到一起,而不用去请求 IT 部门来构建它们。”这是一个多么诱人的话题
在过去的几年间有关自动化技术的讨论已经很多了。COO 们和运营团队(事实上还有其它的业务部门)对于可以重新定义成本随着工作量的增加而增加的这一事实而感到震惊
低成本、几乎不出错、非常遵守流程 —— 对 COO 们和运营领导来说这些好处即实用可行度又高。RPA 工具承诺,它从运营中节省下来的费用就足够支付它的成本(有一个短的回报期),这一事实使得业务的观点更具有吸引力。
<ruby>机器人流程自动化<rt>Robotic Process Automation</rt></ruby>RPA似乎预示着运营的<ruby>圣杯<rt>Holy Grail</rt></ruby>:“我们提供了开箱即用的功能来满足你的日常操作所需 —— 检查电子邮件、保存附件、取数据、更新表格、生成报告、文件以及目录操作。构建一个机器人就像配置这些功能一样简单,然后用机器人将这些操作链接到一起,而不用去请求 IT 部门来构建它们。”这是一个多么诱人的话题。
低成本、几乎不出错、非常遵守流程 —— 对 COO 们和运营领导来说这些好处真实可及。RPA 工具承诺,它从运营中节省下来的费用就足够支付它的成本(有一个短的回报期),这一事实使得业务的观点更具有吸引力。
自动化的谈论都趋向于类似的话题COO 们和他们的团队想知道,自动化操作能够给他们带来什么好处。他们想知道 RPA 平台特性和功能,以及自动化在现实中的真实案例。从这一点到概念验证的实现过程通常很短暂。
@ -14,7 +17,7 @@
但是自动化带来的现实好处有时候可能比你所预期的时间要晚。采用 RPA 的公司在其实施后可能会对它们自身的 ROI 提出一些质疑。一些人没有看到预期之中的成本节省,并对其中的原因感到疑惑。
## 你是不是自动化了错误的东西?
### 你是不是自动化了错误的东西?
在这些情况下,自动化的愿景和现实之间的差距是什么呢?我们来分析一下它,在决定去继续进行一个自动化验证项目(甚至是一个成熟的实践)之后,我们来看一下通常会发生什么。
@ -26,7 +29,7 @@
那么,对于领导们来说,怎么才能确保实施自动化能够带来他们想要的 ROI 呢?实现这个目标有四步:
## 1. 教育团队
### 1. 教育团队
在你的团队中,从 COO 职位以下的人中,很有可能都听说过 RPA 和运营自动化。同样很有可能他们都有许多的问题和担心。在你开始启动实施之前解决这些问题和担心是非常重要的。
@ -36,23 +39,23 @@
“实施自动化的第一步是更好地理解你的流程。”
## 2. 审查内部流程
### 2. 审查内部流程
实施自动化的第一步是更好地理解你的流程。每个 RPA 实施之前都应该进行流程清单、动作分析、以及成本/价值的绘制练习。
这些练习对于理解流程中何处价值产生(或成本,如果没有价值的情况下)是至关重要的。并且这些练习需要在每个流程或者每个任务这样的粒度级别上来做。
这些练习对于理解流程中何处产生价值(或成本,如果没有价值的情况下)是至关重要的。并且这些练习需要在每个流程或者每个任务这样的粒度级别上来做。
这将有助你去识别和优先考虑最合适的自动化候选者。由于能够或者可能需要自动化的任务数量较多,流程一般需要分段实施自动化,因此优先级很重要。
**建议**:设置一个小的工作团队,每个运营团队都参与其中。从每个运营团队中提名一个协调人 —— 一般是运营团队的领导或者团队管理者。在团队级别上组织一次研讨会,去构建流程清单、识别候选流程、以及推动购买。你的自动化合作伙伴很可能有“加速器” —— 调查问卷、计分卡等等 —— 这些将帮助你加速完成这项活动。
## 3. 为优先业务提供强有力的指导
### 3. 为优先业务提供强有力的指导
实施自动化经常会涉及到在运营团队之间,基于业务价值对流程选择和自动化优先级上要达成共识(有时候是打破平衡)虽然团队的参与仍然是分析和实施的关键部分,但是领导仍然应该是最终的决策者。
**建议**:安排定期会议从工作团队中获取最新信息。除了像推动达成共识和购买之外,工作团队还应该在团队层面上去查看领导们关于 ROI、平台选择、以及自动化优先级上的指导性决定。
## 4. 应该推动 CIO 和 COO 的紧密合作
### 4. 应该推动 CIO 和 COO 的紧密合作
当运营团队和技术团队紧密合作时自动化的实施将异常顺利。COO 需要去帮助推动与 CIO 团队的合作。
@ -68,7 +71,7 @@ via: https://enterprisersproject.com/article/2017/11/how-improve-roi-automation-
作者:[Rajesh Kamath][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/) 荣誉推出

View File

@ -1,3 +1,6 @@
Translating by MjSeven
5 Commands for Checking Memory Usage in Linux
======

View File

@ -1,3 +1,5 @@
Translating...by SunWave
How to Check Disk Space on Linux from the Command Line
======

View File

@ -1,214 +0,0 @@
translating by bestony
Getting Started with Debian Packaging
======
![](http://minkush.me/img/posts/12.jpg)
One of my tasks in GSoC involved set up of Thunderbird extensions for the user. Some of the more popular add-ons like [Lightning][1] (calendar organiser) already has a Debian package.
Another important add on is [Cardbook][2] which is used to manage contacts for the user based on CardDAV and vCard standards. But it doesnt have a package yet.
My mentor, [Daniel][3] motivated me to create a package for it and upload it to [mentors.debian.net][4]. It would ease the installation process as it could get installed through `apt-get`. This blog describes how I learned and created a Debian package for CardBook from scratch.
Since, I was new to packaging, I did extensive research on basics of building a package from the source code and checked if the license was [DFSG][5] compatible.
I learned from various Debian wiki guides like [Packaging Intro][6], [Building a Package][7] and blogs.
I also studied the amd64 files included in [Lightning extension package][8].
The package I created could be found [here][9].
![Debian Package!][10]
Debian Package
### Creating an empty package
I started by creating a `debian` directory by using `dh_make` command
```
# Empty project folder
$ mkdir -p Debian/cardbook
```
```
# create files
$ dh_make\
> --native \
> --single \
> --packagename cardbook_1.0.0 \
> --email minkush@example.com
```
Some important files like control, rules, changelog, copyright are initialized with it.
The list of all the files created:
```
$ find /debian
debian/
debian/rules
debian/preinst.ex
debian/cardbook-docs.docs
debian/manpage.1.ex
debian/install
debian/source
debian/source/format
debian/cardbook.debhelper.lo
debian/manpage.xml.ex
debian/README.Debian
debian/postrm.ex
debian/prerm.ex
debian/copyright
debian/changelog
debian/manpage.sgml.ex
debian/cardbook.default.ex
debian/README
debian/cardbook.doc-base.EX
debian/README.source
debian/compat
debian/control
debian/debhelper-build-stamp
debian/menu.ex
debian/postinst.ex
debian/cardbook.substvars
debian/files
```
I gained an understanding of [Dpkg][11] package management program in Debian and its use to install, remove and manage packages.
I build an empty package with `dpkg` commands. This created an empty package with four files namely `.changes`, `.deb`, `.dsc`, `.tar.gz`
`.dsc` file contains the changes made and signature
`.deb` is the main package file which can be installed
`.tar.gz` (tarball) contains the source package
The process also created the README and changelog files in `/usr/share`. They contain the essential notes about the package like description, author and version.
I installed the package and checked the installed package contents. My new package mentions the version, architecture and description!
```
$ dpkg -L cardbook
/usr
/usr/share
/usr/share/doc
/usr/share/doc/cardbook
/usr/share/doc/cardbook/README.Debian
/usr/share/doc/cardbook/changelog.gz
/usr/share/doc/cardbook/copyright
```
### Including CardBook source files
After successfully creating an empty package, I added the actual CardBook add-on files inside the package. The CardBooks codebase is hosted [here][12] on Gitlab. I included all the source files inside another directory and told the build package command which files to include in the package.
I did this by creating a file `debian/install` using vi editor and listed the directories that should be installed. In this process I spent some time learning to use Linux terminal based text editors like vi. It helped me become familiar with editing, creating new files and shortcuts in vi.
Once, this was done, I updated the package version in the changelog file to document the changes that I have made.
```
$ dpkg -l | grep cardbook
ii cardbook 1.1.0 amd64 Thunderbird add-on for address book
```
![Changelog][13]
Changelog file after updating Package
After rebuilding it, dependencies and detailed description can be added if necessary. The Debian control file can be edited to add the additional package requirements and dependencies.
### Local Debian Repository
Without creating a local repository, CardBook could be installed with:
```
$ sudo dpkg -i cardbook_1.1.0.deb
```
To actually test the installation for the package, I decided to build a local Debian repository. Without it, the `apt-get` command would not locate the package, as it is not in uploaded in Debian packages on net.
For configuring a local Debian repository, I copied my packages (.deb) to `Packages.gz` file placed in a `/tmp` location.
![Packages-gz][14]
Local Debian Repo
To make it work, I learned about the apt configuration and where it looks for files.
I researched for a way to add my file location in apt-config. Finally I could accomplish the task by adding `*.list` file with packages path in APT and updating apt-cache afterwards.
Hence, the latest CardBook version could be successfully installed by `apt-get install cardbook`
![Package installation!][15]
CardBook Installation through apt-get
### Fixing Packaging errors and bugs
My mentor, Daniel helped me a lot during this process and guided me how to proceed further with the package. He told me to use [Lintian][16] for fixing common packaging error and then using [dput][17] to finally upload the CardBook package.
> Lintian is a Debian package checker which finds policy violations and bugs. It is one of the most widely used tool by Debian Maintainers to automate checks for Debian policies before uploading the package.
I have uploaded the second updated version of the package in a separate branch of the repository on Salsa [here][18] inside Debian directory.
I installed Lintian from backports and learned to use it on a package to fix errors. I researched on the abbreviations used in its errors and how to show detailed response from lintian commands
```
$ lintian -i -I --show-overrides cardbook_1.2.0.changes
```
Initially on running the command on the `.changes` file, I was surprised to see that a large number of errors, warnings and notes were displayed!
![Package Error Brief!][19]
Brief errors after running Lintian on Package
![Lintian error1!][20]
Detailed Lintian errors
Detailed Lintian errostyle=”width:200px;”rs
I spend some days to fix some errors related to Debian package policy violations. I had to dig into every policy and Debian rules carefully to eradicate a simple error. For this I referred various sections on [Debian Policy Manual][21] and [Debian Developers Reference][22].
I am still working on making it flawless and hope to upload it on mentors.debian.net soon!
It would be grateful if people from the Debian community who use Thunderbird could help fix these errors.
--------------------------------------------------------------------------------
via: http://minkush.me/cardbook-debian-package/
作者:[Minkush Jain][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://minkush.me/cardbook-debian-package/#
[1]:https://addons.mozilla.org/en-US/thunderbird/addon/lightning/
[2]:https://addons.mozilla.org/nn-NO/thunderbird/addon/cardbook/?src=hp-dl-featured
[3]:https://danielpocock.com/
[4]:https://mentors.debian.net/
[5]:https://wiki.debian.org/DFSGLicenses
[6]:https://wiki.debian.org/Packaging/Intro
[7]:https://wiki.debian.org/BuildingAPackage
[8]:https://packages.debian.org/stretch/amd64/lightning/filelist
[9]:https://salsa.debian.org/minkush-guest/CardBook/tree/debian-package/Debian
[10]:/img/posts/13.png
[11]:https://packages.debian.org/stretch/dpkg
[12]:https://gitlab.com/CardBook/CardBook
[13]:/img/posts/15.png
[14]:/img/posts/14.png
[15]:/img/posts/11.png
[16]:https://packages.debian.org/stretch/lintian
[17]:https://packages.debian.org/stretch/dput
[18]:https://salsa.debian.org/minkush-guest/CardBook/tree/debian-package
[19]:/img/posts/16.png (Running Lintian on package)
[20]:/img/posts/10.png
[21]:https://www.debian.org/doc/debian-policy/
[22]:https://www.debian.org/doc/manuals/developers-reference/

View File

@ -1,201 +0,0 @@
Translating by qhwdw
A sysadmin's guide to network management
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openwires_fromRHT_520_0612LL.png?itok=PqZi55Ab)
If you're a sysadmin, your daily tasks include managing servers and the data center's network. The following Linux utilities and commands—from basic to advanced—will help make network management easier.
In several of these commands, you'll see `<fqdn>`, which stands for "fully qualified domain name." When you see this, substitute your website URL or your server (e.g., `server-name.company.com`), as the case may be.
### Ping
As the name suggests, `ping` is used to check the end-to-end connectivity from your system to the one you are trying to connect to. It uses [ICMP][1] echo packets that travel back to your system when a ping is successful. It's also a good first step to check system/network connectivity. You can use the `ping` command with IPv4 and IPv6 addresses. (Read my article "[How to find your IP address in Linux][2]" to learn more about IP addresses.)
**Syntax:**
* IPv4: `ping <ip address>/<fqdn>`
* IPv6: `ping6 <ip address>/<fqdn>`
You can also use `ping` to resolve names of websites to their corresponding IP address, as shown below:
![](https://opensource.com/sites/default/files/uploads/ping-screen-0.png)
### Traceroute
`ping` checks end-to-end connectivity, the `traceroute` utility tells you all the router IPs on the path you travel to reach the end system, website, or server. `traceroute` is usually is the second step after `ping` for network connection debugging.
This is a nice utility for tracing the full network path from your system to another. Wherechecks end-to-end connectivity, theutility tells you all the router IPs on the path you travel to reach the end system, website, or server.is usually is the second step afterfor network connection debugging.
**Syntax:**
* `traceroute <ip address>/<fqdn>`
### Telnet
**Syntax:**
* `telnet <ip address>/<fqdn>` is used to [telnet][3] into any server.
### Netstat
The network statistics (`netstat`) utility is used to troubleshoot network-connection problems and to check interface/port statistics, routing tables, protocol stats, etc. It's any sysadmin's must-have tool.
**Syntax:**
* `netstat -l` shows the list of all the ports that are in listening mode.
* `netstat -a` shows all ports; to specify only TCP, use `-at` (for UDP use `-au`).
* `netstat -r` provides a routing table.
![](https://opensource.com/sites/default/files/uploads/netstat-r.png)
* `netstat -s` provides a summary of statistics for each protocol.
![](https://opensource.com/sites/default/files/uploads/netstat-s.png)
* `netstat -i` displays transmission/receive (TX/RX) packet statistics for each interface.
![](https://opensource.com/sites/default/files/uploads/netstat-i.png)
### Nmcli
`nmcli` is a good utility for managing network connections, configurations, etc. It can be used to control Network Manager and modify any device's network configuration details.
**Syntax:**
* `nmcli device` lists all devices on the system.
* `nmcli device show <interface>` shows network-related details of the specified interface.
* `nmcli connection` checks a device's connection.
* `nmcli connection down <interface>` shuts down the specified interface.
* `nmcli connection up <interface>` starts the specified interface.
* `nmcli con add type vlan con-name <connection-name> dev <interface> id <vlan-number> ipv4 <ip/cidr> gw4 <gateway-ip>` adds a virtual LAN (VLAN) interface with the specified VLAN number, IP address, and gateway to a particular interface.
![](https://opensource.com/sites/default/files/uploads/nmcli.png)
### Routing
There are many commands you can use to check and configure routing. Here are some useful ones:
**Syntax:**
* `ip route` shows all the current routes configured for the respective interfaces.
![](https://opensource.com/sites/default/files/uploads/ip-route.png)
* `route add default gw <gateway-ip>` adds a default gateway to the routing table.
* `route add -net <network ip/cidr> gw <gateway ip> <interface>` adds a new network route to the routing table. There are many other routing parameters, such as adding a default route, default gateway, etc.
* `route del -net <network ip/cidr>` deletes a particular route entry from the routing table.
![](https://opensource.com/sites/default/files/uploads/route-add-del.png)
* `ip neighbor` shows the current neighbor table and can be used to add, change, or delete new neighbors.
![](https://opensource.com/sites/default/files/uploads/ip-neighbor.png)
![](https://opensource.com/sites/default/files/uploads/ip-neigh-help.png)
* `arp` (which stands for address resolution protocol) is similar to `ip neighbor`. `arp` maps a system's IP address to its corresponding MAC (media access control) address.
![](https://opensource.com/sites/default/files/uploads/arp.png)
### Tcpdump and Wireshark
Linux provides many packet-capturing tools like `tcpdump`, `wireshark`, `tshark`, etc. They are used to capture network traffic in packets that are transmitted/received and hence are very useful for a sysadmin to debug any packet losses or related issues. For command-line enthusiasts, `tcpdump` is a great tool, and for GUI users, `wireshark` is a great utility to capture and analyze packets. `tcpdump` is a built-in Linux utility to capture network traffic. It can be used to capture/show traffic on specific ports, protocols, etc.
**Syntax:**
* `tcpdump -i <interface-name>` shows live packets from the specified interface. Packets can be saved in a file by adding the `-w` flag and the name of the output file to the command, for example: `tcpdump -w <output-file.> -i <interface-name>`.
![](https://opensource.com/sites/default/files/uploads/tcpdump-i.png)
* `tcpdump -i <interface> src <source-ip>` captures packets from a particular source IP.
* `tcpdump -i <interface> dst <destination-ip>` captures packets from a particular destination IP.
* `tcpdump -i <interface> port <port-number>` captures traffic for a specific port number like 53, 80, 8080, etc.
* `tcpdump -i <interface> <protocol>` captures traffic for a particular protocol, like TCP, UDP, etc.
### Iptables
`iptables` is a firewall-like packet-filtering utility that can allow or block certain traffic. The scope of this utility is very wide; here are some of its most common uses.
**Syntax:**
* `iptables -L` lists all existing `iptables` rules.
* `iptables -F` deletes all existing rules.
The following commands allow traffic from the specified port number to the specified interface:
* `iptables -A INPUT -i <interface> -p tcp dport <port-number> -m state state NEW,ESTABLISHED -j ACCEPT`
* `iptables -A OUTPUT -o <interface> -p tcp -sport <port-number> -m state state ESTABLISHED -j ACCEPT`
The following commands allow loopback access to the system:
* `iptables -A INPUT -i lo -j ACCEPT`
* `iptables -A OUTPUT -o lo -j ACCEPT`
### Nslookup
The `nslookup` tool is used to obtain IP address mapping of a website or domain. It can also be used to obtain information on your DNS server, such as all DNS records on a website (see the example below). A similar tool to `nslookup` is the `dig` (Domain Information Groper) utility.
**Syntax:**
* `nslookup <website-name.com>` shows the IP address of your DNS server in the Server field, and, below that, gives the IP address of the website you are trying to reach.
* `nslookup -type=any <website-name.com>` shows all the available records for the specified website/domain.
### Network/interface debugging
Here is a summary of the necessary commands and files used to troubleshoot interface connectivity or related network issues.
**Syntax:**
* `ss` is a utility for dumping socket statistics.
* `nmap <ip-address>`, which stands for Network Mapper, scans network ports, discovers hosts, detects MAC addresses, and much more.
* `ip addr/ifconfig -a` provides IP addresses and related info on all the interfaces of a system.
* `ssh -vvv user@<ip/domain>` enables you to SSH to another server with the specified IP/domain and username. The `-vvv` flag provides "triple-verbose" details of the processes going on while SSH'ing to the server.
* `ethtool -S <interface>` checks the statistics for a particular interface.
* `ifup <interface>` starts up the specified interface.
* `ifdown <interface>` shuts down the specified interface.
* `systemctl restart network` restarts a network service for the system.
* `/etc/sysconfig/network-scripts/<interface-name>` is an interface configuration file used to set IP, network, gateway, etc. for the specified interface. DHCP mode can be set here.
* `/etc/hosts` this file contains custom host/domain to IP mappings.
* `/etc/resolv.conf` specifies the DNS nameserver IP of the system.
* `/etc/ntp.conf` specifies the NTP server domain.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/sysadmin-guide-networking-commands
作者:[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
[1]:https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol
[2]:https://opensource.com/article/18/5/how-find-ip-address-linux
[3]:https://en.wikipedia.org/wiki/Telnet

View File

@ -1,3 +1,5 @@
Translating... by SunWave
3 Methods to List All The Users in Linux System
======
Everyone knows user information was residing in `/etc/passwd` file.

View File

@ -0,0 +1,233 @@
从 Debian 打包 Package 开始
======
![](http://minkush.me/img/posts/12.jpg)
我在 GSoC (译注Google Summer Of Code一项针对学生进行的开源项目训练营一般在夏季进行。)的任务中有一项是为用户构建 Thunderbird 拓展。一些非常流行的拓展,比如 [Lightning][1] (日记组织工具)已经拥有了 deb 包。
另外一个重要的用于管理基于 CardDav 和 vCard 标准的联系人的拓展 [Cardbook][2] ,还没有一个 deb 包。
我的导师, [Daniel][3]鼓励我去为它制作一个包,并上传到[mentors.debian.net][4]。因为这样就可以使用 `apt-get` 来安装,简化了安装流程。这篇博客描述了我如何从头开始学习和为 CardBook 创建一个 Debian 包的。
首先,我是第一次接触打包,我在从源码构建包的基础上进行了拓展研究,并检查它的协议是是否与 [DFSG][5] 兼容。
我从多个 Debian Wiki 中的指南中进行学习,比如 [打包介绍][6], [构建一个包][7]’,以及一些博客。
我还学习包含在[Lightning 拓展包][8]的 amd64 文件。
我创建的包可以在[这里][9]找到。
![Debian Package!][10]
Debian 包
### 创建一个空的包
我开始于使用 `dh_make` 来创建一个 `debian` 目录。
```
# Empty project folder
$ mkdir -p Debian/cardbook
```
```
# create files
$ dh_make\
> --native \
> --single \
> --packagename cardbook_1.0.0 \
> --email minkush@example.com
```
一些重要的文件,比如控制、规则、变更日志、版权文件等被初始化其中。
所创建的文件的完整列表如下:
```
$ find /debian
debian/
debian/rules
debian/preinst.ex
debian/cardbook-docs.docs
debian/manpage.1.ex
debian/install
debian/source
debian/source/format
debian/cardbook.debhelper.lo
debian/manpage.xml.ex
debian/README.Debian
debian/postrm.ex
debian/prerm.ex
debian/copyright
debian/changelog
debian/manpage.sgml.ex
debian/cardbook.default.ex
debian/README
debian/cardbook.doc-base.EX
debian/README.source
debian/compat
debian/control
debian/debhelper-build-stamp
debian/menu.ex
debian/postinst.ex
debian/cardbook.substvars
debian/files
```
I gained an understanding of [Dpkg][11] package management program in Debian and its use to install, remove and manage packages.
我了解关于Debian 系统中 [Dpkg][11] 包管理器及如何用它安装、删除和管理包。
我使用 `dpkg` 命令创建了一个空的包。这个命令创建一个空的包文件以及四个名为 `.changes`、`.deb`、 `.dsc``.tar.gz` 的文件。
`.dsc` 文件包含所发生的修改和签名
`.deb` 文件是主要用于安装的包。
`.tar.gz` (tarball) 包含了源代码
这个进程也创建了`/usr/share`目录下的 README 和 变更日志文件。他们包含了关于这个包的基本信息比如描述、作者、版本。
I installed the package and checked the installed package contents. My new package mentions the version, architecture and description!
我安装这个包,并检查这个包安装的内容。我的包中包含了版本、架构和描述。
```
$ dpkg -L cardbook
/usr
/usr/share
/usr/share/doc
/usr/share/doc/cardbook
/usr/share/doc/cardbook/README.Debian
/usr/share/doc/cardbook/changelog.gz
/usr/share/doc/cardbook/copyright
```
### 包含 CardBook 源代码
在成功的创建了一个空包以后,我在包中添加了真正的 CardBook 拓展文件。 CardBook 的源代码托管在 [Gitlab][12] 上。我将所有的源码文件包含在另外一个目录,并告诉打包命令哪些文件需要包含在这个包中。
我使用 vi 编辑器创建一个 `debian/install` 文件并列举了需要被安装额文件。在这个过程中。我花时间去学习基于 Linux 终端的文本编辑器,比如 vi 。这让我熟悉如何在 vi 中编辑、创建文件和快捷方式。
当这些完成后,我在变更日志中更新了包的版本并记录了我所做的改变。
```
$ dpkg -l | grep cardbook
ii cardbook 1.1.0 amd64 Thunderbird add-on for address book
```
![Changelog][13]
更新完包的变更日志
在重建完成后,重要的依赖和描述可以被加入到包中。 Debian 控制文件可以用来添加额外的必须项目和依赖。
### 本地 Debian 仓库
在不创建本地存储库的情况下CardBook 可以使用如下的命令来安装:
```
$ sudo dpkg -i cardbook_1.1.0.deb
```
为了实际测试包的安装,我决定构建一个本地 Debian 存储库。没有它“apt-get” 命令将无法定位包,因为它没有在 Debian 的包软件列表中。
为了配置本地 Debian 存储库,我复制我的包 (.deb) 到放在 `/tmp` 目录中的 `Packages.gz` 文件。
![Packages-gz][14]
本地 Debian 仓库
为了使它工作,我了解了 apt 的配置和它查找文件的路径。
我研究了一种在 apt-config 中添加文件位置的方法。最后,我通过在 APT 中添加 `*.list` 文件来添加包的路径和使用 `apt-cache` 更新APT缓存来完成我的任务。
Hence, the latest CardBook version could be successfully installed by `apt-get install cardbook`
因此,最新的 CardBook 版本可以成功的通过 `apt-get install cardbook` 来安装了。
![Package installation!][15]
使用 apt-get 安装 CardBook
### 修复打包错误和 Bugs
我的导师 Daniel 在这个过程中帮了我很多忙,并指导我如何进一步进行打包。他告诉我使用 [Lintian][16] 来修复打包过程中出现的常见错误和最终使用 [dput][17] 来上传 CardBook 包。
> Lintian 是一个用于发现策略问题和 Bugs 的包检查器。它是 Debian 维护者们在上传包之前广泛使用的自动化检查 Debian 策略的工具。
我上传了第二个版本的到Debian 目录中的 [Salsa 仓库][18] 的一个分离分支中。
我从 Debian backports 上安装 Lintian 并学习在一个包上用它来修复错误。我研究了它在缩写上的使用错误和如何查看 Lintian 命令返回详细的内容。
```
$ lintian -i -I --show-overrides cardbook_1.2.0.changes
```
最初,在 `.changes` 文件上运行命令时,我惊讶地看到大量错误、警告和注释被显示出来!
![Package Error Brief!][19]
在包上运行 Lintian 时看到的大量报错
![Lintian error1!][20]
详细的 Lintian 报错
详细的 Lintian 报错 (2) 以及更多
我花了几天时间修复于 Debian 包策略相关的一些错误。我为了消除一个简单的错误,必须仔细研究每一项策略和 Debian 的规则。为此,我参考了 [Debian 策略手册][21] 以及 [Debian 开发者参考][22]。
我仍然在努力使它变得完美无暇,并希望很快可以将它上传到 mentors.debian.net
如果 Debian 社区中使用 Thunderbird 的人可以帮助修复这些报错就太感谢了。
--------------------------------------------------------------------------------
via: http://minkush.me/cardbook-debian-package/
作者:[Minkush Jain][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[Bestony](https://github.com/bestony)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://minkush.me/cardbook-debian-package/#
[1]:https://addons.mozilla.org/en-US/thunderbird/addon/lightning/
[2]:https://addons.mozilla.org/nn-NO/thunderbird/addon/cardbook/?src=hp-dl-featured
[3]:https://danielpocock.com/
[4]:https://mentors.debian.net/
[5]:https://wiki.debian.org/DFSGLicenses
[6]:https://wiki.debian.org/Packaging/Intro
[7]:https://wiki.debian.org/BuildingAPackage
[8]:https://packages.debian.org/stretch/amd64/lightning/filelist
[9]:https://salsa.debian.org/minkush-guest/CardBook/tree/debian-package/Debian
[10]:/img/posts/13.png
[11]:https://packages.debian.org/stretch/dpkg
[12]:https://gitlab.com/CardBook/CardBook
[13]:/img/posts/15.png
[14]:/img/posts/14.png
[15]:/img/posts/11.png
[16]:https://packages.debian.org/stretch/lintian
[17]:https://packages.debian.org/stretch/dput
[18]:https://salsa.debian.org/minkush-guest/CardBook/tree/debian-package
[19]:/img/posts/16.png (Running Lintian on package)
[20]:/img/posts/10.png
[21]:https://www.debian.org/doc/debian-policy/
[22]:https://www.debian.org/doc/manuals/developers-reference/

View File

@ -0,0 +1,200 @@
系统管理员的一个网络管理指南
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openwires_fromRHT_520_0612LL.png?itok=PqZi55Ab)
如果你是一位系统管理员,那么你的日常工作应该包括管理服务器和数据中心的网络。以下的 Linux 实用工具和命令 —— 从基础的到高级的 —— 将帮你更轻松地管理你的网络。
在几个命令中,你将会看到 `<fqdn>`,它是“完全合格域名”的全称。当你看到它时,你应该用你的网站 URL 或你的服务器来代替它(比如,`server-name.company.com`),具体要视情况而定。
### Ping
正如它的名字所表示的那样,`ping` 是用于去检查从你的系统到你想去连接的系统之间端到端的连通性。当一个 ping 成功时,它使用的 [ICMP][1] 的 echo 包将会返回到你的系统中。它是检查系统/网络连通性的一个良好开端。你可以在 IPv4 和 IPv6 地址上使用 `ping` 命令。(阅读我的文章 "[如何在 Linux 系统上找到你的 IP 地址][2]" 去学习更多关于 IP 地址的知识)
**语法:**
* IPv4: `ping <ip address>/<fqdn>`
* IPv6: `ping6 <ip address>/<fqdn>`
你也可以使用 `ping` 去解析出网站所对应的 IP 地址,如下图所示:
![](https://opensource.com/sites/default/files/uploads/ping-screen-0.png)
### Traceroute
`ping` 是用于检查端到端的连通性,`traceroute` 实用工具将告诉你到达对端系统、网站、或服务器所经过的路径上所有路由器的 IP 地址。`traceroute` 在网络连接调试中经常用于在 `ping` 之后的第二步。
这是一个跟踪从你的系统到其它对端的全部网络路径的非常好的工具。在检查端到端的连通性时,这个实用工具将告诉你到达对端系统、网站、或服务器上所经历的路径上的全部路由器的 IP 地址。通常用于网络连通性调试的第二步。
**语法:**
* `traceroute <ip address>/<fqdn>`
### Telnet
**语法:**
* `telnet <ip address>/<fqdn>` 是用于 [telnet][3] 进入任何支持该协议的服务器。
### Netstat
这个网络统计(`netstat`)实用工具是用于去分析解决网络连接问题和检查接口/端口统计数据、路由表、协议状态等等的。它是任何管理员都应该必须掌握的工具。
**语法:**
* `netstat -l` 显示所有处于监听状态的端口列表。
* `netstat -a` 显示所有端口;如果去指定仅显示 TCP 端口,使用 `-at`(指定信显示 UDP 端口,使用 `-au`)。
* `netstat -r` 显示路由表。
![](https://opensource.com/sites/default/files/uploads/netstat-r.png)
* `netstat -s` 显示每个协议的状态总结。
![](https://opensource.com/sites/default/files/uploads/netstat-s.png)
* `netstat -i` 显示每个接口传输/接收TX/RX包的统计数据。
![](https://opensource.com/sites/default/files/uploads/netstat-i.png)
### Nmcli
`nmcli` 是一个管理网络连接、配置等工作的非常好的实用工具。它能够去管理网络管理程序和修改任何设备的网络配置详情。
**语法:**
* `nmcli device` 列出网络上的所有设备。
* `nmcli device show <interface>` 显示指定接口的网络相关的详细情况。
* `nmcli connection` 检查设备的连接情况。
* `nmcli connection down <interface>` 关闭指定接口。
* `nmcli connection up <interface>` 打开指定接口。
* `nmcli con add type vlan con-name <connection-name> dev <interface> id <vlan-number> ipv4 <ip/cidr> gw4 <gateway-ip>` 在特定的接口上使用指定的 VLAN 号添加一个虚拟局域网VLAN接口、IP 地址、和网关。
![](https://opensource.com/sites/default/files/uploads/nmcli.png)
### 路由
检查和配置路由的命令很多。下面是其中一些比较有用的:
**语法:**
* `ip route` 显示各自接口上所有当前的路由配置。
![](https://opensource.com/sites/default/files/uploads/ip-route.png)
* `route add default gw <gateway-ip>` 在路由表中添加一个默认的网关。
* `route add -net <network ip/cidr> gw <gateway ip> <interface>` 在路由表中添加一个新的网络路由。还有许多其它的路由参数,比如,添加一个默认路由,默认网关等等。
* `route del -net <network ip/cidr>` 从路由表中删除一个指定的路由条目。
![](https://opensource.com/sites/default/files/uploads/route-add-del.png)
* `ip neighbor` 显示当前的邻接表和用于去添加、改变、或删除新的邻居。
![](https://opensource.com/sites/default/files/uploads/ip-neighbor.png)
![](https://opensource.com/sites/default/files/uploads/ip-neigh-help.png)
* `arp` (它的全称是 “地址解析协议”)类似于 `ip neighbor`。`arp` 映射一个系统的 IP 地址到它相应的 MAC介质访问控制地址。
![](https://opensource.com/sites/default/files/uploads/arp.png)
### Tcpdump 和 Wireshark
Linux 提供了许多包捕获工具,比如 `tcpdump`、`wireshark`、`tshark` 等等。它们被用于去捕获传输/接收的网络流量中的数据包,因此它们对于系统管理员去诊断丢包或相关问题时非常有用。对于热衷于命令行操作的人来说,`tcpdump` 是一个非常好的工具,而对于喜欢 GUI 操作的用户来说,`wireshark` 是捕获和分析数据包的不二选择。`tcpdump` 是一个 Linux 内置的用于去捕获网络流量的实用工具。它能够用于去捕获/显示特定端口、协议等上的流量。
**语法:**
* `tcpdump -i <interface-name>` 显示指定接口上实时通过的数据包。通过在命令中添加一个 `-w` 标志和输出文件的名字,可以将数据包保存到一个文件中。例如:`tcpdump -w <output-file.> -i <interface-name>`。
![](https://opensource.com/sites/default/files/uploads/tcpdump-i.png)
* `tcpdump -i <interface> src <source-ip>` 从指定的源 IP 地址上捕获数据包。
* `tcpdump -i <interface> dst <destination-ip>` 从指定的目标 IP 地址上捕获数据包。
* `tcpdump -i <interface> port <port-number>` 从一个指定的端口号比如53、80、8080 等等)上捕获数据包。
* `tcpdump -i <interface> <protocol>` 捕获指定协议的数据包比如TCP、UDP、等等。
### Iptables
`iptables` 是一个包过滤防火墙工具,它能够允许或阻止某些流量。这个实用工具的应用范围非常广泛;下面是它的其中一些最常用的使用命令。
**语法:**
* `iptables -L` 列出所有已存在的 `iptables` 规则。
* `iptables -F` 删除所有已存在的规则。
下列命令允许流量从指定端口到指定接口:
* `iptables -A INPUT -i <interface> -p tcp dport <port-number> -m state state NEW,ESTABLISHED -j ACCEPT`
* `iptables -A OUTPUT -o <interface> -p tcp -sport <port-number> -m state state ESTABLISHED -j ACCEPT`
下列命令允许<ruby>环回<rt>loopback</rt></ruby>接口访问系统:
* `iptables -A INPUT -i lo -j ACCEPT`
* `iptables -A OUTPUT -o lo -j ACCEPT`
### Nslookup
`nslookup` 工具是用于去获得一个网站或域名所映射的 IP 地址。它也能用于去获得你的 DNS 服务器的信息,比如,一个网站的所有 DNS 记录(具体看下面的示例)。与 `nslookup` 类似的一个工具是 `dig`Domain Information Groper实用工具。
**语法:**
* `nslookup <website-name.com>` 显示你的服务器组中 DNS 服务器的 IP 地址,它后面就是你想去访问网站的 IP 地址。
* `nslookup -type=any <website-name.com>` 显示指定网站/域中所有可用记录。
### 网络/接口调试
下面是用于接口连通性或相关网络问题调试所需的命令和文件的汇总。
**语法:**
* `ss` 是一个转储套接字统计数据的实用工具。
* `nmap <ip-address>`,它的全称是 “Network Mapper”它用于扫描网络端口、发现主机、检测 MAC 地址,等等。
* `ip addr/ifconfig -a` 提供一个系统上所有接口的 IP 地址和相关信息。
* `ssh -vvv user@<ip/domain>` 允许你使用指定的 IP/域名和用户名通过 SSH 协议登入到其它服务器。`-vvv` 标志提供 SSH 登入到服务器过程中的 "最详细的" 信息。
* `ethtool -S <interface>` 检查指定接口上的统计数据。
* `ifup <interface>` 启动指定的接口。
* `ifdown <interface>` 关闭指定的接口
* `systemctl restart network` 重启动系统上的一个网络服务。
* `/etc/sysconfig/network-scripts/<interface-name>` 是一个对指定的接口设置 IP 地址、网络、网关等等的接口配置文件。DHCP 模式也可以在这里设置。
* `/etc/hosts` 这个文件包含自定义的主机/域名到 IP 地址的映射。
* `/etc/resolv.conf` 指定系统上的 DNS 服务器的 IP 地址。
* `/etc/ntp.conf` 指定 NTP 服务器域名。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/sysadmin-guide-networking-commands
作者:[Archit Modi][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/architmodi
[1]:https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol
[2]:https://opensource.com/article/18/5/how-find-ip-address-linux
[3]:https://en.wikipedia.org/wiki/Telnet