Others

format usb

Login as super

fdisk -l

mkfs.ext4 /dev/sdb1

mkfs.vfat /dev/sdb1

mkfs.vfat -n ‘Label’ -I /dev/sda

list all hdd’s with name and mount point

lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL

Apache2

make config file slavy.conf in /etc/apache2/sites-available with this rows:

ServerName slavy.site
ServerAlias www.slavy.site
ServerAdmin [email protected]
DocumentRoot /var/www/example.com/public_html/install

sudo a2ensite slavy.conf – start site

sudo a2dissite slavy.conf – stop site

in /etc/apache2/saits-available/000-default.conf is default apache2 config website file

How to make Apache more secure by hiding directory folders

sudo nano /etc/apache2/apache2.conf

<Directory /> section

We’ll edit this section:

Options Indexes FollowSymLinks
AllowOverride None
Require all granted

Switch off Indexes by removing the Indexes option. The new section will look like this:

Options FollowSymLinks
AllowOverride None
Require all granted

save and close

sudo systemctl reload apache2

Apache2: Could not reliably determine the server’s fully qualified domain name

sudo nano /etc/apache2/apache2.conf
and add 
ServerName localhost   

Force SSH server to public key autentication only

sudo nano /etc/ssh/sshd_config

To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PubkeyAuthentication yes

reverse proxy to jellyfin:

1. Покупка на домейн име и настройката на DNS records към ай.пи.то на моя мултимедиен сървър
2. Пренасочване на на порт 443 в рутера към вътрешното ай.пи на сървъра – моя интернет доставчик е А1 и съм им благодарен, че са наистина много бързи и ми оказаха съдействие буквално за минути, понеже Аз нямам достъп до настройките на рутера им
3. Позволяване на порт 443 в защитната стена на сървъра
sudo ufw allow 443
4. Активиране на прокси и ревърс прокси за Апаче
sudo a2enmod proxy
sudo a2enmod proxy_http
5. Създаване на конфиг файл във Апаче, като името на домейна ще приемем, че е example.com
sudo nano /etc/apache2/sites-available/example.com.conf
6. Добавяне информацията за DNS във конфигурационният файл на сайта, както и информацията за проксито. Конфигурационният файл трябва да изглежда така:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin [email protected]
    ErrorLog /var/log/apache2/jellyfin-error.log
    CustomLog /var/log/apache2/jellyfin-access.log combined

    ProxyPreserveHost On

    ProxyPass “/embywebsocket” “ws://127.0.0.1:8096/embywebsocket”
        ProxyPassReverse “/embywebsocket” “ws://127.0.0.1:8096/embywebsocket”

    ProxyPass “/” “http://127.0.0.1:8096/
        ProxyPassReverse “/” “http://127.0.0.1:8096/
</VirtualHost>

Затворете и запазете файла!

7. Актиниране на конфигурационният файл
sudo a2ensite example.com.conf
8. Рестартиране на Апаче
 sudo systemctl restart apache2

9. Ако всичко е направино правилно трябва вече да имаме достъп до нашият Jellyfin използвайки домейн името.
Отваряме браузъра и тестваме – http://www.example.com и също example.com
Следва издаване на така нужният ни SSL сертификат:
10. Инсталираме certbot
sudo apt install python3-certbot-apache -y
11. Поискване на сертификат за нашият сайт
sudo certbot -d example.com -d www.еxample.com
Следваме стъпките които трябва да се минат и попълваме коректно всичко което трябва да се попълни и всичко което ни пита кертбота
Ако всичко е ОК на последния ред от процедурата ще ви изпише – Поздравленя!
Тествайте в браузъра отново
12. Автоматично подновяване на сертификата – Мисля, че стандартно сертификатите идват за 3 месеца, но можем да овтоматизираме този процес и кертбота да дава нов такъв всеки мисец. Влезте в:
cd /etc/systemd/system/timers.target.wants
13. Активирайте автоматичното подновяване
sudo systemctl enable certbot.timer

Reverse proxy to trtansmission-daemon web ui

