Alpine/Morefine: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(32 intermediate revisions by the same user not shown)
Line 96: Line 96:
reboot
reboot
</source>
</source>
==Install Minikube==
<source lang='bash'>
apk add curl libc6-compat
mkdir -p  /opt/cli/minikube-linux-amd64/bin
wget  -cq https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O /opt/cli/minikube-linux-amd64/bin/minikube
ln    -s  /opt/cli/minikube-linux-amd64/bin/minikube /usr/local/bin
chmod +x  /opt/cli/minikube-linux-amd64/bin/minikube
minikube version
minikube --help
</source>
<source lang='bash'>
wget  -cq "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -P /opt/cli/minikube-linux-amd64/bin/
ln    -s  /opt/cli/minikube-linux-amd64/bin/kubectl /usr/local/bin
chmod +x  /opt/cli/minikube-linux-amd64/bin/kubectl
kubectl version --output=yaml --client
kubectl version --output=yaml
kubectl --help
</source>
==Install Podman==
apk add tmux
apk add podman
apk add podman-docker
==Install Docker==
apk add docker docker-cli-compose
rc-update add docker boot
rc-service docker start
usermod -aG docker $USER
addgroup $USER docker
newgrp docker
mkdir -p $HOME/.docker
chown $(id -u):$(id -g) $HOME/.docker -R
chmod g+rwx $HOME/.docker -R
reboot
docker version


==Install QEMU==
==Install QEMU==
Line 141: Line 185:


<source lang='bash'>
<source lang='bash'>
apk add lxd
apk add lxd lxd-client
# enable service
# enable service
rc-update add lxd
rc-update add lxd
Line 150: Line 194:
rc-update add cgroups
rc-update add cgroups
rc-service cgroups start
rc-service cgroups start
</source>


<source lang='bash'>
lxd init
:'
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Name of the storage backend to use (dir, lvm) [default=dir]:
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 10.20.23.1/24
Would you like LXD to NAT IPv4 traffic on your bridge? [default=yes]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
Would you like the LXD server to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]:
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
'
</source>
<source lang='bash'>
# add cgfs to pam.d/system-login
# add cgfs to pam.d/system-login
echo "session    optional  pam_cgfs.so          -c freezer,memory,name=systemd,unified" >> /etc/pam.d/system-login
echo "session    optional  pam_cgfs.so          -c freezer,memory,name=systemd,unified" >> /etc/pam.d/system-login
Line 191: Line 256:
| valign="top" |
| valign="top" |
  lscpu
  lscpu
lsblk
  apk add fuse
  apk add fuse
  apk add ntfs-3g
  apk add ntfs-3g
  ls -lah /dev/sda*
  ls -lah /dev/sda*
apk add inetutils-telnet
|-
| colspan="3" |
----
|-
| valign="top" |
apk list --installed|grep ^bash
apk list --installed|grep  bash
| valign="top" |
apk search | grep ^bash
apk search | grep  bash
| valign="top" |
apk info --contents bash
apk info --rdepends bash


|-
|-
Line 305: Line 386:
| valign="top" |
| valign="top" |
  apk add htop
  apk add htop
ls -lah /etc/runlevels
ls -lah /etc/runlevels/default
ls -lah /etc/runlevels/sysinit
  pkcon remove busybox-symlinks-bash
  pkcon remove busybox-symlinks-bash


