LTSP update kernel module

# on client: download driver
# Intel ixgbe (10G NIC)
wget -qP /tmp
# Intel e1000e (1G NIC)
wget -qP /tmp
tar xzf /tmp/e1000e-3.3.4.tar.gz -C /tmp/
# install required packages
apt-get install build-essential linux-headers-$(uname -r)
# on client: compile
cd /tmp/e1000e-3.3.4/src/
# copy /tmp/e1000e-3.3.4/src/e1000e.ko to LTSP server
# debug on server
# make install
# rmmod e1000e
# modprobe e1000e
# update-initramfs -u
# backup original

Install SonarQube

wget -O - | bash -


# install Java
wget -q --no-check-certificate -O - | bash -

# install SonarQube
echo "deb binary/" > /etc/apt/sources.list.d/sonar.list
sudo apt-get update
sudo apt-get install -y --force-yes sonar

# autostart SonarQube
sudo update-rc.d sonar defaults


tail -f /opt/sonar/logs/sonar.log


Install SSH VPN server

export CONTAINER=vpn

# create container
# TODO: configure MAC on create container
wget -q --no-check-certificate -O - | bash -s -- -f

# configure container MAC address
sed -i 's| = .*| = 00:11:22:33:44:5e|' /var/lib/lxc/${CONTAINER}/config

# enable autostart
echo " = 1" | tee -a /var/lib/lxc/${CONTAINER}/config

# configure container
##echo "lxc.hook.autodev=/var/lib/lxc/vpn/autodev" >> /var/lib/lxc/${CONTAINER}/config

Jenkins CLI

# command overview

# add public key for user

# authentificate by user / pass
java -jar jenkins-cli.jar -s list-jobs --username --password

# install plugin by name
java -jar jenkins-cli.jar -s install-plugin findbugs

# install plugin from URL?
java -jar jenkins-cli.jar -s install-plugin

LXC: create Ubuntu Trusty container

wget -q --no-check-certificate -O - | bash -s


[ -z ${CONTAINER} ] && CONTAINER=trusty

# force, remove previous container
if [ "$1" == "-f" ]; then
  [ $(sudo lxc-ls ${CONTAINER} | wc -l) -gt 0 ] && sudo lxc-destroy -f -n ${CONTAINER}

# create container
sudo lxc-create -t ubuntu -n ${CONTAINER} -- template-options -r trusty $@

# workaround for "Failed to mount cgroup at /sys/fs/cgroup/systemd: Permission denied"
echo "lxc.aa_profile = unconfined" | sudo tee -a /var/lib/lxc/${CONTAINER}/config

# start container in background
sudo lxc-start -d -n ${CONTAINER}

# wait 3 seconds until network is up
sleep 3

# copy APT proxy configuration from host
APT_PROXY=$(grep -h "Acquire::http::Proxy" /etc/apt/* -r | head -1)
[ -n "${APT_PROXY}" ] && echo ${APT_PROXY} | sudo tee /var/lib/lxc/${CONTAINER}/rootfs/etc/apt/apt.conf.d/01proxy

# update packages in container
sudo lxc-attach -n ${CONTAINER} -- apt-get update
sudo lxc-attach -n ${CONTAINER} -- apt-get dist-upgrade -y

# show containers status
sudo lxc-ls ${CONTAINER} -f

Allow root SSH login with password
sed -i 's|PermitRootLogin without-password|PermitRootLogin yes|' /etc/ssh/sshd_config
sed -i 's|PasswordAuthentication no|PasswordAuthentication yes|' /etc/ssh/sshd_config
service ssh restart

Create UEFI disc

# create disc image
mkfs.msdos -C /tmp/uefi.iso 2880
sudo mount /tmp/uefi.iso /mnt
sudo cp /tmp/your_uefi_files/* /mnt/
sudo umount /mnt
# boot to UEFI shell
press F11 on boot
# go to UEFI filesystem
# Links

Debian: Install Cacti

# create container
export CONTAINER=cacti
wget -q --no-check-certificate -O - | bash -s -- -f
sudo lxc-attach -n ${CONTAINER} -- sed -i 's|PermitRootLogin without-password|PermitRootLogin yes|' /etc/ssh/sshd_config
sudo lxc-attach -n ${CONTAINER} -- service ssh restart

# fix dns
echo nameserver > /var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf

# install applications
lxc-attach -n ${CONTAINER} --

apt-get update

# server
debconf-set-selections <<\EOF

Install LXD

wget -O - | bash -


# add LXD PPA repository
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-lxc/lxd-stable
sudo apt-get update

# install LXD
sudo apt-get install -y lxd

# initialize LXD
sudo lxd init --auto


Compare zones between two Nameserver

for TYPE in A CNAME MX TXT; do
    for i in $(cat /tmp/ | grep ${TYPE} | cut  -f1); do
        OLD=$(dig @${OLD_NS} +short ${TYPE} ${i}
        NEW=$(dig @${NEW_NS} +short ${TYPE} ${i}
        if [ "${NEW}" != "${OLD}" ]; then
            echo ${TYPE} ${i}
            echo OLD: ${OLD}
            echo NEW: ${NEW}


-- enable formated output
\x on
-- show databass
SELECT datname FROM pg_database WHERE datistemplate = false;
-- show tables
SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;
-- show user
-- drop database
drop database foo;
echo "drop owned by zentras" | psql
-- exit
-- Display tables structure
-- Display tables size
    relname as "table",
    pg_size_pretty(pg_total_relation_size(relid)) as "size",
    pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "ex
Syndicate content