Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Samba shared directory and multiple client mounts

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Content of the experiment:

(1) samba server export / data/application/web, which provides wordpress in the directory

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

(3) the client (lamp) deploys wordpress and allows it to access it normally; to ensure that articles can be posted normally, upload pictures

(4) client 2 (lamp), mount the file system exported by samba server to / var/www/html; to verify whether its wordpress can be accessed; to ensure that articles can be sent normally, upload pictures

1. Install the configuration on the server host

# install samba

[root@localhost ~] # yum install samba

# start the service

[root@localhost ~] # systemctl start smb

[root@localhost ~] # systemctl start nmb

# View port 139 445

[root@localhost ~] # ss-tnl

Listening port:

137/udp, 138/udp

139/tcp, 445/tcp

# create a directory to be exported

[root@localhost samba] # mkdir-pv / data/application/web

# install mariadb and download a wordpress package from ftp and move to the web directory

[root@localhost samba] # yum install mariadb-server install mysql

[root@localhost samba] # systemctl start mariadb startup service

# decompress wordpress and move to web directory

[root@localhost samba] # unzip wordpress-4.3.1-zh_CN.zip

[root@localhost samba] # mv wordpress / data/application/web/

# enter mysql to create database and user and authorization

Mysql > GRANT ALL ON wpdb.* TO 'wpuser'@'172.16.%.%' IDENTIFIED BY' wppass'

Mysql > FLUSH PRIVILEGES

Mysql > CREATE DATABASE wpdb

# configure the configuration file in wordpress

[root@localhost wordpress] # mv wp-config-sample.php wp-config.php to modify the configuration file name

[root@localhost wordpress] # modified by vim wp-config.php

/ / * * MySQL settings-specific information comes 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')

/ * default text encoding when creating a datasheet * /

Define ('DB_CHARSET',' utf8')

/ * * Database collation type. If you are not sure, do not change * /

Define ('DB_COLLATE',')

[root@localhost wordpress] # systemctl restart mariadb restart service

# create a user and give the user execute permissions on the shared directory

[root@localhost ~] # useradd apache user name is casual. I prefer to use pache because the httpd service is not installed on the server.

[root@localhost ~] # setfacl-m u:apache:rwx / data/application/web/wordpress gives execution permission

# check the ID of apache

[root@localhost ~] # id apache

Uid=1003 (apache) gid=1003 (apache) groups=1003 (apache) remember that the ID number will be changed at the client.

# add a user in the samba service, which must exist in advance; we have already created

[root@localhost ~] # pdbedit-an apache and then enter the password, which is unique to the samba service

# then edit the configuration file of samba; just add the following information on the bottom line

[root@localhost ~] # vim / etc/samba/smb.conf

[wordpress]

Comment = wordpress name

Path = / data/application/web the path to be exported

Browseable = yes

Writable = yes

2. Client host, install samba-client client, httpd,php-mysql,php

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

# change the ID number of pache to the same ID number as the server so that you have the permission to mount the directory.

[root@localhost] # usermod-u 1003 apache

[root@localhost ~] # groupmod-g 1003 apache

# and then mount it

[root@localhost html] # mount-t cifs-o username=apache,password=admin / / 172.16.100.31/wordpress / var/www/html

# start the service and test

Then test whether the data can be connected and stored.

#

# Editing configuration file

Image file added successfully

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report