第一种安装方法
可以参考这个https://www.cnblogs.com/jwrwst/p/6520114.html人写的,也可以搜索
安装jenkins出现下面这样的报错的时候,修改tomcat/conf/server.xml
Your container doesn’t use UTF-8 to decode URLs. If you use non-ASCII characters as a job name etc, this will cause problems. See Containers and Tomcat i18n for more details.
<Connector port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8" 主要是这行 connectionTimeout="20000"
redirectPort="8443" />
1 安装 jdk-8版本
cd /usr/src/ wget http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm rpm -ivh jdk-8u151-linux-x64.rpm
2 设置java环境变量
vim /etc/profile
export PATH PATH=$PATH:/usr/local/inotify/bin Java环境变量一定要在前面maven变量放后面,有顺序
export JAVA_HOME=/usr/java/jdk1.8.0_151 这里jdk的安装目录
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib 直接复制内容即可
export PATH=/usr/lib64/qt-3.3/bin:$JAVA_HOME:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/inotify/bin:/root/bin:/usr/local/git/bin:/root/bin 稍稍改变即可
source /etc/profile
vim /etc/profile
MAVEN_HOME=/usr/local/apache-maven-3.5.2 maven的解压目录
export MAVEN_HOME 复制即可
export PATH=${PATH}:${MAVEN_HOME}/bin
source /etc/profile
mvn -v 出现下面信息就是正确安装了
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)
Maven home: /usr/local/apache-maven-3.5.2
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_151/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
安装tomcat
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.82/bin/apache-tomcat-7.0.82.tar.gz
tar -xf apache-tomcat-7.0.82.tar.gz
打开tomcat/conf/server.xml
打开后在<tomcat-users></tomcat-users>之间增加如下用户信息:
<role rolename="admin-gui"></role>
<role rolename="admin-script"></role>
<role rolename="manager-gui"></role>
<role rolename="manager-script"></role>
<role rolename="manager-jmx"></role>
<role rolename="manager-status"></role>
<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
5 上传jenkins.war到tomcat-->webapps下
./startup.sh ; ps -ef | grep tomcat
7 点击install suggested plugins
8 点击Save and Finish
cat /root/.jenkins/secrets/initialAdminPassword 如果要是忘记密码,没有修改过密码的话 账号admin 密码是cat /root/.jenkins/secrets/initialAdminPassword
第二种方法
1 rpm -ivh jdk-8u74-linux-x64.rpm 2 yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y 可以在iso镜像里面找得到、 3 wget https://www.kernel.org/pub/software/scm/git/git-2.7.1.tar.gz --no-check-certificate 4 tar -xzvf git-2.7.1.tar.gz 5 cd git-2.7.1 6 make prefix=/usr/local/git all 7 make prefix=/usr/local/git install 8 ln -s /usr/local/git/bin/git /usr/bin/git 9 echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc 10 source /etc/bashrc 11 wget https://pkg.jenkins.io/redhat-stable/jenkins-2.73.3-1.1.noarch.rpm
rpm -ivh jenkins-2.73.3-1.1.noarch.rpm
rpm -ivh https://pkg.jenkins.io/redhat-stable/jenkins-2.73.3-1.1.noarch.rpm
12 echo JENKINS_HOME="/jenkins" >> /etc/sysconfig/jenkins 12 vim /etc/sysconfig/iptables # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
1 安装 jdk-8版本
cd /usr/src/ wget http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm rpm -ivh jdk-8u151-linux-x64.rpm
2 设置java环境变量
vim /etc/profile
export PATH PATH=$PATH:/usr/local/inotify/bin Java环境变量一定要在前面maven变量放后面,有顺序
export JAVA_HOME=/usr/java/jdk1.8.0_151 这里jdk的安装目录
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib 直接复制内容即可
export PATH=/usr/lib64/qt-3.3/bin:$JAVA_HOME:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/inotify/bin:/root/bin:/usr/local/git/bin:/root/bin 稍稍改变即可
source /etc/profile
vim /etc/profile
MAVEN_HOME=/usr/local/apache-maven-3.5.2 maven的解压目录
export MAVEN_HOME 复制即可
export PATH=${PATH}:${MAVEN_HOME}/bin
source /etc/profile
mvn -v 出现下面信息就是正确安装了
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)
Maven home: /usr/local/apache-maven-3.5.2
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_151/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
安装tomcat
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.82/bin/apache-tomcat-7.0.82.tar.gz
tar -xf apache-tomcat-7.0.82.tar.gz