Linux学习之Ubuntu 20.04在github下载源码安装Openresty 1.19.3.1

参考的博文:《在 Ubuntu 上使用源码安装 OpenResty》
《OpenResty 安装安装详解-Ubuntu》
《Linux学习之CentOS 7源码安装openresty》

https://openresty.org/en/download.html是官网下载网址,页面往下拉有下载的链接。

https://github.com/openresty/openresty是github上的链接。

可以点击上图中tags进入有不同版本的页面。

sudo cat /etc/issue可以看到操作系统的版本是Ubuntu 20.04.4 LTSsudo lsb_release -r可以看到版本是20.04sudo uname -r可以看到内核版本是5.5.19sudo make -v可以看到版本是GNU Make 4.2.1

sudo apt-get install -y libpcre3-dev libssl-dev perl build-essential curl zlib1g-dev libreadline-dev libncurses5-dev libpcre3-dev安装依赖包。

安装完成之后如下:

sudo wget https://github.com/openresty/openresty/archive/refs/tags/v1.19.3.1.tar.gz下载源码压缩包。

sudo mkdir /openrestycode新建一个/openrestycode放置解压出来的源码。

sudo tar zxf v1.19.3.1.tar.gz -C /openrestycode/把源码解压到/openrestycode里边,然后使用ls -l /openrestycode看一下/openrestycode里边的文件。

cd /openrestycode/openresty-1.19.3.1/进入到/openrestycode/openresty-1.19.3.1/里边,ls -l看一下当前目录的文件信息。

sudo make执行。

发现报错如下:

bash 复制代码
rm: cannot remove '*.tar.bz2': No such file or directory
./util/mirror-tarballs: line 891: unix2dos: command not found
make: *** [Makefile:4: all] Error 1

sudo apt-get install dos2unix安装。

sudo make再次执行,发现又报错:

bash 复制代码
rm: cannot remove '*.tar.bz2': No such file or directory
unix2dos: converting file README-windows.txt to DOS format...
./util/mirror-tarballs: line 913: hg: command not found
make: *** [Makefile:4: all] Error 1

sudo apt-get install -y apt-file安装apt-file

sudo apt-file update更新。

sudo apt-file search hg输出了Finding relevant cache files to search ...E: The cache is empty. You need to run "apt-file update" first.

上边使用sudo apt-file search hg解决不了我的问题,我只能使用sed -n '913p' ./util/mirror-tarballs' ./util/mirror-tarballs看一下./util/mirror-tarballs第913行是什么内容,然后把hg clone粘贴到百度上查找一下,结果看到了博文《【ubuntu】hg clone使用》

想要使用sudo apt-get install mercurial安装mercurial却又提示E: You don't have enough free space in /var/cache/apt/archives/.

有看一篇博文《ubuntu "you don't have enough free space in /var/cache/apt/archives'错误解决》,找到一个大型文件删除了。

sudo apt-get install -y mercurial免确认安装mercurial

安装完成如下:

cd /openrestycode/openresty-1.19.3.1/进入到源码目录里边,sudo make再次执行编译。

完成之后如下:

cd openresty-1.19.3.1/进入到目录。

sudo ./configure --with-http_gzip_static_module --with-http_v2_module --with-http_stub_status_module --with-luajit --with-http_iconv_module进行配置。

完成如下如所示:

sudo make进行编译。

完成如下图所示:

sudo make install进行安装。

安装完成之后如下图:

此文章为8月Day 25学习笔记,内容来源于极客时间《Linux 实战技能 100 讲》

相关推荐
likfishdn11 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean30 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=32 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
若云止水41 分钟前
Ubuntu 下 nginx-1.24.0 源码分析 - ngx_init_cycle 函数 - 详解(4)
数据库·nginx·ubuntu
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
吃汤圆的抹香鲸2 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
sz66cm2 小时前
Linux基础 -- ARM 32 位架构动态注入代码技术文档
linux·arm开发·架构