Brief: This beginner’s guide shows you what you can do with apt-get commands in Linux, how to use them to find new packages, install and upgrade new packages, and clean your system. If you have started using Ubuntu or any Ubuntu-based Linux distribution, such as Linux Mint, elementary OS, etc., you must have come across the apt-get command by now. How to install specific Ubuntu packages, with exact version? closed 去试试: crifan@ubuntu:xmlrpc-c-1.06.31$ sudo apt-get install libtool=2.4 Reading package lists. Done Building dependency tree Reading state information. If you did a standard./configure; make without passing any options to configure, then make install will place the pieces of your desired version of GCC in various subdirectories of /usr/local. The /usr/local directory tree is intended for software installed by the system administrator outside of the package-management system (ie. Exactly what you're doing). This tutorial will help you to install specific version of packages using apt-get. First of all, list all available version of the package. For example to find available version of firefox run the following command. Sudo apt policy firefox The above command shows two version’s of firefox. Now, run the below command to install firefox version.
Active8 months ago
This question appears to be addressed properly in several questions and otherplaces easily found with Google, but I don't find the solution satisfactoryfor the reasons explained below. But just for completion, I've included somerelevant links:
https://askubuntu.com/questions/138284/how-to-downgrade-a-package-via-apt-gethttps://askubuntu.com/questions/428772/how-to-install-specific-version-of-some-package/428778https://askubuntu.com/questions/26498/choose-gcc-and-g-version..
And others.
However, this question is regarding installing a very specific version of GCC in Kali Linux, which does not appear readily available as a specific package. In particular, the question is regarding how to install version 6.3.0, as I need this version to compile a particular program: https://www.reddit.com/r/Monero/comments/6d0ah8/xmrig_miner_new_release/
(as a bonus question, if there is a more sane way to fix this particularissue without using a different version of GCC, feel free to answer, but I believe this question is general and I would like to know how to do it regardless of how to make the aforementioned program link correctly)
The versions which are available to install of any package, e.g. gcc, can bedetermined with:
Which will list the available versions under 'versions:', e.g.
Installation is then as simple as issuing
This will install the older version 4:4.9.2-2, by simply (I believe)overwriting the 7.2.0-1d1 install, if present.
To get version 4:4.9.2-2 available at all, I had to add
debhttp://old.kali.org/kali sana main non-free contrib
to my/etc/apt/sources.list
file and then run apt-get update
. Free t- shirt design tools.However, what if the version I need is not listed?
I've been experimenting with various sources, e.g. those found here:http://snapshot.debian.org/ and at various other questions and websites from Google searches.
Most of them give me ignore or errors, e.g. as follows
Even if this would work, it seems to be a very bad approach to get aparticular version installed, as adding some arbitrary source might not have the particular version I want.
If I search on snapshot.debian.org for gcc, I get only very old versions: http://snapshot.debian.org/package/gcc/
I eventually became frustrated with this approach and compiled GCC 6.3.0 from the source tarball. The compilation was successful, but then I'm faced with how to install it. I'm cautious about running
make install
as I fear it will tamper with apt
and dpkg
and possibly break the system.Instead, I attempted to run it from the build directory, directly. I tried to simply add the build directory as the first entry in my PATH, which didn't work. Then, I attempted to rename
/usr/bin/gcc
and do a symlink from /usr/bin/gcc
to where my gcc-6.3.0 executable lives. This presents the following problem:This was fixed with another entry in my PATH.
Then, I get this error:
Which I assume is because of a missing entry in
/usr/lib/gcc/x86_64-linux-gnu
. I tried to make a symlink from 6 to 6.3.0, but this wasn't sufficient. I also tried to actually copy everything with cp -R
, same result.This should be a 64-bit program, but I also considered the same for
/usr/lib/gcc/i686-linux-gnu
.I'm sure I could start doing
terdon♦strace
to see where it attempts to open the files from, read log files, read the source, and eventually I imagine I'd be able to figure out how to hack together a poorly conceived solution. But it would be nice if someone could tell me how to do this in a sane manner.143k3535 gold badges296296 silver badges473473 bronze badges
AlphaCentauriAlphaCentauri28611 gold badge22 silver badges1212 bronze badges
5 Answers
How to install a specific version of GCC in Kali Linux?
GCC 6 is available on kali linux it can be installed as follow :
To switch between gcc6 and gcc7
sample output:
Select your default
gcc
version.on 2017-08-05 the gcc-6 version is upgraded from
6.3.0
to 6.4.0
.Installing
xmrig
following the build's instructions.Building a specific gcc version
6.3.0
Download the tarball from the closest mirror : GCC Releases
Add
gcc-6.3
to update-alternatives
Important : The
GAD3RGAD3R--disable-multilib
option is required to configure and build gcc
for the current architecture.31.7k1919 gold badges6767 silver badges126126 bronze badges
- First you have to go to this website : http://gcc.gnu.org/mirrors.html
- Then select old-releases and you will see different versions.
- Now you should click in the one that you want to have and the download will start.
- Finally, you have to compile and install from source: https://askubuntu.com/questions/25961/how-do-i-install-a-tar-gz-or-tar-bz2-file
Prashant LuharPrashant Luhar
If you did a standard
./configure; make
without passing any options to configure
, then make install
will place the pieces of your desired version of GCC in various subdirectories of /usr/local
.The
/usr/local
directory tree is intended for software installed by the system administrator outside of the package-management system (ie. exactly what you're doing). As such, software installed there will not break packaged software except in extremely unusual circumstances.GCC in particular is designed around the assumption that you'll have multiple versions installed. It pretty much requires active measures on your part to break anything (eg. by mixing and matching pieces to try to create a hybrid version).
MarkMark2,38011 gold badge1414 silver badges2929 bronze badges
I eventually became frustrated with this approach and compiled GCC 6.3.0 from the source tarball. The compilation was successful,
First, I would recommend, if you compile GCC from its source, to choose a more recent version (e.g. GCC 7 at end of 2017).
Then, be sure to build GCC outside of its source tree and to try first its
configure
script with --help
and to pass more options to its configure
. Read carefully the GCC installation instructions and understand the role of autoconf.In practice, I recommend
- run
/usr/bin/gcc -v
to understand how your system's GCC has been configured - run
apt-get build-dep gcc-6
(or similar) to get recent system's GCC dependencies - create a build directory outside of your GCC source tree, and run further
../configure
(replace..
by appropriate relative path, e.g../gcc-7.2/
) andmake
there. - you probably want to pass at least
--program-suffix=-mine
to thatconfigure
(the-mine
can be replaced by another suffix) and you might even add--prefix=$HOME/soft/
if you don't have root access. You'll probably want additional options toconfigure
and you need to choose and give them carefully. - then a later
make install
(you could even run without being rootmake install DESTDIR=/tmp/gccinst/
and later copy carefully and recursively as root that/tmp/gccinst/
..) would install things in/usr/local/bin/gcc-mine
etc.. (or$HOME/soft/bin/gcc-mine
..) so won't break any system installed files.
Notice that the FHS requires the package management system to leave alone
/usr/local/
(which is the default --prefix
for GCC's configure
)Apt-get Install Specific Version Debian
Basile StarynkevitchBasile Starynkevitch
You can also use a precompiled toolchain or this one for yourspecific architecture (x86_64, glibc, gcc 6.3).
Of course next option is to use a so called rootfs-builder like buildroot or yocto
to generate a toolchain with your specfic gcc version.
to generate a toolchain with your specfic gcc version.
Christian StenzelChristian Stenzel