在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,创建系统用户centos,修改密码为centos,修改该目录的属主属组为centos,并将centos用户添加至samba自己管理的文件中,密码也是centos;
~]# yum install samba
~]# mkdir /data
~]# useradd -r centos
~]# chown centos.centos /data
~]# smbpasswd -a centos
3.在B主机上编辑samba的配置文件/etc/samba/smb.conf,并启动服务;
~]# vim /etc/samba/smb.conf
[share_fs]
comment = mariadb data dir
path = /data
browseable = yes
guest ok = no
write list = centos
~]# systemctl start smb.service
4.在A主机上创建/mydata目录,修改属主属组为mysql,挂载B主的samba共享目录/data至本地的/mydata;
~]# mkdir /mydata
~]# chown mysql.mysql /mydata
~]# mount -t cifs -o username=centos,password=centos //192.168.199.174/share_fs /mydata
5.在A主机上编辑mariadb的配置文件 ,修改数据目录,然后关闭selinux,启动mariadb服务;
~]# vim /etc/my.cnf
datadir=/mydata
~]# setenforce 0
~]# systemctl start mariadb.service
6.在A主机上创建数据库testdb,用户testuser,密码testpasswd,并做授权,:
~]# 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;
7.在A主机上编辑httpd配置文件,修改ServerName为www1.magedu.com,默认主页为index.php,并启动服务;
~]# vim /etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html
ServerName www1.magedu.com:80
~]# systemctl start httpd.service
8.在A主机上下载word并解压至/var/www/html目录下;
9.在A主机上修改/var/www/html/目录下的wp-config-sample.php文件名为wp-config.php,并编辑该文件:
~]# mvwp-config-sample.php wp-config.php
~]# vim wp-config.php
10.在windows主机上修改hosts文件并做测试
通过samba共享目录的方式搭建lamp平台并安装wordpress(二)
原文地址:http://tiankongzhiling.blog.51cto.com/11639803/1829642