Self-Hosted Infrastructure
Crypto farming. WIP.
These instructions assume you're on a POSIX-compliant operating system. See Installation.
You'll need the following:
- USB Thumb Drive - 8 GB minimum
- A machine to download the
.iso
image. and burn it to the USB thumb drive. - Target machine with CPU, RAM, and a Network Interface Card
- Could even be a Raspberry Pi
Choose Operating System Kernel & User Space
Download the corresponding .iso
file.
Burn ISO Image to USB
lsblk
Your output will look something like this.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 7.5G 0 disk
├─sda1 8:1 1 2.6G 0 part
├─sda2 8:2 1 5M 0 part
├─sda3 8:3 1 300K 0 part
└─sda4 8:4 1 4.9G 0 part
zram0 254:0 0 4G 0 disk [SWAP]
nvme0n1 259:0 0 3.6T 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot
└─nvme0n1p2 259:2 0 3.6T 0 part /var/log
/var/cache/pacman/pkg
/home
/.snapshots
/
nvme1n1 259:3 0 1.9T 0 disk
The sda
storage block is the USB and is highlighted in green above. Modern Linux systems use the sd
prefix to indicate 'Storage Device'. a
refers to the first detected device.
If you had other external storage devices connected, the letter for your newly connected USB will be different because it was discovered later (sdb
, sdc
, etc.).
The entries in the tree following sda
such as sda1
, sda2
etc. indicate disk storage partitions.
Unmount all partitions.
sudo umount /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4
# Change location to whereever your .iso file is located
sudo dd if=~/Downloads/ubuntu-24.04.1-live-server-amd64.iso of=/dev/sda bs=4M status=progress oflag=sync
After completion:
sudo eject /dev/sda
Set up server
Flash OS from USB to Server Hardware
Boot into USB from BIOS.
After installation completes, log in to your machine.
sudo apt update && sudo apt upgrade -y && \
sudo apt install openssh-server net-tools && \
sudo systemctl enable ssh && \
sudo systemctl start ssh && \
sudo systemctl status sshd # Verify service running
Configure SSH for External Access (WIP)
Same Network
ip addr
ssh username@<machine_ip_addr>
# ssh user@10.0.1.2
Different Networks
Set up port forwarding from router.
Find public IP address
curl ifconfig.me
Harden SSH Security:
Disable root login in /etc/ssh/sshd_config
.
PermitRootLogin no
Port 2222
sudo systemctl restart sshd
Install Nix
# Answer 'y' for all questions
sh <(curl -L https://nixos.org/nix/install) --daemon --yes
exit
Log in again.
nix-env -iA nixpkgs.zellij
zellij
zellij attach
Optional
nix-env -iA nixpkgs.{git,gh,stow,zsh,ripgrep,fd,yazi,eza,bat,cowsay,cmatrix,lolcat,nyancat,fastfetch}
}
Install Oh My Zsh, a framework to easily customize the look and feel of zsh.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Install PowerLevel10K, a theming system for the Oh My Zsh framework.
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k;
Change value of ZSH_THEME
in ~/.zshrc
:
sed -i 's/^ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc; source ~/.zshrc
If the Powerlevel10k configuration menu doesn't start, do:
p10k configure
Install and configure useful zsh plugins.
# Autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# Syntax Highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sed -i 's/^plugins=(.*)$/plugins=(git zsh-autosuggestions zsh-syntax-highlighting web-search)/' ~/.zshrc
cat << 'EOF' >> ~/.zshrc
# Aliases
alias l='eza -lh --icons=auto'
alias ls='eza --icons=auto --sort=name --group-directories-first'
alias ll='eza -lha --icons=auto --sort --group-directories-first'
alias ld='eza -lhD --icons=auto'
alias lt='eza --icons=auto --tree'
alias y='yazi'
alias mkdir='mkdir -p'
EOF
source ~/.zshrc
Install Pnpm
curl -fsSL https://get.pnpm.io/install.sh | sh - && \
if [ -n "$ZSH_VERSION" ]; then source ~/.zshrc; elif [ -n "$BASH_VERSION" ]; then source ~/.bashrc; fi
pnpm env use 22.13.1 --global
Install Playwright
pnpx playwright install --with-deps
Set up GitHub Actions Runner
Visit github.com/organizations/cuhacking/settings/actions/runners/new
for steps.