22、软件管理之源码包安装与脚本安装

安装前的准备工作

  • 安装C语言编译器
#先检测是否已经暗转gcc编译器
[root@localhost]# rpm -q gcc
如果没有就执行安装命令
[root@localhost]# yum install -y gcc
  • 下载源码包,从http://mirror.bit.edu.cn/apache/httpd/,下载后通过WinSCP工具可以再windows和linux之间传输文件。传输到用户的根目录下。

开始安装

./configure命令和make命令不会往指定目录写入任何软件,这时候只要执行make clean就能清楚make编译产生的临时文件。

[root@localhost ~]# ls
0  anaconda-ks.cfg  httpd-2.2.31  httpd-2.2.31.tar.gz  install.log  install.log.syslog  linux
[root@localhost ~]# dh
-bash: dh: command not found
#查看解压后的文件夹大小
[root@localhost ~]# du -sh httpd-2.2.31
43M     httpd-2.2.31
#进入源码包文件夹
[root@localhost ~]# cd httpd-2.2.31
[root@localhost httpd-2.2.31]# ls
ABOUT_APACHE  CHANGES        httpd.dsp       libhttpd.dep  NOTICE            server
acinclude.m4  config.layout  httpd.mak       libhttpd.dsp  NWGNUmakefile     srclib
Apache.dsw    configure      httpd.spec      libhttpd.mak  os                support
build         configure.in   include         LICENSE       README            test
BuildAll.dsp  docs           INSTALL         Makefile.in   README.platforms  VERSIONING
BuildBin.dsp  emacs-style    InstallBin.dsp  Makefile.win  README-win32.txt
buildconf     httpd.dep      LAYOUT          modules       ROADMAP
[root@localhost httpd-2.2.31]# ./config --help
-bash: ./config: 没有那个文件或目录
[root@localhost httpd-2.2.31]# ./configure --help
#配置安装目录(在这里还可以定义其他的配置) 执行完命令后会生成一个makefile文件,里面包含系统检查环境变量等信息
[root@localhost httpd-2.2.31]# ./configure --prefix=/usr/local/apache2
...(whitout fatal|error|warning is normal)
#开始编译
[root@localhost httpd-2.2.31]# make
...
#开始执行安装操作
[root@localhost httpd-2.2.31]# make install
...
#测试是否安装成功
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 120.192.83.162 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[root@localhost httpd-2.2.31]# service httpd stop
停止 httpd:                                               [确定]
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 120.192.83.162 for ServerName
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl stop
httpd: Could not reliably determine the server's fully qualified domain name, using 120.192.83.162 for ServerName
#卸载只需要删掉安装目录即可
[root@localhost httpd-2.2.31]# rm -rf /usr/local/apache2

脚本安装

脚本安装包并不是独立的软件包类型,常见安装的是源码包,是人为的把安装过程写成了自动安装的脚本,只要执行脚本,定义简单的参数,就可以完成安装,非常类似于windows下软件的安装方式。脚本安装只需执行解压后文件夹内的setup.sh即可。执行一个文件的方法是 当前目录下执行一个脚本的方式是./脚本文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值