你提到的 “CentOS extract 配置” 可能有几种常见理解,我先按最常见的几种场景给你说明,你看看是哪个:
extract(解压/提取)相关工具CentOS 默认一般已有,但可确认/安装:
# 安装常用解压工具
yum install -y tar unzip bzip2 xz
常用示例:
tar -zxvf file.tar.gz
unzip file.zip
tar -Jxvf file.tar.xz
在 CentOS 上部署 Logstash 并做字段提取:
yum install -y java
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
cat > /etc/yum.repos.d/logstash.repo <<EOF
[logstash]
name=Logstash
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
enabled=1
EOF
yum install -y logstash
filter {
dissect {
mapping => {
"message" => "%{time} %{level} %{msg}"
}
}
}
启动:
systemctl start logstash
extract(提取 ISO / 分区)mkdir /mnt/iso
mount -o loop CentOS.iso /mnt/iso
cp -r /mnt/iso/* /data/
umount /mnt/iso
例如:
extract() {
case $1 in
*.tar.gz) tar -zxvf $1 ;;
*.zip) unzip $1 ;;
*.tar.xz) tar -Jxvf $1 ;;
esac
}
写入 ~/.bashrc 后生效:
source ~/.bashrc
你是哪一种?
我可以直接给你精确到命令的步骤。