demand background
I want to build a Lua development environment on Ubuntu 22.04. In fact, the steps are relatively simple. This article is also applicable to build Lua in the Ubuntu host environment. If you want to deploy a container in Ubuntu, and then build a Lua environment in the container, you can First refer to the container creation process on how to create an empty container with privilege permissions and a fixed custom IP on ubuntu22.04 , and then build it according to the deployment steps in this article
Create a Lua interpreter source code storage directory
mkir -p /root/dev_env
Create a Lua installation directory
mkdir -/ /usr/cloudland/lua
Install the download tool and compilation tool
apt-get install wget make gcc
Download and decompress the Lua interpreter source code package
cd /root/dev_env
wget www.lua.org/ftp/lua-5.4.6.tar.gz
tar -zxvf lua-5.4.6.tar.gz
Modify the Makefile and reset the installation directory
Change INSTALL_TOP=/usr/local to INSTALL_TOP=/usr/cloudland/lua, exit and save
Compile and install
make linux
make install
Set Lua environment variables
vi /root/.bashrc
Add at the end
export LUA_HOME=/usr/cloudland/lua
PATH=$PATH/bin:$LUA_HOME/bin
export PATH
source Lua environment variables
source /root/.bashrc
verify
pit -v