当前位置: 首页 > news >正文

Linux Shell 实现一键部署podman

podman 介绍

使用 Podman 管理容器、Pod 和映像。从本地环境中无缝使用容器和 Kubernetes,Podman 提供与 Docker 非常相似的功能,它不需要在你的系统上运行任何守护进程,并且它也可以在没有 root 权限的情况下运行。

Podman 可以管理和运行任何符合 OCI(Open Container Initiative)规范的容器和容器镜像。Podman 提供了一个与 Docker 兼容的命令行前端来管理 Docker 镜像。

podman download

podmanpodman 文档gitlab开源podman ubuntu repo
download参考参考参考

创建一键部署脚本

  • 主要用于安装Podman容器引擎。脚本首先检查操作系统的版本,并根据不同的操作系统版本选择相应的安装方法。脚本支持CentOS、Red Hat、Oracle Linux、Rocky Linux、AlmaLinux、Ubuntu、Debian、Fedora和SUSE等多个发行版。
  • 使用yum包管理器安装Podman及其插件,并配置registries.conf文件。对于Ubuntu和Debian,使用apt包管理器安装Podman及其插件,并配置registries.conf文件。对于Fedora,使用dnf包管理器安装Podman及其插件。对于SUSE,使用zypper包管理器安装Podman及其插件。
  • podman --version | awk '{print $3}' #podman版本获取
  • podman-compose --version 2>&1 | awk 'NR==1{print $3}' #podman-compose 版本获取
  • podman-compose --version 2>&1 | head -n1 | awk '{print $NF}' #podman-compose 版本获取
  • podman --help 命令使用参考
