- #在文件/etc/yum.repos.d/中新建一个以.repos 结尾的文件
- [root@timeserver ~]# cd /etc/yum.repos.d/
- [root@timeserver yum.repos.d]# vim /etc/yum.repos.d/wangluo.repo
- #写入如下内容
- [wangluo-app]
- name=wanluo-app
- baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/x86_64/os/
- gpgcheck=0
- [wangluo-base]
- name=wangluo-base
- baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/
- gpgcheck=0
-
- #安装软件包
- [root@timeserver yum.repos.d]# yum install vim bash-completion -y
- 出现完毕字样代表成功安装
- [root@localhost ~]# systemctl disable --now firewalld
- #查看防火墙状态
- [root@localhost ~]# systemctl status firewalld
- Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
- Active: inactive (dead) #dead 代表已关闭
- Docs: man:firewalld(1)
- [root@localhost ~]# setenforce 0
- #查看关闭状态
- [root@localhost ~]# getenforce
- Permissive #代表关闭
[root@Server-Web ~]# yum install httpd mariadb-server php* -y
- [root@Server-NFS-DNS ~]# cd /
- [root@Server-NFS-DNS /]# unzip wordpress-6.1-zh_CN.zip
- [root@Server-NFS-DNS /]# cd wordpress
- [root@Server-NFS-DNS /]# ls
Server-NFS-DNS端配置共享文件
- [root@localhost ~]# yum install nfs-utils
- [root@localhost ~]vim /etc/exports
- #写入以下内容实现共享文件
- /wordpress *(rw) # * 和括号之间不能有空格
- #开启服务
- [root@localhost ~]systemctl enable --now nfs-server.service
- #查看共享文件
- [root@localhost ~]showmount -e 192.168.186.100(Server-NFS-DNS的IP)
Server-Web 端挂载共享文件
- #安装软件包
- [root@localhost ~]# yum install nfs-utils -y
- #查看共享文件
- [root@localhost ~]#show mount -e 192.168.186.100(Server-NFS-DNS的IP)
- #创建挂载点目录
- [root@localhost ~]# mkdir /guazai
- #将文件挂载到挂载点目录
- [root@localhost ~]# cd /guazai
- [root@localhost ~]# mount 192.168.186.100:/wordpress /guazai
- #客户端对于服务端的挂载文件属于nobody只有 r 权限,因此需要在服务端修改权限
- [root@localhost ~]# chmod o+w /wordpress
- #安装Apache服务器软件
- [root@localhost ~]# yum install httpd -y
- #打开红帽软件管理器列出安装httpd所使用的文件
- [root@localhost ~]# rpm -ql httpd
- [root@timeserver ~]# systemctl enable --now httpd
- #查看httpd启动情况
- [root@timeserver ~]# systemctl status httpd
- #查看监听情况
- [root@timeserver ~]# netstat -lntup
-
- [root@timeserver ~]# vim /etc/httpd/conf.d/ip.conf
- #192.168.186.13代表Serve-web IP
-
- <virtualhost 192.168.186.133:443>
- servername 192.168.186.133
- documentroot /guazai #代表访问Serve-web IP自动访问的目录
- </virtualhost>
-
- <directory /guazai>
- allowoverride none
- require all granted #允许所有人访问
- </directory>
-
- #重启HTTP服务
- [root@localhost ~]# systemctl restart httpd
- [root@Server-Web ~]# vim /etc/httpd/conf/httpd.conf # 编辑http配置文件
-
- 124 DocumentRoot "/guazai"
- 129 <Directory "/guazai">
- [root@Server-Web ~]# cd /guazai
- [root@Server-Web guazai]# cp wp-config-sample.php wp-config.php # 根据模板拷贝配置文件
- # 编辑wp-config.php配置文件
- [root@Server-Web guazai]# vim wp-config.php
- # 定位23行修改后半部分
- define('DB_NAME', 'wordpress'); # WordPress数据库的名称
- define('DB_USER', 'test1'); # MySQL数据库用户名
- define('DB_PASSWORD', '123456'); # MySQL数据库密码
- #启动数据库
- [root@Server-Web guazai]# cd ~
- [root@Server-Web ~]# systemctl start mariadb
注意:创建的用户和密码需要和 挂载目录中配置的一样(本人错误)
- [root@Server-Web ~]# mysql
- MariaDB [(none)]> create database wordpress; # 创建数据库,尾部有分号
- MariaDB [(none)]> create user 'test1'@'localhost' identified by '123456'; # 第一
- 个''为数据库账号,@后面的''内容为数据库可以登录的地址,localhost意为只能本机登录。用户和密码与
- wordpress配置文件一样,
- MariaDB [(none)]> grant all on wordpress.* to 'test1'@'localhost'; # 给用户授权
- MariaDB [(none)]> exit # 退出
- [root@Server-Web ~]# systemctl restart mariadb
- [root@Server-Web ~]# systemctl start httpd
- #安装软件包
- [root@timeserver ~]# cd /etc/yum.repos.d/
- [root@timeserver yum.repos.d]# yum install bind -y
- #编辑文件
- [root@localhost ~]# vim /etc/named.conf
- listen-on port 53 {192.168.186.132;};
- directory "/var/named";
- allow-query {any; };
- };
- zone "openlab.com" IN {
- type master;
- file "named.openlab.com";
- };
- #复制文件内容到对应文件
- [root@timeserver ~]# cp /var/named/named.localhost /var/named/named.openlab.com
- [root@localhost ~]# vim /var/named/named.openlab.com
- $TTL 1D
- @ IN SOA ns.openlab.com. admin.openlab.com. (
- 0 ; serial
- 1D ; refresh
- 1H ; retry
- 1W ; expire
- 3H ) ; minimum
- NS ns.openlab.com.
- ns IN A 192.168.186.133
- www IN A 192.168.186.133
注意:上述复制文件的过程必须严格执行,不可手动在/var/named/named.openlab.com中添加
