Create the Store with LVMIt is recommended to create the STORE machine without the disk for the storage being mounted by the installation routines. Useful CommandsThe following commands are useful to see the current configuration of the machine, Erstellen des Stores mit LVMDie meisten Linux / CentOS Installationen von uns arbeiten mit LVM. Diese Anleitung beschreibt, wie die Rolle STORE auf ein System mittels LVM installiert werden kann. Schritt 1 - Feststellen der aktuellen config | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Display of discs |
|---|
| # Show free space on existing devices
df -h
# Partitionen anzeigenShow drives
ls /dev/sd*
# Show partitions
fdisk -l
# Show partitions
ls /dev/sd*
# IfRe-scan the disk cannot yet be seen, re-scan the SCSI bus SCSI bus
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host0host2/scan
...
# View physical volumes managed by LVM
lvm pvs
# Display logical volumes managed by LVM
lvm lvs
# Display logical volume groups managed by LVM
lvm vgs
# Where is what mounted
mount |
|
Die Informationen oben werden nun gebraucht. Die Konfiguration sollte geprüft werden, nicht das bereits ein LVM für das Storage vorgesehen ist. Schritt 2 - Anlegen einer neuen Partition Hier ist es erforderlich, dass man weiß, wo der zusätzlicher Platz zu finden ist. Es gibt 2 Varianten - entweder eine neue Platte, oder eine erweiterte Platte. In beiden Fällen, wird eine neue Partition angelegt. Hier in diesen Beispiel, wurde eine neue Platte genutzt, die auf /dev/sdb zu finden ist. Die Befehle unten sowie die Partitionsnummer (bei einer vorhandenen Platte ist die Partition dann nicht mehr zwingend 1), entsprechend anpassen. Some of the information above may be required to complete installation. It is important to know where the disk to be used is, and where the space is. Usually, we recommend adding a second disk drive to the machine for the storage. The following assumes that the disk was added as /dev/sdb on the machine, and is not yet partitioned. If this is not the case, or the drive is not /dev/sdb or the space was added to an existing partition, then the commands below will have to be (carefully) modified to take this into account. Creation StepsCreate a PartitionDisplay of discs
| Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Partitioning with
|---|
| fdisk | fdisk /dev/sdb
# --> Edit the partitions on /dev/sdasdb
n
# --> Create new partition
p
# --> New primary partition
1
# --> Create new partition 1 (view output at fdisk -1 above)
Enter
# --> Confirmation that the first available cylinder should be used
Enter
# --> Confirmation that the last available cylinder is to be used (gives the maximum size in total)
t
# --> Change partition type
8e
# --> Linux LVM
w
# --> When OK, write
reboot now |
|
Create LVM Physical VolumeThis command creates a physical volume which can be managed by LVM. The above commands will have created a partition /dev/sdb1. If you are working on a different partition, then modify accordingly.Schritt 3 - Hereinnahme in LVM - Device Erzeugen | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Create device for LVM |
|---|
| # Here is the previous edition of /dev/sd* --> this is the new record (the 1st partition on /dev/sdb, i.e. the second hard disk, newly created partition)
lvm pvcreate /dev/sdb1 |
|
Create a Volume GroupThis command creates a volume group called vg_jtelshared. The volume group can be expanded later, by adding more physical volumes. Schritt 4 - Volume Group anlegen | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Create LVM |
|---|
| lvm vgcreate "vg_jtelshared" /dev/sdb1 |
|
Create a Logical VolumeFinally, a logical volume lv_jtelshared is created on the volume group which contains the aggregated space.Schritt 5 - Logical Volume anlegen | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash |
|---|
| title | Create LVM |
|---|
| lvm lvcreate -l +100%FREE vg_jtelshared -n lv_jtelshared |
|
Create File SystemNow, the file system is created. Here we use xfs, though you can use something else if you really want.Schritt 6 - File System erzeugen | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Create file system |
|---|
| mkfs.xfs -L data /dev/vg_jtelshared/lv_jtelshared |
|
Prepare Mount PointThe data should be mounted to the directory /srv/jtel/shared. The following commands prepare for this:Schritt 7 - Mount Point vorbereiten | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Prepare mount point |
|---|
| mkdir /srv/jtel
mkdir /srv/jtel/shared
chown -R jtel:jtel /srv/jtel/shared |
|
Schritt 8 - Mount Point in fstab festlegen und mounten Add to fstab to Mount at BootThe following adds a line to fstab to mount the file system at bootfstab Eintrag: | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash |
|---|
| title | vi /etc/fstab |
|---|
| vicat <<EOFF >> /etc/fstab
...
(add the following line)
/dev/mapper/vg_jtelshared-lv_jtelshared /srv/jtel/shared xfs defaults 0 0 |
| Und mounten:Mount the File System| Translations Ignore |
|---|
| Code Block |
|---|
| mount /srv/jtel/shared |
| Schritt 9 - Zwischenergebnis prüfenChecks| Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Check final result |
|---|
| df -h |
| Es sollte ein Eintrag für This should show an entry for /srv/jtel/shared existieren mit entsprechend freier Platz. with the expected amount of free space. Install SambaThese commands install the samba server and client and lsof. | Translations Ignore |
|---|
| Code Block |
|---|
| yumdnf -y install samba samba-client lsof |
|
The following creates a samba configuration file with a minimum configuration. | Translations Ignore |
|---|
| Code Block |
|---|
| # SMB Conf
cat <<EOFF > /etc/samba/smb.conf
[global]
workgroup = SAMBAJTEL
security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
min protocol = NT1SMB3
reset on zero vc ntlm auth = yes
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
[printers]
comment = All Printers
path = /var/tmp
printable = Yes
create mask = 0600
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = root
create mask = 0664
directory mask = 0775
[shared]
comment = jtel ACD Shared Directory
read onlypublic = no
read publiconly = yesno
writable = yes
locking = yes
path = /srv/jtel/shared
guest ok = yes
create mask = 0644
directory mask = 0755
force user = jtel
force group = jtel
acl allow execute always = True
EOFF
sed -i -e "s/MYGROUP/WORKGROUP/g" /etc/samba/smb.conf |
|
Setup SeLinux , jtel User access and the Firewall for SambaThe following command sets up selinux for the smb service and opens the necessary ports in the firewallReplace <password> with the password for the jtel user:
| Translations Ignore |
|---|
| Code Block |
|---|
title | SeLinux, jtel User, Firewall |
|---|
setsebool -P samba_enable_home_dirs=on samba_export_all_rw=on use_samba_home_dirs=on use_nfs_home_dirs=on
printf '<password>\n<password>\n' | smbpasswd -a -s jtel
firewall-cmd --zone=public --add-port=445/tcp --add-port=139/tcp --add-port=138/udp --add-port=137/udp --permanent
firewall-cmd --reload |
|
If necessary, add further users to samba - replacing password with the actual password for the user. Here, for example, the windows administrator user: | Translations Ignore |
|---|
Enable and Start SambaThe following commands setup the SMB and NMB services to autostart, and start them. | Code Block |
|---|
| useradd -m Administrator
printf '<password>\n<password>\n' | smbpasswd -a -s Administrator
|
Test SAMBA| Translations Ignore |
|---|
| Code Block |
|---|
| systemctl enable nmb
systemctl enable smb
systemctl start nmb
systemctl start smb |
|
Manually link /home/jtel/shared| Translations Ignore |
|---|
| Code Block |
|---|
|