Skip to content

Instantly share code, notes, and snippets.

@DaniGuardiola
Last active March 13, 2023 18:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaniGuardiola/18964f02506636577e858cdf0b8de3a4 to your computer and use it in GitHub Desktop.
Save DaniGuardiola/18964f02506636577e858cdf0b8de3a4 to your computer and use it in GitHub Desktop.
# ubuntu.daniguardiola.me - start
# fix for yarn global path
export PATH="$(yarn global bin):$PATH"
# fix ~/.local/bin path
export PATH="$HOME/.local/bin:$PATH"
# put android sdk tools on path
export ANDROID_SDK=$HOME/Android/Sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH
# set vim as default editor
export VISUAL=vim
export EDITOR="$VISUAL"
# start z.sh
. "$HOME/apps/z.sh"
# ubuntu.daniguardiola.me - end
file:///tmp
file:///home/dani/projects
file:///home/dani/downloads
{
"bootstrapped": true,
"installed_packages": [
"A File Icon",
"Material Theme",
"DocBlockr",
"Material Theme - Appbar",
"Material Theme - White Panels",
"Package Control",
"SideBarEnhancements",
"StandardFormat",
"SublimeLinter",
"SublimeLinter-contrib-standard",
"Babel"
]
}
{
"ignored_packages": [
"JavaScript" ],
"theme": "Material-Theme.sublime-theme",
"tab_size": 2,
"translate_tabs_to_spaces": true,
"detect_indentation": false
}
# IMPORTANT!! This is outdated. Check:
# https://github.com/DaniGuardiola/ubuntu-setup
# This is a script that configures a machine with a fresh installation of Ubuntu.
# It installs packages and configures it functionally and aesthetically. I am a developer,
# currently working on Javascript and React Native projects, so you will find sublime text 3
# (with an awesome theme and a buch of very useful plugins), Android Studio, npm, yarn, etc...
# It also removes some of the crap that Ubuntu comes with like the Amazon stuff.
# In general, if you're a developer and appreciate clean designs, this should be a good start
# even if some of the opinionated decisions I've made are not fit for your use case. Also
# keep in mind that I'm gonna keep updating this as my needs evolve, but everything is documented.
# Enjoy!
# Tested in a fresh installation of Ubuntu 17.10
# Download and execute:
# $(wget -qO - ubuntu.daniguardiola.me | bash)
# NOTE: to avoid graphics driver problems with nvidia cards:
# - Disable secureboot
# - Add this to the GRUB entry, at the end of the "linux" line: nouveau.modeset=0
# - Optionally, purge nvidia drivers and install latest version from repo: https://askubuntu.com/a/712078
if [ $# -eq 0 ]
then
TMPFILE=$(mktemp)
wget -q --no-cache -O $TMPFILE ubuntu.daniguardiola.me
chmod +x $TMPFILE
echo "source $TMPFILE 1"
exit
fi
# set URL prefix variable
URL='https://gist.githubusercontent.com/DaniGuardiola/18964f02506636577e858cdf0b8de3a4/raw/'
# change working dir to tmp dir
cd /tmp
mkdir ubuntu-setup
cd ubuntu-setup
# upgrade everything
sudo apt update && sudo apt upgrade -y
# install gdebi (installs deb files and its dependencies)
sudo apt install gdebi-core -y
# install latest chrome stable
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O google-chrome.deb
sudo gdebi -n google-chrome.deb
# install paper theme
sudo add-apt-repository ppa:snwh/pulp -y
sudo apt update
sudo apt install paper-icon-theme paper-cursor-theme -y
wget "https://snwh.org/paper/download.php?owner=snwh&ppa=pulp&pkg=paper-gtk-theme,16.10" -O paper-gtk-theme.deb
sudo gdebi -n paper-gtk-theme.deb
# set paper theme
gsettings set org.gnome.desktop.interface gtk-theme "Paper"
gsettings set org.gnome.desktop.interface icon-theme "Paper"
gsettings set org.gnome.desktop.interface cursor-theme "Paper"
# disable desktop icons
gsettings set org.gnome.desktop.background show-desktop-icons false
# install gnome extensions
# install Gnome shell extension manager
sudo wget -O /usr/local/sbin/gnomeshell-extension-manage https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/ubuntugnome/gnomeshell-extension-manage
sudo chmod +x /usr/local/sbin/gnomeshell-extension-manage
# download z.sh and add to .bashrc
sudo wget -O "$HOME/apps/z.sh" https://raw.githubusercontent.com/rupa/z/master/z.sh
sudo chmod +x "$HOME/apps/z.sh"
# install and configure Gnome shell extensions
# hidetopbar
gnomeshell-extension-manage --install --system --version latest --extension-id 545
HIDETOPBAR_SCHEMA_DIR="/usr/local/share/gnome-shell/extensions/hidetopbar@mathieu.bidon.ca/schemas/"
gsettings --schemadir ${HIDETOPBAR_SCHEMA_DIR} set org.gnome.shell.extensions.hidetopbar mouse-sensitive true
# places menu
gnomeshell-extension-manage --install --system --version latest --extension-id 8
# removable drive menu
gnomeshell-extension-manage --install --system --version latest --extension-id 7
# application menu
gsettings set org.gnome.shell enable-hot-corners true # enable hot corners to make it work
gnomeshell-extension-manage --install --system --version latest --extension-id 6
# Sound Input & Output Device Chooser
gnomeshell-extension-manage --install --system --version latest --extension-id 906
# screenshot tool
gnomeshell-extension-manage --install --system --version latest --extension-id 1112
# clipboard indicator
gnomeshell-extension-manage --install --system --version latest --extension-id 779
CLIPBOARDINDICATOR_SCHEMA_DIR="/usr/local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com/schemas/"
gsettings --schemadir ${CLIPBOARDINDICATOR_SCHEMA_DIR} set org.gnome.shell.extensions.clipboard-indicator notify-on-copy false
# show battery percentage
gnomeshell-extension-manage --install --system --version latest --extension-id 818
# autohide battery
gnomeshell-extension-manage --install --system --version latest --extension-id 595
# Top Panel Workspace Scroll
gnomeshell-extension-manage --install --system --version latest --extension-id 701
# middle click to close in overview
gnomeshell-extension-manage --install --system --version latest --extension-id 352
# make terminal look cool
TERMINAL_PROFILE_ID=$(gsettings get org.gnome.Terminal.ProfilesList default)
TERMINAL_PROFILE_SCHEMA="org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/$TERMINAL_PROFILE_ID/"
gsettings set $TERMINAL_PROFILE_SCHEMA use-theme-colors false
gsettings set $TERMINAL_PROFILE_SCHEMA background-color '#000000'
gsettings set $TERMINAL_PROFILE_SCHEMA foreground-color '#FFFFFF'
gsettings set $TERMINAL_PROFILE_SCHEMA use-transparent-background true
gsettings set $TERMINAL_PROFILE_SCHEMA background-transparency-percent 20
# TODO: doesn't work???
# install gnome-tweaks
# sudo apt install gnome-tweak-tool
# remove amazon bullshit
sudo apt purge ubuntu-web-launchers -y
# install and setup sublime text 3
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update
sudo apt install sublime-text -y
wget -O - "${URL}Preferences.sublime-settings" -O 'Preferences.sublime-settings'
mkdir -p "$HOME/.config/sublime-text-3/Packages/User/"
mv 'Preferences.sublime-settings' "$HOME/.config/sublime-text-3/Packages/User/Preferences.sublime-settings"
# install package control
wget https://packagecontrol.io/Package%20Control.sublime-package -O 'Package Control.sublime-package'
mkdir -p "$HOME/.config/sublime-text-3/Installed Packages/"
mv 'Package Control.sublime-package' "$HOME/.config/sublime-text-3/Installed Packages"
# install sublime packages (they will actually install on startup)
wget -O - "${URL}Package Control.sublime-settings" -O 'Package Control.sublime-settings'
mv 'Package Control.sublime-settings' "$HOME/.config/sublime-text-3/Packages/User/Package Control.sublime-settings"
# install pencil (prototyping app)
wget https://pencil.evolus.vn/dl/V3.0.4/Pencil_3.0.4_amd64.deb -O pencil.deb
sudo gdebi -n pencil.deb
# configure dock
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed false # autohide
DOCK_APPS="['google-chrome.desktop', 'sublime_text.desktop', 'pencil.desktop', 'android-studio.desktop']"
gsettings set org.gnome.shell favorite-apps "$DOCK_APPS" # set apps
# install a few utilities and programs:
# - curl
# - git
# - vim
# - meld (diff tool)
sudo apt install curl git vim meld -y
# install nvm and node 8
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 8
nvm use 8
nvm alias default 8
# install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn -y
# install global yarn packages
yarn global add create-react-native-app react-native-cli npm-check-updates
# download and extract android sdk cli tools
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O sdk-tools.zip
mkdir -p "$HOME/.android/sdk"
unzip -o sdk-tools.zip -d "$HOME/.android/sdk"
# Install latest SDK - TODO...
# "$HOME/Android/Sdk/tools/bin/sdkmanager"
# install umake and android studio
sudo add-apt-repository ppa:lyzardking/ubuntu-make -y
sudo apt update
sudo apt install ubuntu-make -y
yes "$HOME/.local/bin/android-studio" | umake android --accept-license
# install wireshark
sudo add-apt-repository ppa:wireshark-dev/stable -y
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt install wireshark -y
# install etcher (flashdrive ISO flashing tool)
echo "deb https://dl.bintray.com/resin-io/debian stable etcher" | sudo tee /etc/apt/sources.list.d/etcher.list
sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 379CE192D401AB61
sudo apt update
sudo apt install etcher-electron -y
# create projects and apps dirs
mkdir ~/projects ~/apps
# remove default home dirs and rename Downloads to lowercase downloads
rm -rf ~/Desktop ~/Documents ~/Music ~/Pictures ~/Public ~/Templates ~/Videos ~/examples.desktop && mv ~/Downloads ~/downloads
wget -O - "${URL}user-dirs.dirs" -O 'user-dirs.dirs'
mv 'user-dirs.dirs' "$HOME/.config/user-dirs.dirs"
xdg-user-dirs-update
# set nautilus shortcuts
wget -O - "${URL}bookmarks" -O 'bookmarks'
mv 'bookmarks' "$HOME/.config/gtk-3.0/bookmarks"
# install MEGAsync and the nautilus extension
wget https://mega.nz/linux/MEGAsync/xUbuntu_17.10/amd64/megasync-xUbuntu_17.10_amd64.deb -O megasync.deb
sudo gdebi -n megasync.deb
wget https://mega.nz/linux/MEGAsync/xUbuntu_17.10/amd64/nautilus-megasync-xUbuntu_17.10_amd64.deb -O megasync-nautilus.deb
sudo gdebi -n megasync-nautilus.deb
# add lines to .bashrc
wget -O - "${URL}.bashrc" >> "$HOME/.bashrc"
# remove tmp dir and go back to home
cd ..
rm -rf ubuntu-setup
cd
# clean up a bit
sudo apt autoremove -y
# execute semi-manual steps in order
printf '\n\n\nAlmost done!'
printf '\nNow some actions are required, please follow these steps to complete the setup.\n'
read -p '>> Press enter when ready to start'
# sublime text
printf '\n> configuring sublime text\n'
printf '\nSublime text will open and install some plugins. Make sure you have an active internet connection.\nWait for the setup to finish, maybe restart sublime a few times and then close it. To make sure, you can check the packages installed and the settings.\nWhen you are done, come back to this terminal.\n'
read -p '>> Press enter to open sublime'
subl
read -p '>> Press enter to go to the next step'
# MEGAsync
printf '\n\nMEGAsync will open, configure the following things:\n- Setup selective sync\n- Add ~/projects and ~/apps to synced dirs\n- Add "node_modules" to ignored in settings\n- Remove ".*" (hidden files - for example .git/ dirs) from ignored\n'
read -p '>> Press enter to open MEGAsync'
megasync
read -p '>> Press enter to go to the next step'
# Chrome
printf '\n\nChrome will open, log into your Google account\n'
read -p '>> Press enter to open Chrome'
google-chrome
read -p '>> Press enter to go to the next step'
# Git
read -p 'What name do you want to use with git? ' GIT_NAME
read -p 'What email do you want to use with git? ' GIT_EMAIL
git config --global user.email $GIT_EMAIL
git config --global user.name $GIT_NAME
git config --global push.default simple
git config --global commit.template "$HOME/projects/git-commit-template"
printf '\n\nKeep in mind that you need to have a "git-commit-template" file inside your ~/projects dir!\nThe content of the file will be the template for commit messages globally.\n\n
read -p '>> Press enter to go to the next step'
# ssh keys
printf '\n\nNow the default SSH key will be generated, without a passphrase, for authentication in services like Github or Gitlab\n'
read -p 'What label do you want to use in the key? ' KEY_LABEL
yes '' | ssh-keygen -t rsa -b 4096 -C $KEY_LABEL
printf '\nThis is your default public key ~/.ssh/id_rsa.pub:\n\n'
cat "$HOME/.ssh/id_rsa.pub"
printf '\n\nCopy the key and save it in the services you want to authenticate with. Common services:\n- Github https://github.com/settings/ssh/new\n- Gitlab https://gitlab.com/profile/keys\n\n'
read -p '>> Press enter to go to the next step'
# Logout!
printf '\n\nDONE! Everything should be set up now.\n'
read -p '>> Press enter to finish. You will get logged out, just log in again and enjoy!'
gnome-session-quit --force
# TODO:
# - Pencil plugins and configuration
# - Configure Android SDK (for react native) and default VM automatically
# - Add Android VM shortcut
# - Add default android VM to favorites
# - Install Franz
# - Franz => startup programs
# - Android default projects & sdk dirs (hidden) - manual step
# - Download android studio settings for use in the assistant
# - Automate KVM installation
# - libGL fix for android VMs - https://stackoverflow.com/a/43916742 (option 2)
# - Install Roboto
# Known issues:
# - Terminal profile configuration doesn't seem to be updating with gsettings (maybe create new profile instead of using default one?)
# - Screenshot tool gnome shell extension fails to install correctly for some reason (maybe the latest version is not the correct one? Maybe put a limit to current Gnome Version somehow?)
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_TEMPLATES_DIR="$HOME"
XDG_PUBLICSHARE_DIR="$HOME"
XDG_DOCUMENTS_DIR="$HOME"
XDG_MUSIC_DIR="$HOME"
XDG_PICTURES_DIR="$HOME"
XDG_VIDEOS_DIR="$HOME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment