CentOS7 LAMP 安装

本文详细记录了一位新手在CentOS7上安装LAMP(Linux, Apache, MySQL, PHP)环境的过程,包括解决编译安装Apache时遇到的Apache运行库、APR、APR-UTIL、expat解析库等问题,以及移除默认的mariadb,安装MySQL5.5,配置MySQL远程连接,安装PHP和必要的扩展库,最后调整Apache配置以支持PHP并设置网站根目录。" 95297344,8669351,宏定义赋值:理解C语言中的变量与常量宏,"['C语言开发', '嵌入式开发', '宏展开', '底层编程']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

自己学习一下怎么安装LAMP环境,新手一枚,有很多地方参考了别人的经验,有错误的地方望指正
1.安装Apache

[root@localhost src]# wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.33.tar.gz
[root@localhost src]# tar -xf httpd-2.4.33.tar.gz

编译安装httpd

[root@localhost src]# cd httpd-2.4.33
[root@localhost httpd-2.4.33]# ./configure

遇到了错误

checking for APR... no
configure: error: APR not found.  Please read the documentation.

原因是缺少Apache运行库,需要安装APR和APR-UTIL
试过了yum安装,不知道为啥安装完还是报这个错,只好试试自己编译安装咯,下载地址在这

编译安装APR

[root@localhost src]# tar -xf apr-1.6.3.tar.gz
[root@localhost src]# cd apr-1.6.3
[root@localhost apr-1.6.3]# ./configure

又遇到一个错误

configure: error: no acceptable C compiler found in $PATH

原因是未安装gcc编译器,给装它一个

[root@localhost apr-1.6.3]# yum install -y gcc-c++

再来一遍,过了

[root@localhost apr-1.6.3]# ./configure
[root@localhost apr-1.6.3]# make && make install

轮到APR-UTIL

[root@localhost apr-1.6.3]# cd ../
[root@localhost src]# tar -xf apr-util-1.6.1.tar.gz
[root@localhost src]# cd apr-util-1.6.1
[root@localhost apr-util-1.6.1]# ./configure

错误还是无可避免滴

configure: error: APR could not be located. Please use the --with-apr option.

无法定位到APR的位置,需要带上 --with-apr 参数编译

[root@localhost apr-util-1.6.1]# ./configure --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make && make install

有报错了

xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

缺少expat解析库,给装上

[root@localhost apr-util-1.6.1]# yum install -y expat-devel

继续

[root@localhost apr-util-1.6.1]# make && make install

继续编译安装httpd,出现了个新的错误

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

装上

[root@localhost httpd-2.4.33]# yum install -y pcre-devel

终于编译过了

[root@localhost httpd-2.4.33]# ./configure --enable-so
[root@localhost httpd-2.4.33]# make && make install

又爆出一堆错误

collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/usr/local/httpd-2.4.33/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/httpd-2.4.33/support&#
出现这个错误的原因是在导入seaborn包时,无法从typing模块中导入名为'Protocol'的对象。 解决这个问题的方法有以下几种: 1. 检查你的Python版本是否符合seaborn包的要求,如果不符合,尝试更新Python版本。 2. 检查你的环境中是否安装了typing_extensions包,如果没有安装,可以使用以下命令安装:pip install typing_extensions。 3. 如果你使用的是Python 3.8版本以下的版本,你可以尝试使用typing_extensions包来代替typing模块来解决该问题。 4. 检查你的代码是否正确导入了seaborn包,并且没有其他导入错误。 5. 如果以上方法都无法解决问题,可以尝试在你的代码中使用其他的可替代包或者更新seaborn包的版本来解决该问题。 总结: 出现ImportError: cannot import name 'Protocol' from 'typing'错误的原因可能是由于Python版本不兼容、缺少typing_extensions包或者导入错误等原因造成的。可以根据具体情况尝试上述方法来解决该问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [ImportError: cannot import name ‘Literal‘ from ‘typing‘ (D:\Anaconda\envs\tensorflow\lib\typing....](https://blog.youkuaiyun.com/yuhaix/article/details/124528628)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值