Linux

RedHat Summit 2019

See you all at RedHat Summit 2019 in Boston, MA. Please visit Crunchy Data booth to talk about our Enterprise Support and Products offering: Crunchy Certified PostgreSQL Crunchy HA PostgreSQL Crunchy PostgreSQL for OpenShift Enterprise PostgreSQL Support Enterprise PostgreSQL Consulting

ASUS Merlin RT-AC66U Notes

1. Custom DNS goes in /jffs/configs/dnsmasq.conf.add address=/test.com/www.test.com/127.0.0.1 address=/test.com/www.test.com/::1service restart_dnsmasq

GIT worktree

1. Fetch origin and tags git fetch --tags git fetch origin 2. Add work tree git worktree add -b <remote branch name> ../<new folder> origin/<remote branch name>

Linux ifconfig cheat sheet

Display link status & IP Addresses ifconfig Bring interface up ifconfig eth0 up Bring interface down ifconfig eth0 down Assign IP to device eth0 ifconfig eth0 192.168.0.2 Assign IP to device including netmask and broadcast ifconfig eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.1 Add IP as alias ifconfig eth0:1 192.

Linux ip cheat sheet

Display link status ip link show Display ip addresses ip addr show Bring interface up ip link set eth0 up Bring interface down ip link set eth0 down Assign IP to device eth0 ip addr add 192.168.0.2 dev eth0 Assign IP to device including netmask and broadcast ip addr add 192.168.0.2/24 broadcast 192.168.0.255 dev eth0 Delete IP from device ip addr del 192.168.0.2/24 dev eth0 Add IP as alias ip addr add 192.

How to undo git local commit(s)

Before pushing changes if you want to change last commit(s) Soft reset git reset HEAD~ Your files are left as is, you can now modify, commit and push. Hard reset git reset --hard HEAD~ Your files will get reset to HEAD.

GIT workflow

