离线安装ollama到服务器

搜了很多教程不满意,弄了半天才弄好,这里记录下,方便以后的人用,那个在线下载太慢,怕不是得下载到明年。

一.从官网下在liunx版的tgz安装包

Releases · ollama/ollama (github.com)

查看自己的服务器信息(参考 https://www.cnblogs.com/Casflawed/p/18525187)

  • x86_64 CPU选择下载ollama-linux-amd64;aarch64|arm64 CPU选择下载ollama-linux-arm64
#查看Linux版本号
cat /proc/version
#查看cpu架构
lscpu

二.利用rz命令上传至服务器端

不知道怎么用看 如何利用Xshell上传文件到服务器-CSDN博客

三.下载官网的安装程序 https://ollama.com/install.sh  起名为insatll.sh

双击打开,我这里用vscode打开

这是官方的

#!/bin/sh
# This script installs Ollama on Linux.
# It detects the current operating system architecture and installs the appropriate version of Ollama.set -eured="$( (/usr/bin/tput bold || :; /usr/bin/tput setaf 1 || :) 2>&-)"
plain="$( (/usr/bin/tput sgr0 || :) 2>&-)"status() { echo ">>> $*" >&2; }
error() { echo "${red}ERROR:${plain} $*"; exit 1; }
warning() { echo "${red}WARNING:${plain} $*"; }TEMP_DIR=$(mktemp -d)
cleanup() { rm -rf $TEMP_DIR; }
trap cleanup EXITavailable() { command -v $1 >/dev/null; }
require() {local MISSING=''for TOOL in $*; doif ! available $TOOL; thenMISSING="$MISSING $TOOL"fidoneecho $MISSING
}[ "$(uname -s)" = "Linux" ] || error 'This script is intended to run on Linux only.'ARCH=$(uname -m)
case "$ARCH" inx86_64) ARCH="amd64" ;;aarch64|arm64) ARCH="arm64" ;;*) error "Unsupported architecture: $ARCH" ;;
esacIS_WSL2=falseKERN=$(uname -r)
case "$KERN" in*icrosoft*WSL2 | *icrosoft*wsl2) IS_WSL2=true;;*icrosoft) error "Microsoft WSL1 is not currently supported. Please use WSL2 with 'wsl --set-version <distro> 2'" ;;*) ;;
esacVER_PARAM="${OLLAMA_VERSION:+?version=$OLLAMA_VERSION}"SUDO=
if [ "$(id -u)" -ne 0 ]; then# Running as root, no need for sudoif ! available sudo; thenerror "This script requires superuser permissions. Please re-run as root."fiSUDO="sudo"
fiNEEDS=$(require curl awk grep sed tee xargs)
if [ -n "$NEEDS" ]; thenstatus "ERROR: The following tools are required but missing:"for NEED in $NEEDS; doecho "  - $NEED"doneexit 1
fifor BINDIR in /usr/local/bin /usr/bin /bin; doecho $PATH | grep -q $BINDIR && break || continue
done
OLLAMA_INSTALL_DIR=$(dirname ${BINDIR})status "Installing ollama to $OLLAMA_INSTALL_DIR"
$SUDO install -o0 -g0 -m755 -d $BINDIR
$SUDO install -o0 -g0 -m755 -d "$OLLAMA_INSTALL_DIR"
if curl -I --silent --fail --location "https://ollama.com/download/ollama-linux-${ARCH}.tgz${VER_PARAM}" >/dev/null ; thenstatus "Downloading Linux ${ARCH} bundle"curl --fail --show-error --location --progress-bar \"https://ollama.com/download/ollama-linux-${ARCH}.tgz${VER_PARAM}" | \$SUDO tar -xzf - -C "$OLLAMA_INSTALL_DIR"BUNDLE=1if [ "$OLLAMA_INSTALL_DIR/bin/ollama" != "$BINDIR/ollama" ] ; thenstatus "Making ollama accessible in the PATH in $BINDIR"$SUDO ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"fi
elsestatus "Downloading Linux ${ARCH} CLI"curl --fail --show-error --location --progress-bar -o "$TEMP_DIR/ollama"\"https://ollama.com/download/ollama-linux-${ARCH}${VER_PARAM}"$SUDO install -o0 -g0 -m755 $TEMP_DIR/ollama $OLLAMA_INSTALL_DIR/ollamaBUNDLE=0if [ "$OLLAMA_INSTALL_DIR/ollama" != "$BINDIR/ollama" ] ; thenstatus "Making ollama accessible in the PATH in $BINDIR"$SUDO ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"fi
fi# Check for NVIDIA JetPack systems with additional downloads
if [ -f /etc/nv_tegra_release ] ; thenif grep R36 /etc/nv_tegra_release > /dev/null ; thenstatus "Downloading JetPack 6 components"curl --fail --show-error --location --progress-bar \"https://ollama.com/download/ollama-linux-${ARCH}-jetpack6.tgz${VER_PARAM}" | \$SUDO tar -xzf - -C "$OLLAMA_INSTALL_DIR"elif grep R35 /etc/nv_tegra_release > /dev/null ; thenstatus "Downloading JetPack 5 components"curl --fail --show-error --location --progress-bar \"https://ollama.com/download/ollama-linux-${ARCH}-jetpack5.tgz${VER_PARAM}" | \$SUDO tar -xzf - -C "$OLLAMA_INSTALL_DIR"elsewarning "Unsupported JetPack version detected.  GPU may not be supported"fi
fiinstall_success() {status 'The Ollama API is now available at 127.0.0.1:11434.'status 'Install complete. Run "ollama" from the command line.'
}
trap install_success EXIT# Everything from this point onwards is optional.configure_systemd() {if ! id ollama >/dev/null 2>&1; thenstatus "Creating ollama user..."$SUDO useradd -r -s /bin/false -U -m -d /usr/share/ollama ollamafiif getent group render >/dev/null 2>&1; thenstatus "Adding ollama user to render group..."$SUDO usermod -a -G render ollamafiif getent group video >/dev/null 2>&1; thenstatus "Adding ollama user to video group..."$SUDO usermod -a -G video ollamafistatus "Adding current user to ollama group..."$SUDO usermod -a -G ollama $(whoami)status "Creating ollama systemd service..."cat <<EOF | $SUDO tee /etc/systemd/system/ollama.service >/dev/null
[Unit]
Description=Ollama Service
After=network-online.target[Service]
ExecStart=$BINDIR/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=$PATH"[Install]
WantedBy=default.target
EOFSYSTEMCTL_RUNNING="$(systemctl is-system-running || true)"case $SYSTEMCTL_RUNNING inrunning|degraded)status "Enabling and starting ollama service..."$SUDO systemctl daemon-reload$SUDO systemctl enable ollamastart_service() { $SUDO systemctl restart ollama; }trap start_service EXIT;;*)warning "systemd is not running"if [ "$IS_WSL2" = true ]; thenwarning "see https://learn.microsoft.com/en-us/windows/wsl/systemd#how-to-enable-systemd to enable it"fi;;esac
}if available systemctl; thenconfigure_systemd
fi# WSL2 only supports GPUs via nvidia passthrough
# so check for nvidia-smi to determine if GPU is available
if [ "$IS_WSL2" = true ]; thenif available nvidia-smi && [ -n "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\.[0-9]*")" ]; thenstatus "Nvidia GPU detected."fiinstall_successexit 0
fi# Don't attempt to install drivers on Jetson systems
if [ -f /etc/nv_tegra_release ] ; thenstatus "NVIDIA JetPack ready."install_successexit 0
fi# Install GPU dependencies on Linux
if ! available lspci && ! available lshw; thenwarning "Unable to detect NVIDIA/AMD GPU. Install lspci or lshw to automatically detect and install GPU dependencies."exit 0
ficheck_gpu() {# Look for devices based on vendor ID for NVIDIA and AMDcase $1 inlspci)case $2 innvidia) available lspci && lspci -d '10de:' | grep -q 'NVIDIA' || return 1 ;;amdgpu) available lspci && lspci -d '1002:' | grep -q 'AMD' || return 1 ;;esac ;;lshw)case $2 innvidia) available lshw && $SUDO lshw -c display -numeric -disable network | grep -q 'vendor: .* \[10DE\]' || return 1 ;;amdgpu) available lshw && $SUDO lshw -c display -numeric -disable network | grep -q 'vendor: .* \[1002\]' || return 1 ;;esac ;;nvidia-smi) available nvidia-smi || return 1 ;;esac
}if check_gpu nvidia-smi; thenstatus "NVIDIA GPU installed."exit 0
fiif ! check_gpu lspci nvidia && ! check_gpu lshw nvidia && ! check_gpu lspci amdgpu && ! check_gpu lshw amdgpu; theninstall_successwarning "No NVIDIA/AMD GPU detected. Ollama will run in CPU-only mode."exit 0
fiif check_gpu lspci amdgpu || check_gpu lshw amdgpu; thenif [ $BUNDLE -ne 0 ]; thenstatus "Downloading Linux ROCm ${ARCH} bundle"curl --fail --show-error --location --progress-bar \"https://ollama.com/download/ollama-linux-${ARCH}-rocm.tgz${VER_PARAM}" | \$SUDO tar -xzf - -C "$OLLAMA_INSTALL_DIR"install_successstatus "AMD GPU ready."exit 0fi# Look for pre-existing ROCm v6 before downloading the dependenciesfor search in "${HIP_PATH:-''}" "${ROCM_PATH:-''}" "/opt/rocm" "/usr/lib64"; doif [ -n "${search}" ] && [ -e "${search}/libhipblas.so.2" -o -e "${search}/lib/libhipblas.so.2" ]; thenstatus "Compatible AMD GPU ROCm library detected at ${search}"install_successexit 0fidonestatus "Downloading AMD GPU dependencies..."$SUDO rm -rf /usr/share/ollama/lib$SUDO chmod o+x /usr/share/ollama$SUDO install -o ollama -g ollama -m 755 -d /usr/share/ollama/lib/rocmcurl --fail --show-error --location --progress-bar "https://ollama.com/download/ollama-linux-amd64-rocm.tgz${VER_PARAM}" \| $SUDO tar zx --owner ollama --group ollama -C /usr/share/ollama/lib/rocm .install_successstatus "AMD GPU ready."exit 0
fiCUDA_REPO_ERR_MSG="NVIDIA GPU detected, but your OS and Architecture are not supported by NVIDIA.  Please install the CUDA driver manually https://docs.nvidia.com/cuda/cuda-installation-guide-linux/"
# ref: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#rhel-7-centos-7
# ref: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#rhel-8-rocky-8
# ref: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#rhel-9-rocky-9
# ref: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#fedora
install_cuda_driver_yum() {status 'Installing NVIDIA repository...'case $PACKAGE_MANAGER inyum)$SUDO $PACKAGE_MANAGER -y install yum-utilsif curl -I --silent --fail --location "https://developer.download.nvidia.com/compute/cuda/repos/$1$2/$(uname -m | sed -e 's/aarch64/sbsa/')/cuda-$1$2.repo" >/dev/null ; then$SUDO $PACKAGE_MANAGER-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/$1$2/$(uname -m | sed -e 's/aarch64/sbsa/')/cuda-$1$2.repoelseerror $CUDA_REPO_ERR_MSGfi;;dnf)if curl -I --silent --fail --location "https://developer.download.nvidia.com/compute/cuda/repos/$1$2/$(uname -m | sed -e 's/aarch64/sbsa/')/cuda-$1$2.repo" >/dev/null ; then$SUDO $PACKAGE_MANAGER config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/$1$2/$(uname -m | sed -e 's/aarch64/sbsa/')/cuda-$1$2.repoelseerror $CUDA_REPO_ERR_MSGfi;;esaccase $1 inrhel)status 'Installing EPEL repository...'# EPEL is required for third-party dependencies such as dkms and libvdpau$SUDO $PACKAGE_MANAGER -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$2.noarch.rpm || true;;esacstatus 'Installing CUDA driver...'if [ "$1" = 'centos' ] || [ "$1$2" = 'rhel7' ]; then$SUDO $PACKAGE_MANAGER -y install nvidia-driver-latest-dkmsfi$SUDO $PACKAGE_MANAGER -y install cuda-drivers
}# ref: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu
# ref: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#debian
install_cuda_driver_apt() {status 'Installing NVIDIA repository...'if curl -I --silent --fail --location "https://developer.download.nvidia.com/compute/cuda/repos/$1$2/$(uname -m | sed -e 's/aarch64/sbsa/')/cuda-keyring_1.1-1_all.deb" >/dev/null ; thencurl -fsSL -o $TEMP_DIR/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/$1$2/$(uname -m | sed -e 's/aarch64/sbsa/')/cuda-keyring_1.1-1_all.debelseerror $CUDA_REPO_ERR_MSGficase $1 indebian)status 'Enabling contrib sources...'$SUDO sed 's/main/contrib/' < /etc/apt/sources.list | $SUDO tee /etc/apt/sources.list.d/contrib.list > /dev/nullif [ -f "/etc/apt/sources.list.d/debian.sources" ]; then$SUDO sed 's/main/contrib/' < /etc/apt/sources.list.d/debian.sources | $SUDO tee /etc/apt/sources.list.d/contrib.sources > /dev/nullfi;;esacstatus 'Installing CUDA driver...'$SUDO dpkg -i $TEMP_DIR/cuda-keyring.deb$SUDO apt-get update[ -n "$SUDO" ] && SUDO_E="$SUDO -E" || SUDO_E=DEBIAN_FRONTEND=noninteractive $SUDO_E apt-get -y install cuda-drivers -q
}if [ ! -f "/etc/os-release" ]; thenerror "Unknown distribution. Skipping CUDA installation."
fi. /etc/os-releaseOS_NAME=$ID
OS_VERSION=$VERSION_IDPACKAGE_MANAGER=
for PACKAGE_MANAGER in dnf yum apt-get; doif available $PACKAGE_MANAGER; thenbreakfi
doneif [ -z "$PACKAGE_MANAGER" ]; thenerror "Unknown package manager. Skipping CUDA installation."
fiif ! check_gpu nvidia-smi || [ -z "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\.[0-9]*")" ]; thencase $OS_NAME incentos|rhel) install_cuda_driver_yum 'rhel' $(echo $OS_VERSION | cut -d '.' -f 1) ;;rocky) install_cuda_driver_yum 'rhel' $(echo $OS_VERSION | cut -c1) ;;fedora) [ $OS_VERSION -lt '39' ] && install_cuda_driver_yum $OS_NAME $OS_VERSION || install_cuda_driver_yum $OS_NAME '39';;amzn) install_cuda_driver_yum 'fedora' '37' ;;debian) install_cuda_driver_apt $OS_NAME $OS_VERSION ;;ubuntu) install_cuda_driver_apt $OS_NAME $(echo $OS_VERSION | sed 's/\.//') ;;*) exit ;;esac
fiif ! lsmod | grep -q nvidia || ! lsmod | grep -q nvidia_uvm; thenKERNEL_RELEASE="$(uname -r)"case $OS_NAME inrocky) $SUDO $PACKAGE_MANAGER -y install kernel-devel kernel-headers ;;centos|rhel|amzn) $SUDO $PACKAGE_MANAGER -y install kernel-devel-$KERNEL_RELEASE kernel-headers-$KERNEL_RELEASE ;;fedora) $SUDO $PACKAGE_MANAGER -y install kernel-devel-$KERNEL_RELEASE ;;debian|ubuntu) $SUDO apt-get -y install linux-headers-$KERNEL_RELEASE ;;*) exit ;;esacNVIDIA_CUDA_VERSION=$($SUDO dkms status | awk -F: '/added/ { print $1 }')if [ -n "$NVIDIA_CUDA_VERSION" ]; then$SUDO dkms install $NVIDIA_CUDA_VERSIONfiif lsmod | grep -q nouveau; thenstatus 'Reboot to complete NVIDIA CUDA driver install.'exit 0fi$SUDO modprobe nvidia$SUDO modprobe nvidia_uvm
fi# make sure the NVIDIA modules are loaded on boot with nvidia-persistenced
if available nvidia-persistenced; then$SUDO touch /etc/modules-load.d/nvidia.confMODULES="nvidia nvidia-uvm"for MODULE in $MODULES; doif ! grep -qxF "$MODULE" /etc/modules-load.d/nvidia.conf; thenecho "$MODULE" | $SUDO tee -a /etc/modules-load.d/nvidia.conf > /dev/nullfidone
fistatus "NVIDIA GPU ready."
install_success

然后找到这个代码片段

if curl -I --silent --fail --location "https://ollama.com/download/ollama-linux-${ARCH}.tgz${VER_PARAM}" >/dev/null ; thenstatus "Downloading Linux ${ARCH} bundle"curl --fail --show-error --location --progress-bar \"https://ollama.com/download/ollama-linux-${ARCH}.tgz${VER_PARAM}" | \$SUDO tar -xzf - -C "$OLLAMA_INSTALL_DIR"BUNDLE=1if [ "$OLLAMA_INSTALL_DIR/bin/ollama" != "$BINDIR/ollama" ] ; thenstatus "Making ollama accessible in the PATH in $BINDIR"$SUDO ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"fi
elsestatus "Downloading Linux ${ARCH} CLI"curl --fail --show-error --location --progress-bar -o "$TEMP_DIR/ollama"\"https://ollama.com/download/ollama-linux-${ARCH}${VER_PARAM}"$SUDO install -o0 -g0 -m755 $TEMP_DIR/ollama $OLLAMA_INSTALL_DIR/ollamaBUNDLE=0if [ "$OLLAMA_INSTALL_DIR/ollama" != "$BINDIR/ollama" ] ; thenstatus "Making ollama accessible in the PATH in $BINDIR"$SUDO ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"fi
fi