Всичко е същото като при jellyfin-а с изклйчение на 2 неща:

  1. Спираме трансмисията: sudo service transmission-daemon stop , отваряме конфигурационният файл на демона: sudo nano /var/lib/transmission-daemon/info/settings.json и променете реда: “bind-address-ipv4”: “0.0.0.0”, на “bind-address-ipv4”: “127.0.0.1”, стартираме трансмисията sudo service transmission-daemon start
  2. Променяме информацията във конфигурационният файл за апаче sudo nano /etc/apache2/sites-available/example.com.conf и трябва да изглежда така:

<VirtualHost *:80>
ServerName brsradio.club
ServerAlias www.brsradio.club
ServerAdmin [email protected]
ErrorLog /var/log/apache2/transmission-error.log
CustomLog /var/log/apache2/transmission-access.log combined

ProxyPreserveHost On

ProxyPass "/embywebsocket" "ws://127.0.0.1:9091/embywebsocket"
    ProxyPassReverse "/embywebsocket" "ws://127.0.0.1:9091/embywebsocket"

ProxyPass "/" "http://127.0.0.1:9091/"
    ProxyPassReverse "/" "http://127.0.0.1:9091/"
</VirtualHost>

Enable SSL certificate on a active website

sudo apt install python3-certbot-apache -y

sudo certbot –apache -d slavy.site -d www.slavy.site

to enable autorenew ssl:

cd /etc/systemd/system/timers.target.wants

sudo systemctl enable –now certbot.timer

to renew manualy all active websites with expired dates on ssl:

sudo certbot renew

sudo certbot certificates - листване на всички валидни сертификати в системата

sudo certbot delete --cert-name yourwebsite.com - изтриване на сертификат със име yourwebsite.com

Add and Delete Users

signin as root
adduser newuser – ad user
usermod -aG sudo newuser – make hime with sudo previlegy

deluser --remove-home newuser
cat /etc/passwd - see all registered users

HDD write permision:

i mount different hdd’s in /mnt like: /mnt/160gb /mnt/320gb etc.. then change ownershep like thath:

sudo chown root:plugdev /mnt/320gb

this work on local filesystem and also in NFS

Firewall ufw

sudo ufw status verbose
sudo ufw status numbered
sudo ufw delete 8
sudo ufw add 9091

Azuracast

Mounting a Directory Into a Station

You may want to add music to a station from a directory on your host machine without copying the data into AzuraCast. You can mount the directory into your stations and web container to make them available to AzuraCast by creating a docker-compose.override.yml.

In the same folder where your Docker installation is (if using recommended instructions, this is /var/azuracast), create a new file named docker-compose.override.yml.

In this file, paste the following contents:

services:
  web:
    volumes:
      - /path/on/host/computer:/var/azuracast/stations/<STATION_NAME>/media/

Replace the <STATION_NAME> with the name of the station directory found under the "Administration" section of the station's profile settings and modify the /path/on/host/computer with the path to the directory that you want to mount.

You will need to restart your Docker containers using 
docker-compose down, then 
docker-compose up -d 
to apply any changes made to this file.

Docker start
sudo systemctl start docker
sudo systemctl stop docker
sudo systemctl start or stop docker.cluster
sudo systemctl status docker or docker.cluster

SSH/TransferFiles

scp <file> <username>@<IP address or hostname>:<Destination>

NFS mount command

sudo mount 192.168.100.100:/jellyfin /mnt/4tb

Auto Mount Drive in Ubuntu Server 22.04 at Startup

sudo blkid

UUID=21886435-6c57-46d5-b345-74d6cb928ba6 /jellyfin ext4 defaults 0 2

192.168.0.216:/mnt/HDD1    /media/freenas/    nfs    defaults,nofail    0 0 

How to List the Connected Devices

ip route | grep default
sudo apt-get install nmap
nmap -sn ip-address/24

Add user to group

sudo adduser username groupname

How to Update Firmware on Ubuntu

sudo apt install fwupd
fwupdmgr get-devices
fwupdmgr refresh
fwupdmgr get-updates
fwupdmgr update

Install VMWare Workstation Player 

Download it from vmware or

cd ~/Downloads
wget https://files03.tchspt.com/down/VMware-Workstation-Full-17.5.2-23775571.x86_64.bundle

sudo apt update
sudo apt install build-essential
gcc --version

ls -l
sudo chmod +x VMware-Player-Full-17.5.0-22583795.x86_64.bundle
sudo sh VMware-Player-Full-17.5.0-22583795.x86_64.bundle

