Postgrep - Install od Debian Kategoria: MySQL i inne bazy | Tagi: postgres | Autor: Bartłomiej Gałęzia

aptitude install postgresql postgresql-contrib php-pgsql

check version

sudo -u postgres psql -c "SELECT version();"
vim /etc/postgresql/11/main/pg_hba.conf
local all postgres trust
service postgresql restart
sudo su - postgres -c "createuser miethek" //create user
sudo su - postgres -c "createdb empg" //create db
GRANT ALL PRIVILEGES ON DATABASE empg TO miethek;

Połączenie z innych adresów:

vim /etc/postgresql/11/main/postgresql.conf
listen_addresses = '*'
vim /var/lib/pgsql/data/pg_hba.conf
host  all  all 0.0.0.0/0 md5
service postgresql restart

Źródło: https://linuxize.com/post/how-to-install-postgresql-on-debian-10/

$serverName = "serverName";
$connectionInfo = array( "Database"=>"DbName",
                         "UID"=>"UserName",
                         "PWD"=>"Password",
                         "Encrypt"=>true,
                         "TrustServerCertificate"=>true);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

Źródło: https://stackoverflow.com/questions/14959492/connecting-to-mssql-from-php-securely-with-encryption

PHP - Connect to MSSQL database Kategoria: PHP | Tagi: codeigniter, mssql, php | Autor: Bartłomiej Gałęzia

add-apt-repository ppa:ondrej/php -y
apt-get update
apt-get install aptitude vim mc nmap curl apache2 php php-dev php-xml php-pear
apt-get install unixodbc-dev

sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv

printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.1/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.1/mods-available/pdo_sqlsrv.ini

phpenmod -v 8.1 sqlsrv pdo_sqlsrv

curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list

sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install -y unixodbc-dev

service apache2 restart



https://forum.codeigniter.com/thread-69740-post-350441.html

https://learn.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver16#installing-the-drivers-on-ubuntu-1604-for-php-70

https://learn.microsoft.com/en-us/sql/connect/php/system-requirements-for-the-php-sql-driver?redirectedfrom=MSDN&view=sql-server-ver16

https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16

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/

Wkhtmltopdf - Page Break Kategoria: PHP | Tagi: wkhtmltopdf | Autor: Bartłomiej Gałęzia

HTML

<div class="new-page"></div>

CSS

@media print {
    .new-page {
        page-break-after: always;
    }
}

lub bezpośrednio w HTML

<div style="page-break-after: always;"></div>

Ważne!

Znacznik "new-page" nie może być wewnątrz znacznika <section> bo nie zadziała.

Czasami (np.: na serwerach CyberFolks) trzeba dodaj w komendzie --print-media-type

wkhtmltopdf --print-media-type http://domena.pl/file.html file_pdf.pdf

Przy próbie połączenia przez CURL z Cyber Folks do Zenbox pokazuje się błąd.

"Please wait while your request is being verified..."

"500 Internal Server Error openresty".

Trzeba to zgłosić do Zenboxa, żeby odblokowali IP serwera źródłowego na firewallu.

https://panel.zenbox.pl/index.php?m=pomoc&page=show-ticket&id=1098515

[#QJIV-9351-ECMM] - ticket z 2024.01.11 nr 1314686

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

Netbeans 13 - Line wrap Kategoria: PHP | Autor: Bartłomiej Gałęzia

Tools -> Options -> Editor -> Formatting

Language: All languages

Line wrap: Anywhere

[Apply]

Źródło: https://smallbusiness.chron.com/wrap-lines-netbeans-49331.html

Acronis - Register agent after server change Kategoria: Acronis | Tagi: acronis, agent | Autor: Bartłomiej Gałęzia

Linux OS

/usr/lib/Acronis/RegisterAgentTool/RegisterAgent -o register -a http://192.168.1.100 -u [username] -p [userpass]

 

Windows OS

Open Command prompt and navigate to C:\Program Files\Acronis\RegisterAgentTool:

cd "%ProgramFiles%\Acronis\RegisterAgentTool"

Issue this command to register the client machine using account and password:

register_agent.exe -o register -a http://192.168.1.100 -u [username] -p [userpass]

 

Źródło: https://kb.acronis.com/content/55244#Linux_OS3

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ść

Windows 10 - Autologowanie Kategoria: Windows | Autor: Bartłomiej Gałęzia

Download and unzip:

https://download.sysinternals.com/files/AutoLogon.zip

Run AutoLogon.exe

Type user login and password

Click Enable

Źródło: https://docs.microsoft.com/pl-pl/sysinternals/downloads/autologon

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/

instalacja wolumenu

lvcreate -n nazwa_wolumenu -L 100G nazwa_grupy

ściągamu Boot_media.iso (https://kb.acronis.com/getmedia) i kopiujemy z niego kernel i ramdisc

wget -c https://[server.acronis]/Boot_media.iso
mount -t iso9660 iso-cd/Boot_media.iso /mnt/iso/
cp /mnt/iso/install.amd/abr64ker.dat /xen/kernels/acronis/abr64ker.dat
cp /mnt/iso/install.amd/lin64ram.dat /xen/kernels/acronis/lin64ram.dat

config do instalacji z iso

vim /xen/nazwa_maszyny/nazwa_configa.cfg
kernel = "/xen/kernels/acronis/abr64ker.dat"
ramdisk = "/xen/kernels/acronis/lin64ram.dat"
vcpus = '1'
memory = '512'

root = '/dev/xvda1 ro'
disk = [
'phy:/dev/xenvms/nazwa_wolumenu,xvda,w'
,'file:/xen/ISOs/Boot_media.iso,hdc:cdrom,r'
]
name = 'nazwa_maszyny'
vif = [ 'mac=00:11:22:33:44:55,bridge=xenbr0' ]
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'

#uruchomienie maszyny z podłączeniem do konsoli

xm create nazwa_configa.cfg -c

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

 

Wyszukaj

Zapisz się do newsletera