Configure HP Printer for Linux

Goals Installation We just need to install hplibs thats all .. sudo apt install hplip hplip-gui xsane hp-setup (1) hp-plugin 1 Fastest way is to enter the printer’s IP address, for network scans it might be necessary to disable/modify the firewall. Resources HP Linux Imaging and Printing Detailed article from Linuxmint forums

May 14, 2021 · 1 min · 52 words · Micha Kops

Install Docker on Linux

Goals Installing a specific Docker version on (Debian-based) Linux Freeze the version to avoid automatic updates Installation curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - (1) sudo add-apt-repository \ (2) "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" sudo apt-get update (3) sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu (4) sudo apt-mark hold docker-ce (5) 1 Add the Docker GPG key 2 Add the Docker repository 3 Update the index 4 Install docker 5 Freeze the version to avoid unwanted automatic updates ...

May 14, 2021 · 1 min · 86 words · Micha Kops

Install Kubernetes Components - Kubeadm, Kubectl, Kubelet

Goals Install kubeadm, kubectl and kubelet on Debian-based Linux Freeze their versions to avoid automatic updates Installation curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - (1) cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list (2) deb https://apt.kubernetes.io/ kubernetes-xenial main EOF sudo apt-get update (3) sudo apt-get install -y kubelet=1.15.7-00 kubeadm=1.15.7-00 kubectl=1.15.7-00 (4) sudo apt-mark hold kubelet kubeadm kubectl (5) 1 Add the GPG key 2 Add the kubernetes repo to the sources list 3 Update the index 4 Install kubelet, kubeadm and kubectl It’s important to use the same version for kubelet, kubeadm and kubectl. ...

May 14, 2021 · 1 min · 117 words · Micha Kops

MySQL and phpMyAdmin Setup with Docker-Compose

Goals Setup mySQL with phpMyAdmin connected using docker-compose (for development purpose) Prerequisites docker-compose installed Setup This is our docker-compose.yml: version: '3.2' services: db: image: mysql:8.0 container_name: mysql-container restart: always ports: - '6603:3306' environment: MYSQL_ROOT_PASSWORD: 12345678 app: depends_on: - db image: phpmyadmin/phpmyadmin container_name: phpmyadmin restart: always ports: - '8080:80' environment: PMA_HOST: db Running docker-compose up Starting mysql-container ... done Starting phpmyadmin ... done Attaching to mysql-container, phpmyadmin [..] We may now login using the following ultra-secure credentials ;) User: root, Password: 12345678 ...

May 14, 2021 · 1 min · 81 words · Micha Kops

Package a Spring Boot App as RPM

Goals Package a Spring Boot Service as RPM Package Configure systemd integration Add install/uninstall hooks to create users, directories etc. Maven Setup <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.4.2</version> <relativePath/> </parent> <groupId>com.hascode</groupId> <artifactId>sample-app</artifactId> <version>1.0.0-SNAPSHOT</version> <name>sample-app</name> <properties> <java.version>11</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> (1) <groupId>de.dentrassi.maven</groupId> <artifactId>rpm</artifactId> <version>1.5.0</version> <executions> <execution> <goals> <goal>rpm</goal> </goals> </execution> </executions> <configuration> <packageName>sample-app</packageName> <skipSigning>true</skipSigning> <group>Application/Misc</group> <requires> <require>java-11-openjdk-headless</require> (2) </requires> <entries> <entry> (3) <name>/opt/sample-app</name> <directory>true</directory> <user>root</user> <group>root</group> <mode>0755</mode> </entry> <entry> (4) <name>/opt/sample-app/log</name> <directory>true</directory> <user>sample-app</user> <group>sample-app</group> <mode>0750</mode> </entry> <entry> (5) <name>/opt/sample-app/sample-app.jar</name> <file>${project.build.directory}/${project.build.finalName}.jar</file> <user>root</user> <group>root</group> <mode>0644</mode> </entry> <entry> (6) <name>/usr/lib/systemd/system/sample-app.service</name> <file>${project.basedir}/src/main/dist/sample-app.service</file> <mode>0644</mode> </entry> </entries> <beforeInstallation> (7) <file>${project.basedir}/src/main/dist/preinstall.sh</file> </beforeInstallation> <afterInstallation> <file>${project.basedir}/src/main/dist/postinstall.sh</file> </afterInstallation> <beforeRemoval> <file>${project.basedir}/src/main/dist/preuninstall.sh</file> </beforeRemoval> <license>All rights reserved</license> </configuration> </plugin> </plugins> </build> </project> ...

May 14, 2021 · 3 min · 567 words · Micha Kops

Setting up a Kubernetes Master Node

Goals Setup a kubernetes master node on a Linux machine Setup Initialize the cluster on the master node sudo kubeadm init --pod-network-cidr=10.244.0.0/16 This might take a few minutes …​ afterward we set up our local kubeconfig: mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config Verify the Cluster Setup Shows that the cluster is responding and kubectl working: kubectl version

May 14, 2021 · 1 min · 65 words · Micha Kops

Synology NAS sync from Linux with rsync over SSH

Goals Configure the NAS to accept SSH and Rsync connections Enable SSH with pub-Key Deploy pub key Synchronize files with rsync Prerequisites We assume, that the Synology NAS basic configuration has been applied and that a shared directory is ready to be our sync target. We will be synchronizing the directory /tmp/samples to the NAS directory /volumes/samples. Synology NAS Setup First of all we need to enable some services on our NAS. ...

May 14, 2021 · 3 min · 436 words · Micha Kops

Unix-like data pipelines with Java 8 Streams and UStream

We all love the simplicity when chaining commands and pipes in an Unix derivative environment. UStream takes this approach and extends Java 8′s stream API to mimic some of the well known commands and apply them on streams. In the following tutorial, I’d like to share some slim examples for using UStream. Figure 1. Data pipelines with UStream Dependencies We simply need to add one dependency to our pom.xml (using Maven): io.github.benas:ustream:0.2 ...

November 8, 2015 · 4 min · 659 words · Micha Kops

Apache Webserver Snippets

Deny all methods excepting POST and GET RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS|HEAD) RewriteRule .* - [F] Rewrite all aliases for a domain to a single domain RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?mydomain1\.com [NC,OR] RewriteCond %{HTTP_HOST} ^(www\.)?mydomain2\.com [NC,OR] RewriteCond %{HTTP_HOST} ^(www\.)?mydomain3\.com [NC,OR] RewriteRule (.*) http://mydomain.com/$1 [R=301,L]

March 1, 2010 · 1 min · 42 words · Micha Kops

Kubernetes Snippets

Rerun existing completed Job kubectl replace deletes the old job, if there is any error, your job definition is lost, don’t forget to save it first! Replace an existing Job with itself kubectl get job JOBNAME -o yaml | kubectl replace --force -f - Sometimes there are errors importing the job template due to auto-generated labels or selectors .. a quick and dirty hack is to filter them out using jq ...

March 1, 2010 · 10 min · 1924 words · Micha Kops