Centos7下通過EPEL安裝scsi-target-utils,完成iscsi儲存模擬
centos下未配置yum源而執行yum安裝scsi-target-utils時,會存在依賴問題,本文介紹直接通過EPEL安裝iscsi,完成模擬iscsi服務端的搭建
一、前置條件
1,系統網路配置支援訪問外網
2,系統提供一塊待共享的磁碟/dev/sdb
二、安裝EPEL
1,首先檢查系統是否已安裝epel
[[email protected] ~]
# rpm -q epel-release
package epel-release is not installed2,安裝EPEL
# yum install epel-release
3,檢測安裝完成[[email protected]
~]# 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 32603,下面我們需要編輯配置檔案/etc/tgt/targets.conf,並設定下iSCSI Qualified Name (IQN)
(待接磁碟/dev/sdb已格式化完成,格式化方式,此處不再贅述)
#vim /etc/tgt/ targets.conf
在檔案末尾新增如下內容
<target iqn.2017-02.com.easted:xiao> #iqn名字可任意
backing-store /dev/sdb
initiator-address 10.10.132.0/24 #限定 允許訪問的客戶端地址段或具體IP
write-cache off #是否開啟或關閉快取
</target>
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---