In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Content of the experiment:
(1) nfs server export / data/application/web, which provides wordpress in the directory
(2) nfs client mounts the file system exported by nfs 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 nfs server to / var/www/html; to verify whether its wordpress can be accessed; to ensure that articles can be sent normally, upload pictures
Here are the three hosts for the experiment:
# Server host IP provides directory sharing and mysql database for 172.16.100.32
# client host IP: 172.16.100.31 mount directory
# client host IP: 172.16.100.33 mount directory
First, the server host installs nfs-utils
[root@localhost ~] # yum install nfs-utils should be installed by default
# then create a directory to be exported
[root@localhost ~] # mkdir-pv / data/application/web
# Edit configuration file / etc/exports
[root@localhost ~] # vim / etc/exports
# indicates the directory to be exported and which ip address clients can mount. Here are all clients of the 172.16 network segment and have read and write permissions.
# create a user on the server and grant permissions
[root@localhost ~] # useradd apache View ID number
[root@localhost] # setfacl-m u:apache:rwx / data/application/web
# 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.
# restart the service. Restart is not recommended in the production environment. Here is a command to export all
[root@localhost ~] # exportfs-ar
# then the client can mount and use it; using the command mount-t is equivalent to mount.nfs
[root@centos7] # mount-t nfs 172.16.100.32:/data/application/web / var/www/html
# format: which directory is mounted to the client after the IP of the mount host and the shared directory path of the server?
# you can use the mount command to check whether the mount is successful and the detailed information
[root@centos7 ~] # mount
172.16.100.32:/data/application/web on/ var/www/html type nfs4 (rw,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=172.16.100.31,local_lock=none,addr=172.16.100.32)
# but now the user on the client does not have write permission to this / var/www/html directory
The ID number of # apache must be the same as the ID number of the user with permissions on the server, so as to map the permissions that the server user ID can have to the client user ID.
# in fact, there is another way to specify the users and groups running httpd to change it in the main configuration file.
Don't use this method for the time being.
# 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
# if you want to see which directories can be mounted and which have been mounted on the server, you can check them with the command showmount-e
[root@centos7 html] # showmount-e 172.16.100.32
Export list for 172.16.100.32:
/ data/application/web 172.16.0.0/16
# Let's provide the wordpress file on the server; then let the client configure it and allow it to access it normally
Install the httpd service
# create database in mariadb and provide username and password for wordpress
Advanced mysql and then the following
Mysql > GRANT ALL ON wpdb.* TO 'wpuser'@'172.16.%.%' IDENTIFIED BY' wppass'
Mysql > FLUSH PRIVILEGES
Mysql > CREATE DATABASE wpdb
# modify wordpress configuration file
[wu@centos7 ~] $vim / var/www/html/wordpress/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.32'); here it points to the server host IP
/ * 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',')
Let's verify that it can be accessed and used normally.
It worked.
# Let's move on to the second client, which is the same as the host step of the first one. I'll simply write down the steps.
[root@localhost yum.repos.d] # yum install httpd php php-mysql install RPM package
# 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
[root@localhost yum.repos.d] # systemctl start httpd startup service
[root@localhost yum.repos.d] # systemctl start mariadb startup service
# Mount the directory exported by the server; use the command mount-t to be equivalent to mount.nfs
[root@localhost] # mount-t nfs 172.16.100.32:/data/application/web / var/www/html
# format: which directory is mounted to the client after the IP of the mount host and the shared directory path of the server?
# you can use the mount command to check whether the mount is successful and the detailed information
[root@localhost ~] # mount
172.16.100.32:/data/application/web on/ var/www/html type nfs4 (rw,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=172.16.100.33,local_lock=none,addr=172.16.100.32)
# because wordpress and configuration are provided in the shared directory, the first client has been configured, so there is no need to reconfigure it
# then you can log in to test whether you can log in to the second client, post a blog post, and whether the data store is available
# login is successful, because the first client has already been installed when it logs in and the file is shared, so you can see the article sent by client 1 as soon as you come in
# next we are posting an article. If we can send a picture, we are done.
Success
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.