kiriyamaX commited on
Commit
5af3c27
1 Parent(s): dfb675d

Create aws_first_launch_setup.sh

Browse files
Files changed (1) hide show
  1. aws_first_launch_setup.sh +31 -0
aws_first_launch_setup.sh ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Format nvme1n1
4
+ sudo mkfs -t xfs /dev/nvme1n1
5
+
6
+ # Create and mount /data directory
7
+ sudo mkdir -p /data
8
+ sudo mount /dev/nvme1n1 /data
9
+
10
+ # Set appropriate permissions for /data (consider more restrictive permissions)
11
+ sudo chmod 777 /data
12
+
13
+ # Fetch UUID of nvme1n1 and make the /data mount permanent
14
+ UUID=$(sudo blkid -s UUID -o value /dev/nvme1n1)
15
+ echo "UUID=$UUID /data xfs defaults 0 2" | sudo tee -a /etc/fstab
16
+
17
+ # Link webui directory to nvme
18
+ mkdir -p ~/webui
19
+ mkdir -p /data/webui
20
+ ln -s /data/webui/ ~/webui/
21
+
22
+ # Setup swap
23
+ sudo swapoff -a # Turn off all swap spaces
24
+ sudo mkdir -p /data/.swap/
25
+ if [ ! -f "/data/.swap/swapfile" ]; then
26
+ sudo dd if=/dev/zero of=/data/.swap/swapfile bs=1G count=16
27
+ sudo chmod 600 /data/.swap/swapfile
28
+ sudo mkswap /data/.swap/swapfile
29
+ sudo swapon /data/.swap/swapfile
30
+ fi
31
+ sudo swapon --show