红联Linux门户
Linux帮助

Install GCC In Linux

发布时间:2008-07-19 00:36:02来源:红联作者:lvcebo
首先你得先从光盘里(或者iso文件里)取得以下文件:

kernel-headers-2.6.23.1-42.fc8.i386.rpm
glibc-headers-2.7-2.i386.rpm
glibc-devel-2.7-2.i386.rpm
cpp-4.1.2-33.i386.rpm (这个不知道需不需要,看下面的安装过程)
gcc-4.1.2-33.i386.rpm

然后就可以开始安装了,注意得switch到root帐号里装,不然可能出现以下错误:error: can't create transaction lock on /var/lib/rpm/__db.000。

安装过程如下:

[Qteqpid@localhost ~]$ su
口令:
[root@localhost Qteqpid]# rpm -ivh kernel-headers-2.6.23.1-42.fc8.i386.rpm
warning: kernel-headers-2.6.23.1-42.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing... ########################################### [100%]
1:kernel-headers ########################################### [100%]
[root@localhost Qteqpid]# rpm -ivh glibc-headers-2.7-2.i386.rpm
warning: glibc-headers-2.7-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing... ########################################### [100%]
1:glibc-headers ########################################### [100%]
[root@localhost Qteqpid]# rpm -ivh glibc-devel-2.7-2.i386.rpm
warning: glibc-devel-2.7-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
[root@localhost Qteqpid]# rpm -ivh cpp-4.1.2-33.i386.rpm
warning: cpp-4.1.2-33.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing... ########################################### [100%]
package cpp-4.1.2-33 is already installed
[root@localhost Qteqpid]# rpm -ivh gcc-4.1.2-33.i386.rpm
warning: gcc-4.1.2-33.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]

测试:

[root@localhost Qteqpid]# gcc
gcc: 没有输入文件
[Qteqpid@localhost ~]$ cat > test.c
#include
int main()
{
printf("hi, i am Qteqpid\n");
return 0;
}
[Qteqpid@localhost ~]$ gcc test.c #an a.out file will be produced after compiling
[Qteqpid@localhost ~]$ ./a.out
hi, i am Qteqpid
[Qteqpid@localhost ~]$
文章评论

共有 0 条评论