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
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/84971.shtml
英文地址,請注明出處:http://en.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;…