Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Monday, August 5, 2024

windows: disable fast start for multiple OS (dual boot)

Hibernation saves an image of your work and shuts down your computer or put your computer into sleep mode.

Fast Startup only saves an image of the system kernel and loaded drivers to reduce boot time.

Fast Startup may not suitable for System:

  1. multiple os except you never access/share data between multiple os.
  2. maintenance
  3. hardware change

Step to disable fast startup 

  1. Search -> Choose a power plan -> Choose what the power buttons do -> Change settings that are currently unavailable
  2. uncheck "Turn on fast start (recommendation)"
  3. save change and restart

 

Wednesday, July 17, 2024

Debian: using Festival to generate voice from text (Text To Speech/TTS) - AI TTS

folder voice

$ ls /usr/share/festival/voices/english/

Using command interpreter:

$ festival
...
festival> (voice.list)
(kal_diphone)
festival> (SayText "Hello")
#<Utterance 0x7f8747f99ef0>

festival> (quit)

Load text from file output direct to sound

$ festival --tts ./hello.txt 

Load text from file output direct to file

$ text2wave ./hello.txt -o text1.wav

Sunday, February 11, 2024

Openssl s_client to verify SSL

Syntax general: openssl s_client [-connect host:port] [option]

 

Get and read openssl s_client output 

$ echo "Get HTTP/1.0" | openssl s_client google.com:443
CONNECTED(00000003)
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1                        <- verification chain 2 ok
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1                        <- verification chain 1 ok
depth=0 CN = *.google.com
verify return:1                        <- verification chain 0 ok
---
Certificate chain
 0 s:CN = *.google.com
   i:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
   a:PKEY: id-ecPublicKey, 256 (bit); sigalg: RSA-SHA256
   v:NotBefore: Jan  9 06:25:08 2024 GMT; NotAfter: Apr  2 06:25:07 2024 GMT
 1 s:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
   i:C = US, O = Google Trust Services LLC, CN = GTS Root R1
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Aug 13 00:00:42 2020 GMT; NotAfter: Sep 30 00:00:42 2027 GMT
 2 s:C = US, O = Google Trust Services LLC, CN = GTS Root R1
   i:C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
   a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
   v:NotBefore: Jun 19 00:00:42 2020 GMT; NotAfter: Jan 28 00:00:42 2028 GMT
---
Server certificate
-----BEGIN CERTIFICATE-----
... <TRUNCATED> ...
-----END CERTIFICATE-----
subject=CN = *.google.com
issuer=C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: ECDSA
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 6833 bytes and written 396 bytes
Verification: OK                    <- handshake verification ok
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 256 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---

Use openssl s_client to export certificate PEM into a file (output file: certfs.pem)

$ echo "Get HTTP/1.0" | openssl s_client -showcerts -connect google.com:443 </dev/null | sed -n -e '/-.BEGIN/,/-.END/ p' > certifs.pem
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1
depth=0 CN = *.google.com
verify return:1
DONE

Get fingerprint SHA1 in byte

$ echo "Get HTTP/1.0" | openssl s_client -connect google.com:443 < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin

Fingerprint SHA256 in byte

$ echo "Get HTTP/1.0" | openssl s_client -connect google.com:443 < /dev/null 2>/dev/null | openssl x509 -fingerprint -sha256 -noout -in /dev/stdin

Fingerprint SHA256 in base64 encode

$ echo "Get HTTP/1.0" | openssl s_client -connect google.com:443 | \
    openssl x509 -pubkey -noout | \
    openssl rsa -pubin -outform der | \
    openssl dgst -sha256 -binary | \
    openssl enc -base64 

To get service sertificates

$ echo "Get HTTP/1.0" | openssl s_client -connect google.com.com:443 -showcerts

For Let's Encrypt, here is official information about compatibility platforms (operating system, browser and java virtual machine,  <link>

Reference:

  • https://www.openssl.org/docs/man1.0.2/man1/openssl-s_client.html
  • https://www.baeldung.com/linux/ssl-certificates


Friday, January 26, 2024

Personal mysql/mariadb sql command references

Using mysqladmin 

Set password root using mysqladmin

# mysqladmin -u root password

Using mysql client

$ mysql -u [user_name] -p

Show users:

> select User from mysql.user;

Add user:

> create user `test`@`localhost`;
> SELECT User FROM mysql.user;

Set user password

> alter user [user_name] identified by [new_password];

Show database:

> show databases;

Add database:

