debian9.4编译环境

为测试升级openssh,发现debian9.4居然没有gcc和make,记录如下:

1系统iso盘:

debian-9.4.0-amd64-DVD-1.iso

安装过程(略)

2系统环境:

root@debian138:~# uname -a

Linux debian138 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux

root@debian138:~# lsb_release -a

No LSB modules are available.

Distributor ID: Debian

Description: Debian GNU/Linux 9.4 (stretch)

Release: 9.4

Codename: stretch

1.1.1 虚机加载iso

虚机–右键,设置–cd/dvd,指定到iso(通常为安装系统的第一张ISO,):

虚机–右键–连接:

1.1.2 挂载光驱

root@debian138:/mnt# ls -la

total 8

drwxr-xr-x 2 root root 4096 Mar 28 15:07 .

drwxr-xr-x 23 root root 4096 Mar 28 15:19 ..

root@debian138:/mnt# ls /mnt

root@debian138:/mnt#

1.1.2.1 创建挂载点

root@debian138:/mnt# mkdir /mnt/cdrom #cdrom为文件目录

1.1.2.2 挂载光驱

root@debian138:/mnt# mount /dev/sr0 /mnt/cdrom

mount: /dev/sr0 is write-protected, mounting read-only

root@debian138:/mnt# ls /mnt/cdrom/

autorun.inf efi isolinux README.mirrors.txt

boot firmware md5sum.txt README.source

css g2ldr pics README.txt

debian g2ldr.mbr pool setup.exe

dists install README.html tools

doc install.amd README.mirrors.html win32-loader.ini

光驱挂载完成。

1.1.4 Gcc包安装

dpkg方式安装gcc会有较多依赖,不建议采用,演示:

root@debian138:/mnt/cdrom/pool/main/g/gcc-defaults# ls

cpp_6.3.0-4_amd64.deb libgcj-bc_6.3.0-4_amd64.deb

g++_6.3.0-4_amd64.deb libgcj-common_6.3-4_all.deb

gcc_6.3.0-4_amd64.deb

root@debian138:/mnt/cdrom/pool/main/g/gcc-defaults# dpkg -i gcc_6.3.0-4_amd64.deb

Selecting previously unselected package gcc.

(Reading database … 130098 files and directories currently installed.)

Preparing to unpack gcc_6.3.0-4_amd64.deb …

Unpacking gcc (4:6.3.0-4) …

dpkg: dependency problems prevent configuration of gcc:

gcc depends on gcc-6 (>= 6.3.0-9~); however:

Package gcc-6 is not installed.

dpkg: error processing package gcc (–install):

dependency problems – leaving unconfigured

Processing triggers for man-db (2.7.6.1-2) …

Errors were encountered while processing:

1.1.4.1 gcc-6又会有其他依赖

cd gcc-6

root@debian138:/mnt/cdrom/pool/main/g/gcc-6# ls

cpp-6_6.3.0-18+deb9u1_amd64.deb

g++-6_6.3.0-18+deb9u1_amd64.deb

gcc-6_6.3.0-18+deb9u1_amd64.deb

gcc-6-base_6.3.0-18+deb9u1_amd64.deb

gcj-6-jre-lib_6.3.0-18+deb9u1_all.deb

libasan3_6.3.0-18+deb9u1_amd64.deb

libatomic1_6.3.0-18+deb9u1_amd64.deb

libcc1-0_6.3.0-18+deb9u1_amd64.deb

libcilkrts5_6.3.0-18+deb9u1_amd64.deb

libgcc1_6.3.0-18+deb9u1_amd64.deb

libgcc-6-dev_6.3.0-18+deb9u1_amd64.deb

libgcj17_6.3.0-18+deb9u1_amd64.deb

libgfortran3_6.3.0-18+deb9u1_amd64.deb

libgomp1_6.3.0-18+deb9u1_amd64.deb

libitm1_6.3.0-18+deb9u1_amd64.deb

liblsan0_6.3.0-18+deb9u1_amd64.deb

libmpx2_6.3.0-18+deb9u1_amd64.deb

libobjc4_6.3.0-18+deb9u1_amd64.deb

libquadmath0_6.3.0-18+deb9u1_amd64.deb

libstdc++6_6.3.0-18+deb9u1_amd64.deb

libstdc++-6-dev_6.3.0-18+deb9u1_amd64.deb

libtsan0_6.3.0-18+deb9u1_amd64.deb

libubsan0_6.3.0-18+deb9u1_amd64.deb

。。。

依赖会较多,下面使用apt方式安装。

1.1.5 本地光驱iso做本地更新仓库

光驱挂载后,看下更新源:

more /etc/apt/sources.list

#

# deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ – Official amd64 DVD

Binary-1 20180310-11:21]/ stretch contrib main

deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ – Official amd64 DVD Bi

nary-1 20180310-11:21]/ stretch contrib main

deb http://security.debian.org/debian-security stretch/updates main

contrib

deb-src http://security.debian.org/debian-security stretch/updates

main contrib

。。。

1.1.6使用apt-cdrom把光驱加入到本地源

root@debian138:/mnt/cdrom/pool/main/g/gcc-6# apt-cdrom add /mnt/cdrom

Using CD-ROM mount point /media/cdrom/

Unmounting CD-ROM…

Waiting for disc…

Please insert a Disc in the drive and press [Enter] —直接回车

Mounting CD-ROM…

Identifying… [fdeb3e693cb142469f21d9cff7b63758-2]

Scanning disc for index files…

Found 2 package indexes, 0 source indexes, 2 translation indexes and 0 signatures

This disc is called:

‘Debian GNU/Linux 9.4.0 _Stretch_ – Official amd64 DVD Binary-1 20180310-11:21’

Reading Package Indexes… Done

Reading Translation Indexes… Done

Writing new source list

Source list entries for this disc are:

deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ – Official amd64 DVD Binary-1 20180310-11:21]/ stretch contrib main

Unmounting CD-ROM…

Repeat this process for the rest of the CDs in your set.

1.1.7更新本地源

root@debian138:/etc/apt# apt update

Ign:1 cdrom://[Debian GNU/Linux 9.4.0 _Stretch_ – Official amd64 DVD Binary-1 20180310-11:21] stretch InRelease

Err:2 cdrom://[Debian GNU/Linux 9.4.0 _Stretch_ – Official amd64 DVD Binary-1 20180310-11:21] stretch Release

Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs

Hit:3 http://security.debian.org/debian-security stretch/updates InRelease

Reading package lists… Done

E: The repository ‘cdrom://[Debian GNU/Linux 9.4.0 _Stretch_ – Official amd64 DVD Binary-1 20180310-11:21] stretch Release’ does not have a Release file.

N: Updating from such a repository can’t be done securely, and is therefore disabled by default.

N: See apt-secure(8) manpage for repository creation and user configuration details.

因前执行果dpkg -i未完成,有进程占用,直接apt –fix-broken install即可

root@debian138:/etc/apt# apt install gcc

Reading package lists… Done

Building dependency tree

Reading state information… Done

gcc is already the newest version (4:6.3.0-4).

You might want to run ‘apt –fix-broken install’ to correct these.

The following packages have unmet dependencies:

gcc-6 : Depends: libcc1-0 (>= 6.3.0-18+deb9u1) but it is not going to be installed

Depends: binutils (>= 2.28) but it is not going to be installed

Depends: libgcc-6-dev (= 6.3.0-18+deb9u1) but it is not going to be installed

Recommends: libc6-dev (>= 2.13-5) but it is not going to be installed

E: Unmet dependencies. Try ‘apt –fix-broken install’ with no packages (or specify a solution).

root@debian138:/etc/apt# apt –fix-broken install

Reading package lists… Done

Building dependency tree

Reading state information… Done

Correcting dependencies… Done

The following additional packages will be installed:

binutils libasan3 libc-dev-bin libc6-dev libcc1-0 libcilkrts5

libgcc-6-dev libitm1 liblsan0 libmpx2 libtsan0 libubsan0

linux-libc-dev manpages-dev

Suggested packages:

binutils-doc glibc-doc

The following NEW packages will be installed:

binutils libasan3 libc-dev-bin libc6-dev libcc1-0 libcilkrts5

libgcc-6-dev libitm1 liblsan0 libmpx2 libtsan0 libubsan0

linux-libc-dev manpages-dev

0 upgraded, 14 newly installed, 0 to remove and 11 not upgraded.

2 not fully installed or removed.

Need to get 0 B/13.3 MB of archives.

After this operation, 65.4 MB of additional disk space will be used.

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

。。。。

Setting up libc6-dev:amd64 (2.24-11+deb9u3) …

Setting up libitm1:amd64 (6.3.0-18+deb9u1) …

Setting up libgcc-6-dev:amd64 (6.3.0-18+deb9u1) …

Setting up gcc-6 (6.3.0-18+deb9u1) …

Setting up gcc (4:6.3.0-4) …

Processing triggers for libc-bin (2.24-11+deb9u3) …

gcc安装完成

1.1.5.2 安装Make

没有依赖,直接install:

root@debian138:/etc/apt# apt install make

Reading package lists… Done

#make

#make: *** No targets specified and no makefile found. Stop.

make 安装完成

声明:本站部分文章内容及图片转载于互联 、内容不代表本站观点,如有内容涉及侵权,请您立即联系本站处理,非常感谢!

(0)
上一篇 2022年4月8日
下一篇 2022年4月8日

相关推荐