1. Fork at github.com 2. Clone it locally git clone git@github.com:<your name>/<repo name>.git 3. Configure username and email address git config user.name 'Yogesh Sharma' git config user.email 'Yogesh.Sharma@xyz.com' 4. Add upstream git remote add upstream git@github.com:<remote name>/<repo name>`.git 5. Fetch & Merge upstream git fetch upstream git merge upstream/master 6. Commit & Push git commit git push 7. On github.com make a pull request 8. After PR is merged pull upstream and rebase git fetch upstream git rebase upstream/master git push origin master --force or

Backup freeotp

Setup android-tools on Fedora 25 Install Android tools sudo dnf install android-tools Setup udev rules sudo cp /usr/share/doc/android-tools/51-android.rules /etc/udev/rules.d/ Enable and Start adb sudo systemctl enable adb sudo systemctl start adb To backup adb backup -f ~/backup-org.fedorahosted.freeotp.adb org.fedorahosted.freeotp To Restore adb restore ~/backup-org.

Setup RPM Build ENV

Install required packages sudo yum install rpm-build redhat-rpm-config yum-utils Setup build environment mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros Download src rpm and save it to ~/rpmbuild/SRPMS/ Install build dependencies for package sudo yum-builddep <package> Build package rpmbuild --rebuild <package>.

Install ARES Wizard on Kodi

To Install Ares Wizard: Start Kodi Goto SYSTEM > File Manager Select Add Source Select None Type the following http://www.areswizard.co.uk select Done Highlight the box underneath Enter a name for this media Source, type ares and select OK Go back to your Home Screen Select SYSTEM Select Add-Ons Select Install from zip file Select ares Select script.areswizardx.x.xx.zip Wait for Add-on enabled notification The Ares Wizard is now installed and can be accessed via the PROGRAMS (or Apps) menu from your home screen

Find KVM VM’s IP from Host

Create following function in your .bash_profile FIND_VMIP() { VM=$1 IP=$(arp -e | grep $(sudo virsh domiflist ${VM} |grep vnet| awk '{print $5}') | awk '{print $1}') echo "VM ${VM}has IP ${IP}" } Create an alias alias vmip=FIND_VMIP Reload .bash_profile source ~/.bash_profile Now run command vmip to find ip. Example: $ sudo vmip myvm VM myvm has IP 192.

Bash Shortcuts

Command Control Shortcuts Shortcut Description Ctrl + l clear the screen Ctrl + s stops the output to the screen (for long running verbose command) Ctrl + q allow output to the screen (if previously stopped using command above) Ctrl + c terminate the command Ctrl + z suspend/stop the command Command Recall Shortcuts Shortcut Description Ctrl + r search the history backwards Ctrl + g escape from history searching mode Ctrl + p previous command in history (i.

Extending PV/VG/LV on iSCSI

Extend iSCSI storage Stop LV on all nodes except one Rescan iSCSI node on one host # iscsiadm -m node -R Resize PV # pvresize /dev/<disk/part> Execute vgs and verify extended size visible as free space Extend LV # lvextend -l +100%FREE /dev/<vg>/<lv> On all other nodes run # iscsiadm -m node -R # pvscan

Fedora 22 on Raspberry Pi 2

Download one of the remix from http://arm.fedoraproject.org/ Download kernel cd /tmp/ git clone -depth 1 https://github.com/raspberrypi/firmware.git I am using LXDE: xzcat Fedora-LXDE-armhfp-22-3-sda.raw.xz | dd of=/dev/mmcblk0 bs=4M fdisk /dev/mmcblk0 change first partition type to B If you like, expand /dev/mmcblk0p3 to utilize all space and use resize2fs /dev/mmcblk0p3 to expand filesystem mkfs.vfat /dev/mmcblk0p1 mkdir /tmp/sdcard mount /dev/mmcblk0p3 /tmp/sdcard mount /dev/mmcblk0p1 /tmp/sdcard/boot cat >/tmp/sdcard/boot/config.txt #uncomment to overclock the arm. 700 MHz is the default.

openvpn certificate signature failure

CentOS and Fedora has stopped support for md5 certificates At client side if you get following error server log usually /var/log/messages VERIFY ERROR: depth=0, error=certificate signature failure: &lt;snip> TLS_ERROR: BIO read tls_read_plaintext error: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed TLS Error: TLS object -> incoming plaintext read error TLS Error: TLS handshake failed Fatal TLS error (check_tls_errors_co), restarting To fix this: vi /etc/systemd/system/NetworkManager.service and add following .include /usr/lib/systemd/system/NetworkManager.service [Service] Environment="OPENSSL_ENABLE_MD5_VERIFY=1 NSS_HASH_ALG_SUPPORT=+MD5" Now restart daemon

Running multiple PostgreSQL clusters using systemd

Requirements   Using systemd   Multiple instance of PostgreSQL       First instance running on port 5491       Second instance running on port 5492 Steps to setup first service STEP 1 create and edit service file sudo vi /etc/systemd/system/postgresql-9.4-5941.service STEP 2 Import original and Add Env .include /lib/systemd/system/postgresql-9.4.service [Service] Environment="PGDATA=/var/lib/pgsql/9.4/data1/" STEP 3 Modify postgresql.conf for instance sudo vi /var/lib/pgsql/9.4/data1/postgresql.conf" STEP 4 Change port for postgresql port=5491 Steps to setup second service STEP 1 create and edit service file

Disk benchmark with dd

Quick way to determine disk write performance dd bs=1G count=5 if=/dev/zero of=<path>/disk-io-test.dat oflag=dsync rm -f <path>/disk-io-test.dat Note: Try to set bs= and count= to a number which is close to double the memory to get realistic results

CentOS 7 Installation

For CentOS 6 users it may be difficult to understand and use new CentOS 7 installer but for Fedora users it is an easy one. To ease the life of new CentOS 7 users, here are steps for minimal CentOS 7 install. Boot from DVD Select Install CentOS 7 by pressing ↑ and press ↵ Language Selection Select your language and Click “continue” Installation Summary This is the main install setup screen.

Odoo Invoice caching

Default setting for Odoo (formerly OpenERP) is to cache invocie PDFs. To disable caching Settings -> Technical -> Actions -> Reports Scroll to Name = Invoice Select Invocie Click Edit UnCheck “Reload from Attachment” Click on Save Here is a screen shot