Updated: 28 September 2026 · Applies to: AlmaLinux 9 / Rocky Linux 9

CentOS/RHEL 7 are end of life; these steps are for AlmaLinux 9 / Rocky Linux 9 (Ubuntu/Debian: package targetcli-fb). The LIO target in the Linux kernel, managed with targetcli, shares a disk or file over the network as an iSCSI target.

1. Install and start

dnf install targetcli
systemctl enable --now target

2. Create the target

targetcli
/backstores/block create disk1 /dev/vdb                 # a whole disk or LVM volume
# or a file: /backstores/fileio create file1 /srv/iscsi/file1.img 20G
/iscsi create iqn.2026-09.com.example:target1
/iscsi/iqn.2026-09.com.example:target1/tpg1/luns create /backstores/block/disk1
/iscsi/iqn.2026-09.com.example:target1/tpg1/acls create iqn.2026-09.com.example:client1
saveconfig
exit

The ACL name must match the InitiatorName of the client. A portal on all addresses, port 3260, is created automatically. To require a password, set userid and password on the ACL with set auth.

3. Open the firewall

firewall-cmd --permanent --add-service=iscsi-target
firewall-cmd --reload

Check the setup with targetcli ls. The configuration is saved in /etc/target/saveconfig.json and restored at boot. Then connect a client as described in "How to configure iSCSI Initiator (client) in CentOS / RHEL 7?".

Note: Allow port 3260 only from your client servers, and use a private network where possible: iSCSI traffic is not encrypted.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket