Add tech_docs/linux/arch_deploy.md
This commit is contained in:
197
tech_docs/linux/arch_deploy.md
Normal file
197
tech_docs/linux/arch_deploy.md
Normal file
@@ -0,0 +1,197 @@
|
||||
### Theme: Space Exploration
|
||||
|
||||
#### Username: **astronaut**
|
||||
#### Password: **stardust123** (Note: Use a strong password in a real setup)
|
||||
#### Hostname: **spaceship**
|
||||
#### Domain Name: **galaxy.local**
|
||||
|
||||
### Step-by-Step Opinionated Arch Linux Setup with Space Theme
|
||||
|
||||
#### Step 1: Verify Boot Mode
|
||||
Ensure your system is booting in UEFI mode:
|
||||
```bash
|
||||
ls /sys/firmware/efi/efivars
|
||||
```
|
||||
If this directory exists, you are in UEFI mode.
|
||||
|
||||
#### Step 2: Partition the Disk
|
||||
Format and mount the partitions:
|
||||
```bash
|
||||
mkfs.fat -F32 /dev/sda1 # EFI partition
|
||||
mkswap /dev/sda2 # Swap partition
|
||||
mkfs.ext4 /dev/sda3 # Root partition
|
||||
|
||||
mount /dev/sda3 /mnt
|
||||
mkdir /mnt/boot
|
||||
mount /dev/sda1 /mnt/boot
|
||||
swapon /dev/sda2
|
||||
```
|
||||
|
||||
#### Step 3: Install the Base System
|
||||
Install the base packages:
|
||||
```bash
|
||||
pacstrap /mnt base linux linux-firmware vim
|
||||
```
|
||||
|
||||
#### Step 4: Generate `fstab`
|
||||
Generate the `fstab` file:
|
||||
```bash
|
||||
genfstab -U /mnt >> /mnt/etc/fstab
|
||||
```
|
||||
|
||||
#### Step 5: Chroot into the New System
|
||||
Change root into the new system:
|
||||
```bash
|
||||
arch-chroot /mnt
|
||||
```
|
||||
|
||||
#### Step 6: Set Locale and Timezone
|
||||
1. **Set locale**:
|
||||
- Edit `/etc/locale.gen` to uncomment your locale (e.g., `en_US.UTF-8`):
|
||||
```bash
|
||||
vim /etc/locale.gen
|
||||
```
|
||||
- Generate the locale:
|
||||
```bash
|
||||
locale-gen
|
||||
```
|
||||
|
||||
2. **Set timezone**:
|
||||
```bash
|
||||
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
|
||||
hwclock --systohc
|
||||
```
|
||||
|
||||
#### Step 7: Set Hostname and Hosts
|
||||
1. **Set hostname**:
|
||||
```bash
|
||||
echo "spaceship.galaxy.local" > /etc/hostname
|
||||
```
|
||||
|
||||
2. **Edit `/etc/hosts`**:
|
||||
```bash
|
||||
vim /etc/hosts
|
||||
```
|
||||
Add the following lines:
|
||||
```
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
127.0.1.1 spaceship.galaxy.local spaceship
|
||||
```
|
||||
|
||||
#### Step 8: Set Root Password
|
||||
Set a strong password for the root user:
|
||||
```bash
|
||||
passwd
|
||||
```
|
||||
For this guide, we'll use `stardust123` as the root password.
|
||||
|
||||
#### Step 9: Create a Regular User Account
|
||||
Create a user account and add it to the sudo group:
|
||||
```bash
|
||||
useradd -m astronaut
|
||||
usermod -aG sudo astronaut
|
||||
passwd astronaut
|
||||
```
|
||||
For this guide, we'll use `stardust123` as the user password.
|
||||
|
||||
#### Step 10: Install Bootloader
|
||||
Install GRUB for UEFI:
|
||||
```bash
|
||||
pacman -S efibootmgr grub
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ArchLinux
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
```
|
||||
|
||||
#### Step 11: Exit Chroot and Reboot
|
||||
Exit the chroot environment and reboot:
|
||||
```bash
|
||||
exit
|
||||
umount -R /mnt
|
||||
reboot
|
||||
```
|
||||
|
||||
### Post-Installation Configuration
|
||||
|
||||
#### Step 12: Secure SSH
|
||||
1. **Install SSH**:
|
||||
```bash
|
||||
sudo pacman -S openssh
|
||||
```
|
||||
|
||||
2. **Configure SSH**:
|
||||
- Open the SSH configuration file:
|
||||
```bash
|
||||
sudo nano /etc/ssh/sshd_config
|
||||
```
|
||||
- Make the following changes:
|
||||
- Change `PermitRootLogin` to `no`.
|
||||
- Change `PasswordAuthentication` to `no`.
|
||||
- Add `PubkeyAuthentication yes`.
|
||||
- Add `AuthorizedKeysFile .ssh/authorized_keys`.
|
||||
- Save the file and restart the SSH service:
|
||||
```bash
|
||||
sudo systemctl enable sshd
|
||||
sudo systemctl start sshd
|
||||
```
|
||||
|
||||
3. **Set Up SSH Keys**:
|
||||
- Generate an SSH key pair on your client machine:
|
||||
```bash
|
||||
ssh-keygen -t rsa -b 4096
|
||||
```
|
||||
- Copy the public key to your Arch Linux server:
|
||||
```bash
|
||||
ssh-copy-id astronaut@your_server_ip
|
||||
```
|
||||
|
||||
#### Step 13: Network Configuration
|
||||
1. **Install NetworkManager**:
|
||||
```bash
|
||||
sudo pacman -S networkmanager
|
||||
```
|
||||
|
||||
2. **Enable NetworkManager**:
|
||||
```bash
|
||||
sudo systemctl enable NetworkManager
|
||||
sudo systemctl start NetworkManager
|
||||
```
|
||||
|
||||
3. **Configure DHCP for Ethernet**:
|
||||
- Ensure the interface `enp0s25` (or whatever your interface is named) is set to use DHCP:
|
||||
```bash
|
||||
nmcli d
|
||||
nmcli con mod enp0s25 ipv4.method auto
|
||||
nmcli con up enp0s25
|
||||
```
|
||||
|
||||
#### Step 14: Install a Minimal Desktop Environment (Optional)
|
||||
If you want a minimal desktop environment, consider installing Xorg and a lightweight window manager like i3 or dwm.
|
||||
|
||||
1. **Install Xorg**:
|
||||
```bash
|
||||
sudo pacman -S xorg-server xorg-xinit
|
||||
```
|
||||
|
||||
2. **Install a Window Manager**:
|
||||
```bash
|
||||
sudo pacman -S i3
|
||||
```
|
||||
|
||||
3. **Configure Xinit**:
|
||||
- Create a `.xinitrc` file in your home directory:
|
||||
```bash
|
||||
echo "exec i3" > ~/.xinitrc
|
||||
```
|
||||
|
||||
4. **Start X**:
|
||||
```bash
|
||||
startx
|
||||
```
|
||||
|
||||
### Final Notes
|
||||
- **Firewall**: Consider setting up a firewall using `ufw` or `firewalld`.
|
||||
- **Regular Updates**: Regularly update your system using `sudo pacman -Syu`.
|
||||
- **Backup**: Regularly back up important data.
|
||||
|
||||
This setup guide provides a secure, minimal, and opinionated configuration for Arch Linux with a fun space-themed scheme. Adjustments can be made based on your specific needs and preferences.
|
||||
Reference in New Issue
Block a user