Install Jenkins

Install
wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.jenkins.sh -O - | bash -

#!/bin/bash

# install required packages
apt-get install -y wget

# add repository key
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -

# add repository
echo "deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list.d/jenkins.list
apt-get update

# install jenkins
apt-get install -y jenkins

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

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

Docker

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.docker.sh -O - | bash -

#!/bin/bash

# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
  sudo $0
  exit
fi

apt-get install -y curl linux-image-extra-$(uname -r) linux-image-extra-virtual apt-transport-https ca-certificates software-properties-common

curl -fsSL https://yum.dockerproject.org/gpg | apt-key add -
add-apt-repository deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"
apt-get update

apt-get -y install docker-engine

systemctl enable docker
systemctl status docker

Debug / Run test container
docker info
docker run hello-world
#docker run -it centos bash

#docker run -i --rm ubuntu bash

sudo docker run -i -t --name dc-ubuntu ubuntu bash
sudo docker start -i dc-ubuntu

# wordpress
docker run -d --name dc-mysql -e MYSQL_ROOT_PASSWORD=mysqlpwd mysql
docker run -d --name dc-wordpress --link dc-mysql:mysql -p 7894:80 wordpress

# search
docker search icinga
docker pull phre/icinga

docker run --name dc-nginx -d -p 7890:80 nginx
http://localhost:7890/
docker logs dc-nginx

# images
sudo docker images
sudo docker rmi 3eXXXXx

apt-get install docker
docker run -t -i --rm ubuntu bash
docker run -i -t --name dc-ubuntu ubuntu bash
docker start -i dc-ubuntu
docker run --name dc-nginx -d -p 7890:80 nginx
docker logs dc-nginx
docker stop dc-nginx
docker rm dc-nginx
docker run --name dc-nginx -d -p 7890:80 -v /tmp/srv/:/usr/local/nginx/html:ro nginx
docker run --name dc-nginx-tmp -t -i nginx /bin/bash
docker commit dc-nginx-tmp img-mynginx
docker run --name dc-mynginx -d -p 7891:80 img-mynginx nginx

# view all cointainer (also inactive)
docker ps -a

# remove all container
docker ps -qa | xargs docker rm

/tmp/dbuildtst/Dockerfile
MAINTAINER Mein Name
FROM nginx
RUN echo 'Hello again! ' > /usr/local/nginx/html/index.html

docker build -t=img-mynginx2 /tmp/dbuildtst/

docker run --name dc-mynginx2 -d -p 7892:80 img-mynginx2

http://registry.hub.docker.com

https://wiki.debian.org/Docker

Run Docker inside LXC container
# http://stackoverflow.com/questions/22085657/can-docker-run-inside-a-linux-container
echo 'DOCKER_OPTS="--exec-driver=lxc"' | tee -a /etc/default/docker
service docker restart

# mysql container
sudo docker pull mysql

# build a container
https://www.digitalocean.com/community/tutorials/docker-explained-using-dockerfiles-to-automate-building-of-images

# notes
docker run --lxc-conf="lxc.network.hwaddr=92:20:de:b0:6b:61" my_image ifconfig
edit /etc/default/docker: DOCKER_OPTS="--dns 8.8.8.8 -e lxc"
apt-get install lxc (lxc-docker is not enough)
docker run --lxc-conf="lxc.network.hwaddr=92:20:de:b0:6b:61" -t myimage

# non root?
https://docs.docker.com/installation/debian/

# quick & easy install
wget -qO- https://get.docker.com/ | sh

# docker under LXC
http://ashish1099.github.io/blog/2015/05/23/docker-inside-lxc/
https://www.stgraber.org/2016/04/13/lxd-2-0-docker-in-lxd-712/
cat /var/lib/lxc/docker/config
...
lxc.aa_profile = unconfined
lxc.cgroup.devices.allow = a
lxc.cap.drop =

# 15 Quick Docker Tips
http://www.centurylinklabs.com/15-quick-docker-tips/

# get volume information
for VOLUME in $(docker volume ls -q); do
docker volume inspect ${VOLUME}
done

# delete unused volumes
docker volume rm $(docker volume ls -qf dangling=true)

# service
/usr/lib/systemd/system/docker.service
/etc/systemd/system/multi-user.target.wants/docker.service

Links
https://github.com/panticz/installit/blob/master/install.docker.sh
https://docs.docker.com/engine/reference/commandline/dockerd/

Install GitLab

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.gitlab.sh -O - | bash -

#!/bin/bash

# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
    sudo $0
    exit
fi

# install required packages
apt-get install -y ca-certificates curl cron

#  bypass the apt-cacher-ng proxy
echo 'Acquire::HTTP::Proxy::packages.gitlab.com "DIRECT";' > /etc/apt/apt.conf.d/99_gitlab

# download GitLab installation script
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash

# workaround for PostgreSQL shmmax issue
echo "kernel.shmmax=17179869184" >> /etc/sysctl.d/90-shmmax.conf
/sbin/sysctl -p /etc/sysctl.d/90-shmmax.conf

# install GitLab Community Edition
apt-get install -y gitlab-ce

# configure domain
sed -i "s|gitlab.example.com|$(hostname -A | tr -d ' ')|g" /etc/gitlab/gitlab.rb
gitlab-ctl reconfigure

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

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

interval daily 7
interval weekly 3
interval monthly 1

