Dell Optiplex

From Geitenpad
Jump to navigation Jump to search

Install base system

Add users

  • Rijk added during installation
  • Add miel
root@knollendonk:/root# adduser miel
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_US:en",
	LC_ALL = (unset),
	LC_PAPER = "nl_NL.UTF-8",
	LC_ADDRESS = "nl_NL.UTF-8",
	LC_MONETARY = "nl_NL.UTF-8",
	LC_NUMERIC = "nl_NL.UTF-8",
	LC_TELEPHONE = "nl_NL.UTF-8",
	LC_IDENTIFICATION = "nl_NL.UTF-8",
	LC_MEASUREMENT = "nl_NL.UTF-8",
	LC_TIME = "nl_NL.UTF-8",
	LC_NAME = "nl_NL.UTF-8",
	LANG = "en_US.UTF-8"
   are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Adding user `miel' ...
Adding new group `miel' (1001) ...
Adding new user `miel' (1001) with group `miel' ...
Creating home directory `/home/miel' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for miel
Changing the user information for miel
Enter the new value, or press ENTER for the default
	Full Name [Margaretha Daniëlle Oosterhoff]: Margaretha Danielle Oosterhoff
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n]

Repair locale

root@ppl:~# update-locale LC_ALL="en_US.UTF-8"

Install utilities

root@knollendonk:/home/rijk# apt-get install vim aptitude screen htop tree curl mlocate locate rsync

Push keys to .ssh/authorized_keys

  • Public keys from ppl and laptop
rijk@knollendonk:~/.ssh$ cat authorized_keys 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxYiIBDAFN1MGWMjlhSy4kRviofAah/C8fK03y+9Anze8QpeKeIneQgJZAJnf02ZJSff61gL6MEIkb4NPykXnlAGWYH+2MCLpaY2sCz4sRAeGRYj4T1XYD/E5T6oUbY9h0fAzMpsmxcl1ihK0mEIyg2qgjW0lb4zaiw1hLyPoUyRIgPWdt07CTuOdHXXfHCDReTFoO1MHoMmW8tkCTx20BREEcSl2geyAFilnQGvN4UPTW13bnYHLE+9OFnZhf4Mj9U6ZkwOVfVaw2y5hpYSnhWy57GbVOD3lq4Ksjhc/48bssnVUbZNq6M79+y8CFgbaQLy0+DUwe6676uoTFl2mZ rijk@rijksUreich
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqnUWYjHAYJ7ROgm1E7bkoATG64OfUBTTXQ8gxt0WqoiI7pfMtmMW5ZsJMsXhkuyPU1QeSosdOMA4GtOv1bgabAeE6T/4UN+RjcFAmugfLeDfNkQsaKZMFTgSoczDxfBpZdUB4FoXR1SelRwoGRZ5NsXbMjXD0SgNlmfiBA0BJrO3X+btNqzDunmVsvxJHw/57foyfJlWE9/eAK3ZTvRIT9f0Vt46mxm1LPcQEJFLhGXFICX8Xddow6lobA1xno2SI6rnK0Hj1+flQ3kflWn8MeHc/S8Y9qnvcTHNfQ/TlzoglknQ7NTfwvJ/bMP+HGcWsyzXUPbJFin0E3y+2v1J/ rijk@paardenpad.xs4all.nl

Syntax on in vim

root@knollendonk:# vim /root/.vimrc
  • Add line
syntax on

Colored prompt

  • Change to .bashrc to .bashrc from suse:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples 

# If not running interactively, don't do anything
case $- in
   *i*) ;;
     *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
   xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
   if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
   fi
fi

if [ "$color_prompt" = yes ]; then
   PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
   PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
   PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
   ;;
*)
   ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
   test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
   alias ls='ls --color=auto'
   #alias dir='dir --color=auto'
   #alias vdir='vdir --color=auto'

   #alias grep='grep --color=auto'
   #alias fgrep='fgrep --color=auto'
   #alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
   . /usr/share/bash-completion/bash_completion
 elif [ -f /etc/bash_completion ]; then
   . /etc/bash_completion
 fi
fi

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  • Set colors in .bashrc
Root: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
User: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  • For user add file .bash_profile:
rijk@knollendonk:~$ cat .bash_profile 
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
   . ~/.bashrc
fi
  • Log off and on for changes to take effect

Samba

root@knollendonk:~# aptitude install samba
root@knollendonk:/etc/samba# mv smb.conf smb.conf.org
root@knollendonk:/etc/samba# vim smb.conf
root@knollendonk:~# cat /etc/samba/smb.conf
[global]
       netbios name = DESKTOPSERVER
       workgroup = PAARDENPAD
       server string = Samba %v on (%L)
       encrypt passwords = Yes
       name resolve order = bcast host
       local master = No
       os level = 33
       load printers = no
       printing = bsd
       printcap name = /dev/null
       disable spoolss = yes
[rijk]
      path = /home/rijk/Documents
      guest ok = No
      comment = Rijks documents
      writable = Yes
[miel]
       path = /home/miel
       guest ok = No
       comment = Miels documents
       writable = Yes
#[oosterhoff]
#        path = /home/oosterhoff
#        guest ok = No
#        comment = Shared documents
#        writable = yes


root@knollendonk:/etc/samba# smbpasswd -a miel
root@knollendonk:/etc/samba# smbpasswd -a rijk
root@knollendonk:/etc/samba# service nmbd restart
root@knollendonk:/etc/samba# service smbd restart

Duplicity

  • Install Duplicity
root@knollendonk:~# aptitude install duplicity
  • Make backup script
root@knollendonk:~/scripts# vim backupDuplicity
#!/bin/bash

echo `date`
export PASSPHRASE=SomeLongGeneratedHardToCrackKey
duplicity /home/rijk/Documents file:///media/Backup/Documents
unset PASSPHRASE
  • Make it executable
root@knollendonk:~/scripts# chmod +x backupDuplicity
  • Add it to crontab
0  19 * * 0 root /root/scripts/backupDuplicity >> /var/log/backupDuplicity.log

/etc/fstab

/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part1 /                    ext4       acl,user_xattr        1 1
/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part2 /var                 ext4       acl,user_xattr        1 2
/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part9 swap                 swap       defaults              0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part5 /home/rijk           ext4       defaults              1 2
/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part6 /home/miel           ext4       defaults              1 2
/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part8 /media/sda8          ext4       defaults              1 2
/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part7 /media/sda7          ext4       defaults              1 2
/dev/disk/by-id/ata-WDC_WD5000AAKX-001CA0_WD-WMAYUM482566-part10 /media/sda10         ext4       acl,user_xattr        1 2
/dev/disk/by-id/ata-Maxtor_6L160M0_L39NPB7G-part1 /media/sdb1          ext4       acl,user_xattr        1 2

/etc/crontab

root@knollendonk:~# cat /etc/crontab 
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 
# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
# 

00 23 * * * root /root/scripts/stopThisMachine

 
 #00 14 * * * root /root/scripts/preCacheSFPG.py > /var/log/preCacheSFPG.log
 
 #43 22 * * * root /root/scripts/backupCSP
 #44 22 * * * root /root/scripts/backupOC
 #45 22 * * * root /root/scripts/backupEgw
 50 22 * * * root /root/scripts/adjustHwClock
 55 22 * * * root /root/scripts/setUserRights
 00 23 * * * root /root/scripts/stopThisMachine
 #00  * * * * root /root/scripts/wakeOpenShift