Jenkins Installation Quick Start - degutos/wikis GitHub Wiki
Jenkins Installation
OS: CentOS Linux release 7.5.1804 (Core)
Adding new repository for Jenkins package
[root@andregonzaga1c ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
Importing our package rpm key for security purpose
[root@andregonzaga1c yum.repos.d]# sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
Update our package cache
[root@andregonzaga1c yum.repos.d]# yum update
Installing Jenkins
[root@andregonzaga1c yum.repos.d]# yum install jenkins
Installing Java Openjdk package - Jenkins rely on this to work
[root@andregonzaga1c yum.repos.d]# yum install java-1.8.0-openjdk
Check if any firewall configuration is denying any access
Unit firewalld.service could not be found.
[root@andregonzaga1c yum.repos.d]# systemctl status iptables
Unit iptables.service could not be found.
Start and enable Jenkins to run after restart
[root@andregonzaga1c yum.repos.d]# systemctl start jenkins
[root@andregonzaga1c yum.repos.d]# systemctl enable jenkins
Testing Jenkins response on 8080
[root@andregonzaga1c yum.repos.d]# yum install telnet
[root@andregonzaga1c yum.repos.d]# telnet localhost 8080
say "hello" and check if it responds
Setting up proxy configuration to work around a redirection port from 80 to 8080
[root@andregonzaga1c yum.repos.d]# yum install ngnix
[root@andregonzaga1c yum.repos.d]# systemctl start nginx
[root@andregonzaga1c yum.repos.d]# systemctl enable nginx
[root@andregonzaga1c nginx]# vi /etc/nginx/nginx.conf
before location / { add:
proxy_pass http://127.0.0.1:8080;
Restart nginx
[root@andregonzaga1c nginx]# systemctl restart nginx
Installing elinks and testing against jenkins
[root@andregonzaga1c nginx]# yum install elinks
-
elinks http://127.0.0.1:8080
-
elinks http://127.0.0.1
Enabling SeLinux and testing again
[root@andregonzaga1c nginx]# setenforce 0
[root@andregonzaga1c nginx]# getenforce
- elinks http://127.0.0.1
Installing package to set up SeLinux
[root@andregonzaga1c nginx]# yum install -y setroubleshoot-server selinux-policy-devel
Checking default http ports for SeLinux
[root@andregonzaga1c nginx]# sepolicy network -t http_port_t
Enabling new Port 8080 to the SeLinux
[root@andregonzaga1c nginx]# semanage port -m -t http_port_t -p tcp 8080
[root@andregonzaga1c nginx]# sepolicy network -t http_port_t
Enabling SeLinux default policy again
[root@andregonzaga1c nginx]# setenforce 1
[root@andregonzaga1c nginx]# getenforce
Open your browser and access your Jenkins address
How to check temp password for Jenkins installation
[root@andregonzaga1c nginx]# cat /var/lib/jenkins/secrets/initialAdminPassword
**After Jenkins installation check **
Manage Jenkins on left menu
and look at the error about proxy reverse.
How to fix proxy reverse - Check also in Jenkins UI where example is available
[root@andregonzaga1c nginx]# vi /etc/nginx/nginx.conf
Add the following content after proxy_pass http://127.0.0.1:8080;
``` proxy_redirect default;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffering off;
proxy_request_buffering off; # Required for HTTP CLI commands in Jenkins > 2.54
proxy_set_header Connection ""; # Clear for keepalive
`[root@andregonzaga1c nginx]# systemctl restart nginx`