问题描述
我如何从源代码在Ubuntu中安装Apache 2.4.46,因为我想拥有一个纯软件包,而无需进行任何调整.
How can I install Apache 2.4.46 in Ubuntu from source, because I want to have the pure package, without tweaks.
从apt安装的apache2可能更安全,但这是我的意图.
The apache2 installed from apt might be more secure, but this is my intention.
推荐答案
请注意,您应该始终安装最新版本的软件以提高安全性.我建议您从Ubuntu的apt软件包管理器如果您在生产服务器上"安装Apache.在本地环境中从源代码安装它并不重要.本教程适用于基于Ubuntu/Debian的系统.
请按照以下说明由我进行安装,并附上更多说明.转到终端,然后一个接一个地输入以下命令,然后按Enter键以免引起混乱:
Please follow this for the instructions of installing it, by me, with a bit more explanation. Go to the terminal, and enter the following commands one by one and hit enter for no confusion:
-
安装一些必需的库:
Install some required libraries:
sudo apt install libnghttp2 libpcre3 libssl build-essential -y
导航到我们将要编译apache的目录.
Navigate to the directory from which we will be compiling apache.
cd /usr/local/src
在浏览器中,转到 http://httpd.apache.org/download.cgi .
右键单击并复制链接的链接位置,看起来像 Source:httpd-2.4.46.tar.gz
sudo wget -O- <download-link> | tar -zxf -
也请转到 http://apr.apache.org/download.cgi并复制 Unix来源的链接位置:apr-1.7.0.tar.gz
sudo wget -O- <apr-download-link> | tar -zxf -
转到 http://apr.apache.org/download.cgi,然后复制 Unix来源的链接位置:apr-util-1.6.1.tar.gz
sudo wget -O- <apr-util-download-link> | tar -zxf -
将下载并提取的apr文件移动到正确的位置:须藤MV 4月-httpd-/srclib/apr
Move the downloaded and extracted apr files to the right location:sudo mv apr- httpd-/srclib/apr
将下载并提取的apr-util文件移动到正确的位置:sudo mv apr-util- httpd-/srclib/apr-util
Move the downloaded and extracted apr-util files to the right location:sudo mv apr-util- httpd-/srclib/apr-util
导航到httpd目录:cd httpd-
Navigate into the httpd directory:cd httpd-
据我说,此配置比其他任何配置都要好.-prefix
是安装Apache的位置.
According to me, this configuration is better than any other. The --prefix
is where apache is installed.
sudo ./configure --prefix=/usr/local/apache2 --enable-mods-shared="reallyall" --enable-mpms-shared="all"
编译源代码:须藤制作
Compile the sources:sudo make
将已编译的应用程序安装到您的系统中:sudo make install
Install the compiled application to your system:sudo make install
可以在步骤 9.中使用不同的参数来更改这些目录.( sudo ./configure
命令)
These directories could be altered using different arguments in step 9. (the sudo ./configure
command)
apache目录为/usr/local/apache2
.
apache conf目录为/usr/local/apache2/conf
.
apache主配置文件为/usr/local/apache2/conf/httpd.conf
.
The apache directory is /usr/local/apache2
.
The apache conf directory is /usr/local/apache2/conf
.
The apache main conf file is /usr/local/apache2/conf/httpd.conf
.
有关更多信息,请访问 http://httpd.apache.org/docs/current/install.html .
For more info go to http://httpd.apache.org/docs/current/install.html.
这篇关于如何在Ubuntu上从源代码安装apache 2.4.46的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!