centos 安装jenkins

一、初始化配置

安装base组件,yum groupinstall base及gcc、gcc-c++

更改系统文件限制;

关闭ctrl+alt+delete的关机功能及优化sshd服务;

关闭防火墙及selinux;

优化部分系统内核参数(在初始化脚本当中);

关闭不关键的服务。

同步时间

crontab -e

#time synchronization
* */1 * * * /usr/sbin/ntpdate -u pool.ntp.org >/dev/null 2>&1

二、安装jdk和maven环境

1.安装jdk

cd ~/software   
wget http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jdk-6u27-linux-i586-rpm.bin  
chmod u+x jdk-6u27-linux-i586-rpm.bin  
./jdk-6u27-linux-i586-rpm.bin
java -version  

2.安装maven

cd ~/software  
wget http://labs.renren.com/apache-mirror//maven/binaries/apache-maven-3.0.3-bin.tar.gz  
tar -xzvf apache-maven-3.0.3-bin.tar.gz  
cd /opt  
mkdir maven  
chown/chgrp admin maven  
mv ~/software/apache-maven-3.0.3 /opt/maven 

3.配置maven

附:

./执行命令

vi /etc/profile
M2_HOME=/opt/maven/apache-maven-3.0.3
PATH=$PATH:/usr/local/mysql/bin:$M2_HOME/bin
中间用:隔开,这样做每次启动仍然存在,否则只是全局变量,重启消失
保存后 source /etc/profile
env 查看
mvn -version
M2_HOME=/opt/maven/apache-maven-3.0.3    
PATH=$PATH:$M2_HOME/bin   
mvn -version 

3、安装配置jenkins

wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo  
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key  
yum install jenkins  
rpm -ql jenkins  

4.配置jenkins

// edit JENKINS_PORT, JENKINS_USER  
vi /etc/sysconfig/jenkins  

5 修改jenkins权限(如果修改JENKINS_USER情况下,暂时不修改)

chown/chgrp admin /usr/lib/jenkins  
chown/chgrp admin /var/log/jenkins  
chown/chgrp admin /var/lib/jenkins  

6 启动jenkins

/sbin/service jenkins start  

你可能感兴趣的:(centos)