当前位置: 首页 > news >正文

yum安装搭建lamp架构部署WordPress个人论坛

yum安装搭建lamp架构部署WordPress个人论坛

1、关闭防火墙、修改selinux并重启
[root@stw2 ~]# systemctl stop firewalld.service 
[root@stw2 ~]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@stw2 ~]# setenforce 0
[root@stw2 ~]# vim /etc/selinux/config 
[root@stw2 ~]# reboot

在这里插入图片描述

2、时钟同步(因为要使用网络源安装)
[root@stw2 ~]# rpm -q chrony
chrony-3.2-2.el7.x86_64
[root@stw2 ~]# systemctl restart chronyd
[root@stw2 ~]# systemctl enable chronyd
Created symlink from /etc/systemd/system/multi-user.target.wants/chronyd.service to /usr/lib/systemd/system/chronyd.service.
[root@stw2 ~]# hwclock -w
[root@stw2 ~]# timedatectl Local time: Mon 2025-08-18 15:18:32 CSTUniversal time: Mon 2025-08-18 07:18:32 UTCRTC time: Mon 2025-08-18 07:18:32Time zone: Asia/Shanghai (CST, +0800)NTP enabled: yes
NTP synchronized: yesRTC in local TZ: noDST active: n/a
3、配置网络源仓库并安装epel-release
[root@stw2 ~]# cd /etc/yum.repos.d/
[root@stw2 yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@stw2 yum.repos.d]# rm -rf *
[root@stw2 yum.repos.d]# ls
[root@stw2 yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
//在浏览器搜索阿里巴巴镜像站,将centos7版本的任意一个复制过来% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0   6712      0 --:--:-- --:--:-- --:--:--  6728
[root@stw2 yum.repos.d]# ls
CentOS-Base.repo
[root@stw2 yum.repos.d]# yum -y install epel-release
[root@stw2 yum.repos.d]# ls
CentOS-Base.repo  epel.repo  epel-testing.repo
4、安装httpd和mariadb数据库
[root@stw2 ~]# yum -y install httpd mariadb mariadb-server
[root@stw2 ~]# systemctl restart mariadb.service 
[root@stw2 ~]# systemctl enable mariadb.service 
5、初始化数据库
[root@stw2 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none): 
OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] y    //设置数据库的root用户的密码,密码是123456
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..... Success!By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] y     //是否移除匿名用户... Success!Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n   //是否不允许root用户远程登录... skipping.By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y   //是否移除测试的数据库- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y     //是否重新加载权限列表... Success!Cleaning up...All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!
6、安装php
[root@stw2 ~]# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
[root@stw2 ~]# yum -y install yum-utils
[root@stw2 ~]# cd /etc/yum.repos.d/
[root@stw2 yum.repos.d]# ls
CentOS-Base.repo   remi-php54.repo  remi-php73.repo  remi-php82.repo
epel.repo          remi-php70.repo  remi-php74.repo  remi-php83.repo
epel-testing.repo  remi-php71.repo  remi-php80.repo  remi.repo
remi-modular.repo  remi-php72.repo  remi-php81.repo  remi-safe.repo
[root@stw2 yum.repos.d]# yum-config-manager --enable remi-php70
[root@stw2 yum.repos.d]# yum -y install php php-cli php-fpm php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd
[root@stw2 yum.repos.d]# php -v    //查看php版本
PHP 7.0.33 (cli) (built: Jun  5 2024 09:34:26) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologieswith Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
7、配置php,将时区改成亚洲/上海
[root@stw2 ~]# vim /etc/php.ini 
[root@stw2 ~]# systemctl restart php-fpm
[root@stw2 ~]# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.

在这里插入图片描述

8、配置默认网页
[root@stw2 ~]# vim /etc/httpd/conf/httpd.conf 
[root@stw2 ~]# cd /var/www/html
[root@stw2 html]# ls
[root@stw2 html]# vim index.php
[root@stw2 html]# systemctl restart httpd
[root@stw2 html]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

在这里插入图片描述

在这里插入图片描述

9、测试访问lamp基础架构

在这里插入图片描述

