`
cakin24
  • 浏览: 1331584 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

Linux中源码包安装过程

阅读更多
一 安装准备
1、安装C语言编译器
[root@localhost ~]# rpm -qa|grep gcc
libgcc-4.8.5-11.el7.x86_64
gcc-gfortran-4.8.5-11.el7.x86_64
gcc-c++-4.8.5-11.el7.x86_64
gcc-4.8.5-11.el7.x86_64
2、下载源码包
下载一个源码包:httpd-2.2.9.tar.gz
将该源码包拷贝到/root目录下。
[root@localhost ~]# ls|grep http
httpd-2.2.9.tar.gz
3、同一机器上可以同时安装rpm包的apache和源码包的apache。
源码包特点:开源、自定义,本机编译效率更高。
rpm包特点:厂商帮你编译好,在机器上执行效率不一定高。
一般建议用源码包,效率更高。
 
二 安装注意事项
1、源码包建议保存位置:/usr/local/src/
2、源码安装位置:/usr/local
3、如何确定安装过程报错:
安装过程停止
并出现error、warning或no的提示。
 
三 源码包安装过程
1、下载源码包
2、解压下载的源码包
3、进入解压缩目录
 
四 实战
1、解压下载的源码包
[root@localhost ~]# tar -zxvf httpd-2.2.9.tar.gz
2、查看解压结果
[root@localhost ~]# ll |grep http
drwxr-xr-x. 11 501 games 4096 6月 11 2008 httpd-2.2.9
-rw-r--r--. 1 root root 6396996 7月 19 21:10 httpd-2.2.9.tar.gz
3、进入解压缩目录
[root@localhost ~]# cd httpd-2.2.9/
[root@localhost httpd-2.2.9]#
4、./configure 软件配置与检查
定义需要的功能选项
检测系统环境是否符合安装要求
把定义好的功能选项和检测系统环境信息写入Makefile文件,用于后续的编辑
注意:基本上每一个源码包都有这个命令。
[root@localhost httpd-2.2.9]# ll |grep config
-rw-r--r--. 1 501 games 10943 11月 22 2004 config.layout
-rwxr-xr-x. 1 501 games 660990 6月 11 2008 configure
-rw-r--r--. 1 501 games 23300 6月 10 2008 configure.in
[root@localhost httpd-2.2.9]# ./configure --prefix=/usr/local/apache2
......
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
[root@localhost httpd-2.2.9]#
5、make编译
[root@localhost httpd-2.2.9]# make
make clean:万一报错,执行此命令。
6、make install 编译安装
[root@localhost httpd-2.2.9]# make install
7、查看安装结果
[root@localhost httpd-2.2.9]# cd /usr/local/apache2/
[root@localhost apache2]# ls
bin build cgi-bin conf error htdocs icons include logs man manual modules
8、启动服务
[root@localhost apache2]# /usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
9、INSTALL文件的作用
安装说明
[root@localhost httpd-2.2.9]# cat INSTALL
 
APACHE INSTALLATION OVERVIEW
 
Quick Start - Unix
------------------
 
For complete installation documentation, see [ht]docs/manual/install.html or
http://httpd.apache.org/docs/2.2/install.html
 
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
10 验证


 
11 源码包的卸载
不需要卸载命令,直接删除安装目录即可。不会遗留任何垃圾文件。
  • 大小: 6 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics