UbuntuSetup: Difference between revisions

From DrewWiki
Jump to navigation Jump to search
(set gnome-terminal colors)
Line 2: Line 2:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
#!/bin/bash
#!/bin/bash
set -x
set -e
START=$(date +%s)


set -x
date


# passwordless sudo for my local box
# passwordless sudo for my local box
sudo sh -c 'echo "drew ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
if ! sudo grep drew /etc/sudoers; then
  sudo sh -c 'echo "drew ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
fi


# set github
# gsettings peronalizations
git config --global user.name "Drew Holt"
if [[ ! $(gsettings get org.gnome.desktop.interface clock-format) == "'12h'" ]]; then
git config --global user.email "drewderivative@gmail.com"
  # set 12 hour time
  gsettings set org.gnome.desktop.interface clock-format 12h


# set natural scrolling, GUI under 'Settings > Mouse'
  # set natural scrolling, GUI under 'Settings > Mouse'
gsettings set org.gnome.desktop.peripherals.mouse natural-scroll true
  gsettings set org.gnome.desktop.peripherals.mouse natural-scroll true
gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false
  gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false


# switch windows, not applications. GUI under 'Settings > Keyboard'
  # switch windows, not applications. GUI under 'Settings > Keyboard'
gsettings set org.gnome.desktop.wm.keybindings switch-applications "[]"
  gsettings set org.gnome.desktop.wm.keybindings switch-applications "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "[]"
  gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
  gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward  "['<Alt><Shift>Tab']"
  gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward  "['<Alt><Shift>Tab']"


# set gnome-terminal colors
  # set gnome-terminal colors
# gsettings list-recursively  "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/"
  # gsettings list-recursively  "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/"
# gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/" login-shell true
  # gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/" login-shell true
settings=("use-theme-colors false" "login-shell true" "foreground-color 'rgb(255,255,255)'" "background-transparency-percent 6" "background-color 'rgb(0,0,0)'" "use-theme-transparency false" "scrollback-unlimited true" "use-transparent-background true")
  settings=("use-theme-colors false" "login-shell true" "foreground-color \
profile=$(gsettings get org.gnome.Terminal.ProfilesList default); profile=${profile:1:-1} # remove leading and trailing single quotes
  'rgb(255,255,255)'" "background-transparency-percent 6" "background-color 'rgb(0,0,0)'" \
for i in "${settings[@]}"; do
  "use-theme-transparency false" "scrollback-unlimited true" "use-transparent-background true")
  gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/" $i
  profile=$(gsettings get org.gnome.Terminal.ProfilesList default)
done
  profile=${profile:1:-1} # remove leading and trailing single quotes
  for i in "${settings[@]}"; do
    gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/" $i
  done


# remove clutter
  # remove clutter
cd $HOME; rmdir Documents/ Music/ Public/ Templates/ Videos/; rm examples.desktop
  if [ -d Documents/ ]; then
    rmdir Documents/ Music/ Public/ Templates/ Videos/
    rm examples.desktop
  fi
fi


## disable popularity-contest
## disable popularity-contest
#sudo dpkg-reconfigure popularity-contest # disable
#sudo dpkg-reconfigure popularity-contest # disable
# docker add repo
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"


# oracle 8 add java repo
# oracle 8 add java repo
sudo add-apt-repository -y ppa:webupd8team/java
if [ ! -f /etc/apt/sources.list.d/webupd8team-ubuntu-java-artful.list ]; then
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
  sudo add-apt-repository -y ppa:webupd8team/java
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
  echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
  echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
fi


# update all repos, upgrade
# update all repos, upgrade, 3600 set to 0 when debugging
sudo apt-get update
#if ! find -H /var/lib/apt/lists -maxdepth 0 -mmin -10; then
sudo apt-get -y dist-upgrade
  sudo apt-get update
  sudo apt-get -y dist-upgrade
#fi


# install etckeeper and initialize it
# install etckeeper and initialize it
sudo apt-get install -y etckeeper
if [ ! -d /etc/.git ]; then
sudo etckeeper init
  sudo apt-get install -y etckeeper
 
  # set github here
  git config --global user.name "Drew Holt"
  git config --global user.email "[email protected]"
 
  sudo etckeeper init
fi


# install local installers already gathered
# install local installers already gathered
sudo mkdir /mnt/hdd
if [ ! -d /mnt/hdd ]; then
sudo mount /dev/vg_hdd/lv_hdd /mnt/hdd
  sudo mkdir /mnt/hdd
cd /mnt/hdd/iso_installers/ubuntu-installers
  sudo mount /dev/vg_hdd/lv_hdd /mnt/hdd
sudo apt-get install -y ./atom-amd64.deb ./google-chrome-stable_current_amd64.deb ./insync_1.4.4.37065-artful_amd64.deb ./slack-desktop-3.1.0-amd64.deb ./vagrant_2.0.3_x86_64.deb ./virtualbox-5.2_5.2.8-121009_Ubuntu_zesty_amd64.deb ./skypeforlinux-64.deb ./keybase_amd64.deb ./chefdk_2.4.17-1_amd64.deb
  cd /mnt/hdd/iso_installers/ubuntu-installers
  sudo apt-get install -y ./atom-amd64.deb ./google-chrome-stable_current_amd64.deb \
    ./insync_1.4.4.37065-artful_amd64.deb ./slack-desktop-3.1.0-amd64.deb \
    ./vagrant_2.0.3_x86_64.deb ./virtualbox-5.2_5.2.8-121009_Ubuntu_zesty_amd64.deb \
    ./skypeforlinux-64.deb ./keybase_amd64.deb ./chefdk_2.4.17-1_amd64.deb
fi


# install all the software
# install all the software
DEBIAN_FRONTEND=noninteractive `#no prompting` \
DEBIAN_FRONTEND=noninteractive `#no prompting` sudo apt-get install -y \
sudo apt-get install -y \
keepass2 synergy gnome-tweak-tool chrome-gnome-shell `#tools` \
keepass2 synergy gnome-tweak-tool chrome-gnome-shell `#tools` \
vim vim-scripts vim-runtime vim-doc curl xd `#systools` \
vim vim-scripts vim-runtime vim-doc curl xd `#systools` \
Line 73: Line 95:
openssh-server fail2ban `#daemon` \
openssh-server fail2ban `#daemon` \
openvpn network-manager-openconnect-gnome network-manager-openvpn-gnome `#network-client` \
openvpn network-manager-openconnect-gnome network-manager-openvpn-gnome `#network-client` \
rdesktop freerdp2-x11 xtightvncviewer sshpass qbittorrent wireshark nmap nikto chkrootkit wavemon namebench apache2-utils mailutils `#netutils` \
rdesktop freerdp2-x11 xtightvncviewer sshpass qbittorrent wireshark `#netutil` \
nmap nikto chkrootkit wavemon namebench apache2-utils mailutils `#netutils` \
virtualenv python2.7-examples python-pip `#python` \
virtualenv python2.7-examples python-pip `#python` \
build-essential `#build-tools` \
build-essential `#build-tools` \
sqlitebrowser yamllint highlight gawk `#dev-tools` \
shellcheck sqlitebrowser yamllint highlight gawk `#dev-tools` \
lynis pandoc apt-transport-https `#misc` \
lynis pandoc apt-transport-https `#misc` \
xchat pidgin `#chatapps` \
xchat pidgin `#chatapps` \
docker-ce `#docker` \
oracle-java8-installer `#oraclejava8` \
oracle-java8-installer `#oraclejava8` \
ansible `#automation`
ansible `#automation`
Line 85: Line 107:
# Set good vim
# Set good vim
sudo update-alternatives --set editor /usr/bin/vim.basic
sudo update-alternatives --set editor /usr/bin/vim.basic
# set env and aliases
if ! grep rdesktop $HOME/.bashrc; then
  cat <<EOF >> $HOME/.bashrc
  export PATH="$HOME/.local/bin:$PATH"
  alias xclip='xclip -selection clipboard'
  alias rdesktop='rdesktop -g 1280x720 -r clipboard:CLIPBOARD -r disk:share=/home/drew'
  alias get_ip='_get_ip() { VBoxManage guestproperty get "$1" "/VirtualBox/GuestInfo/Net/1/V4/IP";}; _get_ip'
EOF
fi


# install youtube-dl
# install youtube-dl
pip install youtube-dl
if [ ! -f $HOME/.local/bin/youtube-dl ]; then
  pip install youtube-dl
fi


# install awscli
# install awscli
pip install awscli
if [ ! -f $HOME/.local/bin/aws ]; then
 
  pip install awscli
# set env and aliases
fi
cat <<EOF >> $HOME/.bashrc
export PATH="$HOME/.local/bin:$PATH"
alias xclip='xclip -selection clipboard'
alias rdesktop='rdesktop -g 1280x720 -r clipboard:CLIPBOARD -r disk:share=/home/drew'
alias get_ip='_get_ip() { VBoxManage guestproperty get "$1" "/VirtualBox/GuestInfo/Net/1/V4/IP";}; _get_ip'
EOF
 
# docker
sudo usermod -a -G docker drew


# configure lm_sensors
# configure lm_sensors
sudo sensors-detect --auto
if ! lsmod | grep coretemp; then
  sudo sensors-detect --auto
fi


# rvm install
# rvm install
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
if [ ! -d $HOME/.rvm ]; then
\curl -sSL https://get.rvm.io | bash -s stable --ruby
  gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
  \curl -sSL https://get.rvm.io | bash -s stable --ruby
fi


# virtualbox extras pack
# virtualbox extras pack
echo y | sudo VBoxManage extpack install /mnt/hdd/iso_installers/ubuntu-installers/Oracle_VM_VirtualBox_Extension_Pack-5.2.8.vbox-extpack
if ! echo $(vboxmanage list extpacks) | grep 1; then
  $location="/mnt/hdd/iso_installers/ubuntu-installers/"
  echo y | sudo VBoxManage extpack install $location/Oracle_VM_VirtualBox_Extension_Pack-5.2.8.vbox-extpack
fi


# atom plugins
# atom plugins
apm install atom-beautify linter-flake8 linter-pep8 autocomplete-python django-templates script-runner teletype
if ! apm list | grep teletype; then
  apm install atom-beautify linter-flake8 linter-pep8 autocomplete-python django-templates script-runner teletype
fi


# vagrant plugins
# vagrant plugins
vagrant plugin install vagrant-berkshelf
if ! vagrant plugin list | grep berkshelf; then
vagrant plugin install berkshelf
  vagrant plugin install vagrant-berkshelf
  vagrant plugin install berkshelf
fi


# nvm install
# nvm install
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
if [ ! -d $HOME/.nvm ]; then
  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
fi
 
date
 
END=$(date +%s)
DIFF=$(echo "$END - $START" | bc)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 20:50, 29 March 2018

Install Main Apps

#!/bin/bash
set -x
set -e

START=$(date +%s)

date

# passwordless sudo for my local box
if ! sudo grep drew /etc/sudoers; then
  sudo sh -c 'echo "drew ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
fi

