Skip to content

Instantly share code, notes, and snippets.

@piotrpolak
Last active March 27, 2019 23:07
Show Gist options
  • Save piotrpolak/c76884cd407d55043a91ed99e8ec02ee to your computer and use it in GitHub Desktop.
Save piotrpolak/c76884cd407d55043a91ed99e8ec02ee to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo apt-get update
# TODO
# https://github.com/timrichardson/Prime-Ubuntu-18.04 / https://github.com/matthieugras/Prime-Ubuntu-18.04
# Battery https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html
sudo apt-get install tp-smapi-dkms acpi-call-dkms
sudo tlp setcharge 60 90 BAT0
# sudo tlp-stat -b
# Nvidia - http://www.linuxandubuntu.com/home/how-to-install-latest-nvidia-drivers-in-linux
sudo apt-get purge -y nvidia*
sudo add-apt-repository -y ppa:graphics-drivers
sudo apt-get update
sudo apt-get install -y nvidia-390 nvidia-prime nvidia-settings nvidia-prime-applet
sudo apt-mark hold nvidia-390
# See also https://github.com/linuxmint/nvidia-prime-applet
# Extras
sudo apt-get install -y ubuntu-restricted-extras gedit git
# TLP - https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html
sudo add-apt-repository -y ppa:linrunner/tlp && \
sudo apt-get update && \
sudo apt-get install -y tlp tlp-rdw && \
sudo tlp start && \
sudo bash -c 'echo "# Customizations" >> /etc/default/tlp' && \
sudo bash -c 'echo CPU_SCALING_GOVERNOR_ON_BAT=powersave >> /etc/default/tlp' && \
sudo bash -c 'echo "DEVICES_TO_DISABLE_ON_BAT=\"bluetooth wwan\"" >> /etc/default/tlp' && \
sudo bash -c 'echo START_CHARGE_THRESH_BAT0=60 >> /etc/default/tlp' && \
sudo bash -c 'echo STOP_CHARGE_THRESH_BAT0=90 >> /etc/default/tlp' && \
sudo tlp start
# sudo gedit /etc/default/tlp
# Powertop
sudo apt-get install -y powertop
## Post install
#sudo powertop --calibrate
sudo bash -c 'cat > /etc/systemd/system/powertop.service << EOF
[Unit]
Description=Powertop tunings
[Service]
Type=idle
ExecStart=/usr/sbin/powertop --auto-tune
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
EOF'
sudo systemctl enable powertop
# Docker
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
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 bionic stable"
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
sudo chmod +x /usr/local/bin/docker-compose && \
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install google-chrome-stable
# Prime extras
mkdir tmp && cp tmp && git clone https://github.com/timrichardson/Prime-Ubuntu-18.04 && \
cd Prime-Ubuntu-18.04/prime_socket/src
sudo apt install -y rustc cargo bbswitch-dkms && \
sudo /usr/bin/prime-select nvidia && \
sudo make install
## Various
## Add `pepis ALL = NOPASSWD: /usr/sbin/tlp` to sudousers (sudo visudo -f /etc/sudoers)
echo "sudo tlp start" >> ~/.bashrc
## Add `pepis ALL = NOPASSWD: /usr/local/bin/prime-select` to sudousers (sudo visudo -f /etc/sudoers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment