workstation | server1
实验要求:workstation 新增一块scsi盘共享给server1 :
fdisk /dev/sdb //新增磁盘分区
yum install scsi-target-utils -y //安装共享存储包
vim /etc/tgt/targets.conf
增加:default-driver iscsi
backing-store /dev/sdb1 //要共享出去的盘
systemctl restart tgtd //重启tgt服务
server1:
yum install iscsi-initiator-utils -y
iscsiadm --mode discoverydb --type sendtargets --portal 192.168.40.203 --discover
iscsiadm --mode node --targetname iqn.2008-09.com.example:server.target1 --portal 192.168.40.203:3260 --login //登陆。会发现dev下多出来一块硬盘,sdb
fdisk /dev/sdb//分区
mkfs.xfs /dev/sdb1//格式化
mkdir home/date //挂载点
mount /dev/sdb1 /home/date //临时挂载
mount //查看是否挂载成功
umount /home/date //卸载
vim /etc/fstab //开机自动挂载。务必要按照格式写入,否则机器可能会奔溃
增加:
/dev/sdb1 /home/date xfs defaults,_netdev 0 0
保存重启reboot,验证是否自动挂载成功
实验需求:workstation,server1 两台机器
要求:workstation共享自己的一个目录给server1
workstation:
mkdir sharedisk
yum install nfs-utils -y //安装nfs服务
database:vim /etc/exports
/sharedisk 192.168.16.0/24(rw,no_root_squash,async)//赋予特定网段对该目录特定权限
systemctl restart nfs
客户端server1:
yum install nfs-utils -y
mkdir /data//创建挂载点
mount -t nfs 192.168.0.10:/sharedisk /sharedisk //IP为共享目录服务器的IP
#将服务器192.168.0.10上的/sharedisk/ 临时挂载到本地
mount
验证:在该共享目录下创建文件,workstation,server1上都可以看到
搭建ecshop网店
试验准备:
需要两台虚拟机:workstation 上安装mariadb server1 安装http 和php
workstation://搭建mariadb数据库
systemctl stop firewalld;systemctl disable firewalld
setenforce 0
yum -y install mariadb-server// 安装并启动mariadb
vim /etc/my.cnf
[mysqld]
character-set-server=utf8//增加中文编码
systemctl restart mariadb
systemctl enable mariadb
mysql_secure_installation //初始化mariadb
mysql -u root -p //使用root用户登陆
show databases;
create database tide;创建数据库
grant all on tide.* to 'tdd'@'localhost' identified by 'tpplinux';
//tpplinux -添加用户及设置密码
GRANT ALL PRIVILEGES ON *.* TO 'tdd'@'%'IDENTIFIED BY 'tpplinux' WITH GRANT OPTION;//赋权限
flush privileges;/刷新
server1:搭建http,php,ecshop
systemctl stop firewalld;systemctl disable firewalld
setenforce 0
yum install -y httpd
systemctl restart httpd;systemctl enable httpd
mv ECShop_V3.0.0_UTF8_release0518/ /var/www/html/ //记得先下载ecshop组件包
cd /var/www/html/ECShop_V3.0.0_UTF8_release0518/
mv ECShop_V3.0.0_UTF8_release0518/ ecshop/ //重命名
chmod -R 777 * //赋予ecshop最大权限
cd ecshop/
mv htaccess.txt .htaccess
yum -y install mysql-* install php-* php-mysql php-devel php php-mbstring php-pear
systemctl restart httpd;systemctl enable httpd
验证:浏览器上IP+/ecshop 根据页面提示输入数据库相关信息及创建管理员账号
注意:
如果ecshop需要放在workstation共享给server1的目录里或者iscsi硬盘里
只需要修改http默认访问的路径即可:
vim /etc/httpd/conf/httpd.conf
119 DocumentRoot "/data"// /data指的是放挂载共享目录或者iscsi磁盘的挂载点,也就是放ecshop的目录
131