Skip to content

Instantly share code, notes, and snippets.

@fbakhda
Created November 21, 2024 09:19
Show Gist options
  • Save fbakhda/fa7c99388d8d084af6863e81b857297a to your computer and use it in GitHub Desktop.
Save fbakhda/fa7c99388d8d084af6863e81b857297a to your computer and use it in GitHub Desktop.
Setting up Basic Ubuntu System (within Intel)
#!/bin/bash
SUDO=''
if (( $EUID != 0 )); then
echo 'I will try without root access to perform'
echo 'but i cant guarantee it works'
echo 'Else use root account'
echo 'Continue [Enter] , Cancel [Ctrl+C]'
read
SUDO='sudo'
fi
$SUDO cat >> /etc/environment << EOF
http_proxy=http://proxy-dmz.intel.com:912
https_proxy=http://proxy-dmz.intel.com:912
no_proxy="127.0.0.1,.intel.com,intel.com,10.0.0.0/8"
EOF
. /etc/environment
nistTime=$($SUDO curl -I --insecure 'https://nist.time.gov/' | grep "Date")
dateString=$(echo $nistTime | cut -d' ' -f2-7)
dayString=$(echo $nistTime | cut -d' ' -f2-2)
dateValue=$(echo $nistTime | cut -d' ' -f3-3)
monthValue=$(echo $nistTime | cut -d' ' -f4-4)
yearValue=$(echo $nistTime | cut -d' ' -f5-5)
timeValue=$(echo $nistTime | cut -d' ' -f6-6)
timeZoneValue=$(echo $nistTime | cut -d' ' -f7-7)
case $monthValue in
"Jan")
monthValue="01"
;;
"Feb")
monthValue="02"
;;
"Mar")
monthValue="03"
;;
"Apr")
monthValue="04"
;;
"May")
monthValue="05"
;;
"Jun")
monthValue="06"
;;
"Jul")
monthValue="07"
;;
"Aug")
monthValue="08"
;;
"Sep")
monthValue="09"
;;
"Oct")
monthValue="10"
;;
"Nov")
monthValue="11"
;;
"Dec")
monthValue="12"
;;
*)
continue
esac
echo "Date:""$monthValue/$dateValue/$yearValue $timeValue"
$SUDO date -s "$monthValue/$dateValue/$yearValue $timeValue"
$SUDO hwclock --systohc
$SUDO ln -sf /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime
$SUDO date
$SUDO apt update
$SUDO apt install net-tools openssh-server git neovim curl wget build-essential software-properties-common -y
$SUDO echo "NTP=10.128.37.1" >> /etc/systemd/timesyncd.conf
$SUDO echo "FallbackNTP=10.128.37.1" >> /etc/systemd/timesyncd.conf
$SUDO timedatectl set-ntp true
$SUDO timedatectl set-timezone Asia/Kuala_Lumpur
$SUDO systemctl restart systemd-timesyncd
echo 'Basic Installation Setup Done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment