Last active
April 29, 2025 17:51
-
-
Save dudo/71686cdd45f6aa3833bcc3506797d3eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check disk names | |
lsblk -o NAME,MODEL,SIZE,TYPE,MOUNTPOINT | |
# Install required packages. nfs-common will be necessary on ALL clients | |
sudo apt update | |
sudo apt install -y mdadm nfs-kernel-server nfs-common | |
# Create the RAID 1 array from /dev/sda and /dev/sdb | |
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb <<EOF | |
yes | |
EOF | |
# Optional: wait briefly and check RAID status | |
sleep 5 | |
cat /proc/mdstat | |
# Format the RAID device with ext4 | |
sudo mkfs.ext4 /dev/md0 | |
# Create the mount point | |
sudo mkdir -p /mnt/raid1 | |
# Mount everything from fstab | |
echo '/dev/md0 /mnt/raid1 ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab | |
sudo mount -a | |
# Create the directory that will be exported over NFS | |
sudo mkdir -p /mnt/raid1/nfs | |
# Ensure export is owned by root | |
sudo chown root:root /mnt/raid1/nfs | |
sudo chmod 0777 /mnt/raid1/nfs | |
# Add the export to /etc/exports | |
echo '/mnt/raid1/nfs *(rw,sync,no_subtree_check,no_root_squash)' | sudo tee -a /etc/exports | |
# Apply the export changes and restart the NFS server | |
sudo exportfs -ra | |
sudo systemctl restart nfs-kernel-server | |
# Confirm everything is good | |
cat /proc/mdstat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download image to SD card | |
# Assuming you've configured your ~/.ssh/config file | |
ssh turingpi | |
cd /mnt/sdcard | |
wget https://firmware.turingpi.com/turing-rk1/ubuntu_22.04_rockchip_linux/v1.33/ubuntu-22.04.3-preinstalled-server-arm64-turing-rk1_v1.33.img.xz | |
xz -d ubuntu-22.04.3-preinstalled-desktop-arm64-turing-rk1_v1.32.img.xz | |
unxz ubuntu-22.04.3-preinstalled-server-arm64-turing-rk1_v1.33.img.xz | |
# Flash node | |
tpi flash --local --image-path /mnt/sdcard/ubuntu-22.04.3-preinstalled-server-arm64-turing-rk1_v1.33.img --node [N] | |
# Login | |
ssh [email protected] | |
# Default password is ubuntu | |
# Add SSH key | |
ssh-copy-id [email protected] | |
# Update the OS | |
sudo apt update | |
sudo apt -y upgrade | |
# Modify CPU governor | |
sudo vim /usr/lib/systemd/system/cpu-governor-performance.service | |
# ondemand | |
# Change the hostname | |
hostnamectl set-hostname rk1[N] | |
# Change the username | |
sudo apt install -y at | |
echo "sudo usermod -l dudo ubuntu" | sudo at now +1 minute | |
echo "sudo mv /home/ubuntu /home/dudo" | sudo at now +2 minute | |
echo "sudo usermod -d /home/dudo -m dudo" | sudo at now +3 minutes | |
exit | |
# Grab a drink | |
# Assuming you've configured your ~/.ssh/config file | |
ssh rk1[N] | |
# Update the username in the sudoers file | |
sudo su | |
sudo vi /etc/sudoers.d/90-cloud-init-users | |
# dudo ALL=(ALL) NOPASSWD:ALL | |
exit | |
# Turn it off and on again to make sure everything stuck | |
sudo reboot | |
# Format and mount the NVMe drive | |
sudo fdisk /dev/nvme0n1 | |
# g (create GPT) | |
# n (create new partition, accept defaults) | |
# w (write changes) | |
sudo mkfs.ext4 /dev/nvme0n1p1 | |
sudo mkdir -p /mnt/nvme | |
sudo mount /dev/nvme0n1p1 /mnt/nvme | |
UUID=$(sudo blkid -s UUID -o value /dev/nvme0n1p1) | |
echo "UUID=$UUID /mnt/nvme ext4 defaults 0 2" | sudo tee -a /etc/fstab | |
df -h | grep /mnt/nvme | |
# Disable swap | |
sudo swapoff -a | |
sudo rm -f /swapfile | |
# Configure DNS | |
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf | |
sudo tee /etc/systemd/network/10-eth0.network > /dev/null <<EOF | |
[Match] | |
Name=eth0 | |
[Network] | |
DHCP=yes | |
[DHCP] | |
UseDNS=yes | |
[Network] | |
DNS=1.1.1.1 | |
DNS=1.0.0.1 | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment