前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Centos7安装Charles完整教程

Centos7安装Charles完整教程

作者头像
兜兜转转
发布2023-03-06 15:07:30
2.1K0
发布2023-03-06 15:07:30
举报
文章被收录于专栏:CodeTime

安装

创建文件/etc/yum.repos.d/Charles.repo

1234

[charlesproxy]name=Charles Proxy Repositorybaseurl=https://www.charlesproxy.com/packages/yumgpgkey=https://www.charlesproxy.com/packages/yum/PublicKey

执行安装:

1

yum install charles-proxy

安装完成后,会生成一个/usr/bin/charles的执行文件,可直接运行。

运行报错

执行charles命令报错:because /lib64/libm.so.6: version 'GLIBC_2.27' not found (required by /usr/lib/charles-proxy/jdk/lib/server/libjvm.so)

解决办法,安装GLIBC_2.27库。

下载https://mirrors.tuna.tsinghua.edu.cn/gnu/libc/glibc-2.27.tar.gz

123456

wget https://mirrors.tuna.tsinghua.edu.cn/gnu/libc/glibc-2.27.tar.gz --no-check-certificatetar -zxvf glibc-2.27.tar.gzcd glibc-2.27mkdir build && cd build../configure --prefix=/opt/glibc-2.27make && make install

configure报错

执行configure报错:These critical programs are missing or too old: bison compiler

报错原因为缺少bison依赖和gcc编译器,以下2个步骤都需要执行:

1.安装bison

1

yum install bison

2.查看版本gcc --version,版本过低,需升级gcc

下载并解压

12

wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-10.4.0/gcc-10.4.0.tar.gz --no-check-certificatetar -zxvf gcc-10.4.0.tar.gz

安装依赖:

12345

yum -y install bzip2 #已安装可以跳过这一步# 中标麒麟系统需要以下依赖# yum -y install gmp mpfr mpc isl bzip2cd gcc-10.4.0./contrib/download_prerequisites

配置

12

mkdir build && cd build../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib

在执行该步骤如果出现A compiler with support for C++11 language features is required错误,先安装c++编译器:yum install gcc-c++

编译并安装

1

make && make install

该步骤耗时很长,需耐心等候。

make报错

执行make操作时,报各种代码错误,诸如:

  • gcc-11编译glibc-2.27:error: argument 1 of type ‘struct __jmp_buf_tag *’ declared as a pointer [-Werror=array-parameter=]
  • gcc-10编译glibc-2.27:error: array subscript 1 is outside the bounds of an interior zero-length array ‘struct dtv_slotinfo[0]’ [-Werror=zero-length-bounds]

最终解决方案gcc-10.4.0搭配glibc-2.32

123456

https://mirrors.tuna.tsinghua.edu.cn/gnu/libc/glibc-2.32.tar.gz --no-check-certificatetar -zxvf glibc-2.32.tar.gzcd glibc-2.32mkdir build && cd build../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --libexecdir=/usr/libmake && make install

注意:这里的configure使用了官方的参数,参数--prefix=/usr是必须的。最终成功安装glibc-2.32,该项包含2.27版本。

1

strings /lib64/libm.so.6 |grep ^GLIBC

生成证书

导出charles根证书

1

charles ssl export charles-root.pem

将证书安装到linux系统

12

mv charles-root.pem /etc/ssl/certs/update-ca-trust force-enable

配置

charles默认使用的配置文件为~/.charles.config,将其复制出来并进行修改:

设置访问控制,charles默认有访问限制,将其完全放开,设置如下内容:

12345678910111213141516171819

<accessControlConfiguration> <warn>true</warn> <ipRanges> <ipRange> <ip> <int>0</int> <int>0</int> <int>0</int> <int>0</int> </ip> <mask> <int>0</int> <int>0</int> <int>0</int> <int>0</int> </mask> </ipRange> </ipRanges></accessControlConfiguration>

启用https代理,在sslLocations节点下添加如下内容:

1234567891011

<sslLocations> <locationPatterns> <locationMatch> <location> <host>*</host> <port>*</port> </location> <enabled>true</enabled> </locationMatch> </locationPatterns></sslLocations>

配置本地路由,使用百度作为测试:

12345678910111213141516171819

<entry> <string>Map Local</string> <mapLocal> <toolEnabled>true</toolEnabled> <mappings> <mapLocalMapping> <sourceLocation> <protocol>https</protocol> <host>www.baidu.com</host> <port>443</port> <path>/</path> </sourceLocation> <dest>/root/charles/test.txt</dest> <enabled>true</enabled> <caseSensitive>true</caseSensitive> </mapLocalMapping> </mappings> </mapLocal></entry>

之后使用新的配置文件启动:

1

charles -config /path/to/your-config.xml

客户端访问https://chls.pro/ssl地址获取并安装charles证书,并将证书受信即可进行https代理。

charles官方文档地址:https://www.charlesproxy.com/documentation

附录

升级make

12345678

wget https://mirrors.tuna.tsinghua.edu.cn/gnu/make/make-4.2.tar.gz --no-check-certificatetar -xvf make-4.2.tar.gzcd make-4.2mkdir build && cd build../configure --prefix=/usrsh build.shmake installmake -v # 检查版本是否升级成功

安装python3

1234567

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgztar -zxf Python-3.8.0.tgzcd Python-3.8.0mkdir build && cd buildmkdir /usr/local/python3../configure --prefix=/usr/local/python3make && make install

建立软链接

1

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

资源地址

gnu官方地址:http://ftp.gnu.org/gnu/

腾讯云镜像:https://mirrors.cloud.tencent.com/gnu/

清华镜像:https://mirrors.tuna.tsinghua.edu.cn/gnu/

资源

对应目录

gcc

/gcc/

glibc

/libc/

make

/make/

我的博客即将同步至腾讯云开发者社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=1j20h7lk5sr7f

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-01-31,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装
  • 运行报错
    • configure报错
      • make报错
      • 生成证书
      • 配置
      • 附录
        • 升级make
          • 安装python3
            • 资源地址
            相关产品与服务
            云开发 CloudBase
            云开发(Tencent CloudBase,TCB)是腾讯云提供的云原生一体化开发环境和工具平台,为200万+企业和开发者提供高可用、自动弹性扩缩的后端云服务,可用于云端一体化开发多种端应用(小程序、公众号、Web 应用等),避免了应用开发过程中繁琐的服务器搭建及运维,开发者可以专注于业务逻辑的实现,开发门槛更低,效率更高。
            领券
            问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档