Skip to content

Instantly share code, notes, and snippets.

@Treydone
Last active June 15, 2016 00:03
Show Gist options
  • Save Treydone/358b13fe4e8b824f20f7 to your computer and use it in GitHub Desktop.
Save Treydone/358b13fe4e8b824f20f7 to your computer and use it in GitHub Desktop.
Ubuntu tweak
sudo apt-get update
sudo apt-get upgrade
############################ Security
sudo apt-get -y install openssh-server
sudo apt-get -y install gufw
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.old
sudo sed 's|Port 22|Port 2222|g' -i /etc/ssh/sshd_config
sudo service ssh restart
cat <<EOF | tee ~/.ssh/config
Host bitbucket.orgv
Hostname bitbucket.org
User git
IdentityFile ~/.ssh/id_dsa
Host github.com
Hostname github.com
User git
IdentityFile ~/.ssh/id_dsa
EOF
cat <<EOF | sudo tee /etc/init.d/firewall
#!/bin/bash
# Vider les tables actuelles
iptables -t filter -F
# Vider les règles personnelles
iptables -t filter -X
# Interdire toute connexion entrante et sortante
iptables -t filter -P INPUT DROP
iptables -t filter -P FORWARD DROP
iptables -t filter -P OUTPUT DROP
# ---
# Ne pas casser les connexions etablies
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# Autoriser loopback
iptables -t filter -A INPUT -i lo -j ACCEPT
iptables -t filter -A OUTPUT -o lo -j ACCEPT
# ICMP (Ping)
iptables -t filter -A INPUT -p icmp -j ACCEPT
iptables -t filter -A OUTPUT -p icmp -j ACCEPT
# ---
# FTP Out
iptables -t filter -A OUTPUT -p tcp --dport 20:21 -j ACCEPT
# SSH In
iptables -t filter -A INPUT -p tcp --dport 2222 -j ACCEPT
iptables -t filter -A INPUT -p tcp --dport 22 -j ACCEPT
# SSH Out
iptables -t filter -A OUTPUT -p tcp --dport 2222 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 22 -j ACCEPT
# DNS In/Out
iptables -t filter -A OUTPUT -p tcp --dport 53 -j ACCEPT
iptables -t filter -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -t filter -A INPUT -p tcp --dport 53 -j ACCEPT
iptables -t filter -A INPUT -p udp --dport 53 -j ACCEPT
# NTP Out
iptables -t filter -A OUTPUT -p udp --dport 123 -j ACCEPT
# HTTP + HTTPS Out
iptables -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 443 -j ACCEPT
# HTTP + HTTPS In
iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t filter -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -t filter -A INPUT -p tcp --dport 8443 -j ACCEPT
# Torrent Out
iptables -t filter -A OUTPUT -p tcp --dport 6881:6889 -j ACCEPT
iptables -t filter -A OUTPUT -p udp --dport 1024:65534 -j ACCEPT
EOF
sudo chmod +x /etc/init.d/firewall
sudo /etc/init.d/firewall
sudo update-rc.d firewall defaults
############################ Tools
echo "+ Installing tools..."
echo "--- Fonts..."
#sudo apt-get -y install ttf-ancient-fonts
sudo apt-get -y install '^ttf-(.*)$'
echo "--- Drivers..."
wget --no-check-certificate https://download.01.org/gfx/RPM-GPG-KEY-ilg -O - | sudo apt-key add -
wget --no-check-certificate https://download.01.org/gfx/RPM-GPG-KEY-ilg-2 -O - | sudo apt-key add -
wget https://download.01.org/gfx/ubuntu/15.10/main/pool/main/i/intel-linux-graphics-installer/intel-linux-graphics-installer_1.4.0-0intel1_amd64.deb
sudo dpkg -i intel-linux-graphics-installer_*.deb
sudo apt-get -y install i965-va-driver libva-intel-vaapi-driver vainfo
sudo apt-get -y install libva-glx1 libva-egl1 vainfo
#echo "--- Hibernate mode..."
#cat <<EOF | sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
#[Re-enable hibernate by default]
#Identity=unix-user:*
#Action=org.freedesktop.upower.hibernate
#ResultActive=yes
#EOF
echo "--- FS/NTFS..."
sudo apt-get -y install exfat-fuse ntfs-config ntfs-3g
echo "--- Dev tools..."
sudo apt-get -y install iotop htop subversion maven nmap iftop ncdu lsof ncftp ruby jq glances jmeter vim
sudo apt-get -y install libxml-xpath-perl libapr1-dev libssl-dev make cmake rpm libtolua-dev libtolua++5.1-dev libx11-dev libxft-dev libxdamage-dev libncurses5-dev libxinerama-dev
sudo apt-get -y install mercurial subversion build-essential git-core configure-debian automake autoconf xorg-dev libtool libdrm-dev mesa-common-dev xutils-dev xutils git filezilla apt-file terminator furiusisomount zsh
sudo apt-get -y install g++ flex bison gperf perl libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev libpng-dev libjpeg-dev python libx11-dev libxext-dev libfreetype6-dev python-dev python-imaging
sudo apt-get -y install libglib2.0-dev libusb-dev gnome-media
sudo apt-get -y install shutter keepassx pdfshuffler
sudo apt-get -y install arduino arduino-mk
sudo apt-get -y install yum yum-utils bchunk
sudo apt-get -y install clusterssh krb5-user nodejs npm adobe-flashplugin tree
curl -fsSL https://get.docker.com/ | sh
sudo usermod -a -G tty `whoami`
sudo usermod -a -G dialout `whoami`
sudo add-apt-repository -y ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get -y install sublime-text-installer
cat << EOF | tee ~/sts.desktop
[Desktop Entry]
Version=1.0
Name=STS
Comment=STS
Exec=/home/devil/opt/sts-bundle/sts-3.7.3.RELEASE/STS
Icon=/home/devil/opt/sts-bundle/sts-3.7.3.RELEASE/icon.xpm
Terminal=false
Type=Application
Categories=Utility;Application;
Name[fr_FR]=STS
EOF
chmod +x ~/sts.desktop
mv sts.desktop ~/.local/share/applications
cat << EOF | tee ~/datagrip.desktop
[Desktop Entry]
Version=1.0
Name=DataGrip
Comment=DataGrip
Exec=/home/devil/opt/DataGrip-2016.1/bin/datagrip.sh
Icon=/home/devil/opt/DataGrip-2016.1/bin/product.png
Terminal=false
Type=Application
Categories=Utility;Application;
Name[fr_FR]=DataGrip
EOF
chmod +x ~/datagrip.desktop
mv datagrip.desktop ~/.local/share/applications
cat << EOF | tee ~/idea.desktop
[Desktop Entry]
Version=1.0
Name=Idea-UI
Comment=Idea-UI
Exec=/home/devil/opt/idea-IU-145.597.3/bin/idea.sh
Icon=/home/devil/opt/idea-IU-145.597.3/bin/idea.png
Terminal=false
Type=Application
Categories=Utility;Application;
Name[fr_FR]=Idea-UI
EOF
chmod +x ~/idea.desktop
mv idea.desktop ~/.local/share/applications
cat << EOF | tee ~/pycharm.desktop
[Desktop Entry]
Version=1.0
Name=PyCharm
Comment=PyCharm
Exec=/home/devil/opt/pycharm-2016.1.2/bin/pycharm.sh
Icon=/home/devil/opt/pycharm-2016.1.2/bin/pycharm.png
Terminal=false
Type=Application
Categories=Utility;Application;
Name[fr_FR]=PyCharm
EOF
chmod +x ~/pycharm.desktop
mv pycharm.desktop ~/.local/share/applications
# Oh-My-Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
wget https://raw.githubusercontent.com/oskarkrawczyk/honukai-iterm/master/honukai.zsh-theme -O ~/.oh-my-zsh/themes/honukai.zsh-theme
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="honukai"/g' ~/.zshrc
sed -i 's/plugins=(.*)/plugins=(git docker git mvn nmap terminitor ubuntu)/g' ~/.zshrc
source ~/.zshrc
sudo usermod -s /bin/zsh root
sudo cp ~/.zshrc /root
#mkdir ~/opt
#wget http://download.springsource.com/release/STS/3.6.3/dist/e4.4/spring-tool-suite-3.6.3.RELEASE-e4.4.1-linux-gtk-x86_64.tar.gz -O ~/opt/spring.tar.gz
#cd ~/opt/
#tar -xvf spring.tar.gz
#cd -
echo "--- Diagram..."
#wget http://www.yworks.com/products/yed/demo/yEd-3.14.2_64-bit_setup.sh
#chmod +x yEd-*-bit_setup.sh
#./yEd-*-bit_setup.sh
#rm yEd-*-bit_setup.sh
echo "--- Python..."
sudo apt-get -y install python-pip python-dev
sudo pip install thefuck
echo 'alias fuck='\''''$(thefuck $(fc -ln -1))'\''' >> ~/.zshrc
echo "alias FUCK='fuck'" >> ~/.zshrc
echo 'alias fuck='\''''$(thefuck $(fc -ln -1))'\''' >> ~/.bashrc
echo "alias FUCK='fuck'" >> ~/.bashrc
sudo pip install reportlab
echo "--- Ruby..."
sudo apt-get install -y ruby-dev gcc
sudo gem install fpm
echo "--- Emul..."
sudo apt-get install -y playonlinux wine winetricks winbind p7zip-full mesa-utils mesa-utils-extra libgl1-mesa-dev libcap2-bin mono-devel wine-gecko2.21
sudo setcap cap_sys_ptrace=eip /usr/bin/wineserver
sudo setcap cap_sys_ptrace=eip /usr/bin/wine-preloader
echo "--- Skype..."
sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner" && sudo apt-get update && sudo apt-get -y install skype
echo "--- Chrome..."
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get -y install google-chrome-stable
echo "--- Java..."
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java7-installer oracle-java8-installer
echo "--- PHP5..."
sudo apt-get -y install php5-fpm php5-mysql php5-cli php5-common php5-json php5-cgi
echo "--- Atom..."
sudo add-apt-repository -y ppa:webupd8team/atom
sudo apt-get update
sudo apt-get -y install atom
apm install file-icons autocomplete-plus atom-beautify pretty-json asciidoc-preview language-asciidoc seti-ui pigments
echo "--- Spotify"
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update
sudo apt-get -y install spotify-client
echo "--- Printers"
sudo apt-get install --assume-yes avahi-utils libcups2 cups libcups2-dev cups-bsd cups-client libcupsimage2-dev libdbus-1-dev build-essential ghostscript openssl libjpeg-dev libsnmp-dev snmp-mibs-downloader libtool libtool-bin libusb-1.0.0-dev wget policykit-1 policykit-1-gnome python3-dbus python3-gi python3-dev python3.5-dev python3-notify2 python3-pil python3-pyqt4 gtk2-engines-pixbuf python3-dbus.mainloop.qt python3-reportlab python3-lxml libsane libsane-dev sane-utils xsane
sudo apt-get -y install hplip-gui apsfilter psutils hpijs-ppds hplip-doc foomatic-db-engine printer-driver-all printer-driver-cups-pdf
echo "--- Disks"
sudo apt-get -y install gparted smartmontools
echo "--- Mobile devices"
sudo apt-get -y install mtpfs
echo "--- Virt"
sudo apt-get -y install virtualbox vagrant
#sudo apt-get -y install build-essential linux-headers-$(uname -r)
#CHKArch=`uname -m`
##64bit
#if [ $CHKArch = "x86_64" ]; then
# wget -O VMware-Player.bundle https://download3.vmware.com/software/player/file/VMware-Player-7.1.0-2496824.x86_64.bundle
#
##i386
#elif [ $CHKArch = "i686" ] || [ $CHKArch = "i386" ] || [ $CHKArch = "i586" ]; then
# wget -O VMware-Player.bundle https://download3.vmware.com/software/player/file/VMware-Player-7.1.0-2496824.i386.bundle
#else
# echo "VMware Player not available for your system architecture."
# exit
#fi
#chmod +x VMware-Player.bundle
#sudo ./VMware-Player.bundle
#rm VMware-Player.bundle
#curl http://pastie.org/pastes/9934018/download -o /tmp/vmnet-3.19.patch
#cd /usr/lib/vmware/modules/source
#sudo tar -xf vmnet.tar
#sudo patch -p0 -i /tmp/vmnet-3.19.patch
#sudo tar -cf vmnet.tar vmnet-only
#sudo rm -r *-only
#sudo vmware-modconfig --console --install-all
echo "--- Provisionning"
sudo apt-get -y install ansible
echo "--- Network"
sudo apt-get -y install cifs-utils
sudo mkdir /media/freebox/
#cat <<EOF | sudo tee /etc/fstab
#//mafreebox.freebox.fr/Disque\040dur /media/freebox cifs _netdev,rw,users,iocharset=utf8,uid=1000,sec=none,file_mode=0777,dir_mode=0777 0 0
#EOF
sudo umount -a
sudo mount -a
echo "--- Display"
cat <<EOF | sudo tee /sys/class/backlight/intel_backlight/brightness
17
EOF
echo "--- Gaming"
#sudo apt-get -y install steam
echo "--- Messaging"
sudo apt-get -y install pidgin
sudo apt-get -y install pidgin-twitter pidgin-themes pidgin-sipe pidgin-openpgp pidgin-skype
echo "--- Players"
sudo apt-get -y install vlc xbmc tomahawk
echo "--- Audio"
sudo apt-get -y install pavucontrol
echo "--- Cloud"
sudo add-apt-repository -y ppa:twodopeshaggy/drive
sudo apt-get update
sudo apt-get install drive
echo "--- Fitbit"
sudo apt-get -y install python-usb python-requests
#sudo add-apt-repository ppa:cwayne18/fitbit -y
#sudo apt-get update
#sudo apt-get -y install galileo
#cat <<EOF | sudo tee /etc/udev/rules.d/99-fitbit.rules
#SUBSYSTEM=="usb", ATTR{idVendor}=="2687", ATTR{idProduct}=="fb01", SYMLINK+="fitbit", MODE="0666"
#EOF
#sudo service udev restart
echo "--- Codecs"
#sudo apt-get -y install gstreamer1.0-libav gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly
sudo apt-get -y install gxine libdvdread4 totem-mozilla
sudo apt-get -y install tagtool easytag id3tool nautilus-script-audio-convert mpg321
sudo apt-get -y install libxine1-ffmpeg mencoder flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview libmpeg3-1 mpeg3-utils mpegdemux liba52-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6
sudo apt-get -y install totem-mozilla icedax lame libmad0 libjpeg-progs libdvdcss2 libdvdread4 libdvdnav4 libswscale-extra-2 ubuntu-restricted-extras
#sudo add-apt-repository -y ppa:pipelight/stable
#sudo apt-get update
#sudo apt-get -y install pipelight-multi
#sudo /usr/share/doc/libdvdread4/install-css.sh
#sudo pipelight-plugin --enable silverlight
echo "--- Imaging"
sudo apt-get -y install gimp gimp-data gimp-plugin-registry gimp-data-extras cheese digikam
echo "--- Ebook"
sudo apt-get -y install calibre pandoc
echo "--- Downloads"
sudo apt-get -y install deluge
echo "--- Widgets"
sudo apt-get -y install screenfetch
# For conky-manager
sudo apt-add-repository -y ppa:teejee2008/ppa
sudo apt-get update
sudo apt-get -y install conky-all conky-manager p7zip
echo "--- Compression"
sudo apt-get -y install p7zip-rar p7zip-full unace unrar zip unzip sharutils rar uudeview mpack arj cabextract file-roller
echo "--- Themes and bonuses"
sudo apt-get -y install indicator-multiload "ubuntu-wallpapers*"
sudo apt-get -y install compiz compizconfig-settings-manager compiz-plugins
#sudo add-apt-repository -y ppa:i-nex-development-team/daily
#sudo add-apt-repository -y ppa:gambas-team/gambas3
#sudo apt-get update
#sudo apt-get -y install i-nex
#sudo add-apt-repository -y ppa:atareao/atareao
#sudo apt-get update
#sudo apt-get install -y power-commands
sudo add-apt-repository -y ppa:numix/ppa
sudo apt-get update
sudo apt-get -y install unity-tweak-tool "numix-*"
#gsettings set com.canonical.indicator.session show-real-name-on-panel true
echo "--- Others"
sudo add-apt-repository -y ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get -y install libvdpau-va-gl1 ubuntu-restricted-extras libavcodec-extra bleachbit y-ppa-manager
echo "--- No services at startup..."
#sudo update-rc.d XXX disable
echo "--- Git..."
echo "[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all" >> ~/.gitconfig
echo 'lg = !"git lg1"'>> ~/.gitconfig
echo "--- Cleaning Up" &&
sudo apt-get -f install &&
sudo apt-get autoremove &&
sudo apt-get -y autoclean &&
sudo apt-get -y clean
echo "OK! Must setting the SSH keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment