install-ubuntu-vivid.md 15 KB
Newer Older
René Jochum's avatar
René Jochum committed
1 2 3 4 5
---
date: 2015-06-10T13:00:00+01:00
title: My installation of Ubuntu Mate 15.04 (Vivid)
author: pcdummy
tags:
René Jochum's avatar
René Jochum committed
6
  - HOWTO
René Jochum's avatar
René Jochum committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
  - Ubuntu
  - My Installation
  - Crypto root
  - BTRFS
  - lxc
---
This is my own documentation of my installation, i assume you have installed
[Ubuntu Mate 14.10](/2015/04/05/install-ubuntu-trusty/) before.

**Grub** + **cryptoroot** + **BTRFS** works a lot better with **Vivid**, yeah!

#### Features

* Latest Ubuntu Mate
* Encrypted disk
* BTRFS root, home and stuff i keep between sys updates.<!--more-->

#### Install Linux from a livecd
* Start from the livecd
* Go to Control Center->Hardware->Keyboard and set the keyboard to german nodeadkeys
* connect to the internet

#### Get root and install BTRFS Tools

    sudo -s -H
    apt-get -y install btrfs-tools

#### Decrypt the root

    cryptsetup --allow-discards luksOpen /dev/sda2 root

#### Create the root subvolume

    mkdir /mnt/btrfs
    mount -o subvolid=0,compress=lzo,recovery,noatime /dev/mapper/root /mnt/btrfs
    btrfs subvolume create /mnt/btrfs/\@ubuntu_15.04

#### Mount the new Subvolume to /target

  	mkdir /target
  	mount -o subvol=@ubuntu_15.04,compress=lzo,recovery,noatime /dev/mapper/root /target
  	mkdir -p /target/var/lib/lxc
  	mkdir -p /target/opt/mono
  	mkdir -p /target/mnt/btrfs

#### Rsync /rofs to /target

    rsync -avP /rofs /target

