2012年2月16日 星期四

[Ubuntu] HOWTO: Install gcc-3.4 via apt-get without an Internet connection


1. Find a machine that has an Internet connection and download the following 3 packages

cpp-3.4_3.4.4-6ubuntu8_i386.deb (1707096 bytes)

gcc-3.4_3.4.4-6ubuntu8_i386.deb (484408 bytes)

gcc-3.4-base_3.4.4-6ubuntu8_i386.deb (163028 bytes)



2. On your Breezy machine, create a directory called "gcc-3.4" and copy the above files to it

mkdir ~/gcc-3.4



3. Create a local repository

cd ~/gcc-3.4

sudo apt-get install build-essential

dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz





You should see something like this:

** Packages in archive but missing from override file: **

cpp-3.4 gcc-3.4 gcc-3.4-base



Wrote 3 entries to output Packages file.



4. Edit /etc/apt/sources.list

sudo gedit /etc/apt/sources.list

Comment out all the lines in the file that start with "deb-src http" or "deb http". To comment out a line, add a pound character # to the start of the line. We want to do this because we do not have an Internet connection, so we cannot access any repositories that exist on the Internet.



Then add the following line to the file:

deb file:///home/username/gcc-3.4 ./

Replace "username" with your username. For example, if your usename is "susie" then you would add this line instead: deb file:///home/susie/gcc-3.4 ./



5. Install gcc-3.4

sudo apt-get update

sudo apt-get install gcc-3.4

You should see something like this:

Reading package lists... Done

Building dependency tree... Done

The following extra packages will be installed:

binutils cpp-3.4 gcc-3.4-base

Suggested packages:

binutils-doc gcc-3.4-doc libc6-dev-amd64

Recommended packages:

libc6-dev

The following NEW packages will be installed:

binutils cpp-3.4 gcc-3.4 gcc-3.4-base

0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.

Need to get 0B/3824kB of archives.

After unpacking 15.2MB of additional disk space will be used.

Do you want to continue [Y/n]? y

WARNING: The following packages cannot be authenticated!

gcc-3.4-base cpp-3.4 gcc-3.4

Install these packages without verification [y/N]? y



Preconfiguring packages ...

Selecting previously deselected package binutils.

(Reading database ... 56661 files and directories currently installed.)

Unpacking binutils (from .../binutils_2.16.1-2ubuntu6_i386.deb) ...

Selecting previously deselected package gcc-3.4-base.

Unpacking gcc-3.4-base (from .../gcc-3.4-base_3.4.4-6ubuntu8_i386.deb) ...

Selecting previously deselected package cpp-3.4.

Unpacking cpp-3.4 (from .../cpp-3.4_3.4.4-6ubuntu8_i386.deb) ...

Selecting previously deselected package gcc-3.4.

Unpacking gcc-3.4 (from .../gcc-3.4_3.4.4-6ubuntu8_i386.deb) ...

Setting up binutils (2.16.1-2ubuntu6) ...



Setting up gcc-3.4-base (3.4.4-6ubuntu8) ...

Setting up cpp-3.4 (3.4.4-6ubuntu8) ...

Setting up gcc-3.4 (3.4.4-6ubuntu8) ...



If step 5 doesn't work for you, you may want to try Arktis' tip "sudo dpkg -i filename" after you download the .deb files, where the filename is the .deb file. Try that for all three .deb files in addition to "sudo apt-get install binutils". I think "sudo dpkg -i *.deb" may do the trick.



You should now be able to compile your kernel modules. Following these steps, I was able to compile the kernel modules for my Lucent modem. Once you get an Internet connection, go back and uncomment all the lines you commented out in /etc/apt/sources.list in step 4. You can also remove the line you added to /etc/apt/sources.list and the ~/gcc-3.4 directory if you like.



 



Reference :


0 意見:

張貼留言