Squid

Install
apt-get install -y squid

Configuration /etc/squid3/squid.conf
http_port 80 accel defaultsite=www.example.com vhost
cache_peer 10.0.3.10 parent 80 0 no-query login=PASS originserver name=myAccel1
acl our_sites1 dstdomain 88.99.100.101 .example.com www.foo.com
http_access allow our_sites1
cache_peer_access myAccel1 allow our_sites1
cache_peer_access myAccel1 deny all

# reload configuration
squid3 -k reconfigure

Links
http://www.ehow.de/man-ssl-squid-aktiviert-wie_10142/

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

Install Jenkins

Install
<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.jenkins.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 "

";
?>

Jenkins Debian weekly repository
deb https://pkg.jenkins.io/debian binary/

Jenkins Debian LTS repository
deb https://pkg.jenkins.io/debian-stable binary/

Manuall plugins download
http://updates.jenkins-ci.org/download/plugins

disk-usage plugin
apt-get install -y fontconfig
https://wiki.jenkins-ci.org/display/JENKINS/Disk+Usage+Plugin

workspace
/var/lib/jenkins/workspace

manual update
wget http://updates.jenkins-ci.org/download/war/latest/jenkins.war -O /usr/share/jenkins/jenkins.war
/etc/init.d/jenkins restart
tail -f /var/log/jenkins/jenkins.log

Jenkins CLI
http://www.panticz.de/jenkins-cli

Plugins
# configure plugins
http://YOUR_JENKINS_IP:8080/pluginManager/available

# Locale plugin
https://wiki.jenkins-ci.org/display/JENKINS/Locale+Plugin
Manage Jenkins > Configure System
Locale
Default Language: en
Ignore browser preference and force this language to all users (check)

# Git plugin
https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin

MySQL JDBC driver to Jenkins (works with Jenkins jobs AND in Jenkins Script Console / Scriptler)
mkdir /usr/java/packages/lib/ext
ln -s /var/lib/jenkins/lib/java /usr/java/packages/lib/ext
wget http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.33.tar.gz -P /tmp
tar xzf /tmp/mysql-connector-java-5.1.33.tar.gz -C /tmp/
cp /tmp/mysql-connector-java-5.1.33/mysql-connector-java-5.1.33-bin.jar /var/lib/jenkins/lib/java/

# howtos
for (item in Hudson.instance.items) {
println("$item.name")
}

java -jar hudson-cli.jar -s http://your_Hudson_server/ copy-job myjob copy-myjob

# port forward
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu

# ssl
# /etc/default/jenkins
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpsPort=8443 --httpsCertificate=/etc/ssl/certs/www.example.com.pem --httpsPrivateKey=/etc/ssl/www.example.com.pem"

iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443

Build options
# skip build javadoc
-Dmaven.javadoc.skip=true

Configuration SonarQube
/var/lib/jenkins/.m2/settings.xml

Links
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
http://pkg.jenkins-ci.org/debian/

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/*

Tomcat configuration

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.tomcat.sh";
echo "wget $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 "

";
?>

# start
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0
export JAVA_OPTS="$JAVA_OPTS -Xmx256m"
/usr/local/apache-tomcat-5.5.20/bin/startup.sh

# deploy
/opt/SDK2/bin/asadmin deploy /tmp/Intranet.war

# change default port from 8080 to 80

# log directory
/var/log/tomcat6

# redirect by default to a app
mv /var/lib/tomcat6/webapps/ROOT/index.html /var/lib/tomcat6/webapps/ROOT/index.old.html
cat < /var/lib/tomcat6/webapps/ROOT/index.html

EOF

# manager
/etc/tomcat8/tomcat-users.xml
http://YOUR_TOMCAT_IP/manager/html/

# apache module
mod_jk

# LINKS
http://wiki.ubuntuusers.de/Tomcat
http://linux-sxs.org/internet_serving/c581.html
http://shrubbery.mynetgear.net/c/display/W/Disable+Directory+Listing+in+Tomcat
http://wiki.ubuntuusers.de/Tomcat

# https://intranet.sedo.de.intern/confluence/pages/viewpage.action?title=Enable+SSL+in+Tomcat&spaceKey=SOA
# https://ssl-trust.com/ssl-zertifikat-installieren/tomcat
# http://www.torsten-horn.de/techdocs/ssl.htm

UnixBench

# install required packages for compile
apt-get install -y build-essential
# perl perl-modules make

# download
wget -q http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz -O /tmp/UnixBench.tar.gz
tar -C /tmp/ -xzf /tmp/UnixBench.tar.gz
cd /tmp/UnixBench

# patch > 16 core limitation, https://code.google.com/p/byte-unixbench/issues/detail?id=4
wget --no-check-certificate "https://byte-unixbench.googlecode.com/issues/attachment?aid=-1645413311807741160&name=fix-limitation.patch&token=ABZ6GAfTt_8YARok5-o9WLVQDWrlCoUdQw%3A1399886165120" -O /tmp/fix-limitation.patch