在Linux中安装软件

在Linux中安装软件

rpm

软件安装查询

安装的格式:

rpm -ivh 软件名

字符 含义
i install安装
v 显示过程
h 显示进度条

查询已安装的格式

rpm -q +名称 查询是否已安装

[root@localhost ~]# rpm -q tree
tree-1.6.0-10.el7.x86_64
[root@localhost ~]# rpm -q sdd
未安装软件包 sdd 

rpm -qa 查询所以已安装的软件

[root@localhost ~]# rpm -qa
python-cups-1.9.63-6.el7.x86_64
cronie-1.4.11-17.el7.x86_64
libconfig-1.4.9-5.el7.x86_64
clutter-gst3-3.0.22-1.el7.x86_64
gnome-icon-theme-extras-3.12.0-1.el7.noarch
python-configobj-4.7.2-7.el7.noarch
dhclient-4.2.5-58.el7.centos.x86_64
ethtool-4.8-1.el7.x86_64
libpeas-gtk-1.20.0-1.el7.x86_64
wodim-1.1.11-23.el7.x86_64
python-urwid-1.1.1-3.el7.x86_64
hyphen-2.8.6-5.el7.x86_64
fontpackages-filesystem-1.44-8.el7.noarch
python-gobject-3.22.0-1.el7.x86_64
python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch
libsss_autofs-1.15.2-50.el7.x86_64
filesystem-3.2-21.el7.x86_64
python-requests-2.6.0-1.el7_1.noarch
m17n-lib-1.6.4-14.el7.x86_64
xkeyboard-config-2.20-1.el7.noarch
tagsoup-1.2.1-8.el7.noarch
.............

rpm -qc 软件名 查询软件的配置文件

[root@localhost ~]# rpm -qc rpm
/var/lib/rpm/Basenames
/var/lib/rpm/Conflictname
/var/lib/rpm/Dirnames
/var/lib/rpm/Group
/var/lib/rpm/Installtid
/var/lib/rpm/Name
/var/lib/rpm/Obsoletename
/var/lib/rpm/Packages
/var/lib/rpm/Providename
/var/lib/rpm/Requirename
/var/lib/rpm/Sha1header
/var/lib/rpm/Sigmd5
/var/lib/rpm/Triggername
/var/lib/rpm/__db.001
/var/lib/rpm/__db.002
/var/lib/rpm/__db.003
/var/lib/rpm/__db.004
/var/lib/rpm/__db.005
/var/lib/rpm/__db.006
/var/lib/rpm/__db.007
/var/lib/rpm/__db.008
/var/lib/rpm/__db.009

rpm -ql 软件的所在列表

[root@localhost ~]# rpm -ql tree
/usr/bin/tree
/usr/share/doc/tree-1.6.0
/usr/share/doc/tree-1.6.0/LICENSE
/usr/share/doc/tree-1.6.0/README
/usr/share/man/man1/tree.1.gz

rpm -qi 软件的基本信息

[root@localhost ~]# rpm -qi tree
Name        : tree
Version     : 1.6.0
Release     : 10.el7
Architecture: x86_64
Install Date: 2024年04月03日 星期三 13时48分21秒
Group       : Applications/File
Size        : 89505
License     : GPLv2+
Signature   : RSA/SHA256, 2014年07月04日 星期五 13时36分46秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : tree-1.6.0-10.el7.src.rpm
Build Date  : 2014年06月10日 星期二 03时28分53秒
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://mama.indstate.edu/users/ice/tree/
Summary     : File system tree viewer
Description :
The tree utility recursively displays the contents of directories in a
tree-like format.  Tree is basically a UNIX port of the DOS tree
utility.

yum

yum是依靠网络实现软件的安装;是一个基于RPM包构建的软件更新机制,能够自动解决软件包之间的依赖关系。解决了日常工作中的大量查找安装依赖包的时间

通式:

yum install tree -y #安装tree软件

