Centos7下通过EPEL安装scsi-target-utils,完成iscsi存储模拟

centos下未配置yum源而执行yum安装scsi-target-utils时,会存在依赖问题,本文介绍直接通过EPEL安装iscsi,完成模拟iscsi服务端的搭建

一、前置条件

1,系统网络配置支持访问外网

2,系统提供一块待共享的磁盘/dev/sdb

二、安装EPEL

1,首先检查系统是否已安装epel

 [root@localhost ~]
# rpm -q epel-release
package epel-release is not installed

2,安装EPEL

# yum install epel-release
3,检测安装完成

[root@localhost ~]# rpm -q epel-release
epel-release-6-8.noarch

三、安装配置scsi-target-utils

1, 安装

# yum --enablerepo=epel -y install scsi-target-utils
2,启动服务并添加到开机自启动

# service tgtd start
# chkconfig tgtd on
# netstat -tnlp | grep 3260

3,下面我们需要编辑配置文件/etc/tgt/targets.conf,并设置下iSCSI Qualified Name (IQN)

(待接磁盘/dev/sdb已格式化完成,格式化方式,此处不再赘述)

#vim /etc/tgt/ targets.conf

在文件末尾添加如下内容

   #iqn名字可任意

   backing-store /dev/sdb               

 initiator-address 10.10.132.0/24   #限定 允许访问的客户端地址段或具体IP

   write-cache off                     #是否开启或关闭快取

4,重启服务,使得修改的配置生效

service tgtd restart

5,确定iscsi server是否成功。如果显示如下说明配置iscsi server已经成功

# tgt-admin --show

Target 1: iqn.2017-02.com.easted:xiao
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 214748 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: rdwr
            Backing store path: /dev/sdb
            Backing store flags:
    Account information:
    ACL information:
        10.10.132.0/24

     注意:关闭服务端的IPTABLES和seLinux,以免客户端无法正常访问

至此,centos下模拟ipsan服务端已经搭建完成,对外接入信息为:

IP:10.10.132.104

IQN: iqn.2017-02.com.easted:xiao

我们可以在linux或者windows系统接入该模拟存储验证挂载,其中linux下需要安装配置iscsi-initiator-utils/windows下需要启用scsi服务器,具体接入步骤本章不做介绍


                      ---我们永远相信,分享是一种美德 | We Believe, Great People Share Knowledge---


你可能感兴趣的:(Centos7下通过EPEL安装scsi-target-utils,完成iscsi存储模拟)