Install the MySQL Client(This will be needed later). Warning |
---|
If you are installing STORE on a machine which will contain the role DATA too, then do not install the default mysql client, as this will collide with MySQL. Instead, install the MySQL software first (see role DATA). |
Code Block |
---|
apt-get -y install default-mysql-client lvm2 |
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, Translations Ignore |
---|
Code Block |
---|
| # Show free space on existing devices
df -h
# Show drives
ls /dev/sd*
# Show partitions
fdisk -l
# Show partitions
ls /dev/sd*
# Re-scan the SCSI bus
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/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 |
|
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 Partition Info |
---|
Partitioning is only required if there are multiple disks. If the machine has only one disk, then no partition must be created for the samba share. You can continue below at "Prepare Mount Point" in this case. |
Translations Ignore |
---|
Code Block |
---|
| fdisk /dev/sdb
# --> Edit the partitions on /dev/sdb
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 |
|
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. Translations Ignore |
---|
Code Block |
---|
| 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. Translations Ignore |
---|
Code Block |
---|
| 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. Translations Ignore |
---|
Code Block |
---|
| lvm lvcreate -l +100%FREE vg_jtelshared -n lv_jtelshared |
|
Create File SystemNow, the file system is created. Here we use ext4, though you can use something else if you really want. Translations Ignore |
---|
Code Block |
---|
| mkfs.ext4 /dev/vg_jtelshared/lv_jtelshared |
|
Prepare Mount PointThe data should be mounted to the directory /srv/jtel/shared. The following commands prepare for this: Translations Ignore |
---|
Code Block |
---|
| mkdir /srv/jtel
mkdir /srv/jtel/shared
chown -R jtel:jtel /srv/jtel |
|
Add to fstab to Mount at BootThe following adds a line to fstab to mount the file system at boot: Translations Ignore |
---|
Code Block |
---|
| cat <<EOFF >> /etc/fstab
/dev/mapper/vg_jtelshared-lv_jtelshared /srv/jtel/shared ext4 defaults 0 0
EOFF |
|
Mount the File SystemThis also makes sure the ownership is correct: Translations Ignore |
---|
Code Block |
---|
| mount /srv/jtel/shared
chown -R jtel:jtel /srv/jtel |
|
ChecksThis should show an entry for /srv/jtel/shared with the expected amount of free space. Install SambaThese commands install the samba server and client and lsof. Note: if a popup selection screen comes asking whether you want the smb.conf modified, then just hit enter. Translations Ignore |
---|
Code Block |
---|
apt-get -y install samba smbclient 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 = JTEL
security = user
passdb backend = tdbsam
min protocol = SMB2
reset on zero vc = yes
ntlm auth = yes
[shared]
comment = jtel ACD Shared Directory
public = no
read only = no
writable = yes
locking = yes
path = /srv/jtel/shared
create mask = 0644
directory mask = 0755
force user = jtel
force group = jtel
acl allow execute always = True
EOFF |
|
Setup the FirewallAllow the ports required for SMB to work correctly: Code Block |
---|
ufw allow 445/tcp |
Allow the ports required for SMB to work correctly on a specific ethernet interface: Code Block |
---|
ufw allow in on eth1 to any port 445 proto tcp |
Enable and Start SambaThe following commands setup the SMB and NMB services to autostart, and start them. Translations Ignore |
---|
Code Block |
---|
systemctl enable nmbd
systemctl enable smbd
systemctl start nmbd
systemctl start smbd |
|
Manually link /home/jtel/sharedFinally, link the /home/jtel/shared folder. Translations Ignore |
---|
Code Block |
---|
ln -s /srv/jtel/shared /home/jtel/shared |
|
Setup Access to the Samba Serverjtel User AccessThe following command creates the smb credentials for the jtel user. Info |
---|
There is no need to create smb credentials for the jtel user on systems with only one linux machine, as there would be no other machines with a jtel user to connect to the share. |
Status |
---|
colour | Red |
---|
title | Caution Password |
---|
|
Translations Ignore |
---|
Code Block |
---|
printf '<password>\n<password>\n' | smbpasswd -a -s jtel
|
|
Further User AccessIf necessary, add further users to samba - replacing password with the actual password for the user. Here, for example, the windows administrator user: Status |
---|
colour | Red |
---|
title | Caution Password |
---|
|
Translations Ignore |
---|
Code Block |
---|
useradd -m Administrator
printf '<password>\n<password>\n' | smbpasswd -a -s Administrator
|
|
Test the file mountFinally, test the file mount from one of the other machines. Either by connecting to STORE, or by using the windows explorer to attach to \\acd-store\shared
|