aws ec2 install jenkins
1. add jenkins yum source:
sudo wget -O /etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/redhat/jenkins.repo
2. add jenkins key:
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
3. install jenkins:
yum install jenkins --nogpgcheck
4. start jenkins & check status:
service jenkins start
service jenkins status
5. expose jenkins UI via aws alb:
1) create aws ALB
2) create target group, protocol as TCP or HTTP, port as 8080
3) register the target as EC2 instance or ip
4) append the target group to ALB
5) in ALB security group, add inbound rules with the internet ip address where will access ALB
6. launch ALB's dns address to launch jenkins GUI
7. as the very first time launch jenkins GUI, follow UI's initial administrator password retrieval method to cat initial password from EC2 file system
8. install jenkins plugins
9. from EC2, install jdk(not jre!), maven, docker
10. for docker, if error raise as:
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post
need to add user into docker group:
1) sudo usermod -a -G docker $USER
2) sudo usermod -a -G docker jenkins
3) newgrp docker
Note: some said with step 3) will apply changes, but I have to reboot EC2 to make jenkins add to docker group
11. for docker, if error raise as:
Starting cgconfig service: Error: cannot mount cpu to /cgroup/cpu: Device or resource busy
/sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed
Failed to parse /etc/cgconfig.conf [FAILED]
Starting docker: . [ OK ]
then need to execute below command:
sudo cgclear
评论
发表评论