> create database `test`;
> SHOW DATABASES;
> grant all privileges on test.* to 'test'@'localhost` ;
> flush privileges;

Show table:

> use test;
> show tables;

create table:

> use test;
> create table product(id mediumint, name varchar(100));

Note: Do not use root account to create user table, use particular user to create table.
 


Monday, November 6, 2023

repair grub after windows updating bios on lenovo ideaPad gaming 3 AMD 7535h (15”)

Insert Debian installer DVD/CD or USB and change boot order

  1. Keep press shift + restart windows -> troubleshoot -> UEFI Firmware Setting -> Restart
  2. Change boot order to Debian installer media

Boot into Debian

  1. Boot into Debian installer DVD/CD or USB, then press c to enter grub command. If the screen goes blank (for CD boot older then existing grub version), press ESC until you get prompt grub>
  2. Get Debian partition using grub> ls and find Filesystem type ext* or your existing filesystem (see the picture below)
  3. Get Debian grab from Debian partition e.q grub> ls (hd0,gpt7)/boot and find Debian grub folder  (see the picture below) 
  4. Run command to start existing Debian e.q
grub> set root=(hd0,gpt7)
grub> set prefix=(hd0,gpt7)/boot/grub
grub> insmod normal
grub> normal
 
Your Debian will appear in boot option

Repair grub using 

# grub-install
# update-grub

Every time you update your firmware via windows, your grub boot will lost. It's so annoying. Unfortunately, there is not much tool available to automatically check and update bios for Debian. Debian still stable using old bios, but not in windows.  

Monday, July 17, 2023

Debian Bookworm: Configure printer and scanner HP Ink 415 Wireless (all in one)

Install required packages for printer and scanner

# apt-get install system-config-printer hplip cups hplip-ppds  

To configure printer:

  1. Applications -> Settings -> Print Settings
  2. Add new printer
  3. Select Network Printer -> AppSocket/HP JetDirect and fill Enter Host with printer's IP address

Install XSane for scanning image

# apt-get install xsane sane-utils

To configure scanner:

  1. Run XSane to configure scanner
  2. After XSane detected HP Printer & Scanner, select Hewlett-Pac and press Ok.

To install driver print to pdf

# apt-get install printer-driver-cups-pdf



Wednesday, July 12, 2023

Debian Bookworm: change grub resolution on boot using grub-customizer to 640x480

Install grub customizer

# apt-get install  grub-customizer  

To change grub resolution on boot:

Applications -> Settings -> Grub Customizer -> Appearance Settings -> custom resolution 640x480

Wednesday, July 5, 2023

Debian Bookworm: installing Apache2, MariaDB and PHP 8.2 (default)

 Installing MariaDB database

# apt-get install mariadb-client mariadb-server  

Install apache2 and PHP

# apt-get install apache2 php libapache2-mod-php php8.2-mysql

By default, PHP version for Debian Bookworm is 8.2.

To disable apache2 and mariadb start during boot (to faster your PC start, not recommended for live server)

# systemctl disable apache2
# systemctl disable mariadb

You can start and stop manualy after boot.

Install additional php 8.2 required by CodeIgniter

# apt-get install php8.2-curl php8.2-imagick php8.2-gd php8.2-intl php8.2-mbstring php8.2-memcache php8.2-memcached php8.2-redis php8.2-xml php8.2-phpdbg


Debian Bookworm: installing Eclipse using Eclipse installer

Download linux installer Linux x86_64 from https://www.eclipse.org/downloads/packages/installer.

Extract it

[home]/Downloads$ tar -xf ./eclipse-inst-jre-linux64.tar.gz 

Run installer

[home]/Downloads$ cd eclipse-installer/
[home]/Downloads/eclipse-installer$ ls
artifacts.xml  eclipse-inst      features  p2       readme
configuration  eclipse-inst.ini  icon.xpm  plugins
[home]/Downloads/eclipse-installer$ ./eclipse-inst 

For the first time, Eclipse will ask you to select workspace for your application. Choose default or create your prefered workspace directory.

You safe to remove eclipse-inst-jre-linux64.tar.gz file and [home]/Downloads/eclipse-installer directory.

Done.

Monday, June 26, 2023

Android Studio: Installing 2022 patch 2 on Debian 12 (Bookworm)

 Install JDK 17 (Optional)
# apt-get install openjdk-17-jdk

Add Multiarch repository to support architecture i386
# dpkg --add-architecture i386
# apt-get update

Note: to delete i386 run dpkg --remove-architecture i386

