Installing targetcli on CentOS 6.8

  • Aug. 7, 2016
  • Category: Linux

Installing the kernel-ml-4.5.4 on CentOS 6.8

yum install wget

mkdir /root/elrepo
cd /root/elrepo
wget http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
yum install *

yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel 

nano /etc/grub.conf
default=0

reboot

Installing targetcli

yum install gcc gcc-c++ make automake autoconf ncurses-devel lsscsi git 

Deps:

  • for configshell: python-devel epydoc pyparsing python-urwid
  • for rtslib: python-configobj python-netifaces python-ipaddr
  • for targetcli: python-prettytable
yum install rpm-build python-devel epydoc pyparsing python-urwid python-configobj python-netifaces python-ipaddr python-prettytable
[root@srv1 ~]# mkdir building-targetcli
[root@srv1 ~]# cd building-targetcli/
[root@srv1 building-targetcli]# git config --global http.sslverify false
[root@srv1 building-targetcli]# git clone https://github.com/Datera/configshell.git
[root@srv1 building-targetcli]cd configshell/dist
[root@srv1 dist]# ls
configshell-1.6.1~g020d540.tar.gz  python-configshell-1.6.1~g020d540-1.el6.noarch.rpm  python-configshell-1.6.1~g020d540-1.el6.src.rpm
[root@srv1 dist]# yum install python-configshell-1.6.1~g020d540-1.el6.noarch.rpm
[root@srv1 dist]# cd ../../ 
[root@srv1 building-targetcli]# ls
configshell
[root@srv1 building-targetcli]# 
[root@srv1 building-targetcli]# git clone https://github.com/Datera/rtslib.git
[root@srv1 building-targetcli]# ls
[root@srv1 building-targetcli]# configshell rtslib
[root@srv1 building-targetcli]# cd rtslib
[root@srv1 building-targetcli]# make rpm
[root@srv1 rtslib]# cd dist
[root@srv1 dist]# ls
python-rtslib-3.0.pre4.9~g6fd0bbf-1.el6.noarch.rpm  rtslib-3.0.pre4.9~g6fd0bbf.tar.gz
python-rtslib-3.0.pre4.9~g6fd0bbf-1.el6.src.rpm
[root@srv1 dist]# yum install python-rtslib-3.0.pre4.9~g6fd0bbf-1.el6.noarch.rpm
[root@srv1 dist]# cd ../../
[root@srv1 building-targetcli]# 
[root@srv1 building-targetcli]# ls
[root@srv1 building-targetcli]# configshell rtslib
[root@srv1 building-targetcli]# git clone https://github.com/Datera/targetcli.git
[root@srv1 building-targetcli]# ls
[root@srv1 building-targetcli]# configshell rtslib targetcli
[root@srv1 building-targetcli]# cd targetcli/
[root@srv1 targetcli]# ls
[root@srv1 targetcli]# COPYING  debian  doc  Makefile  README.md  rpm  scripts  setup.py  targetcli
[root@srv1 targetcli]# make rpm
[root@srv1 targetcli]# cd dist
[root@srv1 dist]# ls
targetcli-3.0.pre4.5~ga125182-1.el6.noarch.rpm  targetcli-3.0.pre4.5~ga125182.tar.gz
targetcli-3.0.pre4.5~ga125182-1.el6.src.rpm
[root@srv1 dist]# yum install targetcli-3.0.pre4.5~ga125182-1.el6.noarch.rpm
[root@srv1 ~]# /etc/init.d/target start
The Linux SCSI Target is already stopped                   [  OK  ]
The Linux SCSI Target looks properly installed             [PASSED]
The configfs filesystem is already mounted                 [PASSED]
Loaded core module target_core_mod                         [PASSED]
Loaded core module target_core_pscsi                       [PASSED]
Loaded core module target_core_iblock                      [PASSED]
Loaded core module target_core_file                        [PASSED]
Loaded fabric module iscsi_target_mod                      [PASSED]
Loaded fabric module tcm_fc                                [PASSED]
Loaded fabric module vhost_scsi                            [PASSED]
Failed to load fabric module tcm_usb_gadget                [WARNING]
Loaded fabric module ib_srpt                               [PASSED]
Loaded fabric module tcm_loop                              [PASSED]
Loaded fabric module tcm_qla2xxx                           [PASSED]
Loading config from /etc/target/scsi_target.lio, this may t[PASSED]ral minutes for FC adapters
Loaded /etc/target/scsi_target.lio                         [PASSED]
Started The Linux SCSI Target                              [  OK  ]

/etc/rc.d/rc.local

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/etc/init.d/target start

Reboot

Verifying targetcli

[root@srv1 ~]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli 3.0.pre4.5~ga125182 (rtslib 3.0.pre4.9~g6fd0bbf)
Copyright (c) 2011-2014 by Datera, Inc.
All rights reserved.

/> ls
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- fileio ................................................................................................... [0 Storage Object]
  | o- iblock ................................................................................................... [0 Storage Object]
  | o- pscsi .................................................................................................... [0 Storage Object]
  | o- rd_mcp ................................................................................................... [0 Storage Object]
  o- iscsi ............................................................................................................. [0 Targets]
  o- loopback .......................................................................................................... [0 Targets]
  o- vhost ............................................................................................................. [0 Targets]
/> saveconfig
Save configuration? [Y/n]: 
Saving new startup configuration
/> exit
Comparing startup and running configs...
Startup config is up-to-date.