samba-azure/install.sh

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