Install library required
# apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

Download Android Studio android-studio-2022.2.1.20-linux.tar.gz from https://developer.android.com/studio. 

You need to create folder for Android Studio, SDK Tool and Workspace. Android Studio and SDK Tool can not be placed in same directory. 

Extract your android-studio-2022.2.1.20-linux.tar.gz.

Run Android Studio for first time

  1. Run [Android_Studio_Folder]/bin/studio.sh
  2. Select Do not import settings
  3. Select Install Type: Custom
  4. Let default JDK folder for Gradle
  5. Select UI Theme, I choose Darcula
  6. Select your Android SDK Location that you have prepare before, Uncheck Android Virtual Device. You can install Android Virtual Device anytime after configuration finish.
  7. Read and accept License Agreement
  8. Wait until all files downloaded and installation finish.

You can install other SDk required after that. For example if you want to create application for Android 7.0, please download Android SDK Platform 24. This is your minimum android version.

You may start your android project, select save location that you have prepare before. For Example Save location: /[your_home_directory]/Workspace/Android/helloworld.

Android Studio in the same PC, run faster on Debian rather than windows 11 (dual boot).

Debian Bookworm: Install Debian 12.0 Dual Boot with preinstall windows 11 home on fresh Lenovo Ideapad Gaming 3

Preparation using windows 11 to create installation CD

  1. Download CD 1 debian-12.0.0-amd64-netinst.iso from https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/
  2. Insert blank DVD (file size exceed CD size)
     
  3. Right click file and select Windows Disk Image Burner.

Disable Secure Boot

  1. From windows 11, press Shift + Restart
  2. Select Troubleshoot -> Advaned Options -> UEFI Firmware Settings -> Security
  3. Find Secure Boot and change it to Disable
  4. Save configuration

To check status Secure Boot from windows 11, use system information, and find Secure Boot State. Secure Boot State must be Off to make sure Debian installation work perperly.

Restart to DVD and follow Graphic Installation guide.

Monday, May 23, 2022

Debian Bullseye (Debian 11): install mysql-workbench-community

Requirements:

  1. gnome-keyring
  2. libtinfo5
  3. libpython 2.7

Install all requirements packages:

# apt-get install seahorse gnome-keyring libtinfo5 libpython2.7

Change Default gnome-keyring using seahorse

$ seahorse

delete "Default keyring"

create new "Default keyring" and enter new password

Download from https://downloads.mysql.com/archives/workbench/

Choose Ubuntu Linux 18.04 (x86, 64-bit), DEB Package (mysql-workbench-community_8.0.22-1ubuntu18.04_amd64.deb)

# dpkg -i mysql-workbench-community_8.0.22-1ubuntu18.04_amd64.deb

Convension:

  • # run as root
  • $ run as user

 

Friday, March 11, 2022

Debian Bullseyes: installing & configure brightness control on Xfce4

 

You need to install:

  1. brightnessctl
  2. grub-customizer
  3. xfce4-power-manager   

# apt-get install brightnessctl grub-customizer xfce4-power-manager   

From Applications -> Settings -> Grub Customizer

  1. Open General settings
  2. At kernel parameters append acpi_backlight=video
    for example "quiet acpi_backlight=video"
  3. Save and restart.

You can choose only one from these options:

  • acpi_backlight=vendor
  • acpi_backlight=video
  • acpi_backlight=native
  • acpi_backlight=none

You can change your brightness from Power Manager Plugin in Xfce4.

Note: after make any change, restart your Debian

Tested on

  • Asus K45DR AMD A8 Series
  • Debian 11.2
  • linux-image 5.15.0-0.bpo.3-amd64

Tuesday, November 9, 2021

Debian Bullseyes: installing zoneminder (1.34.23-1)

 

Requirements:

  • MariaDB
  • Apache2

Installing packages

# apt-get install zoneminder apache2 mariadb-server-10.5 mariadb-client-10.5 php php7.4 libapache2-mod-php7.4 php7.4-mysql

# chown www-data:www-data /usr/share/zoneminder/ -R

# chown root:www-data /etc/zm/ -R

# a2enmod cgi

# a2enmod rewrite

# a2enconf zoneminder

Set root password (optional). For the first time after installation, password for mariadb root is blank.

# mysqladmin -u root -p password yournewpass

Create DB, User and Password. Omit option -p for mariadb root if you do not set password.

# mysql –u root –p

MariaDB [(none)]> CREATE USER 'zmuser' IDENTIFIED BY 'zmpass';

