【rebhat笔记6】iSCSI搭建及HTTP服务搭建指南

一、iSCSI存储搭建

存储架构概述

  • DAS(直连式存储)
  • NAS(网络附加存储)
  • SAN(存储区域网络)
    • IP SAN:使用iSCSI协议
    • FC SAN:使用光纤网络

iSCSI服务端配置

  1. 创建分区:使用fdiskparted命令。
  2. 安装iSCSI服务:yum install targetcli -y
  3. 启动并设置iSCSI服务自动启动:systemctl start target 与 systemctl enable target
  4. 配置防火墙允许TCP端口3260:firewall-cmd --permanent --add-port=3260/tcp
  5. 使用targetcli配置iSCSI存储:
    • 创建后备存储:/backstores/block create server0 /dev/sdb1
    • 创建iSCSI目标:/iscsi create iqn号
    • 关联LUN和iSCSI目标:/iscsi/iqn号/tpg1/luns create /backstores/block/server0
    • 创建端口:/iscsi/iqn号/tpg1/portals create 192.168.10.1 3260
    • 设置访问控制列表:/iscsi/iqn号/tpg1/acls create +客户端的iqn号
    • 保存配置并退出:saveconfig 与 exit

iSCSI客户端配置

  1. 安装iSCSI客户端工具:yum install iscsi-initiator-utils -y
  2. 配置iSCSI初始化器名称:/etc/iscsi/initiatorname.iscsi
  3. 重启iSCSI服务:systemctl restart iscsi
  4. 使用iscsiadm发现并登录iSCSI目标:
    • 发现目标:iscsiadm --mode discoverydb --type sendtargets --portal 192.168.16.147 --discover
    • 登录设备:iscsiadm --mode node --targetname iqn.1994-05.com.redhat:99fff0992692 --portal 192.168.16.147:3260 --login

iSCSI设备使用

  • 将iSCSI设备分区并格式化:例如/dev/sdb1格式化为ext4
  • 挂载设备:mount /dev/sdb1 /mnt/iscsi
  • 自动挂载:编辑/etc/fstab添加相应条目

二、HTTP服务搭建

HTTP服务端配置

  1. 安装HTTP服务:yum install httpd httpd-manual -y
  2. 启动并设置HTTP服务自动启动:systemctl start httpd 与 systemctl enable httpd
  3. 配置防火墙允许HTTP服务:firewall-cmd --permanent --add-service=http
  4. 编辑HTTP配置文件:/etc/httpd/conf/httpd.conf
  5. 设置网站根目录:/var/www/html/
  6. 创建并编辑网页文件:vim /var/www/html/index.html
  7. 重启HTTP服务以应用更改:systemctl restart httpd

虚拟主机配置

  1. 创建虚拟目录:mkdir /var/www/virtual
  2. 编辑虚拟主机配置文件:/etc/httpd/conf.d/vhost.conf
  3. 配置虚拟主机:
    <VirtualHost *:80> 
    ServerName server.example.com 
    DocumentRoot /var/www/html 
    </VirtualHost> 
    <VirtualHost *:80> 
    ServerName desktop.example.com 
    DocumentRoot /var/www/virtual 
    </VirtualHost>
  4. 重启HTTP服务以应用更改:systemctl restart httpd

客户端配置

  • 配置本地DNS解析或/etc/hosts文件:
     
    192.168.16.147 server.example.com 
    192.168.16.147 desktop.example.com

  • 在Windows客户端,编辑C:\Windows\System32\drivers\etc\hosts文件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值