How to install GCC with deb?

Asked by Caipenghui

Hello, everyone:
  My computer is loaded with ubuntu18.04 LTS, but my computer is not connected to the Internet, so I can't install GCC online. So I have a network in another computer from https://packages.ubuntu.com/bionic-updates/devel/gcc download deb into the u disk to install on my Ubuntu 18.04.

What's the use of deb? How does deb install GCC?I know that deb can't solve the dependency problem, what can we do?

                                                                                   Caipenghui
                                                                               Nov 17, 2018

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

The package management system in Ubuntu keeps track of all mutual dependencies between packages. If you cannot connect to the internet, but want to install packages manually, then you have to take care yourself, that all dependencies are met.

You want to install the gcc package.
You have already found the page https://packages.ubuntu.com/bionic-updates/devel/gcc
This page tells (with red dots) that for installing this version of gcc, you need to have installed cpp and gcc-7.
cpp in turn depends on cpp-7 which in turn depends on gcc-7-base and some other packages.

So this can be a very long chain of dependencies. You have to download all those packages (in *.deb format) and install them on your system if you do not yet have them installed.

For installation of the packages you can e.g. use the command "sudo dpkg --install package1.deb package2.deb …"
If you are missing a dependency, then you will receive an error message for this command.

It probably would be easier to connect this system to the internet (at least temporarily) for an automatic resolving of dependencies.

Revision history for this message
Caipenghui (caipenghui) said :
#2

Compile gcc with source code or deb? Ubuntu18.04 LTS offline installation Is there a gcc compiler?

Revision history for this message
Caipenghui (caipenghui) said :
#3

If I want to download libc6 (>= 2.14) [amd64] where to download

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

I am quite sure, that you have libc6 already installed.
What is the output of the command

dpkg -l libc6
apt-cache policy libc6

"deb" files contain precompiled software. If you install the gcc deb file, then there should not be a need for compiling it from source.

What exactly do you want to achieve?

Revision history for this message
Caipenghui (caipenghui) said :
#5

于 November 18, 2018 10:27:45 AM UTC, Manfred Hampl <email address hidden> 写到:
> Your question #676229 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/676229
>
> Manfred Hampl requested more information:
> I am quite sure, that you have libc6 already installed.
> What is the output of the command
>
> dpkg -l libc6
> apt-cache policy libc6
>
> "deb" files contain precompiled software. If you install the gcc deb
> file, then there should not be a need for compiling it from source.
>
> What exactly do you want to achieve?

I just don't understand, the deb file is very small, no gcc source package size is large, solve the gcc deb dependent file can successfully install gcc?

Revision history for this message
Caipenghui (caipenghui) said :
#6

于 November 18, 2018 10:27:45 AM UTC, Manfred Hampl <email address hidden> 写到:
> Your question #676229 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/676229
>
> Manfred Hampl requested more information:
> I am quite sure, that you have libc6 already installed.
> What is the output of the command
>
> dpkg -l libc6
> apt-cache policy libc6
>
> "deb" files contain precompiled software. If you install the gcc deb
> file, then there should not be a need for compiling it from source.
>
> What exactly do you want to achieve?

Brother, I really want to install gcc through deb, but I don't know how to install gcc compiler to learn c language, because my computer has no network, so I can't install gcc through apt get. To be honest, this is very inconvenient. Can you provide gcc's deb dependency file to me? please. I am a good boy.Thank you very much!

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

Look at https://packages.ubuntu.com/bionic-updates/devel/gcc

The gcc deb file is only 5 KB in size, because this package does not contain much by itself. But this package depends on other packages, which contain the real functionality.
e.g. https://packages.ubuntu.com/bionic-updates/gcc-7 - 7 MB size and https://packages.ubuntu.com/bionic-updates/cpp-7 6 MB

You can install gcc only, if you have installed gcc-7 and cpp-7 and some additional packages.

Revision history for this message
Caipenghui (caipenghui) said :
#8

于 November 18, 2018 12:43:46 PM UTC, Manfred Hampl <email address hidden> 写到:
> Your question #676229 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/676229
>
> Status: Open => Answered
>
> Manfred Hampl proposed the following answer:
> Look at https://packages.ubuntu.com/bionic-updates/devel/gcc
>
> The gcc deb file is only 5 KB in size, because this package does not
> contain much by itself. But this package depends on other packages,
> which contain the real functionality.
> e.g. https://packages.ubuntu.com/bionic-updates/gcc-7 - 7 MB size and
> https://packages.ubuntu.com/bionic-updates/cpp-7 6 MB
>
> You can install gcc only, if you have installed gcc-7 and cpp-7 and
> some
> additional packages.

Thank you, I know. I have put all these dependencies down, how to install them?

dpkg -i?

One by one installation is too much trouble. headache

Revision history for this message
Manfred Hampl (m-hampl) said :
#9

Yes, the right command for installing software from deb packages is
sudo dpkg --install …
or
sudo dpkg -i …

If you have put the deb files into a directory, you can use wildcards
sudo dpkg --install *.deb
or use the --recursive option
sudo dpkg --install --recursive /path/to/directory

Can you help with this problem?

Provide an answer of your own, or ask Caipenghui for more information if necessary.

To post a message you must log in.