Kategoria - Linux - liczba wpisów 191
Debian, Ubuntu, Fedora

Usuwanie pierwszej linii z długiego pliki Kategoria: Linux | Tagi: mysqldump, mysql, tail | Autor: Bartłomiej Gałęzia

tail -n +2 source_file.txt > destination_file.txt

Przydatne przy odtwarzaniu bazy danych gdzie mysqldump dodaje na początku zabezpieczenie:

/*!999999\- enable the sandbox mode */

Źródło: https://stackoverflow.com/questions/339483/how-can-i-remove-the-first-line-of-a-text-file-using-bash-sed-script

HEIC to JPG batch convetion Kategoria: Linux | Autor: Bartłomiej Gałęzia

sudo apt install libheif-examples
for file in *.HEIC; do heif-convert $file ${file%.HEIC}.jpg; done

Źródło: https://ubuntuhandbook.org/index.php/2021/06/open-heic-convert-jpg-png-ubuntu-20-04/

yum remove epel-release

yum clean all

sudo yum -y install yum-utils

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

sudo yum install certbot

sudo yum install certbot-nginx

Źródło: https://stackoverflow.com/questions/53545436/no-package-certbot-available

Ubuntu 20 - Lock screen not working Kategoria: Linux | Autor: Bartłomiej Gałęzia

Menu -> Settings -> Keyboard -> Application shortcuts -> [+Add]

dm-tool lock -> Super + L

Źródło: https://askubuntu.com/questions/1242110/after-upgrading-to-ubuntu-20-04-lockscreen-not-working

Debian 10 - Possible missing firmware Kategoria: Linux | Tagi: aptitude, debian, nvidia | Autor: Bartłomiej Gałęzia

after aptitude install

W: Possible missing firmware /lib/firmware/nvidia/gp100/gr/sw_method_init.bin for module nouveau
W: Possible missing firmware /lib/firmware/nvidia/gp100/gr/sw_bundle_init.bin for module nouveau
W: Possible missing firmware /lib/firmware/nvidia/gp100/gr/sw_nonctx.bin for module nouveau
W: Possible missing firmware /lib/firmware/nvidia/gp100/gr/sw_ctx.bin for module nouveau
W: Possible missing firmware /lib/firmware/nvidia/gp100/gr/gpccs_sig.bin for module nouveau
W: Possible missing firmware /lib/firmware/nvidia/gp100/gr/gpccs_data.bin for module nouveau
W: Possible missing firmware /lib/firmware/nvidia/gp100/gr/gpccs_inst.bin for module nouveau
...
vim /etc/apt/sources.list

change this

deb http://deb.debian.org/debian/ buster main

to this

deb http://deb.debian.org/debian/ buster main non-free contrib
aptitude update
aptitude install nvidia-detect
nvidia-detect
Detected NVIDIA GPUs:
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF100 [GeForce GTX 480] [10de:06c0] (rev a3)

Checking card:  NVIDIA Corporation GF100 [GeForce GTX 480] (rev a3)
Your card is only supported up to the 390 legacy drivers series.
It is recommended to install the
    nvidia-legacy-390xx-driver
package.
aptitude install nvidia-legacy-390xx-driver

Źródło: https://linuxconfig.org/how-to-install-nvidia-driver-on-debian-10-buster-linux

KVM - Migrate Virtualbox to KVM Kategoria: Linux | Tagi: kvm, migrate, Virtualbox | Autor: Bartłomiej Gałęzia

1. Stop the VirtualBox machine.

2. Convert VDI Image to RAW Disk Format

vboxmanage clonehd --format RAW /home/user/VirtualBox_VMs/Debian_vm.vdi /home/user/VirtualBox_VMs/Debian_vm.img

3. Copy RAW image to KVM server

rsync -av --progress /home/user/VirtualBox_VMs/Debian_vm.img user@kvmserver:/home/kvm/Debian_vm.img

4. Convert RAW Image Disk Format to KVM Format

qemu-img convert -f raw Debian_vm.img -O qcow2 Debian_vm.qcow2

