1、搭建php-fpm工作方式的LAMP环境,实现wordpress正常访问 

搭建httpd+wordpress环境   ip:172.16.100.141  将下载好的wordpress放置再/data/目录下

~]#yum install httpd -y

~]#yum install php php-mysql -y

~]#vim /etc/httpd/conf.d/ilinux.conf

<VirtualHost 172.16.100.141:80>

ServerName www.ilinux.io

DocumentRoot /data/www/html/ilinux/

ProxyRequests off

ProxyPassMatch ^/(.*\.php)$ fcgi://172.16.100.142/data/$1

<Directory /data/www/html/ilinux>

    Option None

    AllowOverride None

    require all granted

</Directory>

</VirtualHost>

~]#mkdir /data/www/html/ilinux -pv

~]#vim /data/www/html/ilinux/index.html

<li>172.16.100.141<li>

~]#vim /data/www/html/ilinux/phpinfo.php

<?php

    phpinfo();

?>

~]#yum install lrzsz -y

~]#rz     上传wordpress

~]#tar -xvf wordpress -C /data/

~]#ln -sv /data/wordpress/ /data/www/html/ilinux/blog/

~]#chown apache.apache /data/wordpress

~]#chown apache.apache /var/lib/php/session/

~]#systemctlt start httpd.service

搭建mariadb-server再172.16.100.142服务器上

~]#yum install mariadb-server -y

~]#vim /etc/my.cnf

skip-name-resolve=on

innodb-file-per-table=on

~]#mysql

mysql>SET PASSWORD FOR root@localhost = PASSWORD(xlj999);

mysql>SET PASSWORD FOR root@127.0.0.1 = PASSWORD(xlj999);

mysql>create database wordpress;

mysql>grant all privileges on wordpress.* towordpress@%identified by wordpress;

mysql>grant all privileges on wordpress.* towordpress@localhostidentified by wordpress;

mysql>grant all privileges on wordpress.* towordpress@127.0.0.1identified by wordpress;

~]#systemctl start mariadb.service

#安装然后网页输入相应配置www.ilinux.io/blog

 

 

****实现php-fpm模块**** 172.16.100.142

~]#yum install php-fpm php-mysql php-mbstring php-mcrpt -y

~]#mkdri /var/lib/php/session -pv

~]#chown apache.apache /var/lib/php/session

~]#vim /etc/php-fpm.d/www.conf

listen=172.16.100.142:9000

listen.allowed_clients=172.16.100.141

~]#systemctl start php-fpm.service

~]#scp 172.16.100.141:/data/wordpress /data/www/html/ilinux/blog

~]#chown apache.apache /data/www/html/ilinux/blog/wp-config.php

 

 

 2、什么是DML?常用SQL举例,每个命令至少1个例子,最多不超过3个例子 

mysql>SELECT name AS student_name,gender FROM students;

mysql>SELECT name AS student_name,gender FROM students WHERE stuid>2;

mysql>SELECT stuid,name AS student_name,gender FROM students WHERE gender=M;

mysql>DELETE FROM students WHERE stuid=3;

mysql>SELECT * FROM students;

mysql>DELETE FROM students ORDER BY age DESC LIMIT 100;

mysql>UPDATE students SET classid=2;

mysql>UPDATE students SET classid=2 WHERE stuid=2;

3.简述ftp的主动和被动模式,并实现基于pam认证的vsftpd

存储

SATA,SAS,IDE,SCSI,USB

SCSI 

 

DAS

Dirct Attached Storage    直接附加存储   接口类型:”block”

NAS

Network Attached Storage 网络附加存储   接口类型:”file”

协议

CIFS(samba),NFS(Network File System)

RPC

Remote Procedure Call 远程过程调用

SAN

Storage Area Network    接口类型:”block”

协议:ISCSI(IP-SAN)FCSAN,FCOE

两类连接:

命令连接:传输命令

数据连接:传输数据

两种模式:PORT

Server:20/tcp连接客户端的命令连接使用的端口向后的第一个可用端口

被动模式:PASV

Server:打开一个随机端口,并等待客户端连接

PAM: Pluggable Authenticate Module    /etc/pam.d/   认证框架

协议:C/S

Server

WindowsServ-U,FilezillaLinuxwuftpd,proftpd,pureftpd,vsftpd(Very Secure FTP daemon)

 

Client

Windowsftp,Fillzilla,CuteFTP,FlashFXPLinuxlftp,ftp,Fillzilla,gftp

 

URL

SCHEMA://username:password@HOST:Port/PATH/TO/FILE

路径映射

用户家目录:每个用户的URL/映射到当前的家目录

vsftpdftp用户的身份运行,默认为ftp用户,匿名用户的默认路径即ftp用户的家目录/var/ftp     ftp,anonymous

~]#ls /usr/lib64/security/

 

~]#ldd /usr/sbin/vsftpd

 

~]#ls /etc/pam.d/

 

~]#yum install mariadb-devel pam-devel -y

~]#yum groupinstall “Development Tools” “Server Platform Development”

下载pam_mysql-0.7RC1.tar.gz

~]#tar xvf pam_mysql-0.7RC1.tar.gz

 

~]#cd pam_mysql-0.7RC1

~]#./configure --help

~]#./configure --with-mysql=/usr --with-pam=/usr --with-pam-mods-dir=/usr/lib64/security

~]#make && make install

~]#ls /usr/lib64/security

 

~]#vim /etc/my.cnf.d/server.cnf

skip_name_resolve=ON

innodb_file_per_table=ON

log_bin=mysql-bin

~]#systemctl start mariadb.service

~]#mysql

mysql>grant all privileges on vsftpd.* to ‘vsftpd’@’127.0.0.1’ identified by ‘vsftpd’;

mysql>flush privileges;

mysql>create database vsftpd;

mysql>use vsftpd;

mysql>CREATE TABLE users(id INT UNSIGNED NOT NUL AUTO_INCREMENT PRIMARY KEY,name VARCHAR(100) NOT NULL,password CHAR(48)NOT NULL,UNIQUE KEY(name));

mysql>DESC users;

mysql>INSERT INTO users(name,password) VALUES(‘tom’,PASSWORD(‘mageedu’)),(‘jerry’,PASSWORD(‘jerry’));

mysql>SELECT * FROM users;

mysql>\q

~]#useradd -d /ftproot/vuser vuser

~]#finger vuser

~]#mkdir /ftproot/vuser/pub

~]#vim /etc/pam.d/vsftpd.vusers

auth required /usr/lib64/security/pam_mysql.so user=vsftpd passwd=mageedu host=127.0.0.1 db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2

account required /usr/lib64/security/pam_mysql.so user=vsftpd passwd=mageedu host=127.0.0.1 db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2

~]#vim /etc/vsftpd/vsftpd.conf

pam_service_name=vsftpd.vusers

guest_enable=YES

guest_username=vuser

~]#chmod a-w /ftproot/vuser/

不能上传文件

~]#vim /etc/vsftpd/vsftpd.conf

user_config_dir=/etc/vsftpd/vusers_config/

~]#vim /etc/vsftpd/vusers_config/tom

anon_upload_enable=YES

anon_mkdir_write_enable=YES

 4、简述NFS服务原理及配置 

__________________Server_________________________172.16.100.135

~]#lsmod

~]#lsmod | grep nfs

~]#yum info nfs-utils

NFS utilities and supporting clients and daemons for the kernel NFS server

#####安装nfs-utils########

~]#yum install nfs-utils -y

~]#rpm -ql nfs-utils

#####编辑/etc/exports文件######

~]#vim /etc/exports

~]#ls /etc/exports.d/

~]#vim /etc/exports

~]#mkdir /data/mysql -pv

~]#man exports

