samba-azure/install.sh

raw link view readme
1 STORAGE_KEY=$2
2
3 #+ just because having a firewall is common sense
4 yum install firewalld -y
5 systemctl start firewalld
6 systemctl enable firewalld
7 firewall-cmd --reload
8
9 yum install samba-client -y
10
11 cat > /mnt/.smbcredentials << EOF
12 username=$STORAGE_NAME
13 password=$STORAGE_KEY
14 EOF
15 chmod 600 /mnt/.smbcredentials
16
17 mkdir /mnt/azure-elephant
18 mkdir /mnt/azure-chicken
19
20 cat >> /root/update_fstab << EOF
21 cat >> /etc/fstab << INNER_EOF
22 //$STORAGE_NAME.file.core.windows.net/elephant /mnt/azure-elephant cifs vers=3.0,credentials=/mnt/.smbcredentials,dir_mode=0600,file_mode=0600
23 //$STORAGE_NAME.file.core.windows.net/chicken /mnt/azure-chicken cifs vers=3.0,credentials=/mnt/.smbcredentials,dir_mode=0600,file_mode=0600
24 INNER_EOF
25 EOF
26 chmod +x /root/update_fstab
27
28 cat > /root/create_share.sh << EOF
29 azure storage share create --account-name '$STORAGE_NAME' --account-key '$STORAGE_KEY' --share elephant
30 azure storage share create --account-name '$STORAGE_NAME' --account-key '$STORAGE_KEY' --share chicken
31 EOF
32 chmod 0700 /root/create_share.sh
33
34 yum install epel-release -y
35 yum install npm -y
36 npm install -g azure-cli
37