网站首页 > 教程分享 正文
centos7安装参考以下链接
CentOS7配置LAMP环境(PHP7.3.6+maraidb10.3+Apache2.4.39)源码安装超详细步骤
新安装了openeuler 与centos8兼容,新开配置贴
搭建环境笔记,命令都已测
先增加xrdp远程连接,这样就可以远程到图形界面了
http://blog.lxfamn.cn/?p=3074
最近出于对linux服务器的学习,在安装配置的过程中遇到了各种问题,也上网看了许多相关文章,现在终于弄好了,特写此教程向大家分享,也为自己留下学习笔记。
生命不息,折腾不止。
注:如果系统之前已配置过LAMP运行环境,记得先将之前的版本卸载,防止安装过程中出现各种莫名其妙的问题,本教程为全新的CentOS8【openeuler】。
【安装Apache】
安装使用二进制安装,方便管理使用
下载 apache 及相关组件 apr、apr-util、pcre
[root@localhost ~]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.54.tar.gz
[root@localhost ~]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
[root@localhost ~]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
[root@localhost ~]# wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz
COPY
安装编译所需工具及依赖库
```shell
[root@localhost ~]# yum install gcc gcc++ gcc-c++ libxml2 libxml2-devel expat-devel -y
[root@localhost ~]# yum install -y expat-devel
解包并做相关配置
```shell
[root@localhost ~]# tar -zxvf httpd-2.4.54.tar.gz
[root@localhost ~]# tar -zxvf apr-1.7.0.tar.gz
[root@localhost ~]# tar -zxvf apr-util-1.6.1.tar.gz
[root@localhost ~]# tar -zxvf pcre-8.45.tar.gz
[root@localhost ~]# mv apr-1.7.0 apr
[root@localhost ~]# mv apr-util-1.6.1 apr-util
[root@localhost ~]# mv apr apr-util httpd-2.4.54/srclib
安装 pcre
```shell
[root@localhost ~]# cd pcre-8.45
[root@localhost pcre-]# ./configure --prefix=/usr/local/pcre8
[root@localhost pcre-]# make
[root@localhost pcre-*]# make install
开始 apache 编译配置,完成后执行安装
```shell
[root@localhost ~]# cd httpd-2.4.54
[root@localhost httpd-*]# ./configure --prefix=/usr/local/apache2 -with-pcre=/usr/local/pcre8/bin/pcre-config -with-included-apr
[root@localhost httpd-*]# make
[root@localhost httpd-*]# make install
开放防火墙端口并重启防火墙服务(HTTP协议80端口)
[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
[root@localhost ~]# systemctl restart firewalld.serviceCOPY
添加 apache 开机启动服务
[root@localhost ~]# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
[root@localhost ~]# vim /etc/init.d/httpd
在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.
[root@localhost ~]# chmod +x /etc/rc.d/init.d/httpd
[root@localhost ~]# chkconfig --add httpd
[root@localhost ~]# chkconfig httpd onCOPY
查看服务是否添加成功,启动 apache 服务
[root@localhost ~]# chkconfig --list httpd
[root@localhost ~]# systemctl start httpd.serviceCOPY
此时在浏览器中输入对应ip地址,将显示如下提示,表示Apache已经开始正常工作
It works!
设置Apache支持PHP
1 [root@localhost ~]# vim /usr/local/apache2/conf/httpd.conf
2 找到<IfModule unixd_module> 在该行前面添加 LoadModule php7_module modules/libphp7.so
搜索x-compress添加内容
4 AddType application/x-httpd-php .php
5 AddType application/x-httpd-php-source .php5
6
7 接着找到
8 <IfModule dir_module>
9 DirectoryIndex index.html
10 </IfModule>
11 修改为
12 <IfModule dir_module>
13 DirectoryIndex index.html index.php
14 </IfModule>
15
16 找到
17 DocumentRoot "/usr/local/apache2/htdocs"
18 <Directory "/usr/local/apache2/htdocs">
19 修改为
20 DocumentRoot "/home/www"
21 <Directory "/home/www">
22 此处 /home/www 为你自定义的网站根目录,设置效果如图片-2COPY
保存退出后创建网站根目录
1 [root@localhost ~]# mkdir /home/www
重启Apache服务
1 [root@localhost ~]# systemctl restart httpd.service
注意:此时Apache重启后仍然无法解析php,原因为 modules/libphp7.so 文件不存在,当安装完PHP后就能正常解析。
【安装PHP】
为了避免后期麻烦的编译安装或者出现的额问题,作者在安装过程中尽量安装所有功能,所以需要提前安装一些扩展,然后再编译
首先安装openssl
yum install openssl
yum install openssl-devel
安装curl
wget https://curl.haxx.se/download/curl-7.84.0.tar.gz
tar zxvf curl-7.84.0.tar.gz##如果选择的是tar.bz2版本 解压使用 tar -jxvfcd curl-7.65.0
./configure --prefix=/usr/local/sysother/curl7 --with-wolfssl
(如果有错,提示没有c相关的编译器,执行#yum install gcc命令)
make
make install</li>
接下来一堆莫名其妙插件,装就是了
yum install libpng-devel
yum install freetype-devel
yum install libxslt-devel* -y
dnf install libcurl-devel
yum install gmp-devel -y
yum install oniguruma-devel -y
yum install readline-devel -y
下面两个安装
cmake安装
http://blog.lxfamn.cn/?p=3699
http://blog.lxfamn.cn/?p=3702
下载 php 并解包 即可安装8.1.9版本
[root@localhost ~]# wget http://am1.php.net/get/php-8.1.9.tar.gz/from/this/mirror
[root@localhost ~]# tar -zxvf mirror
切换至解包好的目录并执行编译配置(--enable-fpm 是为了配合能使用 nginx)
[root@localhost ~]# cd php-8.1.9/
[root@localhost php-7.3.0]# ./configure --prefix=/usr/local/php8 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php8/etc/ --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-xmlrpc --with-openssl --with-mcrypt --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache
编译配置完成后执行编译,最后执行安装
[root@localhost php-7.3.0]# make
[root@localhost php-7.3.0]# make install
此时重启Apache后即可在 /home/www 目录中自行创建php文件进行测试访问
安装 mariadb
https://lxfamn.cn/blog/?p=6898
猜你喜欢
- 2024-10-27 安装Apache-php项目运行的lamp环境搭建
- 2024-10-27 我的HTML+php学习第十八天——Apache,域名配置下
- 2024-10-27 CentOS7编译安装PHP7的详细教程(图文)
- 2024-10-27 Mac系统下用Apache和PHP安装Xdebug详细流程
- 2024-10-27 CentOS7 - 安装Apache HTTP Server和PHP
- 2024-10-27 Windows安装PHP8+Apache+JIT(即时编译)
- 2024-10-27 CentOS7如何安装最新版PHP7?Nginx或Apache该如何配置?
- 2024-10-27 phpstudy中apache无法启动怎么解决?
- 2024-10-27 使用Dockerfile基于7.4-apache-buster镜像搭建php7.4微服务环境
- 2024-10-27 windows下的Apache+php+pdo+SQL server环境配置
你 发表评论:
欢迎- 最近发表
-
- 有了这份900多页的Android面试指南,你离大厂Offer还远吗?
- K2 Blackpearl 流程平台总体功能介绍:常规流程功能
- 零基础安卓开发起步(一)(安卓开发入门视频)
- 教程:让你的安卓像Windows一样实现程序窗口化运行
- Android事件总线还能怎么玩?(事件总线有什么好处)
- Android 面试被问“谈谈架构”,到底要怎样回答才好?
- Android开发工具Parcel和Serialize
- Android 中Notification的运用(notification widget安卓)
- Android退出所有Activity最优雅的方式
- MT管理器-简单实战-去除启动页(mt管理器怎么去除软件弹窗)
- 标签列表
-
- css导航条 (66)
- sqlinsert (63)
- js提交表单 (60)
- param (62)
- parentelement (65)
- jquery分享 (62)
- check约束 (64)
- curl_init (68)
- sql if语句 (69)
- import (66)
- chmod文件夹 (71)
- clearinterval (71)
- pythonrange (62)
- 数组长度 (61)
- javafx (59)
- 全局消息钩子 (64)
- sort排序 (62)
- jdbc (69)
- php网页源码 (59)
- assert h (69)
- httpclientjar (60)
- postgresql conf (59)
- winform开发 (59)
- mysql数字类型 (71)
- drawimage (61)
本文暂时没有评论,来添加一个吧(●'◡'●)