Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to test a software package without installing software in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to test a software package without installing software in Linux". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to test a software package without installing software in Linux".

For some reason, you may need to test the package before installing it on your Linux system. If that's the case, you're lucky! Today, I'm going to show you how to use the Nix package manager in Linux. A striking feature of the Nix package manager is that it allows users to test packages without first installing them. This is helpful when you want to use a specific program temporarily.

Test a package without installing it in Linux

Make sure you install the Nix package manager first. If it is not installed, refer to the following guide.

For example, suppose you want to test your C++ code. You don't have to install GCC. Simply run the following command:

$nix-shell-p gcc

This command builds or downloads the gcc package and its dependencies, and then puts it into a Bash shell where the gcc command exists, none of which affects the normal environment.

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 CurrentDload Upload Total Spent Left Speed100 8324 8324 00 6353 00: 00:01 0:00:01--:-6373 [nix-shell:~] $

Check the GCC version:

[nix-shell:~] $gcc- vUsing built-in specs.COLLECT_GCC=/nix/store/dyj2k6ch45r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/bin/gccCOLLECT_LTO_WRAPPER=/nix/store/dyj2k6ch45r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/libexec/gcc/x86_64-unknown-linux-gnu/5.4.0/lto-wrapperTarget: x86_64-unknown-linux-gnuConfigured with:Thread model: posixgcc version 5.4.0 (GCC)

Now, continue and test the code. When finished, type exit to return to the console.

[nix-shell:~] $exitexit

Once you quit from nix-shell, you cannot use GCC.

This is another example.

$nix-shell-p hello

This will build or download GNU Hello and its dependencies, and then put it into the Bash shell where the hello command is located, all of which will not affect your normal environment:

[nix-shell:~] $helloHello, world!

Enter exit to return to the console.

[nix-shell:~] $exit

Now test whether your hello program is available.

$hellohello: the above command not found is all the contents of the article "how to test a software package without installing software in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report