centos7 搭建jenkins.note

环境:VMware 虚拟机 centos 7+ jdk 1.8+ tomcat7+jenkins搭建好linux 服务器后,关闭防火墙

停止firewall
[root@#localhost ~]# systemctl stop firewalld.service

禁止firewall开机启动
[root@#localhost ~]# systemctl disable firewalld.service
[root@#localhost ~]# vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled

##安装tomcat下载apache-tomcat:地址:http://tomcat.apache.org/download-70.cgi 
http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.94/bin/apache-tomcat-7.0.94.zip
http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.94/bin/apache-tomcat-7.0.94.tar.gz

[root@#localhost ~]# cd /data/www/
[root@#localhost www]# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.94/bin/apache-tomcat-7.0.94.tar.gz

上传tomcat的tar.gz压缩文件
解压:
[root@#localhost tomcat7]# tar zxf apache-tomcat-7.0.94.tar.gz
启动tomcat
[root@#localhost www]# mv apache-tomcat-7.0.94 tomcat7
[root@#localhost www]# ./tomcat7/bin/startup.sh 
Using CATALINA_BASE: /data/www/tomcat7
Using CATALINA_HOME: /data/www/tomcat7
Using CATALINA_TMPDIR: /data/www/tomcat7/temp
Using JRE_HOME: /usr
Using CLASSPATH: /data/www/tomcat7/bin/bootstrap.jar:/data/www/tomcat7/bin/tomcat-juli.jar
Tomcat started.

关闭Tomcat
[root@#localhost www]# ./tomcat7/bin/shutdown.sh 
Using CATALINA_BASE: /data/www/tomcat7
Using CATALINA_HOME: /data/www/tomcat7
Using CATALINA_TMPDIR: /data/www/tomcat7/temp
Using JRE_HOME: /usr
Using CLASSPATH: /data/www/tomcat7/bin/bootstrap.jar:/data/www/tomcat7/bin/tomcat-juli.jar

测试tomcat访问是否成功
http://192.168.1.248:8080/

##使用yum源 安装 java
[root@#localhost www]# yum install -y java-1.8.0-openjdk

##安装jenkins
[root@#localhost www]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
[root@#localhost www]# ll /etc/yum.repos.d/ |grep jenkins
-rw-r--r-- 1 root root 71 11月 30 2016 jenkins.repo

[root@#localhost www]# rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key 
[root@#localhost www]# yum clean all && yum makecache
[root@#localhost www]# yum install -y jenkins

##jenkins 启动命令 
[root@#localhost www]# systemctl start jenkins
[root@#localhost www]# service jenkins start
Starting jenkins (via systemctl): [ 确定 ]

获取admin密码
[root@#localhost www]# cat /var/lib/jenkins/secrets/initialAdminPassword
dcde665f71dd43ebb63cc94e9400c3f4

##测试访问jekins
http://192.168.1.248:8080

如果访问不了  修改jenkins端口
[root@#localhost conf]# vim /etc/sysconfig/jenkins 
======================================
JENKINS_PORT="8081"
======================================

重启jenkins即可,重启后通过
http://192.168.1.248:8081/

05-11 20:12