Last active
May 21, 2018 09:35
-
-
Save seropian/86294e209dae3d4774846ccd4d9a6c6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1. UPDATE YUM | |
yum update | |
#2. UPGRADE KERNEL | |
#See http://bicofino.io/2014/10/25/install-kernel-3-dot-10-on-centos-6-dot-5/ | |
#As root: | |
#Set proxy if needed; replace ip:port with your own | |
export http_proxy="http://1.2.3.4:3128" | |
export https_proxy="http://1.2.3.4:3128" | |
#Install new kernel | |
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org | |
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm | |
yum --enablerepo=elrepo-kernel install kernel-lt | |
#for running VirtualBox integration package | |
# yum --enablerepo=elrepo-kernel install kernel-lt-devel | |
# yum install gcc | |
#run VirtualBox integration package | |
#reboot if: - VirtualBox build not seeing kernel headers from devel OR | |
# - Integration not working properly (i.e. bidirectional clipboard) | |
#Set boot to new kernel | |
#In /etc/grub.conf, set default to the new kernel version, example: | |
default=0 | |
timeout=5 | |
splashimage=(hd0,0)/grub/splash.xpm.gz | |
hiddenmenu | |
title CentOS (3.10.55-1.el6.elrepo.x86_64) | |
root (hd0,0) | |
kernel /vmlinuz-3.10.55-1.el6.elrepo.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=br-abnt2 rhgb quiet | |
... | |
#Reboot machine | |
reboot | |
#3. INSTALL DOCKER | |
#if docker existing, stop all docker containers | |
killall docker | |
#Add cgroup to /etc/fstab | |
cgroup /sys/fs/cgroup cgroup defaults 0 0 | |
mount /sys/fs/cgroup | |
#Or, as an alternative | |
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup | |
#install docker binary | |
curl -fsSLO https://get.docker.com/builds/Linux/x86_64/docker-1.12.0.tgz && tar --strip-components=1 -xvzf docker-1.12.0.tgz -C /usr/local/bin | |
#configure proxy for docker daemon; replace ip:port with your own | |
cat <<EOF | sudo tee -a /etc/sysconfig/docker | |
export http_proxy="http://1.2.3.4:3128" | |
export https_proxy="http://1.2.3.4:3128" | |
export no_proxy="localhost, 127.0.0.1" | |
EOF | |
#give users right to execute docker | |
groupadd docker | |
usermod -aG docker jenkins | |
#generate ssh keys if needed | |
#start docker daemon | |
dockerd --tls --tlscacert=/root/.docker/ca.crt --tlscert=/root/.docker/jenkins.crt --tlskey=/root/.docker/jenkins.key | |
#If client verification needed for ssh then add --tlsverify | |
#dockerd --tlsverify --tlscacert=/root/.docker/ca.crt --tlscert=/root/.docker/jenkins.crt --tlskey=/root/.docker/jenkins.key | |
#Docker to start at boot | |
chkconfig --add docker | |
chkconfig docker on | |
service docker start | |
#prepare docker container environment | |
export DOCKER_HOST="tcp://$HOST:2376" | |
#4. OPTIONAL | |
#create dir for jenkins volume | |
mkdir /app/jenkins && chgroup jenkins 1000 | |
#Install and run jenkins with java | |
docker --tls run -d --restart unless-stopped --name jenkins -p 8080:8080 -p 50000:50000 --env "JENKINS_OPTS=--prefix=/jenkins2" --env "JAVA_OPTS=-Dhttps.proxyHost=10.15.111.69 -Dhttps.proxyPort=3128 -Dhttp.proxyHost=10.15.111.69 -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=\"localhost|other-server\"" -v /app/jenkins:/var/jenkins_home jenkins:2.7.2-alpine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment