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 install and switch multiple software versions of Ubuntu

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

Share

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

This article will explain in detail how to install and switch multiple software versions of Ubuntu. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Preface

In Ubuntu systems, it may be due to usage habits or compilation environment requirements that you want to install multiple versions of the same software in the system, which can be switched when needed.

Here, take gcc as an example, when compiling some software, you may rely on the version of gcc or Gmail + that does not conform to the system version, in most cases, it is lower than the system version, but you do not want to delete the system gcc and Gmail versions, because other software may need to maintain the current version, so you can install and retain multiple gcc and Gmail + versions in ubuntu and switch when needed.

Environment

System: Ubuntu 14.04

Installation

Gcc, Gmail + and gfortran of the current system are all supported by the system by default (no additional version number is required for installation, as follows), assuming that the current version is all 4.8.*

Sudo apt-get install gcc gathers + gfortran

Then I hope the system can also support version 4.7.* (add the version number to install)

Sudo apt-get install gcc-4.7 glittering PUF4.7 gfortran-4.7

In this way, two versions (4.8,4.7) are installed on the system, both of which are installed in'/ usr/bin/',. You can view them using the following command

Ll / usr/bin/gcc*ll / usr/bin/g++*ll / usr/bin/gfortran*

You can see that both versions are installed correctly (some of which are not version number suffix files need not be considered), but you can see that gcc, Gmail + and gfortran used by the system by default all point to version 4.8. You can use the following command to check their respective versions

Gcc-vg++-vgfortran-v

You can see that they are all version 4.8, so how to switch to other installed versions, see below.

Configuration

Using the update-alternatives command here is a script for switching among multiple commands of the same type, which can be installed through apt-get install dpkg in debian. Here we do not describe the command in detail, the value introduces the three commands we use, we want to know more about ourselves to consult the relevant information.

The following is only an example of how to use gcc, which is the same as gfortran.

# # Command

Usage: update-alternatives [...]-- the higher the priority number of install, the higher the priority-- remove removes items from the replacement group. -- display displays information about the replacement group. -- config lists the options in the replacement group and asks the user about which one to use. Install

This parameter is to add an available link to the command

Sudo update-alternatives-install / usr/bin/gcc gcc / usr/bin/gcc-4.8 20sudo update-alternatives-install / usr/bin/gcc gcc / usr/bin/gcc-4.7 10

If you look at'/ usr/bin/gcc' again after installation, you can see that the link already points to'/ etc/alternatives/gcc', so all the links established are saved under the'/ etc/alternatives' folder.

Config

This parameter selects the link value to be used for the command, which is equivalent to switching among the available link. After switching, use 'gcc-v' to check that the version number has changed.

Sudo update-alternatives-config gccdisplay

This parameter displays all available link for the command

Sudo update-alternatives-display gccremove

This parameter is used to delete link that the command does not want to continue to use.

Sudo update-alternatives-remove gcc / usr/bin/gcc-4.7 article on "how to install and switch multiple software versions of Ubuntu" ends here. I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Internet Technology

Wechat

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

12
Report