189 lines
3.7 KiB
Markdown
189 lines
3.7 KiB
Markdown
# Extra Repos
|
|
|
|
```sh
|
|
dnf update
|
|
dnf install epel-release
|
|
dnf install elrepo-release
|
|
dnf install rpmfusion-free-release
|
|
```
|
|
|
|
# System tools
|
|
|
|
```sh
|
|
dnf groupinstall "Development tools"
|
|
dnf install vim git zip htop iftop btop hdparm stress python3-pip
|
|
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
|
|
dnf install nodejs
|
|
```
|
|
|
|
# System test
|
|
|
|
```sh
|
|
btop
|
|
stress -c 4 -i 2 -d 1
|
|
```
|
|
|
|
# Oh My Posh
|
|
|
|
```sh
|
|
curl -s https://ohmyposh.dev/install.sh | bash -
|
|
mkdir -p .config/oh-my-posh/themes
|
|
wget -P .config/oh-my-posh/themes https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/capr4n.omp.json
|
|
wget -P .config/oh-my-posh/themes https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/aliens.omp.json
|
|
wget -P .config/oh-my-posh/themes https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/capr4n.omp.json
|
|
echo 'eval "$(oh-my-posh init bash --config ~/.config/oh-my-posh/themes/capr4n.omp.json)"' >> ~/.bashrc
|
|
exec bash
|
|
```
|
|
|
|
# FZF
|
|
|
|
```sh
|
|
dnf -y install fzf fd-find bat
|
|
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
|
~/.fzf/install
|
|
# Ctrl-t find files / directories
|
|
# Ctrl-r find in history
|
|
# Alt-c change directory
|
|
# kill -9 **TAB autocomplete option
|
|
```
|
|
|
|
# Encrypted Partition
|
|
|
|
```sh
|
|
# Create encrypted partition
|
|
dnf install cryptsetup
|
|
cryptsetup -y -v --type luks2 luksFormat /dev/nvme0n1p6
|
|
lsblk -f
|
|
|
|
# Mount luks
|
|
cryptsetup luksOpen /dev/nvme0n1p6 data
|
|
ls -l /dev/mapper/data
|
|
cryptsetup -v status data
|
|
cryptsetup luksDump /dev/nvme0n1p6
|
|
|
|
# Format ext4
|
|
dd if=/dev/zero of=/dev/mapper/data status=progress
|
|
mkfs.ext4 /dev/mapper/data
|
|
|
|
# Mount ext4
|
|
mkdir /data
|
|
mount /dev/mapper/data /data
|
|
df -h
|
|
ls -l /data
|
|
|
|
# Umount all
|
|
umount /data
|
|
cryptsetup luksClose data
|
|
```
|
|
|
|
# Change docker data Directory
|
|
|
|
```sh
|
|
docker info -f '{{ .DockerRootDir }}' # /var/lib/docker
|
|
systemctl stop docker.socket
|
|
systemctl stop docker
|
|
echo '{"data-root": "/data/docker"}' > /etc/docker/daemon.json
|
|
systemctl start docker
|
|
systemctl start docker.socket
|
|
docker info -f '{{ .DockerRootDir }}' # /data/docker
|
|
mv /var/lib/docker /var/lib/docker.old
|
|
```
|
|
|
|
# Enable rc.local
|
|
|
|
`/etc/rc.local`
|
|
|
|
```sh
|
|
#!/bin/bash
|
|
# Add terminal commands here without sude
|
|
|
|
# Make sure the script will "exit 0" on success
|
|
# or any other value on error.
|
|
exit 0
|
|
```
|
|
|
|
`/etc/systemd/system/rc-local.service`
|
|
|
|
```sh
|
|
[Unit]
|
|
Description=/etc/rc.local Compatibility
|
|
ConditionPathExists=/etc/rc.local
|
|
|
|
[Service]
|
|
Type=forking
|
|
ExecStart=/etc/rc.local start
|
|
TimeoutSec=0
|
|
StandardOutput=tty
|
|
RemainAfterExit=yes
|
|
SysVStartPriority=99
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
```sh
|
|
chmod +x /etc/rc.local
|
|
systemctl enable rc-local
|
|
systemctl start rc-local.service
|
|
systemctl status rc-local.service
|
|
```
|
|
|
|
# Get password service
|
|
|
|
`/opt/password.py`
|
|
|
|
```sh
|
|
#! /usr/bin/python3
|
|
from aiohttp import web
|
|
async def sendpass(request):
|
|
data = {"password": "12345678"}
|
|
return web.json_response(data)
|
|
app = web.Application()
|
|
app.add_routes([web.get('/andthepasswordis', sendpass)])
|
|
web.run_app(app, port=9999)
|
|
```
|
|
|
|
`python3 -m pip install aiohttp`
|
|
|
|
`/lib/systemd/system/password.service `
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=Custom Python Service
|
|
After=multi-user.target
|
|
Conflicts=getty@tty1.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
ExecStart=/usr/bin/python3 /opt/password.py
|
|
StandardInput=tty-force
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
```sh
|
|
systemctl daemon-reload
|
|
systemctl enable password
|
|
systemctl start password.service
|
|
systemctl status password.service
|
|
```
|
|
|
|
`/etc/systemd/system/docker-stop.service`
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=Stop docker and umount luks data partition before shutting down
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=true
|
|
ExecStop=/opt/docker-stop.sh
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
```sh
|
|
systemctl daemon-reload
|
|
systemctl enable docker-stop
|
|
systemctl status docker-stop
|
|
``` |