Precision 7540

From Geitenpad
Revision as of 12:26, 1 February 2025 by Rijk (talk | contribs) (Add users)
Jump to navigation Jump to search

Base System

Install Debian Gnome on preconfigured luks/lvm disk:

  1. Use Expert Install from the netinst ISO.
  2. Select rescue-mode in "Load installer components from installation media" step.
  3. Before the "Partition disks" step, select "Execute a shell".
  4. Use cryptsetup open on your LVM partition. Use lvs to confirm that your logical volumes are visible.
  5. Exit the shell and select "Partition disks". Use manual partitioning and mount the right LVs at /, /home, and swap.
  6. Proceed with the remaining installation steps, but stop before "Finish the installation".
  7. Go to "Execute a shell" again and edit /target/etc/crypttab to unlock your LUKS partition on boot.
  8. Exit the shell and select "Finish the installation".

Ad 7: The UUID must be filled, I used this command:

cryptsetup luksDump /dev/sda3 | grep -F UUID >> /target/etc/crypttab

Then I edited the file:

nano /target/etc/crypttab

cat /target/etc/crypttab
sda3_crypt UUID=[UUID from luksDump] none luks,discard

I also had to do:

update-initramfs -u -k all

https://www.reddit.com/r/debian/comments/1599rkt/how_to_reinstall_debian_12_with_existing/

Add users

Add users miel, oosterhoff and multimedia

useradd -d /home/oosterhoff -g 1003 -m -l -r -s /usr/sbin/nologin -u 1003 oosterhoff

Colored prompt and .bashrc

  • Add following to /etc/profile:
if [ "$SHELL" = "/bin/bash" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi
  • Add following to /root/.bashrc and /home/rijk/.bashrc:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

####################################################################
#####  Colored man pages   #########################################
####################################################################
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'

####################################################################
#####  Eternal bash history  #######################################
####################################################################
# Undocumented feature which sets the size to "unlimited".
# https://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="%d-%m-%Y %H:%M:%S "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
export HISTFILE=~/.bash_eternal_history

alias ls='ls --color=auto'
alias la='ls -la'
alias ll='ls -l'
alias bat='bat -P'

export EDITOR=vim

Prevent sleep

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

But also: https://geitenpad.rijkenmiel.nl/mediawiki/index.php/Lenovo_U410#Disable_sleep

LAMP

nala install mariadb-server mariadb-client
nala install apache2 apache2-utils
nala install ufw
ufw allow http
nala install php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
mysql_secure_installation

   Switch to unix_socket authentication [Y/n]. y
   Set root password? [Y/n]. n
   Remove anonymous users? [Y/n]. y
   Disallow root login remotely? [Y/n]. y
   Remove test database and access to it? [Y/n]. y
   Reload privilege tables now? [Y/n]. y

Add db user admin:

GRANT ALL PRIVILEGES ON *.* TO 'admin'@localhost IDENTIFIED BY 'password1';

See: https://wiki.debian.org/LaMp

Later we removed this, we are going full docker style!

Services

root@Geitenpad:~# nala install docker docker-compose git
root@Geitenpad:~# systemctl enable --now docker
root@Geitenpad:~# usermod -aG docker rijk
rijk@Geitenpad:~$ mkdir -p Development/git
rijk@Geitenpad:~$ cd Development/git/
rijk@Geitenpad:~/Development/git$ git clone git@gitlab.com:raginggoblin/docker-containers.git
root@Geitenpad:/etc/docker# cat daemon.json 
{ "dns" : [ "9.9.9.9" , "149.112.112.112" ] }