可以看到这里的路径是官网的,我们要搞成自己的

status "Installing ollama to $OLLAMA_INSTALL_DIR"
$SUDO install -o0 -g0 -m755 -d $BINDIR
$SUDO install -o0 -g0 -m755 -d "$OLLAMA_INSTALL_DIR"
status "Downloading Linux ${ARCH} bundle"#    curl --fail --show-error --location --progress-bar \#        "https://ollama.com/download/ollama-linux-${ARCH}.tgz${VER_PARAM}" | \$SUDO tar -xzf ./Ollama.tgz -C "$OLLAMA_INSTALL_DIR"BUNDLE=1if [ "$OLLAMA_INSTALL_DIR/bin/ollama" != "$BINDIR/ollama" ] ; thenstatus "Making ollama accessible in the PATH in $BINDIR"$SUDO ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"fi

注意文件名,改成自己的,这个例子中是/home/Ollama.tgz, 依据实际情况来改(参考自https://blog.csdn.net/weixin_43278082/article/details/142357712)

把该文件用rz指令上传至服务器。


四.安装

1.解决报错

报错:

install.sh: line 4: $'\r': command not found
: invalid option 5: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]

原因:

出现这个错误是因为你的脚本文件在Windows环境下被编辑或保存过,导致它包含了Windows风格的换行符(CRLF),而Linux系统下的脚本通常使用UNIX风格的换行符(LF)。此外,set: invalid option 5的错误提示表明脚本中可能存在语法错误。