Źródło: https://www.tecmint.com/migrate-virtualbox-vms-into-kvm-vms/

KVM - Change default storage location Kategoria: Linux | Tagi: kvm, virsh | Autor: Bartłomiej Gałęzia

mkdir /home/images
virsh pool-destroy default
virsh pool-edit default

change

<path>/var/lib/libvirt/images</path>

to

<path>/home/images</path>
virsh pool-start default

Create new pool for ISO files

virsh pool-define-as --name iso --type dir --target /home/iso/
virsh pool-start iso
virsh pool-autostart iso

https://ostechnix.com/how-to-change-kvm-libvirt-default-storage-pool-location/

- Shut down the guest machine.
- In the 'Display spice' section, select "All interfaces" instead of 'Localhost only' in "Address"
- Restart the guest machine


https://askubuntu.com/questions/780862/virt-manager-to-remote-host-continuous-password-prompt-over-ssh

Plik konfiguracyjny z wirtualką na XEN

kernel = '/usr/lib/xen-4.8/boot/hvmloader'
builder = 'hvm'

vcpus       = '1'
memory      = '2048'
shadow_memory = 8

localtime = 1

#  Disk device(s).
disk        = [
                'file:/xen/ISO/Boot_media.iso,hdb:cdrom,r',
                'phy:/dev/xenvms/restore_disk,xvda,w'

              ]

boot = "dc"

#  Hostname
name        = 'system_restore'

#  Networking
vif         = [ 'mac=00:11:22:33:44:55,bridge=xenbr0' ]

vnc=1
vncconsole=1
vncpasswd='password'

vncunused = 1
vnclisten = '192.168.1.1'

stdvga = 0
serial = 'pty'
usbdevice = 'tablet' # Required for USB mouse


##  Behaviour
on_shutdown = 'destroy'
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

Zobacz całość

Ubuntu 18 - Change grub order Kategoria: Linux | Autor: Bartłomiej Gałęzia

vim /etc/default/grub
GRUB_DEFAULT=saved
update-grub
grub-set-default 2
reboot

Źródło: https://studysection.com/blog/how-to-change-boot-order-in-ubuntu-18-04-from-grub2-to-set-windows-as-default-launch/

QEMU/KVM - Install server on Debian Kategoria: Linux | Tagi: kvm, virtual | Autor: Bartłomiej Gałęzia

1. Hardware check

egrep -c '(vmx|svm)' /proc/cpuinfo
grep -E --color '(vmx|svm)' /proc/cpuinfo

2. Install packages

sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager -y

3. Check libvirt status

sudo systemctl status libvirtd.service

4. Add user to libvirt and libvirt-qemu group

adduser user1 libvirt
adduser user1 libvirt-qemu
newgrp libvirt
newgrp libvirt-qemu

5. Create bridged network card

vim /etc/network/interfaces
iface enp6s0 inet manual
auto br0
iface br0 inet manual
bridge_ports enp6s0

https://www.linuxtechi.com/install-configure-kvm-debian-10-buster/

https://www.cyberciti.biz/faq/install-kvm-server-debian-linux-9-headless-server/

https://pl.euro-linux.com/blog/wirtualizacja-bez-kompromisow-kilka-slow-o-kvm-qemu-libvirt-i-virt-manager/

bez wpisywania hasła wiele razy

https://askubuntu.com/questions/780862/virt-manager-to-remote-host-continuous-password-prompt-over-ssh

 

Unifi Network Controller on Raspberry Pi Kategoria: Linux | Autor: Bartłomiej Gałęzia

sudo apt-get install haveged -y
sudo apt-get install openjdk-8-jre-headless -y
echo 'deb http://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
sudo apt-get update && sudo apt-get install unifi -y
https://localhost:8443 

https://www.youtube.com/watch?v=VH8b6ocohHU

[New Server]

apt-get install python-ldap libldap2-dev
mkdir /root/samba3

[Old Server]

