Fix Missing Libxslt When Installing Nginx

1. Problem description

./configure: error: the HTTP XSLT module requires the libxml2/libxslt libraries.
You can either do not enable the module or install the libraries.

It was the first time I encountered Nginx compilation and installation failure, and then I found that the Ubuntu image of Tencent Cloud lacked libxslt.

2. Solution

There are ways to install via a package manager and to compile and install from source.

2.1.CentOS

implement:

Bash
1
yum install libxml2 libxslt

2.2.Ubuntu

implement:

Bash
1
2
3
sudo apt-get install libxml2-dev
sudo apt-get install libxml2
sudo apt-get install libxslt1-dev

2.3.compile and install

If you can't install using the package, you can try to compile and install.

Compilation may take a long time, it is recommended to execute in Screen.

Screen tutorial reference:

Linux install using Screen
https://blog.tsinbei.com/archives/871/

Higher version GCC may be required ,CentOS reference:

CentOS7 compile and upgrade GCC
https://blog.tsinbei.com/archives/860/
Bash
1
2
3
4
5
6
7
wget ftp://xmlsoft.org/libxslt/libxslt-1.1.21.tar.gz
tar -xvzf libxslt-1.1.21.tar.gz
cd libxslt-1.1.21
sudo autoreconf --install
./configure
make
sudo make install

After the installation is successful, recompile Nginx.

Fix Missing Libxslt When Installing Nginx

https://blog.tsinbei.com/en/archives/731/

Author
Ηsukqi Lee
Posted on

2023-05-24

Edited on

2023-05-24

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet