Does apt-get install <package> upgrade the package if it is already installed?
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Does apt-get install <package> upgrade the package if it is already installed?
Eg. I have lib-2.0 installed. If I do a apt-get install lib-2.1, will it automatically upgrade lib-2.0 that is already in my system or will it install as a separate package?
||/ Name Version Description
+++-==============-==============-============================================
un g++ <none> (no description available)
un g++-2.95 <none> (no description available)
un g++-3.0 <none> (no description available)
ii g++-3.2 3.2.3-9 The GNU C++ compiler
un g++-3.3 <none> (no description available)
After installing g++-3.3:
||/ Name Version Description
+++-==============-==============-============================================
un g++ <none> (no description available)
un g++-2.95 <none> (no description available)
un g++-3.0 <none> (no description available)
ii g++-3.2 3.2.3-9 The GNU C++ compiler
ii g++-3.3 3.3.3-5 The GNU C++ compiler
After installing g++
||/ Name Version Description
+++-==============-==============-============================================
ii g++ 3.3.3-2 The GNU C++ compiler
un g++-2.95 <none> (no description available)
un g++-3.0 <none> (no description available)
ii g++-3.2 3.2.3-9 The GNU C++ compiler
ii g++-3.3 3.3.3-5 The GNU C++ compiler
Now I have three different versions of g++?
If there are 3 different versions listed in apt-cache search, what is the problem syntax to install: apt-get install <packagename only> or apt-install <packagename>-<version> ?
Eg. apt-cache search ^test
test-1.0
test-1.1
test-1.2
If I want to install test-1.2, do I use apt-get install test (just the package name only) or apt-get install test-1.2?
It depends. apt-get installs the version you specifiy, or if you don't specify whatever the default is. If the default package is 1.2 then yes, if its 1.1 then no. It depends on the package. Usually it the latest version but not always.
There are several packages for g++ simply because there are slight imcompatabilites and other problems. Some programs will only compile with older versions, simply because the older version has a diffrent ABI or had a non-standard behaviour thats been fixed in the newer version, but which the program used, so it fails.
g++ simply points to the g++ 3.3 package, if type the following
cd /usr/bin
ls -l g++*
you'll probably get this
g++ -> g++-3.3
g++-3.2
g++-3.3
I don't think you have 2.95, or 3.0 installed, The cache contains stuff you don't have installed, Its a listing of whats available.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.