1 apt 安装
#
sudo apt update
#查看可安装的lua版本
sudo apt-get install lua=version
#
sudo apt-get install lua5.3
#查看版本
test@iZbp1g7fmjea77vsqc5hmmZ:/data/soft$ lua -v
Lua 5.3.6 Copyright (C) 1994-2020 Lua.org, PUC-Rio
2 Ubuntu卸载软件
#查找lua已安装软件
dpkg --list|grep lua
#卸载lua
sudo apt-get --purge remove lua5.3
sudo apt-get --purge remove liblua5.3-0:amd64
3 lua 编译安装
sudo apt-get install libreadline-dev
#下载
curl -L -R -O https://www.lua.org/ftp/lua-5.4.6.tar.gz
tar zxvf lua-5.4.6.tar.gz
cd lua-5.4.6/
make all test
#指定安装目录
sudo make install INSTALL_TOP=/usr/local/lua
#测试
test@iZbp1g7fmjea77vsqc5hmmZ:~/lua-5.4.6$ /usr/local/lua/bin/lua -v
Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio