압축 패키지 설치 방법
1. httpd-2.4.29.tar.gz를 다운로드합니다.
2.서버/usr/local/software에 업로드합니다. 오류:
tar -zxvf httpd-2.4.29.tar.gz ./configure --prefix=/usr/local/apache2/ # 设置apache安装目录
3. 다음으로 apr을 설치하고 먼저 apr-1.6.3.tar.gz를 다운로드하세요.
4. 서버/usr/local/software
checking for APR... no configure: error: APR not found. Please read the documentation.
에 업로드하세요.
tar -zxvf apr-1.6.3.tar.gz cd apr-1.6.3 .configure make make install
5 . apr -util-1.6.1.tar.gz를 다운로드하세요.
6. 서버/usr/local/software
checking for APR-util... no configure: error: APR-util not found. Please read the documentation.
tar -zxvf apr-util-1.6.1.tar.gz cd apr-util-1.6.1 ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录 #include <expat.h> ^ 编译中断。 make: *** [xml/apr_xml.lo] 错误 1
yum install expat-devel # 中间会让你输入y ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr make # 成功! make install
./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
tar -zxvf pcre-8.41.tar.gz ./configure
checking windows.h usability... no checking windows.h presence... no checking for windows.h... no configure: error: You need a C++ compiler for C++ support.
yum install -y gcc gcc-c++ # 错了那么多次,别忘了现在的位置,接下来还是要安装pcre ./configure make make install
cd .. cd apache ./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ make make install
/usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode' /usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler' /usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_ParserCre collect2: error: ld returned 1 exit status make[2]: *** [htpasswd] 错误 1 make[2]: Leaving directory `/usr/local/software/apache/support' make[1]: *** [all-recursive] 错误 1 make[1]: Leaving directory `/usr/local/software/apache/support'
tar -zxvf apr-util-1.5.2.tar.gz cd apr-util-1.5.2 ./configure --prefix=/usr/local/apr-util-1.5/ --with-apr=/usr/local/apr make make install
cd .. cd apache ./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util-1.5/ make # make时间会比较长 make install
Installing configuration files mkdir /usr/local/apache2/conf mkdir /usr/local/apache2/conf/extra mkdir /usr/local/apache2/conf/original mkdir /usr/local/apache2/conf/original/extra Installing HTML documents mkdir /usr/local/apache2/htdocs Installing error documents mkdir /usr/local/apache2/error Installing icons mkdir /usr/local/apache2/icons mkdir /usr/local/apache2/logs Installing CGIs mkdir /usr/local/apache2/cgi-bin Installing header files mkdir /usr/local/apache2/include Installing build system files mkdir /usr/local/apache2/build Installing man pages and online manual mkdir /usr/local/apache2/man mkdir /usr/local/apache2/man/man1 mkdir /usr/local/apache2/man/man8 mkdir /usr/local/apache2/manual make[1]: Leaving directory `/usr/local/software/apache'
cp httpd.conf httpd.conf.bak # 备份配置文件 vim httpd.conf # 放掉191行的注释,修改为: ServerName [你的IP]:80 :wq
/usr/local/apache2/bin/apachectl start # 或者 /usr/local/apache2//bin/httpd -k start
1. Yum 소스 설치(온라인으로 다운로드 필요)
ps -ef|grep apache /usr/local/apache2/bin/apachectl stop # 或者 /usr/local/apache2//bin/httpd -k stop # 没错,bin前面就是//
首先关闭apache服务 yum install httpd # 中间过程中输入:y
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-67.el7.centos.6 mailcap.noarch 0:2.1.41-2.el7 完毕!
cd /etc/httpd/conf cp httpd.conf httpd.conf.bak # 放掉95行的注释,修改为: ServerName [你的IP]:80 :wq
4. 서비스 종료
systemctl start httpd.service
5. 다시 첫 번째 방법으로 httpd 설치를 시작했습니다.
systemctl stop httpd.service
Apache Tutorial
칼럼을 방문하여 알아보세요!위 내용은 리눅스에 아파치 서버를 설치하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!