Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-06-23 11:38:54 +08:00
commit aea11f487d
11 changed files with 1150 additions and 291 deletions

View File

@ -1,6 +1,6 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: reviewer: (Yufei-Yan)
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How IoT will rescue aviation)

View File

@ -1,157 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (Yufei-Yan)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What is IoT? The internet of things explained)
[#]: via: (https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html)
[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/)
What is IoT? The internet of things explained
======
The internet of things (IoT) is a network of connected smart devices providing rich data, but it can also be a security nightmare.
Thinkstock
The internet of things (IoT) is a catch-all term for the growing number of electronics that aren't traditional computing devices, but are connected to the internet to send data, receive instructions or both.
There's an incredibly broad range of things that fall under that umbrella: Internet-connected "smart" versions of traditional appliances like refrigerators and light bulbs; gadgets that could only exist in an internet-enabled world like Alexa-style digital assistants; internet-enabled sensors that are transforming factories, healthcare, transportation, distribution centers and farms.
### What is the internet of things?
The IoT brings the power of the internet, data processing and analytics to the real world of physical objects. For consumers, this means interacting with the global information network without the intermediary of a keyboard and screen; many of their everyday objects and appliances can take instructions from that network with minimal human intervention.
**[ [More IoT coverage of Network World][1] ]**
In enterprise settings, IoT can bring the same efficiencies to physical manufacturing and distribution that the internet has long delivered for knowledge work. Millions if not billions of embedded internet-enabled sensors worldwide are providing an incredibly rich set of data that companies can use to gather data about their safety of their operations, track assets and reduce manual processes. Researchers can also use the IoT to gather data about people's preferences and behavior, though that can have serious implications for privacy and security.
### How big is it?
In a word: enormous. [Priceonomics breaks it down][2]: There are more than 50 billion IoT devices as of 2020, and those devices will generate 4.4 zettabytes of data this year. (A zettabyte is a trillion gigabytes.) By comparison, in 2013 IoT devices generated a mere 100 billion gigabytes. The amount of money to be made in the IoT market is similarly staggering; estimates on the value of the market in 2025 range from $1.6 trillion to $14.4 trillion.
### History of IoT
A world of omnipresent connected devices and sensors is one of the oldest tropes of science fiction. IoT lore has dubbed a [vending machine at Carnegie Mellon][3] that was connected to APRANET in 1970 as the first Internet of Things device, and many technologies have been touted as enabling "smart" IoT-style characteristics to give them a futuristic sheen. But the term Internet of Things was coined in 1999 by British technologist [ Kevin Ashton][4].
At first, the technology lagged behind the vision. Every internet-connected thing needed a processor and a means to communicate with other things, preferably wirelessly, and those factors imposed costs and power requirements that made widespread IoT rollouts impractical, at least until Moore's Law caught up in the mid '00s.
One important milestone was [widespread adoption of RFID tags][5], cheap minimalist transponders that could be stuck on any object to connect it to the larger internet world. Omnipresent Wi-Fi and 4G made it possible to for designers to simply assume wireless connectivity anywhere. And the rollout of IPv6 means that connecting billions of gadgets to the internet won't exhaust the store of IP addresses, which was a real concern. (Related story: [Can IoT networking drive adoption of IPv6?][6])
### How does the IoT work?
The basic elements of the IoT are devices that gather data. Broadly speaking, they are internet-connected devices, so they each have an IP address. They range in complexity from autonomous vehicles that haul products around factory floors to simple sensors that monitor the temperature in buildings. They also include personal devices like fitness trackers that monitor the number of steps individuals take each day. To make that data useful it needs to be collected, processed, filtered and analyzed, each of which can be handled in a variety of ways.
Collecting the data is done by transmitting it from the devices to a gathering point. Moving the data can be done wirelessly using a range of technologies or on wired networks. The data can be sent over the internet to a data center or a cloud that has storage and compute power or the transfer can be staged, with intermediary devices aggregating the data before sending it along.
Processing the data can take place in data centers or cloud, but sometimes thats not an option. In the case of critical devices such as shutoffs in industrial settings, the delay of sending data from the device to a remote data center is too great. The round-trip time for sending data, processing it, analyzing it and returning instructions (close that valve before the pipes burst) can take too long. In such cases edge-computing can come into play, where a smart edge device can aggregate data, analyze it and fashion responses if necessary, all within relatively close physical distance, thereby reducing delay. Edge devices also have upstream connectivity for sending data to be further processed and stored.
[][7] Network World / IDG
How the internet of things works. 
### **Examples of IoT devices**
Essentially, anything that's capable of gathering some information about the physical world and sending it back home can participate in the IoT ecosystem. Smart home appliances, RFID tags, and industrial sensors are a few examples. These sensors can monitor a range of factors including temperature and pressure in industrial systems, status of critical parts in machinery, patient vital signs, and use of water and electricity, among many, many other possibilities.
Entire factory robots can be considered IoT devices, as can autonomous vehicles that move products around industrial settings and warehouses.
Other examples include fitness wearables and home security systems. There are also more generic devices, like the [Raspberry Pi][8] or [Arduino][9], that let you build your own IoT end points. Even though you might think of your smartphone as a pocket-sized computer, it may well also be beaming data about your location and behavior to back-end services in very IoT-like ways.
#### **Device management**
In order to work together, all those devices need to be authenticated, provisioned, configured, and monitored, as well as patched and updated as necessary. Too often, all this happens within the context of a single vendor's proprietary systems or, it doesn't happen at all, which is even more risky. But the industry is starting to transition to a [standards-based device management model][10], which allows IoT devices to interoperate and will ensure that devices aren't orphaned.
#### **IoT communication standards and protocols**
When IoT gadgets talk to other devices, they can use a wide variety of communications standards and protocols, many tailored to devices with limited processing capabilities or not much electrical power. Some of these you've definitely heard of — some devices use Wi-Fi or Bluetooth, for instance — but many more are specialized for the world of IoT. ZigBee, for instance, is a wireless protocol for low-power, short-distance communication, while message queuing telemetry transport (MQTT) is a publish/subscribe messaging protocol for devices connected by unreliable or delay-prone networks. (See Network Worlds glossary of [IoT standards and protocols][11].)
The increased speeds and bandwidth of the coming 5G standard for cellular networks will also benefit IoT, though that usage will [lag behind ordinary cell phones][12].
### IoT, edge computing and the cloud
[][13] Network World / IDG
How edge computing enables IoT.
For many IoT systems, there's a lot of data coming in fast and furious, which has given rise to a new technology category, [edge computing][14]_,_ consisting of appliances placed relatively close to IoT devices, fielding the flow of data from them. These machines process that data and send only relevant material back to a more centralized system for analysis. For instance, imagine a network of dozens of IoT security cameras. Instead of bombarding the building's security operations center (SoC) with simultaneous live-streams, edge-computing systems can analyze the incoming video and only alert the SoC when one of the cameras detects movement.
And where does that data go once its been processed? Well, it might go to your centralized data center, but more often than not it will end up in the cloud.
The elastic nature of cloud computing is great for IoT scenarios where data might come in intermittently or asynchronously. And many of the big cloud heavy hitters — including [Google][15], [Microsoft][16], and [Amazon][17] — have IoT offerings. 
### IoT platforms
The cloud giants are trying to sell more than just a place to stash the data your sensors have collected. They're offering full IoT platforms*,* which bundle together much of the functionality to coordinate the elements that make up IoT systems. In essence, an IoT platform serves as middleware that connects the IoT devices and edge gateways with the applications you use to deal with the IoT data. That said, every platform vendor seems to have a slightly different definition of what an IoT platform is, the better to [distance themselves from the competition][18].
### IoT and data
As mentioned, there are zettabytes of data being collected by all those IoT devices, funneled through edge gateways, and sent to a platform for processing. In many scenarios, this data is the reason IoT has been deployed in the first place. By collecting information from sensors in the real world, organizations can make nimble decisions in real time.
Oracle, for instance, [imagines a scenario][19] where people at a theme park are encouraged to download an app that offers information about the park. At the same time, the app sends GPS pings back to the park's management to help predict wait times in lines. With that information, the park can take action in the short term (by adding more staff to increase the capacity of some attractions, for instance) and the long term (by learning which rides are the most and least popular at the park).
These decisions can be made without human intervention. For example, data gathered from pressure sensors in a chemical-factory pipeline could be analyzed by software in an edge device that spots the threat of a pipeline rupture, and that information can trigger a signal to shut valves to avert a spill. 
### IoT and big data analytics
The theme park example is easy to get your head around, but is small potatoes compared to many real-world IoT data-harvesting operations. Many big data operations use information harvested from IoT devices, correlated with other data points, to get insight into human behavior. _Software Advice_ gives [a few examples][20], including a service from Birst that matches coffee brewing information collected from internet-connected coffeemakers with social media posts to see if customers are talking about coffee brands online.
Another dramatic example came recently when X-Mode released a map based on tracking location data of people who partied at spring break in Ft. Lauderdale in March of 2020, even as the coronavirus pandemic was gaining speed in the United States, showing [where all those people ended up across the country][21]. The map was shocking not only because it showed the potential spread of the virus, but also because it illustrated just how closely IoT devices can track us. (For more on IoT and analytics, click [here][22].
### IoT data and AI
The volume of data IoT devices can gather is far larger than any human can deal with in a useful way, and certainly not in real time. We've already seen that edge computing devices are needed just to make sense of the raw data coming in from the IoT endpoints. There's also the need to detect and deal with data that might [be just plain wrong][23].
Many IoT providers are offering machine learning and artificial intelligence capabilities to make sense of the collected data. IBM's Jeopardy!-winning Watson platform, for instance, can be [trained on IoT data sets][24] to produce useful results in the field of predicative maintenance — analyzing data from drones to distinguish between trivial damage to a bridge and cracks that need attention, for instance. Meanwhile, Arm is working on [low-power chips][25] that can provide AI capabilities on the IoT endpoints themselves.    ** ** 
### IoT and business
Business uses for IoT include keeping track of customers, inventory, and the status of important components. [IoT for All][26] flags four industries that have been transformed by IoT:
* **Oil and gas**: Isolated drilling sites can be better monitored with IoT sensors than by human intervention
* A**griculture**: Granular data about crops growing in fields derived from IoT sensors can be used to increase yields
* **HVAC**: Climate control systems across the country can be monitored by manufacturers
* **Brick-and-mortar retail**: Customers can be microtargeted with offers on their phones as they linger in certain parts of a store
More generally, enterprises are looking for IoT solutions that can help in [four areas][27]: energy use, asset tracking, security, and the customer experience.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html
作者:[Josh Fruhlinger][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Josh-Fruhlinger/
[b]: https://github.com/lujun9972
[1]: https://www.networkworld.com/category/internet-of-things/
[2]: https://priceonomics.com/the-iot-data-explosion-how-big-is-the-iot-data/
[3]: https://www.machinedesign.com/automation-iiot/article/21836968/iot-started-with-a-vending-machine
[4]: https://www.visioncritical.com/blog/kevin-ashton-internet-of-things
[5]: https://www.networkworld.com/article/2319384/rfid-readers-route-tag-traffic.html
[6]: https://www.networkworld.com/article/3338106/can-iot-networking-drive-adoption-of-ipv6.html
[7]: https://images.idgesg.net/images/article/2020/05/nw_how_iot_works_diagram-100840757-orig.jpg
[8]: https://www.networkworld.com/article/3176091/10-killer-raspberry-pi-projects-collection-1.html
[9]: https://www.networkworld.com/article/3075360/arduino-targets-the-internet-of-things-with-primo-board.html
[10]: https://www.networkworld.com/article/3258812/the-future-of-iot-device-management.html
[11]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html
[12]: https://www.networkworld.com/article/3291778/what-s-so-special-about-5g-and-iot.html
[13]: https://images.idgesg.net/images/article/2017/09/nw_how_edge_computing_works_diagram_1400x1717-100736111-orig.jpg
[14]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html
[15]: https://cloud.google.com/solutions/iot
[16]: https://azure.microsoft.com/en-us/overview/iot/
[17]: https://aws.amazon.com/iot/
[18]: https://www.networkworld.com/article/3336166/why-are-iot-platforms-so-darn-confusing.html
[19]: https://blogs.oracle.com/bigdata/how-big-data-powers-the-internet-of-things
[20]: https://www.softwareadvice.com/resources/iot-data-analytics-use-cases/
[21]: https://www.cnn.com/2020/04/04/tech/location-tracking-florida-coronavirus/index.html
[22]: https://www.networkworld.com/article/3311919/iot-analytics-guide-what-to-expect-from-internet-of-things-data.html
[23]: https://www.networkworld.com/article/3396230/when-iot-systems-fail-the-risk-of-having-bad-iot-data.html
[24]: https://www.networkworld.com/article/3449243/watson-iot-chief-ai-can-broaden-iot-services.html
[25]: https://www.networkworld.com/article/3532094/ai-everywhere-iot-chips-coming-from-arm.html
[26]: https://www.iotforall.com/4-unlikely-industries-iot-changing/
[27]: https://www.networkworld.com/article/3396128/the-state-of-enterprise-iot-companies-want-solutions-for-these-4-areas.html

View File

@ -1,132 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Import functions and variables into Bash with the source command)
[#]: via: (https://opensource.com/article/20/6/bash-source-command)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Import functions and variables into Bash with the source command
======
Source is like a Python import or a Java include. Learn it to expand
your Bash prowess.
![bash logo on green background][1]
When you log into a Linux shell, you inherit a specific working environment. An _environment_, in the context of a shell, means that there are certain variables already set for you, which ensures your commands work as intended. For instance, the [PATH][2] environment variable defines where your shell looks for commands. Without it, nearly everything you try to do in Bash would fail with a **command not found** error. Your environment, while mostly invisible to you as you go about your everyday tasks, is vitally important.
There are many ways to affect your shell environment. You can make modifications in configuration files, such as `~/.bashrc` and `~/.profile`, you can run services at startup, and you can create your own custom commands or script your own [Bash functions][3].
### Add to your environment with source
Bash (along with some other shells) has a built-in command called `source`. And here's where it can get confusing: `source` performs the same function as the command `.` (yes, that's but a single dot), and it's _not_ the same `source` as the `Tcl` command (which may come up on your screen if you type `man source`). The built-in `source` command isn't in your `PATH` at all, in fact. It's a command that comes included as a part of Bash, and to get further information about it, you can type `help source`.
The `.` command is [POSIX][4]-compliant. The `source` command is not defined by POSIX but is interchangeable with the `.` command.
According to Bash `help`, the `source` command executes a file in your current shell. The clause "in your current shell" is significant, because it means it doesn't launch a sub-shell; therefore, whatever you execute with `source` happens within and affects your _current_ environment.
Before exploring how `source` can affect your environment, try `source` on a test file to ensure that it executes code as expected. First, create a simple Bash script and save it as a file called `hello.sh`:
```
#!/usr/bin/env bash
echo "hello world"
```
Using `source`, you can run this script even without setting the executable bit:
```
$ source hello.sh
hello world
```
You can also use the built-in`.` command for the same results:
```
$ . hello.sh
hello world
```
The `source` and `.` commands successfully execute the contents of the test file.
### Set variables and import functions
You can use `source` to "import" a file into your shell environment, just as you might use the `include` keyword in C or C++ to reference a library or the `import` keyword in Python to bring in a module. This is one of the most common uses for `source`, and it's a common default inclusion in `.bashrc` files to `source` a file called `.bash_aliases` so that any custom aliases you define get imported into your environment when you log in.
Here's an example of importing a Bash function. First, create a function in a file called `myfunctions`. This prints your public IP address and your local IP address:
```
function myip() {
        curl <http://icanhazip.com>      
        ip addr | grep inet$IP | \
        cut -d"/" -f 1 | \
        grep -v 127\\.0 | \
        grep -v \:\:1 | \
        awk '{$1=$1};1'
}
```
Import the function into your shell:
```
`$ source myfunctions`
```
Test your new function:
```
$ myip
93.184.216.34
inet 192.168.0.23
inet6 fbd4:e85f:49c:2121:ce12:ef79:0e77:59d1
inet 10.8.42.38
```
### Search for source
When you use `source` in Bash, it searches your current directory for the file you reference. This doesn't happen in all shells, so check your documentation if you're not using Bash.
If Bash can't find the file to execute, it searches your `PATH` instead. Again, this isn't the default for all shells, so check your documentation if you're not using Bash.
These are both nice convenience features in Bash. This behavior is surprisingly powerful because it allows you to store common functions in a centralized location on your drive and then treat your environment like an integrated development environment (IDE). You don't have to worry about where your functions are stored, because you know they're in your local equivalent of `/usr/include`, so no matter where you are when you source them, Bash finds them.
For instance, you could create a directory called `~/.local/include` as a storage area for common functions and then put this block of code into your `.bashrc` file:
```
for i in $HOME/.local/include/*;
  do source $i
done
```
This "imports" any file containing custom functions in `~/.local/include` into your shell environment.
Bash is the only shell that searches both the current directory and your `PATH` when you use either the `source` or the `.` command.
### Using source for open source
Using `source` or `.` to execute files can be a convenient way to affect your environment while keeping your alterations modular. The next time you're thinking of copying and pasting big blocks of code into your `.bashrc` file, consider placing related functions or groups of aliases into dedicated files, and then use `source` to ingest them.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/bash-source-command
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者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
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
[2]: https://opensource.com/article/17/6/set-path-linux
[3]: https://opensource.com/article/20/6/how-write-functions-bash
[4]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains

View File

@ -0,0 +1,139 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 open source alternatives to VS Code)
[#]: via: (https://opensource.com/article/20/6/open-source-alternatives-vs-code)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
7 open source alternatives to VS Code
======
Avoid Microsoft's proprietary VS Code build and opt for an open source
code editor instead.
![Person using a laptop][1]
Visual Studio Code, also known as VS Code, is a code editor for Linux, Windows, and macOS. It's the kind of editor that walks the line between editing text and managing your entire codebase, like an integrated development environment (IDE). It's extensible through plugins and has proven to be a reliable text editor that's easily beaten out formidable non-open rival editors.
Microsoft released VS Code as open source, but the version you download from Microsoft is not open source. However, you have several options for using VS Code as open source or selecting one of its open source alternatives.
### Building VS Code as open source
VS Code's source code is available [on GitHub][2]. Yet when you download the VS Code application [from Microsoft][3], you'll find that your download is licensed under the [Microsoft Software License][4]. This isn't an open source license. The difference is in the build process.
Chris Dias, a Microsoft developer on the VS Code project, [makes a comparison][5] between VS Code and, for instance, the Chrome browser and its open source "upstream" project, [Chromium][6]. VS Code is indeed built upon an open source codebase. The official Microsoft-branded release is customized with Microsoft-specific functionality, including a trademark, an extensions gallery, a proprietary C# debugger, and telemetry. But when you clone and build the code yourself, none of these targets is configured, so you generate a "clean" version, which is called Code - OSS (OSS stands for open source software).
In practice, the differences between VS Code and Code - OSS are minimal. Most notably, VS Code includes telemetry, which is tracking software. It's unlikely that Microsoft is literally tracking your every move, and there's lots of software out there these days that gathers usage data. Whether or not you care about VS Code's telemetry is up to you. If you'd rather do without the usage tracking, here are some great (and open source) alternatives to VS Code.
### VSCodium
![Code OSS screenshot][7]
(Seth Kenlon, [CC BY-SA 4.0][8])
The easiest alternative to VS Code is VS Code itself, built without Microsoft's proprietary additions. The [VSCodium][9] project provides downloadable executables of Code - OSS, built from the VS Code codebase without Microsoft's `product.json` changes. The VSCodium developers also go to great length to deactivate all hard-to-find telemetry options, delivering the cleanest build of VS Code's source you can find without building it yourself.
VSCodium cautions that VS Code quietly includes some proprietary tools that cannot be shipped with an open source build. This includes a C# debugger and some gallery extensions. If you need them, there are [documented workarounds][10] for these issues, but if you rely on something very specific in VS Code, you should verify that it functions in VSCodium.
You should also verify that all [telemetry is deactivated][11].
### Code - OSS
If you don't want to use VSCodium's build, you can [compile VS Code from source][12] yourself and end up with the same thing. The executable is called `Code - OSS` rather than `VSCode`, and the license restrictions that apply to VSCodium also apply to your build, but so do the workarounds.
If you build the application from source, you should verify that all [telemetry is deactivated][11] when you first launch it.
### Atom
![Atom screenshot][13]
(Seth Kenlon, [CC BY-SA 4.0][8])
[Atom][14] is an open source IDE-like text editor that Microsoft acquired when it purchased GitHub. Like VS Code, you can extend the Atom editor with plugins and customize it with themes and your unique combination of tools. It is also cross-platform and has built-in GitHub integration. In short, Atom is potentially whatever you need it to be, so long as the extensions you need already exist or you're willing to write them.
Also like VS Code, Atom includes [metrics tracking by default][15]. This can be disabled, and unlike VS Code, there are no arbitrary restrictions on extensions, so you don't have to change up your workflow in exchange for your privacy. Atom is certainly a useful tool for coders, but it's also a pretty great editor for [anyone who uses a computer][16]. If you're looking for a good general-purpose text editor, give Atom a try.
### GNOME Builder
![GNOME Builder screenshot][17]
(Seth Kenlon, [CC BY-SA 4.0][8])
Developed as an IDE for the GNOME desktop, [GNOME Builder][18] is a code editor for Linux, specifically for building GNOME applications. If you're building applications for Linux and want an easy avenue to compatibility, Builder is the easy choice. Install Builder from [Flathub.org][19]; when you start a project, it'll even prompt you to install the GNOME SDK if you're missing it. This means you don't have to consciously track GNOME as you maintain your application because Builder does it for you.
However, you can use Builder for much more than just GNOME applications. It supports dozens of programming languages, including Python, Rust, C and C++, Java, Go, JavaScript, TypeScript, VB.NET, several markup and Markdown languages, and more. Some of these have full support with autocompletion and pop-up function definitions, while others only have simple conveniences such as syntax highlighting and auto-bracket matching. The IDE is a pleasure to work with, though, whether you consider yourself a serious programmer or you're just in need of a good HTML and CSS editor.
### Geany
![Geany screenshot][20]
(Seth Kenlon, [CC BY-SA 4.0][8])
[Geany][21] is a powerful, stable, and lightweight editor with useful features to help you write good Bash, Python, Lua, XML, HTML, LaTeX, and more. There's plenty of support for 50 different programming and scripting languages, markup languages, and miscellaneous filetypes (such as .diff and .po). At the very least, Geany almost certainly provides bracket matching and syntax highlighting—and it usually offers quite a lot more.
Geany is a modest little editor, but through plugins, you can add features such as a panel for a project view, filesystem tree, debugging, a terminal, and so on until it looks and acts like an IDE. Or, if you prefer, you can keep it simple and understated. If you can't run VS Code on a computer due to limitations in CPU or RAM, Geany is the obvious alternative. It's quick to launch, and its memory footprint is negligible. While Geany is a little heftier than running Vim in a terminal, it's fast and snappy even on a Raspberry Pi.
### Brackets
![Brackets screenshot][22]
(Seth Kenlon, [CC BY-SA 4.0][8])
[Brackets][23] is a text editor and IDE aimed at web developers. It has strong support for HTML, CSS, JavaScript, PHP, and even Python. However, like VS Code, it has a rich ecosystem of extensions, so you can expand it to serve as your workbench for whatever language you work in the most.
There are extensions to help parse languages, to run scripts, and even to compile and execute code. Brackets has a traditional interface anyone can understand, whether or not you're familiar with an IDE or even a text editor beyond a simple notepad. If you spend a little time adding relevant extensions and getting to know them, you'll find Brackets a useful and subtle editor that helps you, through autocompletion and linting, avoid silly mistakes in whatever you're typing. And if you're writing code, it'll probably make your testing and debugging workflow faster.
### Che
![Che screenshot][24]
(Seth Kenlon, [CC BY-SA 4.0][8])
If you enjoy living on the cutting edge, [Che][25] is an editor you need to try. It's a cloud-based IDE, so it runs by default as a Software as a Service (SaaS), but it's entirely open source, so it can be run as _your own_ SaaS, provided you have a Kubernetes instance.
More than just being an online IDE, though, Che is an IDE built for cloud development. It makes no assumptions that you expect or want a view of your local filesystem. It lives and works in the cloud, so you can too. In fact, if you have a Git server, you can treat it as your filesystem and work on a project directly from its repository. Of course, you can also download any work you do, if you like to have a local backup copy.
But its main feature, and the one cloud developers are excited about, is that Che is a full-featured, Kubernetes-aware, open source IDE. If you're building apps, sites, or containers (or a combination of the three) for the cloud, then Che is an editor you need to try.
### What's your choice?
Are you using one of these alternatives to VS Code? Is there one you would like to try? Please share your feedback in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/open-source-alternatives-vs-code
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者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
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
[2]: https://github.com/microsoft/vscode
[3]: https://code.visualstudio.com/
[4]: https://code.visualstudio.com/license
[5]: https://github.com/Microsoft/vscode/issues/60#issuecomment-161792005
[6]: https://www.chromium.org/
[7]: https://opensource.com/sites/default/files/uploads/code-oss.png (Code OSS screenshot)
[8]: https://creativecommons.org/licenses/by-sa/4.0/
[9]: https://vscodium.com/
[10]: https://github.com/VSCodium/vscodium/blob/master/DOCS.md
[11]: https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting
[12]: https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run
[13]: https://opensource.com/sites/default/files/uploads/atom.jpg (Atom screenshot)
[14]: http://atom.io
[15]: https://discuss.atom.io/t/how-do-i-disable-the-metrics-or-tracking/24520
[16]: https://opensource.com/article/19/4/write-git
[17]: https://opensource.com/sites/default/files/uploads/builder.png (GNOME Builder screenshot)
[18]: https://wiki.gnome.org/Apps/Builder
[19]: https://flathub.org/apps/details/org.gnome.Builder
[20]: https://opensource.com/sites/default/files/uploads/geany.png (Geany screenshot)
[21]: https://www.geany.org/
[22]: https://opensource.com/sites/default/files/uploads/brackets.jpg (Brackets screenshot)
[23]: http://brackets.io/
[24]: https://opensource.com/sites/default/files/uploads/che-cpp.jpg (Che screenshot)
[25]: https://www.eclipse.org/che/extend/

View File

@ -0,0 +1,125 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Linux tools for improving your time management)
[#]: via: (https://opensource.com/article/20/6/linux-time-management)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
Linux tools for improving your time management
======
Whether you need help to stay focused, maintain timeliness, or find
shortcuts to avoid repetition, these Linux tools have you covered.
![Business woman on laptop sitting in front of window][1]
Productivity is a subjective term, but essentially, it's a measurement of how efficiently a particular task is completed. Everyone has different things that keep them productive—some people need help staying on task, some people need a particular kind of work environment, some people need alerts and reminders to avoid missed deadlines, and some need assistance with repetitive, manual chores. Luckily, there are myriad tools and technologies available to provide you the specific support you need. In particular, if you are a Linux user, there are some tweaks that can help you increase your productivity; here are two that I use on a regular basis.
### Clipboard Indicator
Are you someone who uses a lot of copy and paste functions between several documents in your day to day usage? If so, then [Clipboard Indicator][2] should become one of your go-to solutions. Install Clipboard Indicator as a GNOME extension to your Linux distribution. In my experience, it has a minimum performance impact on GNOME Shell—at least, less than other solutions I have tried.
This tool adds an indicator menu to the top panel and caches your clipboard history. You can set the history size, preview the number of characters you want to view. It shows notifications on copy and acts as a temporary space to store whatever you copy.
![Clipboard indicator menu on GNOME desktop][3]
The easiest way to install the extension and connector is to use your distro's package manager.
For Fedora, CentOs, or RHEL, use:
```
`$ sudo dnf install chrome-gnome-shell`
```
On Ubuntu or Debian, use `apt install` instead.
Once it's installed, go to <https://extensions.gnome.org/> and check your installed extensions.
If you use Firefox, use the Firefox browser add-on and install the `GNOME Shell integration`**.** You will see a small footprint icon in your Firefox toolbar, which will take you to the Extensions page. On that page, search for the Clipboard Indicator extension and toggle to enable it.
Now, follow the prompts to download the GNOME extension and activate it. You can check your `~/.local/share/gnome-shell/extensions` location to view the extension.
Voila! You'll see a new icon in the top-right corner of your GNOME desktop. Copy anything and experiment with its settings.
A quick installation via Git can also be performed by cloning the repo into your local `gnome-shell extensions` directory using the command:
```
`$ git clone https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator.git ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com`
```
Go to the GNOME Tweak tool and activate it from the Extensions screen.
### Pomodoro
![Using the pomodoro timer on GNOME][4]
The Pomodoro Technique is a time management philosophy that aims to provide the user with maximum focus. Each 25-minute work period is called a "pomodoro," (Italian for tomato); after each pomodoro, you take a five-minute break. Every four pomodoros, or 100 minutes, you then take a 15 to 20-minute break. If you have a large and varied to-do list, using the Pomodoro Technique can help you crank through projects faster by forcing you to adhere to strict timing.
The installation procedure can be managed through the GNOME Tweaks webpage (extensions.gnome.org) or through the command line. For the latter, choose your distribution of Linux along with the release version and install using the following command:
```
`$ sudo dnf install gnome-shell-extension-pomodoro`
```
or if you wish to build from source:
```
$ git clone -b gnome-3.34 <https://github.com/codito/gnome-pomodoro.git>
$ cd gnome-pomodoro
```
The source code has a number of dependencies, many of which are likely already installed. To make sure of it, install of the following.
```
`$ sudo dnf install autoconf-archive gettext vala vala-tools pkg-config desktop-file-utils glib2-devel gtk3-devel libappstream-glib-devel libappindicator-gtk3-devel libcanberra-devel libpeas-devel sqlite-devel gom-devel gobject-introspection-devel gsettings-desktop-schemas-devel gstreamer1-devel`
```
Inside unpacked directory of the source code, complete the build.
```
$ ./autogen.sh --prefix=/usr --datadir=/usr/share 
$ make 
$ sudo make install 
```
No matter how we install, go to GNOME Tweaks and turn on the pomodoro timer. If you don't already have GNOME Tweaks, installing it through your package manager or in your software installer of choice. For example, on Fedora:
```
`$ sudo dnf install gnome-tweaks`
```
On Ubuntu or Debian, use `apt install` instead.
Pomodoro desktop integration is currently available for GNOME Shell, and they plan to support more desktops in the future. Check out <https://gnomepomodoro.org/> for the latest on the project. For KDE users in the meantime, there is an alternative called [Fokus][5].
### Productivity on Linux
Productivity is personal, but it's something we all are after in one way or another. Each of these tools has either saved me time or made my working time more productive, and they're a quick integration with Linux.
Do you have a favorite productivity tool? Share it in the comments!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/linux-time-management
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[译者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/sudeshna-sur
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
[2]: https://extensions.gnome.org/extension/779/clipboard-indicator/
[3]: https://opensource.com/sites/default/files/uploads/gnome-tweaks-productivity_0.png (Clipboard indicator menu on GNOME desktop)
[4]: https://opensource.com/sites/default/files/uploads/pomodoro-timer-fedora-opensourcecom.png (Using the pomodoro timer on GNOME)
[5]: https://store.kde.org/p/1308861/

View File

@ -0,0 +1,122 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Manage your Kubernetes cluster with Lens)
[#]: via: (https://opensource.com/article/20/6/kubernetes-lens)
[#]: author: (Chris Collins https://opensource.com/users/clcollins)
Manage your Kubernetes cluster with Lens
======
Lens is a useful, attractive, open source user interface for working
with Kubernetes clusters.
![Ship captain sailing the Kubernetes seas][1]
As more workloads are migrated to containerized environments, it becomes challenging to manage those larger numbers of containers and the connections between them and other systems. As the scale and complexity of a containerized environment increase past a human's ability to manage, container orchestration platforms such as [Kubernetes][2] become increasingly important. Such platforms, however, come with their own management challenges that require metrics, observability, and a user-friendly interface to present their huge amount of complexity.
### Enter Lens
[Lens][3], which bills itself as "the Kubernetes IDE," is a useful, attractive, open source user interface (UI) for working with Kubernetes clusters. Out of the box, Lens can connect to Kubernetes clusters using your kubeconfig file and will display information about the cluster and the objects it contains. Lens can also connect to—or install—a Prometheus stack and use it to provide metrics about the cluster, including node information and health.
![Lens UI displaying an overview of workloads on the cluster][4]
An overview of workloads on the cluster. (Chris Collins, [CC BY-SA 4.0][5])
Like Kubernetes' dashboard and OpenShift, Lens provides live updates on the state of objects in the cluster and metrics collected by [Prometheus][6].
### Get started
Installing Lens is straightforward. [AppImage][7] packages are available for Linux, and there are binaries available for macOS and Windows clients. This tutorial explains how to download and use the Lens AppImage to install and use Lens on Linux.
According to [AppImage's FAQ][8], an AppImage is "a downloadable file for Linux that contains an application and everything the application needs to run." An application packaged as an AppImage is just that—a single executable file that can be downloaded and run.
The AppImage for Lens can be downloaded from the [Lens Releases][9] page on GitHub. After you download it, mark the file executable with `chmod`, and then either execute it directly or copy it to a place in your `$PATH`:
```
# Download the 3.4.0 AppImage for Lens, mark it executable and copy it to your $PATH
# (output omitted for brevity)
$ wget <https://github.com/lensapp/lens/releases/download/v3.4.0/Lens-3.4.0.AppImage>
$ chmod +x Lens-3.4.0.AppImage
$ sudo mv Lens-3.4.0.AppImage /usr/sbin/lens
```
Then you can start Lens by typing `lens` on the command line.
### Connect Lens to a Kubernetes cluster
Once you launch Lens, connect it to a Kubernetes cluster by clicking the **+** icon in the top-left corner and selecting a kubeconfig. Next, a drop-down box will appear containing any Kubernetes contexts from your `~/.kube/config` file, or you can select a custom one. Because cluster and authentication information about the cluster for any context is included in the kubeconfig file, Lens treats each context as a different cluster, unfortunately.
This is particularly unhelpful compared with how OpenShift creates context information in the kubeconfig file automatically for any project (namespace) you switch to. As a site-reliability engineer (SRE) working on hundreds of clusters, I had dozens and dozens of "clusters" to choose from when setting up Lens. In practice, I found it best to select the `default` context for any cluster. You can manage all namespaces and workloads once Lens has connected, and there's no need to add them all.
Once it's connected, Lens will display a ton of information about your cluster. You can see the workloads that are running: pods and deployments, daemon sets, cron jobs, etc. You can also view information about config maps and secrets, networking information, storage, namespaces, and events. Each will let you drill down into the information about a given object, and you can even edit the objects directly in Lens.
![Lens displaying details of pods running on the cluster, including information on a specific pod.][10]
Details of pods running on the cluster. (Chris Collins, [CC BY-SA 4.0][5])
### Gather metrics about your cluster
One of Lens' incredibly helpful features is its ability to connect to a Prometheus stack installed in your cluster to gather metrics about the cluster and its nodes for both current and historical data. This is great for getting at-a-glance information about the cluster right within the Lens UI without having to go to an external dashboard. However, the information presented is not comprehensiveit's good for an overview, but you may still wish to utilize a visualization tool such as Grafana with a more complicated dashboard to gather more specialized information.
Along with being able to connect to an existing Prometheus stack provisioned in the cluster, Lens can install applications on your behalf, too. This is very useful for enthusiasts running Kubernetes clusters in their homelabs to be able to deploy and connect to Prometheus in a single click.
### Install Prometheus with Lens
If you have been following along with this series, especially [_Build a Kubernetes cluster with the Raspberry Pi_][11], you will have a Kubernetes cluster provisioned in your homelab for education and tinkering. One thing the vanilla cluster lacks is metrics, and this is a great opportunity to add Prometheus to the cluster and install the [kube-state-metrics][12] service to gather information about the cluster.
To install it, just right-click on the cluster icon in the top-left corner of the Lens UI (after connecting to the cluster, of course) and select **Settings**. Under **Features** on the Settings page, you will find a **Metrics** section and a button to install Prometheus. Click **Install** to deploy the Prometheus stack to your cluster, and Lens will auto-detect its existence and begin displaying metrics. (It will take a minute—the new Prometheus has to collect some metrics first.)
I also appreciate that Lens links directly to the manifests used to deploy this stack, so you can verify what will be created before doing it, if you want.
![Lens UI, displaying hardware utilization metrics about the cluster][13]
Hardware utilization metrics about the cluster. (Chris Collins, [CC BY-SA 4.0][5])
### Fix kube-state-metrics
Unfortunately, while Prometheus will install just fine on a Raspberry Pi-based cluster, the kube-state-metrics service will fail. Currently, the kube-state-metrics project does not build an AArch64/ARM64 image, so pods created from that image will continuously crash with `exec format error` messages in the logs.
Luckily [this issue is being tracked][14], and the kube-state-metrics project is working toward building the infrastructure to produce official ARM images. Until then, however, you can use a community-developed image and patch the kube-state-metrics deployment directly using Lens.
Go back into the cluster information, click on **Workloads**, and select **Deployments**. A list of all the Kubernetes deployment objects in the cluster will appear in the pane on the right. You should be able to pick out the kube-state-metrics deployment easily by the angry red entry under the **Conditions** column that indicates the crash-looping pod issue.
Select the kube-state-metrics deployment, and details of the object will slide out from the right in an overlay window. In the upper-right corner of this window is a pencil icon. Clicking that icon opens an editor window with the YAML representation of the kube-state-metrics deployment. Scroll down, and edit the `.spec.template.spec.containers.image` value. By default, this value points to the official image: `quay.io/coreos/kube-state-metrics:v1.9.5`.
Replace this value with `'docker.io/carlosedp/kube-state-metrics:v1.9.5'`, and click **Save**. This will trigger the deployment to roll out new kube-state-metrics pods with an ARM64 architecture, and they should become ready and begin reporting the metrics directly to Prometheus.
### Lens lets you see clearly
Kubernetes is complex, and any tool that makes it easier to visualize and work with Kubernetes clusters can lower the barrier of entry for new folks and make life considerably easier for experienced Kubernetes administrators. Lens knocks this out of the park with an attractive, intuitive, and easy-to-use UI for managing one or more clusters, from the 10,000-foot view down into the nitty-gritty of individual Kubernetes objects. Lens also helps display metrics about the cluster and makes installing and using a Prometheus stack to display the metrics almost push-button.
I am extremely impressed with Lens and use it to manage several Kubernetes clusters in my own homelab, and I hope you find it useful as well. Do you have tools you like for managing or visualizing what goes on in your Kubernetes clusters? Share them in the comments, so we can all try them out!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/kubernetes-lens
作者:[Chris Collins][a]
选题:[lujun9972][b]
译者:[译者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/clcollins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas)
[2]: https://opensource.com/resources/what-is-kubernetes
[3]: https://k8slens.dev/
[4]: https://opensource.com/sites/default/files/uploads/lens2.png (Lens UI displaying an overview of workloads on the cluster)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://opensource.com/sitewide-search?search_api_views_fulltext=prometheus
[7]: https://opensource.com/article/20/6/appimages
[8]: https://docs.appimage.org/user-guide/faq.html#question-what-is-an-appimage
[9]: https://github.com/lensapp/lens/releases/latest
[10]: https://opensource.com/sites/default/files/uploads/lens3.png (Lens displaying details of pods running on the cluster, including information on a specific pod.)
[11]: https://opensource.com/article/20/6/kubernetes-raspberry-pi
[12]: https://github.com/kubernetes/kube-state-metrics
[13]: https://opensource.com/sites/default/files/uploads/lens1.png (Lens UI, displaying hardware utilization metrics about the cluster)
[14]: https://github.com/kubernetes/kube-state-metrics/issues/1037

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,347 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Protect your system with fail2ban and firewalld blacklists)
[#]: via: (https://fedoramagazine.org/protect-your-system-with-fail2ban-and-firewalld-blacklists/)
[#]: author: (hobbes1069 https://fedoramagazine.org/author/hobbes1069/)
Protect your system with fail2ban and firewalld blacklists
======
![][1]
If you run a server with a public-facing SSH access, you might have experienced malicious login attempts. This article shows how to use two utilities to keep the intruder out of our systems.
To protect against repeated ssh login attempts, well look at _fail2ban_. And if you dont travel much, and perhaps stay in one or two countries, you can configure _firewalld_ to only [allow access from the countries you choose][2].
First lets work through a little terminology for those not familiar with the various applications well need to make this work:
**fail2ban:** Daemon to ban hosts that cause multiple authentication errors.
fail2ban will monitor the SystemD journal to look for failed authentication attempts for whichever jails have been enabled. After the number of failed attempts specified it will add a firewall rule to block that specific IP address for an amount of time configured.
**firewalld:** A firewall daemon with D-Bus interface providing a dynamic firewall.
Unless youve manually decided to use traditional iptables, youre already using firewalld on all supported releases of Fedora and CentOS.
### Assumptions
* The host system has an internet connection and is either fully exposed directly, through a DMZ (both REALLY bad ideas unless you know what youre doing), or has a port being forwarded to it from a router.
* While most of this might apply to other systems, this article assumes a current version of Fedora (31 and up) or RHEL/CentOS 8. On CentOS you must enable the Fedora EPEL repo with sudo dnf install epel-release
### Install &amp; Configuration
#### Fail2Ban
More than likely whichever FirewallD zone is set already allows SSH access but the sshd service itself is not enabled by default. To start it manually and without permanently enabling on boot:
```
$ sudo systemctl start sshd
```
Or to start and enable on boot:
```
$ sudo systemctl enable --now sshd
```
The next step is to install, configure, and enable fail2ban. As usual the install can be done from the command line:
```
$ sudo dnf install fail2ban
```
Once installed the next step is to configure a jail (a service you want to monitor and ban at whatever thresholds youve set). By default IPs are banned for 1 hour (which is not near long enough). The best practice is to override the system defaults using *.local files instead of directly modifying the *.config files. If we look at my jail.local we see:
```
# cat /etc/fail2ban/jail.local
[DEFAULT]
# "bantime" is the number of seconds that a host is banned.
bantime = 1d
# A host is banned if it has generated "maxretry" during the last "findtime"
findtime = 1h
# "maxretry" is the number of failures before a host get banned.
maxretry = 5
```
Turning this into plain language, after 5 attempts within the last hour the IP will be blocked for 1 day. Theres also options for increasing the ban time for IPs that get banned multiple times, but thats the subject for another article.
The next step is to configure a jail. In this tutorial sshd is shown but the steps are more or less the same for other services. Create a configuration file inside _/etc/fail2ban/jail.d_. Heres mine:
```
# cat /etc/fail2ban/jail.d/sshd.local
[sshd]
enabled = true
```
Its that simple! A lot of the configuration is already handled within the package built for Fedora (Hint: Im the current maintainer). Next enable and start the fail2ban service.
```
$ sudo systemctl enable --now fail2ban
```
Hopefully there were not any immediate errors, if not, check the status of fail2ban using the following command:
```
$ sudo systemctl status fail2ban
```
If it started without errors it should look something like this:
```
$ systemctl status fail2ban
● fail2ban.service - Fail2Ban Service
Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-06-16 07:57:40 CDT; 5s ago
Docs: man:fail2ban(1)
Process: 11230 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS)
Main PID: 11235 (f2b/server)
Tasks: 5 (limit: 4630)
Memory: 12.7M
CPU: 109ms
CGroup: /system.slice/fail2ban.service
└─11235 /usr/bin/python3 -s /usr/bin/fail2ban-server -xf start
Jun 16 07:57:40 localhost.localdomain systemd[1]: Starting Fail2Ban Service…
Jun 16 07:57:40 localhost.localdomain systemd[1]: Started Fail2Ban Service.
Jun 16 07:57:41 localhost.localdomain fail2ban-server[11235]: Server ready
```
If recently started, fail2ban is unlikely to show anything interesting going on just yet but to check the status of fail2ban and make sure the jail is enabled enter:
```
$ sudo fail2ban-client status
Status
|- Number of jail: 1
`- Jail list: sshd
```
And the high level status of the sshd jail is shown. If multiple jails were enabled they would show up here.
To check the detailed status a jail, just add the jail to the previous command. Heres the output from my system which has been running for a while. I have removed the banned IPs from the output:
```
$ sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
| |- Currently failed: 8
| |- Total failed: 4399
| `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions
|- Currently banned: 101
|- Total banned: 684
`- Banned IP list: ...
```
Monitoring the fail2ban log file for intrusion attempts can be achieved by “tailing” the log:
```
$ sudo tail -f /var/log/fail2ban.log
```
Tail is a nice little command line utility which by default shows the last 10 lines of a file. Adding the “-f” tells it to follow the file which is a great way to watch a file thats still being written to.
Since the output has real IPs in it, a sample wont be provided but its pretty human readable. The INFO lines will usually be attempts at a login. If enough attempts are made from a specific IP address you will see a NOTICE line showing an IP address was banned. After the ban time has been reached you will see an NOTICE unban line.
Lookout for several WARNING lines. Most often this happens when a ban is added but fail2ban finds the IP address already in its ban database, which means banning may not be working correctly. If recently installed the fail2ban package it should be setup for FirewallD rich rules. The package was only switched from “ipset” to “rich rules” as of _fail2ban-0.11.1-6_ so if you have an older install of fail2ban it may still be trying to use the ipset method which utilizes legacy iptables and is not very reliable.
#### FirewallD Configuration
##### Reactive or Proactive?
There are two strategies that can be used either separately or together. Reactive or proactive permanent blacklisting of individual IP address or subnets based on country of origin.
For the reactive approach once fail2ban has been running for a while its a good idea to take a look at how “bad is bad” by running _sudo fail2ban-client status sshd_ again. There most likely will be many banned IP addresses. Just pick one and try running _whois_ on it. There can be quite a bit of interesting information in the output but for this method, only the country of origin is of importance. To keep things simple, lets filter out everything but the country.
For this example a few well known domain names will be used:
```
$ whois google.com | grep -i country
Registrant Country: US
Admin Country: US
Tech Country: US
```
```
$ whois rpmfusion.org | grep -i country
Registrant Country: FR
```
```
$ whois aliexpress.com | grep -i country
Registrant Country: CN
```
The reason for the _grep -i_ is to make grep non-case sensitive while most entries use “Country”, some are in all lower case so this method matches regardless.
Now that the country of origin of an intrusion attempt is known the question is, “Does anyone from that country have a legitimate reason to connect to this computer?” If the answer is NO, then it should be acceptable to block the entire country.
Functionally the proactive approach it not very different from the reactive approach, however, there are countries from which intrusion attempts are very common. If the system neither resides in one of those countries, nor has any customers originating from them, then why not add them to the blacklist now rather than waiting?
##### Blacklisting Script and Configuration
So how do you do that? With FirewallD ipsets. I developed the following script to automate the process as much as possible:
```
#!/bin/bash
# Based on the below article
# https://www.linode.com/community/questions/11143/top-tip-firewalld-and-ipset-country-blacklist
# Source the blacklisted countries from the configuration file
. /etc/blacklist-by-country
# Create a temporary working directory
ipdeny_tmp_dir=$(mktemp -d -t blacklist-XXXXXXXXXX)
pushd $ipdeny_tmp_dir
# Download the latest network addresses by country file
curl -LO http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz
tar xf all-zones.tar.gz
# For updates, remove the ipset blacklist and recreate
if firewall-cmd -q --zone=drop --query-source=ipset:blacklist; then
firewall-cmd -q --permanent --delete-ipset=blacklist
fi
# Create the ipset blacklist which accepts both IP addresses and networks
firewall-cmd -q --permanent --new-ipset=blacklist --type=hash:net \
--option=family=inet --option=hashsize=4096 --option=maxelem=200000 \
--set-description="An ipset list of networks or ips to be dropped."
# Add the address ranges by country per ipdeny.com to the blacklist
for country in $countries; do
firewall-cmd -q --permanent --ipset=blacklist \
--add-entries-from-file=./$country.zone && \
echo "Added $country to blacklist ipset."
done
# Block individual IPs if the configuration file exists and is not empty
if [ -s "/etc/blacklist-by-ip" ]; then
echo "Adding IPs blacklists."
firewall-cmd -q --permanent --ipset=blacklist \
--add-entries-from-file=/etc/blacklist-by-ip && \
echo "Added IPs to blacklist ipset."
fi
# Add the blacklist ipset to the drop zone if not already setup
if firewall-cmd -q --zone=drop --query-source=ipset:blacklist; then
echo "Blacklist already in firewalld drop zone."
else
echo "Adding ipset blacklist to firewalld drop zone."
firewall-cmd --permanent --zone=drop --add-source=ipset:blacklist
fi
firewall-cmd -q --reload
popd
rm -rf $ipdeny_tmp_dir
```
This should be installed to _/usr/local/sbin_ and dont forget to make it executable!
```
$ sudo chmod +x /usr/local/sbin/firewalld-blacklist
```
Then create a configure file: _/etc/blacklist-by-country_:
```
# Which countries should be blocked?
# Use the two letter designation separated by a space.
countries=""
```
And another configuration file _/etc/blacklist-by-ip_, which is just one IP per line without any additional formatting.
For this example 10 random countries were selected from the ipdeny zones:
```
# ls | shuf -n 10 | sed "s/\.zone//g" | tr '\n' ' '
nl ee ie pk is sv na om gp bn
```
Now as long as at least one country has been added to the config file its ready to run!
```
$ sudo firewalld-blacklist
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 142 100 142 0 0 1014 0 --:--:-- --:--:-- --:--:-- 1014
100 662k 100 662k 0 0 989k 0 --:--:-- --:--:-- --:--:-- 989k
Added nl to blacklist ipset.
Added ee to blacklist ipset.
Added ie to blacklist ipset.
Added pk to blacklist ipset.
Added is to blacklist ipset.
Added sv to blacklist ipset.
Added na to blacklist ipset.
Added om to blacklist ipset.
Added gp to blacklist ipset.
Added bn to blacklist ipset.
Adding ipset blacklist to firewalld drop zone.
success
```
To verify that the firewalld blacklist was successful, check the drop zone and blacklist ipset:
```
$ sudo firewall-cmd --info-zone=drop
drop (active)
target: DROP
icmp-block-inversion: no
interfaces:
sources: ipset:blacklist
services:
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
$ sudo firewall-cmd --info-ipset=blacklist | less
blacklist
type: hash:net
options: family=inet hashsize=4096 maxelem=200000
entries:
```
The second command will output all of the subnets that were added based on the countries blocked and can be quite lengthy.
##### So now what do I do?
While it will be a good idea to monitor things more frequently at the beginning, over time the number of intrusion attempts should decline as the blacklist grows. Then the goal should be maintenance rather than active monitoring.
To this end I created a SystemD service file and timer so that on a monthly basis the by country subnets maintained by ipdeny are refreshed. In fact everything discussed here can be downloaded from my pagure.io project:
<https://pagure.io/firewalld-blacklist>
Arent you glad you read the whole article? Now just download the service file and timer to _/etc/systemd/system/_ and enable the timer:
```
$ sudo systemctl daemon-reload
$ sudo systemctl enable --now firewalld-blacklist.timer
```
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/protect-your-system-with-fail2ban-and-firewalld-blacklists/
作者:[hobbes1069][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/hobbes1069/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/fail2ban-and-firewalld-816x345.png
[2]: https://www.linode.com/community/questions/11143/top-tip-firewalld-and-ipset-country-blacklist

View File

@ -0,0 +1,128 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Jitsi Meet: A Free & Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up)
[#]: via: (https://itsfoss.com/jitsi-meet/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Jitsi Meet: A Free & Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up
======
_**Brief: Jitsi Meet is an open-source video conferencing service that you can use for free to organize online classes, conferences and meet ups. You can also host Jitsi on your own server**._
The remote work trend grew significantly amidst the COVID-19 pandemic. No matter whether you like it or not, video conferencing is proving to be a great solution for both individuals and businesses.
One of the video conferencing services that got insanely popular in last few months is Zoom. However, there are plenty of security and privacy concerns [about Zoom video calls][1].
So, its important to choose a secure and easy-to-use video conferencing app that gets the work done. Im sure there are numerous alternatives, but here — lets take a look at an open-source option [Jitsi Meet][2].
### Jitsi Meet: Free to Use, Open-Source Video Conferencing Service
![][3]
Jitsi Meet is a part of [Jitsi][4], which is a collection of open-source voice, video conferencing, and instant messaging services.
The Jitsi Meet allows you to host group video calls, i.e. video conferencing in seconds. You dont even need an account with them.
For desktop, it is browser-based and does not offer a native desktop app. I think thats not an issue because installing an app is probably an overhead for some.
And, for smartphones, it does offer both iOS and Android apps that you can install from the App Store and the Play Store respectively. In addition to these, you can also find it on the open source Android app store [F-Droid][5].
If you want to go the extra mile, you can deploy Jitsi Meet on your server. This is ideal for businesses who dont want to use a third-party server even if it is from the developers of the software.
### Features of Jitsi Meet
![][6]
Jitsi Meet is simple and yet feature-rich. Heres the set of features that youll get:
* Does not need user registration
* Edit documents together using Etherpad
* Gives you the ability to self-host
* Supports Slack and Rocket.chat integration
* Offers password protection if needed
* End-to-End encryption (beta)
* Background blur (beta)
* Recording option
* Live stream support
* YouTube video sharing
* View the network status of users
* Google and Microsoft Calendar Integration
* Chat feature
* Screen sharing
* Supports International dial-in connection to join
* The session exists for you to continue the video call later without needing the meeting code.
* Low-bandwidth mode option
![][7]
For obvious reasons, you will find fewer options on the mobile app.
Do note that [end-to-end encryption is still in beta][8]. But, even without it, Jitsi Meet should be a privacy-friendly and secure video conferencing solution.
On mobile, I just wish if it had the screen sharing option — except that, everything else works just fine.
### How To Use Jitsi Meet?
![][9]
Theres nothing extra that you need to do in order to make it work on Linux. You just need to head over to their [official Jitsi Meet instance][2] and then type in the name of the meeting to create or join.
As you can see in the screenshot above, you can also find a list of your recent meeting rooms so that you dont have to type or create the meeting room again.
![][10]
If youre creating it, its best to go with a unique name and also add a password protection to it if you do not need anyone else to join in accidentally.
![][11]
If youre joining someone elses meeting, simply ask for the meeting name or the link of the meeting to be able to easily join using your desktop or smartphone.
It works the same way on desktop minus some options. Ive been using it for a while and Ive also encouraged and trained my dads employer (our neighborhood school) to use Jitsi Meet to host online classes.
Even though it has a limit of up to 75 participants, it holds up pretty well and works perfectly fine.
[Jitsi Meet][12]
**Wrapping Up**
If youre looking to host your own Jitsi instance, I suggest you to follow their [official self-hosting guide][13] to get it up and running. You can also find a [list of instances on their GitHub page][14].
Jitsi Meet is an amazing open-source video conferencing application. Its a privacy-friendly alternative to Zoom and other video calling services of that kind.
I also suggest looking at [NextCloud, an open source alternative to MS Office 365][15].
What do you think about Jitsi Meet? Have you tried it yet? Whats your favorite video conferencing tool?
--------------------------------------------------------------------------------
via: https://itsfoss.com/jitsi-meet/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者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/ankush/
[b]: https://github.com/lujun9972
[1]: https://www.tomsguide.com/news/zoom-security-privacy-woes
[2]: https://meet.jit.si/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-screenshot.png?ssl=1
[4]: https://jitsi.org/
[5]: https://f-droid.org/en/packages/org.jitsi.meet/
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-smartphones.jpg?ssl=1
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-options-desktop.png?ssl=1
[8]: https://jitsi.org/blog/e2ee/
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-use.resized.png?ssl=1
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-browser-screenshot.png?ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-password.png?ssl=1
[12]: https://meet.jit.si
[13]: https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart
[14]: https://github.com/jitsi/jitsi-meet/wiki/Jitsi-Meet-Instances
[15]: https://itsfoss.com/nextcloud/

View File

@ -0,0 +1,155 @@
[#]: collector: (lujun9972)
[#]: translator: (Yufei-Yan)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What is IoT? The internet of things explained)
[#]: via: (https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html)
[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/)
什么是 IoT物联网简介
======
物联网IoT是一个将智能设备连接起来的网络并提供了丰富的数据但是它也有可能是一场安全领域的噩梦。
对于越来越多不用于传统计算但却相互连接用来收发数据的电子设备来说物联网IoT这个词可以说是最夺人眼球的。
现在有数不胜数的东西可以归为这一类:传统家用电器里面,可以联网的那一部分"智能设备",比如说电冰箱和灯泡;那些只能运行于有互联网环境的小设备,比如像 Alexa 之类的电子助手;与互联网连接的传感器,他们正在改变着工厂、医疗、运输、物流中心和农场。
### 什么是物联网?
物联网IoT将互联网、数据处理和分析的能力带给了现实世界中的各种物品。对于消费者来说这就意味着不需要键盘和显示器这些东西就能和全世界的信息进行互动日常用品当中很多都可以通过网络得到操作指令从而最大程度的减少了人工的操作。
**[更多关于物联网IoT在网络世界中的内容][1]**
在企业环境当中互联网Internet长期以来为制造和分销提供了便利物联网IoT也能带来同样的效率。互联网嵌入式传感器即使没有几十亿全世界数百万的此类传感器正在提供着丰富的数据企业可以利用这些数据来保证他们运营的安全跟踪资产和减少人工处理的次数。研究人员也可以使用物联网IoT来获取人们的喜好和行为数据尽管这些行为可能会严重的涉及隐私和安全问题。
### 它有多大?
一句话:非常庞大。[Priceonomics 把它分开来看][2]在2020年的时候有超过50亿的物联网IoT设备这些设备可以生成 4.4 泽字节zettabyte译者注1 zettabyte = 10<sup>9</sup> terabyte = 10<sup>12</sup> gigabyte的数据。相比较物联网IoT设备在 2013 仅仅产生了 1000 亿千兆字节gigabyte的数据。在物联网IoT市场上可能挣到的钱也同样让人瞠目到 2025 年,这块市场的价值可以达到 1.6 万亿美元到 14.4 万亿美元。
### 物联网IoT的历史
一个所有设备和传感器无处不链接的世界是科幻小说中最经典的景象之一。物联网IoT的知识早在 1970 的时候就已经实现了,世界上第一个物联网设备,[卡耐基•梅隆大学的自动贩卖机][3],它还用来和 APRANET 相连,而且很多其他的技术也已经被发明出来并给大家展示了一个充满未来感和智慧的物联网。但是直到 1999 年,物联网这个词才由英国的技术人员,[Kevin Ashton][4] 提出来。
一开始技术是滞后于当时对未来的憧憬的。每个与互联网相连的设备都需要一个处理器和一种能和其他东西通信的方式无线的最好这些因素都增加了物联网IoT大规模实际应用的成本和性能要求这种情况至少一直持续到 21 世纪头十年中期,直到摩尔定律赶上来。
一个重要的里程碑是当 [RFID 的大规模使用][5],这种价格低廉的转发器可以被贴在任何物品上,然后这些物品就可以连接到更大的互联网上了。对于设计者来说,无处不在的 Wi-Fi 和 4G 让任何地方的无线连接都变得非常简单。而且IPv6 的出现在也不用让人们担心把数十亿小设备连接到互联网上会将 IP 地址耗尽。(相关故事:[物联网IoT网络可以促进IPv6的使用吗][6]
### 物联网IoT是如何工作的
物联网IoT的基本元素是收集的数据的设备。广义地说他们是和互联网相连的设备所以每一个设备都有 IP 地址。这些设备涵盖了从从工厂运输货物的自动驾驶车辆到简单的温度监控的传感器。这其中也包括每天统计步数的个人手环。为了让这些数据变得有意义,就需要收集、处理、过滤和分析这些数据,又会有很多种办法来实现这些过程。
搜集数据是通过把数据从设备上发送到搜集端。可以通过各种无线或者有线网络进行数据的转移。数据可以通过无联网发送到有存储空间或者计算能力的数据中心或者云端,或者这些数据可以分段的进行传输,中间设备在发送之前会将这些数据聚集在一起。
处理数据可以在数据中心或者云端进行但是有时候这不太可行。对于一些非常重要的设备比如说工业领域的关停设备从设备上将数据发送到远程数据中心的延迟代价实在是太高了。发送、处理、分析数据和返回指令在管道爆炸之前关闭阀门这些操作来回一趟的时间可能要花费非常多的时间。在这种情况下边缘计算edge-computing就可以大显身手了。边缘计算是一个智能的边缘设备可以聚集数据并且进行分析在需要的时候进行回应所有的这一系列操作都是距离所需要控制的设备很近的所以也就降低了延迟。边缘设备可以有上游连接这样数据就可以进一步被处理和储存。
[][7] 网络世界 / IDG
物联网IoT是如何工作的。
### **物联网IoT设备的一些例子**
本质上任何可以搜集来自于真实世界数据并且可以发送回去的设备都可以参与到物联网IoT生态系统中。典型的例子包括智能家居设备射频识别标签RFID和工业传感器。这些传感器可以监控一系列的要素包括工业系统中的温度和压力机器中关键设备的状态患者身上与生命体征相关的信号也可以利用水和电已经其他许多可能的东西。
一台工厂的机器人可以被认为是物联网IoT设备因为他们可以看作是自动化的载具将货物在仓库之间转移
其他的例子包括可穿戴设备和家庭安防系统。还有一些其他更基础的设备,比如说[树莓派Raspberry Pi][8]和[Arduino][9]这些设备可以让你构建你自己的物联网IoT终端节点。
#### **设备管理**
为了能让这些设备一起工作,所有这些设备都需要进行验证、合理分配、调试和监控,并且在需要的时候进行更新。要么这些操作会经常的出现在由一个设备供应商制造的系统中;要么这些操作根本就不会发生,这样也是最有风险的。但是整个工业界正在向[标准化的设备管理模型][10]过渡这样也就允许物联网IoT设备之间进行互相操作也可以保证设备不会被孤立。
#### **物联网IoT通信标准和协议**
当物联网IoT小设备和其他设备通信的时候他们可以使用各种通信标准和协议这其中许多都是为这些处理能力有限和缺少电源供应的设备专门定制的。你一定听说过其中的一些尽管说有一些设备使用的是Wi-Fi或者蓝牙但是更多的设备是使用了专门为物联网IoT世界定制的标准。比如ZigBee就是一个低功耗、远距离传输的无线通信协议而 MQTTMessage Queuing Telemetry Transport是为链接在不可靠或者有延迟网络上的设备定制的一个发布/订阅publish/subscribe模式的信息传递协议。参考网络世界的词汇表[物联网IoT标准和协议](11)。)
物联网IoT也会受益于5G为蜂窝网络带来的高速度和高带宽尽管这种使用场景会[滞后于普通的手机][12]。
### 物联网IoT, 边缘计算edge computing和云cloud
[][23] 网络世界 / IDG
边缘计算如何使物联网IoT成为可能。
对于许多物联网IoT系统来说大量的数据会以极快的速度涌来这种情况催生了一个新的科技领域[边缘计算edge computing][14]它由放置在物联网IoT设备附近的设备组成处理来自那些设备的数据。这些机器会处理这些数据并且只将相关的材料发送到一个更集中的系统系统进行分析。比如假设在一个有几十个物联网IoT安防摄像头的网络中边缘计算会直接分析传入的视频而且只有当其中一个摄像头检测到有物体移动的时候才向SoC发出警报而不会是一下子将所有的在线数据流全部发送到大楼的安全操作中心SoC
一旦这些数据已经被处理过了,他们有去哪里了呢?好吧,它也许会被送到你的数据中心,但是更多情况下,它最终会进入云。
对于物联网IoT这种间歇或者不同步的数据来往场景来说具有弹性的云计算是再适合不过的了。许多云计算巨头包括[谷歌][15][微软][16],和[亚马逊][17]都会提供物联网IoT产品。
### 物联网IoT平台
云计算巨头们正在尝试出售的不仅仅是存放传感器搜集的数据。他们要提供一个可以协调物联网IoT系统中各种元素的网正完整平提案平台会将很多功能捆绑在一起。本质上物联网IoT平台作为中间件将物联网IoT设备和边缘网关用处理物联网IoT数据的应用程序连接起来。也就是说每一个平台的厂商看上去都会对物联网IoT平台应该是什么这个问题有一些稍微不同的解释这样就能更好的[与其他竞争者拉开差距][18]。
### 物联网IoT和数据
正如前面所提到的所有那些物联网IoT设备收集了有泽字节zettabytes这个数量级的数据这些数据通过边缘网关被发送到平台上进行处理。在很多情况下这些数据就是首先要部署物联网IoT的原因。通过从现实世界中的传感器搜集来的数据各种组织就可以实时的作出灵活的决定。
例如Oracle 公司[假设了一个场景][19],当人们在主题公园的时候,会被鼓励下载一个可以提供公园信息的应用。同时,这个程序会将 GPS 信号发回到公园的管理部门来帮助他们预测排队时间。有了这些信息,公园就可以在短期内(比如通过增加员工数量来提高一些景点的容量)和长期内(通过了解哪些设施最受欢迎,那些最不受欢迎)采取行动。
这些决定完全可以在没有人工干预的情况作出。比如,从化工厂管道中的压力传感器收集的数据可以通过边缘设备的软件进行分析,从而发现管道破裂的威胁,这样的信息可以触发关闭阀门从而避免泄漏的信号。
### 物联网IoT和大数据分析
主题公园的例子可以让你很容易理解但是和许多现实世界中物联网IoT收集数据的操作相比就显得小菜一碟了。许多打数据操作都会使用到来自物联网IoT设备收集的信息然后与其他数据关联这样就可以分析预测到人类的行为。_Software Advice_ 给出了[一些例子][20]其中包括由Birst提供的一项服务该服务将从联网的咖啡机中收集的咖啡冲泡的信息与社交媒体上发布的帖子进行匹配看看顾客是否在网上谈论咖啡品牌。
另一个最近才发生的戏剧性的例子X-Mode 发布了一张基于位置追踪数据的地图,地图上显示了在 2020 年 3 月春假的时候正当新冠病毒在美国加速传播的时候人们在劳德代尔堡Ft. Lauderdale聚会完[最终都去了哪里][21]。这张地图令人震撼不仅仅是因为它显示出病毒可能的扩散方向更是因为它说明了物联网IoT设备是可以多么密切地追踪我们。更多关于物联网IoT和分析的信息请点击[此处][22]
### 物联网IoT数据和AI
物联网IoT设备能够收集的数据量远远大于任何人类能够以有效的方式处理的数据量而且这肯定不是实时的。我们已经看到来自于物联网IoT终端的原始数据需要边缘计算设备去进行解释。还需要检测和处理可能[完全错误的数据][23]。
许多物联网IoT供应商也同时提供机器学习和人工只能的功能可以用来理解收集来的数据。比如在 Watson 平台上获胜的 IBM Jeopard! ,就可以在[物联网IoT数据集进行训练][24],这样就可以在预测行维护领域产生有用的结果 - 比如说分析来自无人机的数据可以区分桥梁上轻微的损坏和需要重视的裂缝。同时ARM 也在研发[低功耗芯片][25]它可以在物联网IoT终端上提供AI的能力。
### 物联网IoT和贸易
贸易领域, 物联网IoT可以用于包括跟踪客户库存和重要部件的状态。[IoT for All][26] 列举了四个已经被物联网IoT改变的行业
* **石油和天然气**:与人工干预相比,无联网传感器可以更好的检测孤立的钻井场地。
* **农业**通过物联网IoT传感器获得的田间作物的数据可以用来提高产量。
* **采暖通风**:制造商可以监控全国各地的气候控制系统。
* **实体零售**:当顾客在商店的某一部分停留的时候,可以给他们的手机上发送优惠信息从而进行精准定位。
更普遍的情况是,企业正在寻找能够在[四个领域][27]上获得帮助的物联网IoT解决方案能源使用资产跟踪安全领域和客户体验。
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html
作者:[Josh Fruhlinger][a]
选题:[lujun9972][b]
译者:[Yufei-Yan](https://github.com/Yufei-Yan)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Josh-Fruhlinger/
[b]: https://github.com/lujun9972
[1]: https://www.networkworld.com/category/internet-of-things/
[2]: https://priceonomics.com/the-iot-data-explosion-how-big-is-the-iot-data/
[3]: https://www.machinedesign.com/automation-iiot/article/21836968/iot-started-with-a-vending-machine
[4]: https://www.visioncritical.com/blog/kevin-ashton-internet-of-things
[5]: https://www.networkworld.com/article/2319384/rfid-readers-route-tag-traffic.html
[6]: https://www.networkworld.com/article/3338106/can-iot-networking-drive-adoption-of-ipv6.html
[7]: https://images.idgesg.net/images/article/2020/05/nw_how_iot_works_diagram-100840757-orig.jpg
[8]: https://www.networkworld.com/article/3176091/10-killer-raspberry-pi-projects-collection-1.html
[9]: https://www.networkworld.com/article/3075360/arduino-targets-the-internet-of-things-with-primo-board.html
[10]: https://www.networkworld.com/article/3258812/the-future-of-iot-device-management.html
[11]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html
[12]: https://www.networkworld.com/article/3291778/what-s-so-special-about-5g-and-iot.html
[13]: https://images.idgesg.net/images/article/2017/09/nw_how_edge_computing_works_diagram_1400x1717-100736111-orig.jpg
[14]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html
[15]: https://cloud.google.com/solutions/iot
[16]: https://azure.microsoft.com/en-us/overview/iot/
[17]: https://aws.amazon.com/iot/
[18]: https://www.networkworld.com/article/3336166/why-are-iot-platforms-so-darn-confusing.html
[19]: https://blogs.oracle.com/bigdata/how-big-data-powers-the-internet-of-things
[20]: https://www.softwareadvice.com/resources/iot-data-analytics-use-cases/
[21]: https://www.cnn.com/2020/04/04/tech/location-tracking-florida-coronavirus/index.html
[22]: https://www.networkworld.com/article/3311919/iot-analytics-guide-what-to-expect-from-internet-of-things-data.html
[23]: https://www.networkworld.com/article/3396230/when-iot-systems-fail-the-risk-of-having-bad-iot-data.html
[24]: https://www.networkworld.com/article/3449243/watson-iot-chief-ai-can-broaden-iot-services.html
[25]: https://www.networkworld.com/article/3532094/ai-everywhere-iot-chips-coming-from-arm.html
[26]: https://www.iotforall.com/4-unlikely-industries-iot-changing/
[27]: https://www.networkworld.com/article/3396128/the-state-of-enterprise-iot-companies-want-solutions-for-these-4-areas.html

View File

@ -0,0 +1,132 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Import functions and variables into Bash with the source command)
[#]: via: (https://opensource.com/article/20/6/bash-source-command)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 source 命令将函数和变量导入 Bash
======
source 就像 Python 的 import 或者 Java 的 include。学习它扩展你的 Bash 能力。
![bash logo on green background][1]
登录 Linux shell 时,你将继承特定的工作环境。对于 shell 而言_环境_ environment 已经为你设置了某些变量,以确保你的命令按预期工作。例如,[PATH][2] 环境变量定义 shell 从哪里查找命令。没有它,几乎所有尝试在 Bash 中执行的所有操作都会因 **command not found** 错误而失败。在执行日常任务时,环境对你几乎是不可见的,但它很重要。
有多种方法可以影响你的 shell 环境。你可以在配置文件中进行修改,例如 `~/.bashrc``~/.profile`,你可以在启动时运行服务,还可以创建自己的自定义命令或编写自己的 [Bash 函数][3] 。
### 通过 source 添加到你的环境
Bash以及其他一些 shell有一个称为 `source` 的内置命令。这就是令人困惑的地方:`source` 执行与命令 `.` 相同的功能是的那只是一个点而__不是_与 `Tcl` 命令相同的 `source`(如果你输入 `man source`,可能会在屏幕上显示)。实际上,内置的 `source` 命令根本不在你的 `PATH` 中。这是 Bash 附带的命令,要获取有关它的更多信息,可以输入 `help source`
`.` 命令兼容 [POSIX][4]。 但 `source` 命令不是 POSIX 定义的,但可以与 `.` 命令互换。
根据 Bash `help``source` 命令在你当前的 shell 中执行一个文件。 “在你当前的 shell 中”这句很重要,因为它表示它不会启动子 shell。因此`source` 执行的任何操作都发生在内部并影响_当前_环境。
在探讨 `source` 对环境的影响之前,请在测试文件上尝试 `source` 以确保其按预期执行代码。首先,创建一个简单的 Bash 脚本并将其保存为 `hello.sh`
```
#!/usr/bin/env bash
echo "hello world"
```
使用 `source`,即使不设置可执行也可以运行此脚本:
```
$ source hello.sh
hello world
```
你也可以使用内置的 `.` 命令获得相同的结果:
```
$ . hello.sh
hello world
```
`source``.` 命令成功执行测试文件的内容。
### 设置变量和导入函数
你可以使用 `source` 将文件“导入”到 shell 环境中,就像你可以在 C 或 C++ 中使用 `include` 关键字引用一个库,或者在 Python 中使用 `import` 关键字引入一个模块一样。这是 `source` 的最常见用法之一,它也是 `.bashrc` 中的一个默认包含项,通过 `source` 导入 `.bash_aliases` 来将任何你自定义的别名在登录时导入。
这是导入 Bash 函数的示例。首先,在名为 `myfunctions` 的文件中创建一个函数。它将打印你的公共 IP 地址和本地 IP 地址:
```
function myip() {
        curl <http://icanhazip.com>      
        ip addr | grep inet$IP | \
        cut -d"/" -f 1 | \
        grep -v 127\\.0 | \
        grep -v \:\:1 | \
        awk '{$1=$1};1'
}
```
将函数导入你的 shell
```
`$ source myfunctions`
```
测试新函数:
```
$ myip
93.184.216.34
inet 192.168.0.23
inet6 fbd4:e85f:49c:2121:ce12:ef79:0e77:59d1
inet 10.8.42.38
```
### source 搜索
当你在Bash中使用 `source` 时,它将在当前目录中搜索你引用的文件。但并非所有 shell 都这样,因此,如果你不使用 Bash请查看文档。
如果 Bash 找不到要执行的文件,它将搜索你的 `PATH`。同样,这并不是所有 shell 的默认设置,因此,如果你不使用 Bash请查看文档。
这些都是 Bash 中不错的便利功能。这种出奇地强大,因为它允许你将常用函数保存在磁盘上的一个集中位置,然后将你的环境视为集成开发环境 IDE。你不必担心函数的存储位置因为你知道它们在本地等同于在 `/usr/include` 下,因此无论你在哪,当你 source 过它们Bash 都可以找到它们。
例如,你可以创建一个名为 `~/.local/include` 的目录作为常见函数存储区,然后将此代码块放入 .bashrc 文件中:
```
for i in $HOME/.local/include/*;
  do source $i
done
```
这会将 `~/.local/include` 中所有包含自定义函数的文件“导入”到 shell 环境中。
当你使用 `source``.` 命令时Bash 是唯一搜索当前目录和 `PATH` 的 shell。
### 将 source 用于开源
使用 `source``.` 执行文件是影响环境同时保持变更模块化的一种便捷方法。在下次考虑将大量代码复制并粘贴到 .bashrc 文件中时,请考虑将相关函数或别名组放入专用文件中,然后使用 source 获取它们。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/bash-source-command
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[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/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
[2]: https://opensource.com/article/17/6/set-path-linux
[3]: https://opensource.com/article/20/6/how-write-functions-bash
[4]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains