在A主机上安装httpd,php,mariadb,samba-client,作为samba client,在B主机上安装samba,作为samba server。A主机IP192.168.199.157,B主机IP 192.168.199.174。
1.在A主机上安装httpd,php,php-mysql,mariadb,samba-client
~]# yum install httpd php php-mysql mariadb-server samba-client
2.在B主机上安装samba,并创建目录/data/application/web,创建系统用户centos,修改密码为centos,修改该目录的属主属组为centos,并将centos用户添加至samba自己管理的文件中,密码也是centos;
~]# yum install samba
~]# mkdir -pv /data/application/web
~]# useradd -r centos
~]# chown -R centos.centos /data/application/web
~]# smbpasswd -a centos
3.在B主机上编辑samba的配置文件/etc/samba/smb.conf,并启动服务;
~]# vim /etc/samba/smb.conf
[share_fs]
comment = wordpress dir
path = /data/application/web
browseable = yes
guest ok = no
write list = centos
~]# systemctl start smb.service
4.在A主机上启动数据库服务,创建数据库testdb,用户testuser,密码testpasswd,并做授权,:
~]#systemctl start mariadb.service
~]# mysql
MariaDB[(none)]>CREATEDATABASE testdb;
MariaDB[(none)]>CREATEUSER ‘testuser’@’127.0.0.1’ IDENTIFIED BY ‘testpasswd’;
MariaDB[(none)]>GRANT ALL ON testdb.* TO ‘testuser’@’127.0.0.1’;
MariaDB[(none)]>FLUSH PRIVILEGES;
5.在A主机上编辑httpd的配置文件/etc/httpd/conf/httpd.conf,并启动httpd服务;
~]# vim /etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html
ServerName www1.magedu.com:80
~]# systemctl start httpd.service
6.在B主机上下载wordpress并解压到/data/application/web目录下
7.在A主机上挂载B主机共享的目录/data/application/web到本地的/var/www/html目录
~]# mount -t cifs -o username=centos,password=centos //192.168.199.174/share_fs /var/www/html
8.在A主机上修改/var/www/html/目录下的wp-config-sample.php文件名为wp-config.php,并编辑该文件:
~]# mvwp-config-sample.php wp-config.php
~]# vim wp-config.php
9.在windows主机上修改hosts文件并做测试