/etc/init.d/samba stop
rsync -aP /var/lib/samba/private/secrets.tdb root@[new_server]:/root/samba3/
rsync -aP /var/lib/samba/wins.dat root@[new_server]:/root/samba3/
rsync -aP /var/lib/samba/winbindd_idmap.tdb root@[new_server]:/root/samba3/
rsync -aP /etc/samba/smb.conf root@[new_server]:/root/samba3/

[New Server]

vim /root/samba3/smb.conf
netbios name = [new_server]

Uwaga!! "Workgroup" w nowym i starym pliku smb.conf musi być taka sama.

samba-tool domain samba3upgrade --dbdir=/root/samba3/ --realm='''MYDOMAIN.COM''' /root/samba3/smb.conf

Po migracji:

vim /etc/samba/smb.conf
dns forwarder = 8.8.8.8
#       idmap_ldb:use rfc2307 = yes
vim /etc/nsswitch.conf
passwd:         files winbind
group:          files winbind

https://samba.tranquil.it/doc/en/samba_advanced_methods/samba_migrate_from_samba3_to_samba-ad.html

RSYNC - Limit prędkości Kategoria: Linux | Autor: Bartłomiej Gałęzia

rsync --bwlimit=1000 /path/to/source /path/to/dest/

https://www.cyberciti.biz/faq/how-to-set-keep-rsync-from-using-all-your-bandwidth-on-linux-unix/

Debian 10 - nslookup command not found Kategoria: Linux | Autor: Bartłomiej Gałęzia

aptitude install dnsutils

Problem

E: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'

Rozwiązanie

apt-get --allow-releaseinfo-change update

OCS Reports - Install agent on Linux Kategoria: Linux | Tagi: OCS | Autor: Bartłomiej Gałęzia

aptitude install make libmodule-install-perl dmidecode libxml-simple-perl libcompress-zlib-perl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl libcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl libproc-daemon-perl net-tools libsys-syslog-perl pciutils smartmontools read-edid nmap libnet-netmask-perl
wget http://path.to.ocsagent/Ocsinventory-Unix-Agent-2.8.1.tar.gz
tar -xvzf Ocsinventory-Unix-Agent-2.8.1.tar.gz
cd Ocsinventory-Unix-Agent-2.8.1
perl Makefile.PL
make
make install
Where do you want to write the configuration file? /etc/ocsinventory
Specify log file path you want to use?  /var/log/ocs_agent.log
Do you want disable SSL CA verification configuration option (not recommended) ? [y]
Do you want to set CA certificate chain file path ? [n]

https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers/

OCS Reports - Install on Debian 10 Kategoria: Linux | Tagi: debian, debian10, OCS | Autor: Bartłomiej Gałęzia

1. Packages

apt-get update
apt-get install aptitude sudo vim mc nmap screen make cmake gcc make apache2 libapache2-mod-perl2 libapache-dbi-perl libapache-db-perl libapache2-mod-php mariadb-server mariadb-client software-properties-common php7.3 libapache2-mod-php7.3 php7.3-common php7.3-sqlite3 php7.3-mysql php7.3-gmp php7.3-curl php7.3-mbstring php7.3-gd php7.3-cli php7.3-xml php7.3-zip php7.3-soap php7.3-json php-pclzip git curl perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl libapache-dbi-perl libapache2-mod-perl2 libapache2-mod-perl2-dev

2. Mysql

sudo mysql_secure_installation
sudo mysql -u root -p

Zobacz całość

Dell PowerEdge R210 II - Debian 10 network card drivers Kategoria: Linux | Autor: Bartłomiej Gałęzia

http://ftp.br.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_20190114-2_all.deb

mkdir /mnt/usb
mount /dev/sdb /mnt/usb
cp /mnt/usb/firmware-bnx2_20190114-2_all.deb /root/
cd /root
PATH=/usr/bin
dpkg -i firmware-bnx2_20190114-2_all.deb
vim /etc/apt/sources.list
deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

https://debian.pkgs.org/10/debian-nonfree-arm64/firmware-bnx2_20190114-2_all.deb.html

Wyszukaj

Zapisz się do newsletera