mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
d13e97866e
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: ( chenmu-kk )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
@ -8,19 +8,25 @@
|
||||
[#]: author: (Bryant Son (Red Hat, Community Moderator) https://opensource.com/users/brson)
|
||||
|
||||
9 open source tools for building a fault-tolerant system
|
||||
九个用来构建容错系统的开源工具
|
||||
======
|
||||
|
||||
Maximize uptime and minimize problems with these open source tools.
|
||||
这些开源工具可以最大化延长运行时间并且在最大程度上减少问题。
|
||||
|
||||
![magnifying glass on computer screen, finding a bug in the code][1]
|
||||
|
||||
I've always been interested in web development and software architecture because I like to see the broader picture of a working system. Whether you are building a mobile app or a web application, it has to be connected to the internet to exchange data among different modules, which means you need a web service.
|
||||
我总是对web开发和软件体系结构很感兴趣,因为我喜欢看到一个工作系统的更广阔的前景。无论是构建一个移动应用程序还是一个web应用程序,都必须连接到internet才能在不同的模块中交换数据,这意味着你需要web服务。
|
||||
|
||||
If you use a cloud system as your application's backend, you can take advantage of greater computing power, as the backend service will scale horizontally and vertically and orchestrate different services. But whether or not you use a cloud backend, it's important to build a _fault-tolerant system_ —one that is resilient, stable, fast, and safe.
|
||||
如果选择云系统作为应用程序的后端,则可以利用更优秀的计算能力,因为后端服务将会在水平和垂直方向上进行扩展并编排不同的服务。但无论你是否使用云后端,建造一个灵活、稳定、快速又安全的容错系统是必不可少的。
|
||||
|
||||
To understand fault-tolerant systems, let's use Facebook, Amazon, Google, and Netflix as examples. Millions and billions of users access these platforms simultaneously while transmitting enormous amounts of data via peer-to-peer and user-to-server networks, and you can be sure there are also malicious users with bad intentions, like hacking or denial-of-service (DoS) attacks. Even so, these platforms can operate 24 hours a day and 365 days a year without downtime.
|
||||
To understand fault-tolerant systems, let's use Facebook, Amazon, Google, and Netflix as examples. Millions and billions of users access these platforms simultaneously while transmitting enormous amounts of data via peer-to-peer and user-to-server networks, and you can be sure there are also malicious users with bad intentions, like hacking or denial-of-service (DoS) attacks. Even so, these platforms can operate 24 hours a day and 365 days a year without downtime.
|
||||
要了解容错系统,让我们以脸书、亚马逊、谷歌和奈飞为例。数以亿计的用户会同时接入这些平台并通过对等网络和用户-服务器网络传输大量数据,你可以肯定这其中还存在许多的带有不法目的的恶意用户,例如黑客攻击和拒绝服务(DoS)攻击。即使如此,这些平台无需停机也可以全年无休地运转。
|
||||
|
||||
Although machine learning and smart algorithms are the backbones of these systems, the fact that they achieve consistent service without a single minute of downtime is praiseworthy. Their expensive hardware and gigantic datacenters certainly matter, but the elegant software designs supporting the services are equally important. And the fault-tolerant system is one of the principles to build such an elegant system.
|
||||
尽管机器学习和智能算法是这些系统的基础,但它们实现一致服务而不需要一分钟停机的事实值得称赞。它们昂贵的硬件设备和巨大的数据中心当然十分重要,但是支持服务的精密软件设计也同样重要。而且容错系统是一个构建如此精密系统的法则之一。
|
||||
|
||||
### Two behaviors that cause problems in production
|
||||
|
||||
|
68
sources/talk/20200817 What makes Java open source.md
Normal file
68
sources/talk/20200817 What makes Java open source.md
Normal file
@ -0,0 +1,68 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (What makes Java open source?)
|
||||
[#]: via: (https://opensource.com/article/20/8/open-source-java)
|
||||
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
|
||||
|
||||
What makes Java open source?
|
||||
======
|
||||
Clearing up the confusion about developing in Java while staying in the
|
||||
open source ecosystem.
|
||||
![Coffee beans][1]
|
||||
|
||||
If you're using [Java][2] to write business applications, you may know that Java Standard Edition (SE) is not open source software. It is not managed by a foundation, like Python or JavaScript, and in January 2019, Oracle changed its policy to require a commercial license for any use of SE, from the developer's local environment to production.
|
||||
|
||||
This change also raised a lot of questions in open source communities about licensing compliance and Java usage. If you're still confused, this article will guide you through how these changes apply to Java developers.
|
||||
|
||||
### Evolving platforms in the Java community
|
||||
|
||||
[OpenJDK][3] (Open Java Development Kit) is a free and open source implementation of Java SE. It is an alternative that allows more than 70% of Java developers to continue stabilizing their Java application environments while remaining within the open source ecosystem. OpenJDK is primarily licensed under the [GNU GPLv2][4]. The freedoms guaranteed by this distribution strategy have made OpenJDK the default choice for Java developers to build desktop applications that are compatible with Java SE.
|
||||
|
||||
Oracle continued developing and maintaining Enterprise Java (Java EE), which is built on the Java SE platform. Java EE includes additional features outside SE's scope to support large-scale, scalable, multi-tier, and secured applications for a variety of enterprise environments. In September 2017, the Java EE platform was transferred to the [Eclipse Foundation][5], leading to the adoption of more agile processes, changing the governance process, and implementing more flexible licensing. One year later, in 2018, the Eclipse Foundation announced a new brand name, [Jakarta EE][6], with a new logo and working groups to support developers transitioning from Java EE to the new platform. The evolution from Java EE to Jakarta EE also impacted many enterprise Java developers in implementing new business logic.
|
||||
|
||||
### Evolving frameworks as Java evolved
|
||||
|
||||
In the meantime, new technologies, such as RESTful APIs (2000), HTTP 2 (2015), and JSON (2017), were being developed alongside fast-changing web architectures. Interest in microservices architectures was growing, but because Java EE was in transition, it did not pick up on these new paradigms as they happened.
|
||||
|
||||
In response, the broader Java community and several vendors (IBM, Red Hat, and Tomitribe) created [MicroProfile][7] in 2016 to optimize the Enterprise Java platform for microservices architectures. MicroProfile [later joined the Eclipse Foundation][8], giving enterprise Java developers two options for implementing microservice architectures: SpringBoot or MicroProfile. MicroProfile allows developers to create portable Java-based microservices across vendor solutions while ensuring compatibility between matching Java/Jakarta EE and MicroProfile APIs in the same application.
|
||||
|
||||
If you are interested in Enterprise Java development, [MicroProfile Starter][9] is a great resource to explore microservices in practice. MicroProfile Starter's graphical user interface requires a few details to generate code to create a monolithic Java application server.
|
||||
|
||||
A MicroProfile runtime supports deploying an application artifact (e.g., a JAR or WAR file) and executing it as a Java application server with a MicroProfile specification. You can choose the cloud-native runtime you prefer (e.g., [Quarkus][10]) from MicroProfle Starter's runtime list, then select specifications to gain additional enterprise features, such as fault tolerance, OpenAPI, OpenTracing, and more. Once you've completed these steps, click on "Download" to begin developing your application.
|
||||
|
||||
![MicroProfile Starter GUI][11]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][12])
|
||||
|
||||
### Conclusion
|
||||
|
||||
Navigating Java from an open source perspective can be a bit confusing given the language's long history, acquisitions, and relicenses. Sticking with OpenJDK and Jakarta EE allows Java developers to maintain standard enterprise applications without compromising open source freedoms. If you want to dive in further, take a look at MicroProfile or delve deeper into runtimes by exploring Quarkus.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/8/open-source-java
|
||||
|
||||
作者:[Daniel Oh][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/daniel-oh
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans)
|
||||
[2]: https://opensource.com/resources/java
|
||||
[3]: https://openjdk.java.net/
|
||||
[4]: https://openjdk.java.net/legal/gplv2+ce.html
|
||||
[5]: https://www.eclipse.org/org/
|
||||
[6]: https://opensource.com/article/18/5/jakarta-ee
|
||||
[7]: https://microprofile.io/
|
||||
[8]: https://opensource.com/article/18/1/eclipse-microprofile
|
||||
[9]: https://start.microprofile.io/
|
||||
[10]: https://quarkus.io/
|
||||
[11]: https://opensource.com/sites/default/files/uploads/microprofile.png (MicroProfile Starter GUI)
|
||||
[12]: https://creativecommons.org/licenses/by-sa/4.0/
|
@ -0,0 +1,70 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Amazon Braket lets customers try out quantum computing)
|
||||
[#]: via: (https://www.networkworld.com/article/3570251/amazon-braket-lets-customers-try-out-quantum-computing.html)
|
||||
[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/)
|
||||
|
||||
Amazon Braket lets customers try out quantum computing
|
||||
======
|
||||
AWS joins IBM, Microsoft, Google and others in growing quantum computing arena
|
||||
[Glosser.ca / Pete Linforth][1] [(CC BY-SA 3.0)][2]
|
||||
|
||||
AWS has announced the availability of a new service that lets customers tap into and experiment with [quantum computing][3] simulators and access quantum hardware from [D-Wave][4], [IonQ][5], and [Rigetti][6].
|
||||
|
||||
The managed service, [Amazon Braket][7], offers customers a development environment where they can explore and build quantum algorithms, test them on quantum circuit simulators, and run them on different quantum hardware technologies, AWS said in a [statement][7] about the service. The Braket service includes Jupyter notebooks that come pre-installed with the Amazon Braket SDK and example tutorials.
|
||||
|
||||
**Read more: [What is quantum computing? (and why enterprises should care)][3] **
|
||||
|
||||
According to AWS, Braket provides access to a fully managed, high-performance, quantum circuit simulator that lets users test and validate circuits with a single line of code. In addition, as a native AWS service, Braket can be managed via the AWS management console. (Related: [Amazon joins the quantum computing crowd with Braket testbed][8])
|
||||
|
||||
The service is named after the standard notation in quantum mechanics bra-ket, which was introduced by Paul Dirac in 1939 to describe the state of quantum systems and is also known as the [Dirac notation][9].
|
||||
|
||||
"Quantum computing has the potential to solve computational problems that are beyond the reach of classical computers by harnessing the laws of quantum mechanics to process information in new ways," AWS stated. "This approach to computing could transform areas such as chemical engineering, material science, drug discovery, financial portfolio optimization, and machine learning. But defining those problems and programming quantum computers to solve them requires new skills, which are difficult to acquire without easy access to quantum computing hardware."
|
||||
|
||||
In a blog about Braket, Jeff Barr, Chief Evangelist for AWS, said there are a few things customers should keep in mind about Braket:
|
||||
|
||||
* Quantum computing is an emerging field. "Although some of you are already experts, it will take some time for the rest of us to understand the concepts and the technology, and to figure out how to put them to use."
|
||||
* The [quantum processing units] QPUs accessed through Amazon Braket support two different paradigms. The IonQ and Rigetti QPUs and the simulator support circuit-based quantum computing, and the D-Wave QPU supports quantum annealing. You cannot run a problem designed for one paradigm on a QPU that supports the other one, so you will need to choose the appropriate QPU early.
|
||||
* Each task will incur a per-task charge and an additional per-shot charge that is specific to the type of QPU used. Use of the simulator incurs an hourly charge, billed by the second, with a 15 second minimum. For more information, check out [Amazon Braket Pricing][10]
|
||||
|
||||
|
||||
|
||||
The Amazon Braket rollout follows similar [quantum service][11] introductions from [IBM][12], [Microsoft][13], [QC Ware, ][14]Google, Honeywell and others in what is becoming a growing market. Researchers at [Tractica][15] for example, forecast that total enterprise quantum computing market revenue will reach $9.1 billion annually by 2030, up from $111.6 million in 2018. "The global market for quantum computing is being driven largely by the desire to increase the capability of modeling and simulating complex data, improve the efficiency or optimization of systems or processes, and solve problems with more precision," Tractica stated.
|
||||
|
||||
Gartner has called quantum computing one of the top potential disruptive technologies in the next five years, stating that the parallel execution and exponential scalability of quantum computers means they excel with problems too complex for a traditional approach or where traditional algorithms would take too long to find a solution. Industries such as automotive, financial, insurance, pharmaceuticals, military and research have the most to gain from the advancements in quantum computing. Most organizations should learn about and monitor QC through 2022 and perhaps exploit it from 2023 or 2025, Gartner stated.
|
||||
|
||||
Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3570251/amazon-braket-lets-customers-try-out-quantum-computing.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://en.wikipedia.org/wiki/File:Bloch_Sphere.svg
|
||||
[2]: https://creativecommons.org/licenses/by-sa/3.0/legalcode
|
||||
[3]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html
|
||||
[4]: https://aws.amazon.com/braket/hardware-providers/dwave/
|
||||
[5]: https://aws.amazon.com/braket/hardware-providers/ionq/
|
||||
[6]: https://aws.amazon.com/braket/hardware-providers/rigetti/
|
||||
[7]: https://aws.amazon.com/braket/
|
||||
[8]: https://www.networkworld.com/article/3487421/amazon-joins-the-quantum-computing-crowd-with-braket-testbed.html
|
||||
[9]: https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation
|
||||
[10]: https://aws.amazon.com/braket/pricing
|
||||
[11]: https://www.networkworld.com/article/3489098/10-hot-quantum-computing-startups-to-watch.html
|
||||
[12]: https://www.ibm.com/blogs/research/category/quantcomp/
|
||||
[13]: https://www.microsoft.com/en-us/quantum/
|
||||
[14]: https://qcware.com/
|
||||
[15]: https://tractica.omdia.com/newsroom/press-releases/the-quantum-computing-market-is-poised-for-strong-growth-with-global-revenue-to-reach-9-1-billion-by-2030/
|
||||
[16]: https://www.facebook.com/NetworkWorld/
|
||||
[17]: https://www.linkedin.com/company/network-world
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,217 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Set up Vim as your Rust IDE)
|
||||
[#]: via: (https://opensource.com/article/20/7/vim-rust-ide)
|
||||
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
|
||||
|
||||
Set up Vim as your Rust IDE
|
||||
======
|
||||
The Vim text editor is a great development environment for programming
|
||||
Rust applications.
|
||||
![Ferris the crab under the sea, unofficial logo for Rust programming language][1]
|
||||
|
||||
The [Rust][2] programming language is designed to implement systems programming with safe concurrency and high memory performance in a way that feels familiar to C++ developers. It's also one of the most loved programming languages in [Stack Overflow's 2019 Developer Survey][3].
|
||||
|
||||
Text editors and [integrated development environment (IDE) tools][4] make writing Rust code easier and quicker. There are many editors to choose from, but I believe the [Vim editor][5] is a great fit for a Rust IDE. In this article, I'll explain how to set up Vim for Rust application development.
|
||||
|
||||
### Install Vim
|
||||
|
||||
Vim is one of the most commonly used command-line text editors in Linux and Unix. The latest version (as of this writing) is [8.2][6], and it offers more flexibility than ever in how you can use it.
|
||||
|
||||
[Vim's download page][7] provides multiple options to install it with binary or packages. For example, if you use macOS, you can install the [MacVim][8] project, then expand Vim's capabilities by [installing Vim plugins][9].
|
||||
|
||||
To set up Rust for development, download [Rustup][10], a handy Rust installer utility, and run the following in your terminal (if you use macOS, Linux, or any other Unix-like operating system):
|
||||
|
||||
|
||||
```
|
||||
`$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
|
||||
```
|
||||
|
||||
Choose an installation option from the interactive prompt. Then you will see output like:
|
||||
|
||||
|
||||
```
|
||||
stable installed - rustc 1.43.1 (8d69840ab 2020-05-04)
|
||||
|
||||
Rust is installed now. Great!
|
||||
|
||||
To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
|
||||
environment variable. Next time you log in this will be done
|
||||
automatically.
|
||||
|
||||
To configure your current shell run source $HOME/.cargo/env
|
||||
```
|
||||
|
||||
### Syntax highlighting
|
||||
|
||||
Vim allows you to configure your runtime by defining it in the `.vimrc` file. To enable syntax highlighting, open your `.vimrc` file (or create one if it doesn't exist):
|
||||
|
||||
|
||||
```
|
||||
`$ vim ~/.vimrc`
|
||||
```
|
||||
|
||||
Add the following in the `.vimrc` file and save it:
|
||||
|
||||
|
||||
```
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
```
|
||||
|
||||
The first line turns on the detection, plugin, and indent configurations all at once. The second line enables syntax highlighting. These features will help you manage your developer workflow in Rust. Learn more in Vim's [help file][11].
|
||||
|
||||
### Create a Rust application in Vim
|
||||
|
||||
To create a new Rust HelloWorld application (`hello.rs`) using Vim, enter:
|
||||
|
||||
|
||||
```
|
||||
`$ vim hello.rs`
|
||||
```
|
||||
|
||||
Enter the following Rust code to print **Hello World!** in the console:
|
||||
|
||||
|
||||
```
|
||||
fn main() {
|
||||
println!("Hello World");
|
||||
}
|
||||
```
|
||||
|
||||
It should look something like this:
|
||||
|
||||
![Rust code with syntax highlighting][12]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][13])
|
||||
|
||||
Here's what it would look like without syntax highlighting:
|
||||
|
||||
![Rust code without syntax highlighting][14]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][13])
|
||||
|
||||
Did you notice how Vim automatically indented and organized the code? That is because of the first line you entered in the `.vimrc` file.
|
||||
|
||||
Great job! Next, you will build this application using Rust's package manager, [Cargo][15].
|
||||
|
||||
### Cargo integrations
|
||||
|
||||
Cargo makes creating applications easier. To see how, create a Cargo-based HelloWorld application. If you don't already have Cargo installed on your Linux or macOS system, enter:
|
||||
|
||||
|
||||
```
|
||||
`$ curl https://sh.rustup.rs -sSf | sh`
|
||||
```
|
||||
|
||||
Then create a package with Cargo:
|
||||
|
||||
|
||||
```
|
||||
`$ cargo new my_hello_world`
|
||||
```
|
||||
|
||||
If you look at the directory structure, you'll see Cargo automatically generated some source code and directories. If you have `tree` installed, run it to see the directory structure:
|
||||
|
||||
|
||||
```
|
||||
$ tree my_hello_world
|
||||
my_hello_world
|
||||
├── Cargo.toml
|
||||
└── src
|
||||
└── main.rs
|
||||
|
||||
1 directory, 2 files
|
||||
```
|
||||
|
||||
Open the `main.rs` source code file in Vim:
|
||||
|
||||
|
||||
```
|
||||
`$ vim my_hello_world/src/main.rs`
|
||||
```
|
||||
|
||||
The code is the same as in the HelloWorld example you created manually above. Replace `World` with `Rust with Vim`:
|
||||
|
||||
|
||||
```
|
||||
fn main() {
|
||||
println!("Hello, Rust with Vim");
|
||||
}
|
||||
```
|
||||
|
||||
Use `:wq` to save your changes and quit Vim.
|
||||
|
||||
### Compile your application
|
||||
|
||||
Now you can compile your first Rust application using `cargo build`:
|
||||
|
||||
|
||||
```
|
||||
$ cd my_hello_world
|
||||
$ cargo build
|
||||
```
|
||||
|
||||
Your terminal output will look similar to this:
|
||||
|
||||
|
||||
```
|
||||
Compiling my_hello_world v0.1.0 (/Users/danieloh/cloud-native-app-dev/rust/my_hello_world)
|
||||
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.60s
|
||||
```
|
||||
|
||||
You may see a warning message because you reused the sample package name, `my_hello_world`, but you can ignore it for now.
|
||||
|
||||
Run the application:
|
||||
|
||||
|
||||
```
|
||||
$ target/debug/my_hello_world
|
||||
Hello, Rust with Vim!
|
||||
```
|
||||
|
||||
You can also use `cargo run` to build and run the application all at once:
|
||||
|
||||
|
||||
```
|
||||
$ cargo run
|
||||
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
|
||||
Running `target/debug/my_hello_world`
|
||||
Hello, Rust with Vim!!
|
||||
```
|
||||
|
||||
Congratulations! You set up Vim editor for Rust IDE on your local machine, developed your first Rust application, and built, tested, and ran it using the Cargo package manager tool. Run `cargo help` If you want to learn other Cargo commands.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/7/vim-rust-ide
|
||||
|
||||
作者:[Daniel Oh][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/daniel-oh
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rust_programming_crab_sea.png?itok=2eWLz8A5 (Ferris the crab under the sea, unofficial logo for Rust programming language)
|
||||
[2]: https://www.rust-lang.org/
|
||||
[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages
|
||||
[4]: https://en.wikipedia.org/wiki/Integrated_development_environment
|
||||
[5]: https://opensource.com/resources/what-vim
|
||||
[6]: https://github.com/vim/vim
|
||||
[7]: https://www.vim.org/download.php
|
||||
[8]: https://github.com/macvim-dev/macvim
|
||||
[9]: https://opensource.com/article/20/2/how-install-vim-plugins
|
||||
[10]: https://rustup.rs/
|
||||
[11]: http://vimdoc.sourceforge.net/htmldoc/filetype.html#:filetype-overview
|
||||
[12]: https://opensource.com/sites/default/files/uploads/rust_helloworld.png (Rust code with syntax highlighting)
|
||||
[13]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[14]: https://opensource.com/sites/default/files/uploads/rust_helloworld_no-syntax.png (Rust code without syntax highlighting)
|
||||
[15]: https://opensource.com/article/20/3/rust-cargo
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (LazyWolfLin)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,154 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Manjaro vs Arch Linux: What’s the Difference? Which one is Better?)
|
||||
[#]: via: (https://itsfoss.com/manjaro-vs-arch-linux/)
|
||||
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
|
||||
|
||||
Manjaro vs Arch Linux: What’s the Difference? Which one is Better?
|
||||
======
|
||||
|
||||
_**Manjaro or Arch Linux? If Manjaro is based on Arch, how come is it different from Arch? Read how Arch and Manjaro are different in this comparison article.**_
|
||||
|
||||
Most of the [beginner-friendly Linux distributions][1] are based on Ubuntu. As Linux users gains more experience, some try their hands on the more ‘advanced distributions’, mostly in the ‘Arch domain’.
|
||||
|
||||
This Arch domain dominated by two distributions: [Arch Linux][2] itself and [Manjaro][3]. There are other [Arch-based Linux distributions][4] but none are as popular as these two.
|
||||
|
||||
If you are confused between Arch and Manjaro then this comparison should help you out.
|
||||
|
||||
### Manjaro and Arch Linux: How different or similar are they?
|
||||
|
||||
![][5]
|
||||
|
||||
I have tried to compare these two distributions on various points. Please keep in mind that I have not exclusively focused on the differences. I have also pointed out where they are similar.
|
||||
|
||||
#### Both are rolling release distributions but not of the same kind
|
||||
|
||||
There are no “releases” every few months or years in Arch and Manjaro like Ubuntu or Fedora. Just [keep your Arch or Manjaro system updated][6] and you’ll always have the latest version of the operating system and the software packages. You don’t need to worry about upgrading your installed version like ever.
|
||||
|
||||
If you are planning to do a fresh install at some point, keep in mind that both Manjaro and Arch update the installation ISO regularly. It is called ISO refresh and it ensures that newly installed systems don’t have to install all the new system updates made available in last few months.
|
||||
|
||||
But there is a difference between the rolling release model of Arch and Manjaro.
|
||||
|
||||
Manjaro maintains its own independent repositories except for the community-maintained Arch User Repository (AUR). These repositories also contain software packages not provided by Arch. Popular software packages initially provided by the official Arch repositories will first be thoroughly tested (and if necessary, patched), prior to being released, usually about two weeks behind Arch, to Manjaro’s own Stable Repositories for public use.
|
||||
|
||||
![][7]
|
||||
|
||||
A consequence of accommodating this testing process is that Manjaro will never be quite as bleeding-edge as Arch. But then, it makes Manjaro slightly more stable than Arch and less susceptible to breaking your system.
|
||||
|
||||
#### Package Management – Pacman and Pamac
|
||||
|
||||
Both Arch and Manjaro ship with command-line based package management tool called Pacman which was coded in C and uses tar to package applications. In other words, you can [use the same pacman commands][8] for managing packages in both distributions.
|
||||
|
||||
In addition to the Pacman, Manjaro has also developed a GUI application called Pamac for easily installing software on Manjaro. This makes using Manjaro easier than Arch.
|
||||
|
||||
![Pamac GUI Package Manager by Manjaro][9]
|
||||
|
||||
Do note that you may also install Pamac from AUR in Arch Linux but the tool is integral part of Manjaro.
|
||||
|
||||
#### Manjaro Hardware Detection Tool (MHWD)
|
||||
|
||||
Pamac is not the only GUI tool developed by Manjaro team to help its users. Manjaro also has a dedicated tool for detecting hardware and suggest drivers for them.
|
||||
|
||||
![Manjaro hardware configuration GUI tool][10]
|
||||
|
||||
This hardware detection tool is so useful that it can be one of the [main reasons why Manjaro is loved by the community][11]. It is insanely easy to detect/install/use or switch from one driver to another and makes the hardware compatibility an issue from the past.
|
||||
|
||||
#### Drivers support
|
||||
|
||||
Manjaro offers great support for GPU drivers. As we all know for many years Linux has issues installing drivers (Specially Nvidia).
|
||||
|
||||
While [installing Manjaro][12] it gives options to start with open source (free) or non-open source (non-free) graphics driver installation. When you choose “non-free” it automatically detects your graphics card and install the most appropriate driver for it and hence GPU works out of the box.
|
||||
|
||||
Installing graphics driver is easier even after installing Manjaro thanks to the hardware detection tool you saw in the previous section.
|
||||
|
||||
And if you have a system with Nvidia Optimus card (Hybrid GPU) it works fine with Manjaro. You will get plenty of options of get it working.
|
||||
|
||||
In Arch Linux, you have to install (if you could find) the appropriate drivers for your machine.
|
||||
|
||||
#### Access to the Arch User Repository (AUR)
|
||||
|
||||
[Arch User Repository][13] (AUR) is a community-driven repository for Arch-based Linux distributions users. The AUR was created to organize and share new packages from the community and to help accelerate popular packages’ inclusion into the [community repository][14].
|
||||
|
||||
A good number of new packages that enter the official repositories start in the AUR. In the AUR, users are able to contribute their own package builds (PKGBUILD and related files).
|
||||
|
||||
You can use AUR in both Arch and Manjaro.
|
||||
|
||||
#### Desktop environments
|
||||
|
||||
Alright! You can use virtually any desktop environments on any Linux distribution. Arch and Manjaro are no exceptions.
|
||||
|
||||
However, a dedicated desktop flavor or version makes it easier for users to have a seamless experience of the said desktop environments.
|
||||
|
||||
The default Arch ISO doesn’t include any desktop environment. For example, you want to [install KDE on Arch Linux][15], you will have to either download and install it while [installing Arch Linux][16] or after that.
|
||||
|
||||
Manjaro, on the other hand, provides different ISO for desktop environments like Xfce, KDE and GNOME. Manjaro community also maintains ISO for MATE, Cinnamon, LXDE, LXQt, OpenBox and more.
|
||||
|
||||
#### Installation procedure
|
||||
|
||||
![Arch Live Boot][17]
|
||||
|
||||
Manjaro is based on Arch Linux and it is Arch compatible, but **it is not Arch**. It’s not even a pre-configured version of Arch with just a graphical installer. Arch doesn’t come with the usual comfort out of the box, which is why most people prefer something easier. Manjaro offers you the easy entry, but supports you on your way to becoming an experienced user or power user.
|
||||
|
||||
#### Documentation and support
|
||||
|
||||
Both Arch and Manjaro have their own wiki pages and support forums to help their respective users.
|
||||
|
||||
While Manjaro has a decent [wiki][18] for documentation, the [Arch wiki][19] is in a different league altogether. You can find detailed information on every aspect of Arch Linux in the Arch wiki.
|
||||
|
||||
#### Targeted audience
|
||||
|
||||
The key difference is that [Arch is aimed to users with a do-it-yourself attitude][20] who are willing to read the documentation, and solve their own problems.
|
||||
|
||||
On the other hand Manjaro is targeted at Linux users who are not that experienced or who don’t want to spend time assembling the operating system.
|
||||
|
||||
### Conclusion
|
||||
|
||||
Some people often say that Manjaro is for those who can’t install Arch. But I think that’s not true. Not everyone wants to configure Arch from scratch or doesn’t have much time.
|
||||
|
||||
Manjaro is definitely a beast, but a very different kind of beast than Arch. **Fast, powerful, and always up to date**, Manjaro provides all the benefits of an Arch operating system, but with an especial emphasis on **stability, user-friendliness and accessibility** for newcomers and experienced users.
|
||||
|
||||
Manjaro doesn’t take its minimalism as far as Arch Linux does. With Arch, you start with a blank canvas and adjust each setting manually. When the default Arch installation completes, you have a running Linux instance at the command line. Want a [graphical desktop environment][21]? Go right ahead—there’s plenty to choose from. Pick one, install, and configure it. You learn so much doing that especially if you are new to Linux. You get a superb understanding of how the system goes together and why things are installed they way are.
|
||||
|
||||
I hope you have a better understanding of Arch and Manjaro now. You understand how they are similar and yet different.
|
||||
|
||||
_**I have voiced my opinion. Don’t hesitate to share yours in the comment section. Between Arch and Manjaro, which one do you prefer and why.**_
|
||||
|
||||
_With additional inputs from Abhishek Prakash._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/manjaro-vs-arch-linux/
|
||||
|
||||
作者:[Dimitrios Savvopoulos][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/dimitrios/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/best-linux-beginners/
|
||||
[2]: https://www.archlinux.org/
|
||||
[3]: https://manjaro.org/
|
||||
[4]: https://itsfoss.com/arch-based-linux-distros/
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/arch-vs-manjaro.png?ssl=1
|
||||
[6]: https://itsfoss.com/update-arch-linux/
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/repositories.png?ssl=1
|
||||
[8]: https://itsfoss.com/pacman-command/
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Pamac.png?resize=800%2C534&ssl=1
|
||||
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/hardware-detection.png?ssl=1
|
||||
[11]: https://itsfoss.com/why-use-manjaro-linux/
|
||||
[12]: https://itsfoss.com/install-manjaro-linux/
|
||||
[13]: https://itsfoss.com/aur-arch-linux/
|
||||
[14]: https://wiki.archlinux.org/index.php/Community_repository
|
||||
[15]: https://itsfoss.com/install-kde-arch-linux/
|
||||
[16]: https://itsfoss.com/install-arch-linux/
|
||||
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-live-boot.jpg?ssl=1
|
||||
[18]: https://wiki.manjaro.org/index.php?title=Main_Page
|
||||
[19]: https://wiki.archlinux.org/
|
||||
[20]: https://itsfoss.com/why-arch-linux/
|
||||
[21]: https://itsfoss.com/best-linux-desktop-environments/
|
154
sources/tech/20200817 Use GNU on Windows with MinGW.md
Normal file
154
sources/tech/20200817 Use GNU on Windows with MinGW.md
Normal file
@ -0,0 +1,154 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Use GNU on Windows with MinGW)
|
||||
[#]: via: (https://opensource.com/article/20/8/gnu-windows-mingw)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Use GNU on Windows with MinGW
|
||||
======
|
||||
Install the GNU Compiler Collection and other GNU components to enable
|
||||
GNU Autotools on Windows.
|
||||
![Windows][1]
|
||||
|
||||
If you're a hacker running Windows, you don't need a proprietary application to compile code. With the [Minimalist GNU for Windows][2] (MinGW) project, you can download and install the [GNU Compiler Collection][3] (GCC) along with several other essential GNU components to enable [GNU Autotools][4] on your Windows computer.
|
||||
|
||||
### Install MinGW
|
||||
|
||||
The easiest way to install MinGW is through mingw-get, a graphical user interface (GUI) application that helps you select which components to install and keep them up to date. To run it, [download `mingw-get-setup.exe`][5] from the project's host. Install it as you would any other EXE file by clicking through the installation wizard to completion.
|
||||
|
||||
![Installing mingw-get][6]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][7])
|
||||
|
||||
### Install GCC on Windows
|
||||
|
||||
So far, you've only installed an installer—or more accurately, a dedicated _package manager_ called mingw-get. Launch mingw-get to select which MinGW project applications you want to install on your computer.
|
||||
|
||||
First, select **mingw-get** from your application menu to launch it.
|
||||
|
||||
![Installing GCC with MinGW][8]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][7])
|
||||
|
||||
To install GCC, click the GCC and G++ package to mark GNU C and C++ compiler for installation. To complete the process, select **Apply Changes** from the **Installation** menu in the top-left corner of the mingw-get window.
|
||||
|
||||
Once GCC is installed, you can run it from [PowerShell][9] using its full path:
|
||||
|
||||
|
||||
```
|
||||
PS> C:\MinGW\bin\gcc.exe --version
|
||||
gcc.exe (MinGW.org GCC Build-x) x.y.z
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
```
|
||||
|
||||
### Run Bash on Windows
|
||||
|
||||
While it calls itself "minimalist," MinGW also provides an optional [Bourne shell][10] command-line interpreter called MSYS (which stands for Minimal System). It's an alternative to Microsoft's `cmd.exe` and PowerShell, and it defaults to Bash. Aside from being one of the (justifiably) most popular shells, Bash is useful when porting open source applications to the Windows platform because many open source projects assume a [POSIX][11] environment.
|
||||
|
||||
You can install MSYS from the mingw-get GUI or from within PowerShell:
|
||||
|
||||
|
||||
```
|
||||
`PS> mingw-get install msys`
|
||||
```
|
||||
|
||||
To try out Bash, launch it using its full path:
|
||||
|
||||
|
||||
```
|
||||
PS> C:\MinGW\msys/1.0/bin/bash.exe
|
||||
bash.exe-$ echo $0
|
||||
"C:\MinGW\msys/1.0/bin/bash.exe"
|
||||
```
|
||||
|
||||
### Set the path on Windows
|
||||
|
||||
You probably don't want to have to type the full path for every command you want to use. Add the directory containing your new GNU executables to your path in Windows. There are two root directories of executables to add: one for MinGW (including GCC and its related toolchain) and another for MSYS (including Bash and many common tools from the GNU and [BSD][12] projects).
|
||||
|
||||
To modify your environment in Windows, click on the application menu and type `env`.
|
||||
|
||||
![Edit your env][13]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][7])
|
||||
|
||||
A Preferences window will open; click the **Environment variables** button located near the bottom of the window.
|
||||
|
||||
In the **Environment variables** window, double-click the **Path** selection from the bottom panel.
|
||||
|
||||
In the **Edit Environment variables** window that appears, click the **New** button on the right. Create a new entry reading **C:\MinCW\msys\1.0\bin** and click **OK**. Create a second new entry the same way, this one reading **C:\MinGW\bin**, and click **OK**.
|
||||
|
||||
![Set your env][14]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][7])
|
||||
|
||||
Accept these changes in each Preferences window. You can reboot your computer to ensure the new variables are detected by all applications, or just relaunch your PowerShell window.
|
||||
|
||||
From now on, you can call any MinGW command without specifying the full path, because the full path is in the `%PATH%` environment variable of your Windows system, which PowerShell inherits.
|
||||
|
||||
### Hello world
|
||||
|
||||
You're all set up now, so put your new MinGW system to a small test. If you're a [Vim][15] user, launch it, and enter this obligatory "hello world" code:
|
||||
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
cout << "Hello open source." << endl;
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Save the file as `hello.cpp`, then compile it with the C++ component of GCC:
|
||||
|
||||
|
||||
```
|
||||
`PS> gcc hello.cpp --output hello`
|
||||
```
|
||||
|
||||
And, finally, run it:
|
||||
|
||||
|
||||
```
|
||||
PS> .\a.exe
|
||||
Hello open source.
|
||||
PS>
|
||||
```
|
||||
|
||||
There's much more to MinGW than what I can cover here. After all, MinGW opens a whole world of open source and potential for custom code, so take advantage of it. For a wider world of open source, you can also [give Linux a try][16]. You'll be amazed at what's possible when all limits are removed. But in the meantime, give MinGW a try and enjoy the freedom of the GNU.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/8/gnu-windows-mingw
|
||||
|
||||
作者:[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/more_windows.jpg?itok=hKk64RcZ (Windows)
|
||||
[2]: http://mingw.org
|
||||
[3]: https://gcc.gnu.org/
|
||||
[4]: https://opensource.com/article/19/7/introduction-gnu-autotools
|
||||
[5]: https://osdn.net/projects/mingw/releases/
|
||||
[6]: https://opensource.com/sites/default/files/uploads/mingw-install.jpg (Installing mingw-get)
|
||||
[7]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[8]: https://opensource.com/sites/default/files/uploads/mingw-packages.jpg (Installing GCC with MinGW)
|
||||
[9]: https://opensource.com/article/19/8/variables-powershell
|
||||
[10]: https://en.wikipedia.org/wiki/Bourne_shell
|
||||
[11]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
|
||||
[12]: https://opensource.com/article/19/3/netbsd-raspberry-pi
|
||||
[13]: https://opensource.com/sites/default/files/uploads/mingw-env.jpg (Edit your env)
|
||||
[14]: https://opensource.com/sites/default/files/uploads/mingw-env-set.jpg (Set your env)
|
||||
[15]: https://opensource.com/resources/what-vim
|
||||
[16]: https://opensource.com/article/19/7/ways-get-started-linux
|
216
translated/tech/20200706 Set up Vim as your Rust IDE.md
Normal file
216
translated/tech/20200706 Set up Vim as your Rust IDE.md
Normal file
@ -0,0 +1,216 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Set up Vim as your Rust IDE)
|
||||
[#]: via: (https://opensource.com/article/20/7/vim-rust-ide)
|
||||
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
|
||||
|
||||
将 Vim 设置为 Rust IDE
|
||||
======
|
||||
Vim 编辑器是很好的 Rust 应用开发环境。
|
||||
![Ferris the crab under the sea, unofficial logo for Rust programming language][1]
|
||||
|
||||
[Rust][2] 语言旨在以 C++ 开发人员熟悉的方式实现具有安全并发性和高内存性能的系统编程。它也是 [Stack Overflow 的 2019 年开发人员调查][3]中最受欢迎的编程语言之一。
|
||||
|
||||
文本编辑器和[集成开发环境(IDE)工具][4]使编写 Rust 代码更加轻松快捷。有很多编辑器可供选择,但是我相信 [Vim 编辑器][5]非常适合 Rust IDE。在本文中,我将说明如何为 Rust 应用开发设置 Vim。
|
||||
|
||||
### 安装 Vim
|
||||
|
||||
Vim 是 Linux 和 Unix 中最常用的命令行文本编辑器之一。最新版本(在编写本文时)是 [8.2][6],它在使用方式上提供了前所未有的灵活性。
|
||||
|
||||
[Vim 的下载页面][7]提供了多种二进制或软件包形式安装。例如,如果使用 macOS,那么可以安装 [MacVim][8] 项目,然后通过[安装 Vim 插件][9] 扩展 Vim 的功能。
|
||||
|
||||
要设置 Rust 进行开发,请下载 [Rustup][10],这是一个方便的 Rust 安装器工具,并在你的终端上运行以下命令(如果你使用 macOS、Linux 或任何其他类 Unix 系统):
|
||||
|
||||
|
||||
```
|
||||
`$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
|
||||
```
|
||||
|
||||
在提示中选择安装选项。然后,你将看到如下输出:
|
||||
|
||||
|
||||
```
|
||||
stable installed - rustc 1.43.1 (8d69840ab 2020-05-04)
|
||||
|
||||
Rust is installed now. Great!
|
||||
|
||||
To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
|
||||
environment variable. Next time you log in this will be done
|
||||
automatically.
|
||||
|
||||
To configure your current shell run source $HOME/.cargo/env
|
||||
```
|
||||
|
||||
### 语法高亮
|
||||
|
||||
Vim 能让你通过 `.vimrc` 文件配置你的运行时。要启用语法高亮,请打开 `.vimrc` 文件(如果不存在就创建一个):
|
||||
|
||||
|
||||
```
|
||||
`$ vim ~/.vimrc`
|
||||
```
|
||||
|
||||
在 `.vimrc` 中添加以下内容并保存:
|
||||
|
||||
|
||||
```
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
```
|
||||
|
||||
第一行同时打开检测、插件和缩进配置。第二行启用语法高亮。这些功能将帮助你在 Rust 中管理开发流程。在 Vim 的[帮助文件][11]中了解更多信息。
|
||||
|
||||
### 在 Vim 中创建一个 Rust 应用
|
||||
|
||||
要使用 Vim 创建一个新的 Rust HelloWorld 应用(`hello.rs`),请输入:
|
||||
|
||||
|
||||
```
|
||||
`$ vim hello.rs`
|
||||
```
|
||||
|
||||
输入以下 Rust 代码在控制台中打印 **Hello World!**:
|
||||
|
||||
|
||||
```
|
||||
fn main() {
|
||||
println!("Hello World");
|
||||
}
|
||||
```
|
||||
|
||||
它看起来应该像这样:
|
||||
|
||||
![Rust code with syntax highlighting][12]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][13])
|
||||
|
||||
没有语法高亮的样子如下:
|
||||
|
||||
![Rust code without syntax highlighting][14]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][13])
|
||||
|
||||
你是否注意到 Vim 自动缩进和组织代码?那是因为你在 `.vimrc` 文件中输入了第一行。
|
||||
|
||||
很好!接下来,你将使用 Rust 的包管理器 [Cargo][15] 构建此应用。
|
||||
|
||||
### Cargo 集成
|
||||
|
||||
Cargo 使创建应用更加容易。要查看操作方法,请创建一个基于 Cargo 的 HelloWorld 应用。如果你尚未在 Linux 或 macOS 系统上安装 Cargo,请输入:
|
||||
|
||||
|
||||
```
|
||||
`$ curl https://sh.rustup.rs -sSf | sh`
|
||||
```
|
||||
|
||||
然后使用 Cargo 创建包:
|
||||
|
||||
|
||||
```
|
||||
`$ cargo new my_hello_world`
|
||||
```
|
||||
|
||||
如果查看目录结构,你会看到 Cargo 自动生成一些源码和目录。如果你安装了 `tree`,请运行它查看目录结构:
|
||||
|
||||
|
||||
```
|
||||
$ tree my_hello_world
|
||||
my_hello_world
|
||||
├── Cargo.toml
|
||||
└── src
|
||||
└── main.rs
|
||||
|
||||
1 directory, 2 files
|
||||
```
|
||||
|
||||
在 Vim 中打开 `main.rs` 源码文件:
|
||||
|
||||
|
||||
```
|
||||
`$ vim my_hello_world/src/main.rs`
|
||||
```
|
||||
|
||||
它与你在上面手动创建的 HelloWorld 示例中的代码相同。用 `Rust with Vim` 代替 `World`:
|
||||
|
||||
|
||||
```
|
||||
fn main() {
|
||||
println!("Hello, Rust with Vim");
|
||||
}
|
||||
```
|
||||
|
||||
使用 `:wq` 保存更改并退出 Vim。
|
||||
|
||||
### 编译你的应用
|
||||
|
||||
现在你可以使用 `cargo build` 编译你的第一个 Rust 应用:
|
||||
|
||||
|
||||
```
|
||||
$ cd my_hello_world
|
||||
$ cargo build
|
||||
```
|
||||
|
||||
你的终端输出将类似于以下内容:
|
||||
|
||||
|
||||
```
|
||||
Compiling my_hello_world v0.1.0 (/Users/danieloh/cloud-native-app-dev/rust/my_hello_world)
|
||||
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.60s
|
||||
```
|
||||
|
||||
你可能会看到一条警告消息,因为你重用了示例包名 `my_hello_world`,但现在可以忽略它。
|
||||
|
||||
运行应用:
|
||||
|
||||
|
||||
```
|
||||
$ target/debug/my_hello_world
|
||||
Hello, Rust with Vim!
|
||||
```
|
||||
|
||||
你也可以使用 `cargo run` 一次构建和运行应用:
|
||||
|
||||
|
||||
```
|
||||
$ cargo run
|
||||
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
|
||||
Running `target/debug/my_hello_world`
|
||||
Hello, Rust with Vim!!
|
||||
```
|
||||
|
||||
恭喜!你在本地的 VIm 编辑器中设置了 Rust IDE,开发了第一个 Rust 应用,并使用 Cargo 包管理器工具构建、测试和运行了它。如果你想学习其他 Cargo 命令,请运行 `cargo help`。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/7/vim-rust-ide
|
||||
|
||||
作者:[Daniel Oh][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/daniel-oh
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rust_programming_crab_sea.png?itok=2eWLz8A5 (Ferris the crab under the sea, unofficial logo for Rust programming language)
|
||||
[2]: https://www.rust-lang.org/
|
||||
[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages
|
||||
[4]: https://en.wikipedia.org/wiki/Integrated_development_environment
|
||||
[5]: https://opensource.com/resources/what-vim
|
||||
[6]: https://github.com/vim/vim
|
||||
[7]: https://www.vim.org/download.php
|
||||
[8]: https://github.com/macvim-dev/macvim
|
||||
[9]: https://opensource.com/article/20/2/how-install-vim-plugins
|
||||
[10]: https://rustup.rs/
|
||||
[11]: http://vimdoc.sourceforge.net/htmldoc/filetype.html#:filetype-overview
|
||||
[12]: https://opensource.com/sites/default/files/uploads/rust_helloworld.png (Rust code with syntax highlighting)
|
||||
[13]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[14]: https://opensource.com/sites/default/files/uploads/rust_helloworld_no-syntax.png (Rust code without syntax highlighting)
|
||||
[15]: https://opensource.com/article/20/3/rust-cargo
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
@ -7,21 +7,22 @@
|
||||
[#]: via: (https://opensource.com/article/20/7/procdump-linux)
|
||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||
|
||||
Debug Linux using ProcDump
|
||||
使用 ProcDump 调试 Linux
|
||||
======
|
||||
Check out Microsoft's open source tool for getting process information.
|
||||
![Dump truck rounding a turn in the road][1]
|
||||
|
||||
Microsoft's growing appreciation for Linux and open source is no secret. The company has steadily increased its contributions to open source in the last several years, including porting some of its software and tools to Linux. In late 2018, Microsoft [announced][2] it was porting some of its [Sysinternals][3] tools to Linux as open source, and [ProcDump for Linux][4] was the first such release.
|
||||
> 用这个微软的开源工具,获取进程信息。
|
||||
|
||||
If you have worked on Windows in debugging or troubleshooting, you have probably heard of Sysinternals. It is a "Swiss Army knife" toolset that helps system administrators, developers, and IT security professionals monitor and troubleshoot Windows environments.
|
||||
![渣土车在路上转弯][1] 。
|
||||
|
||||
One of Sysinternals' most popular tools is [ProcDump][5]. As its name suggests, it is used for dumping the memory of a running process into a core file on disk. This core file can then be analyzed using a debugger to understand the process' state when the dump was taken. Having used Sysinternals previously, I was curious to try out the Linux port of ProcDump.
|
||||
微软越来越心仪 Linux 和开放源码,这并不是什么秘密。在过去几年中,该公司稳步增加对开源的贡献,包括将其部分软件和工具移植到 Linux。2018 年底,微软[宣布][2]将其部分 [Sysinternals][3] 工具以开源的方式移植到 Linux,[Linux 版的 ProcDump][4]是第一个这样的版本。
|
||||
|
||||
### Get started with ProcDump for Linux
|
||||
如果你在 Windows 上从事过调试或故障排除工作,你可能听说过 Sysinternals。它是一个“瑞士军刀”工具集,可以帮助系统管理员、开发人员和 IT 安全专家监控和排除 Windows 环境的故障。
|
||||
|
||||
To try ProcDump for Linux, you need to download the tool and compile it. (I am using Red Hat Enterprise Linux, though these instructions should work the same on other Linux distros):
|
||||
Sysinternals 最受欢迎的工具之一是 [ProcDump][5]。顾名思义,它用于将正在运行的进程的内存转储到磁盘上的一个核心文件中。然后可以用调试器对这个核心文件进行分析,了解转储时进程的状态。因为之前用过 Sysinternals,所以我很想试试 ProcDump 的 Linux 移植版。
|
||||
|
||||
### 开始使用 Linux 上的 ProcDump
|
||||
|
||||
要试用 Linux 上的 ProcDump,你需要下载该工具并编译它。(我使用的是 Red Hat Enterprise Linux,尽管这些步骤在其他 Linux 发行版上应该是一样的):
|
||||
|
||||
```
|
||||
$ cat /etc/redhat-release
|
||||
@ -32,11 +33,10 @@ $ uname -r
|
||||
$
|
||||
```
|
||||
|
||||
First, clone the ProcDump for Linux repository:
|
||||
|
||||
首先,克隆 Linux 版 ProcDump 的版本库。
|
||||
|
||||
```
|
||||
$ git clone <https://github.com/microsoft/ProcDump-for-Linux.git>
|
||||
$ git clone https://github.com/microsoft/ProcDump-for-Linux.git
|
||||
Cloning into 'ProcDump-for-Linux'...
|
||||
remote: Enumerating objects: 40, done.
|
||||
remote: Counting objects: 100% (40/40), done.
|
||||
@ -53,8 +53,7 @@ CODE_OF_CONDUCT.md dist include LICENSE procdump.1
|
||||
$
|
||||
```
|
||||
|
||||
Next, build the program using `make`. It prints out the exact [GCC][6] command-line interface needed to compile the source files:
|
||||
|
||||
接下来,使用 `make` 构建程序。它能准确地输出编译源文件所需的 [GCC][6] 命令行参数。
|
||||
|
||||
```
|
||||
$ make
|
||||
@ -75,8 +74,7 @@ gcc -o bin/ProcDumpTestApplication obj/ProcDumpTestApplication.o -Wall -I ./incl
|
||||
$
|
||||
```
|
||||
|
||||
The compilation creates two new directories. First is an `obj/` directory, which holds the object files created during compilation. The second (and more important) directory is `bin/`, which is where the compiled `procdump` program is stored. It also compiles another test binary called `ProcDumpTestApplication`:
|
||||
|
||||
编译过程中会创建两个新的目录。第一个是 `obj/` 目录,存放编译期间创建的对象文件。第二个(也是更重要的)目录是 `bin/`,它是存储编译出的 `procdump` 程序的地方。它还会编译另一个名为 `ProcDumpTestApplication` 的测试二进制文件:
|
||||
|
||||
```
|
||||
$ ls obj/
|
||||
@ -95,8 +93,7 @@ bin/ProcDumpTestApplication: ELF 64-bit LSB executable, x86-64, version 1 (SYSV)
|
||||
$
|
||||
```
|
||||
|
||||
With this setup, every time you run the `procdump` utility, you must move into the `bin/` folder. To make it available from anywhere within the system, run `make install`. This copies the binary into the usual `bin/` directory, which is part of your shell's `$PATH`:
|
||||
|
||||
在此情况下,每次运行 `procdump` 实用程序时,你都必须移动到 `bin/` 文件夹中。要使它在系统中的任何地方都可以使用,运行 `make install`。这将二进制文件复制到通常的 `bin/` 目录中,它是你的 shell `$PATH` 的一部分:
|
||||
|
||||
```
|
||||
$ which procdump
|
||||
@ -113,22 +110,20 @@ $ which procdump
|
||||
$
|
||||
```
|
||||
|
||||
With installation, ProcDump provides a man page, which you can access with `man procdump`:
|
||||
|
||||
安装时,ProcDump 提供了一个手册页,你可以用 `man procdump` 访问:
|
||||
|
||||
```
|
||||
$ man procdump
|
||||
$
|
||||
```
|
||||
|
||||
### Run ProcDump
|
||||
|
||||
To dump a process' memory, you need to provide its process ID (PID) to ProcDump. You can use any of the running programs or daemons on your machine. For this example, I will use a tiny C program that loops forever. Compile the program and run it (to exit the program, hit **Ctrl**+**C**, or if it's running in the background, use the `kill` command with the PID):
|
||||
### 运行 ProcDump
|
||||
|
||||
要转储一个进程的内存,你需要向 ProcDump 提供它的进程 ID(PID)。你可以使用机器上任何正在运行的程序或守护进程。在这个例子中,我将使用一个永远循环的小 C 程序。编译程序并运行它(要退出程序,按 `Ctrl+C`,如果程序在后台运行,则使用 `kill` 命令并输入 PID):
|
||||
|
||||
```
|
||||
$ cat progxyz.c
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
for (;;)
|
||||
@ -141,13 +136,12 @@ int main() {
|
||||
$
|
||||
$ gcc progxyz.c -o progxyz
|
||||
$
|
||||
$ ./progxyz &
|
||||
$ ./progxyz &
|
||||
[1] 350498
|
||||
$
|
||||
```
|
||||
|
||||
By running the program, you can find its PID using either `pgrep` or `ps`. Make note of the PID:
|
||||
|
||||
运行该程序,你可以使用 `pgrep` 或 `ps` 找到它的 PID。记下 PID:
|
||||
|
||||
```
|
||||
$ pgrep progxyz
|
||||
@ -159,8 +153,7 @@ root 350508 347350 0 03:29 pts/0 00:00:00 grep --color=auto pro
|
||||
$
|
||||
```
|
||||
|
||||
While the test process is running, invoke `procdump` and provide the PID. The output states the name of the process and the PID, reports that a `Core dump` was generated, and shows its file name:
|
||||
|
||||
当测试进程正在运行时,调用 `procdump` 并提供 PID。输出表明了该进程的名称和 PID,并报告它生成了一个核心转储文件,并显示其文件名:
|
||||
|
||||
```
|
||||
$ procdump -p 350498
|
||||
@ -185,8 +178,7 @@ Press Ctrl-C to end monitoring without terminating the process.
|
||||
$
|
||||
```
|
||||
|
||||
List the contents of the current directory, and you should see the new core file. The file name matches the one shown by the `procdump` command, and the date, time, and PID are appended to it:
|
||||
|
||||
列出当前目录的内容,你应该可以看到新的核心文件。文件名与 `procdump` 命令显示的文件名一致,日期、时间、PID 都会附加在文件名上:
|
||||
|
||||
```
|
||||
$ ls -l progxyz_time_2020-06-24_03\:30\:00.350498
|
||||
@ -197,10 +189,9 @@ progxyz_time_2020-06-24_03:30:00.350498: ELF 64-bit LSB core file, x86-64, versi
|
||||
$
|
||||
```
|
||||
|
||||
### Analyze the core file with the GNU Project Debugger
|
||||
|
||||
To see if you can read the proc file, invoke the [GNU Project Debugger][7] (`gdb`). Remember to provide the test binary's path so you can see all the function names on the stack. Here, `bt` (backtrace) shows that the `sleep()` function was being executed when the dump was taken:
|
||||
### 用 GNU 项目调试器分析核心文件。
|
||||
|
||||
要查看是否可以读取该转储文件,调用 [GNU 项目调试器][7](`gdb`)。记得提供测试二进制文件的路径,这样你就可以看到堆栈上所有的函数名。在这里,`bt`(回溯)表明,当转储被采集时,`sleep()` 函数正在执行:
|
||||
|
||||
```
|
||||
$ gdb -q ./progxyz ./progxyz_time_2020-06-24_03\:30\:00.350498
|
||||
@ -216,13 +207,12 @@ Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-101.el8.x86_6
|
||||
(gdb)
|
||||
```
|
||||
|
||||
### What about gcore?
|
||||
|
||||
Linux users will be quick to point out that Linux already has a command called `gcore`, which ships with most Linux distros and does the exact same thing as ProcDump. This is a valid argument. If you have never used it, try the following to dump a process' core with `gcore`. Run the test program again, then run `gcore`, and provide the PID as an argument:
|
||||
### gcore 怎么样?
|
||||
|
||||
Linux 用户会很快指出,Linux 已经有一个叫 `gcore` 的命令,大多数 Linux 发行版都有这个命令,它的作用和 ProcDump 完全一样。你说的对。如果你从来没有使用过它,可以尝试用 `gcore` 来转储一个进程的核心。再次运行测试程序,然后运行 `gcore`,并提供 PID 作为参数:
|
||||
|
||||
```
|
||||
$ ./progxyz &
|
||||
$ ./progxyz &
|
||||
[1] 350664
|
||||
$
|
||||
$
|
||||
@ -237,8 +227,7 @@ Saved corefile core.350664
|
||||
$
|
||||
```
|
||||
|
||||
`gcore` prints a message saying it has saved the core to a specific file. Check the current directory to find this core file, and use `gdb` again to load it:
|
||||
|
||||
`gcore` 打印一条消息,说它已将核心文件保存到一个特定的文件中。检查当前目录,找到这个核心文件,然后再次使用 `gdb` 加载它:
|
||||
|
||||
```
|
||||
$
|
||||
@ -263,8 +252,7 @@ Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-101.el8.x86_6
|
||||
$
|
||||
```
|
||||
|
||||
For `gcore` to work, you need to make sure the following settings are in place. First, ensure the `ulimit` is set for core files; if it is set to `0`, core files won't be generated. Second, ensure that `/proc/sys/kernel/core_pattern` has the proper settings to specify the core pattern:
|
||||
|
||||
为了使 `gcore` 可以工作,你需要确保以下设置到位。首先,确保为核心文件设置了 `ulimit`,如果设置为 `0`,核心文件将不会被生成。第二,确保 `/proc/sys/kernel/core_pattern` 有正确的设置来指定核心模式:
|
||||
|
||||
```
|
||||
$ ulimit -c
|
||||
@ -272,24 +260,22 @@ unlimited
|
||||
$
|
||||
```
|
||||
|
||||
### Should you use ProcDump or gcore?
|
||||
### 你应该使用 ProcDump 还是 gcore?
|
||||
|
||||
There are several cases where you might prefer using ProcDump instead of gcore, and ProcDump has a few built-in features that might be useful in general.
|
||||
有几种情况下,你可能更喜欢使用 ProcDump 而不是 gcore,ProcDump 有一些内置的功能,在一般情况下可能很有用。
|
||||
|
||||
#### Waiting for a test binary to execute
|
||||
#### 等待测试二进制文件的执行
|
||||
|
||||
Whether you use ProcDump or gcore, the test process must be executed and in a running state so that you can provide a PID to generate a core file. But ProcDump has a feature that waits until a specific binary runs; once it finds a test binary running that matches that given name, it generates a core file for that test binary. It can be enabled using the `-w` argument and the program's name instead of a PID. This feature can be useful in instances where the test program exits quickly.
|
||||
|
||||
Here's how it works. In this example, there is no process named `progxyz` running:
|
||||
无论是使用 ProcDump 还是 gcore,测试进程必须被执行并处于运行状态,这样才能提供一个 PID 来生成核心文件。但 ProcDump 有一个功能,就是等待特定的二进制文件运行,一旦发现运行的测试二进制文件与给定的名称相匹配,它就会为该测试二进制文件生成一个核心文件。它可以使用 `-w` 参数和程序名称而不是 PID 来启用。这个功能在测试程序快速退出的情况下很有用。
|
||||
|
||||
下面是它的工作原理。在这个例子中,没有名为 `progxyz` 的进程在运行:
|
||||
|
||||
```
|
||||
$ pgrep progxyz
|
||||
$
|
||||
```
|
||||
|
||||
Invoke `procdump` with the `-w` command to keep it waiting. From another terminal, invoke the test binary `progxyz`:
|
||||
|
||||
用 `-w` 参数调用 `procdump`,让它保持等待。在另一个终端,调用测试二进制 `progxyz`:
|
||||
|
||||
```
|
||||
$ procdump -w progxyz
|
||||
@ -312,17 +298,15 @@ Press Ctrl-C to end monitoring without terminating the process.
|
||||
[03:39:23 - INFO]: Waiting for process 'progxyz' to launch...
|
||||
```
|
||||
|
||||
Then, from another terminal, invoke the test binary `progxyz`:
|
||||
|
||||
然后,从另一个终端调用测试二进制 `progxyz`:
|
||||
|
||||
```
|
||||
$ ./progxyz &
|
||||
$ ./progxyz &
|
||||
[1] 350951
|
||||
$
|
||||
```
|
||||
|
||||
ProcDump immediately detects that the binary is running and dumps the core file for this binary:
|
||||
|
||||
ProcDump 立即检测到二进制正在运行,并转储这个二进制的核心文件:
|
||||
|
||||
```
|
||||
[03:39:23 - INFO]: Waiting for process 'progxyz' to launch...
|
||||
@ -339,13 +323,12 @@ progxyz_time_2020-06-24_03:43:22.350951: ELF 64-bit LSB core file, x86-64, versi
|
||||
$
|
||||
```
|
||||
|
||||
#### Multiple core dumps
|
||||
|
||||
Another important ProcDump feature is that you can specify how many core files to generate by using the command-line argument `-n <count>`. The default time gap between the core dumps is 10 seconds, but you can modify this using the `-s <sec>` argument. This example uses ProcDump to take three core dumps of the test binary:
|
||||
#### 多个核心转储
|
||||
|
||||
另一个重要的 ProcDump 功能是,你可以通过使用命令行参数 `-n <count>` 指定要生成多少个核心文件。核心转储之间的默认时间间隔是 `10` 秒,但你可以使用 `-s <sec>` 参数修改。这个例子使用 ProcDump 对测试二进制文件进行了三次核心转储:
|
||||
|
||||
```
|
||||
$ ./progxyz &
|
||||
$ ./progxyz &
|
||||
[1] 351014
|
||||
$
|
||||
$ procdump -n 3 -p 351014
|
||||
@ -379,31 +362,27 @@ $ ls -l progxyz_time_2020-06-24_03\:45\:*
|
||||
$
|
||||
```
|
||||
|
||||
#### Core dump based on CPU and memory usage
|
||||
#### 基于 CPU 和内存使用情况的核心转储
|
||||
|
||||
ProcDump also enables you to trigger a core dump when a test binary or process reaches a certain CPU or memory threshold. ProcDump's man page shows the command-line arguments to use when invoking ProcDump:
|
||||
ProcDump 还可以让你在测试二进制或进程达到一定的 CPU 或内存阈值时触发核心转储。ProcDump 的手册页显示了调用 ProcDump 时使用的命令行参数:
|
||||
|
||||
- `-C`:当 CPU 超过或等于指定值时,触发核心转储生成(0 到 100 * nCPU)。
|
||||
- `-c`:当 CPU 小于指定值时,触发核心转储生成(0 到 100 * nCPU)。
|
||||
- `-M`:当内存提交超过或等于指定值(MB)时,触发核心转储生成。
|
||||
- `-m`:当内存提交小于指定值(MB)时,触发核心转储生成。
|
||||
- `-T`:当线程数超过或等于指定值时触发。
|
||||
- `-F`:当文件描述符数量超过或等于指定值时触发。
|
||||
- `-I`:轮询频率,单位为毫秒(默认为 1000)。
|
||||
|
||||
例如,当给定 PID 的 CPU 使用率超过 70% 时,可以要求 ProcDump 转储核心:
|
||||
|
||||
```
|
||||
-C Trigger core dump generation when CPU exceeds or equals specified value (0 to 100 * nCPU)
|
||||
-c Trigger core dump generation when CPU is less than specified value (0 to 100 * nCPU)
|
||||
-M Trigger core dump generation when memory commit exceeds or equals specified value (MB)
|
||||
-m Trigger core dump generation when when memory commit is less than specified value (MB)
|
||||
-T Trigger when thread count exceeds or equals specified value.
|
||||
-F Trigger when filedescriptor count exceeds or equals specified value.
|
||||
-I Polling frequency in milliseconds (default is 1000)
|
||||
procdump -C 70 -n 3 -p 351014
|
||||
```
|
||||
|
||||
For example, you can ask ProcDump to dump the core when the given PID's CPU usage exceeds 70%:
|
||||
### 结论
|
||||
|
||||
|
||||
```
|
||||
`procdump -C 70 -n 3 -p 351014`
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
ProcDump is an interesting addition to the long list of Windows programs being ported to Linux. Not only does it provide additional tooling options to Linux users, but it can also make Windows users feel more at home when working on Linux.
|
||||
ProcDump 是一长串被移植到 Linux 的 Windows 程序中的一个有趣的补充。它不仅为 Linux 用户提供了额外的工具选择,而且可以让 Windows 用户在 Linux 上工作时更有熟悉的感觉。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -411,7 +390,7 @@ via: https://opensource.com/article/20/7/procdump-linux
|
||||
|
||||
作者:[Gaurav Kamathe][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -0,0 +1,154 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Manjaro vs Arch Linux: What’s the Difference? Which one is Better?)
|
||||
[#]: via: (https://itsfoss.com/manjaro-vs-arch-linux/)
|
||||
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
|
||||
|
||||
Manjaro 和 Arch Linux 有何不同,哪个更好?
|
||||
======
|
||||
|
||||
> Manjaro 还是 Arch Linux?如果说 Manjaro 是基于 Arch 的,那么它和 Arch 又有什么不同呢?请在这篇比较文章中阅读 Arch 和 Manjaro 的不同之处吧。
|
||||
|
||||
大多数[适合初学者的 Linux 发行版][1]都是基于 Ubuntu 的。随着 Linux 用户经验的增加,一些人开始尝试使用更高级的发行版,主要是在“Arch领域”。
|
||||
|
||||
这个 Arch 领域以两个发行版为主。[Arch Linux][2] 本身和 [Manjaro][3]。还有其他[基于 Arch 的 Linux 发行版][4],但都没有这两个发行版受欢迎。
|
||||
|
||||
如果你在 Arch 和 Manjaro 之间感到困惑,那么这个比较应该能帮助你。
|
||||
|
||||
### Manjaro 和 Arch Linux:它们有什么不同或相似之处?
|
||||
|
||||
![][5]
|
||||
|
||||
我试图在各个方面比较这两种发行版。请记住,我并没有只关注差异,我还指出了它们的相似之处。
|
||||
|
||||
#### 两者都是滚动发布的版本,但不是同一种类型
|
||||
|
||||
在 Arch 和 Manjaro 中,没有像 Ubuntu 或 Fedora 那样每隔几个月或几年就会有一次“发布”。只要[保持你的 Arch 或 Manjaro 系统的更新][6],你将永远拥有最新版本的操作系统和软件包。你不需要像以往一样担心升级你的安装版本。
|
||||
|
||||
如果你打算在某个时候进行全新安装,请记住,Manjaro 和 Arch 都会定期更新它的安装 ISO。这被称为 ISO 刷新,它确保新安装的系统不必安装过去几个月中所有可用的新系统更新。
|
||||
|
||||
但 Arch 和 Manjaro 的滚动发布模式是有区别的。
|
||||
|
||||
除了社区维护的 Arch 用户软件库(AUR)之外,Manjaro 维护着自己独立的软件库。这些软件库也包含非 Arch 提供的软件包。那些由 Arch 官方软件库所提供的流行软件包将首先进行彻底的测试(必要时打上补丁),然后 Manjaro 再发布,通常比 Arch 晚两周左右,发布到 Manjaro 自己的稳定软件库供公众使用。
|
||||
|
||||
![][7]
|
||||
|
||||
适应这个测试过程的一个后果是,Manjaro 永远不会像 Arch 一样具有激进尝鲜。但这样一来,就使得 Manjaro 比 Arch 稍微稳定一些,也不容易破坏你的系统。
|
||||
|
||||
#### 包管理 - Pacman 和 Pamac
|
||||
|
||||
Arch 和 Manjaro 都提供了基于命令行的软件包管理工具 Pacman,它是用 C 语言编写的,使用 tar 来打包应用程序。换句话说,你可以[使用相同的 pacman 命令][8]来管理两个发行版的软件包。
|
||||
|
||||
除了 Pacman,Manjaro 还开发了一个名为 Pamac 的 GUI 应用程序,用于在 Manjaro 上轻松安装软件。这使得使用 Manjaro 比使用 Arch 更容易。
|
||||
|
||||
![Manjaro 的 Pamac GUI P包管理器][9]
|
||||
|
||||
请注意,你也可以在 Arch Linux 中从 AUR 安装 Pamac,但该工具是 Manjaro 的组成部分。
|
||||
|
||||
#### Manjaro 硬件检测工具(MHWD)
|
||||
|
||||
Pamac 并不是 Manjaro 团队开发的唯一帮助用户的 GUI 工具。Manjaro 还有一个专门的工具,用于检测硬件并为其推荐驱动程序。
|
||||
|
||||
![Manjaro 硬件配置 GUI 工具][10]。
|
||||
|
||||
这个硬件检测工具非常有用,可以说是 [Manjaro 受到社区喜爱的主要原因][11]之一。它使得检测/安装/使用或从一个驱动切换到另一个驱动都非常简单,让硬件兼容性成为了过去的问题。
|
||||
|
||||
#### 驱动程序支持
|
||||
|
||||
Manjaro 为 GPU 驱动提供了极大的支持。我们都知道多年来 Linux 在安装驱动程序(特别是 Nvidia)方面存在问题。
|
||||
|
||||
当[安装 Manjaro][12] 时,它给出了从开源(自由)或非开源(非自由)图形驱动安装开始的选项。当你选择“非自由”时,它会自动检测你的显卡,并为其安装最合适的驱动程序,因此 GPU 可以开箱即用。
|
||||
|
||||
由于有了上一节中看到的硬件检测工具,甚至安装 Manjaro 时,安装显卡驱动会更加容易。
|
||||
|
||||
如果你有一个带有 Nvidia Optimus 卡(混合 GPU)的系统,它与 Manjaro 配合良好。你会有很多方式来让它工作。
|
||||
|
||||
在 Arch Linux 中,你必须为你的机器安装(如果你能找到)合适的驱动程序。
|
||||
|
||||
#### 访问 Arch 用户软件库(AUR)
|
||||
|
||||
[Arch 用户软件库][13](AUR)是一个面向基于 Arch 的 Linux 发行版用户的社区驱动的软件库。AUR 的创建是为了组织和分享来自社区的新软件包,并帮助加快流行软件包被纳入[社区软件库][14]。
|
||||
|
||||
大量进入官方软件库的新软件包都是从 AUR 开始的。在 AUR 中,用户能够贡献自己的软件包构建(`PKGBUILD` 和相关文件)。
|
||||
|
||||
你可以在 Arch 和 Manjaro 中使用 AUR。
|
||||
|
||||
#### 桌面环境
|
||||
|
||||
好吧!你可以在任何 Linux 发行版上使用几乎所有的桌面环境。Arch 和 Manjaro 也不例外。
|
||||
|
||||
然而,一个专门的桌面风格或版本可以让用户更容易地对上述桌面环境进行无缝体验。
|
||||
|
||||
默认的 Arch ISO 并不包含任何桌面环境。例如,你想[在 Arch Linux 上安装 KDE][15],你必须在[安装 Arch Linux][16] 时或之后下载并安装它。
|
||||
|
||||
而 Manjaro 则为 Xfce、KDE 和 GNOME 等桌面环境提供了不同的 ISO。Manjaro 社区还维护着 MATE、Cinnamon、LXDE、LXQt、OpenBox 等桌面环境的 ISO。
|
||||
|
||||
#### 安装程序
|
||||
|
||||
![Arch 即用启动][17]
|
||||
|
||||
Manjaro 是基于 Arch Linux 的,它是兼容 Arch 的,但**它不是 Arch**。它甚至不是只有一个图形安装程序的预配置版本的 Arch。Arch 并不具备通常的舒适的开箱即用,这也是为什么大多数人喜欢更简单的东西。Manjaro 为你提供了简单的入口,但支持你成为经验丰富的用户或资深用户。
|
||||
|
||||
#### 文档和支持
|
||||
|
||||
Arch 和 Manjaro 都有自己的维基页面和支持论坛来帮助各自的用户。
|
||||
|
||||
虽然 Manjaro 有一个不错的[维基][18]文档,但 [Arch 维基][19]则完全不同。你可以在 Arch 维基中找到关于 Arch Linux 各方面的详细信息。
|
||||
|
||||
#### 目标受众
|
||||
|
||||
关键的区别在于 [Arch 针对的是抱着自己动手的态度的用户][20],他们愿意阅读文档,自己解决问题。
|
||||
|
||||
而 Manjaro 则是针对那些没有那么多经验或者不想花时间组装操作系统的 Linux 用户。
|
||||
|
||||
### 结论
|
||||
|
||||
有些人经常说 Manjaro 是给那些不会安装 Arch 的人用的。但我认为这是不对的。不是每个人都想从头配置 Arch,或者没有太多时间。
|
||||
|
||||
Manjaro 绝对是一只野兽,但与 Arch 截然不同。**快速、强大,并总是保持更新**,Manjaro 提供了 Arch 操作系统的所有优点,但特别强调**稳定性、用户友好性和可访问性**,适合新手和有经验的用户。
|
||||
|
||||
Manjaro 并不像 Arch Linux 那样极简主义。在 Arch 中,你从一个空白的画布开始,手动调整每个设置。当默认的 Arch 安装完成后,你在命令行就有了一个正在运行的 Linux 实例。想要一个[图形化桌面环境][21]?那就自己来吧 —— 有很多选择。选择一个,安装,然后配置它。你可以从中学到很多东西,特别是如果你是 Linux 新手的话。你会对系统是如何组合在一起的,以及为什么要以这样的方式安装东西有很好的理解。
|
||||
|
||||
我希望你现在对 Arch 和 Manjaro 有了更好的理解。你明白了它们的相似,却又不同。
|
||||
|
||||
我已经发表了我的看法。不要犹豫,请在评论区分享你的观点。在 Arch 和 Manjaro 之间,你更喜欢哪一个,为什么。
|
||||
|
||||
Abhishek Prakash 补充了更多内容。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/manjaro-vs-arch-linux/
|
||||
|
||||
作者:[Dimitrios Savvopoulos][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/dimitrios/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/best-linux-beginners/
|
||||
[2]: https://www.archlinux.org/
|
||||
[3]: https://manjaro.org/
|
||||
[4]: https://itsfoss.com/arch-based-linux-distros/
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/arch-vs-manjaro.png?ssl=1
|
||||
[6]: https://itsfoss.com/update-arch-linux/
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/repositories.png?ssl=1
|
||||
[8]: https://itsfoss.com/pacman-command/
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Pamac.png?resize=800%2C534&ssl=1
|
||||
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/hardware-detection.png?ssl=1
|
||||
[11]: https://itsfoss.com/why-use-manjaro-linux/
|
||||
[12]: https://itsfoss.com/install-manjaro-linux/
|
||||
[13]: https://itsfoss.com/aur-arch-linux/
|
||||
[14]: https://wiki.archlinux.org/index.php/Community_repository
|
||||
[15]: https://itsfoss.com/install-kde-arch-linux/
|
||||
[16]: https://itsfoss.com/install-arch-linux/
|
||||
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-live-boot.jpg?ssl=1
|
||||
[18]: https://wiki.manjaro.org/index.php?title=Main_Page
|
||||
[19]: https://wiki.archlinux.org/
|
||||
[20]: https://itsfoss.com/why-arch-linux/
|
||||
[21]: https://itsfoss.com/best-linux-desktop-environments/
|
Loading…
Reference in New Issue
Block a user