先增加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.gzCOPY
安装编译所需工具及依赖库
```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.html10 </IfModule>11 修正为12 <IfModule dir_module>13 DirectoryIndex index.html index.php14 </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 opensslyum install openssl-devel
安装curl
wget https://curl.haxx.se/download/curl-7.84.0.tar.gztar 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命令)makemake install</li>
接下来一堆莫名其妙插件,装便是了
yum install libpng-develyum install freetype-develyum install libxslt-devel -ydnf install libcurl-develyum install gmp-devel -y yum install oniguruma-devel -yyum 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文件进行测试访问
安装 mariadbhttps://lxfamn.cn/blog/?p=6898