Enable syslog to listen to udp port 514 (the port number can be changed to suit your need)
Tuesday, December 11, 2018
Send postgresql log to syslog
Tuesday, December 4, 2018
Install nvidia driver for Tesla card on ubuntu 16.04
Check what driver your card is currently using, in this case, the card is using the opensource nvidia drivers called nouveau
$ lspci -v | grep -A8 NVIDIA
3d:00.0 3D controller: NVIDIA Corporation Device 1bb3 (rev a1)
Subsystem: NVIDIA Corporation Device 11d8
Flags: bus master, fast devsel, latency 0, IRQ 40
Memory at b7000000 (32-bit, non-prefetchable) [size=16M]
Memory at 4bfe0000000 (64-bit, prefetchable) [size=256M]
Memory at 4bff0000000 (64-bit, prefetchable) [size=32M]
Capabilities:
Kernel driver in use: nouveau
Kernel modules: nvidiafb, nouveau
Monday, December 3, 2018
Using tsocks with apt to bypass proxy
Recently, I encountered an error while trying to update ubuntu server 16.04. The error is as below:
Monday, November 26, 2018
Create a persistent reverse tunnel for a server behind firewall
To do this, you need to have a middleman server (middleman) to act as intermediaries between your workstation and the server behind firewall (target). The best is to have your middleman server running ssh server on the usual port that firewall allows, for example 80 and 443.
Step 1: In the target server, create a passwordless ssh access to your middleman server. Please refer here on how to accomplish that
Step 2: Create a simple bash script in target server that will check for the reverse tunnel connection, and restart the tunnel if the tunnel is broken. Lets say in this case, my middleman ssh server is running on port 443, you want to create a reverse tunnel on port 2222 on middleman server, and you want to use a user called foo in the middleman server. Don't forget to make the script executable by the owner.
$ cat /home/foo/bin/tunnelcheck.sh
$ chmod u+x /home/foo/bin/tunnelcheck.sh
Step 3: Set a crontab to run the above script every 10 minutes (or whatever interval you think is appropriate)
$ crontab -e
*/10 * * * * /home/foo/bin/tunnelcheck.sh
Step 4: Test the persistency by killing the ssh tunnel, and wait for crontab to run the tunnelcheck.sh script, and restart the tunnel
Step 5: You are now able to access the target server, simply by ssh'ng into port 2222 on middleman server
$ ssh foo@middleman -p 2222
Tuesday, November 6, 2018
How to test that your usb live cd is working
To do this, you need qemu-kvm. Install it:
$ sudo apt install qemu-kvm
Check the address of your usb, by using dmesg
$ dmesg | grep sd
Once you have the address, you can start it using below command (make sure you allocate at least 1024M memory, else it will return kernel panic)
$ sudo qemu-system-x86_64 -m 1024 -hda /dev/sdb
To use a cdrom, you can use below command
$ sudo qemu-system-x86_64 -m 1024 -cdrom /dev/cdrom
You can also test an iso file, using below command
$ sudo qemu-system-x86_64 -m 1024 -cdrom centos.iso