~]#vim /etc/exports

/data/mysql  172.16.0.67(rw,anonuid=1001,anongid=1001)  172.16.0.0/16(ro)

#######启动nfs########

~]#systemctl start nfs.service

~]#ss -tnl

 

~]#vim /etc/sysconfig/nfs      #可以修改配置文件

~]#useradd -u 1001 centos

~]#mkdir /data/mysql/test

~]#chown -R 1001.1001 /data/mysql/test

~]#exprotfs -rav #############重新导出  不重启

 

 

 

 

 

 

 

____________________________Client_________________________172.16.100.137

~]#yum install showmount -y

~]#showmount -e 172.16.100.135

Export list for 172.16.100.135:

/data/mysql 172.16.100.0/24

~]#mount -t nfs 172.16.100.135:/data/mysql  /mnt

~]#mount

 

~]#

 5、简述samba服务,并实现samba配置

简述samba服务:

smb:Service message block

cifs:common internet filesystem

 

samba功能:

文件系统共享

打印机共享

NetBIOS协议

程序环境:

服务端程序包:samba  samba-common samba-libs

主配置文件:/etc/samba/smb.conf ,samba-common包提供

主程序:

nmbd:NetBIOS name server

smbd:SMB/CIFS service

Unit FIle

smb.service

nmb.service

监听的端口:

137/udp,138/udp

139/tcp,445/tcp

客户端程序:

smbclient:交互式命令行客户端,类似于lftp

mount.cifs:挂在cifs文件系统的专用命令

 

共享文件系统配置

有三类

[homes] :为每个samba用户定义是否能够通过samba服务访问自己的家目录

[printers]:定义打印服务

[shared_fs]:定义共享的文件系统

常用指令

comment :注释信息

path:当前共享所映射的文件系统路径

browseable:是否可浏览,指是否而可被用户查看

guest ok :是否允许来宾账号访问

public :是否公开所有用户

writable :是否可写

write list :拥有写权限的用户列表

用户名

@组名

+组名

samba 用户管理: smbpasswd [options] USERNAME

-a :添加

-x :删除

-d :禁用

-e :启用

pdbedit

-L :列出samba服务中的所有用户

-a :添加用户为samba用户

-x :删除用户

-t :从标准输出接受字符串作为用户密码

查看服务器端的共享:

smbclient -L SMB-Server [-U Username];

交互式文件访问:

smbclient //SMB-Server/Share_Name [-U Username]

挂在访问:

mount -t cifs //SMB_Server/Share_Name -o username=USERNAME,password=PASSWORD

注意:挂在操作的用户,与-o选项中的指定用户直接产生映射关系。此时,访问挂载 点是以-o选项中的username指定的用户身份进行,与本地用户无关

显示smbstatus命令

-b : 显示简要格式信息

-v : 显示详细格式信息

服务配置:

*****172.16.100.141*****

~]#yum install sabma -y

~]#rpm -ql samba | less

~]#rpm -ql samba-common | less

~]#vim /etc/samba/smb.conf

[mysql_file]

        comment = mysql_file_data

        path = /data/mysql_data

        write list = tqgaorui5

        browseable = yes

        writeable = yes

        force group = @tom_group

~]#useradd tqgaorui5

~]#smbpasswd -a tqgaorui5

~]#systemctl start nmb.service

~]#systemctl start smb.service

~]#groupadd -g 1001 tom_group

~]#cat /etc/group

*****172.16.100.142*****

~]#yum install samba-client -y

~]#smbclient -L 172.16.100.141 -U tqgaorui5

~]#smbcllient -t cifs //172.16.100.141/mysql_file /data/mysql_data -o tqgaorui5,password=redhat

~]#mount

~]#vim /etc/fstab

//172.16.100.141/mysql_file /data/mysql_data cifs defaults 0 0

~]#useradd tom

~]#id tom

uid=1001(tom) gid=1001(tom) 组=1001(tom)