wget https://github.com/mkubecek/vmware-host-modules/archive/workstation-17.5.0.tar.gz
  tar -xzf workstation-17.5.0.tar.gz
  cd vmware-host-modules-workstation-17.5.0
  make
  make install

sudo vmware-modconfig --console --install-all
openssl req -new -x509 -newkey rsa:2048 -keyout VMWARE17.5.priv -outform DER -out VMWARE17.5.der -nodes -days 36500 -subj "/CN=VMWARE/"
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE17.5.priv ./VMWARE17.5.der $(modinfo -n vmmon)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE17.5.priv ./VMWARE17.5.der $(modinfo -n vmnet)
tail $(modinfo -n vmmon) | grep "Module signature appended"
sudo mokutil --import VMWARE17.5.der

reboot the system then on the prompt screen continue to boot.

Unable to install all modules.See log /tmp/vmware/vmware-{Host}-vmware-14067.log for details.(Exit code1)

git clone https://github.com/mkubecek/vmware-host-modules
cd vmware-host-modules
git checkout workstation-16.2.3
sudo make ; sudo make install

reboot

Static IP configuration
How to Transfer All MySQL Databases From Old to New Server

Migrate Let's Encrypt Certificates (Certbot) To New Server

How to list all SSL certificates issued by certbot and how to delete one

How to Initialize/Enable a Swap Partition

swapon --show
sudo swapon [disk_path]
swapon --show
sudo nano /etc/fstab
/dev/[disk_path] none swap sw 0 0
sudo mysql -u root
SHOW DATABASES;
DROP DATABASE dbname;

DROP USER 'developer'@'localhost'; - изтрива юзър

We have share on windows machine – 192.168.100.223/smbwin with read acces for user smbuser

sudo apt apt update && sudo apt install samba smbclient cifs-utils
sudo mkdir /smbmount
sudo chmod -R 777 /smbmount
sudo nano /etc/samba/smb.conf 

In the section WORKGROUP add following line:

client max protocol = NT1

Save and close the file then reload the service

sudo service smbd restart
sudo mount -t cifs -o username=smbuser //192.168.100.223/smbwin /smbmount

Then provide your pass

Install Jellyfin Media Server

We can install simply Jellyfin using this comand:

curl https://repo.jellyfin.org/install-debuntu.sh | sudo bash

Increase PHP Allowed Memory

You can easily do this by editing the azuracast.env located in /var/azuracast/.

There you can find the following entry:
# PHP's maximum memory limit.
# PHP_MEMORY_LIMIT=128M

Change this to look like this:

# PHP's maximum memory limit.
PHP_MEMORY_LIMIT=1024M

After you have changed this setting you need to restart AzuraCast via

sudo docker-compose down && sudo docker-compose up -d

How to Increase Your PHP RAM no docker installation

sudo nano /etc/php/8.1/cli/php.ini

Find memory_limit and change it. Save the file and reload apache

sudo systemctl reload apache2

USB Ethernet adapter refusing to work on Ubuntu Server

How to set up Multiple networks and routing using new Ubuntu Netplan?

Printer problems go on:

http://localhost:631/admin

Install Qortal Node

wget https://github.com/Qortal/qortal/releases/latest/download/qortal.zip
unzip qortal.zip
cd qortal
cat apikey.txt
if dont have API just create one
nano settings.json

-------------------

{
  "apiKeyEnabled": true,
  "apiKey": "OLJF3..................o940ij",
  "apiDocumentationEnabled": true,
  "apiWhitelistEnabled": false,
  "apiRestricted": false,
  "api": {
    "enabled": true,
    "bindAddress": "0.0.0.0",
    "port": 12391
  }
}

---------------------

./start.sh
sudo ufw allow 12391
cat qortal.log
sudo nano /etc/systemd/system/qortal.service

---------------

[Unit]
Description=Qortal Core Node
After=network.target

[Service]
User=slavy
WorkingDirectory=/home/slavy/qortal
ExecStart=/home/slavy/qortal/start.sh
Restart=always
RestartSec=10
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

-----------

nano /home/slavy/qortal/start.sh

-------------

#!/bin/bash
cd "$(dirname "$0")"
exec java -jar qortal.jar

---------------

sudo systemctl daemon-reload
sudo systemctl enable qortal
sudo systemctl start qortal
sudo systemctl status qortal