10、将压缩包上传并解压
[root@stw2 ~]# ls
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates
Desktop          Downloads  Music                 Public    Videos
[root@stw2 ~]# rz -E  //不用敲命令直接将压缩包丢进来
rz waiting to receive.
[root@stw2 ~]# ls
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates  wordpress-6.5.5.tar.gz
Desktop          Downloads  Music                 Public    Videos
[root@stw2 ~]# tar -xzvf wordpress-6.5.5.tar.gz 
[root@stw2 ~]# ls
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates  wordpress
Desktop          Downloads  Music                 Public    Videos     wordpress-6.5.5.tar.gz
11、将解压之后的压缩包复制移动到/var/www/html,并为之设置权限
[root@stw2 ~]# cp -r wordpress /var/www/html/
[root@stw2 ~]# cd /var/www/html/
[root@stw2 html]# ls
index.php  wordpress
[root@stw2 html]# ll
total 8
-rw-r--r-- 1 root root   21 Aug 18 15:59 index.php
drwxr-xr-x 5 root root 4096 Aug 18 16:06 wordpress
[root@stw2 html]# chown -R apache:apache wordpress/
[root@stw2 html]# ll
total 8
-rw-r--r-- 1 root   root     21 Aug 18 15:59 index.php
drwxr-xr-x 5 apache apache 4096 Aug 18 16:06 wordpress
[root@stw2 html]# chmod -R 775 wordpress/
12、为wordpress配置数据库
[root@stw2 ~]# mysql -uroot -p   //root用户登录,输入密码
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)MariaDB [(none)]> create database wordpress_db; //创建数据库wordpress_db
Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> create user 'wordpress_user'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
//为wordpress_db数据库创建一个用户和密码MariaDB [(none)]> grant all on wordpress_db.* to 'wordpress_user'@'localhost';
Query OK, 0 rows affected (0.00 sec)
//给刚刚创建的用户权限MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| wordpress_db       |
+--------------------+
4 rows in set (0.00 sec)MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> exit
Bye
13、为wordpress配置站点
[root@stw2 ~]# cp -p /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /etc/httpd/conf.d
[root@stw2 ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf 
[root@stw2 wordpress]# vim /etc/httpd/conf/httpd.conf 
//将主配置文件中的一个两个内容复制
[root@stw2 ~]# systemctl restart httpd

在这里插入图片描述

14、使用浏览器访问wordpress站点

在这里插入图片描述

在这里插入图片描述

http://www.lryc.cn/news/625189.html

相关文章:

  • 美图披露半年报:AI应用取得突破,净利润同比大增71.3%
  • 上周60+TRO案件,波比的游戏时间/丹迪世界/飞盘/迪奥/多轮维权,手表/汽车品牌持续发力,垃圾桶专利等新增侵权风险!
  • 【MongoDB】多种聚合操作详解,案例分析
  • 启发式合并
  • powershell中的cmdlet
  • 【每日一题】Day 7
  • MySQL架构和储存引擎
  • Web安全 - 构建安全可靠的API:基于国密SM2/SM3的文件上传方案深度解析
  • 多智能体架构设计:从单Agent到复杂系统的演进逻辑
  • 人工智能 | 基于大数据的皮肤病症状数据可视化分析系统(matlab源码)
  • 发布npmjs组件库
  • AopAutoConfiguration源码阅读
  • 鼠标右键没有“通过VSCode打开文件夹”
  • JVM学习笔记-----类加载
  • FPGA-Vivado2017.4-建立AXI4用于单片机与FPGA之间数据互通
  • Google 的 Opal:重新定义自动化的 AI 平台
  • WPF 打印报告图片大小的自适应(含完整示例与详解)
  • Rust 入门 生命周期-next2 (十九)
  • 牛津大学xDeepMind 自然语言处理(1)
  • Centos7 使用lamp架构部署wordpress
  • 接口和抽象类的区别(面试回答)
  • 【深度长文】Anthropic发布Prompt Engineering全新指南
  • Java面向对象三大特性:封装、继承、多态深度解析与实践应用
  • ⭐CVPR2025 RigGS:从 2D 视频到可编辑 3D 关节物体的建模新范式
  • 音频分类模型笔记
  • OOP三大特性
  • 【计算机视觉与深度学习实战】05计算机视觉与深度学习在蚊子检测中的应用综述与假设
  • 网络基础——协议认识
  • Pytest项目_day18(读取ini文件)
  • Unity 中控开发 多路串口服务器(一)