Software management operations
- Types of packages in Linux
- Package name structure
- rpm command management software package
- Construction of local software warehouse
- dnf software management commands
- Construction of network warehouse
- Construction of third-party software warehouse (third-party software is shared in the network)
- Configure an Alibaba Cloud warehouse
Types of packages in Linux
- 1.DEB #UBLinux DEXLinux
- 2.RPM #Redhat centos fc
- 3.bz2 | gz | xz #1.需要源码安装需要编译
- #2.绿色软件,直接可用
- #ntfs-3g_ntfsprogs-2017.3.23.tgz #需要编译
- #而以bz2、ge、xz为后缀的可以直接安装使用
"Only green software, source code compilation software, and rpm software can be used in rhel8"
Package name structure
- 1.软件名称
- 2.软件版本
- 3.软件的授权协议版本
- 4.软件架构
- 5.软件类型后缀
rpm command management software package
command:
- rpm
- -ivh ##安装参数组合 i install v verbose(安装过程0 -h hash(采用hash加密)
- -a ##显示所有安装的软件
- -f ##显示文件属于哪个安装包
- -e ##卸载软件
- -q ##查询软件是否安装
- -l ##软件安装文件列表
- -ql ##显示所有安装的文件
- -p ##软件包
- -c ##配置文件
- -qc ##显示所有安装的配置文件
- -d ##说明
- -Kv ##检测MD5校验码
- -V ##检测已安装软件在系统中的文件被修改信息
- 软件包 --script ##检测安装卸载时都做了什么动作
- 软件包 --nodeps ##安装时忽略依赖性
- 软件包 --force ##强制安装
- 软件包 --info ##显示软件的信息
Construction of local software warehouse
##The function of the software warehouse is to manage the software. The rpm command cannot solve the dependency. If the software needs to automatically solve the dependency problem during the installation process, we need to install the software warehouse##
-
Construction method:
1.在系统中加载安装系统时使用的安装镜像 2.编写软件仓库文件 /etc/yum.repos.d/ ##软件源指向文件配置目录 ##再此目录中不能有无法访问的源指向 vim /etc/yum.repos.d/xxx.repo ##软件仓库指向文件
3.测试
dnf software management commands
- dnf
- repolist ##列出仓库信息
- clean all ##清除系统中已经加载的仓库缓存信息
- list all ##列出所有软件
- list available ##列出未安装软件
- list installed ##列出已安装软件
- install ##安装
- remove ##卸载
- reinstall ##重新安装
- search ##搜索
- whatprovides ##搜索包含文件的软件包
- history ##dnf执行历史
- history info ##dnf执行历史详细信息
- group list ##列出软件组
- group list --installed ##列出已安装软件组
- group list --available ##列出未安装软件组
- group list --hidden ##列出隐藏软件组
- group install ##安装软件组
- group info ##查看软件组命令
Use the previously built local warehouse to test:
dnf repollist
dnf search keyword
dnf history
dnf group list --****
dnf clean all
Construction of network warehouse
-
Build a local warehouse
-
Install the httpd service, command
dnf install http -y
, and then start the service,dnf enable --now httpd
I have installed it here, so let's see if it starts.
-
Create a new shared directory
-
Mount the image to the shared directory and set it to automatically mount at startup (the default must be remounted after restarting) to reduce the trouble of mounting.
-
Then modify the /etc/yum.repos.d/westos.repo file (that is, the software repository points to the file)
-
Now you can access the warehouse through the corresponding URL, and you can also directly access it after restarting.
Construction of third-party software warehouse (third-party software is shared in the network)
-
Create a shared directory
/var/www/html/software. Only rpm files can exist in the shared directory . The compressed package cannot be managed by dnf -
Store third-party software under /var/www/html/software
You can find a few software by yourself, or you can connect to someone else's computer to make a few.
-
Use third-party software to generate the repodate directory.
Install the collection tool: createrepodnf install createrepo -y
into the shared directory:cd /var/www/html/software
scan the software through createrepo, and then generate the repodate data directory. Note: If you don’t scan the page, the newly added software will not be displayed. In the /sofrware directory,createrepo .
the repodate here is equivalent to the index file of each software. -
Specify a third-party shared source, specify the location of the file, /etc/yum.repos.d/westos.repo (westos can name itself)
-
Access via network
Note: If your software package was moved by mv, you need to perform a step setenforce 0
, otherwise the software you own will not be displayed on the web page.
Configure an Alibaba Cloud warehouse
For Alibaba Cloud developers, find a mirror at the mirror site and copy the download URL at the bottom. For example, https://mirrors.aliyun.com/epel/8/Everything/x86_64/
and then add the warehouse. vim /etc/yum.repos.d/westos.repo
Of course, you also need to open the httpd service