linux

Installation and configuration of the ELK Stack (Elasticsearch, Logstash, Kibana)

# Overview and download homepage
http://www.elasticsearch.org/overview/elkdownloads/

#
# Prerequirements (Elasticsearch and Logstash are Java packages so please install Java JRE first)
#
# Install Java JRE package on Debian
apt-get install -y openjre-7-jre

#
# Elasticsearch (distributed restful search and analytics)
#
# Install Elasticsearch package on Debian
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.2.deb -P /tmp
dpkg -i /tmp/elasticsearch-1.3.2.deb

# Enable Elasticsearch daemon
update-rc.d elasticsearch defaults 95 10

Docker

Installation
https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
http://www.panticz.de/install-docker

Add user to docker group
sudo usermod -aG docker $USER
su - $USER

systemctl enable docker
systemctl status docker

Start all exited container
docker start $(docker ps -a -q -f status=exited)

Stop all containers
docker stop $(docker ps -a -q)

# Delete all containers
#docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q) -f

# Delete all images

Install GitLab

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.gitlab.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

HowTo
http://www.panticz.de/gitlab

Login
http://YOUR_SERVER_IP
user: root
pass: 5iveL!fe

Downloads: GitLab CE Download Archives
https://about.gitlab.com/downloads/archives/

# check instalation
gitlab-rake gitlab:check

# GitLab APT repository
https://packages.gitlab.com/gitlab/gitlab-ce

# rebuild an authorized_keys file
gitlab-rake gitlab:shell:setup

# install specific version
sudo apt-get install -y gitlab-ce=7.10.1~omnibus.1-1

Send email notification
Notify.test_email('foo@example.com', 'GitLab test subject', 'GitLab test message').deliver_now

Links
https://packages.gitlab.com/gitlab/gitlab-ce/install
https://packages.gitlab.com/gitlab/gitlab-ce/
https://about.gitlab.com/downloads/
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#installation
https://www.gitlab.com/2014/02/14/gitlab-is-now-simple-to-install/
https://about.gitlab.com/downloads/archives/ - old GitLab packages archive

rsnapshot

apt-get install -y rsnapshot

mv /etc/rsnapshot.conf /etc/rsnapshot.conf.org

cat < /etc/rsnapshot.conf
config_version 1.2
snapshot_root /media/backup/
logfile /var/log/rsnapshot.log
verbose 3
loglevel 3

cmd_preexec /bin/mount /media/backup
cmd_postexec /bin/umount /media/backup
#backup_script /usr/local/bin/backup_mysql.sh localhost/mysql/

cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
ssh_args -F /home/foo/.ssh/config -i /home/foo/.ssh/id_rsa

interval daily 7
interval weekly 3
interval monthly 1

#exclude dev/*
exclude lost+found/*

Boot iPXE from harddisc (Network booting from GRUB using iPXE)

<?php
$URL="https://raw.githubusercontent.com/panticz/preseed/master/ipxe/scripts/install_grub_ipxe.sh";
echo "wget -q $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Links
http://packages.ubuntu.com/de/vivid/grub-ipxe
http://ipxe.org/embed

SSH server enable / disable password authentication

Enable
sed -i 's|[#]*PasswordAuthentication no|PasswordAuthentication yes|g' /etc/ssh/sshd_config
sed -i 's|UsePAM no|UsePAM yes|g' /etc/ssh/sshd_config
service ssh restart

Disable (don´t forget to install pre-shared-key first: http://www.panticz.de/ssh_pre-shared-key_authentication)
<?php
$URL="https://raw.githubusercontent.com/panticz/scripts/master/disable_ssh_password_authentication.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

# LXC
# disable login without password
lxc-attach -n ${CONTAINER} -- sed -i 's|[#]*PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
lxc-attach -n ${CONTAINER} -- sed -i 's|UsePAM yes|UsePAM no|g' /etc/ssh/sshd_config
lxc-attach -n ${CONTAINER} -- service ssh restart

# generate SSH key for root
lxc-attach -n ${CONTAINER} -- ssh-keygen -q -f /root/.ssh/id_rsa -N ''

OpenWrt on TP-Link TL-WR941ND / TL-WR1043ND / TL-WDR3600 / TL-WDR4300

# 15.05
https://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/

# flash tl-wr1043nd
URL=http://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/openwrt-15.05.1-ar71xx-generic-tl-wr1043nd-v1-squashfs-factory.bin
wget ${URL} -P /tmp
scp /tmp/openwrt-15.05-ar71xx-generic-tl-wr1043nd-v1-squashfs-factory.bin root@192.168.1.111:/tmp/
ssh root@192.168.1.111
echo 3 > /proc/sys/vm/drop_caches
mtd -r write /tmp/openwrt-15.05.1-ar71xx-generic-tl-wr1043nd-v1-squashfs-factory.bin firmware

# flash tl-wdr4300

Adaptec RAID controller / arcconf

arcconf GETLOGS 1 DEVICE

# list logical devices
arcconf GETCONFIG 1 LD

# list phisical devices
arcconf GETCONFIG 1 PD

# start adaptec verifi
arcconf TASK START 1 DEVICE 0 0 VERIFY

arcconf GETSTATUS 1

# create JBOD on all devices
# get device count
COUNT=$(arcconf GETCONFIG 1 PD | grep "Hard drive" | wc -l)

# create JBOD on all devices
for CHANNEL in `echo $(seq 1 ${COUNT})`; do
CHANNEL=$((CHANNEL-1))
echo ${CHANNEL}

arcconf CREATE 1 JBOD 0 ${CHANNEL} noprompt
done

# delete devices
arcconf DELETE 1 LOGICALDRIVE ALL noprompt

Install Jameica + Hibiscus online banking

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.hibiscus.sh";
echo "wget $URL -O - | bash -";
echo "

";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
$result = curl_exec($ch);
curl_close($ch);
htmlspecialchars($result);

echo "

";
?>

Ansible playbook
https://github.com/panticz/ansible/tree/master/roles/hibiscus
- hosts: localhost
roles:
- hibiscus

# broken
echo "deb http://de.archive.ubuntu.com/ubuntu cosmic main restricted universe multiverse" > /etc/apt/sources.list.d/cosmic.list
apt install -y jameica
rm /etc/apt/sources.list.d/cosmic.list

# broken
sudo add-apt-repository ppa:marko-preuss/hibiscus
sudo apt-get update
sudo apt-get install hibiscus-orig

Links
https://www.willuhn.de/wiki/doku.php?id=support:ubuntu_18.04_64bit
https://wiki.ubuntuusers.de/Hibiscus/
http://www.willuhn.de/products/jameica/download.php
http://www.willuhn.de/products/hibiscus/download.php
https://www.willuhn.de/wiki/doku.php?id=support:bezugsquellen
http://www.heise.de/download/linux/office/finanzsoftware/homebanking-50003505037/

Linpack under Ubuntu / Linux

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.linpack.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

# get CPU info
CPU=$(cat /proc/cpuinfo | grep "model name" | tail -1)
COUNT=$(cat /proc/cpuinfo | grep processor | wc -l)
echo "CPU : $CPU"
echo "COUNT : $COUNT"

# OPTIONAL: configure parameter
# export MKL_DYNAMIC=false
# export OMP_NUM_THREADS=4

# run
runme_xeon64

Links
http://software.intel.com/en-us/articles/intel-math-kernel-library-linpack-download - Intel LINPACK Download
http://www.roylongbottom.org.uk/linpack%20results.htm