vi /podman_install.sh
#!/bin/bash
# -*- coding: utf-8 -*-
# Author: CIASM
# update 2023/09/18<<!
# ubuntu To execute this script 
ln -sf bash /bin/sh
!install_basics() {# Check if the script is being run as root
if [ "$(id -u)" != "0" ]; thenecho "This script must be run as root."exit 1
fi# Check the CentOS/Red Hat version
if [[ -f /etc/redhat-release ]]; thenOS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)# Check the oralce Linux version
elif [[ -f /etc/oracle-release ]]; thenOS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)# Check the Rock Linux version
elif [[ -f /etc/rocky-release ]]; thenOS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)# Check the AlmaLinux version 
elif [[ -f /etc/almalinux-release ]]; thenOS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)# Check the ubuntu version
elif [[ -f /etc/os-release ]]; thenOS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)# Check the suse version
elif [[ -f /etc/SuSE-release ]]; thenOS=$( cat /etc/*release* | grep "^PRETTY_NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)# Check the Debian version
elif [[ -f /etc/os-release ]]; thenOS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+' | head -n1)# Check the Fedora version
elif [[ -f /etc/fedora-release ]]; thenOS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')VERSION=$(cat /etc/*release* | grep -oE '[0-9]+' | head -n1)elseecho -e "\033[31mThis script only supports $OS $VERSION...\033[0m"exit 1
fi# Check the podman version
if ! command -v podman &> /dev/null; then
#if [ ! -d "/usr/bin/podman" ]; thenecho -e "\033[32m Installing podman for $OS $VERSION...\033[0m"case $VERSION in# CentOS/RedHat/oracle 7 install7.?)echo Installing basics...install_centos_podman;;# CentOS/RedHat/oracle/RockLinux/AlmaLinux 8 install 8.?)echo Installing basics...install_centos_podman;;# CentOS/RedHat/oracle/RockLinux/AlmaLinux 9 install9.?) echo Installing basics...install_centos_podman;;# ubuntu 20.04 Linux install20.04)echo Installing basics...echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.listcurl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/Release.key" | sudo apt-key add -apt updateinstall_ubuntu_podman;;# ubuntu 21 Linux install21.04|21.10)echo Installing basics...echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_21.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.listcurl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_21.04/Release.key" | sudo apt-key add -apt updateinstall_ubuntu_podman;;# ubuntu 22 Linux install22.04)echo Installing basics...echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.listcurl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/Release.key" | sudo apt-key add -apt updateinstall_ubuntu_podman;;# Debian 10, 11 , 1210)echo Installing basics...echo Installing basics...echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.listcurl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/Release.key" | sudo apt-key add -apt updateinstall_ubuntu_podman;;11)echo Installing basics...echo Installing basics...echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.listcurl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_11/Release.key" | sudo apt-key add -apt updateinstall_ubuntu_podman;;12)echo Installing basics...echo Installing basics...echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_12/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.listcurl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_12/Release.key" | sudo apt-key add -apt updateinstall_ubuntu_podman;;# Fedora 31,32,3336|37|38)echo Installing basics...install_centos_podman;;# SUSE 12 install12.?)echo Installing  basics...sudo SUSEConnect -p sle-sdk/12.4/x86_64install_suse_podman;;# SUSE 15 install15.?)echo Installing  basics...sudo SUSEConnect -p sle-sdk/15.3/x86_64install_suse_podman;;*)echo -e "\033[31m Unsupported $OS $VERSION...\033[0m" exit 1;;
esacecho -e "\033[32m podman for $OS $VERSION successfully installed...\033[0m"
elseecho -e "\033[33m podman for $OS $VERSION already installed...\033[0m"
fi}install_centos_podman() {
echo "install podman"
yum -y install podman podman-plugins podman-docker python3
pip3 install podman-compose#registries.conf add config
cat >>/etc/containers/registries.conf<<EOF
[registries_search]
registries=["registry.access.redhat.com", "registry.fedoraproject.org", "docker.io"]
EOFpodman info# start podman
systemctl enable --now podman#check podman version
podman --version | awk '{print $3}'
podman-compose --version 2>&1 | head -n1 | awk '{print $NF}'
}install_ubuntu_podman() {
echo "install podman"
apt -y install podman podman-plugins python3 python3-pip
pip3 install podman-composecat >>/etc/containers/registries.conf<<EOF
[registries_search]
registries=["registry.access.redhat.com", "registry.fedoraproject.org", "docker.io"]
EOFpodman info# start podman
systemctl enable --now podman#check podman version
podman --version | awk '{print $3}'
podman-compose --version 2>&1 | head -n1 | awk '{print $NF}'}install_suse_podman() {
echo "install podman"
sudo zypper in -y podman net-tools vim wget net-tools
}main (){install_basics
}main

执行一键安装podman 

sh /podman_install.sh

相关文章:

Linux Shell 实现一键部署podman

podman 介绍 使用 Podman 管理容器、Pod 和映像。从本地环境中无缝使用容器和 Kubernetes&#xff0c;Podman 提供与 Docker 非常相似的功能&#xff0c;它不需要在你的系统上运行任何守护进程&#xff0c;并且它也可以在没有 root 权限的情况下运行。 Podman 可以管理和运行…...

Biome-BGC生态系统模型与Python融合技术

Biome-BGC是利用站点描述数据、气象数据和植被生理生态参数&#xff0c;模拟日尺度碳、水和氮通量的有效模型&#xff0c;其研究的空间尺度可以从点尺度扩展到陆地生态系统。 在Biome-BGC模型中&#xff0c;对于碳的生物量积累&#xff0c;采用光合酶促反应机理模型计算出每天…...

Matlab图像处理-区域描述

一旦一幅图像的目标区域被确定&#xff0c;我们往往用一套描述子来表示其特性。选择区域描述子的动机不单纯为了减少在区域中原始数据的数量&#xff0c;而且也应有利于区别带有不同特性的区域。因此&#xff0c;当目标区域有大小、旋转、平移等方面的变化时&#xff0c;针对这…...

openGauss学习笔记-69 openGauss 数据库管理-创建和管理普通表-更新表中数据

文章目录 openGauss学习笔记-69 openGauss 数据库管理-创建和管理普通表-更新表中数据 openGauss学习笔记-69 openGauss 数据库管理-创建和管理普通表-更新表中数据 修改已经存储在数据库中数据的行为叫做更新。用户可以更新单独一行、所有行或者指定的部分行。还可以独立更新…...

Flink RowData 与 Row 相互转化工具类

RowData与Row区别 &#xff08;0&#xff09;都代表了一条记录。都可以设置RowKind&#xff0c;和列数量Aritry。 &#xff08;1&#xff09;RowData 属于Table API&#xff0c;而Row属于Stream API &#xff08;2&#xff09;RowData 属于Table内部接口&#xff0c;对用户不友…...

企业架构LNMP学习笔记48

数据结构类型操作&#xff1a; 数据结构&#xff1a;存储数据的方式 数据类型 算法&#xff1a;取数据的方式&#xff0c;代码就把数据进行组合&#xff0c;计算、存储、取出。 排序算法&#xff1a;冒泡排序、堆排序 二分。 key&#xff1a; key的命名规则不同于一般语言…...

docker部署neo4j

拉取镜像 docker pull neo4j:3.5.35-community查看镜像 [rootlocalhost data]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE neo4j 3.5.35-community 3548ff943256 13 months ago 446MB创建容器并运行 docker run -d …...

融云观察:AI Agent 是不是游戏赛道的下一个「赛点」?

本周四 融云直播间&#xff0c;点击报名~ ChatGPT 的出现&#xff0c;不仅让会话成为了未来商业的基本形态&#xff0c;也把大家谈论 AI 的语境从科技产业转向了 AI 与全产业的整合。 关注【融云全球互联网通信云】了解更多 而目前最热衷于拥抱生成式 AI 的行业中&#xff0c…...

运用谷歌浏览器的开发者工具,模拟搜索引擎蜘蛛抓取网页

第一步&#xff1a;按压键盘上的F12键打开开发这工具&#xff0c;并点击右上角三个小黑点 第二步&#xff1a;选择More tools 第三步&#xff1a;选择Network conditions 第四步&#xff1a;找到User agent一列&#xff0c;取消复选框的勾选 第五步&#xff1a;选择谷歌爬虫…...

uni-app 点击蒙版层时关闭自定义弹窗

click.stop&#xff1a;用于阻止冒泡 click.stop 标签范围内&#xff0c;点击任何区域(包括 click 点击事件)都不会关闭弹窗。标签范围外会关闭弹窗 click.stop 标签内的 click 等事件&#xff1a;如果事件内有关闭弹窗的代码可关闭弹窗 在 template 中 <view class&quo…...

【红包雨功能的】环境部署(弹性伸缩、负载均衡、Redis读写分离、云服务器部署)

文章目录 创建环境创建专用网络VPC安全组创建云服务器打包部署2. Java环境启动项目开机启动任意服务1. 制作服务文件2. 制作启动脚本3. 制作停止脚本4. 增加执行权限5. 设置开机启动 创建镜像继续创建多台云服务器负载均衡弹性伸缩redis的报警规则白名单1. LAMP 环境1. 安装Apa…...

基于Java的设计模式-策略模式

策略模式就是定义一系列的算法,把它们一个个封装起来, 并且使它们可相互替换。 基本概念 策略模式主要是解决多种算法相似的情况下&#xff0c;使用if...else所带来的复杂和难以维护。当存在系统中有多个类&#xff0c;但是区分它们的是只是它们的直接行为&#xff0c;那我们…...

小程序多种姿势更换文章

概述 简单的文章切换demo&#xff0c;通过倒计时、摇一摇、双击进行文章切换 详细 直接看效果图吧&#xff01;比较简单&#xff0c;主要是练习一下... 小程序不带双击事件&#xff0c;可以记录第一次单击事件和第二次单机事件进行双击操作。 1、摇一摇是通过调用官方的 …...

读书笔记-《ON JAVA 中文版》-摘要25[第二十二章 枚举]

文章目录 第二十二章 枚举1. 基本功能1.1 基本 enum 特性 2. 方法添加2.1 方法添加2.2 覆盖 enum 的方法 3 switch 语句中的 enum4. values 方法的神秘之处5. 实现而非继承6. 随机选择7. 使用接口组织枚举8. 使用 EnumSet 替代 Flags9. 使用 EnumMap10. 常量特定方法11. 本章小…...

DNDC模型建模方法及应用

DNDC&#xff08;Denitrification-Decomposition&#xff0c;反硝化-分解模型&#xff09;是目前国际上最为成功的模拟生物地球化学循环的模型之一&#xff0c;自开发以来&#xff0c;经过不断完善和改进&#xff0c;从模拟简单的农田生态系统发展成为可以模拟几乎所有陆地生态…...

Kafka为什么是高性能高并发高可用架构

目录 1 前言2 顺序写入3 页缓存4 零拷贝5 Broker 性能6 流数据并行7 总结 1 前言 我们都知道 Kafka 是基于磁盘进行存储的&#xff0c;但 Kafka 官方又称其具有高性能、高吞吐、低延时的特点&#xff0c;其吞吐量动辄几十上百万。小伙伴们是不是有点困惑了&#xff0c;一般认为…...

QT-day3

完成文本编辑器的保存工作 void Widget::on_savebton_clicked() {QString fileName QFileDialog::getSaveFileName(this,"保存","./","All(*.*);;Images(*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)");QFile file(fileName);i…...

开发自测的测试用例设计方法

测试用例设计方法有&#xff1a;等价类划分法、边界值分析法、错误推测法、判定表法、正交实验法。 测试用例就是一个文档&#xff0c;描述输入、动作、或者时间和一个期望的结果&#xff0c;其目的是确定应用程序的某个特性是否正常的工作。 一.等价类划分法 顾名思义&#x…...

【AI视野·今日Sound 声学论文速览 第七期】Tue, 19 Sep 2023

AI视野今日CS.Sound 声学论文速览 Tue, 19 Sep 2023 Totally 1 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Sound Papers Frame-to-Utterance Convergence: A Spectra-Temporal Approach for Unified Spoofing Detection Authors Awais Khan, Khalid Mahmood Ma…...

MySQL 清空表 截断表

清空表&#xff1a;delete from users&#xff1b; 清空表只是清空表中的逻辑数据&#xff0c;但是物理数据不清除&#xff0c;如主键值、索引等不被清除&#xff0c;还是原来的值。 截断表&#xff1a;truncate table users&#xff1b; 截断表可以用于删除表中 的所有数据…...

AtCoder 第409​场初级竞赛 A~E题解

A Conflict 【题目链接】 原题链接&#xff1a;A - Conflict 【考点】 枚举 【题目大意】 找到是否有两人都想要的物品。 【解析】 遍历两端字符串&#xff0c;只有在同时为 o 时输出 Yes 并结束程序&#xff0c;否则输出 No。 【难度】 GESP三级 【代码参考】 #i…...

Cinnamon修改面板小工具图标

Cinnamon开始菜单-CSDN博客 设置模块都是做好的&#xff0c;比GNOME简单得多&#xff01; 在 applet.js 里增加 const Settings imports.ui.settings;this.settings new Settings.AppletSettings(this, HTYMenusonichy, instance_id); this.settings.bind(menu-icon, menu…...

【Web 进阶篇】优雅的接口设计:统一响应、全局异常处理与参数校验

系列回顾&#xff1a; 在上一篇中&#xff0c;我们成功地为应用集成了数据库&#xff0c;并使用 Spring Data JPA 实现了基本的 CRUD API。我们的应用现在能“记忆”数据了&#xff01;但是&#xff0c;如果你仔细审视那些 API&#xff0c;会发现它们还很“粗糙”&#xff1a;有…...

AI书签管理工具开发全记录(十九):嵌入资源处理

1.前言 &#x1f4dd; 在上一篇文章中&#xff0c;我们完成了书签的导入导出功能。本篇文章我们研究如何处理嵌入资源&#xff0c;方便后续将资源打包到一个可执行文件中。 2.embed介绍 &#x1f3af; Go 1.16 引入了革命性的 embed 包&#xff0c;彻底改变了静态资源管理的…...

高效线程安全的单例模式:Python 中的懒加载与自定义初始化参数

高效线程安全的单例模式:Python 中的懒加载与自定义初始化参数 在软件开发中,单例模式(Singleton Pattern)是一种常见的设计模式,确保一个类仅有一个实例,并提供一个全局访问点。在多线程环境下,实现单例模式时需要注意线程安全问题,以防止多个线程同时创建实例,导致…...

在QWebEngineView上实现鼠标、触摸等事件捕获的解决方案

这个问题我看其他博主也写了&#xff0c;要么要会员、要么写的乱七八糟。这里我整理一下&#xff0c;把问题说清楚并且给出代码&#xff0c;拿去用就行&#xff0c;照着葫芦画瓢。 问题 在继承QWebEngineView后&#xff0c;重写mousePressEvent或event函数无法捕获鼠标按下事…...

stm32wle5 lpuart DMA数据不接收

配置波特率9600时&#xff0c;需要使用外部低速晶振...

华为OD最新机试真题-数组组成的最小数字-OD统一考试(B卷)

题目描述 给定一个整型数组,请从该数组中选择3个元素 组成最小数字并输出 (如果数组长度小于3,则选择数组中所有元素来组成最小数字)。 输入描述 行用半角逗号分割的字符串记录的整型数组,0<数组长度<= 100,0<整数的取值范围<= 10000。 输出描述 由3个元素组成…...

算法打卡第18天

从中序与后序遍历序列构造二叉树 (力扣106题) 给定两个整数数组 inorder 和 postorder &#xff0c;其中 inorder 是二叉树的中序遍历&#xff0c; postorder 是同一棵树的后序遍历&#xff0c;请你构造并返回这颗 二叉树 。 示例 1: 输入&#xff1a;inorder [9,3,15,20,7…...

Spring AOP代理对象生成原理

代理对象生成的关键类是【AnnotationAwareAspectJAutoProxyCreator】&#xff0c;这个类继承了【BeanPostProcessor】是一个后置处理器 在bean对象生命周期中初始化时执行【org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization】方法时…...