一。基础配置:
1.配置主机名,静态IP地址
2.开启防火墙配置
3.部分开启selinux并且配置
4.服务器之间使用同ntp.aliyun.com进行世家能同步
5.服务器之间实现SSH绵密登陆
二。业务需求
1.Sever-NFS-DNS主机配置NFS服务器,将博客网站资源文件共享给Sever-wed主机,Sever-NFS-DNS主机配置DNS
2.Sever-wed主机配置wed服务,通过域名www.mywed.com可以访问到自建的博客网站
三。网络基础配置:
服务器:
nmcli c modify ens160 ipv4.method manual ipv4.addresses 192.168.1.150/24 ipv4-gateway
192.168.1.2 ipv4.dns 114.114.114.114
nmcli c reload
nmcli c up ens160
客户机:
nmcli c modify ens160 ipv4.method manual ipv4.addresses 192.168.1.151/24 ipv4-gateway
192.168.1.2 ipv4.dns 114.114.114.114
nmcli c reload
nmcli c up ens160
四。修改主机名及host映射:
服务器:
hostname set-hostname Sever-Wed(修改主机名)
vim /etc/hosts
reboot
客户机:
hostname set-hostname Sever-NFS-DNS(修改主机名)
vim /etc/hosts
reboot
五。开启防火墙和SElinux设置(两台机子)
systemctl start firewalld
systemctl enable firewalld
setenforce 0(Sever-Wed端开启)
setenforce 1(Sever-NFS-DNS端开启)
六。时间同步(两台主机都进行操作)
yum install chrony -y
vim /etc/chrony.conf
systemctl restart chronyd
chronyc sources -v
timedatectl status
七。配置免密登录:
服务器:
ssh-keygen -t rsa
ssh-copy-id 192.168.1.151
ssh 192.168.1.151
exit
客户机:
ssh-keygen -t rsa
ssh-copy-id 192.168.1.150
ssh 192.168.1.150
exit
八。环境搭建:
服务器:
yum install nginx mariadb-server php* -y
客户机:
从https://cn.wordpress.ory/下载插件
unzip workpress-6.1-zh_CN.zip
cd wordpress
ls
九。Server-NFS-DNS端设置NFS共享
yum install rpcbind -y
yum install nfs-utils -y
cd ~
vim /etc/exports
chmod -Rf 777 /wordpress
firewall-cmd --permanent --zone public --add-service=mount(防火墙放行权限)
firewall-cmd --permanent --zone public --add-service=rpc-bind
firewall-cmd --permanent --zone public --add-service=nfs
firewall-cmd --reload
systemctl start rpcbind
systemctl start nfs-server
chcon -t httpd_sys_content_t /wordpress -Rv(修改wordpress的安全上下文)
十。Sever-web设置:
yum install rpcbind -y
yum install nfs-utils -y
showmount -e 192.168.1.151
mkdir /wp
mount -t nfs 192.168.1.151:/workpress /wp
df -Th
cd /wp
ls
十一。nginx设置(Sever-wed修改)
cd ~
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone public --add-port=80/tcp
firewall-cmd --reload
vim /etc/nginx/nginx.conf
nginx -t
systemctl restrt nginx
十二。修改wordpress配置文件(Server-wed修改)
cd /wp
cp wp-config-sample.php wp-config.php
vim wp-config.php
systemctl start mariadb
十三。数据库操作(server-wed)
mysql
systemctl restart mariadb
十四。window进行测试:输入server-Web端的ip地址
十五。进行域名的解析:(Server-NFS-DNS正向解析:ip->域名)
yum install bind -y
firewall-cmd --permanent --zone=public --add-service=dns
firewall-cmd --reload
systemctl start named(启动域名解析)
vim /etc/named.conf
vim /etc/named.rfc1912.zones
cd /var/named
cp -a named.localhost openlab.com.zone
vim openlab.com.zone
systemctl restar named
最后浏览器输入域名即可