Skip to content

Instantly share code, notes, and snippets.

@ScreamingDev
Last active December 4, 2016 10:07
Show Gist options
  • Select an option

  • Save ScreamingDev/9001760 to your computer and use it in GitHub Desktop.

Select an option

Save ScreamingDev/9001760 to your computer and use it in GitHub Desktop.
Ubuntu formatting before and after - a todo- and checklist

System

sudo apt-get update
sudo apt-get upgrade

Environment

Control

# Less memory swapped / write-operations to the SSD
echo "vm.swappiness = 1" | sudo tee -a /etc/sysctl.conf

# Faster update of new/changed files
echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.conf

Grub

# Boot faster
sudo sed -i 's/GRUB_TIMEOUT=10/GRUB_TIMEOUT=3/g' /etc/default/grub

# update
sudo update-grub2

Apport

# don't nag me with errors
sudo sed -i 's/enabled=1/enabled=0/g' /etc/default/apport

Xfce

# Show everything in startup
sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop

Thunar

sudo apt-get install -y thunar-archive-plugin # Open archives in thunar \
                        thunar-vcs-plugin # GIT

Network

# VPN
sudo apt-get install -y openvpn network-manager-openvpn

Backups

Screen

# for backups without leaving the shell open
sudo apt-get install -y screen

Back In Time

# like a time machine on osx
sudo apt-get install -y backintime-gnome

AutoMySQLBackup

# if you want to backup your sql too
sudo apt-get install -y automysqlbackup

For the office

Drawing

sudo apt-get install -y gimp
sudo apt-get install -y inkscape
sudo apt-get install -y freemind
sudo apt-get install -y easystroke

Productivity

# AutoKey for text shortcuts
sudo apt-get install -y autokey-gtk

# Fast better editor
sudo apt-get install -y geany

# glipper
sudo apt-get install -y glipper

# Kupfer - Best launcher ever!
sudo apt-get install -y kupfer python-wnck python-gnomekeyring python-appindicator python-nautilus python-cjson python-gnome2

# Repair VI
echo "set nocompatible" > ~/.vimrc

VoIP

sudo apt-get install -y ekiga

Writing

sudo apt-get install -y libreoffice

WebCam / Screencast

# sudo apt-get install -y cheese
sudo apt-get install -y kazam

For Developer

Languages

Ruby

sudo apt-get install -y ruby-dev

Node.js

sudo apt-get install -y nodejs-dev

PHP

sudo apt-get install -y php-dev php5-curl php5-gd php5-intl php5-mcrypt php5-xdebug php-xsl
sudo php5enmod mcrypt
sudo php5enmod xsl


# Change default php.ini values so that no error occur
sudo sed -i "s/^;date.timezone =$/date.timezone = \"Europe\/Berlin\"/" /etc/php5/cli/php.ini

# But those we do will nag us
sudo sed -i 's/display_errors = Off/display_errors = On/g' /etc/php5/cli/php.ini

Python

sudo apt-get install -y python3-dev

Databases

sudo apt-get install -y libsqlite3-dev
sudo apt-get install -y mysql-server php5-mysql

Tools

GIT

sudo apt-get install -y git

# And some helpful repo check tool (needs ruby)
sudo gem install git-up

Mailcatcher

sudo gem install mailcatcher

Composer

wget https://getcomposer.org/composer.phar
sudo mv composer.phar /usr/local/bin/composer
sudo chmod 755 /usr/local/bin/composer

# Install crontab for updates (todo: make it a daily cron)
#crontab -l > mycron
#echo "0		*/6		*		*		*		/usr/local/bin/composer self-update" >> mycron
#crontab mycron
#rm mycron

Symfony

curl -LsS http://symfony.com/installer > symfony.phar
sudo mv symfony.phar /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony

Selenium

wget http://selenium-release.storage.googleapis.com/2.48.2/selenium-server-standalone-2.48.2.jar
mkdir ~/opt
mv selenium-server-standalone-2.48.2.jar ~/opt/

MySQL Workbench

sudo apt-get install -y mysql-workbench

Server

Docker

# Get the latest
wget -qO- https://get.docker.com/ | sh
sudo usermod -a -G docker `whoami`

Apache2

sudo apt-get install -y apache2-dev

# PHP Module
sudo apt-get install -y libapache2-mod-php5

# Change config for less error messages
sudo sed -i "s/^;date.timezone =$/date.timezone = \"Europe\/Berlin\"/" /etc/php5/apache2/php.ini
sudo sed -i "s/^expose_php = On$/expose_php = Off/" /etc/php5/apache2/php.ini
sudo sed -i "s/^;upload_tmp_dir =$/upload_tmp_dir=\"\/tmp\"/" /etc/php5/apache2/php.ini

