Linux运维新人自用笔记(部署 ​​LAMP:Linux + Apache + MySQL + PHP、部署discuz论坛)

内容全为个人理解和自查资料梳理,欢迎各位大神指点!

每天学习较为零散。

day19

简单搭建网站

下载apache服务

#下载阿帕奇服务
[root@xun ~]# yum install httpd -y#关闭防火墙
[root@xun ~]# iptables -F#启动服务
[root@xun ~]# systemctl start httpd#验证服务和端口
[root@xun ~]# netstat -tunlp |grep httpd
tcp6       0      0 :::80                   :::*                    LISTEN      2515/httpd          
[root@xun ~]# curl -I 127.0.0.1:80
HTTP/1.1 403 Forbidden
Date: Sun, 15 Jun 2025 14:40:40 GMT
Server: Apache/2.4.6 (CentOS)
Last-Modified: Thu, 16 Oct 2014 13:20:58 GMT
ETag: "1321-5058a1e728280"
Accept-Ranges: bytes
Content-Length: 4897
Content-Type: text/html; charset=UTF-8#查看自己服务器的公网ip
[root@xun ~]# curl ifconfig.me
xxx.72.xxx.90#设置开机自启
[root@xun ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.#查看用户访问日志
[root@xun ~]# tail -f /var/log/httpd/access_log 

下载mysql数据库 

下载mysql#启动服务
[root@xun yum.repos.d]# systemctl start mysqld
[root@xun yum.repos.d]# systemctl status mysqld
● mysqld.service - MySQL Community ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Sun 2025-06-15 23:15:43 CST; 3s agoProcess: 7264 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)#mysql的安全设置
[root@xun yum.repos.d]# mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQLSERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, 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): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
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 MySQL
root user without the proper authorisation.You already have a root password set, so you can safely answer 'n'.Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Sorry, passwords do not match.New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..... Success!By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL 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... skipping.By default, MySQL 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...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist... Failed!  Not critical, keep moving...- 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!All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.Thanks for using MySQL!Cleaning up...#登陆mysql
[root@xun yum.repos.d]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 5.6.51 MySQL Community Server (GPL)Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)mysql> EXIT
Bye
[root@xun yum.repos.d]# 

下载php 

# 启用 remi 仓库(提供更新的 PHP 版本)yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm# 启用 PHP 7.4yum-config-manager --enable remi-php74# 安装 PHPyum install -y php#查询apache的rpm文件列出包中的文件
[root@xun /]# rpm -ql httpd |grep html#将php代码放在阿帕奇网页下
[root@xun /]# cd /var/www/html/[root@xun html]# cat index.php 
<?phpphpinfo();
?>#在网页访问
PHP 版本 7.4.33
系统	Linux xun 3.10.0-1160.el7.x86_64 #1 SMP 2020 年 10 月 19 日星期一 16:18:59 UTC x86_64
构建日期	6月 5, 2024 05:05:14
构建系统	Red Hat Enterprise Linux Server 版本 7.9 (Maipo)
生成提供程序	Remi 的 RPM 存储库<https://rpms.remirepo.net/> #StandWithUkraine
服务器 API	Apache 2.0 处理程序
虚拟目录支持	禁用
配置文件 (php.ini) 路径	/等
加载的配置文件	/etc/php.ini
扫描此目录以获取其他 .ini 文件	/etc/php.d 中
解析的其他 .ini 文件	/etc/php.d/20-bz2.ini 中, /etc/php.d/20-calendar.ini 中, /etc/php.d/20-ctype.ini 中, /etc/php.d/20-curl.ini 中, /etc/php.d/20-exif.ini 中、 /etc/php.d/20-fileinfo.ini 中, /etc/php.d/20-ftp.ini 中、 /etc/php.d/20-gettext.ini 中, /etc/php.d/20-iconv.ini 中、 /etc/php.d/20-json.ini 中、 /etc/php.d/20-phar.ini 中, /etc/php.d/20-sockets.ini 中, /etc/php.d/20-sodium.ini 中、 /etc/php.d/20-tokenizer.ini
PHP 应用程序接口	20190902
PHP 扩展	20190902
Zend 扩展	320190902
Zend 扩展构建	API320190902,NTS
PHP 扩展构建	API20190902,NTS
调试版本	不
线程安全	禁用
Zend 信号处理	启用
Zend 内存管理器	启用
Zend 多字节支持	禁用
IPv6 支持	启用
DTrace 支持	可用、禁用
已注册的 PHP 流	https, ftps, compress.zlib, php, 文件, glob, 数据, http, ftp, compress.bzip2, phar
已注册的流套接字传输	TCP、UDP、UNIX、UDG、SSL、SSLv3、TLS、TLSv1.0、TLSv1.1、TLSv1.2
已注册的流过滤器	zlib.*、string.rot13、string.toupper、string.tolower、string.strip_tags、convert.*、consumed、dechunk、bzip2.*、convert.iconv.*

 在discuz官网下载Discuz! X3.5版本

