Linux中國
如何在 Linux 中不安裝軟體測試一個軟體包
出於某種原因,你可能需要在將軟體包安裝到你的 Linux 系統之前對其進行測試。如果是這樣,你很幸運!今天,我將向你展示如何在 Linux 中使用 Nix 包管理器來實現。Nix 包管理器的一個顯著特性是它允許用戶測試軟體包而無需先安裝它們。當你想要臨時使用特定的程序時,這會很有幫助。
測試一個軟體包而不在 Linux 中安裝它
確保你先安裝了 Nix 包管理器。如果尚未安裝,請參閱以下指南。
例如,假設你想測試你的 C++ 代碼。你不必安裝 GCC。只需運行以下命令:
$ nix-shell -p gcc
該命令會構建或下載 gcc 軟體包及其依賴項,然後將其放入一個存在 gcc 命令的 Bash shell 中,所有這些都不會影響正常環境。
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
download-using-manifests.pl: perl: warning: Setting locale failed.
download-using-manifests.pl: perl: warning: Please check that your locale settings:
download-using-manifests.pl: LANGUAGE = (unset),
download-using-manifests.pl: LC_ALL = (unset),
download-using-manifests.pl: LANG = "en_US.UTF-8"
download-using-manifests.pl: are supported and installed on your system.
download-using-manifests.pl: perl: warning: Falling back to the standard locale ("C").
download-from-binary-cache.pl: perl: warning: Setting locale failed.
download-from-binary-cache.pl: perl: warning: Please check that your locale settings:
download-from-binary-cache.pl: LANGUAGE = (unset),
download-from-binary-cache.pl: LC_ALL = (unset),
download-from-binary-cache.pl: LANG = "en_US.UTF-8"
[...]
fetching path 『/nix/store/6mk1s81va81dl4jfbhww86cwkl4gyf4j-stdenv』...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
*** Downloading 『https://cache.nixos.org/nar/0aznfg1g17a8jdzvnp3pqszs9rq2wiwf2rcgczyg5b3k6d0iricl.nar.xz』 to 『/nix/store/6mk1s81va81dl4jfbhww86cwkl4gyf4j-stdenv』...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8324 100 8324 0 0 6353 0 0:00:01 0:00:01 --:--:-- 6373
[nix-shell:~]$
檢查GCC版本:
[nix-shell:~]$ gcc -v
Using built-in specs.
COLLECT_GCC=/nix/store/dyj2k6ch35r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/bin/gcc
COLLECT_LTO_WRAPPER=/nix/store/dyj2k6ch35r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/libexec/gcc/x86_64-unknown-linux-gnu/5.4.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
gcc version 5.4.0 (GCC)
現在,繼續並測試代碼。完成後,輸入 exit 返回到控制台。
[nix-shell:~]$ exit
exit
一旦你從 nix-shell 中退出,你就不能使用 GCC。
這是另一個例子。
$ nix-shell -p hello
這會構建或下載 GNU Hello 和它的依賴關係,然後將其放入 hello 命令所在的 Bash shell 中,所有這些都不會影響你的正常環境:
[nix-shell:~]$ hello
Hello, world!
輸入 exit 返回到控制台。
[nix-shell:~]$ exit
現在測試你的 hello 程序是否可用。
$ hello
hello: command not found
有關 Nix 包管理器的更多詳細信息,請參閱以下指南。
希望本篇對你有幫助!還會有更好的東西。敬請關注!!
乾杯!
via: https://www.ostechnix.com/how-to-test-a-package-without-installing-it-in-linux/
作者:SK 選題:lujun9972 譯者:geekpi 校對:wxy
本文轉載來自 Linux 中國: https://github.com/Linux-CN/archive
對這篇文章感覺如何?
太棒了
0
不錯
0
愛死了
0
不太好
0
感覺很糟
0
More in:Linux中國
捐贈 Let's Encrypt,共建安全的互聯網
隨著 Mozilla、蘋果和谷歌對沃通和 StartCom 這兩家 CA 公司處罰落定,很多使用這兩家 CA 所簽發證書的網站紛紛尋求新的證書籤發商。有一個非盈利組織可以為大家提供了免費、可靠和安全的 SSL 證書服務,這就是 Let's Encrypt 項目。現在,它需要您的幫助
Let's Encrypt 正式發布,已經保護 380 萬個域名
由於 Let's Encrypt 讓安裝 X.509 TLS 證書變得非常簡單,所以這個數量增長迅猛。
關於Linux防火牆iptables的面試問答
Nishita Agarwal是Tecmint的用戶,她將分享關於她剛剛經歷的一家公司(印度的一家私人公司Pune)的面試經驗。在面試中她被問及許多不同的問題,但她是iptables方面的專家,因此她想分享這些關於iptables的問題和相應的答案給那些以後可能會進行相關面試的人。 所有的問題和相應的答案都基於Nishita Agarwal的記憶並經過了重寫。 嗨,朋友!我叫Nishita Agarwal。我已經取得了理學學士學位,我的專業集中在UNIX和它的變種(BSD,Linux)。它們一直深深的吸引著我。我在存儲方面有1年多的經驗。我正在尋求職業上的變化,並將供職於印度的P
Lets Encrypt 已被所有主流瀏覽器所信任
旨在讓每個網站都能使用 HTTPS 加密的非贏利組織 Lets Encrypt 已經得了 IdenTrust的交叉簽名,這意味著其證書現在已經可以被所有主流的瀏覽器所信任。從這個裡程碑事件開始,訪問者訪問使用了Lets Encrypt 證書的網站不再需要特別配置就可以得到 HTTPS 安全保護了。 Lets Encrypt 的兩個中級證書 ...

