Line 338: Line 422:
* [https://wiki.alpinelinux.org/wiki/Xen_Dom0_on_USB_or_SD Alpine » Wiki » Xen Dom0 on USB or SD]
* [https://wiki.alpinelinux.org/wiki/Xen_Dom0_on_USB_or_SD Alpine » Wiki » Xen Dom0 on USB or SD]
* [https://wiki.alpinelinux.org/wiki/Setting_up_a_new_user Alpine » Wiki » Setting up a new user]
* [https://wiki.alpinelinux.org/wiki/Setting_up_a_new_user Alpine » Wiki » Setting up a new user]
* [https://collabnix.com/how-to-install-the-latest-version-of-docker-compose-on-alpine-linuxin-2022/ Alpine » Install Docker Compose]
* [https://stackoverflow.com/questions/57544746/ Alpine » Minkube Compatibility]
* [https://wiki.alpinelinux.org/wiki/Repositories Alpine » Wiki » Repositories]
* [https://wiki.alpinelinux.org/wiki/Repositories Alpine » Wiki » Repositories]
* [https://wiki.alpinelinux.org/wiki/OpenRC Alpine » Wiki » OpenRC]
* [https://wiki.alpinelinux.org/wiki/Docker Alpine » Wiki » Docker]
* [https://luppeng.wordpress.com/2020/02/28/install-and-start-postgresql-on-alpine-linux/ Alpine » PostgreSQL]
* [https://luppeng.wordpress.com/2020/02/28/install-and-start-postgresql-on-alpine-linux/ Alpine » PostgreSQL]
* [https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ Alpine » Kubectl]


|-
|-
Line 373: Line 462:
* [[Academia JavaEE Workspace in Ubuntu]]
* [[Academia JavaEE Workspace in Ubuntu]]
* [[Academia JavaEE Workspace in MacOS]]
* [[Academia JavaEE Workspace in MacOS]]
* [https://github.com/pgadmin-org/pgadmin4/blob/master/Dockerfile PgAdmin 4 » Dockerfile » Alpine]
* [https://github.com/better/alpine-tensorflow/blob/master/Dockerfile Tensorflow » Dockerfile » Alpine]
* [https://stackoverflow.com/questions/172587/ Difference between g++ & gcc]
* [[Linux Virtual Display for iPad Pro]]
* [https://stackoverflow.com/questions/50897640/ Python 3 Virtual Env & Docker]
* [https://github.com/OpenRC/openrc/blob/master/service-script-guide.md OpenRC Service Script Guide]
* [https://wiki.alpinelinux.org/wiki/Writing_Init_Scripts Alpine » Writing Init Scripts]
|-
| colspan="3" |
----
|-
| valign="top" |
* [https://serverfault.com/questions/974686/ Alpine » Converting a Systemd Service to OpenRC]
| valign="top" |
| valign="top" |


|}
|}

Latest revision as of 01:24, 10 July 2023

APK Local Repo

wget -cq https://uk.alpinelinux.org/alpine/v3.17/releases/x86_64/alpine-extended-3.17.1-x86_64.iso -P ${HOME}
mkdir /mnt/iso  && mount -o loop -t iso9660 ${HOME}/alpine-extended-3.17.1-x86_64.iso /mnt/iso
mkdir /var/repo && cp -r /mnt/iso/apks /var/repo/ && umount /mnt/iso && rm -rf /mnt/iso
rm -rf ${HOME}/alpine-extended-3.17.1-x86_64.iso

tee -a /etc/apk/repositories >>/dev/null <<EOF
/var/repo/apks
EOF

apk update
apk upgrade

Install Gnome

setup-xorg-base
rc-update add hwdrivers sysinit
rc-update add mdev sysinit
rc-service hwdrivers start
rc-service mdev start

apk add gnome
apk add gnome-apps-core
apk add gnome-apps-extra
rc-service gdm start
rc-update add gdm

apk add bash
apk add bash-completion
apk add thunar-volman
apk update
apk upgrade
adduser chorke -h /home/chorke
adduser chorke wheel
setup-desktop gnome
rc-update add hwdrivers sysinit
rc-update add mdev sysinit
rc-service hwdrivers start
rc-service mdev start

apk add gnome-apps-extra
apk add bash bash-completion

enabling gnome shell screen recording:
apk add pipewire pipewire-media-session gst-plugin-pipewire
troubleshooting gnome shell screen:
tail -n 100 -f var/log/gdm/greeter.log
less var/log/gdm/greeter.log
setup-devd udev
apk add bash
tee -a /etc/locale.conf >>/dev/null <<EOF
LANG=en_US.UTF-8

EOF

Install Xfce

free -h
adduser chorke -h /home/chorke
adduser chorke wheel

apk add doas vim
tee -a /etc/doas.conf >>/dev/null <<EOF
#
permit persist :wheel
EOF
cat /etc/apk/repositories
:'
http://dl-cdn.alpinelinux.org/alpine/v3.17/main
http://dl-cdn.alpinelinux.org/alpine/v3.17/community

#http://dl-cdn.alpinelinux.org/alpine/edge/main
#http://dl-cdn.alpinelinux.org/alpine/edge/community
#http://dl-cdn.alpinelinux.org/alpine/edge/testing
:'
setup-xorg-base
apk add xfce4 xfce4-terminal xfce4-screensaver lightdm-gtk-greeter dbus adwaita-icon-theme
rc-service lightdm start
rc-update add lightdm
rc-service dbus start
rc-update add dbus

apk add elogind polkit-elogind
reboot

Install Minikube

apk add curl libc6-compat
mkdir -p  /opt/cli/minikube-linux-amd64/bin
wget  -cq https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O /opt/cli/minikube-linux-amd64/bin/minikube

ln    -s  /opt/cli/minikube-linux-amd64/bin/minikube /usr/local/bin
chmod +x  /opt/cli/minikube-linux-amd64/bin/minikube

minikube version
minikube --help
wget  -cq "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -P /opt/cli/minikube-linux-amd64/bin/
ln    -s  /opt/cli/minikube-linux-amd64/bin/kubectl /usr/local/bin
chmod +x  /opt/cli/minikube-linux-amd64/bin/kubectl

kubectl version --output=yaml --client
kubectl version --output=yaml
kubectl --help

Install Podman

apk add tmux
apk add podman
apk add podman-docker

Install Docker

apk add docker docker-cli-compose
rc-update add docker boot
rc-service docker start

usermod -aG docker $USER
addgroup $USER docker
newgrp docker

mkdir -p $HOME/.docker
chown $(id -u):$(id -g) $HOME/.docker -R
chmod g+rwx $HOME/.docker -R

reboot
docker version

Install QEMU

apk add qemu qemu-img qemu-system-x86_64 qemu-ui-gtk
apk add py-libvirt virt-manager bridge-utils
apk add libvirt libvirt-daemon dbus polkit
apk add virt-install libvirt-client
apk add qemu-modules libvirt-qemu

adduser  "$(whoami)" qemu
addgroup "$(whoami)" kvm

rc-service libvirtd start
rc-update add libvirtd

rc-service libvirt-guests start
rc-update add libvirt-guests
check cpu for virtualization support:
egrep -c '(vmx|svm)' /proc/cpuinfo
lscpu|grep VT-x

apk add virt-what
virt-what
wget -cq https://uk.alpinelinux.org/alpine/v3.17/releases/x86_64/alpine-standard-3.17.1-x86_64.iso -P ${HOME}
qemu-system-x86_64 -m 512 -cdrom ${HOME}/alpine-standard-3.17.1-x86_64.iso
rm -rf ${HOME}/alpine-standard-3.17.1-x86_64.iso

Install LXD

cat /etc/apk/repositories
:'
http://dl-cdn.alpinelinux.org/alpine/v3.17/main
http://dl-cdn.alpinelinux.org/alpine/v3.17/community

#http://dl-cdn.alpinelinux.org/alpine/edge/main
#http://dl-cdn.alpinelinux.org/alpine/edge/community
#http://dl-cdn.alpinelinux.org/alpine/edge/testing
:'

apk update
apk upgrade
apk add lxd lxd-client
# enable service
rc-update add lxd
rc-service lxd start
rc-service lxd status

# configure system
rc-update add cgroups
rc-service cgroups start
lxd init
:'
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: 
Name of the storage backend to use (dir, lvm) [default=dir]: 
Would you like to connect to a MAAS server? (yes/no) [default=no]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: 
What should the new bridge be called? [default=lxdbr0]: 
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 10.20.23.1/24
Would you like LXD to NAT IPv4 traffic on your bridge? [default=yes]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
Would you like the LXD server to be available over the network? (yes/no) [default=no]: 
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: 
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: 
'
# add cgfs to pam.d/system-login
echo "session    optional   pam_cgfs.so          -c freezer,memory,name=systemd,unified" >> /etc/pam.d/system-login

# add user and group idmaps to lxc config
echo "lxc.idmap = u 0 100000 65536" >> /etc/lxc/default.conf
echo "lxc.idmap = g 0 100000 65536" >> /etc/lxc/default.conf

# add root and other users
echo "root:100000:65536" >> /etc/subuid
echo "root:100000:65536" >> /etc/subgid
brctl addbr lxdbr0
tee -a /etc/network/interfaces >>/dev/null <<EOF
auto lxdbr0
iface lxdbr0 inet dhcp
    bridge-ports eth0

EOF

Knowledge

df -hT
fdisk -l
apk update
ip addr show
ip link show
apk add lsblk
apk add parted
apk add util-linux
apk add smartmontools
apk add e2fsprogs-extra
lscpu
apk add fuse
apk add ntfs-3g
ls -lah /dev/sda*
apk add inetutils-telnet

apk list --installed|grep ^bash
apk list --installed|grep  bash
apk search | grep ^bash
apk search | grep  bash
apk info --contents bash
apk info --rdepends bash

parted -l
badblocks -v /dev/sda1 > ~/bad_sectors.txt
badblocks -v /dev/sda2 > ~/bad_sectors.txt
badblocks -v /dev/sda3 > ~/bad_sectors.txt
smartctl --version
smartctl -H /dev/sda1
smartctl -H /dev/sda2
smartctl -H /dev/sda3

apk add qemu
apk add qemu-system-ppc
apk add qemu-system-arm
apk add qemu-system-i386
apk add qemu-system-x86_64
apk add qemu-system-aarch64
apk add networkmanager
apk add networkmanager-ppp
apk add networkmanager-ovs
apk add networkmanager-adsl
apk add networkmanager-openvpn
apk add networkmanager-bluetooth
apk add iwd
apk add net-tools
apk add networkmanager-cli
apk add networkmanager-wifi
rc-update add networkmanager
rc-service networkmanager start

apk add sudo
setup-desktop gnome
apk add qemu-system-ppc64
apk add qemu-system-riscv64
rc-status
rc-status --list
rc-status --manual
rc-status --crashed
rc-service --list
rc-update add nginx
rc-update del nginx
rc-service --list | grep -i nginx

wget -cq https://uk.alpinelinux.org/alpine/v3.17/releases\
/x86_64/alpine-extended-3.17.1-x86_64.iso -P ~/ && mkdir /mnt/iso
mount -o loop -t iso9660 ~/alpine-extended-3.17.1-x86_64.iso /mnt/iso
mkdir /var/repo && cp -r /mnt/iso/apks /var/repo/ && rm -rf /mnt/iso
rm -rf ~/alpine-extended-3.17.1-x86_64.iso

tee -a /etc/apk/repositories >>/dev/null <<EOF
/var/repo/apks
EOF
apk add lsblk
apk add parted
modprobe dummy
apk add doas vim
adduser chorke wheel

ip link delete dummy0
cat /etc/group  | grep chorke
cat /etc/passwd | grep chorke

ssh-keygen -f ~/.ssh/known_hosts -R '10.19.83.20'
tee -a /etc/doas.conf >>/dev/null <<EOF
#
permit persist :wheel
EOF
apk add htop
ls -lah /etc/runlevels
ls -lah /etc/runlevels/default
ls -lah /etc/runlevels/sysinit
pkcon remove busybox-symlinks-bash

References