Setup Wireguard VPN Server on CentOS

This tutorial is going to show you how to set up your own WireGuard VPN server on CentOS.

WireGuard is made specifically for the Linux kernel. It runs inside the Linux kernel and allows you to create fast, modern, and secure VPN tunnel.

TL;DR

Prerequisites

This tutorial assumes that the VPN server and VPN client are both going to be running on CentOS 7/8 operating system.

Step 1: Install WireGuard on CentOS Server and Desktop

Log into your CentOS server, then run the following commands to install WireGuard.

Git Cheatsheet for Minimalists

Basic Git Concepts

  • Working copy (working tree file): It refers to the file in the repository that appears on the hard disk.
  • Index (staging area or cache): it refers to you have git add-ed, or, what would be committed if you were to run git commit.
  • HEAD: It refers to the “current” or “active” branch, when we need to check out a branch (referring to your attempt to match the branch with what is in the working copy), only one can be checked out at a time.

git init

Initialize a new git repository

Podman Basic Notes

Playing around with Podman

1
alias docker="sudo podman $1"

The above command works as of this time and podman makes namespaces for every users for every resources, i.e., images, containers and so on.

It means, podman images and sudo podman images will show different resources.😎

1
2
3
4
5
sudo podman pod create --name my-pod -p 8080:80
sudo podman run -d --restart=always --pod=my-pod --name my-nginx nginx
sudo podman run -d --restart=always --pod=my-pod --name my-curl curl
sudo podman generate kube my-pod > my-pod.yaml
sudo podman play kube ./my-pod.yaml

The generated file can not be used as raw. Below is an example of a manually edited version.

Kubernetes Basic Notes

Kubectl Installation

1
2
3
4
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
echo $PATH
sudo mv kubectl /usr/local/bin/

Minikube Installation

1
2
3
4
5
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube
minikube start
minikube status

Kubectl Commands

CRUD Commands

1
2
3
kubectl create deployment [name]
kubectl edit deployment [name]
kubectl delete deployment [name]

Status of different K8s components

1
kubectl get `nodes | pods | services | replicasets | deployments`

Debugging pods

1
2
Kubectl logs [pod name]
kubectl exec -it containername -- bin/bash

Applying YAML files

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
kubectl apply -f some-deployment.yaml
kubectl apply -f some-service.yaml
kubectl apply -f some-secret.yaml
kubectl describe service some-service
kubectl get pods -o wide
kubectl get deployments -o yaml
kubectl get secrets
kubectl delete -f some-deployment.yaml
kubectl delete -f some-service.yaml
kubectl delete -f some-secret.yaml

Single Node Deployment Example

How to Make a Swap Space Using a Swap File in Linux

This article is based on the content of aws knowledgebase.

You might have been stuck in memory leak when building some kinda javascript-heavy frontend apps like Vue or React on a cloud server itself. Just for serving built artifacts, we do not need large instances, but still the building process is always hungry for more memory you know.

Below is how to resolve such specific problem.

Oh, this is not the case if you already have a dedicated(partitioned) swap space, it’s a better option in any case but in most cases, we will be playing with servers without a swap patition.