解决:使用dos2unix工具将脚本文件的换行符从CRLF转换为LF

使用该命令下载必要的包

sudo yum install dos2unix

转换

dos2unix install.sh

然后在install.sh文件目录下执行

sh install.sh

等待安装即可


最终安装成功

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/485243.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Face2QR:可根据人脸图像生成二维码,还可以扫描,以后个人名片就这样用了!

今天给大家介绍的是一种专为生成个性化二维码而设计的新方法Face2QR&#xff0c;可以将美观、人脸识别和可扫描性完美地融合在一起。 下图展示为Face2QR 生成的面部图像&#xff08;第一行&#xff09;和二维码图像&#xff08;第二行&#xff09;。生成的二维码不仅忠实地保留…

WHLUG丨deepin、华中科技大学开放原子开源俱乐部、 RustSBI 和清华大学开源操作系统训练营共话开源新生代成长之路

2024年11月30日下午&#xff0c;由 deepin&#xff08;深度&#xff09;社区联合华中科技大学开放原子开源俱乐部、 RustSBI 开源社区和清华大学开源操作系统训练营共同举办的WHLUG&#xff08;武汉Linux用户组&#xff09;线下沙龙在华中科技大学成功举办。 本次活动聚集了50余…

排查bug的通用思路

⭐️前言⭐️ APP点击某个按钮没有反应/PC端执行某个操作后&#xff0c;响应较慢&#xff0c;通用的问题排查方法: 从多个角度来排查问题 &#x1f349;欢迎点赞 &#x1f44d; 收藏 ⭐留言评论 &#x1f349;博主将持续更新学习记录收获&#xff0c;友友们有任何问题可以在评…

