Permanently add Static Route in Linux

Static routing is the process of manually entering the routes to the routing table to reach a particular destination. Basically two commands are used in Linux to add routes. The first command is the old traditional route add and second is the IP route command.

Earlier we learned how to route add in Linux, in this tutorial, here I will show you how to add permanent static routes in Linux distributions such as Centos and Ubuntu.

Adding temporary static routes

In order to add a static route temporarily on your Linux machine, you can use either route or ip command.

You can list the current routing table as follows.

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.206.1 0.0.0.0 UG 100 0 0 eno1
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eno1
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.206.0 0.0.0.0 255.255.255.0 U 100 0 0 eno1

route -n command

Read more

Share

Revoking Lets Encrypt Certificate properly

When you want to learn how to revoke Let’s Encrypt SSL/TLS certificates, follow the steps below:

Step 1: Validate Certificate file

Before you revoke a certificate, you’ll want to validate that the correct certificates and key file you’re revoking.. since there is no reversal.. Once a certificate is revoked, it will never be used again…

When you revoke a certificate, the certificate authority publishes that revocation information through the Online Certificate Status Protocol (OCSP), and some browsers will check OCSP to see whether they should trust a certificate…

Read more

Share

Fix Proxmox (PVE) “can’t lock file ‘/var/lock/qemu-server/lock-xxx.conf’ – got timeout” (Proxmox can’t shutdown/stop virtual machine) (Proxmox kill/force stop virtual machine)

The Issue

When trying to “Stop” or “Shutdown” virtual machine from Proxmox (PVE) web gui, the “Cluster log” shows

end task UPID:pve:xxxxxxxx:xxxxxxxx:xxxxxxx:qmstop:xxx:root@pam: can’t lock file ‘/var/lock/qemu-server/lock-xxx.conf’ -got timeout
end task UPID:pve:xxxxxxxx:xxxxxxxx:xxxxxxx:qmreboot:xxx:root@pam: VM quit/powerdown failed

The Fix

We can manually delete the lock from following path

/run/lock/qemu-server
# The file will be
/run/lock/qemu-server/lock-100.conf
/run/lock/qemu-server/lock-102.conf
...

Make sure only delete the correct one!

You can also do it using script from this site-

https://dannyda.com/2020/05/11/how-to-fix-proxmox-pve-cant-lock-file-var-lock-qemu-server-lock-xxx-conf-got-timeout-proxmox-cant-shutdown-virtual-machine/

Share

Easyengine installaiton on Debian 10

Install Easyengine WordPress on a Debian 10 VM (mine was a KVM).

The following procedure will install EE with following components;

  • Docker
  • WordPress Core
  • MariaDB
  • Nginx Server PHP-FPM
  • Redis Cache
  • Let’s encrypt SSL

Install EasyEngine on Linux

wget -qO ee rt.cx/ee4 && sudo bash ee
ee site create your_domain --type=wp --ssl=le --cache

For detailed installation or customizing your requirement, you may visit- https://easyengine.io/commands/site/create/

Read more

Share

Install webssh on Debian

You need to have PIP installed on your debian system. Check if it’s already installed, if not, install one of the available edition. My setup included

  • Debain 10 (buster)
  • PIP 3

Installing pip for Python 3

Perform the following steps as a user with sudo privileges to install Pip for Python 3 on Debian 10:

Start by updating the package list:

sudo apt update

Install pip for Python 3 and all of its dependencies with the following command:

Read more

Share

Download YouTube Videos in Linux Command Line

Install youtube-dl to download YouTube videos in Linux terminal

youtube-dl is a Python-based small command-line tool that allows downloading videos from YouTube, Dailymotion, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles and few more similar sites. It is written in pygtk and requires Python interpreter to run this program, it’s not platform restricted. It should run on any Unix, Windows or in Mac OS X based systems.

The youtube-dl tool supports resuming interrupted downloads. If youtube-dl is killed (for example by Ctrl-C or due to loss of Internet connectivity) in the middle of the download, you can simply re-run it with the same YouTube video URL. It will automatically resume the unfinished download, as long as a partial download is present in the current directory. Which means you don’t need download managers in Linux just for resuming downloads.

Read more

Share

Build a Centos 7 Repo

Install httpd

[root@www ~]# yum -y install httpd
# remove welcome page
[root@www ~]# rm -f /etc/httpd/conf.d/welcome.conf

Configure httpd. Replace server name to your own environment.

[root@www ~]# vi /etc/httpd/conf/httpd.conf
# line 86: change to admin's email address

ServerAdmin root@srv.world
# line 95: change to your server's name

ServerName www.srv.world:80
# line 151: change

AllowOverride All
# line 164: add file name that it can access only with directory's name

DirectoryIndex index.html index.cgi index.php
# add follows to the end

# server's response header

ServerTokens Prod
# keepalive is ON

KeepAlive On

[root@www ~]# systemctl start httpd
[root@www ~]# systemctl enable httpd

Install other required packages.

[root@dlp ~]# yum -y install rsync createrepo

Read more

Share