#### Copy stuff from 14.10 to 15.04

    cp /etc/mtab /target/etc/

    export from='/mnt/btrfs/@ubuntu_14.10'
    cp -a $from/etc/hosts /target/etc/
    cp -a $from/etc/hostname /target/etc/
    cp -a $from/etc/sysctl.conf /target/etc/
    cp -a $from/etc/sudoers /target/etc/
    cp -a $from/etc/crypttab /target/etc/
    cp -a $from/etc/fstab /target/etc/
    sed -i -e's/@ubuntu_14.10/@ubuntu_15.04/' /target/etc/fstab
    cp -a $from/etc/data_luks.key /target/etc/
    cp -a $from/etc/initramfs-tools/modules /target/etc/initramfs-tools
    cp -a $from/etc/NetworkManager/system-connections/* /etc/NetworkManager/system-connections/
    cp -pfra $from/etc/NetworkManager/dnsmasq.d/* /target/etc/NetworkManager/dnsmasq.d/
    cp -a $from/etc/samba/smb.conf /target/etc/samba/
    rsync -avP $from/etc/libvirt/ /target/etc/libvirt/

#### Chroot to /target

    mount -o bind,rw /dev /target/dev
    mount -o bind,rw /proc /target/proc
    mount -o bind,rw /sys /target/sys
    mount -o bind,rw /dev/pts /target/dev/pts
    mount -o bind,rw /run /target/run

    chroot /target /bin/bash

    export TARGET_USERNAME=$SUDO_USER
    rm -f /usr/lib/locale/locale-archive
    locale-gen de_AT.UTF-8 en_US.UTF-8 de_AT en_US
    update-locale LANG=de_AT.UTF-8
    export LANG=de_AT.UTF-8
    dpkg-reconfigure keyboard-configuration
    dpkg-reconfigure tzdata

#### Make sure dhclient never updates resolv.conf
See: http://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/

  	cat <<EOF > /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate
    #!/bin/sh
    make_resolv_conf(){
    	:
    }
    EOF
	  cat /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate # check

#### Create your user

	export TARGET_USERNAME="pcdummy"
	adduser --no-create-home ${TARGET_USERNAME}
	usermod -a --groups=sudo,cdrom,floppy,audio,dip,video,plugdev ${TARGET_USERNAME}
	passwd -l root
	usermod -a -G fuse ${TARGET_USERNAME}

#### Update the fresh install (still in chroot)

	sed -i -e's/archive.ubuntu/ch.archive.ubuntu/g' /etc/apt/sources.list
	apt-get update && apt-get -yy dist-upgrade

#### Update grub.

	cat <<'EOF' > /etc/default/grub
	GRUB_DEFAULT=0
	GRUB_TIMEOUT=10
	GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
	GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 kopt=root=/dev/mapper/root quiet splash"
	#GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda2:root"
	GRUB_ENABLE_CRYPTODISK=y
	GRUB_PRELOAD_MODULES="luks cryptodisk gcry_rijndael gcry_sha1"
	EOF'

	update-grub

#### My favorite console text editor and aptitude.

	apt-get -yy install vim vim-scripts aptitude
	update-alternatives --set editor /usr/bin/vim.basic

#### Remove live installer

	apt-get -yy purge casper ubiquity && apt-get -yy autoremove


#### German Language packs and suggestions

	apt-get -yy install firefox-locale-de libreoffice-l10n-de thunderbird-locale-de hyphen-de libreoffice-help-de mythes-de thunderbird-gnome-support ttf-lyx myspell-de-at


#### Nvidia driver.

	apt-get update
	apt-get -yy install nvidia-settings nvidia-current
	nvidia-xconfig --no-logo

#### Install usefull stuff.
Speed :)

    sudo apt-get -y install readahead-fedora preload nscd

#### Reboot

	reboot


#### Gnome-encfs-manager

164 165 166
  	sudo add-apt-repository -y ppa:gencfsm/ppa
  	sudo apt-get update
  	sudo apt-get -y install gnome-encfs-manager
René Jochum's avatar
René Jochum committed
167 168 169 170 171 172 173 174 175 176

#### [Atom](https://atom.io/) text editor
[He](http://www.atomtips.com/atom-editor-vs-sublime-text/) explains my reasons to switch to Atom from Sublime quiet good

    sudo add-apt-repository -y ppa:webupd8team/atom
    sudo apt-get update
    sudo apt-get -y install atom nodejs git

#### Geany text editor

177
    sudo aptitude install 'geany-plugins' geany-plugin-py geany-plugin-treebrowser geany-plugin-vc
René Jochum's avatar
René Jochum committed
178 179 180

#### Evernote on Linux

181 182 183 184 185 186 187 188 189 190 191 192 193
Isn't working!

     sudo add-apt-repository -y ppa:vincent-c/nevernote
     sudo apt-get update
     sudo apt-get -y install nixnote

I've made my own package witch works on 15.04:

    pushd .
    cd ~/Downloads
    wget http://rene.jochums.at/downloads/nixnote2-2.0-beta3_amd64.deb
    sudo dpkg -i nixnote2-2.0-beta3_amd64.deb; sudo apt-get install -y -f
    popd
René Jochum's avatar
René Jochum committed
194 195 196

#### Virtual development environment

197
	  sudo add-apt-repository -y ppa:jacob/virtualisation
René Jochum's avatar
René Jochum committed
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
    sudo add-apt-repository -y ppa:ubuntu-lxc/lxc-stable
    sudo apt-get -y install libvirt-bin virt-manager qemu qemu-kvm qemu-system spice-client python-spice-client-gtk bridge-utils ebtables virt-top
    sudo apt-get -y install lxc cgmanager uidmap lxc-templates
    sudo apt-get -y install system-config-samba # To setup sharing's for windows guests.
    sudo usermod -a -G libvirtd $SUDO_USER

#### Playing with OpenVSwitch

    sudo apt-get -y install openvswitch-switch ethtool

#### Git repository viewer

    sudo apt-get -y install git-cola fldiff

#### KeePass 2: Password manager

    sudo add-apt-repository -y ppa:dlech/keepass2-plugins
    sudo apt-get update
    sudo apt-get -y install keepass2 mono-dmcs mono-complete libmono-system-management4.0-cil keepass2-plugin-rpc xul-ext-keefox xul-ext-keebird keepass2-plugin-keepasshttp

#### Go Development with [gvm](https://github.com/moovweb/gvm)
install deps:

    sudo apt-get install curl git mercurial make binutils bison gcc build-essential

#### Python Development with [PyEnv](https://github.com/yyuu/pyenv-installer)
Nice howto on that from [davebehnke.com](http://davebehnke.com/python-pyenv-ubuntu.html)

    sudo apt-get -y install python3-pip python3-dev python3-wheel python-tox python3-nose python3-coverage make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm

228 229 230 231

#### [Syncthing](https://syncthing.net/)

    sudo add-apt-repository -y ppa:ytvwld/syncthing
René Jochum's avatar
René Jochum committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
    sudo add-apt-repository -y ppa:nilarimogard/webupd8
    sudo apt-get update
    sudo apt-get -y install syncthing syncthing-gtk

#### Quassel IRC Client (git/development version!). I have a quassel-core (means server) somewhere in the wild.

    sudo add-apt-repository -y ppa:mamarley/quassel-git
    sudo apt-get update
    sudo apt-get -y install quassel-client

#### Skype

    sudo dpkg --add-architecture i386
    sudo apt-get update
    wget -O skype-install.deb http://www.skype.com/go/getskype-linux-deb
    sudo dpkg -i skype-install.deb; sudo apt-get -f install
    rm -f skype-install.deb

#### Remote desktop (RDP+VNC) clients/managers - i use gnome-rdp and remmina (slowly switching over to remmina).

    sudo apt-get -y install gnome-rdp remmina-plugin-rdp remmina-plugin-vnc libfreerdp-plugins-standard rdesktop xtightvncviewer

#### OpenVPN client

    sudo apt-get -y install network-manager-openvpn-gnome

#### IPSec client

    sudo apt-get -y install network-manager-vpnc-gnome

#### Tranmission Remote (for my apu1d4 :) )

René Jochum's avatar
René Jochum committed
264
	  sudo apt-get -y install transmission-remote-gtk
René Jochum's avatar
René Jochum committed
265 266 267

#### PHP Dev

René Jochum's avatar
René Jochum committed
268
    sudo apt-get -y install php5-cli php5-pear php-dev php-apc
René Jochum's avatar
René Jochum committed
269 270 271

#### Java Web start (for Cisco ASDM)

René Jochum's avatar
René Jochum committed
272
    sudo apt-get -y install icedtea-7-plugin
René Jochum's avatar
René Jochum committed
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398

#### Citrix Receiver

Goto https://receiver.citrix.com and download the .deb version

    pushd .
    cd Downloads
    sudo dpkg -i icaclient_13.1.0.285639_amd64.deb; sudo apt-get install -f
    popd


#### Audiograbber on Linux

    sudo apt-get -y install install sound-juicer

#### Audio file tag editor

    sudo apt-get -y install puddletag

#### Softether VPN

    sudo add-apt-repository -y ppa:paskal-07/softethervpn
    sudo sed -i -e's|vivid|trusty|g' /etc/apt/sources.list.d/paskal-07-ubuntu-softethervpn-vivid.list
    sudo apt-get update
    sudo apt-get -y install softether-vpnclient

    sudo vpnclient start


Create a VPN connection:

    pcdummy@ThinkPad-T410:~$ vpncmd
    vpncmd command - SoftEther VPN Command Line Management Utility
    SoftEther VPN Command Line Management Utility (vpncmd command)
    Version 4.17 Build 9562   (English)
    Compiled 2015/05/30 17:41:38 by yagi at pc30
    Copyright (c) SoftEther VPN Project. All Rights Reserved.

    By using vpncmd program, the following can be achieved.

    1. Management of VPN Server or VPN Bridge
    2. Management of VPN Client
    3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)

    Select 1, 2 or 3: 2

    Specify the host name or IP address of the computer that the destination VPN Client is operating on.
    If nothing is input and Enter is pressed, connection will be made to localhost (this computer).
    Hostname of IP Address of Destination:

    Connected to VPN Client "localhost".

    VPN Client>AccountCreate
    AccountCreate command - Create New VPN Connection Setting
    Name of VPN Connection Setting: pcdummy.lan

    Destination VPN Server Host Name and Port Number: apu1d4.home.pc-dummy.net:8888

    Destination Virtual Hub Name: vpn.pcdummy.lan

    Connecting User Name: jochumr

    Used Virtual Network Adapter Name: 0

    The command completed successfully.


Create a Password:

    VPN Client>Accountpasswordset
    AccountPasswordSet command - Set User Authentication Type of VPN Connection Setting to Password Authentication
    Name of VPN Connection Setting: pcdummy.lan

    Please enter the password. To cancel press the Ctrl+D key.

    Password: ********************
    Confirm input: ********************


    Specify standard or radius: standard

    The command completed successfully.


Connect the newly created "Account":

    AccountConnect pcdummy.lan


#### Wine with 32bit default

    sudo apt-get -y install wine1.7 wine-gecko:i386 wine-mono:i386

    # Set wine to 32bit by default
    cat <<EOF >> ~/.profile

    # Set wine to 32bit
    WINEARCH=win32
    WINEPREFIX=$HOME/.wine32
    EOF

    source $HOME/.profile

#### Filezilla

    sudo apt-get -y install filezilla

#### Google Chrome OpenSource - Chromium

    sudo apt-get -y install chromium-browser chromium-browser-l10n

#### Google Chrome

    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
    sudo sh -c 'echo "deb http://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

#### Salt client

    sudo add-apt-repository -y ppa:saltstack/salt
    sudo apt-get update
    sudo apt-get -qy install salt-minion

#### Misc

René Jochum's avatar
René Jochum committed
399
    sudo apt-get -y install sshfs unrar screen pwgen whois uuid
René Jochum's avatar
René Jochum committed
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501

#### LXC (Linux Container)

    sudo add-apt-repository -y ppa:ubuntu-lxc/stable
    sudo apt-get update
    sudo apt-get -y install lxc lxctl cgmanager uidmap

Default NAT Bridge:

    sudo sh -c 'cat <<EOF > /etc/default/lxc-net
    USE_LXC_BRIDGE="true"
    LXC_BRIDGE="mlabnatbr0"
    LXC_ADDR="10.167.161.1"
    LXC_NETMASK="255.255.255.0"
    LXC_NETWORK="10.167.161.0/24"
    LXC_DHCP_RANGE="10.167.161.100,10.167.161.254"
    LXC_DHCP_MAX="153"
    LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
    LXC_DOMAIN="mlabnat.pcdummy.lan"
    EOF'


By default other lxc hosts will go over my NAT interface:

    sudo sed -i -e's|lxc.network.link = lxcbr0|lxc.network.link = mlabnatbr0|' /etc/lxc/default.conf

Make `mlabnatbr0` the default for lxc:

    sudo sh -c 'cat <<EOF > /etc/lxc/default.conf
    lxc.network.type = veth
    lxc.network.link = mlabnatbr0
    lxc.network.flags = up
    lxc.network.hwaddr = 00:16:3e:xx:xx:xx
    EOF'

Install and configure radvd and dnsmasq for lxc `mlabnatbr0`:

    sudo apt-get -y install radvd
    sudo sh -c 'cat <<EOF > /etc/radvd.conf
    interface mlabnatbr0
    {
       # Advertise
       AdvSendAdvert on;

       # Maximum time between RAs
       MaxRtrAdvInterval 60;

       AdvManagedFlag on;

       prefix fd57:c87d:f1ee:ee01::1/64
       {
            # We are the only router. If we shut down, nobody else can route
            # this prefix -- tell clients about this.
            DeprecatePrefix on;
       };
    };
    EOF'

    sudo sh -c 'cat <<EOF > /etc/lxc/dnsmasq.conf
    dhcp-range=::add:0:0:100,::add:0:0:1e3, constructor:mlabnatbr0, 12h

    dhcp-option=option:all-subnets-local,1
    dhcp-option=option6:dns-server,[::]
    dhcp-option=option6:ntp-server,[::]
    dhcp-option=option:domain-search,mlabnat.pcdummy.lan
    EOF'

Create the lxd user and give him some permissions:

    sudo useradd -r -d /var/lib/lxd -s /bin/bash lxd # /bin/bash so i can "ssh lxd@localhost"
    sudo usermod -a -G lxd pcdummy
    # Give lxd 99 uid/gid ranges to map.
    for i in {1..99}; do
    	sudo usermod --add-subuids ${i}00000-${i}65536 lxd
    	sudo usermod --add-subgids ${i}00000-${i}65536 lxd
    done # This takes a while
    sudo mkdir /var/lib/lxd
    sudo chown lxd:lxd /var/lib/lxd
    sudo sudo -H -u lxd mkdir -p /var/lib/lxd/.config/lxc/
    sudo sudo -H -u lxd sh -c 'cat <<EOF > /var/lib/lxd/.config/lxc/default.conf
    lxc.include = /etc/lxc/default.conf
    lxc.id_map = u 0 100000 65537
    lxc.id_map = g 0 100000 65537
    EOF'

Allow userspace containers to use the network interfaces:

    echo 'lxd veth mlabnatbr0 100' | sudo tee -a /etc/lxc/lxc-usernet 1>/dev/null
    echo 'lxd veth mlabbr0 100' | sudo tee -a /etc/lxc/lxc-usernet 1>/dev/null

Restart lxc and lxc-net

    sudo service lxc stop
    sudo service lxc-net restart
    sudo service lxc start

For "ssh lxd@localhost"

    sudo apt-get -y install openssh-server
    sudo mkdir /var/lib/lxd/.ssh/
    sudo cp $HOME/.ssh/workkey.pub /var/lib/lxd/.ssh/authorized_keys
    sudo chown -R lxd:lxd /var/lib/lxd/.ssh/
René Jochum's avatar
René Jochum committed
502 503 504 505

#### Gimp

    sudo apt-get -y install gimp gimp-help-de gimp-plugin-registry
René Jochum's avatar
René Jochum committed
506 507 508 509 510 511 512 513 514 515 516

#### Rhythmbox [close on hide](http://askubuntu.com/a/454782)

    pushd .
    mkdir -p ~/.local/share/rhythmbox/plugins
    cd ~/.local/share/rhythmbox/plugins
    git clone https://github.com/fossfreedom/close-on-hide
    popd

  after close rhythmbox and open it again (real close), then enable
  the plugin, have fun.
René Jochum's avatar
René Jochum committed
517 518 519 520

#### DNS [.local fix](http://www.hexblot.com/blog/resolving-local-domains-linux)

At my employer we use a .local Domain, the above link shows you how to fix it.