Uniapp的App环境下使用Map获取缩放比例

概述 目前我试过的就是你用vue后缀是拿不到比例的你可以用nvue当然uniapp的uvue应该是更加可以的我使用的是高德所以你得在高德的后台声请原生的Android的key才可以如果是vue3的开发模式的话不用使用this来获取当前对象使用scale对象来接受和改变缩放比例会比较友好然后直接走…

如何利用Java爬虫获得商品类目

在当今数字化时代&#xff0c;数据已成为企业最宝贵的资产之一。获取和分析数据的能力对于任何希望在市场上保持竞争力的企业来说都是至关重要的。对于电子商务平台和市场研究公司而言&#xff0c;获取商品类目数据尤为重要&#xff0c;因为这些数据可以帮助他们更好地理解市场…

筑起厂区安全--叉车安全防护装置全解析

在繁忙的工业生产领域中&#xff0c;叉车作为搬运工&#xff0c;穿梭于仓储与生产线之间。然而&#xff0c;叉车的高效运作背后&#xff0c;也隐藏着诸多安全风险&#xff0c;尤其是在那些空间狭小、物流繁忙的环境中。为了降低这些潜在的危险&#xff0c;叉车安全防护装置便成…

AI新动向:豆包文生图升级,文心一言领先市场

在今日的AI资讯中&#xff0c;我们关注到了几个重要的行业动态&#xff0c;其中包括字节跳动AI助手豆包的功能升级&#xff0c;以及百度文心一言在生成式AI市场的领先地位。 字节跳动旗下的智能AI助手豆包近期对其文生图能力进行了显著提升&#xff0c;用户现在可以通过一键操…

【深度学习】手机SIM卡托缺陷检测【附链接】

一、手机SIM卡托用途 SIM卡托是用于固定和保护SIM卡的部件&#xff0c;通过连接SIM卡与手机主板的方式&#xff0c;允许设备访问移动网络&#xff0c;用户可以通过SIM卡进行通话、发送短信和使用数据服务。 二、手机SIM卡托不良影响 SIM卡接触不良&#xff0c;造成信号中断&…

PDF文件打开之后不能打印,怎么解决?

正常的PDF文件是可以打印的&#xff0c;如果PDF文件打开之后发现文件不能打印&#xff0c;我们需要先查看一下自己的打印机是否能够正常运行&#xff0c;如果打印机是正常的&#xff0c;我们再查看一下&#xff0c;文件中的打印功能按钮是否是灰色的状态。 如果PDF中的大多数功…

JUC:读写锁和邮戳锁

1. 面试题 你知道Java里面有那些锁你说说你用过的锁&#xff0c;锁饥饿问题是什么&#xff1f;有没有比读写锁更快的锁StampedLock知道吗&#xff1f;&#xff08;邮戳锁/票据锁&#xff09;ReentrantReadWriteLock有锁降级机制&#xff0c;你知道吗&#xff1f; 2. 读写锁&a…

