Samba shared directory and multiple client mounts

Source: Internet
Author: User
Tags mysql host wordpress database

Experimental content:

(1) Samba server export/data/application/web, in the directory to provide WordPress;

(2) Samba client mounts the file system exported by Samba server to/var/www/html;

(3) the client (lamp) to deploy WordPress, and let its normal access, to ensure that the normal post, upload pictures;

(4) Client 2 (lamp), mount the file system exported by Samba server to/var/www/html; check whether its WordPress can be accessed, to ensure that the normal post, upload pictures;


1, install the configuration on the server host;

#安装samba

[email protected] ~]# Yum Install Samba

#启动服务

[[email protected] ~]# systemctl start SMB

[email protected] ~]# systemctl start NMB

#查看端口139 445

[email protected] ~]# SS-TNL

Port to listen on:

137/UDP, 138/UDP

139/TCP, 445/tcp

#创建准备导出的目录;

[email protected] samba]# Mkdir-pv/data/application/web

#安装mariadb并且从ftp下载一个wordpress包, move to the web directory

[[email protected] samba]# yum install mariadb-server installing MySQL

[[email protected] samba]# systemctl start mariadb start service

#解压wordpress移动到web目录下

[email protected] samba]# unzip Wordpress-4.3.1-zh_cn.zip

[email protected] samba]# MV wordpress/data/application/web/

#进入mysql创建数据库及用户和授权;

Mysql> GRANT all on wpdb.* to ' wpuser ' @ ' 172.16.%.% ' identified by ' wppass ';

mysql> FLUSH privileges;

mysql> CREATE DATABASE wpdb;


#配置wordpress里的配置文件;

[[email protected] wordpress]# MV wp-config-sample.php wp-config.php to modify the profile name

[email protected] wordpress]# vim wp-config.php Modified

* * MySQL Settings-specific information from the host you are using * *//

/** Name of WordPress database */

Define (' db_name ', ' wpdb ');

/** MySQL Database user name */

Define (' Db_user ', ' wpuser ');

/** MySQL Database password */

Define (' Db_password ', ' wppass ');

/** MySQL Host */

Define (' Db_host ', ' 172.16.100.31 ');

/** The default text encoding when creating data tables */

Define (' Db_charset ', ' UTF8 ');

/** the database collation type. If you are unsure do not change */

Define (' db_collate ', ');

[[email protected] wordpress]# systemctl Restart mariadb Restart service

#创建一个用户并且赋予该用户对共享目录拥有执行权限;

[[email protected] ~]# useradd Apache user name I prefer to use pache because the server does not have the HTTPD service installed


[[email protected] ~]# setfacl-m u:apache:rwx/data/application/web/wordpress give execute permission

#查看一下apache的ID

[[email protected] ~]# ID Apache

uid=1003 (Apache) gid=1003 (Apache) groups=1003 (Apache) Remember the ID number, etc. will go to the client to change

#添加samba服务中的用户, this user system must exist beforehand; we have created it;

[[email protected] ~]#pdbedit-a Apache then enter the password, which is the unique password of the Samba service;


#然后编辑samba的配置文件, add the following information to the bottom line;

[email protected] ~]# vim/etc/samba/smb.conf

[WordPress]

Comment = wordpress name

Path =/data/application/web route to export

browseable = yes

writable = yes


2, client host, install Samba-client client, httpd,php-mysql,php;

Yum-y Install samba-client httpd php-mysql php



#先把pache的ID号改成和服务端一样的ID号 so there's permission to mount the directory.

[email protected] ~]# usermod-u 1003 Apache

[email protected] ~]# groupmod-g 1003 Apache

#然后挂载即可

[email protected] html]# mount-t cifs-o username=apache,password=admin//172.16.100.31/wordpress/var/www/ Html

#启动服务并且测试

Then test whether the data can be connected and stored;

650) this.width=650; "title=" 1.jpg "src=" Http://s4.51cto.com/wyfs02/M01/84/74/wKiom1eQy22QY7sqAADgv1aBRns474.jpg " alt= "Wkiom1eqy22qy7sqaadgv1abrns474.jpg"/>

650) this.width=650; "Style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat Center;border : 1px solid #ddd; "src="/e/u261/themes/default/images/spacer.gif "alt=" Spacer.gif "/>650" this.width=650; "title=" 1.jpg "src=" http://s5.51cto.com/wyfs02/M01/84/74/wKioL1eQy3_Cm0_uAAD9Z23eaOs502.jpg "alt=" wkiol1eqy3_cm0_ Uaad9z23eaos502.jpg "/>

650) this.width=650; "Style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat Center;border : 1px solid #ddd; "src="/e/u261/themes/default/images/spacer.gif "alt=" Spacer.gif "/>

#

650) this.width=650; "Style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat Center;border : 1px solid #ddd; "src="/e/u261/themes/default/images/spacer.gif "alt=" Spacer.gif "/>650" this.width=650; "title=" 1.jpg "src=" http://s1.51cto.com/wyfs02/M02/84/74/wKiom1eQy5GglR2NAADnWDZ-fn0716.jpg "alt=" Wkiom1eqy5gglr2naadnwdz-fn0716.jpg "/>

#编辑配置文件


Add picture file succeeded


This article is from the "11332618" blog, please be sure to keep this source http://11342618.blog.51cto.com/11332618/1828597

Samba shared directory and multiple client mounts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.