$ sudo apt update && sudo apt install boxes -y
$ echo "this is linuxwave" | boxes
$ boxes -l
$ echo "this is linuxwave" | boxes -d unicornsay
$ man boxes
$ sudo apt update && sudo apt install boxes -y
$ echo "this is linuxwave" | boxes
$ boxes -l
$ echo "this is linuxwave" | boxes -d unicornsay
$ man boxes
$ sudo apt update && sudo apt install podman -y
[registries.search]registries = ['docker.io']
$ podman pull severalnines/clustercontrol
$ mkdir -p clustercontrol/{backups,cmon.d,cmonlib,datadir,prom-conf,prom-data,sshkey}
$ ssh-keygen -t ed25519Generating public/private ed25519 key pair.Enter file in which to save the key (/home/myuser/.ssh/id_ed25519): /home/myuser/clustercontrol/sshkey/id_ed25519Enter passphrase (empty for no passphrase):Enter same passphrase again:...
$ podman run -d --name clustercontrol \-h clustercontrol \-p 5000:80 \-p 5001:443 \-p 9443:9443 \-p 19501:19501 \-e DOCKER_HOST_ADDRESS=192.168.10.10 \-v $PWD/clustercontrol/cmon.d:/etc/cmon.d \-v $PWD/clustercontrol/datadir:/var/lib/mysql \-v $PWD/clustercontrol/sshkey:/root/.ssh \-v $PWD/clustercontrol/cmonlib:/var/lib/cmon \-v $PWD/clustercontrol/backups:/root/backups \-v $PWD/clustercontrol/prom-data:/var/lib/prometheus \-v $PWD/clustercontrol/prom-conf:/etc/prometheus \severalnines/clustercontrol
$ podman exec -it clustercontrol bash# s9s user --create --generate-key --controller="https://localhost:9501" --group=admins myuser# s9s user --change-password --new-password=anypassword myuser
Sometimes, we need to run psql command without entering the password, even though the account is protected with password. The usual situations are, when we are running the psql command in a script, or we have to constantly monitor the output of psql commands using watch. Here is the method on how to achieve that.
Create a .pgpass file inside the user's home directory who's going to access psql without password
$ touch ~/.pgpass
Follow below format to add the user's details into pgpass
hostname:port:database:username:password
$ echo "10.10.10.10:5432:mydatabase:myuser:mysuperlongpassword" > ~/.pgpass
We can also use wildcard, such as *. If you password contains ":" or "\", use "\" to escape them
$ echo "*:*:mydatabase:myuser:mysuperlongpassword" > ~/.pgpass
$ chmod 0600 ~/.pgpass
$ psql -h localhost -U myuser mydatabasepostgres=#
listen_addresses = '*'wal_level = replicamax_wal_senders = 3
$ sudo su - postgrespostgres@master:~$ createuser --replication -P replicauser
host replication replicauser 172.17.0.4/32 scram-sha-256
$ sudo systemctl restart postgresql
In slave node, do below steps:
- remove postgresql data directory which is /etc/postgresql/16/main (we can also rename it to save as a backup)
$ sudo su - postgres
postgres@slave:~$ rm -rf /etc/postgresql/16/main
- set a proper permission to the data directory
postgres@slave:~$ chmod 700 /etc/postgresql/16/main
- copy data from master (assuming master's ip address is 172.17.0.3)
postgres@slave:~$ pg_basebackup -h 172.17.0.3 -U replicauser -D /var/lib/postgresql/16/main/
- add standby.signal file inside postgresql data directory, to tell postgresql that this is a standby node
postgres@slave:~$ touch /var/lib/postgresql/16/main/standby.signal
- add below configuration (uncomment wherever necessary) /etc/postgresql/16/main/postgresql.conf
listen_addresses = '*'
hot_standby = on
primary_conninfo = 'host=172.17.0.3 port=5432 user=replicauser password=1'
- restart postgresql
$ sudo systemctl restart postgresql
Verify the replication is working
- in master, check pg_stat_replication table
$ sudo su - postgres
postgres=# select client_addr, state from pg_stat_replication where usename like 'replicauser';
- Check if walsender process is running in master
$ ps -ef | grep wal
- Check if walreceiver is running in slave
$ ps -ef | grep wal
-
We can also create a database in master, and verify that the same database appear in slave almost instantly .
$ sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt update
$ sudo apt install postgresql-16 -y
$ sudo vi /etc/postgresql/16/main/postgresql.conf
listen_addresses = '*'
$ sudo systemctl start postgresql
$ sudo systemctl enable postgresql
$ sudo ufw allow 5432/tcp
$ sudo su - postgrespostgres@host:~$ psqlpostgres=# select version();
$ sudo apt update && sudo apt install mediainfo -y
$ mediainfo myfile.mp4
$ ffmpeg -i video.mp4 -q:a 0 -map a audio.mp4
$ ffmpeg -i video.mp4 -ss 00:03:00 -t 00:00:45.0 -q:a 0 -map a audio.mp4
$ sudo apt install alien -y
$ sudo dnf install alien -y
$ sudo alien --to-deb myapp.rpm
$ sudo alien --to-rpm myapp.deb
$ sudo alien --to-tgz myapp.deb
$ sudo alien --to-rpm --to-deb myapp.tgz
$ ps 1
$ stat /sbin/init
$ readlink /sbin/init
$ python -V
$ python3 -m venv rembg
$ cd rembg$ source bin/activate
(rembg) $ pip install --upgrade pip
(rembg) $ pip install rembg[cli]
$ rembg --help
(rembg) $ rembg i mypicture.jpg mypicture-nobg.jpg
$ rembg s
$ python -V
$ sudo apt update && sudo apt install python3.10-venv -y
$ python3 -m venv myproject
$ cd myproject$ source bin/activate
$ deactivate
$ sudo journalctl --disk-usage
$ sudo journalctl
$ sudo journalctl --flush
$ sudo journalctl --vacuum-size=1G
$ sudo journalctl --vacuum-time=1month
$ sudo journalctl --rotate
$ sudo apt update && sudo apt install chrony -y
$ sudo systemctl start chrony
$ sudo systemctl enable chrony
$ sudo chronyc sources -v
$ sudo chronyc makestep
$ sudo sysctl <tunable class>.<tunable>
$ sudo sysctl -w <tunable class>.<tunable> >> /etc/sysctl.conf
$ sudo sysctl -w <tunable class>.<tunable> >> /etc/sysctl.d/filename.conf
$ sudo sysctl -p
$ sudo sysctl -p /etc/sysctl.d/filename.conf
$ sudo sysctl --system
$ sudo sysctl -a
$ sudo sysctl -a --pattern 'kernel'
What are the available tunable classes? According to Red Hat, these are the ones available in RHEL.
- abi: execution domain and personalities
- crypto: cryptographic interfaces
- debug: kernel debugging interfaces
- dev: device specific information
- fs: global and specific filesystem tunables
- kernel: global kernel tunables
- net: network tunables
- sunrpc: sun remote procedure calls (NFS)
- user: user namespace limits
- vm: tuning and management of memory, buffer and cache
How to get information about the tunables and its usage? Refer to https://www.kernel.org/doc/Documentation/
$ xinput list | grep -i touchpad
$ xinput list-props 11
$ grep -i "using input" /var/log/Xorg.0.log
$ sudo apt update && sudo apt install xserver-xorg-input-synaptics -y
$ xinput list-props 11
$ sudo apt remove xserver-xorg-input-synaptics