# But those we do will nag us
sudo sed -i 's/display_errors = Off/display_errors = On/g' /etc/php5/cli/php.ini

# Some modules and restart
sudo a2enmod expires
sudo a2enmod headers
sudo a2enmod rewrite
sudo a2enmod status
sudo service apache2 restart

# Settings for more security
sudo sed -i "s/^ServerTokens OS$/ServerTokens Prod/" /etc/apache2/conf-available/security.conf
sudo sed -i "s/^ServerSignature On$/ServerSignature Off/" /etc/apache2/conf-available/security.conf
echo "UseCanonicalName On" | sudo tee -a /etc/apache2/conf-available/security.conf

sudo apt-get install -y apache2-utils

Bye!

sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove

It's all about backup.

Firefox

Do this:

  • Store the recovery key

Thunderbird

Do this:

Clean up obsolete files

Some files are obsolete or generated by the app you use. You only want to keep your configuration because cache, log and index-folders can take a huge amount of disk space.

#!/bin/bash

# JetBrains / WebIDE / phpStorm
rm -rf .WebIde80/system/log/*
rm -rf .WebIde80/system/index/*
rm -rf .WebIde80/system/LocalHistory/*

# Thunderbird
find .thunderbird/*/logs/irc/* -type f -mtime +7 -exec rm -rf {} \;


# Ubuntu
rm -rf .local/share/Trash

GRUB fixes and tweaks

Screw this monitor

There is always a second screen. Get rid of it!

# look up in xrandr the name (mine was "VGA-1-2")
xrandr --verbose
# disable it in the GRUB
sudo nano /etc/default/grub
# add this line (the name "VGA-1-2" must be replaced with yours)
# GRUB_CMDLINE_LINUX="video=VGA-1-2:d"
sudo update-grub

Ubuntu fixes and Tweaks

Less apport error messages

Apport shows plenty of error messages and some even occur after login when nothing happend. Those are messages from the last few days that are still shown which are very annoying. So we delete all crash-reports at boot but need to keep in mind that we did that:

sudo nano /etc/rc.local

Add this line before exit 0:

rm /var/crash/*

Save, exit and make sure it is executable with sudo chmod +x rc.local.

Speed up launch time of applications

Other tweaks

  • power management is off? iwconfig

Tweaks:

# compiz settings
sudo apt-get install compizconfig-settings-manager

Performance

Shell

ZSH - the more productive shell

install zsh

# make it default
chsh -s $(which zsh)

Gnome

Some cool extensions:

Fast simple editor

# terminal in geany
sudo apt-get install libvte-dev

Change the default applications:

  • Firefox

  • Thunar

  • Thunderbird

  • Gnome Terminal

    exo-preferred-applications sudo update-alternatives --config x-www-browser sudo update-alternatives --config gnome-www-browser

Concern this too: http://askubuntu.com/questions/79305/how-do-i-change-my-default-browser

Development

Mailcatcher

Run mailcatcher and see on http://localhost:1080/ for send mails. Write a .htaccess like this:

php_value sendmail_path "/usr/bin/env catchmail -f some@from.address"

And as daemon: http://akrabat.com/computing/setting-up-mailcatcher-as-a-service-in-debianubuntu/

WordPress CLI

curl -kL https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

PHP

sudo apt-get install php5-xdebug

# deploy
echo 'xdebug.profiler_enable_trigger=1' | sudo tee -a /etc/php5/apache2/conf.d/20-xdebug.ini
echo 'xdebug.profiler_output_dir="/tmp"' | sudo tee -a /etc/php5/apache2/conf.d/20-xdebug.ini
echo 'xdebug.profiler_output_name="cachegrind.out.%R"' | sudo tee -a /etc/php5/apache2/conf.d/20-xdebug.ini

Extensions

XDebug

Config:

zend_extension="/usr/lib64/php/20100525/xdebug.so"
; xdebug.collect_params = 4
xdebug.dump_globals = 1
xdebug.dump.SERVER = REQUEST_URI
xdebug.extended_info = 1
xdebug.file_link_format = "javascript: var r = new XMLHttpRequest; r.open(\"get\", \"http://localhost:8091?message=%f:%l\");r.send()"
xdebug.profiler_enable = 0
xdebug.profiler_output_dir="/tmp"
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name="cachegrind.out.%R"
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.show_local_vars = 1
xdebug.trace_format = 1

Tools

Go in your ~/bin folder:

composer require "n98/magerun=1.*"

Office

Remember:

  • Disable java in libre office for better performance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment