Skip to content

Commit

Permalink
Save notes on Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
dpurge committed Jun 10, 2024
1 parent 13bb8ed commit 0e7aeaf
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
55 changes: 55 additions & 0 deletions content/docs/devops/linux/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,58 @@ lvdisplay
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
```

## Generalize cloud image

```sh
sudo cloud-init clean
sudo rm -rf /var/lib/cloud/instances
sudo truncate -s 0 /etc/machine-id
sudo rm /var/lib/dbus/machine-id
sudo ln -s /etc/machine-id /var/lib/dbus/machine-id
sudo poweroff
```

## LXC server setup

Add user and install basic software:

```sh
adduser david
usermod -aG sudo david
sudo apt update
sudo apt dist-upgrade
sudo apt install curl wget git neovim mc tmux python3 jq golang sqlite3 autofs ca-certificates net-tools

sudo wget https://github.com/mikefarah/yq/releases/download/v4.44.1/yq_linux_amd64 -O /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq

wget https://github.com/google/go-jsonnet/releases/download/v0.20.0/jsonnet-go_0.20.0_linux_amd64.deb -O /tmp/jsonnet.deb
sudo apt install /tmp/jsonnet.deb
rm /tmp/jsonnet.deb

curl --fail --location --progress-bar --output /tmp/deno.zip https://github.com/denoland/deno/releases/download/v1.44.1/deno-x86_64-unknown-linux-gnu.zip
sudo unzip -d /usr/local/bin -o /tmp/deno.zip
rm /tmp/deno.zip

wget https://github.com/go-task/task/releases/download/v3.37.2/task_linux_amd64.deb -O /tmp/task.deb
sudo apt install /tmp/task.deb
rm /tmp/task.deb
```

Generalize image:

```sh
sudo apt clean
sudo apt autoremove
sudo rm /etc/ssh/ssh_host_*
sudo truncate -s 0 /etc/machine-id
sudo poweroff
```

Prepare container after creation from image:

```sh
sudo dpkg-reconfigure openssh-server

```
3 changes: 2 additions & 1 deletion content/docs/devops/qemu/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ bookCollapseSection: true
---

Manual:

```sh
qemu-img create -f qcow2 ubuntu.img 50G
qemu-system-x86_64 -boot d -cdrom ubuntu.iso -m 4G -smp 2 -hda ubuntu.img -nic user,hostfwd=tcp::8888-:22
# reboot without cdrom
qemu-system-x86_64 -m 4G -smp 2 -hda ubuntu.img -nic user,hostfwd=tcp::8888-:22 -virtfs local,path=$PWD,mount_tag=host0,security_model=passthrough,id=host0 -nographic
```
```

0 comments on commit 0e7aeaf

Please sign in to comment.