[root@localhost ~]# yum install tree -y
已加载插件:fastestmirror, langpacks
base                                                                             | 3.6 kB  00:00:00     
extras                                                                           | 2.9 kB  00:00:00     
updates                                                                          | 2.9 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                                | 253 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                               |  26 MB  00:00:03     
Determining fastest mirrors
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

========================================================================================================
 Package              架构                   版本                            源                    大小
========================================================================================================
正在安装:
 tree                 x86_64                 1.6.0-10.el7                    base                  46 k

事务概要
========================================================================================================
安装  1 软件包

总下载量:46 k
安装大小:87 k
Downloading packages:
tree-1.6.0-10.el7.x86_64.rpm                                                     |  46 kB  00:00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : tree-1.6.0-10.el7.x86_64                                                            1/1 
  验证中      : tree-1.6.0-10.el7.x86_64                                                            1/1 

已安装:
  tree.x86_64 0:1.6.0-10.el7                                                                            

完毕!
单机yum仓库:
[root@localhost /]# mount /dev/sr0 mnt
mount: /dev/sr0 写保护,将以只读方式挂载
mount: /dev/sr0 已经挂载或 /mnt 忙
       /dev/sr0 已经挂载到 /run/media/root/CentOS 7 x86_64 上
       /dev/sr0 已经挂载到 /mnt 上
[root@localhost /]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# ls
bak               CentOS-CR.repo         CentOS-fasttrack.repo  CentOS-Sources.repo
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo      CentOS-Vault.repo
[root@localhost yum.repos.d]# mv *.repo bak
[root@localhost yum.repos.d]# vim local.repo
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: local
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# vim local.repo
[root@localhost yum.repos.d]# yum makecache 
已加载插件:fastestmirror, langpacks
local                                                                            | 3.6 kB  00:00:00     
(1/4): local/group_gz                                                            | 156 kB  00:00:00     
(2/4): local/filelists_db                                                        | 3.1 MB  00:00:00     
(3/4): local/primary_db                                                          | 3.1 MB  00:00:00     
(4/4): local/other_db                                                            | 1.2 MB  00:00:00     
Determining fastest mirrors
元数据缓存已建立
[root@localhost yum.repos.d]# yum install tree -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

========================================================================================================
 Package              架构                   版本                           源                     大小
========================================================================================================
正在安装:
 tree                 x86_64                 1.6.0-10.el7                   local                  46 k

事务概要
========================================================================================================
安装  1 软件包

总下载量:46 k
安装大小:87 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : tree-1.6.0-10.el7.x86_64                                                            1/1 
  验证中      : tree-1.6.0-10.el7.x86_64                                                            1/1 

已安装:
  tree.x86_64 0:1.6.0-10.el7                                                                            

完毕!

编译安装

nginx 运行一个 网站你安装了 nginx 软件 等于搭建了一个 网站
[root@localhost ~]# mkdir /data
[root@localhost ~]# cd /data
[root@localhost data]# wget http://nginx.org/download/nginx-1.18.0.tar.gz #下载源码包
[root@localhost data]#tar xf nginx-1.18.0.tar.g2
[root@localhost nginx-1.18.0]#cd nginx-1.18.0/
[root@localhost nginx-1.18.0]#yum -y install make gcc pcre-devel openssl-devel zlib-devel openssl openssl-devel                  #安装依赖环境
[root@localhost nginx-1.18.0]#./configure --prefix=/apps/nginx  		#检测环境, 指定安装目录
[root@localhost nginx-1.18.0]#make -j2			#编译    -j2   2个核心编译
[root@localhost nginx-1.18.0]#make instal			#将软件复制到 前面规定的路径
[root@localhost ~]#In -s /apps/nginx/sbin/nginx	 /usr/local/sbin 	#建立软链接
[root@localhost ~]#nginx   #可以补全
[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#setenforce 0
[root@localhost ~]#cur  ip地址(本机的)
[root@localhost ~]# curl 172.16.208.10
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
浏览器中 输入 ip地址

posted @   红荼  阅读(19)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示