【Linux03】——Linux软件安装

1 编译安装

软件:tengine-2.1.0.tar.gz

  1. 解压
[root@node1 ~]# tar -zxvf tengine-2.1.0.tar.gz 
  1. 进入解压后的目录,查看README文件,可以看到中间有一段说,安装Tengine只需要根据下面三个步骤
[root@node1 ~]# cd tengine-2.1.0
[root@node1 tengine-2.1.0]# cat README
···
To install Tengine, just follow these three steps:
    $ ./configure
    $ make
    # make install
···
  1. 第一步,./configure,如果你的电脑之前没有安装过gcc编译器会报以下错误
[root@node1 ~]# ./configure
checking for OS
 + Linux 2.6.32-431.el6.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found
  1. 安装gcc编译器,在这里使用yum安装,关于yum安装下一节再细讲
[root@node1 tengine-2.1.0]# yum install -y gcc
  1. gcc安装完之后重新执行./configure,可能报以下错误
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

安装PCRE

[root@node1 tengine-2.1.0]# yum install pcre-devel
  1. PCRE安装完之后重新执行./configure,可能报以下错误
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

继续安装OpenSSL

[root@node1 tengine-2.1.0]# yum install openssl-devel
  1. 第二步,make
[root@node1 tengine-2.1.0]# make
  1. 第三步,make install
[root@node1 tengine-2.1.0]# make install
  1. 测试。Nginx已经安装到/usr/local目录下,我们可以启动试试
[root@node1 tengine-2.1.0]# cd /usr/local/nginx/sbin
[root@node1 sbin]# ls
dso_tool  nginx
[root@node1 sbin]# ./nginx 

启动后在浏览器输入node1的地址,显示以下页面(需要先关闭防火墙),这个页面在/usr/local/nginx/html下的index.html
在这里插入图片描述

2 rpm安装

2.1 安装

软件:jdk-7u67-linux-x64.rpm

[root@node1 ~]# rpm -ivh jdk-7u67-linux-x64.rpm 

2.2 rpm常用命令

  1. 安装
    rpm -ivh ***.rpm:其中i表示安装,v表示显示安装过程,h表示显示进度
  2. 升级
    rpm -Uvh ***.rpm
  3. 卸载
    rpm -e PACKAGE_NAME
    rpm -e –nodeps PACKAGE_NAME:不考虑依赖包
    rpm -e –allmatches PACKAGE_NAME:删除所有跟PACKAGE_NAME匹配的所有版本的包
  4. 查询
    rpm -qa:查询已经安装的所有包
    rpm -q PACKAGE_NAME:查询指定的包是否已经安装
    rpm -qi PACKAGE_NAME:查询指定包的说明信息
    rpm -ql PACKAGE_NAME:查询指定包安装后生成的文件列表
    rpm -qc PACEAGE_NEME:查询指定包安装的配置文件
    rpm -qd PACKAGE_NAME:查询指定包安装的帮助文件
    rpm -q --scripts PACKAGE_NAME: 查询指定包中包含的脚本
    rpm -qf /path/to/somefile: 查询文件是由哪个rpm包安装生成的

3 yum安装

3.1 配置源

3.1.1 国内源

  • 网易:http://mirrors.163.com/
  • 阿里:https://opsx.alibaba.com/mirror?lang=zh-CN

这里我们使用阿里的镜像站

  1. 下载wget命令
    下面会用到wget命令如果没下载的先下载
yum install -y wget
  1. 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  1. 删除本地已缓存的依赖关系
yum clean all
  1. 从镜像站下载依赖关系
yum makecache

3.1.2 本地源

软件:CentOS-6.10-x86_64-bin-DVD1.iso

  1. 挂载
    先选择我们需要的iso文件
    在这里插入图片描述
    将iso文件挂载到/mnt目录
[root@node1 Packages]# mount /dev/cdrom /mnt/
  1. 备份CentOS-Base.repo文件
[root@node1 yum.repos.d]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  1. 修改CentOS-Base.repo文件
[root@node1 yum.repos.d]# vi CentOS-Base.repo

[base]
name=local
baseurl=file:///mnt
gpgcheck=1
enable=1
  1. 删除本地已缓存的依赖关系
yum clean all
  1. 从本地生成依赖关系
yum makecache

3.3 常用命令

  1. yum命令
    yum repolist:显示所有已经安装和可以安装的程序包
    yum clean all:清理本地缓存
    yum makecache:构建缓存
    yum update:升级程序包
  2. 查询
    yum list:列出资源库中所有可以安装或更新的rpm包
    yum search:查找软件包
    yum info:列出资源库中所有可以安装或更新的rpm包的信息
  3. 安装&卸载
    yum install
    remove|erase
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值