Skip to main content

IT - iSCSI: installing target server Fedora 36 / 37 / 38 / 39

Fedora Installation and iSCSI Target Setup

1. Install Fedora from DVD DL

  • Download latest version from Fedora Server Download
  • Burn DVD DL using the Windows workstation
  • (Apple mac-mini) Plug external DVD DL reader. Mac-mini 015 has a faulty USB port.
  • Plug wired network cable
  • Load Fedora disc, boot
  • Enable root account and SSH for root
  • Add user afberendsen
  • Disk layout with fedora_fedora-root using all space available

2. Initial Setup

  • Set up hostname:
    • sudo hostnamectl set-hostname <host-name>
    • sudo reboot
    • Check prompt
  • Update ~/.bashrc:
export HISTCONTROL=ignoredups:erasedups   # no duplicate entries
export HISTSIZE=100000                    # big big history
export HISTFILESIZE=100000                # big big history
export HISTTIMEFORMAT="[%F %H:%M:%S %a] "
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
export QUOTING_STYLE=literal
shopt -s histappend
  • Update SSH: sudo vi ./ssh/sshd_config
    • Change Banner /etc/ssh/motd
    • Create /etc/ssh/motd
  • Update NetworkManager config:
[ipv4]
method=manual
address1=192.168.0.15/24,192.168.0.1
dns=1.1.1.1;1.0.0.1;8.8.8.8;8.8.4.4;
  • Update DNF config: sudo vi /etc/dnf/automatic.conf
[commands]
upgrade_type = default
random_sleep = 0
network_online_timeout = 60
download_updates = yes
apply_updates = yes
reboot = never
reboot_command = "shutdown -r +5 'Rebooting after applying package updates'"

[emitters]
emit_via = stdio

[email]
email_from = root@<this-server-ip-address>
email_to = afberendsen@gmail.com
email_host = localhost

[command]
[command_email]
email_from = root@<this-server-ip-address>
email_to = afberendsen@gmail.com

[base]
debuglevel = 1

3. Extensions

  • Install packages: targetcli wget cpufetch glances
  • systemctl enable target
  • sudo firewall-cmd --add-service=iscsi-target
  • sudo firewall-cmd --runtime-to-permanent
  • sudo shutdown -r now
  • systemctl | grep "target.service\|iscsi"

4. iSCSI Target CLI Script

#!/bin/bash

echo "===> Deleting"

for a1 in $(targetcli ls /iscsi | grep TPGs | awk '{print $2}'); do
    for a2 in $(targetcli ls "/iscsi/${a1}" | grep tpg | awk '{print $2}'); do
        for a3 in $(targetcli ls "/iscsi/${a1}/${a2}/acls/" | grep Mapped | awk '{print $2}'); do
            targetcli "/iscsi/${a1}/${a2}/acls/" delete "${a3}"
        done
        for a3 in $(targetcli ls "/iscsi/${a1}/${a2}/luns/" | grep default_tg_pt_gp | awk '{print $2}'); do
            targetcli "/iscsi/${a1}/${a2}/luns/" delete "${a3}"
        done
    done
    targetcli "/iscsi" delete "${a1}"
done

echo "===> Creating"

for a1 in $(targetcli ls /backstores/block | grep /dev | awk '{print $2}'); do
    targetcli /backstores/block/ delete ${a1}
done

sThis=iqn.1994-05.com.redhat:4aa4ea84d4aa
sClient=iqn.1994-05.com.redhat:ecdd17858d7

# Add backstores
targetcli /backstores/block create t16-A-disk0 /dev/disk/by-id/wwn-0x5000c500db7ea494
targetcli /backstores/block create t16-A-disk1 /dev/disk/by-id/wwn-0x5000c500c523375a
targetcli /backstores/block create t16-A-disk2 /dev/disk/by-id/wwn-0x5000039c08d83244
targetcli /backstores/block create t16-A-disk3 /dev/disk/by-id/wwn-0x5000039b48d84d70
targetcli /backstores/block create t16-A-disk4 /dev/disk/by-id/wwn-0x5000c500d5698091
targetcli /backstores/block create t16-B-disk0 /dev/disk/by-id/wwn-0x5000c500b5154088
targetcli /backstores/block create t16-B-disk1 /dev/disk/by-id/wwn-0x5000039968cb6ac5
targetcli /backstores/block create t16-B-disk2 /dev/disk/by-id/wwn-0x5000c500db76e926
targetcli /backstores/block create t16-B-disk3 /dev/disk/by-id/wwn-0x50000399b8cba421
targetcli /backstores/block create t16-B-disk4 /dev/disk/by-id/wwn-0x5000c500b27fe42e

# Add server node
targetcli /iscsi create ${sThis}

# Add LUNs
for disk in t16-A-disk{0..4} t16-B-disk{0..4}; do
    targetcli /iscsi/${sThis}/tpg1/luns create /backstores/block/${disk}
done

# Add client ACL
targetcli /iscsi/${sThis}/tpg1/acls create ${sClient}

# Save and verify
targetcli saveconfig
targetcli ls

Comments

Popular posts from this blog

Movie - Bastille Day | The Take (2016)

  My views Plot On the eve of  Bastille Day  in  Paris , American drifter and  pickpocket  Michael Mason steals a woman's handbag, not knowing that it contains  explosives . After taking the cash from the bag, he discards it, caught unwittingly on  CCTV  as he does so. The bag then detonates and kills four people. Upon being captured by  CIA  agent Sean Briar, who is being reprimanded for irresponsible conduct on the job, Mason protests that he is not a  terrorist  and tells Briar that the bag contained a cellphone owned by a woman named Zoé. The bomb was set up by a group of  corrupt policemen , all of them members in the  French special police RAPID unit  led by Rafi Bertrand, who intend to pull a robbery at the  Bank of France . Zoé was told to plant the bomb at the office of the  French Nationalist Party  (as part of a diversion for the heist), but after seeing the night cleaning crew arri...

Movie - The Wizard of Oz (1939)

  My views Plot In rural  Kansas ,  Dorothy Gale  lives on a farm owned by her Uncle Henry and Aunt Em, and wishes she could be somewhere else. Dorothy's neighbor, Almira Gulch, who had been bitten by Dorothy's dog, Toto, obtains a sheriff's order authorizing her to seize Toto. Toto escapes and returns to Dorothy, who runs away to protect him. Professor Marvel, a charlatan fortune-teller, convinces Dorothy that Em is heartbroken, which prompts Dorothy to return home. She returns just as a  tornado  approaches the farm. Unable to get into the locked storm cellar, Dorothy takes cover in the farmhouse and is knocked unconscious. She seemingly awakens to find the house moving through the air, with her and Toto still inside it. The house comes down in an unknown land, and Dorothy is greeted by a good witch named  Glinda , who floats down in a bubble and explains that Dorothy has landed in Munchkinland in the  Land of Oz , and that the Munchkins are cel...

Movie - The Gorge (2025)

  My views For 80 years everything was ok ... until they sent a woman For sure is DTV ... really bad Inside the gorge is clearly designed and written by a gamer Plot Two elite  snipers  receive identical missions: travel to an undisclosed location and guard the West and East sides of a deep gorge for one year without any contact with the outside world nor their counterpart on the opposite side. Levi Kane, a former  U.S. Marine  and current  private contractor  accepts the offer to guard the West tower. Drasa, a  Lithuanian  covert operative frequently employed by the  Kremlin , agrees to guard the East side. Upon arriving, Levi relieves his predecessor, J.D., a  British   Royal Marine  of duty and asks for specifics about the mission. J.D. explains that in addition to the towers on the East and West, there are automated turret defenses to the North and South, a powerful signal ‘ cloak ,’ and  explosives on the walls ...