软件安装工具 yum

yum是Python写的一个安装工具。从配置的仓库当中取你需要的包进行安装
yum工具本身配置位置: /etc/yum.conf
yum仓库配置位置: /etc/yum.repos.d
大部分系统软件可以直接安装,但是有些第三方软件,必须安装包含这个软件的仓库。比如nginx的安装,就需要epel库。

yum一般用作 centos,redhat,federa
ubuntu: agt-get
tinylinux: pkgadd

yum在centos8.0就不存在了
dnf: centos8
=> yum 基本一样
ln -s dnf

yum的常用命令

1) yum search softname
2) yum -y install softname
-y: 表示如果提问,直接回答yes
3) yum remove softname 删除软件
4)yum autoremove 删除软件卸载之后的垃圾文件,一般来说,删除了指定软件之后,必须要执行yum autoremove,让yum工具清空所有的垃圾。因为yum remove 了这个软件之后,改软件的依赖的工具不会被卸载,但是安装的时候,如果缺少包,他会自动下载安装。
5) yum list |grep software 表示检索所有的 仓库当中有没有software这个软件,如果找到了,使用2)进行安装。

什么是仓库

仓库里面包含了仓库的URL地址,同时里面有字段enable,gpgcheck
如果enable=1 使用该库,否则0 禁用
如果 gpgcheck=0 ,表示不检查安全,可以避免安全问题。

如果需要增加一个仓库,只要下载或者编辑该仓库文件就行。如下

[root@yfserver yum.repos.d]# cat epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[root@yfserver yum.repos.d]#

命令使用详解

安装

yum -y install soft

卸载

yum -y remove soft
yum autoremove

查找命令是由哪个包提供的

yum provides command
yum install package_name -y

搜索有无此包

[root@yfserver yum.repos.d]# yum search nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
================================================================= N/S matched: nginx =================================================================
collectd-nginx.x86_64 : Nginx plugin for collectd
lemonldap-ng-nginx.noarch : LemonLDAP-NG Nginx support
Pagure
pcp-pmda-nginx.x86_64 : Performance Co-Pilot (PCP) metrics for the Nginx Webserver
python2-certbot-nginx.noarch : The nginx plugin for certbot
sympa-nginx.x86_64 : Sympa with nginx
nginx.x86_64 : A high performance web server and reverse proxy server
`

[root@yfserver yum.repos.d]# yum list |grep mariadb

mariadb.x86_64                           1:5.5.68-1.el7                @base
mariadb-libs.x86_64                      1:5.5.68-1.el7                @anaconda
mariadb-server.x86_64                    1:5.5.68-1.el7                @base
mariadb-bench.x86_64                     1:5.5.68-1.el7                base
mariadb-devel.i686                       1:5.5.68-1.el7                base
mariadb-devel.x86_64                     1:5.5.68-1.el7                base
mariadb-embedded.i686                    1:5.5.68-1.el7                base
mariadb-embedded.x86_64                  1:5.5.68-1.el7                base
mariadb-embedded-devel.i686              1:5.5.68-1.el7                base
mariadb-embedded-devel.x86_64            1:5.5.68-1.el7                base
mariadb-libs.i686                        1:5.5.68-1.el7                base
mariadb-test.x86_64                      1:5.5.68-1.el7                base
[root@yfserver yum.repos.d]#

找出所有soft的相关包

[root@yfserver yum.repos.d]# yum list --show-duplicates |grep java
BareBonesBrowserLaunch-javadoc.noarch    3.1-7.el7                     epel
CFR-javadoc.noarch                       0.151-4.el7                   epel
OpenStego-javadoc.noarch                 0.7.2-1.el7                   epel
R-java.x86_64                            3.6.0-1.el7                   epel
R-java-devel.x86_64                      3.6.0-1.el7                   epel
abrt-java-connector.x86_64               1.0.6-12.el7                  base
aesh-javadoc.noarch                      0.66.8-3.el7                  epel
aether-javadoc.noarch                    1.13.1-13.el7                 base
ant-antunit-javadoc.noarch               1.2-10.el7                    base

rpm 命令

centos,redhat安装命令,federa
ubuntu: deb,

rpm -qa 检索文件
rpm -e 删除
rpm -ivh 表示安装
rpm -Uvh 表示升级

rpm -qc 查询配置文件
rpm -qi
rpm -ql

rpm 也能降级。

[root@yfserver ~]# rpm -qc mariadb-server-5.5.68-1.el7.x86_64
/etc/logrotate.d/mariadb
/etc/my.cnf.d/server.cnf
/var/log/mariadb/mariadb.log
[root@yfserver ~]# rpm -qi mariadb-server-5.5.68-1.el7.x86_64
Name        : mariadb-server
Epoch       : 1
Version     : 5.5.68
Release     : 1.el7
Architecture: x86_64
Install Date: Fri 08 Dec 2023 02:40:03 PM CST
Group       : Applications/Databases
Size        : 61148588
License     : GPLv2 with exceptions and LGPLv2 and BSD
Signature   : RSA/SHA256, Thu 15 Oct 2020 02:55:53 AM CST, Key ID 24c6a8a7f4a80eb5
Source RPM  : mariadb-5.5.68-1.el7.src.rpm
Build Date  : Fri 02 Oct 2020 03:25:10 AM CST
Build Host  : x86-02.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://mariadb.org
Summary     : The MariaDB server and related files
Description :
MariaDB is a multi-user, multi-threaded SQL database server. It is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MariaDB server and some accompanying files and directories.
MariaDB is a community developed branch of MySQL.
[root@yfserver ~]# rpm -ql mariadb-server-5.5.68-1.el7.x86_64
/etc/logrotate.d/mariadb
/etc/my.cnf.d/server.cnf
/usr/bin/innochecksum
/usr/bin/myisam_ftdump
/usr/bin/myisamchk

安装JEEWMS

第一步

1) 安装mysql8.0或者mysql5.7的数据库,或者mariadb10以上版本。
2)SQL文件在git服务器上,192.168.10.19:3000
3)war包在jeknins上面,192.168.10.19:8080/jenkins下,用户root,密码1qaz!QAZ
4)在in.itshine.cn帆软的tomcat目录下,下载jdk1.8和tomcat 9.0 linux版本。下载/opt/jeewms/installation目录下

第二步

解压jdk,解压tomcat

把JAVA_HOME设置成刚刚解压的jdk目录,在/etc/profile的最后部分添加
export JAVA_HOME=…
export PATH=$JAVA_HOME/bin:$PATH

添加完毕以后,使用
. /etc/profile来执行。

第三步 导入SQL

先创建用户和授权

 create database jeewms charset utf8;
 create user jeewms@localhost identified by '1qaz!QAZ';
 grant all privileges on jeewms.* to jeewms@localhost;
 flush privileges;

然后执行

mysql jeewms <Dump2024.sql

第四步

1) 把 jeewms.war放到 tomcat的webapps目录下,启动tomcat,等待解压
2) 找到dbconfig.properties文件,修改里面数据库名称,用户名名称,和密码,保持

杀死 java进程

pkill -9 java
并放行8080

firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --reload

3)重启 tomcat
catalina.sh start

测试

在自己windows浏览器中访问
http://ip/jeewms

作者:严锋  创建时间:2023-12-08 14:30
最后编辑:严锋  更新时间:2025-05-09 15:48