mirror of
https://github.com/LCTT/TranslateProject.git
synced 2026-08-23 04:03:29 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11278-1.html)
|
||||
[#]: subject: (Managing credentials with KeePassXC)
|
||||
[#]: via: (https://fedoramagazine.org/managing-credentials-with-keepassxc/)
|
||||
[#]: author: (Marco Sarti https://fedoramagazine.org/author/msarti/)
|
||||
@@ -18,30 +18,24 @@
|
||||
|
||||
### 介绍 KeePassXC
|
||||
|
||||
KeePassXC是一个开源的跨平台密码管理器:它是作为 KeePassX 的一个分支开始开发的,这是个不错的产品,但开发不是非常活跃。它使用 256 位密钥的 AES 算法将密钥保存在加密数据库中,这使得在云端设备(如 pCloud 或 Dropbox)中保存数据库相当安全。
|
||||
KeePassXC 是一个开源的跨平台密码管理器:它是作为 KeePassX 的一个分支开始开发的,这是个不错的产品,但开发不是非常活跃。它使用 256 位密钥的 AES 算法将密钥保存在加密数据库中,这使得在云端设备(如 pCloud 或 Dropbox)中保存数据库相当安全。
|
||||
|
||||
除了密码,KeePassXC 还允许你在加密钱包中保存各种信息和附件。它还有一个有效的密码生成器,可以帮助用户正确地管理他的凭据。
|
||||
除了密码,KeePassXC 还允许你在加密皮夹中保存各种信息和附件。它还有一个有效的密码生成器,可以帮助用户正确地管理他的凭据。
|
||||
|
||||
### 安装
|
||||
|
||||
这个程序在标准的 Fedora 仓库和 Flathub 仓库中都有。不幸的是,沙箱程序无法使用浏览器集成,所以我建议通过 dnf 安装程序:
|
||||
```
|
||||
这个程序在标准的 Fedora 仓库和 Flathub 仓库中都有。不幸的是,在沙箱中运行的程序无法使用浏览器集成,所以我建议通过 dnf 安装程序:
|
||||
|
||||
```
|
||||
|
||||
sudo dnf install keepassxc
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
### 创建你的钱包
|
||||
### 创建你的皮夹
|
||||
|
||||
要创建新数据库,有两个重要步骤:
|
||||
|
||||
* 选择加密设置:默认设置相当安全,增加转换轮次也会增加解密时间。
|
||||
* 选择主密钥和额外保护:主密钥必须易于记忆(如果丢失它,你的钱包就会丢失!)但是足够强大,一个至少有 4 个随机单词的密码可能是一个不错的选择。作为额外保护,你可以选择密钥文件(请记住:你必须始终都有它,否则无法打开钱包)和/或 YubiKey 硬件密钥。
|
||||
|
||||
|
||||
* 选择加密设置:默认设置相当安全,增加转换轮次也会增加解密时间。
|
||||
* 选择主密钥和额外保护:主密钥必须易于记忆(如果丢失它,你的皮夹就会丢失!)而足够强大,一个至少有 4 个随机单词的密码可能是一个不错的选择。作为额外保护,你可以选择密钥文件(请记住:你必须始终都有它,否则无法打开皮夹)和/或 YubiKey 硬件密钥。
|
||||
|
||||
![][3]
|
||||
|
||||
@@ -51,7 +45,7 @@ sudo dnf install keepassxc
|
||||
|
||||
### 创建你的第一个条目
|
||||
|
||||
创建数据库后,你可以开始创建第一个条目。对于 Web 登录,请在“条目”选项卡中输入用户名、密码和 URL。 你可以根据个人策略指定凭据的到期日期,也可以通过按右侧的按钮下载网站的 favicon 并将其关联为条目的图标,这是一个很好的功能。
|
||||
创建数据库后,你可以开始创建第一个条目。对于 Web 登录,请在“条目”选项卡中输入用户名、密码和 URL。你可以根据个人策略指定凭据的到期日期,也可以通过按右侧的按钮下载网站的 favicon 并将其关联为条目的图标,这是一个很好的功能。
|
||||
|
||||
![][5]
|
||||
|
||||
@@ -65,7 +59,7 @@ KeePassXC 还提供了一个很好的密码/口令生成器,你可以选择长
|
||||
|
||||
KeePassXC 有一个适用于所有主流浏览器的扩展。该扩展允许你填写所有已指定 URL 条目的登录信息。
|
||||
|
||||
必须在 KeePassXC(工具菜单 -> 设置)上启用浏览器集成,指定你要使用的浏览器:
|
||||
必须在 KeePassXC(工具菜单 -> 设置)上启用浏览器集成,指定你要使用的浏览器:
|
||||
|
||||
![][8]
|
||||
|
||||
@@ -79,21 +73,21 @@ KeePassXC 有一个适用于所有主流浏览器的扩展。该扩展允许你
|
||||
|
||||
通过这种方式,你可以通过 KeePassXC 获取互联网凭据,而无需将其保存在浏览器中。
|
||||
|
||||
### SSH agent integration
|
||||
### SSH 代理集成
|
||||
|
||||
KeePassXC 的另一个有趣功能是与 SSH 集成。如果你使用 ssh 代理,KeePassXC 能够交互并添加你上传的 ssh 密钥到条目中。
|
||||
KeePassXC 的另一个有趣功能是与 SSH 集成。如果你使用 ssh 代理,KeePassXC 能够与之交互并添加你上传的 ssh 密钥到条目中。
|
||||
|
||||
首先,在常规设置(工具菜单 -> 设置)中,你必须启用 ssh 代理并重启程序:
|
||||
首先,在常规设置(工具菜单 -> 设置)中,你必须启用 ssh 代理并重启程序:
|
||||
|
||||
![][11]
|
||||
|
||||
此时,你需要作为附件上传你的 ssh 密钥对到条目中。然后在 “SSH agent” 选项卡中选择附件下拉列表中的私钥,此时公钥将自动填充。不要忘记选择上面的两个复选框,以便在数据库打开/解锁时将密钥添加到代理,并在数据库关闭/锁定时删除:
|
||||
此时,你需要以附件方式上传你的 ssh 密钥对到条目中。然后在 “SSH 代理” 选项卡中选择附件下拉列表中的私钥,此时会自动填充公钥。不要忘记选择上面的两个复选框,以便在数据库打开/解锁时将密钥添加到代理,并在数据库关闭/锁定时删除:
|
||||
|
||||
![][12]
|
||||
|
||||
现在打开和解锁数据库,你可以使用钱包中保存的密钥登录 ssh。
|
||||
现在打开和解锁数据库,你可以使用皮夹中保存的密钥登录 ssh。
|
||||
|
||||
唯一的限制是可以添加到代理的最大密钥数:ssh 服务器默认不接受超过5次登录尝试,出于安全原因,建议不要增加此值。
|
||||
唯一的限制是可以添加到代理的最大密钥数:ssh 服务器默认不接受超过 5 次登录尝试,出于安全原因,建议不要增加此值。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -102,14 +96,14 @@ via: https://fedoramagazine.org/managing-credentials-with-keepassxc/
|
||||
作者:[Marco Sarti][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/msarti/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/keepassxc-816x345.png
|
||||
[2]: https://fedoramagazine.org/manage-your-passwords-with-bitwarden-and-podman/
|
||||
[2]: https://linux.cn/article-11181-1.html
|
||||
[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-33-27.png
|
||||
[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-48-21.png
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-30-07.png
|
||||
102
published/20190827 A dozen ways to learn Python.md
Normal file
102
published/20190827 A dozen ways to learn Python.md
Normal file
@@ -0,0 +1,102 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11280-1.html)
|
||||
[#]: subject: (A dozen ways to learn Python)
|
||||
[#]: via: (https://opensource.com/article/19/8/dozen-ways-learn-python)
|
||||
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
|
||||
|
||||
学习 Python 的 12 个方式
|
||||
======
|
||||
|
||||
> 这些资源将帮助你入门并熟练掌握 Python。
|
||||
|
||||

|
||||
|
||||
Python 是世界上[最受欢迎的][2]编程语言之一,它受到了全世界各地的开发者和创客的欢迎。大多数 Linux 和 MacOS 计算机都预装了某个版本的 Python,现在甚至一些 Windows 计算机供应商也开始安装 Python 了。
|
||||
|
||||
也许你尚未学会它,想学习但又不知道在哪里入门。这里的 12 个资源将帮助你入门并熟练掌握 Python。
|
||||
|
||||
### 课程、书籍、文章和文档
|
||||
|
||||
1、[Python 软件基金会][3]提供了出色的信息和文档,可帮助你迈上编码之旅。请务必查看 [Python 入门指南][4]。它将帮助你得到最新版本的 Python,并提供有关编辑器和开发环境的有用提示。该组织还有可以来进一步指导你的[优秀文档][5]。
|
||||
|
||||
2、我的 Python 旅程始于[海龟模块][6]。我首先在 Bryson Payne 的《[教你的孩子编码][7]》中找到了关于 Python 和海龟的内容。这本书是一个很好的资源,购买这本书可以让你看到几十个示例程序,这将激发你的编程好奇心。Payne 博士还在 [Udemy][8] 上以相同的名称开设了一门便宜的课程。
|
||||
|
||||
3、Payne 博士的书激起了我的好奇心,我渴望了解更多。这时我发现了 Al Sweigart 的《[用 Python 自动化无聊的东西][9]》。你可以购买这本书,也可以使用它的在线版本,它与印刷版完全相同且可根据知识共享许可免费获得和分享。Al 的这本书让我学习到了 Python 的基础知识、函数、列表、字典和如何操作字符串等等。这是一本很棒的书,我已经购买了许多本捐赠给了当地图书馆。Al 还提供 [Udemy][10] 课程;使用他的网站上的优惠券代码,只需 10 美元即可参加。
|
||||
|
||||
4、Eric Matthes 撰写了《[Python 速成][11]》,这是由 No Starch Press 出版的 Python 的逐步介绍(如同上面的两本书)。Matthes 还有一个很棒的[伴侣网站][12],其中包括了如何在你的计算机上设置 Python 以及一个用以简化学习曲线的[速查表][13]。
|
||||
|
||||
5、[Python for Everybody][14] 是另一个很棒的 Python 学习资源。该网站可以免费访问 [Charles Severance][15] 的 Coursera 和 edX 认证课程的资料。该网站分为入门、课程和素材等部分,其中 17 个课程按从安装到数据可视化的主题进行分类组织。Severance([@drchuck on Twitter][16]),是密歇根大学信息学院的临床教授。
|
||||
|
||||
6、[Seth Kenlon][17],我们 Opensource.com 的 Python 大师,撰写了大量关于 Python 的文章。Seth 有很多很棒的文章,包括“[用 JSON 保存和加载 Python 数据][18]”,“[用 Python 学习面向对象编程][19]”,“[在 Python 游戏中用 Pygame 放置平台][20]”,等等。
|
||||
|
||||
### 在设备上使用 Python
|
||||
|
||||
7、最近我对 [Circuit Playground Express][21] 非常感兴趣,这是一个运行 [CircuitPython][22] 的设备,CircuitPython 是为微控制器设计的 Python 编程语言的子集。我发现 Circuit Playground Express 和 CircuitPython 是向学生介绍 Python(以及一般编程)的好方法。它的制造商 Adafruit 有一个很好的[系列教程][23],可以让你快速掌握 CircuitPython。
|
||||
|
||||
8、[BBC:Microbit][24] 是另一种入门 Python 的好方法。你可以学习如何使用 [MicroPython][25] 对其进行编程,这是另一种用于编程微控制器的 Python 实现。
|
||||
|
||||
9、学习 Python 的文章如果没有提到[树莓派][26]单板计算机那是不完整的。一旦你有了[舒适][27]而强大的树莓派,你就可以在 Opensource.com 上找到[成吨的][28]使用它的灵感,包括“[7 个值得探索的树莓派项目][29]”,“[在树莓派上复活 Amiga][30]”,和“[如何使用树莓派作为 VPN 服务器][31]”。
|
||||
|
||||
10、许多学校为学生提供了 iOS 设备以支持他们的教育。在尝试帮助这些学校的老师和学生学习用 Python 编写代码时,我发现了 [Trinket.io][32]。Trinket 允许你在浏览器中编写和执行 Python 3 代码。 Trinket 的 [Python 入门][33]教程将向你展示如何在 iOS 设备上使用 Python。
|
||||
|
||||
### 播客
|
||||
|
||||
11、我喜欢在开车的时候听播客,我在 Kelly Paredes 和 Sean Tibor 的 [Teaching Python][34] 播客上找到了大量的信息。他们的内容很适合教育领域。
|
||||
|
||||
12、如果你正在寻找一些更通用的东西,我推荐 Michael Kennedy 的 [Talk Python to Me][35] 播客。它提供了有关 Python 及相关技术的最佳信息。
|
||||
|
||||
你学习 Python 最喜欢的资源是什么?请在评论中分享。
|
||||
|
||||
计算机编程可能是一个有趣的爱好,正如我以前在 Apple II 计算机上编程时所学到的……
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/8/dozen-ways-learn-python
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/don-watkins
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_screen_display.jpg?itok=2HMTzqz0 (Code on a screen)
|
||||
[2]: https://insights.stackoverflow.com/survey/2019#most-popular-technologies
|
||||
[3]: https://www.python.org/
|
||||
[4]: https://www.python.org/about/gettingstarted/
|
||||
[5]: https://docs.python.org/3/
|
||||
[6]: https://opensource.com/life/15/8/python-turtle-graphics
|
||||
[7]: https://opensource.com/education/15/9/review-bryson-payne-teach-your-kids-code
|
||||
[8]: https://www.udemy.com/teach-your-kids-to-code/
|
||||
[9]: https://automatetheboringstuff.com/
|
||||
[10]: https://www.udemy.com/automate/?couponCode=PAY_10_DOLLARS
|
||||
[11]: https://nostarch.com/pythoncrashcourse2e
|
||||
[12]: https://ehmatthes.github.io/pcc/
|
||||
[13]: https://ehmatthes.github.io/pcc/cheatsheets/README.html
|
||||
[14]: https://www.py4e.com/
|
||||
[15]: http://www.dr-chuck.com/dr-chuck/resume/bio.htm
|
||||
[16]: https://twitter.com/drchuck/
|
||||
[17]: https://opensource.com/users/seth
|
||||
[18]: https://linux.cn/article-11133-1.html
|
||||
[19]: https://opensource.com/article/19/7/get-modular-python-classes
|
||||
[20]: https://linux.cn/article-10902-1.html
|
||||
[21]: https://opensource.com/article/19/7/circuit-playground-express
|
||||
[22]: https://circuitpython.org/
|
||||
[23]: https://learn.adafruit.com/welcome-to-circuitpython
|
||||
[24]: https://opensource.com/article/19/8/getting-started-bbc-microbit
|
||||
[25]: https://micropython.org/
|
||||
[26]: https://www.raspberrypi.org/
|
||||
[27]: https://projects.raspberrypi.org/en/pathways/getting-started-with-raspberry-pi
|
||||
[28]: https://opensource.com/sitewide-search?search_api_views_fulltext=Raspberry%20Pi
|
||||
[29]: https://opensource.com/article/19/3/raspberry-pi-projects
|
||||
[30]: https://opensource.com/article/19/3/amiga-raspberry-pi
|
||||
[31]: https://opensource.com/article/19/6/raspberry-pi-vpn-server
|
||||
[32]: https://trinket.io/
|
||||
[33]: https://docs.trinket.io/getting-started-with-python#/welcome/where-we-ll-go
|
||||
[34]: https://www.teachingpython.fm/
|
||||
[35]: https://talkpython.fm/
|
||||
@@ -0,0 +1,83 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (VMware boosts load balancing, security intelligence, analytics)
|
||||
[#]: via: (https://www.networkworld.com/article/3434576/vmware-boosts-load-balancing-security-intelligence-analytics.html)
|
||||
[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/)
|
||||
|
||||
VMware boosts load balancing, security intelligence, analytics
|
||||
======
|
||||
At VMworld, VMware says its NSX networking software looks to help customers boost performance, management of virtualized cloud resources.
|
||||
![Thinkstock][1]
|
||||
|
||||
SAN FRANCISCO – VMware has added new features to its core networking software that will let customers more securely control cloud application traffic running on virtual machines, containers or bare metal.
|
||||
|
||||
At its VMworld event, the company announced a new version of the company’s NSX networking software with support for the cloud-based advanced load balancer technology it recently acquired from Avi Networks.
|
||||
|
||||
**[ Also see [How to plan a software-defined data-center network][2] and [Efficient container use requires data-center software networking][3].]**
|
||||
|
||||
The load balancer is included in VMware vRealize Network Insight 5.0 and tied to NSX Intelligence software that lets customers optimize network performance and availability in virtual and physical networks. The load balancer includes a web application firewall and analytics features to help customers securely control and manage traffic.
|
||||
|
||||
[VMware bought Avi in June][4] with the plan to punch up its data-center network-virtualization capabilities by adding Avi’s load balancing, analytics and application-delivery technology to NSX. Avi’s integration with VMware NSX delivers an application-services fabric that synchronizes with the NSX controller to provide automated, elastic load balancing including real-time analytics for applications deployed in a software-defined network environment. The Avi technology also monitors, scales and reconfigures application services in real time in response to changing performance requirements.
|
||||
|
||||
“The load balancer uses a modern interface and architecture to deliver and optimize application delivery in a dynamic fashion," said Rohit Mehra, vice president, Network Infrastructure for IDC. "Leveraging inbuilt advanced analytics and monitoring to deliver scale that is much needed for cloud applications and micro-services, the advanced load balancer will essentially be a nice add-on option to VMware’s NSX networking portfolio. While many customers may benefit from its integration into NSX, VMware will likely keep it as an optional add-on, given the vast majority of its networking clients currently use other ADC platforms.”
|
||||
|
||||
NSX-T Data Center software is targeted at organizations looking to support multivendor cloud-native applications, [bare-metal][5] workloads, [hypervisor][6] environments and the growing hybrid and multi-cloud worlds. The software offers a range of services layer 2 to Layer 7 for workloads running on all types of infrastructure – virtual machines, containers, physical servers and both private and public clouds. NSX-T is the underpinning technology for VMware’s overarching Virtual Cloud Network portfolio that offers a communications-software layer to connect everything from the data center to cloud and edge.
|
||||
|
||||
“NSX now provides a complete set of networking services offered in software. Customers don’t need dedicated hardware systems to do switching, routing or traffic load balancing as NSX treats VM, container and app traffic all the same from the cloud to data center and network edge,” said Tom Gillis, VMware senior vice president and general manager, networking and security business unit.
|
||||
|
||||
Now customers can distribute workloads uniformly across network improving capacity, efficiency and reliability, he said.
|
||||
|
||||
Speaking at the event, a VMware customer said VMware NSX-T Data Center is helping the company secure workloads at a granular level with micro-segmentation, and to fundamentally re-think network design. "We are looking to develop apps as quickly as possible and use NSX to do automation and move faster,” said [Andrew Hrycaj][7], principal network engineer at IHS Markit – a business information provider headquartered in London.
|
||||
|
||||
NSX also helps IT manage a common security policy across different platforms, from containers, to the public cloud with AWS and Azure, to on-prem, simplifying operations and helping with regulatory compliance, while fostering a pervasive security strategy, Hrycaj said.
|
||||
|
||||
At VMworld the company announced version 2.5 of NSX which includes a distributed \analytics engine called NSX Intelligence that VMware says will help eliminate blind spots to reduce security risk and accelerate security-incident remediation through visualization and deep insight into every flow across the entire data center.
|
||||
|
||||
“Traditional approaches involve sending extensive packet data and telemetry to multiple disparate centralized engines for analysis, which increase cost, operational complexity, and limit the depth of analytics,” wrote VMware’s Umesh Mahajan, a senior vice president and general manager networking and security in a [blog about version 2.5][8].
|
||||
|
||||
“In contrast, NSX Intelligence, built natively within the NSX platform, distributes the analytics within the hypervisor on each host, sending back relevant metadata… [and providing] detailed application--topology visualization, automated security-policy recommendations, continuous monitoring of every flow, and an audit trail of security policies, all built into the NSX management console.”
|
||||
|
||||
IDC’s Mehra said: “The NSX Intelligence functionality is indeed very interesting, in that it delivers on the emerging need for deeper visibility and analytics capabilities in cloud IT environments. This can then be used either for network and app optimization goals, or in many cases, will facilitate NSX security and policy enforcement via micro-segmentation and other tools. This functionality, built into NSX, runs parallel to vRealize Network Insight, so it will be interesting to see how they mirror, or rather, complement each other,” he said.
|
||||
|
||||
NSX-T 2.5, also introduces a new deployment and operational approach VMware calls Native Cloud Enforced mode.
|
||||
|
||||
“This mode provides a consistent policy model across the hybrid cloud network and reduces overhead by eliminating the need to install NSX tools in workload VMs in the public cloud,” Mahajan wrote. “The NSX security policies are translated into the cloud provider’s native security constructs via APIs, enabling common and centralized policy enforcement across clouds.”
|
||||
|
||||
Networking software vendor Apstra got into the NSX act by announcing it had more deeply integrated the Apstra Operating System (AOS) with NSX.
|
||||
|
||||
AOS includes a tighter design and operational interoperability between the underlying physical network and software-defined overlay networks with a solution that liberates customers from being locked into any specific network hardware vendor, said Mansour Karam, CEO and founder of Apstra.
|
||||
|
||||
AOS 3.1 adds automation to provide consistent network and security policy for workloads across the physical and virtual/NSX infrastructure, Apstra said. AOS supports VMware vSphere and allows for automatic remediation of network anomalies. AOS’ intent-based analytics perform regular network checks to safeguard configurations between the Apstra managed environment and the vSphere servers are in sync.
|
||||
|
||||
Like other AOS releases, version 3.1 is hardware agnostic and integrated with other networking vendors including Cisco, Arista, Dell and Juniper as well as other vendors such as Microsoft and Cumulus.
|
||||
|
||||
Big Switch also announced that it has extended its Enterprise Virtual Private Cloud (E-VPC) integration to the VMware Cloud Foundation (VCF) and NSX-T. The company's Big Cloud Fabric (BCF) underlay now fully integrates with VMware’s software-defined data center (SDDC) portfolio, including NSX-T, vSphere, VxRail and vSAN, providing unmatched automation, visibility and troubleshooting capabilities.
|
||||
|
||||
Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3434576/vmware-boosts-load-balancing-security-intelligence-analytics.html
|
||||
|
||||
作者:[Michael Cooney][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/Michael-Cooney/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://images.idgesg.net/images/article/2017/09/networking-100735059-large.jpg
|
||||
[2]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html
|
||||
[3]: https://www.networkworld.com/article/3297379/data-center/efficient-container-use-requires-data-center-software-networking.html
|
||||
[4]: https://www.networkworld.com/article/3402981/vmware-eyes-avi-networks-for-data-center-software.html
|
||||
[5]: https://www.networkworld.com/article/3261113/why-a-bare-metal-cloud-provider-might-be-just-what-you-need.html?nsdr=true
|
||||
[6]: https://www.networkworld.com/article/3243262/what-is-a-hypervisor.html?nsdr=true
|
||||
[7]: https://www.networkworld.com/article/3223189/how-network-automation-can-speed-deployments-and-improve-security.html
|
||||
[8]: https://blogs.vmware.com/networkvirtualization/2019/08/nsx-t-2-5.html/
|
||||
[9]: https://www.facebook.com/NetworkWorld/
|
||||
[10]: https://www.linkedin.com/company/network-world
|
||||
@@ -1,196 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Install Ansible (Automation Tool) on Debian 10 (Buster))
|
||||
[#]: via: (https://www.linuxtechi.com/install-ansible-automation-tool-debian10/)
|
||||
[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/)
|
||||
|
||||
How to Install Ansible (Automation Tool) on Debian 10 (Buster)
|
||||
======
|
||||
|
||||
Now a days in IT field, automation is the hot topic and every organization is start adopting the automation tools like **Puppet**, **Ansible**, **Chef**, **CFEngine**, **Foreman** and **Katello**. Out of these tools Ansible is the first choice of almost all the IT organization to manage UNIX and Linux like systems. In this article we will demonstrate on how to install and use ansible tool on Debian 10 Sever.
|
||||
|
||||
[![Ansible-Install-Debian10][1]][2]
|
||||
|
||||
My Lab details:
|
||||
|
||||
* Debian 10 – Ansible Server/ controller Node – 192.168.1.14
|
||||
* CentOS 7 – Ansible Host (Web Server) – 192.168.1.15
|
||||
* CentOS 7 – Ansible Host (DB Server) – 192.169.1.17
|
||||
|
||||
|
||||
|
||||
We will also demonstrate how Linux Servers can be managed using Ansible Server
|
||||
|
||||
### Ansible Installation on Debian 10 Server
|
||||
|
||||
I am assuming in your Debian 10 system you have a user which has either root privileges or sudo rights. In my setup I have a local user named “pkumar” with sudo rights.
|
||||
|
||||
Ansible 2.7 packages are available in default Debian 10 repositories, run the following commands from command line to install Ansible,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo apt update
|
||||
root@linuxtechi:~$ sudo apt install ansible -y
|
||||
```
|
||||
|
||||
Run the below command to verify the ansible version,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible --version
|
||||
```
|
||||
|
||||
![ansible-version][1]
|
||||
|
||||
To Install latest version of Ansible 2.8, first we must set Ansible repositories.
|
||||
|
||||
Execute the following commands one after the another,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" | sudo tee -a /etc/apt/sources.list
|
||||
root@linuxtechi:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
|
||||
root@linuxtechi:~$ sudo apt update
|
||||
root@linuxtechi:~$ sudo apt install ansible -y
|
||||
root@linuxtechi:~$ sudo ansible --version
|
||||
```
|
||||
|
||||
![latest-ansible-version][1]
|
||||
|
||||
### Managing Linux Servers using Ansible
|
||||
|
||||
Refer the following steps to manage Linux like servers using Ansible controller node,
|
||||
|
||||
### Step:1) Exchange the SSH keys between Ansible Server and its hosts
|
||||
|
||||
Generate the ssh keys from ansible server and shared the keys among the ansible hosts
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo -i
|
||||
root@linuxtechi:~# ssh-keygen
|
||||
root@linuxtechi:~# ssh-copy-id root@linuxtechi
|
||||
root@linuxtechi:~# ssh-copy-id root@linuxtechi
|
||||
```
|
||||
|
||||
### Step:2) Create Ansible Hosts inventory file
|
||||
|
||||
When ansible is installed then /etc/hosts file is created created automatically, in this file we can mentioned the ansible hosts or its clients. We can also create our own ansible host inventory file in our home directory,
|
||||
|
||||
Read More on : [**How to Manage Ansible Static and Dynamic Host Inventory**][3]
|
||||
|
||||
Run the below command to create ansible hosts inventory in our home directory
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ vi $HOME/hosts
|
||||
[Web]
|
||||
192.168.1.15
|
||||
|
||||
[DB]
|
||||
192.168.1.17
|
||||
```
|
||||
|
||||
Save and exit the file
|
||||
|
||||
**Note:** In above hosts file we can also use host name or FQDN as well but for that we have to make sure that ansible hosts are reachable and accessible by hostname or fqdn.
|
||||
|
||||
### Step:3) Test and Use default ansible modules
|
||||
|
||||
Ansible comes with lot of default modules which can used in ansible command, examples are shown below,
|
||||
|
||||
Syntax:
|
||||
|
||||
# ansible -i <host_file> -m <module> <host>
|
||||
|
||||
Where:
|
||||
|
||||
* **-i ~/hosts**: contains list of ansible hosts
|
||||
* **-m:** after -m specify the ansible module like ping & shell
|
||||
* **<host>:** Ansible hosts where we want to run the ansible modules
|
||||
|
||||
|
||||
|
||||
Verify ping connectivity using ansible ping module
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping all
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping Web
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping DB
|
||||
```
|
||||
|
||||
Output of above commands would be something like below:
|
||||
|
||||
![Ansible-ping-module-examples][1]
|
||||
|
||||
Running shell commands on ansible hosts using shell module
|
||||
|
||||
**Syntax:** # ansible -i <hosts_file> -m shell -a <shell_commands> <host>
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime" all
|
||||
192.168.1.17 | CHANGED | rc=0 >>
|
||||
01:48:34 up 1:07, 3 users, load average: 0.00, 0.01, 0.05
|
||||
|
||||
192.168.1.15 | CHANGED | rc=0 >>
|
||||
01:48:39 up 1:07, 3 users, load average: 0.00, 0.01, 0.04
|
||||
|
||||
root@linuxtechi:~$
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime ; df -Th / ; uname -r" Web
|
||||
192.168.1.15 | CHANGED | rc=0 >>
|
||||
01:52:03 up 1:11, 3 users, load average: 0.12, 0.07, 0.06
|
||||
Filesystem Type Size Used Avail Use% Mounted on
|
||||
/dev/mapper/centos-root xfs 13G 1017M 12G 8% /
|
||||
3.10.0-327.el7.x86_64
|
||||
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
Above commands output confirms that we have successfully setup ansible controller node
|
||||
|
||||
Let’s create a sample NGINX installation playbook, below playbook will install nginx on all server which are part of Web host group, but in my case I have one centos 7 machine under this host group.
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ vi nginx.yaml
|
||||
---
|
||||
- hosts: Web
|
||||
tasks:
|
||||
- name: Install latest version of nginx on CentOS 7 Server
|
||||
yum: name=nginx state=latest
|
||||
- name: start nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: started
|
||||
```
|
||||
|
||||
Now execute the playbook using following command,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible-playbook -i ~/hosts nginx.yaml
|
||||
```
|
||||
|
||||
output of above command would be something like below,
|
||||
|
||||
![nginx-installation-playbook-debian10][1]
|
||||
|
||||
This confirms that Ansible playbook has been executed successfully, that’s all from article, please do share your feedback and comments.
|
||||
|
||||
Read Also: [**How to Download and Use Ansible Galaxy Roles in Ansible Playbook**][4]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/install-ansible-automation-tool-debian10/
|
||||
|
||||
作者:[Pradeep Kumar][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.linuxtechi.com/author/pradeep/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Ansible-Install-Debian10.jpg
|
||||
[3]: https://www.linuxtechi.com/manage-ansible-static-and-dynamic-host-inventory/
|
||||
[4]: https://www.linuxtechi.com/use-ansible-galaxy-roles-ansible-playbook/
|
||||
@@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (A dozen ways to learn Python)
|
||||
[#]: via: (https://opensource.com/article/19/8/dozen-ways-learn-python)
|
||||
[#]: author: (Don WatkinsDorris Scott https://opensource.com/users/don-watkinshttps://opensource.com/users/don-watkinshttps://opensource.com/users/chris-engelhardthttps://opensource.com/users/momiji15https://opensource.com/users/asingh31https://opensource.com/users/pshapirohttps://opensource.com/users/greg-phttps://opensource.com/users/don-watkinshttps://opensource.com/users/holmjahttps://opensource.com/users/don-watkins)
|
||||
|
||||
A dozen ways to learn Python
|
||||
======
|
||||
These resources will get you started and well on your way to proficiency
|
||||
with Python.
|
||||
![Code on a screen][1]
|
||||
|
||||
Python is [one of the most popular][2] programming languages on the planet. It's embraced by developers and makers everywhere. Most Linux and MacOS computers come with a version of Python pre-installed, and now even a few Windows computer vendors are installing Python too.
|
||||
|
||||
Maybe you're late to the party, and you want to learn but don't know where to turn. These 12 resources will get you started and well on your way to proficiency with Python.
|
||||
|
||||
### Courses, books, articles, and documentation
|
||||
|
||||
1. The [Python Software Foundation][3] has excellent information and documentation to help you get started on your coding journey. Be sure to check out the [Python for beginners][4] guide. It will help you get the latest version of Python and offers helpful tips on editors and development environments. The organization also has [excellent documentation][5] to guide you.
|
||||
2. My Python journey began with the [Turtle module][6]. I first found answers to my questions about Python and the Turtle in Bryson Payne's _[Teach Your Kids to Code][7]_. The book is a great resource, and buying it gives you access to dozens of example programs that will spark your programming curiosity. Dr. Payne also teaches an inexpensive course by the same title on [Udemy][8].
|
||||
3. Dr. Payne's book piqued my curiosity, and I yearned to learn more. This was when I discovered _[Automate the Boring Stuff with Python][9]_ by Al Sweigart. You can buy the book or use the online materials, which are identical to the print edition and freely available and shareable under a Creative Commons license. Thanks to Al, I learned Python basics, functions, lists, dictionaries, manipulating strings, and much more. It's a great book, and I have purchased many copies to donate to local libraries. Al also offers a course on [Udemy][10]; with a coupon code on his website, you can get it for only $10.
|
||||
4. Eric Matthes wrote _[Python Crash Course][11]_, a step-by-step introduction to Python published (like the two books above) by No Starch Press. Matthes also has a wonderful [companion website][12] that includes how to set up Python on your computer as well as links to [cheat sheets][13] to ease the learning curve.
|
||||
5. [Python for Everybody][14] is another great Python learning resource. The site offers free access to materials from [Charles Severance][15]'s Coursera and edX certification courses. The site is divided into Get Started, Lessons, and Materials sections, with its 17 lessons well-organized by topic area, from installation to data visualization. Severance, [@drchuck on Twitter][16], is a clinical professor in the School of Information at the University of Michigan.
|
||||
6. [Seth Kenlon][17], our master Pythonista at Opensource.com, has written extensively about Python. Seth has many great articles, including "[Save and load Python data with JSON][18]," "[Learn object-oriented programming with Python][19]," "[Put platforms in a Python game with Pygame][20]," and many more.
|
||||
|
||||
|
||||
|
||||
### Use Python on devices
|
||||
|
||||
7. Recently I have become very interested in the [Circuit Playground Express][21], a device that runs on [CircuitPython][22], a subset of the Python programming language designed for microcontrollers. I have found that the Circuit Playground Express and CircuitPython are great ways to introduce students to Python (and programming in general). Its maker, Adafruit, has an excellent [series of tutorials][23] that will get you up to speed with CircuitPython.
|
||||
8. A [BBC:Microbit][24] is another great way to get started with Python. You can learn how to program it with [MicroPython][25], another Python implementation for programming microcontrollers.
|
||||
9. No article about learning Python would be complete without mentioning the [Raspberry Pi][26] single-board computer. Once you [get comfortable][27] with the mighty Pi, you can find a [ton of ideas][28] on Opensource.com for using it, including "[7 Raspberry Pi projects to explore][29]," "[Resurrecting the Amiga on the Raspberry Pi][30]," and "[How to use your Raspberry Pi as a VPN server][31]."
|
||||
10. A lot of schools provide students with iOS devices to support their education. While trying to help teachers and students in these schools learn to code with Python, I discovered [Trinket.io][32]. Trinket allows you to write and execute Python 3 code in a browser. Trinket's [Getting started with Python][33] tutorial will show you how to use Python on your iOS device.
|
||||
|
||||
|
||||
|
||||
### Podcasts
|
||||
|
||||
11. I enjoy listening to podcasts when I am driving, and I have found a wealth of information on [Teaching Python][34] with Kelly Paredes and Sean Tibor. Their content is well-tuned to the education space.
|
||||
12. If you're looking for something a little more general, I recommend Michael Kennedy's [Talk Python to Me][35] podcast. It offers excellent information about what's going on in Python and related technologies.
|
||||
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
What is your favorite resource for learning Python? Please share it in the comments.
|
||||
|
||||
Computer programming can be a fun hobby, as I learned when I programmed Apple II computers last...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/8/dozen-ways-learn-python
|
||||
|
||||
作者:[Don WatkinsDorris Scott][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/don-watkinshttps://opensource.com/users/don-watkinshttps://opensource.com/users/chris-engelhardthttps://opensource.com/users/momiji15https://opensource.com/users/asingh31https://opensource.com/users/pshapirohttps://opensource.com/users/greg-phttps://opensource.com/users/don-watkinshttps://opensource.com/users/holmjahttps://opensource.com/users/don-watkins
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_screen_display.jpg?itok=2HMTzqz0 (Code on a screen)
|
||||
[2]: https://insights.stackoverflow.com/survey/2019#most-popular-technologies
|
||||
[3]: https://www.python.org/
|
||||
[4]: https://www.python.org/about/gettingstarted/
|
||||
[5]: https://docs.python.org/3/
|
||||
[6]: https://opensource.com/life/15/8/python-turtle-graphics
|
||||
[7]: https://opensource.com/education/15/9/review-bryson-payne-teach-your-kids-code
|
||||
[8]: https://www.udemy.com/teach-your-kids-to-code/
|
||||
[9]: https://automatetheboringstuff.com/
|
||||
[10]: https://www.udemy.com/automate/?couponCode=PAY_10_DOLLARS
|
||||
[11]: https://nostarch.com/pythoncrashcourse2e
|
||||
[12]: https://ehmatthes.github.io/pcc/
|
||||
[13]: https://ehmatthes.github.io/pcc/cheatsheets/README.html
|
||||
[14]: https://www.py4e.com/
|
||||
[15]: http://www.dr-chuck.com/dr-chuck/resume/bio.htm
|
||||
[16]: https://twitter.com/drchuck/
|
||||
[17]: https://opensource.com/users/seth
|
||||
[18]: https://opensource.com/article/19/7/save-and-load-data-python-json
|
||||
[19]: https://opensource.com/article/19/7/get-modular-python-classes
|
||||
[20]: https://opensource.com/article/18/7/put-platforms-python-game
|
||||
[21]: https://opensource.com/article/19/7/circuit-playground-express
|
||||
[22]: https://circuitpython.org/
|
||||
[23]: https://learn.adafruit.com/welcome-to-circuitpython
|
||||
[24]: https://opensource.com/article/19/8/getting-started-bbc-microbit
|
||||
[25]: https://micropython.org/
|
||||
[26]: https://www.raspberrypi.org/
|
||||
[27]: https://projects.raspberrypi.org/en/pathways/getting-started-with-raspberry-pi
|
||||
[28]: https://opensource.com/sitewide-search?search_api_views_fulltext=Raspberry%20Pi
|
||||
[29]: https://opensource.com/article/19/3/raspberry-pi-projects
|
||||
[30]: https://opensource.com/article/19/3/amiga-raspberry-pi
|
||||
[31]: https://opensource.com/article/19/6/raspberry-pi-vpn-server
|
||||
[32]: https://trinket.io/
|
||||
[33]: https://docs.trinket.io/getting-started-with-python#/welcome/where-we-ll-go
|
||||
[34]: https://www.teachingpython.fm/
|
||||
[35]: https://talkpython.fm/
|
||||
313
sources/tech/20190828 Introduction to the Linux chmod command.md
Normal file
313
sources/tech/20190828 Introduction to the Linux chmod command.md
Normal file
@@ -0,0 +1,313 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Introduction to the Linux chmod command)
|
||||
[#]: via: (https://opensource.com/article/19/8/linux-chmod-command)
|
||||
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdosshttps://opensource.com/users/mralexjuarezhttps://opensource.com/users/brsonhttps://opensource.com/users/seth)
|
||||
|
||||
Introduction to the Linux chmod command
|
||||
======
|
||||
Chmod, which sets read, write, and execute permissions, is one of the
|
||||
most important Linux security commands.
|
||||
![5 pengiuns floating on iceburg][1]
|
||||
|
||||
Every object on your Linux system has a permission mode that describes what actions a user can perform on it. There are three types of permissions: read (**r**), write (**w**), and execute (**x**).
|
||||
|
||||
To **read** a file is to view its contents. For example, a text file must have **read** permission for someone to read the text within. If the user wants to add a sentence to that file, it needs **write** permission. The **execute** permission enables someone to run a file, such as a shell script or a binary program file.
|
||||
|
||||
### Basic permissions
|
||||
|
||||
The **ls -l** command displays the permissions assigned to a file. For example:
|
||||
|
||||
|
||||
```
|
||||
ls -l
|
||||
-rw-rw-r-- 1 bruce bruce 0 Jul 30 16:25 schedule1.txt
|
||||
```
|
||||
|
||||
Some permissions (**rw**) appear more than once because they are referring to different entities: _user_, _group_, and _other_. _User_ is synonymous with the owner, and _group_ refers to the user's primary group, both of which are **bruce**. _Other_ refers to all other users.
|
||||
|
||||
The first position denotes the object's type: **-** for a file, **d** for a directory, and **l** for a symbolic link. The next nine positions are grouped in threes and describe the permission mode. The positions are ordered **r**,**w**,**x**, and the groups are ordered **user**, **group**, **other**.
|
||||
|
||||
\--- --- --- | rwx rwx rwx
|
||||
---|---
|
||||
uuu ggg ooo | u=user, g=group, o=other
|
||||
|
||||
#### Files
|
||||
|
||||
A file with read, write, and execute bits set for all entities would appear:
|
||||
|
||||
|
||||
```
|
||||
`rwxrwxrwx`
|
||||
```
|
||||
|
||||
Of course, we don't usually configure files this permissively in the real world; this is just an illustration of how each position is used.
|
||||
|
||||
In the following example, a file is configured for its owner (**pablo**) to have read and write permissions, for members of the group to only have read permission, and for everyone else to have no permissions.
|
||||
|
||||
|
||||
```
|
||||
`-rw-r----- 1 pablo pablo 0 Jul 30 16:25 textfile`
|
||||
```
|
||||
|
||||
The **chmod** command modifies the permission mode of objects in the system. It is one of the most used and important commands in the set of Linux security commands.
|
||||
|
||||
A plus (**+**) symbol adds a permission, and a minus (**-**) symbol removes a permission. You can read **chmod u+r** as "user plus read," as it gives the user _read_ permission. The command **chmod u-r** means "user minus read," as it takes the _read_ permission away from the user.
|
||||
|
||||
#### Directories
|
||||
|
||||
The same three permissions also apply to a directory. A directory must have the _read_ permission for a user to view its contents. It will need _write_ permission for a user to add to the directory (e.g., to create a new file). For a user to change to a directory (**cd**), it must have _execute_ permission.
|
||||
|
||||
|
||||
```
|
||||
`drw-rw-r-- 2 pablo pablo 4096 Jul 30 15:56 JBOSS`
|
||||
```
|
||||
|
||||
Pablo may be the owner of the JBOSS directory, but since he doesn't have execute permission, he can not **cd** into it. He can use the command **chmod u+x** to add the permission, and then he can **cd** into it.
|
||||
|
||||
|
||||
```
|
||||
$ cd JBOSS
|
||||
bash: cd: JBOSS: Permission denied
|
||||
$ chmod u+x JBOSS
|
||||
$ ls -l
|
||||
drwxrw-r-- 2 pablo pablo 4096 Jul 30 15:56 JBOSS
|
||||
$ cd JBOSS
|
||||
$ pwd
|
||||
/opt/JBOSS
|
||||
```
|
||||
|
||||
#### Combined arguments
|
||||
|
||||
You can combine arguments using a comma. In this example, you only need one command to set permissions so the group cannot write to a file nor can the rest of the world read it:
|
||||
|
||||
|
||||
```
|
||||
$ chmod o-r,g-w readme.txt
|
||||
$ ls -l
|
||||
-rw-r----- 1 pablo share 0 Jul 31 13:34 readme.txt
|
||||
```
|
||||
|
||||
You can read this as "others minus read and group minus write."
|
||||
|
||||
Suppose Denise has written a Bash script called **home_backup.sh** and wants to give it _execute_ permission. She also wants to prevent anyone else from reading, writing, or executing it. One way to do this is with the plus and minus symbols:
|
||||
|
||||
|
||||
```
|
||||
`$ chmod go-rw,u+x home_backup.sh`
|
||||
```
|
||||
|
||||
Another way is by using the equals (**=**) symbol. This will set the permissions absolutely without regard for previous settings. Note that there is a space after the second equals; this indicates a value of **none**:
|
||||
|
||||
|
||||
```
|
||||
`$ chmod u=rwx,go= home_backup.sh`
|
||||
```
|
||||
|
||||
You can read this as "permissions for user equal read, write, and execute and permissions for group and other equal none."
|
||||
|
||||
### Numeric mode
|
||||
|
||||
Chmod also supports a numeric mode, which uses values assigned to each position:
|
||||
|
||||
owner
|
||||
|
||||
group
|
||||
|
||||
other
|
||||
|
||||
r
|
||||
|
||||
w
|
||||
|
||||
x
|
||||
|
||||
r
|
||||
|
||||
w
|
||||
|
||||
x
|
||||
|
||||
r
|
||||
|
||||
w
|
||||
|
||||
x
|
||||
|
||||
400
|
||||
|
||||
200
|
||||
|
||||
100
|
||||
|
||||
40
|
||||
|
||||
20
|
||||
|
||||
10
|
||||
|
||||
4
|
||||
|
||||
2
|
||||
|
||||
1
|
||||
|
||||
The total value of a set of permissions can be calculated and passed to the chmod command as a single argument. Take the example with Denise and her backup script. If she uses numeric mode to set the permissions on her script, she must first calculate the value total:
|
||||
|
||||
|
||||
```
|
||||
`-rwx------ 1 denise denise 0 Jul 31 13:53 home_backup.sh`
|
||||
```
|
||||
|
||||
Denise adds the numbers that correspond to each permission she wants to apply:
|
||||
|
||||
**400 + 200 + 100 = 700**
|
||||
|
||||
Her command will be **chmod 700 home_backup.sh**. Suppose Denise wanted to reset the original permissions on the file:
|
||||
|
||||
|
||||
```
|
||||
`-rw-rw-r-- 1 denise denise 0 Jul 31 13:53 home_backup.sh`
|
||||
```
|
||||
|
||||
The value of these permissions calculates to 664:
|
||||
|
||||
**400 + 200 + 40 + 20 + 4 = 664**
|
||||
|
||||
Denise can use the command **chmod 664 home_backup.sh** to restore the original permissions.
|
||||
|
||||
### Special modes
|
||||
|
||||
Three other modes can be set on an object:
|
||||
|
||||
name | symbolic | numeric
|
||||
---|---|---
|
||||
setuid | s | 4000
|
||||
setgid | s | 2000
|
||||
sticky | t | 1000
|
||||
|
||||
The **SetUID** bit enforces user ownership on an executable file. When it is set, the file will execute with the file owner's user ID, not the person running it.
|
||||
|
||||
|
||||
```
|
||||
`$ chmod u+s`
|
||||
```
|
||||
|
||||
The **SetGID** bit enforces group ownership on files and directories. When it is set, any file or directory created in a directory will get the directory's group ownership, not the user's. When it is set on a file, the file will always be executed as its owning group rather than as the user:
|
||||
|
||||
|
||||
```
|
||||
`$ chmod g+s`
|
||||
```
|
||||
|
||||
The **sticky** bit, also referred to as the "restricted deletion flag," can be set on a directory to prevent anyone except the directory's owner from deleting a file in that directory:
|
||||
|
||||
|
||||
```
|
||||
`$ chmod o+t`
|
||||
```
|
||||
|
||||
The sticky bit can be set in numerical mode by adding its value to those of the other permissions. If you have an object with a value of 755 and you want to set the sticky bit, add 1000:
|
||||
|
||||
**1000 + 400 + 200 + 100 + 40 + 10 + 4 + 1 = 1755**
|
||||
|
||||
This command would be **chmod 1755**. Several symbolic methods are equivalent; one example is **chmod u=rwx,go=rx,o+t**.
|
||||
|
||||
### Extras
|
||||
|
||||
The letter **a** is a shortcut to assign permissions to all users. The command **chmod a+rwx** is equivalent to **chmod ugo+rwx**.
|
||||
|
||||
#### Recursive
|
||||
|
||||
Like many other Linux commands, chmod has a recursive argument, **-R**, which allows you to operate on a directory and its contents recursively. By recursive, It is meant that the command will attempt to operate on all objects below the specified directory rather than just the directory itself. This example starts in an empty directory and adds the **-v** (verbose) argument, so chmod will report what it is doing:
|
||||
|
||||
|
||||
```
|
||||
$ ls -l . conf
|
||||
.:
|
||||
drwxrwxr-x 2 alan alan 4096 Aug 5 15:33 conf
|
||||
|
||||
conf:
|
||||
-rw-rw-r-- 1 alan alan 0 Aug 5 15:33 conf.xml
|
||||
$ chmod -vR 700 conf
|
||||
mode of 'conf' changed from 0775 (rwxrwxr-x) to 0700 (rwx------)
|
||||
mode of 'conf/conf.xml' changed from 0664 (rw-rw-r--) to 0700 (rwx------)
|
||||
```
|
||||
|
||||
#### Reference
|
||||
|
||||
A reference file command (**\--reference=RFILE**) can be used to duplicate the mode of another file (**RFILE**), known as a reference file. This is handy when you are changing modes on files to match a certain configuration or when you don't know the exact mode—or don't want to take time to calculate it:
|
||||
|
||||
|
||||
```
|
||||
$ ls -l
|
||||
-rw-r--r-x 1 alan alan 0 Aug 5 17:10 notes.txt
|
||||
-rw-rw-r-- 1 alan alan 0 Aug 5 17:10 readme.txt
|
||||
$ chmod --reference=readme.txt notes.txt
|
||||
$ ls -l
|
||||
-rw-rw-r-- 1 alan alan 0 Aug 5 17:10 notes.txt
|
||||
-rw-rw-r-- 1 alan alan 0 Aug 5 17:10 readme.txt
|
||||
```
|
||||
|
||||
#### Report changes
|
||||
|
||||
The chmod command also has a **-c** (**\--changes**) argument, which tells chmod to report only when a change is made (versus **-v**, or **-verbose**, which tells chmod to report all its output). Chmod will still report other things, such as if an operation is not allowed.
|
||||
|
||||
The argument **-f** (**\--silent**, **\--quiet**) suppresses most error messages. Using this argument with **-c** will show only real changes.
|
||||
|
||||
#### Preserve root
|
||||
|
||||
The root (**/**) of the Linux filesystem should be treated with great respect. If someone makes a command mistake at this level, the consequences can be terrible and leave a system completely useless, particularly when you are running a recursive command that will make any kind of change—or worse: deletions. Fortunately, the chmod command's **\--preserve-root** argument will protect and preserve the root. If the argument is used with a recursive chmod command on the root, nothing will happen, and you will see this message:
|
||||
|
||||
|
||||
```
|
||||
[alan@localhost ~]# chmod -cfR --preserve-root a+w /
|
||||
chmod: it is dangerous to operate recursively on '/'
|
||||
chmod: use --no-preserve-root to override this failsafe
|
||||
```
|
||||
|
||||
The option has no effect when it is not used with recursive. However, if the root user runs the command, the permissions of the **/** will change, but not those of other files or directories.
|
||||
|
||||
|
||||
```
|
||||
[alan@localhost ~]$ chmod -c --preserve-root a+w /
|
||||
chmod: changing permissions of '/': Operation not permitted
|
||||
[root@localhost /]# chmod -c --preserve-root a+w /
|
||||
mode of '/' changed from 0555 (r-xr-xr-x) to 0777 (rwxrwxrwx)
|
||||
```
|
||||
|
||||
Surprisingly, this is not the default argument; **\--no-preserve-root** is. If you run a command without the "preserve" option, it will default to "no preserve" mode and possibly change permissions on files that shouldn't be changed.
|
||||
|
||||
|
||||
```
|
||||
[alan@localhost ~]$ chmod -cfR a+x /
|
||||
mode of '/proc/1525/task/1525/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
|
||||
mode of '/proc/1541/task/1541/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
|
||||
mode of '/proc/1541/task/1580/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
|
||||
mode of '/proc/1541/task/1592/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
|
||||
mode of '/proc/1557/task/1557/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
|
||||
mode of '/proc/1558/task/1558/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
|
||||
mode of '/proc/1561/task/1561/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
All objects on a Linux system have a set of permissions. It is important to check and maintain them occasionally to prevent unwanted access.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/8/linux-chmod-command
|
||||
|
||||
作者:[Alan Formy-Duval][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/alanfdosshttps://opensource.com/users/mralexjuarezhttps://opensource.com/users/brsonhttps://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg)
|
||||
@@ -0,0 +1,174 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Managing Ansible environments on MacOS with Conda)
|
||||
[#]: via: (https://opensource.com/article/19/8/using-conda-ansible-administration-macos)
|
||||
[#]: author: (James Farrell https://opensource.com/users/jamesf)
|
||||
|
||||
Managing Ansible environments on MacOS with Conda
|
||||
======
|
||||
Conda corrals everything you need for Ansible into a virtual environment
|
||||
and keeps it separate from your other projects.
|
||||
![CICD with gears][1]
|
||||
|
||||
If you are a Python developer using MacOS and involved with Ansible administration, you may want to use the Conda package manager to keep your Ansible work separate from your core OS and other local projects.
|
||||
|
||||
Ansible is based on Python. Conda is not required to make Ansible work on MacOS, but it does make managing Python versions and package dependencies easier. This allows you to use an upgraded Python version on MacOS and keep Python package dependencies separate between your system, Ansible, and other programming projects.
|
||||
|
||||
There are other ways to install Ansible on MacOS. You could use [Homebrew][2], but if you are into Python development (or Ansible development), you might find managing Ansible in a Python virtual environment reduces some confusion. I find this to be simpler; rather than trying to load a Python version and dependencies into the system or in **/usr/local**, Conda helps me corral everything I need for Ansible into a virtual environment and keep it all completely separate from other projects.
|
||||
|
||||
This article focuses on using Conda to manage Ansible as a Python project to keep it clean and separated from other projects. Read on to learn how to install Conda, create a new virtual environment, install Ansible, and test it.
|
||||
|
||||
### Prelude
|
||||
|
||||
Recently, I wanted to learn [Ansible][3], so I needed to figure out the best way to install it.
|
||||
|
||||
I am generally wary of installing things into my daily use workstation. I especially dislike applying manual updates to the vendor's default OS installation (a preference I developed from years of Unix system administration). I really wanted to use Python 3.7, but MacOS packages the older 2.7, and I was not going to install any global Python packages that might interfere with the core MacOS system.
|
||||
|
||||
So, I started my Ansible work using a local Ubuntu 18.04 virtual machine. This provided a real level of safe isolation, but I soon found that managing it was tedious. I set out to see how to get a flexible but isolated Ansible system on native MacOS.
|
||||
|
||||
Since Ansible is based on Python, Conda seemed to be the ideal solution.
|
||||
|
||||
### Installing Conda
|
||||
|
||||
Conda is an open source utility that provides convenient package- and environment-management features. It can help you manage multiple versions of Python, install package dependencies, perform upgrades, and maintain project isolation. If you are manually managing Python virtual environments, Conda will help streamline and manage your work. Surf on over to the [Conda documentation][4] for all the details.
|
||||
|
||||
I chose the [Miniconda][5] Python 3.7 installation for my workstation because I wanted the latest Python version. Regardless of which version you select, you can always install new virtual environments with other versions of Python.
|
||||
|
||||
To install Conda, download the PKG format file, do the usual double-click, and select the "Install for me only" option. The install took about 158MB of space on my system.
|
||||
|
||||
After the installation, bring up a terminal to see what you have. You should see:
|
||||
|
||||
* A new **miniconda3** directory in your **home**
|
||||
* The shell prompt modified to prepend the word "(base)"
|
||||
* **.bash_profile** updated with Conda-specific settings
|
||||
|
||||
|
||||
|
||||
Now that the base is installed, you have your first Python virtual environment. Running the usual Python version check should prove this, and your PATH will point to the new location:
|
||||
|
||||
|
||||
```
|
||||
(base) $ which python
|
||||
/Users/jfarrell/miniconda3/bin/python
|
||||
(base) $ python --version
|
||||
Python 3.7.1
|
||||
```
|
||||
|
||||
Now that Conda is installed, the next step is to set up a virtual environment, then get Ansible installed and running.
|
||||
|
||||
### Creating a virtual environment for Ansible
|
||||
|
||||
I want to keep Ansible separate from my other Python projects, so I created a new virtual environment and switched over to it:
|
||||
|
||||
|
||||
```
|
||||
(base) $ conda create --name ansible-env --clone base
|
||||
(base) $ conda activate ansible-env
|
||||
(ansible-env) $ conda env list
|
||||
```
|
||||
|
||||
The first command clones the Conda base into a new virtual environment called **ansible-env**. The clone brings in the Python 3.7 version and a bunch of default Python modules that you can add to, remove, or upgrade as needed.
|
||||
|
||||
The second command changes the shell context to this new **ansible-env** environment. It sets the proper paths for Python and the modules it contains. Notice that your shell prompt changes after the **conda activate ansible-env** command.
|
||||
|
||||
The third command is not required; it lists what Python modules are installed with their version and other data.
|
||||
|
||||
You can always switch out of a virtual environment and into another with Conda's **activate** command. This will bring you back to the base: **conda activate base**.
|
||||
|
||||
### Installing Ansible
|
||||
|
||||
There are various ways to install Ansible, but using Conda keeps the Ansible version and all desired dependencies packaged in one place. Conda provides the flexibility both to keep everything separated and to add in other new environments as needed (as I'll demonstrate later).
|
||||
|
||||
To install a relatively recent version of Ansible, use:
|
||||
|
||||
|
||||
```
|
||||
(base) $ conda activate ansible-env
|
||||
(ansible-env) $ conda install -c conda-forge ansible
|
||||
```
|
||||
|
||||
Since Ansible is not part of Conda's default channels, the **-c** is used to search and install from an alternate channel. Ansible is now installed into the **ansible-env** virtual environment and is ready to use.
|
||||
|
||||
### Using Ansible
|
||||
|
||||
Now that you have installed a Conda virtual environment, you're ready to use it. First, make sure the node you want to control has your workstation's SSH key installed to the right user account.
|
||||
|
||||
Bring up a new shell and run some basic Ansible commands:
|
||||
|
||||
|
||||
```
|
||||
(base) $ conda activate ansible-env
|
||||
(ansible-env) $ ansible --version
|
||||
ansible 2.8.1
|
||||
config file = None
|
||||
configured module search path = ['/Users/jfarrell/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
|
||||
ansible python module location = /Users/jfarrell/miniconda3/envs/ansibleTest/lib/python3.7/site-packages/ansible
|
||||
executable location = /Users/jfarrell/miniconda3/envs/ansibleTest/bin/ansible
|
||||
python version = 3.7.1 (default, Dec 14 2018, 13:28:58) [Clang 4.0.1 (tags/RELEASE_401/final)]
|
||||
(ansible-env) $ ansible all -m ping -u ansible
|
||||
192.168.99.200 | SUCCESS => {
|
||||
"ansible_facts": {
|
||||
"discovered_interpreter_python": "/usr/bin/python"
|
||||
},
|
||||
"changed": false,
|
||||
"ping": "pong"
|
||||
}
|
||||
```
|
||||
|
||||
Now that Ansible is working, you can pull your playbooks out of source control and start using them from your MacOS workstation.
|
||||
|
||||
### Cloning the new Ansible for Ansible development
|
||||
|
||||
This part is purely optional; it's only needed if you want additional virtual environments to modify Ansible or to safely experiment with questionable Python modules. You can clone your main Ansible environment into a development copy with:
|
||||
|
||||
|
||||
```
|
||||
(ansible-env) $ conda create --name ansible-dev --clone ansible-env
|
||||
(ansible-env) $ conda activte ansible-dev
|
||||
(ansible-dev) $
|
||||
```
|
||||
|
||||
### Gotchas to look out for
|
||||
|
||||
Occasionally you may get into trouble with Conda. You can usually delete a bad environment with:
|
||||
|
||||
|
||||
```
|
||||
$ conda activate base
|
||||
$ conda remove --name ansible-dev --all
|
||||
```
|
||||
|
||||
If you get errors that you cannot resolve, you can usually delete the environment directly by finding it in **~/miniconda3/envs** and removing the entire directory. If the base becomes corrupt, you can remove the entire **~/miniconda3** directory and reinstall it from the PKG file. Just be sure to preserve any desired environments you have in **~/miniconda3/envs**, or use the Conda tools to dump the environment configuration and recreate it later.
|
||||
|
||||
The **sshpass** program is not included on MacOS. It is needed only if your Ansible work requires you to supply Ansible with an SSH login password. You can find the current [sshpass source][6] on SourceForge.
|
||||
|
||||
Finally, the base Conda Python module list may lack some Python modules you need for your work. If you need to install one, the **conda install <package>** command is preferred, but **pip** can be used where needed, and Conda will recognize the install modules.
|
||||
|
||||
### Conclusion
|
||||
|
||||
Ansible is a powerful automation utility that's worth all the effort to learn. Conda is a simple and effective Python virtual environment management tool.
|
||||
|
||||
Keeping software installs separated on your MacOS environment is a prudent approach to maintain stability and sanity with your daily work environment. Conda can be especially helpful to upgrade your Python version, separate Ansible from your other projects, and safely hack on Ansible.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/8/using-conda-ansible-administration-macos
|
||||
|
||||
作者:[James Farrell][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/jamesf
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc (CICD with gears)
|
||||
[2]: https://brew.sh/
|
||||
[3]: https://docs.ansible.com/?extIdCarryOver=true&sc_cid=701f2000001OH6uAAG
|
||||
[4]: https://conda.io/projects/conda/en/latest/index.html
|
||||
[5]: https://docs.conda.io/en/latest/miniconda.html
|
||||
[6]: https://sourceforge.net/projects/sshpass/
|
||||
121
sources/tech/20190828 Using GNS3 with Fedora.md
Normal file
121
sources/tech/20190828 Using GNS3 with Fedora.md
Normal file
@@ -0,0 +1,121 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using GNS3 with Fedora)
|
||||
[#]: via: (https://fedoramagazine.org/using-gns3-with-fedora/)
|
||||
[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/)
|
||||
|
||||
Using GNS3 with Fedora
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
GNS3 is [an amazing tool][2] that allows IT professionals to, quite simply, create a virtual lab. The software can virtualize or emulate a variety of systems called appliances. These appliances range from Cisco routers and switches to nodes such as Windows Server, CentOS, and Fedora. GNS3 also has the capability to utilize [containers][3]. If you’re designing and testing proof-of-concept ideas, recreating environments for troubleshooting, or want to delve into the world of network engineering, GNS3 might be for you.
|
||||
|
||||
As seen on their website, GNS3 is well acquainted in the enterprise world. Companies using it span from tech businesses like Intel, to scientific organizations like NASA. Even renown banks and telecom companies are included in the list. This adds great credibility to the power and reliability this open-source tool provides.
|
||||
|
||||
### Installation
|
||||
|
||||
For Fedora users, GNS3 can be easily installed from the official repository. From the command-line type:
|
||||
|
||||
```
|
||||
sudo dnf install gns3-server gns3-gui
|
||||
```
|
||||
|
||||
The reason for the separate packages is because GNS3 can be configured as a dedicated server. This is useful for teams to collaborate while working on a project, or problem. The dedicated servers can be installed on bare-metal or as a virtual machine.
|
||||
|
||||
GNS3 requires a computer with virtualization capabilities. This allows the software to utilize the computer’s hardware to increase the performance when running the appliances. To use Spice/VNC as a console install the _virt-viewer_ package.
|
||||
|
||||
When the installation is complete, an icon will be placed among the applications for GNS3.
|
||||
|
||||
![][4]
|
||||
|
||||
### Initial setup
|
||||
|
||||
Opening GNS3 for the first time will open the Setup Wizard. The options on the first screen allow users to either setup an isolated VM environment, run the topologies from the local computer, or to use a remote server. The examples in this article are performed on the local machine.
|
||||
|
||||
The next screen configures the application to connect to the local machine running GNS3 server. Here we see the path to the application installed locally on the server, host binding address, and port. These settings can be tweaked to match your setup. However, for a quick setup it’s best to accept the defaults.
|
||||
|
||||
Once the settings are verified, a confirmation will appear stating the connection to the local server was successful. The last screen in the wizard will provide a summary. Click the **Finish** button to complete the setup.
|
||||
|
||||
![][5]
|
||||
|
||||
### Finding appliances in the GNS3 Marketplace
|
||||
|
||||
Before venturing into the GUI, this would be a good time to visit the [GNS3 Marketplace][6]. The marketplace contains appliances, pre-configured labs, and software for use with GNS3. The options in the Marketplace are vast and beyond the scope of this article. However, let’s download an appliance to see how it works.
|
||||
|
||||
First, select the appliance you want (the examples in this article will use OpenWRT). Select the template for that appliance to download. Appliance templates are JSON files with the extension _gns3a_.
|
||||
|
||||
You can also install OS nodes without a template, or create your own. [OSBoxes.org][7] has a variety of pre-built VMWare images (VMDK) that are compatible with GNS3. For this article we’ll use the Fedora 64-bit VMWare image. You can also find images for many other distributions such as CentOS, Ubuntu, and Kali Linux.
|
||||
|
||||
To use Cisco appliances a service agreement or subscription to VIRL is needed to download the IOS images from Cisco. For links and guides to legally download Cisco IOS, check out David Bombal’s site at <https://davidbombal.com/gns3-download-cisco-ios-images-virl-images-best-get/>.
|
||||
|
||||
You may also need to install Dynamips which is not included in the official repos. However, a simple web search will point to the RPM package.
|
||||
|
||||
![][8]
|
||||
|
||||
### Importing appliances to GNS3
|
||||
|
||||
Now that we have some appliances let’s build a small and simple topology using the templates and images we just downloaded.
|
||||
|
||||
After the initial setup the **New appliance template** window will open. From here we can import template files like the _gns3a_ file downloaded from the Marketplace. Other options for adding appliances without a template include IOS devices, VMs, and Docker containers.
|
||||
|
||||
To add the OpenWRT router, click **Import an appliance template file**. This will open the **Add appliance** wizard. Review the information on the first screen which shows the category, vendor, architecture, and KVM status for that appliance, and click **Next**. Now select the **Server type** to run the appliance and click **Next**. This is where we can specify whether we want to run it on a remote server, in a GNS3 VM, or on the local machine. After verifying the server requirements click **Next** to continue the installation.
|
||||
|
||||
At this point it’s time to install the image file for the OpenWRT appliance. Select the version and click the **Download** button. This will go to the site containing the image file and download it. This article will use OpenWRT 18.06.4 downloaded from the project’s website. If the version of the image is not in the list, click the button to **Create a new version**, and enter the version number (in this case 18.06.4). Select the filename and click **Import** to import the image. GNS3 will then ask if you would like to copy the image and decompress it (if necessary). Accept it and complete the install.
|
||||
|
||||
![][9]
|
||||
|
||||
### Adding appliances without a template
|
||||
|
||||
To add the Fedora VM downloaded from OSBoxes, click on one of the icons on the left and select **New appliance template** near the bottom. Select **Add a Qemu virtual machine** and click **Next**. Enter a name for the appliance (in this case Fedora 30) then click **Next**. Verify the QEMU binary path and input the amount of RAM to use for the VM, then select the **Console type**. On the next screen select **New image** and browse for the VMDK file. Depending on the file-size it may take a few moments. To copy/import the image select **Yes** and once it’s completed click **Finish**.
|
||||
|
||||
![][10]
|
||||
|
||||
### Adding and connecting nodes in GNS3
|
||||
|
||||
Now that we have some appliances, let’s build a simple topology with OpenWRT and Fedora in GNS3. The icons on the left represent Routers, Switches, End devices, and Security devices. The second-last shows all appliances, and the bottom option is to _Add a link_ which connects the nodes to each other.
|
||||
|
||||
Click on the **Routers** icon and drag the OpenWRT router onto the empty workspace to the right. Click on the **End devices** icon and do the same for the computer node. Depending on how large the file is, it may take a few moments for the PC node to appear in the workspace. To connect the nodes, click **Add a link** then click on a node, select the interface (i.e. Ethernet0), then do the same with the other node (as seen in the demo below).
|
||||
|
||||
You can customize the consoles by going to the menu bar and selecting **Edit > Preferences > General**. Select the tab for **Console applications** and click the **Edit** button. From here you can choose your favourite terminal in the drop-down menu and even customize it in the text-box below.
|
||||
|
||||
Once everything is in place, start the nodes by clicking the green (play) button at the top. The lights in the Topology Summary section will turn green indicating the nodes are on. To open the consoles for the nodes, click the **Console to all devices** button to the left (it looks like a terminal icon). The Remote Viewer window for Fedora and a terminal window for OpenWRT will open.
|
||||
|
||||
Once complete you can turn off the nodes individually by right-clicking on the node and selecting **Stop**, or to stop all nodes click the red **Stop** button in the top bar.
|
||||
|
||||
![][11]
|
||||
|
||||
### Conclusion
|
||||
|
||||
GNS3 is a powerful piece of software with features that are beyond the scope of this article. The software is similar to Cisco’s Packet Tracer. However, Packet Tracer is a simulator with limitations to the program’s coding. GNS3 on the other hand virtualizes/emulates the nodes using the hardware’s actual OS. This provides full functionality and a closer experience to the actual hardware.
|
||||
|
||||
The [GNS3 documentation][12] site offers an enormous amount of resources that delve further into the workings of the application. They also offer training courses for those interested in digging deep into the workings of the software.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/using-gns3-with-fedora/
|
||||
|
||||
作者:[Shaun Assam][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/sassam/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3.png-816x345.jpg
|
||||
[2]: https://gns3.com
|
||||
[3]: https://fedoramagazine.org/running-containers-with-podman/
|
||||
[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-app-icon-1024x768.png
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-initial-setup.gif
|
||||
[6]: https://www.gns3.com/marketplace
|
||||
[7]: https://www.osboxes.org
|
||||
[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-marketplace.png
|
||||
[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-adding-appliance-template.gif
|
||||
[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-adding-vm-image-without-template.gif
|
||||
[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-demo.gif
|
||||
[12]: https://docs.gns3.com
|
||||
240
sources/tech/20190828 What are environment variables in Bash.md
Normal file
240
sources/tech/20190828 What are environment variables in Bash.md
Normal file
@@ -0,0 +1,240 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (What are environment variables in Bash?)
|
||||
[#]: via: (https://opensource.com/article/19/8/what-are-environment-variables)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
What are environment variables in Bash?
|
||||
======
|
||||
Learn about environment variables in Bash in our miniseries: Variables
|
||||
in shells.
|
||||
![x sign ][1]
|
||||
|
||||
Environment variables contain information about your login session, stored for the system shell to use when executing commands. They exist whether you’re using Linux, Mac, or Windows. Many of these variables are set by default during installation or user creation.
|
||||
|
||||
While environment variables apply to all modern systems, this article specifically addresses environment variables in the Bash shell on Linux, BSD, Mac, and Cygwin.
|
||||
|
||||
### Understanding environment variables
|
||||
|
||||
Environment variables are no different, technically, than variables. They can be set, recalled, and cleared with exactly the same syntax used for variables. If you’re not used to using variables in Bash, read my [variables in Bash][2] article before continuing.
|
||||
|
||||
You don’t often use environment variables directly. They’re referenced by individual applications and daemons as needed. For instance, your home directory is set as an environment variable when you log in. For example, on Linux you can see your **HOME** environment variable's contents like this:
|
||||
|
||||
|
||||
```
|
||||
$ echo $HOME
|
||||
HOME=/home/seth
|
||||
```
|
||||
|
||||
On a Mac:
|
||||
|
||||
|
||||
```
|
||||
$ echo $HOME
|
||||
HOME=/Users/bogus
|
||||
```
|
||||
|
||||
On Windows:
|
||||
|
||||
|
||||
```
|
||||
`C:\Users\bogus`
|
||||
```
|
||||
|
||||
You can view all environment variables set on your system with the **env** command. ****The list is long, so pipe the output through **more** to make it easier to read:
|
||||
|
||||
|
||||
```
|
||||
$ env | more
|
||||
TERM=xterm-256color
|
||||
LESSOPEN=||/usr/bin/lesspipe.sh %s
|
||||
USER=seth
|
||||
SUDO_EDITOR=emacs
|
||||
WWW_HOME=<http://mirror.lagoon.nc/pub/slackware/slackware64-current/ChangeLog.txt>
|
||||
VISUAL=emacs
|
||||
DISPLAY=:0
|
||||
PS1=$
|
||||
XDG_DATA_DIRS=/home/seth/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/
|
||||
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin
|
||||
GDMSESSION=gnome
|
||||
MAIL=/var/spool/mail/seth
|
||||
[...]
|
||||
```
|
||||
|
||||
Environment variables can be useful when you want to override default settings, or when you need to manage new settings that your system has no reason to create on its own. For instance, when you type a command, the only reason your computer knows how to _find_ the application corresponding to that command is that the **PATH** environment variable tells it where to look. This variable lists valid directories for your operating system to search for commands, whether that command is [**ls**][3] or [cp][4], or a graphical application like Firefox or [Lutris][5], or anything else.
|
||||
|
||||
Different environment variables get used by different systems. Your **PATH** variable is vital to your terminal emulator, for instance, but a lot less significant to, say, Java (which has its own paths, which point to important Java libraries). However, the **USER** variable is used by several systems as a way to identify who is requesting a service. For example, if you’re on a multiuser system and need to check your local mailbox, your mail command knows which mail spool to retrieve based on the **MAIL** and **USER** variables.
|
||||
|
||||
### Setting an environment variable
|
||||
|
||||
Usually, the installer program, whether it’s **dnf** on Fedora, **apt** on Ubuntu, **brew** on Mac, or a custom installer, updates your environment variables for a new application. Sometimes, though, when you’re installing something outside of your distribution’s intended toolset, you may have to manage an environment variable yourself. Or you might choose to add an environment variable to suit your preferences. If you decide you want to keep some applications in a **bin** folder located in your home directory, then you must add that directory to your **PATH** so your operating system knows to look there for applications to run when you issue a command.
|
||||
|
||||
#### Temporary environment variables
|
||||
|
||||
You can add a location to your path the way you create throw-away variables. It works, but only as long as the shell you used to modify your system path remains open. For instance, open a Bash shell and modify your system path:
|
||||
|
||||
|
||||
```
|
||||
$ export PATH=$PATH:/home/seth/bin
|
||||
```
|
||||
|
||||
Confirm the result:
|
||||
|
||||
|
||||
```
|
||||
$ echo $PATH
|
||||
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin:/home/seth/bin
|
||||
```
|
||||
|
||||
Close the session:
|
||||
|
||||
|
||||
```
|
||||
$ exit
|
||||
```
|
||||
|
||||
Open a new one and take a look at the **PATH** variable:
|
||||
|
||||
|
||||
```
|
||||
$ echo $PATH
|
||||
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin
|
||||
```
|
||||
|
||||
This variable has reverted to its default state because **PATH** isn’t getting set with each new shell. For that, you must configure your variables to load any time a shell is launched.
|
||||
|
||||
#### Permanent environment variables
|
||||
|
||||
You can set your own persistent environment variables in your shell configuration file, the most common of which is **~/.bashrc**. If you’re a system administrator managing several users, you can also set environment variables in a script placed in the **/etc/profile.d** directory.
|
||||
|
||||
The syntax for setting a variable by configuration file is the same as setting a variable in your shell:
|
||||
|
||||
|
||||
```
|
||||
export PATH=$PATH:/snap/bin:/home/seth/bin
|
||||
```
|
||||
|
||||
Close the current shell, or else force it to load the updated config:
|
||||
|
||||
|
||||
```
|
||||
$ . ~/.bashrc
|
||||
```
|
||||
|
||||
Finally, take another look at your system path:
|
||||
|
||||
|
||||
```
|
||||
$ echo $PATH
|
||||
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin:/home/seth/bin
|
||||
```
|
||||
|
||||
It is now set correctly to include your additional custom directory.
|
||||
|
||||
### Discovering other environment variables
|
||||
|
||||
You can create and manipulate environment variables at will, and some applications do just that. This fact means that many of your environment variables aren’t used by most of your applications, and if you add your own arbitrary variables then some could be used by nothing at all. So the question is: How do you find out which environment variables are meaningful?
|
||||
|
||||
The answer lies in an application’s documentation. For instance, to find out what options are available to you for your general Bash environment, you can read the Bash documentation. While the Bash man page mentions many important variables, the GNU info page for Bash features two exhaustive lists of useful Bourne Shell and Bash environment variables, and how each is used.
|
||||
|
||||
For example, in the info page list:
|
||||
|
||||
|
||||
```
|
||||
'HISTCONTROL'
|
||||
A colon-separated list of values controlling how commands are saved
|
||||
on the history list. If the list of values includes 'ignorespace',
|
||||
lines which begin with a space character are not saved in the
|
||||
history list. A value of 'ignoredups' causes lines which match the
|
||||
previous history entry to not be saved. A value of 'ignoreboth' is
|
||||
shorthand for 'ignorespace' and 'ignoredups'.
|
||||
[...]
|
||||
```
|
||||
|
||||
This output tells you that the **HISTCONTROL** environment variable controls how your Bash history is presented, and what values you can use to customize that experience. In this example, the **ignoredups** value tells the output of the **history** command to ignore duplicate lines.
|
||||
|
||||
You can test this one easily. First, issue the same command twice in a row:
|
||||
|
||||
|
||||
```
|
||||
$ echo "hello world"
|
||||
hello world
|
||||
$ echo "hello world"
|
||||
hello world
|
||||
```
|
||||
|
||||
View your history, or at least the most recent entries:
|
||||
|
||||
|
||||
```
|
||||
$ history | tail -5
|
||||
996 man bash
|
||||
997 info bash
|
||||
998 echo "hello world"
|
||||
999 echo "hello world"
|
||||
1000 history
|
||||
```
|
||||
|
||||
You can see that duplicate entries are indeed listed now.
|
||||
|
||||
Set a new environment variable in your **.bashrc** file based on what you read in the info page:
|
||||
|
||||
|
||||
```
|
||||
export HISTCONTROL=$HISTCONTROL:ignorespace:ignoredups
|
||||
```
|
||||
|
||||
Save and then load your new configuration:
|
||||
|
||||
|
||||
```
|
||||
$ source ~/.bashrc
|
||||
```
|
||||
|
||||
Issue two commands twice in a row:
|
||||
|
||||
|
||||
```
|
||||
$ echo "hello once"
|
||||
hello once
|
||||
$ echo "hello once"
|
||||
hello once
|
||||
```
|
||||
|
||||
View the most recent entries in your history:
|
||||
|
||||
|
||||
```
|
||||
$ history | tail -5
|
||||
1000 history
|
||||
1001 emacs ~/.bashrc
|
||||
1002 source ~/.bashrc
|
||||
1003 echo "hello once"
|
||||
1004 history
|
||||
```
|
||||
|
||||
Duplicate entries are now collapsed into one entry because of your new environment variable, just as the info page specified.
|
||||
|
||||
Finding relevant environment variables is usually a matter of reading the documentation for the application you want to affect. Most environment variables are specific to what one application needs to run smoothly. For general entries, your shell’s documentation is the logical place to look. If you write scripts or applications that require new environment variables, be sure to define those variables in your own documentation.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/8/what-are-environment-variables
|
||||
|
||||
作者:[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/x_stop_terminate_program_kill.jpg?itok=9rM8i9x8 (x sign )
|
||||
[2]: https://opensource.com/article/19/8/using-variables-bash
|
||||
[3]: https://opensource.com/article/19/7/master-ls-command
|
||||
[4]: https://opensource.com/article/19/8/copying-files-linux
|
||||
[5]: https://opensource.com/article/18/10/lutris-open-gaming-platform
|
||||
@@ -0,0 +1,146 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Three Ways to Exclude Specific/Certain Packages from Yum Update)
|
||||
[#]: via: (https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Three Ways to Exclude Specific/Certain Packages from Yum Update
|
||||
======
|
||||
|
||||
As part of system update, you may need to exclude few of the packages due to application dependency in Red Hat based system.
|
||||
|
||||
If yes, how to exclude, how many ways that can be done.
|
||||
|
||||
Yes, it can be done in three ways, we will teach you all three methods in this article.
|
||||
|
||||
A package manager is a collection of tools that allow users to easily manage packages in Linux system.
|
||||
|
||||
It allows users to install, update/upgrade, remove, query, re-install, and search packages in Linux system.
|
||||
|
||||
For Red Hat and it’s clone, we uses **[yum Package Manager][1]** and **[rpm Package Manager][2]** for package management.
|
||||
|
||||
### What’s yum?
|
||||
|
||||
yum stands for Yellowdog Updater, Modified. Yum is an automatic updater and package installer/remover for rpm systems.
|
||||
|
||||
It automatically resolve dependencies when installing a package.
|
||||
|
||||
### What’s rpm?
|
||||
|
||||
rpm stands for Red Hat Package Manager is a powerful package management tool for Red Hat system.
|
||||
|
||||
The name RPM refers to `.rpm` file format that containing compiled software’s and necessary libraries for the package.
|
||||
|
||||
You may interested to read the following articles, which is related to this topic. If so, navigate to appropriate links.
|
||||
|
||||
* **[How To Check Available Security Updates On Red Hat (RHEL) And CentOS System][3]**
|
||||
* **[Four Ways To Install Security Updates On Red Hat (RHEL) And CentOS Systems][4]**
|
||||
* **[Two Methods To Check Or List Installed Security Updates on Redhat (RHEL) And CentOS System][5]**
|
||||
|
||||
|
||||
|
||||
### Method-1: Exclude Packages with yum Command Manually or Temporarily
|
||||
|
||||
We can use `--exclude or -x` switch with yum command to exclude specific packages from getting updated through yum command.
|
||||
|
||||
I can say, this is a temporary method or On-Demand method. If you want to exclude specific package only once then we can go with this method.
|
||||
|
||||
The below command will update all packages except kernel.
|
||||
|
||||
To exclude single package.
|
||||
|
||||
```
|
||||
# yum update --exclude=kernel
|
||||
|
||||
or
|
||||
|
||||
# yum update -x 'kernel'
|
||||
```
|
||||
|
||||
To exclude multiple packages. The below command will update all packages except kernel and php.
|
||||
|
||||
```
|
||||
# yum update --exclude=kernel* --exclude=php*
|
||||
|
||||
or
|
||||
|
||||
# yum update --exclude httpd,php
|
||||
```
|
||||
|
||||
### Method-2: Exclude Packages with yum Command Permanently
|
||||
|
||||
This is permanent method and you can use this, if you are frequently performing the patch update.
|
||||
|
||||
To do so, add the required packages in /etc/yum.conf to disable packages updates permanently.
|
||||
|
||||
Once you add an entry, you don’t need to specify these package each time you run yum update command. Also, this prevent packages from any accidental update.
|
||||
|
||||
```
|
||||
# vi /etc/yum.conf
|
||||
|
||||
[main]
|
||||
cachedir=/var/cache/yum/$basearch/$releasever
|
||||
keepcache=0
|
||||
debuglevel=2
|
||||
logfile=/var/log/yum.log
|
||||
exactarch=1
|
||||
obsoletes=1
|
||||
gpgcheck=1
|
||||
plugins=1
|
||||
installonly_limit=3
|
||||
exclude=kernel* php*
|
||||
```
|
||||
|
||||
### Method-3: Exclude Packages Using Yum versionlock plugin
|
||||
|
||||
This is also permanent method similar to above. Yum versionlock plugin allow users to lock specified packages from being updated through yum command.
|
||||
|
||||
To do so, run the following command. The below command will exclude the freetype package from yum update.
|
||||
|
||||
Alternatively, you can add the package entry directly in “/etc/yum/pluginconf.d/versionlock.list” file.
|
||||
|
||||
```
|
||||
# yum versionlock add freetype
|
||||
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
Adding versionlock on: 0:freetype-2.8-12.el7
|
||||
versionlock added: 1
|
||||
```
|
||||
|
||||
Run the following command to check the list of packages locked by versionlock plugin.
|
||||
|
||||
```
|
||||
# yum versionlock list
|
||||
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
0:freetype-2.8-12.el7.*
|
||||
versionlock list done
|
||||
```
|
||||
|
||||
Run the following command to discards the list.
|
||||
|
||||
```
|
||||
# yum versionlock clear
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/
|
||||
|
||||
作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
|
||||
[2]: https://www.2daygeek.com/rpm-command-examples/
|
||||
[3]: https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/
|
||||
[4]: https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/
|
||||
[5]: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/
|
||||
@@ -0,0 +1,191 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Install Ansible (Automation Tool) on Debian 10 (Buster))
|
||||
[#]: via: (https://www.linuxtechi.com/install-ansible-automation-tool-debian10/)
|
||||
[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/)
|
||||
|
||||
如何在 Debian 10(Buster)上安装 Ansible(自动化工具)
|
||||
======
|
||||
|
||||
在如今的 IT 领域,自动化一个是热门话题,每个组织都开始采用自动化工具,像 **Puppet**、**Ansible**、**Chef**、**CFEngine**、**Foreman** 和 **Katello**。在这些工具中,Ansible 是几乎所有 IT 组织中管理 UNIX 和 Linux 系统的首选。在本文中,我们将演示如何在 Debian 10 Sever 上安装和使用 ansible。
|
||||
|
||||
[![Ansible-Install-Debian10][1]][2]
|
||||
|
||||
我的实验室细节:
|
||||
|
||||
* Debian 10 – Ansible 服务器/ 控制节点 – 192.168.1.14
|
||||
* CentOS 7 – Ansible 主机 (Web 服务器)– 192.168.1.15
|
||||
* CentOS 7 – Ansible 主机(DB 服务器)– 192.169.1.17
|
||||
|
||||
|
||||
|
||||
我们还将演示如何使用 Ansible 服务器管理 Linux 服务器
|
||||
|
||||
### 在 Debian 10 Server 上安装 Ansible
|
||||
|
||||
我假设你的 Debian 10 中有一个拥有 root 或 sudo 权限的用户。在我这里,我有一个名为 “pkumar” 的本地用户,它拥有 sudo 权限。
|
||||
|
||||
Ansible 2.7 包存在于 Debian 10 的默认仓库中,在命令行中运行以下命令安装 Ansible,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo apt update
|
||||
root@linuxtechi:~$ sudo apt install ansible -y
|
||||
```
|
||||
|
||||
运行以下命令验证 ansible 版本,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible --version
|
||||
```
|
||||
|
||||
![ansible-version][1]
|
||||
|
||||
要安装最新版本的 Ansible 2.8,首先我们必须设置 Ansible 仓库。
|
||||
|
||||
一个接一个地执行以下命令,
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" | sudo tee -a /etc/apt/sources.list
|
||||
root@linuxtechi:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
|
||||
root@linuxtechi:~$ sudo apt update
|
||||
root@linuxtechi:~$ sudo apt install ansible -y
|
||||
root@linuxtechi:~$ sudo ansible --version
|
||||
```
|
||||
|
||||
![latest-ansible-version][1]
|
||||
|
||||
### 使用 Ansible 管理 Linux 服务器
|
||||
|
||||
请参考以下步骤,使用 Ansible 控制器节点管理类似 Linux 的服务器,
|
||||
|
||||
### 步骤 1:在 Ansible 服务器及其主机之间交换 SSH 密钥
|
||||
|
||||
在 ansible 服务器生成 ssh 密钥并在 ansible 主机之间共享密钥。
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo -i
|
||||
root@linuxtechi:~# ssh-keygen
|
||||
root@linuxtechi:~# ssh-copy-id root@linuxtechi
|
||||
root@linuxtechi:~# ssh-copy-id root@linuxtechi
|
||||
```
|
||||
|
||||
### 步骤 2:创建 Ansible 主机清单
|
||||
|
||||
安装 ansible 后会自动创建 /etc/hosts,在此文件中我们可以编辑 ansible 主机或其客户端。我们还可以在家目录中创建自己的 ansible 主机清单,
|
||||
|
||||
运行以下命令在我们的家目录中创建 ansible 主机清单。
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ vi $HOME/hosts
|
||||
[Web]
|
||||
192.168.1.15
|
||||
|
||||
[DB]
|
||||
192.168.1.17
|
||||
```
|
||||
|
||||
保存并退出文件
|
||||
|
||||
**注意:**在上面的 hosts 文件中,我们也可以使用主机名或 FQDN,但为此我们必须确保 ansible 主机可以通过主机名或者 fqdn 访问。。
|
||||
|
||||
### 步骤 3:测试和使用默认的ansible模块
|
||||
|
||||
Ansible 附带了许多可在 ansible 命令中使用的默认模块,示例如下所示。
|
||||
|
||||
语法:
|
||||
|
||||
# ansible -i <host_file> -m <module> <host>
|
||||
|
||||
这里:
|
||||
|
||||
* **-i ~/hosts**:包含 ansible 主机列表
|
||||
* **-m:** 在 -m 之后指定 ansible 模块,如 ping 和 shell
|
||||
* **<host>:** 我们要运行 ansible 模块的 Ansible 主机
|
||||
|
||||
|
||||
|
||||
使用 ansible ping 模块验证 ping 连接
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping all
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping Web
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping DB
|
||||
```
|
||||
|
||||
命令输出如下所示:
|
||||
|
||||
![Ansible-ping-module-examples][1]
|
||||
|
||||
Running shell commands on ansible hosts using shell module
|
||||
使用 shell 模块在 ansible 主机上运行 shell 命令
|
||||
|
||||
**语法:** # ansible -i <hosts_file> -m shell -a <shell_commands> <host>
|
||||
|
||||
例子:
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime" all
|
||||
192.168.1.17 | CHANGED | rc=0 >>
|
||||
01:48:34 up 1:07, 3 users, load average: 0.00, 0.01, 0.05
|
||||
|
||||
192.168.1.15 | CHANGED | rc=0 >>
|
||||
01:48:39 up 1:07, 3 users, load average: 0.00, 0.01, 0.04
|
||||
|
||||
root@linuxtechi:~$
|
||||
root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime ; df -Th / ; uname -r" Web
|
||||
192.168.1.15 | CHANGED | rc=0 >>
|
||||
01:52:03 up 1:11, 3 users, load average: 0.12, 0.07, 0.06
|
||||
Filesystem Type Size Used Avail Use% Mounted on
|
||||
/dev/mapper/centos-root xfs 13G 1017M 12G 8% /
|
||||
3.10.0-327.el7.x86_64
|
||||
|
||||
root@linuxtechi:~$
|
||||
```
|
||||
|
||||
上面的命令输出表明我们已成功设置 ansible 控制器节点。
|
||||
|
||||
让我们创建一个示例 NGINX 安装 playbook,下面的 playbook 将在所有服务器上安装 nginx,这些服务器是 Web 主机组的一部分,但在这里,我的主机组下只有一台 centos 7 机器。
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ vi nginx.yaml
|
||||
---
|
||||
- hosts: Web
|
||||
tasks:
|
||||
- name: Install latest version of nginx on CentOS 7 Server
|
||||
yum: name=nginx state=latest
|
||||
- name: start nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: started
|
||||
```
|
||||
|
||||
现在使用以下命令执行 playbook。
|
||||
|
||||
```
|
||||
root@linuxtechi:~$ sudo ansible-playbook -i ~/hosts nginx.yaml
|
||||
```
|
||||
|
||||
上面命令的输出类似下面这样。
|
||||
|
||||
![nginx-installation-playbook-debian10][1]
|
||||
|
||||
这表明 Ansible playbook 成功执行了。本文就是这些了,请分享你的反馈和评论。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/install-ansible-automation-tool-debian10/
|
||||
|
||||
作者:[Pradeep Kumar][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://www.linuxtechi.com/author/pradeep/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Ansible-Install-Debian10.jpg
|
||||
Reference in New Issue
Block a user