MariaDB [(none)]> CREATE DATABASE zm;

MariaDB [(none)]> GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost';

Creating DB

# mysql -u zmuser -p < /usr/share/zoneminder/db/zm_create.sql

NOTE: if change user, password or database, you need to change file in /etc/zm/zm.conf

# ZoneMinder database name

ZM_DB_NAME=zm

# ZoneMinder database user

ZM_DB_USER=zmuser

# ZoneMinder database password

ZM_DB_PASS=zmpass

Restarting services

# systemctl restart apache2

# systemctl restart zoneminder

From browser open URL http://localhost/zm

References:

  • https://forums.zoneminder.com/viewtopic.php?t=29355
  • https://wiki.zoneminder.com/Debian_11_Bullseye_with_Zoneminder_1.36.x

Monday, August 23, 2021

Debian Bullseye: upgrade from Debian Buster XFCE

 

Edit /etc/apt/sources.list

# main security
deb https://security.debian.org/debian-security bullseye-security/updates main
#deb-src https://security.debian.org/debian-security bullseye-security/updates main

# main mirror Indonesia
deb http://kebo.pens.ac.id/debian bullseye main
deb http://kebo.pens.ac.id/debian bullseye-updates main

# NON FREE
deb https://deb.debian.org/debian bullseye main contrib non-free

# BACKPORTS
deb https://deb.debian.org/debian bullseye-backports main

Update without new packages

# apt upgrade --without-new-pkgs

During upgrade, you need to restart some services.

Restart, open root terminal and make full upgrade (required more than 800MB)

# apt full-upgrade

Restart your PC.

Clean up unused installer

# apt-get autoclean && apt-get autoremove -y

If you get trouble connecting to internet (can not resolve servername) after upgrading edit /etc/resolv.conf

search 8.8.8.8 1.1.1.1
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 1.1.1.1

Restart your networking

# systemctl restart networking

If you install dnsmasq and get trouble connecting to internet (can not resolve servername) after upgrading, edit /etc/dnsmasq.conf

#no-resolv
# dedetok 2021-08-18
no-resolv
server=8.8.8.8
server=1.1.1.1

Reboot

Thursday, July 15, 2021

Debian Buster (Debian 10): install mysql workbench

 

Download mysql workbench from https://downloads.mysql.com/archives/workbench/

I use mysql-workbench-community version 8.0.19 for ubuntu 18.04 i.e. mysql-workbench-community_8.0.19-1ubuntu18.04_amd64

Install libtinfo5

# apt-get install  libtinfo5

Install mysql workbench using dpkg

# dpkg -i mysql-workbench-community_8.0.19-1ubuntu18.04_amd64

NOTE:

  • only mysql workbench community for Ubuntu 18.04 will work on Debian Buster (10)

Monday, July 5, 2021

Debian Buster: LAMP + PhpMyadmin

 

LAMP: Linux Apache2 MariaDB PHP + PhpMyyadmin

Install mariadb

# apt-get install mariadb-server  mariadb-client  

Set mysql root password

# mysqladmin -u root password [yourpassword]

Install Apache2 and PHP

# apt-get install apache2 php libapache2-mod-php php-gd php-mysql

Disable autostart

# systemctl disable mariadb
# systemctl disable apache2

install phpmyadmin

  1. Install depedency php-twig (> 2.9) from backport
    # apt-get install -t buster-backports php-twig
  2. Install phpmydmin
    # apt-get install phpmyadmin php-bz2 php-curl php-tcpdf php-zip
Using browser open http://localhost/phpmyadmin/index.php

Debian Buster: install all in one hp ink tank 315

 

Detect hp ink tank 315 detected by system

# dmesg
...
[   66.017856] usb 3-2: new high-speed USB device number 2 using xhci_hcd
[   66.170313] usb 3-2: New USB device found, idVendor=03f0, idProduct=1053, bcdDevice= 1.00
[   66.170319] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   66.170322] usb 3-2: Product: Ink Tank 310 series
[   66.170324] usb 3-2: Manufacturer: HP
[   66.170326] usb 3-2: SerialNumber: CN83B2G1YK06PH
[   66.198225] usblp 3-2:1.1: usblp0: USB Bidirectional printer dev 2 if 1 alt 0 proto 2 vid 0x03F0 pid 0x1053
[   66.198300] usbcore: registered new interface driver usblp

Install CUPS and hplip

# apt-get install system-config-printer hplip cups hplip-ppds  