# gsettings peronalizations
if [[ ! $(gsettings get org.gnome.desktop.interface clock-format) == "'12h'" ]]; then
  # set 12 hour time
  gsettings set org.gnome.desktop.interface clock-format 12h

  # set natural scrolling, GUI under 'Settings > Mouse'
  gsettings set org.gnome.desktop.peripherals.mouse natural-scroll true
  gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false

  # switch windows, not applications. GUI under 'Settings > Keyboard'
  gsettings set org.gnome.desktop.wm.keybindings switch-applications "[]"
  gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward "[]"
  gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
  gsettings set org.gnome.desktop.wm.keybindings switch-windows-backward  "['<Alt><Shift>Tab']"

  # set gnome-terminal colors
  # gsettings list-recursively  "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/"
  # gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/" login-shell true
  settings=("use-theme-colors false" "login-shell true" "foreground-color \
  'rgb(255,255,255)'" "background-transparency-percent 6" "background-color 'rgb(0,0,0)'" \
  "use-theme-transparency false" "scrollback-unlimited true" "use-transparent-background true")
  profile=$(gsettings get org.gnome.Terminal.ProfilesList default)
  profile=${profile:1:-1} # remove leading and trailing single quotes
  for i in "${settings[@]}"; do
    gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/" $i
  done

  # remove clutter
  if [ -d Documents/ ]; then
    rmdir Documents/ Music/ Public/ Templates/ Videos/
    rm examples.desktop
  fi
fi

## disable popularity-contest
#sudo dpkg-reconfigure popularity-contest # disable

# oracle 8 add java repo
if [ ! -f /etc/apt/sources.list.d/webupd8team-ubuntu-java-artful.list ]; then
  sudo add-apt-repository -y ppa:webupd8team/java
  echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
  echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
fi

# update all repos, upgrade, 3600 set to 0 when debugging
#if ! find -H /var/lib/apt/lists -maxdepth 0 -mmin -10; then
  sudo apt-get update
  sudo apt-get -y dist-upgrade
#fi

# install etckeeper and initialize it
if [ ! -d /etc/.git ]; then
  sudo apt-get install -y etckeeper

  # set github here
  git config --global user.name "Drew Holt"
  git config --global user.email "[email protected]"

  sudo etckeeper init
fi

# install local installers already gathered
if [ ! -d /mnt/hdd ]; then
  sudo mkdir /mnt/hdd
  sudo mount /dev/vg_hdd/lv_hdd /mnt/hdd
  cd /mnt/hdd/iso_installers/ubuntu-installers
  sudo apt-get install -y ./atom-amd64.deb ./google-chrome-stable_current_amd64.deb \
    ./insync_1.4.4.37065-artful_amd64.deb ./slack-desktop-3.1.0-amd64.deb \
    ./vagrant_2.0.3_x86_64.deb ./virtualbox-5.2_5.2.8-121009_Ubuntu_zesty_amd64.deb \
    ./skypeforlinux-64.deb ./keybase_amd64.deb ./chefdk_2.4.17-1_amd64.deb
fi

# install all the software
DEBIAN_FRONTEND=noninteractive `#no prompting` sudo apt-get install -y \
keepass2 synergy gnome-tweak-tool chrome-gnome-shell `#tools` \
vim vim-scripts vim-runtime vim-doc curl xd `#systools` \
lm-sensors p7zip-full exfat-utils exfat-fuse libimage-exiftool-perl `#systools` \
ubuntu-restricted-extras gimp audacity vlc vlc-plugin-fluidsynth ffmpeg atomicparsley `#media` \
openjdk-8-jdk icedtea-8-plugin `#java` \
openssh-server fail2ban `#daemon` \
openvpn network-manager-openconnect-gnome network-manager-openvpn-gnome `#network-client` \
rdesktop freerdp2-x11 xtightvncviewer sshpass qbittorrent wireshark `#netutil` \
nmap nikto chkrootkit wavemon namebench apache2-utils mailutils `#netutils` \
virtualenv python2.7-examples python-pip `#python` \
build-essential `#build-tools` \
shellcheck sqlitebrowser yamllint highlight gawk `#dev-tools` \
lynis pandoc apt-transport-https `#misc` \
xchat pidgin `#chatapps` \
oracle-java8-installer `#oraclejava8` \
ansible `#automation`

# Set good vim
sudo update-alternatives --set editor /usr/bin/vim.basic

