sentOs安装jq包

[root@localhost yum.repos.d]# yum list  jq

Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks

Repository c7-media is listed more than once in the configuration

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

Error: No matching Packages to list

 

[root@localhost jq]# yum install  jq

Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks

Repository c7-media is listed more than once in the configuration

Loading mirror speeds from cached hostfile

 * base: centos.ustc.edu.cn

 * extras: centos.ustc.edu.cn

 * updates: centos.ustc.edu.cn

No package jq available.

Error: Nothing to do

 

/etc/yum.repo.d/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=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

 

把enabled=0 改为enabled=1

 

[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

 

[root@localhost yum.repos.d]# yum install jq
Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks
Repository c7-media is listed more than once in the configuration
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                    | 7.0 kB  00:00:00     
epel-debuginfo/x86_64/metalink                                                          | 7.2 kB  00:00:00     
 * base: mirrors.aliyun.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * epel-debuginfo: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
epel                                                                                    | 4.7 kB  00:00:00     
epel-debuginfo                                                                          | 3.0 kB  00:00:00     
(1/4): epel/x86_64/group_gz                                                             |  88 kB  00:00:00     
(2/4): epel/x86_64/updateinfo                                                           | 954 kB  00:00:00     
(3/4): epel-debuginfo/x86_64/primary_db                                                 | 882 kB  00:00:01     
(4/4): epel/x86_64/primary_db                                                           | 6.6 MB  00:00:06     
Resolving Dependencies
--> Running transaction check
---> Package jq.x86_64 0:1.5-1.el7 will be installed
--> Processing Dependency: libonig.so.2()(64bit) for package: jq-1.5-1.el7.x86_64
--> Running transaction check
---> Package oniguruma.x86_64 0:5.9.5-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================
 Package                    Arch                    Version                        Repository             Size
===============================================================================================================
Installing:
 jq                         x86_64                  1.5-1.el7                      epel                  153 k
Installing for dependencies:
 oniguruma                  x86_64                  5.9.5-3.el7                    epel                  129 k

Transaction Summary
===============================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 282 k
Installed size: 906 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/epel/packages/oniguruma-5.9.5-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for oniguruma-5.9.5-3.el7.x86_64.rpm is not installed
(1/2): oniguruma-5.9.5-3.el7.x86_64.rpm                                                 | 129 kB  00:00:02     
(2/2): jq-1.5-1.el7.x86_64.rpm                                                          | 153 kB  00:00:02     
---------------------------------------------------------------------------------------------------------------
Total                                                                          127 kB/s | 282 kB  00:00:02     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : oniguruma-5.9.5-3.el7.x86_64                                                                1/2 
  Installing : jq-1.5-1.el7.x86_64                                                                         2/2 
  Verifying  : oniguruma-5.9.5-3.el7.x86_64                                                                1/2 
  Verifying  : jq-1.5-1.el7.x86_64                                                                         2/2 

Installed:
  jq.x86_64 0:1.5-1.el7                                                                                        

Dependency Installed:
  oniguruma.x86_64 0:5.9.5-3.el7                                                                               

Complete!
 

 

 

[root@localhost yum.repos.d]# jq 
jq - commandline JSON processor [version 1.5]
Usage: jq [options] <jq filter> [file...]

    jq is a tool for processing JSON inputs, applying the
    given filter to its JSON text inputs and producing the
    filter's results as JSON on standard output.
    The simplest filter is ., which is the identity filter,
    copying jq's input to its output unmodified (except for
    formatting).
    For more advanced filters see the jq(1) manpage ("man jq")
    and/or https://stedolan.github.io/jq

    Some of the options include:
     -c        compact instead of pretty-printed output;
     -n        use `null` as the single input value;
     -e        set the exit status code based on the output;
     -s        read (slurp) all inputs into an array; apply filter to it;
     -r        output raw strings, not JSON texts;
     -R        read raw strings, not JSON texts;
     -C        colorize JSON;
     -M        monochrome (don't colorize JSON);
     -S        sort keys of objects on output;
     --tab    use tabs for indentation;
     --arg a v    set variable $a to value <v>;
     --argjson a v    set variable $a to JSON value <v>;
     --slurpfile a f    set variable $a to an array of JSON texts read from <f>;
    See the manpage for more options.
 

 

<think>好的,用户想在Windows系统上安装jq工具,我需要先回忆一下相关的信息。根据提供的引用,引文[1]和[2]主要提到了Linux和Mac的安装方法,但没有直接说明Windows的步骤。不过,我可以通过其他途径来解答这个问题。 首先,jq是一个处理JSON数据的命令行工具,官方支持多个平台。对于Windows用户,通常的安装方法括使用管理器如Chocolatey或Scoop,或者手动下载二进制文件。我需要确认这些方法的可行性。 手动安装的话,用户需要访问jq的官方网站(https://stedolan.github.io/jq/),在下载页面找到Windows的二进制版本,通常是.exe文件。下载后,将jq.exe添加到系统的PATH环境变量中,这样就可以在命令行中使用。这个过程需要指导用户如何添加PATH,可能需要步骤说明。 另外,使用管理器会更方便。比如,如果用户已经安装了Chocolatey,可以运行`choco install jq`;如果使用Scoop,则是`scoop install jq`。需要检查这些管理器是否维护了jq的最新版本,以及安装命令是否正确。 可能用户会遇到的问题括下载页面找不到正确的文件,或者设置PATH时出错。需要提前预见到这些情况,给出清晰的步骤,并建议验证安装是否成功的命令`jq --version`。 还要注意引用已有的资料,虽然引用中没有Windows的信息,但可以指出类似Linux的管理方式在Windows下通过第三方工具实现。最后确保回答符合格式要求,使用正确的LaTeX语法,生成相关问题,并自然添加引用标识。</think>### Windows 系统安装 jq 的方法 在 Windows 系统中安装 `jq` 工具可以通过以下两种主要方式实现: --- #### **方法一:手动下载二进制文件** 1. **访问官方下载页面** 打开浏览器,访问 `jq` 的官方下载地址: [https://stedolan.github.io/jq/download/](https://stedolan.github.io/jq/download/)[^1] 2. **选择 Windows 版本** 在页面中找到 `Windows` 版本的二进制文件(通常为 `jq-win64.exe` 或类似名称),点击下载。 3. **配置环境变量** - 将下载的 `jq.exe` 文件移动到一个固定目录(例如 `C:\Program Files\jq`)。 - 将此目录添加到系统环境变量 `PATH` 中。 **步骤示例**: - 右键点击“此电脑” → 属性 → 高级系统设置 → 环境变量 → 编辑系统变量 `Path` → 添加目录路径 → 确认保存。 4. **验证安装** 打开命令提示符(CMD)或 PowerShell,输入以下命令: ```bash jq --version ``` 若输出版本号(如 `jq-1.6`),则安装成功。 --- #### **方法二:通过管理器安装** 若已安装第三方管理器(如 **Chocolatey** 或 **Scoop**),可通过命令行快速安装: - **Chocolatey** 运行命令: ```bash choco install jq ``` - **Scoop** 运行命令: ```bash scoop install jq ``` --- #### **注意事项** - 若手动下载遇到问题,可检查防火墙设置或尝试从 GitHub 仓库直接下载[^2]。 - 安装完成后,建议通过 `jq --help` 查看基本用法。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值