「Mac畅玩鸿蒙与硬件43」UI互动应用篇20 - 闪烁按钮效果

本篇将带你实现一个带有闪烁动画的按钮交互效果。通过动态改变按钮颜色&#xff0c;用户可以在视觉上感受到按钮的闪烁效果&#xff0c;提升界面互动体验。 关键词 UI互动应用闪烁动画动态按钮状态管理用户交互 一、功能说明 闪烁按钮效果应用实现了一个动态交互功能&#xf…

MongoDB的简单使用

MongoDB(文档数据库)的简单使用 MongoDB最好的学习资料就是他的官方文档&#xff1a;SQL 到 MongoDB 的映射图表 - MongoDB 手册 v8.0 1.MongoDB CRUD操作 1.1Insert操作 基本方法&#xff1a; db.collection.insertOne() 将单个文档(document)插入集合中 db.collectio…

chromedriver.exe编译

使用例子参考官网 ChromeDriver 使用入门 | Chrome for Developers Chrome for Testing availability 注意&#xff1a;chromedriver版本要与chromium版本号对应。 如何编译chromedriver chrome\test\chromedriver\BUILD.gn 1、ninja -C out/debug chromedriver_server…

基于MinIO打造高可靠分布式“本地”文件系统

MinIO是一款高性能的对象存储服务&#xff0c;而S3协议是由亚马逊Web服务&#xff08;AWS&#xff09;制定的一种标准协议&#xff0c;用于云存储服务之间的数据交换。MinIO与S3协议的关系在于&#xff0c;MinIO实现了S3协议的接口&#xff0c;这意味着用户可以使用与AWS S3相同…

Python_Flask02

所有人都不许学Java了&#xff0c;都来学Python&#xff01; 如果不来学的话请网爆我的老师 连接前的准备 安装pymysql 和 flask_sqlalchemy&#xff0c;安装第三下面两个所需要的包才能连接上数据库 pip install pymysql pip install flask_sqlalchemy pymysql是一个Pyth…

python学opencv|读取图像(四)imshow()函数尝试

【1】引言 前述已经学习了opencv读取图像的基本操作&#xff0c;包括下述链接&#xff1a; python学opencv|读取图像-CSDN博客 python学opencv|读取图像&#xff08;二&#xff09;保存彩色图像-CSDN博客 python学opencv|读取图像&#xff08;三&#xff09;放大和缩小图像…

AC高可靠

在真实网络中&#xff0c;一台AC可能要管理上百台AP&#xff0c;因此对与AC的可靠性要求目前有4种解决方案 分别是VRRP双机热备&#xff0c;双链路冷备&#xff0c;双链路热备&#xff0c;N1备份 简述 VRRP双机热备份 主备AC两个独立的IP地址&#xff0c;通过VRRP对外虚拟为同…

docker逃逸总结

一、 检查是否在docker容器中 通过以下两个地方来判断 # 是否存在此文件 ls -al /.dockerenv# 在其中是否包含docker字符串 cat /proc/1/cgroup除了上面两种外还有其他方式判断&#xff0c;如检测mount、fdisk -l查看硬盘 、判断PID 1的进程名等也可用来辅助判断。 容器逃逸…

第十七章 使用 MariaDB 数据库管理系统

1. 数据库管理系统 数据库是指按照某些特定结构来存储数据资料的数据仓库。在当今这个大数据技术迅速崛起的年代&#xff0c;互联网上每天都会生成海量的数据信息&#xff0c;数据库技术也从最初只能存储简单的表格数据的单一集中存储模式&#xff0c;发展到了现如今存储海量…

六、Prompt工程——进阶迭代

Prompt工程——进阶迭代 一、Prompt样本提示零样本提示(Zero-shot Prompting)少量样本提示(Few-shot Prompting) 自洽性/自一致性(Self-Consistency)Prompt生成知识提示生成知识提示(Generate Knowledge Prompting) 这些都是业界总结出来的一些方法论&#xff0c;大家主要是学习…