#在discuz官网下载Discuz! X3.5版本,在/var/www/html目录下解压缩
unzip Discuz_X3.5_SC_UTF8_20250205.zip #将upload/目录下所有文件转移到 /var/www/html/ 中
mv upload/* /var/www/html/[root@xun html]# ll
total 11564
-rw-r--r--  1 root root     2869 Feb  5 20:44 admin.php
drwxr-xr-x 10 root root     4096 Feb  5 20:44 api
-rw-r--r--  1 root root      727 Feb  5 20:44 api.php
drwxr-xr-x  2 root root     4096 Feb  5 20:44 archiver
drwxr-xr-x  2 root root     4096 Feb  5 20:44 config
-rw-r--r--  1 root root     1040 Feb  5 20:44 connect.php
-rw-r--r--  1 root root      106 Feb  5 20:44 crossdomain.xml
drwxr-xr-x 12 root root     4096 Feb  5 20:44 data
-rw-r--r--  1 root root 11596436 Jun 16 13:32 Discuz_X3.5_SC_UTF8_20250205.zip
-rw-r--r--  1 root root     5558 Feb  5 20:41 favicon.ico
-rw-r--r--  1 root root     2357 Feb  5 20:44 forum.php
-rw-r--r--  1 root root      906 Feb  5 20:44 group.php
-rw-r--r--  1 root root     1325 Feb  5 20:44 home.php
-rw-r--r--  1 root root     6920 Feb  5 20:44 index.php
drwxr-xr-x  5 root root     4096 Feb  5 20:44 install
-rw-r--r--  1 root root     8181 Feb  5 20:41 LICENSE
-rw-r--r--  1 root root      998 Feb  5 20:44 member.php
-rw-r--r--  1 root root     2410 Feb  5 20:44 misc.php
-rw-r--r--  1 root root     1790 Feb  5 20:44 plugin.php
-rw-r--r--  1 root root     1086 Feb  5 20:44 portal.php
-rw-r--r--  1 root root    33294 Dec 21  2022 qqqun.png
drwxr-xr-x  2 root root     4096 Feb  5 20:44 readme
-rw-r--r--  1 root root    70226 Mar 16  2023 readme.html
-rw-r--r--  1 root root      639 Feb  5 20:44 robots.txt
-rw-r--r--  1 root root     1755 Feb  5 20:44 search.php
drwxr-xr-x 10 root root     4096 Feb  5 20:44 source
drwxr-xr-x  7 root root     4096 Feb  5 20:44 static
drwxr-xr-x  3 root root     4096 Feb  5 20:44 template
drwxr-xr-x  8 root root     4096 Feb  5 20:44 uc_client
drwxr-xr-x 13 root root     4096 Feb  5 20:44 uc_server
drwxr-xr-x  2 root root     4096 Jun 16 13:33 upload
-rw-r--r--  1 root root      140 Feb 12  2023 utility.html

 将/var/www/html/ 中的目录文件权限设置为777

 chmod -R 777 ./*

 Discuz在服务器配置安装时出现xml_parser_create()不支持

# 下载 libxslt RPM 包(阿里云镜像)
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/libxslt-1.1.28-6.el7.x86_64.rpm# 安装(强制忽略依赖)
sudo rpm -ivh --nodeps libxslt-1.1.28-6.el7.x86_64.rpm# 确保 remi-php74 仓库已启用
sudo yum-config-manager --enable remi-php74# 安装 php-xml
sudo yum install -y php-xml --enablerepo=remi-php74# 检查 PHP 模块
php -m | grep xml# 测试 PHP 是否能解析 XML
php -r "new SimpleXMLElement('<test></test>'); echo 'OK';"最后重启
systemctl restart httpd刷新网络界面即可最初因 libxslt 依赖缺失导致 php-xml 安装失败
通过手动安装 libxslt RPM 包或编译安装解决问题

Discuz在服务器配置安装时出现mysqli_connect()不支持

#下载驱动
[root@xun html]# yum install php-mysqli -y
#重启apache
[root@xun html]# systemctl restart httpd

部署完成
http://117.72.204.90/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/pingmian/84971.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Kubernetes架构解析

Kubernetes 技术栈的深度解析&#xff0c;涵盖架构设计、核心组件、生态工具及二次开发实践&#xff0c;结合实战案例说明其内在关联&#xff1a; 一、Kubernetes 架构设计 核心分层模型 #mermaid-svg-CnFwJbuzaABZpTBr {font-family:"trebuchet ms",verdana,arial…

langchain4j整合springboot

langchain4j整合springboot 1.搭建项目架子配置文件Controller测试测试结果![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/35b8bd04f3034bd990861f065bc73d2f.png) 1.搭建项目架子 配置文件 参考官网配置引入 <?xml version"1.0" encoding"UTF…

408第一季 - 数据结构 - 平衡二叉树

平衡二叉树 定义 缩写记一下 AVL 还有下面这些&#xff0c;can you try&#xff1f; 平衡二叉树的插入 LL平衡旋转&#xff08;右单旋转&#xff09; 怎么理解&#xff1f; 首先我们可以看见啊&#xff0c;b图A左边和右边的不平衡的&#xff0c;非常的难受 于是我们可以这…

VR 地震安全演练:“透视” 地震,筑牢企业安全新护盾​

与传统的地震安全教育方式相比&#xff0c;VR 地震安全技术具有无可比拟的优势。在过去漫长的岁月里&#xff0c;我们主要依赖书本、讲座和视频等较为常规的手段来了解地震知识和逃生技巧。​ 书本上密密麻麻的文字以及静态的图片&#xff0c;虽然能够较为系统地传递理论性的信…

30-Oracle 23ai-回顾从前的Flashback设置

配置和测试了Oracle 23 ai的Flashback Log Placement后&#xff0c; 刚好身边11g,19c的环境都在&#xff0c;还是把从前的flashback整理下&#xff0c;温故知新&#xff0c;循序渐进。 一、闪回技术 Flashback Database 允许将整个数据库回退到过去的某个时间点/SCN&#xff…

Gartner《Reference Architecture for Federated Analytics》学习心得

研究背景 随着分析平台越来越易于被广泛用户使用,以及组织内用例的不断增多和多样化,分析架构的去中心化给专注于架构的分析专家带来了混乱。组织在交付一致、可复用和可信的分析方面面临挑战,分布式分析架构需要在控制和敏捷之间取得平衡,然而许多组织在这方面的控制力不…

Windows下Docker一键部署Dify教程

Windows环境下Docker部署Dify完整指南 &#x1f4cb; 目录 系统要求Docker安装验证Docker安装Dify部署访问Dify常见问题管理命令 &#x1f5a5;️ 系统要求 在开始安装之前&#xff0c;请确保你的Windows系统满足以下要求&#xff1a; 硬件要求 CPU: > 2核心内存: >…

idea maven打包很慢,怎么提速-多线程

作为一个技术运维人员&#xff0c;经常要更新程序然后重新打包发布jar包。由于程序子模块多&#xff0c;需要相互引用每次打包的时候都需要很久&#xff0c;怎么可以让打包快一点呢&#xff1f;可以启动打包的多线程。请参照下图设置&#xff0c;线程数量应该和cpu内核数量要能…

Java/Kotlin selenium 无头浏览器 [Headless Chrome] 实现长截图 三种方式

在自动化测试和网页抓取中&#xff0c;完整捕获整个页面内容是常见需求。传统截图只能捕获当前视窗内容&#xff0c;无法获取超出可视区域的页面部分。长截图技术通过截取整个滚动页面解决了这个问题&#xff0c;特别适用于&#xff1a; 保存完整网页存档生成页面可视化报告验…

【AI大模型】Elasticsearch9 + 通义大模型实现语义检索操作详解

目录 一、前言 二、Elasticsearch9 语义检索介绍 2.1 ES9 语义检索核心特性 2.2 semantic_text 字段类型说明 2.3 ES9 语义检索原理 2.4 ES9 语义检索优势与使用场景 三、 Elasticsearch9 搭建过程 3.1 环境说明 3.2 部署方式一 3.2.1 创建docker网络 3.2.2 获取es9镜…

linux开机原理以及如何开关机-linux023

linux开机原理以及如何开关机 Linux 系统启动过程概述 阶段描述内核引导启动时&#xff0c;BIOS执行自检&#xff0c;启动设备通常是硬盘。操作系统接管硬件后&#xff0c;读取/boot目录下的内核文件。运行 initinit是系统所有进程的起点&#xff0c;负责启动其他进程。它读取…

使用 socat 和 xinetd 将程序绑定到端口运行

在现代网络应用开发和系统管理中&#xff0c;经常需要将某些程序或脚本绑定到特定的网络端口上&#xff0c;以实现远程访问或服务化。例如&#xff0c;一个简单的 Python 脚本可能需要通过 TCP 端口提供服务&#xff0c;或者一个命令行工具需要通过网络接口暴露其功能。为了实现…

电阻篇---上拉电阻

一、上拉电阻的定义与本质 定义&#xff1a;上拉电阻是一端连接到电源&#xff08;VCC&#xff09;&#xff0c;另一端连接到电路节点的电阻元件&#xff0c;其核心作用是将该节点的电平 “拉” 至电源电压&#xff0c;使其在无信号输入时保持稳定的高电平状态。 本质原理&…

前端持续集成和持续部署简介

持续集成&#xff08;CI&#xff09;&#xff1a;代码提交后自动触发构建、静态检查、单元测试&#xff0c;确保代码质量。 持续部署&#xff08;CD&#xff09;&#xff1a;通过流水线将测试通过的代码自动发布到测试/生产环境&#xff0c;减少人工操作失误。 CI/CD 工具链 …

Elasticsearch高效文章搜索实践

功能 创建索引和映射 使用postman添加映射和查询 查询所有的文章信息&#xff0c;批量导入到es索引库中 server:port: 9999 spring:application:name: es-articledatasource:driver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:3306/leadnews_article?useU…

React 中除了react-router还有哪些路由方案

在用React开发时&#xff0c;常用的路由是react-router &#xff0c;但除此之外&#xff0c;还有两个路由方案&#xff0c;因为他们具备 react-router 没有的特性。 1. tanstack/router 1.1. 主要特性 100% 推断的 TypeScript 支持 类型安全的导航 嵌套路由和布局路由 内置…

VINS-Fusion 简介、安装、编译、数据集/相机实测

目录 VINS-Fusion 简介 安装 VINS-Fusion 源码安装 运行数据集 双目模式 单目IMU 模式 双目IMU 模式 D455 相机实际运行 双目IMU 模式 VINS-Fusion 简介 VINS-Fusion 是继 VINS-Mono 和 VINS-Mobile&#xff08;单目视觉惯导 SLAM 方案&#xff09;后&#xff0c;香港科 技大学…

SQL Developer 表复制

SQL Developer 表复制 此方法在数据量比较大时&#xff0c;比一条一条的insert要快得多&#xff1b;具体是会覆盖掉原数据&#xff0c;还是增量的处理&#xff0c;请自行创建demo表测试一下。 注意&#xff1a;原库版本要与目标库数据库版本一致&#xff0c;否则可能会报错的。…

影视剧学经典系列-梁祝-《吕氏春秋·应同》

1、背景 07版电视剧《梁山伯与祝英台》中&#xff0c;谢道韫作为先生&#xff0c;给学生讲了其中的句子。 2、名言 君为尊&#xff0c;以白为黑&#xff0c;臣不能从&#xff1b;父虽亲&#xff0c;以黑为白&#xff0c;子不能从”出自《吕氏春秋应同》 其意为&#xff0c;…