1、 更换阿里云yum源并安装epel源
[root@localhost ~]# yum -y install vim wget [root@localhost ~]# mv /etc/yum.repos.d//CentOS-base.repo /etc/yum.repos.d/CentOS-base.repo.backup [root@localhost ~]# wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-base.repo [root@localhost ~]# yum -y install epel-release [root@localhost ~]# yum -y update
2、安装apache-2.4.6,启动服务后并进行验证
[root@localhost ~]# yum -y install httpd httpd-devel [root@localhost ~]# systemctl start httpd && systemctl enable httpd [root@localhost ~]# httpd -v
3、配置防火墙
[root@localhost ~]# firewall-cmd --zone=public --permanent --add-service=http [root@localhost ~]# systemctl restart firewalld [root@localhost ~]# firewall-cmd --list-all
访问浏览器能看到apache测试页面
4、安装数据库mariadb10.5.8
先将系统自带的旧版本mariadb的相关包移除
[root@localhost ~]# yum list installed | grep mariadb
[root@localhost ~]# yum remove mariadb-libs.x86_64
创建mariadb最新版本的yum源
[root@localhost ~]# vim /etc/yum.repos.d/mariadb.repo
[root@localhost ~]# yum clean all && yum makecache [root@localhost ~]# yum list | grep mariadb
[root@localhost ~]# yum -y install MariaDB-server MariaDB-client [root@localhost ~]# yum -y install net-tools [root@localhost ~]# systemctl enable mariadb --now [root@localhost ~]# netstat -anptu | grep :3306
配置mariadb10.5数据库密码等
[root@localhost ~]# mysql_secure_installation
[root@localhost ~]# vim /etc/my.cnf [mysqld] init_connect='SET collation_connection = utf8_general_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_general_ci skip-character-set-client-handshake
[root@localhost ~]# vim /etc/my.cnf.d/client.cnf default-character-set=utf8 [root@localhost ~]# cat /etc/my.cnf.d/client.cnf
[root@localhost ~]# vim /etc/my.cnf.d/mysql-clients.cnf # # These groups are read by MariaDB command-line tools # Use it for options that affect only one utility # [mysql] default-character-set=utf8 [mysql_upgrade] [mysqladmin] [mysqlbinlog] [mysqlcheck] [mysqldump] [mysqlimport] [mysqlshow] [mysqlslap] [root@localhost ~]# cat /etc/my.cnf.d/mysql-clients.cnf
[root@localhost ~]# systemctl restart mariadb [root@localhost ~]# mysql -uroot -p MariaDB [(none)]> show variables like "%character%";
如上图所示mariadb安装完成。
安装php-8.0
[root@localhost ~]# yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm [root@localhost ~]# yum clean all && yum makecache
[root@localhost ~]# yum -y install yum-utils [root@glocalhost ~]# yum repolist all |grep php
[root@localhost ~]# yum-config-manager --enable remi-php80
安装php-80以及扩展包
[root@localhost ~]# yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis php-fileinfo php-mysqli php-session php-zlib php-simplexml php-intl php-domxml php-ldap php-openssl php-xmlrpc php-pecl-apcu php-pear-CAS php-opcache [root@localhost ~]# php -v [root@localhost ~]# systemctl enable php-fpm --now [root@localhost ~]# php --modules