If CUPS error

# tail /var/log/cups/error_log
X [09/Jun/2021:13:20:46 +0700] No valid Listen or Port lines were found in the configuration file.

Edit /etc/cups/cupsd.conf

# vi /etc/cups/cupsd.conf
Listen 127.0.0.1:631

Configure printer via Browser http://localhost:631/

  1. Administration -> Add Printer
  2. HP Ink Tank 310 series USB CN83B2G1YK06PH HPLIP (HP Ink Tank 310 series), Next
  3. Continue
  4. Model: HP Ink Tank 310 Series hpijs, 318.12 (en), Add Printer
  5. Filled User Name with root and its password, Ok

Install XSane for scanner

# apt-get install xsane sane-utils

Detect hp ink tank 315 scanner

# lsusb
Bus 004 Device 002: ID 03f0:1053 HP, Inc
# sane-find-scanner

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x03f0 [HP], product=0x1053 [Ink Tank 310 series]) at libusb:004:002
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

Try your scanner

# scanimage -L
device `hpaio:/usb/Ink_Tank_310_series?serial=CN83B2G1YK06PH' is a Hewlett-Packard Ink_Tank_310_series all-in-one

or

$ scanimage > image.pnm

To install driver print to pdf

# apt-get install printer-driver-cups-pdf

Sunday, September 20, 2020

Debian Buster: install pgadmin4 (fresh postgresql 11)

  1. Download apt key https://www.pgadmin.org/static/packages_pgadmin_org.pub and add key
    # wget https://www.pgadmin.org/static/packages_pgadmin_org.pub
    # apt-key add packages_pgadmin_org.pub
  2. Create and append pgadmin4 repository
    # echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list
  3. Run update & install pgadmin4-desktop
    # apt-get update
    # apt-get install pgadmin4-desktop

By default postgres user has no password in database (not system). You need to set/change postgres database password. From root linux shell
# su - postgres
$ psql
# \password
<type_your_password>

Try login to your postgres using psql
$ psql -U postgres  -h localhost
Password for user postgres:
psql (11.7 (Debian 11.7-0+deb10u1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=#

After running pgadmin4, pgadmin4 server will started and the first time you need to create master password (NOTE: master password is password to use pgadmin4).

Connect to your local postgresql server

  1. From your browser http://127.0.0.1:41271/browser/, Add New Server
  2. Fill
    1. Connection: localhost (your connection name)
    2. Port: 5432
    3. Maintenance Database: postgres
    4. Username: postgres
    5. Password: <your password>
  3. and Save

Reference:
https://www.pgadmin.org/download/pgadmin-4-apt/

 

Monday, August 31, 2020

Debian Buster: build and install ZJ-5802 Portable Bluetooth Thermal Receipt Printer 58 mm

 

Install CUPS configurator

# apt-get install  system-config-printer

Installing ZJ-5802 Portable Bluetooth Thermal Receipt Printer driver

  1. install requirements
    # apt install build-essential cmake libcups2-dev libcupsimage2-dev
    wait, it takes some times.
  2. Download code (by click 'Code') from https://github.com/klirichek/zj-58
  3. create directory
    $ mkdir zj58master
  4. copy file
    $ cp zj-58-master.zip zj58master/
  5. extract
    $ cd zj58master/
    $ unzip zj-58-master.zip
  6. move to extraced folder
    $ cd zj-58-master/
  7. create directory to build source
    $ mkdir build
  8. move to build directory
    $ cd build/
  9. run cmake from source i.e. /home/[your_user_name]/Downloads/zj58master/zj-58-master
    $ cmake /home/dedetok/Downloads/zj58master/zj-58-master
  10. install as root from folder /home/[your_user_name]/Downloads/zj58master/zj-58-master/build
    # make install
  11. if there is no failure, you can configure your CUPS

Configure CUPS

  1. Applications -> Settings -> Print Settings
  2. Unlock printer
  3. Add (sign '+ ADD') Printer
  4. Select Device
        Devices: Unknown (Printer)
        Connection: USB
    click Forward
  5. Choose driver
        Select printer from database: Zijiang
    click Forward
        Models: Zj-58
        Drivers: Zijiang Zj-58 [en] (recommended)
    click Forward
        Leave blank on options (i.e. Cash Drawer 1, Cash Drawer 2, and Cutter. My model does not have these hardware)
    click Forward
  6. click Apply
  7. Print test page
  8. Your printer should be run properly

Reference:
https://github.com/klirichek/zj-58