#exclude dev/*
exclude lost+found/*
exclude mnt/*
exclude proc/*
exclude run/*
exclude sys/*

Tomcat configuration

wget https://raw.githubusercontent.com/panticz/installit/master/install.tomcat.sh -O - | bash -

#!/bin/bash

# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
  sudo $0
  exit
fi

# install Java JDK
wget -q https://raw.githubusercontent.com/panticz/installit/master/install.java-jdk.sh -O - | bash -

# install tomcat
apt-get install -y tomcat8

# OPTIONAL: configure JAVA_HOME
echo "JAVA_HOME=/usr/lib/jvm/$(ls /usr/lib/jvm | grep oracle | tail -1)" >> /etc/default/tomcat?

# configure tomcat to linsten on port 80 instead of default 8080
sed -i 's|port="8080"|port="80"|g' /etc/tomcat?/server.xml

# bind to a privileged port
sed -i 's|#AUTHBIND=no|AUTHBIND=yes|g' /etc/default/tomcat?

# restart tomcat
service tomcat8 restart

# 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
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

Ubuntu: Install Nemo file manager

wget https://raw.githubusercontent.com/panticz/installit/master/install.nemo.sh -O - | bash -

#!/bin/bash

sudo add-apt-repository -y ppa:webupd8team/nemo
sudo apt-get update
sudo apt-get install -y nemo

Links
http://www.webupd8.org/2013/10/install-nemo-with-unity-patches-and.html

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

wget -q https://raw.githubusercontent.com/panticz/preseed/master/ipxe/scripts/install_grub_ipxe.sh -O - | bash -

#!/bin/bash

# ensure that this script is run as root
if [ $(id -u) -ne 0 ]; then
  sudo $0
  exit
fi

# download GRUB iPXE boot image
wget -q http://dl.panticz.de/ipxe/ipxe.lkrn -O /boot/ipxe.lkrn

# create GRUB menu entry
wget -q https://raw.githubusercontent.com/panticz/preseed/master/ipxe/scripts/grub/49_ipxe -O /etc/grub.d/49_ipxe 
chmod a+x /etc/grub.d/49_ipxe

# update GRUB config
. /etc/os-release
case ${ID} in
  fedora)
    grub2-mkconfig -o /boot/grub2/grub.cfg
  ;;
  debian|ubuntu)
    update-grub
  ;;
  *)
    echo "Distribution not supported. Please upgrade grub configuration manually"
esac

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

Install LXC (Linux Containers) under Ubuntu

Installation
http://www.panticz.de/install_lxc

Create container
export LANG=en_US.UTF-8
export CONTAINER=wheezy

sudo sudo lxc-destroy -n ${CONTAINER}
sudo lxc-create -t debian -n ${CONTAINER}
sudo lxc-start -d -n ${CONTAINER}

echo 'Acquire::http::Proxy "http://apt-cacher:3142/";' | sudo tee /var/lib/lxc/${CONTAINER}/rootfs/etc/apt/apt.conf

sudo lxc-attach -n ${CONTAINER} -- apt-get clean
sudo lxc-attach -n ${CONTAINER} -- apt-get update
sudo lxc-attach -n ${CONTAINER} -- apt-get dist-upgrade -y

Create CentOS 6 DomU

wget https://raw.githubusercontent.com/panticz/xen/master/domains/centos.6.sh -O - | bash -

#!/bin/bash

#
# IP    : dhcp
# user  : root
# pass  : t00r
#

#
# TODO
# use separate partitions for root (/dev/vg0/centos6-disk) and swap (/dev/vg0/centos6-swap) instead of harddisk image
#

# create disk
lvcreate --name centos6-disk --size 8G vg0

# download installation kernel and initrd
[ -d /tmp/centos6 ] || mkdir /tmp/centos6
wget -q http://mirror.netcologne.de/centos/6/os/x86_64/images/pxeboot/initrd.img -O /tmp/centos6/initrd.img
wget -q http://mirror.netcologne.de/centos/6/os/x86_64/images/pxeboot/vmlinuz -O /tmp/centos6/vmlinuz

# create installation configuration
cat <<EOF> /tmp/centos6-inst
kernel      = '/tmp/centos6/vmlinuz'
ramdisk     = '/tmp/centos6/initrd.img'
memory      = '512'
disk        = [ 'phy:/dev/vg0/centos6-disk,xvda,w' ]
name        = 'centos6-inst'
dhcp        = 'dhcp'
vif         = [ 'mac=00:00:00:00:ce:ce' ]
on_poweroff = 'destroy'
on_reboot   = 'destroy'
on_crash    = 'destroy'
extra       = "text ip=dhcp ks=http://preseed.panticz.de/preseed/centos6-minimal.cfg"
EOF

# install
xm create -c /tmp/centos6-inst

# create CenOS 6 configuration
cat <<EOF> /etc/xen/centos6
bootloader  = "/usr/lib/xen-4.1/bin/pygrub"
memory      = '512'
disk        = [ 'phy:/dev/vg0/centos6-disk,xvda,w' ]
name        = 'centos6'
dhcp        = 'dhcp'
vif         = [ 'mac=00:00:00:00:ce:ce' ]
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'
EOF

# OPTIONAL: add to autostart
ln -s /etc/xen/centos6 /etc/xen/auto/centos6

# start CenOS 6
xm create -c centos6

Links
http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-startinginstall.html

Syndicate content