# set env and aliases
if ! grep rdesktop $HOME/.bashrc; then
  cat <<EOF >> $HOME/.bashrc
  export PATH="$HOME/.local/bin:$PATH"
  alias xclip='xclip -selection clipboard'
  alias rdesktop='rdesktop -g 1280x720 -r clipboard:CLIPBOARD -r disk:share=/home/drew'
  alias get_ip='_get_ip() { VBoxManage guestproperty get "$1" "/VirtualBox/GuestInfo/Net/1/V4/IP";}; _get_ip'
EOF
fi

# install youtube-dl
if [ ! -f $HOME/.local/bin/youtube-dl ]; then
  pip install youtube-dl
fi

# install awscli
if [ ! -f $HOME/.local/bin/aws ]; then
  pip install awscli
fi

# configure lm_sensors
if ! lsmod | grep coretemp; then
  sudo sensors-detect --auto
fi

# rvm install
if [ ! -d $HOME/.rvm ]; then
  gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
  \curl -sSL https://get.rvm.io | bash -s stable --ruby
fi

# virtualbox extras pack
if ! echo $(vboxmanage list extpacks) | grep 1; then
  $location="/mnt/hdd/iso_installers/ubuntu-installers/"
  echo y | sudo VBoxManage extpack install $location/Oracle_VM_VirtualBox_Extension_Pack-5.2.8.vbox-extpack
fi

# atom plugins
if ! apm list | grep teletype; then
  apm install atom-beautify linter-flake8 linter-pep8 autocomplete-python django-templates script-runner teletype
fi

# vagrant plugins
if ! vagrant plugin list | grep berkshelf; then
  vagrant plugin install vagrant-berkshelf
  vagrant plugin install berkshelf
fi

# nvm install
if [ ! -d $HOME/.nvm ]; then
  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
fi

date

END=$(date +%s)
DIFF=$(echo "$END - $START" | bc)

Local Installers and config needed

run_keybase
insync start ### do some magic here so we don't have to resync 200GB of google drive
  • Chrome [3]
  • Atom [4]
  • VirtualBox [5]
  • Vagrant [6]
  • Slack [7]
  • Skype [8]
  • Docker (in script) [9]
  • Orackle 8 (in script)
  • rvm (in script) requires /bin/bash --login or fixed shell Ubuntu RVM Instructions
  • awscli (in script) [10]
  • nvm (in script) requires /bin/bash --login or fixed shell (in script) [11]
  1. ChefDK (in script) [12]

When needed

drew@drew-8570w:~$ snap list
Name                  Version                  Rev   Developer      Notes
core                  16-2.29.4.2              3604  canonical      core
drive                 current                  22    fireeye        -
juju                  2.3.1                    3106  canonical      classic
kubectl               1.9.0                    266   canonical      classic

Configure misc

Configure SSH keys

Create new ones or replenish from vault.

Configure GPG keys

Replenish from vault.

Set gnome-screenshot default save directory

?

Set default downloads directory to Desktop

command for firefoxx, chrome, qbit, skype, slack, hangouts, etc

Gnome Tweak Tool

Install extension then use Tweak tool to configure.

Dash to Dock

  • Dash to Dock [19]
  • TopIcons-plus [20] - for Insync, Slack, Skype icons
  • OpenWeather [21]
  • Grown-up notifications [22]

Extensions installed into:

$ ~/.local/share/gnome-shell/extensions
* restart GNOME Shell (Alt+F2, r, Enter) and enable the extension through gnome-tweak-tool.

Maybe Snaps

drew@drew-8570w:~$ snap list
picard                1.4.2                    2     pachulo        -
spotify               1.0.70.399.g5ffabd56-26  5     spotify        -
sqlitebrowser-casept  3.9.1                    2     casept         -
vault                 v0.9.0                   236   snapcrafters   -
vscode                1.19.1-1513676564        22    flexiondotorg  classic