Linux barebones quickstart: Difference between revisions

From Bitpost wiki
No edit summary
 
(48 intermediate revisions by the same user not shown)
Line 2: Line 2:
Set up [[Ubuntu quickstart|Ubuntu]] or [[Centos quickstart|Centos]] or some small embedded whateverism...
Set up [[Ubuntu quickstart|Ubuntu]] or [[Centos quickstart|Centos]] or some small embedded whateverism...


=== Set up IP ===
==== (Optional) Change the IP ====
DO THIS NOW, NEVER LET A CLONE USE THE SAME IP, you will tear your clothes and spit on the ground!
 
The only time to skip is if you are using DHCP.
If this is a VM clone, [[Set your IP|CHANGE YOUR IP NOW]] before you tear your hair out.
# on home lan, dnsmasq doles out the ips based on MAC, make sure you have it configured
 
# for static IPs on ubuntu work machines:
==== (Optional) Set up hostname ====
  sudo emacs /etc/network/interfaces
# for static IPs on centos work machines:
  sudo emacs /etc/sysconfig/network-scripts/ifcfg-ens192
  # For VMs, change network adapter if needed to match subnet (eg "LabNet8X")
# for virtualbox no changes were needed (as of yet)


=== Set up hostname ===
If you've cloned a VM, or you are using any "lite" OS that doesn't have an installer, you'll need to set your hostname to something unique, as a first step:
Note that this is not needed for a fresh install of ubuntu.  But if you've cloned a VM, you'll need to change hostname:
  sudo emacs /etc/hostname && sudo hostname newname  # use hostname cmd to set it right away
  sudo emacs /etc/hostname && sudo hostname newname  # use hostname cmd to set it right away
  # NOTE that systemd can also be used: sudo hostnamectl set-hostname newname
  # NOTE that systemd can also be used: sudo hostnamectl set-hostname newname
  # /etc/hosts changes should not be needed, if hostnames are properly configured (dnsmasq DNS -or- work DNS will provide resolution)
  # /etc/hosts changes should not be needed, if hostnames are properly configured (dnsmasq DNS -or- work DNS will provide resolution)


=== Install basic tools ===
==== (Optional) Set up user m ====
sudo apt install git curl emacs # ubuntu
sudo yum install git curl emacs # centos
git config --global user.email m@thedigitalmachine.com
git config --global user.name "Michael Behrns-Miller [##hostname##]"


=== Set up scripts ===
"Lite" OS installs will not add a user for you, so if you don't have user m, [[Add a user|add user m now]].
cd && mkdir development && cd development
git clone bitpost.com:development/scripts.git
./scripts/setup_linux.sh # to continue bootstrapping


==== (Optional) Limit system log size ====


Prevent endless system logging [[Systemd#Log_limit|here]].


=== Set up IP ===


=== in progress: move all this to setup_linux.sh and mh command ===
On home lan, bitpost dnsmasq doles out the ips based on MAC:
hostname # make note
ip address # make note of MAC - there may be more than one (eg: wired and wifi)
[bitpost#] emacs config/etc/dnsmasq.d/mdm_lan_dnsmasq.conf && sudo service dnsmasq restart
# reacquire IP on new box


=== Copy ssh keys ===
sudo apt install openssh-server # if needed (usually)
ssh newbox # via password
# 2022 keys
mkdir -p .ssh/2022
[bitpost#] scp -r .ssh/2022/id_ed25519* newguy:.ssh/2022/
cd .ssh && ln -s 2022/id_ed25519 . && cat 2022/id_ed25519.pub >> authorized_keys
It's time to deprecate this one...
# 2018 keys
mkdir -p .ssh/2018
[bitpost#] scp -r .ssh/2018/id_rsa* newguy:.ssh/2018/
cd .ssh && ln -s 2018/id_rsa . && cat 2018/id_rsa.pub >> authorized_keys


  cd && ln -s development/scripts scripts
=== Install basic tools ===
  mkdir scripts/[distro]/[new machine]
  sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
  emacs -nw .bashrc
   
  # export PATH=$HOME/scripts/[distro]/[machine]:$HOME/development/scripts/[distro]/i3:$HOME/development/scripts/[distro]:$PATH
  sudo apt install git curl emacs-nox # ubuntu server
  sudo apt install git curl emacs    # ubuntu desktop
sudo yum install git curl emacs-nox # centos


=== Set up ssh ===
=== Set up scripts ===
# openssh-server defaults are ok but see /etc/ssh/sshd_config for details
  cd && mkdir development && cd development
  cd ~/.ssh
  git clone morosoph:development/scripts.git  
scp [another-working-setup]:.ssh/authorized_keys .
  ./scripts/setup_linux.sh [desktop|nodesk] # to continue bootstrapping
scp [another-working-setup]:.ssh/id_rsa_3072_nopswd .
scp [another-working-setup]:.ssh/config .
ln -s id_rsa_3072_nopswd id_rsa
# also add any other private keys and run [chmod 400] on them
 
=== Set up config ===
cd ~/development
  git clone bitpost.com:development/config.git  
  cd config
mkdir -p [distro] && cd distro
cp -rp [existing machine] [new machine]
# EDIT IT ALL
# WARNING - EDIT ACTUAL SYSTEM FILES, NOT repo files, as those will get clobbered when you stow
# BACK EVERYTHING UP AS YOU GO until we get really good at this :-)
git add [new machine]
git commit -a -m "new machine" && git push
cd && ln -s /home/m/development/config/  optional:[gig]/  [distro]/[new machine] config


=== TODO config distro machine migration ===
That's it, get on with your life.
Start to revamp config from [machine]/[distro] to [distro]/[machine] to match scripts.  It's not hard even though it's dangerous.  You can do each machine separately from others.  Get on it!
# DO THIS ALL IN ONE SESSION, do not log out
cd development/config
mkdir -p distro # prolly not needed
git mv machine/distro distro/machine
setup_stow.sh # repeat until it doesn't fail; check each failure to make sure it is a symlink, and simply rm them as you go

Latest revision as of 20:33, 27 January 2023

Install the distro

Set up Ubuntu or Centos or some small embedded whateverism...

(Optional) Change the IP

If this is a VM clone, CHANGE YOUR IP NOW before you tear your hair out.

(Optional) Set up hostname

If you've cloned a VM, or you are using any "lite" OS that doesn't have an installer, you'll need to set your hostname to something unique, as a first step:

sudo emacs /etc/hostname && sudo hostname newname  # use hostname cmd to set it right away
# NOTE that systemd can also be used: sudo hostnamectl set-hostname newname
# /etc/hosts changes should not be needed, if hostnames are properly configured (dnsmasq DNS -or- work DNS will provide resolution)

(Optional) Set up user m

"Lite" OS installs will not add a user for you, so if you don't have user m, add user m now.

(Optional) Limit system log size

Prevent endless system logging here.

Set up IP

On home lan, bitpost dnsmasq doles out the ips based on MAC:

hostname # make note
ip address # make note of MAC - there may be more than one (eg: wired and wifi)
[bitpost#] emacs config/etc/dnsmasq.d/mdm_lan_dnsmasq.conf && sudo service dnsmasq restart
# reacquire IP on new box

Copy ssh keys

sudo apt install openssh-server # if needed (usually)
ssh newbox # via password
# 2022 keys
mkdir -p .ssh/2022
[bitpost#] scp -r .ssh/2022/id_ed25519* newguy:.ssh/2022/
cd .ssh && ln -s 2022/id_ed25519 . && cat 2022/id_ed25519.pub >> authorized_keys

It's time to deprecate this one...

# 2018 keys
mkdir -p .ssh/2018
[bitpost#] scp -r .ssh/2018/id_rsa* newguy:.ssh/2018/
cd .ssh && ln -s 2018/id_rsa . && cat 2018/id_rsa.pub >> authorized_keys

Install basic tools

sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y

sudo apt install git curl emacs-nox # ubuntu server
sudo apt install git curl emacs     # ubuntu desktop
sudo yum install git curl emacs-nox # centos

Set up scripts

cd && mkdir development && cd development
git clone morosoph:development/scripts.git 
./scripts/setup_linux.sh [desktop|nodesk] # to continue bootstrapping

That's it, get on with your life.