1. Jenkins repository setting
-------------------------------------------------------------------------
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
# Individual Package Downloads
wget https://pkg.jenkins.io/redhat-stable/jenkins-2.89.4-1.1.noarch.rpm
https://pkg.jenkins.io/redhat-stable/
2. Java Install
-------------------------------------------------------------------------
yum list java*jdk-devel
yum install java-1.8.0-openjdk-devel.x86_64
ls -l /usr/bin/javac
/usr/bin/javac -> /etc/alternatives/javac
ls -l /etc/alternatives/javac
/etc/alternatives/javac -> /usr/lib/jvm/java-1.8.0/bin/javac
alternatives --config java
alternatives --config javac
java -version
# Set JAVA_HOME environment variable.
echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0" >> ~/.bashrc
echo "PATH=$PATH:$JAVA_HOME/bin:$HOME/bin" >> ~/.bashrc
echo "export PATH" >> ~/.bashrc
source ~/.bashrc
env | grep JAVA
JAVA_HOME=/usr/lib/jvm/java-1.8.0
3. Jenkins Install
-------------------------------------------------------------------------
1) yum update
#yum upgrade
yum clean all;yum repolist
2) install jenkins
yum install jenkins
off line)
wget https://pkg.jenkins.io/redhat-stable/jenkins-2.89.4-1.1.noarch.rpm
yum install jenkins-2.234-1.1.noarch.rpm
3) jenkins setting
# vim /etc/sysconfig/jenkins
JENKINS_PORT="8080"
JENKINS_ARGS="-Xmx2048m"
# vim /etc/rc.d/init.d/jenkins
candidates="
/usr/lib/jvm/java-1.8.0/bin/java
"
4) firewall setting
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --permanent --zone=public --add-port=8080/tcp
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=443/tcp
firewall-cmd --permanent --zone=public --add-port=22/tcp
firewall-cmd --reload
--------------------------------------
YOURPORT=8080
PERM="--permanent"
SERV="$PERM --service=jenkins"
firewall-cmd $PERM --new-service=jenkins
firewall-cmd $SERV --set-short="Jenkins ports"
firewall-cmd $SERV --set-description="Jenkins port exceptions"
firewall-cmd $SERV --add-port=$YOURPORT/tcp
firewall-cmd $PERM --add-service=jenkins
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-all
firewall-cmd --zone=public --list-all
4. start jenkins
-------------------------------------------------------------------------
1) start jenkins
systemctl enable jenkins
systemctl start jenkins
chkconfig jenkins on
systemctl status jenkins
2) jenkins console
cat /var/lib/jenkins/secrets/initialAdminPassword
3) jenkins 설정 파일
/var/lib/jenkins
/etc/default/jenkins
/etc/init.d/jenkins
※ administrator password
/var/lib/jenkins/home/secrets/initialAdminPassword
● To change attributes of the service
svccfg -s svc:/network/http:jenkins editprop
svcadm refresh svc:/network/http:jenkins
/lib/svc/manifest/network/jenkins-standalone.xml
- jenkins log
tail -f /var/log/jenkins/jenkins.log
※ consult the log
/var/svc/log/network-http:jenkins.log
5. git, maven install
-------------------------------------------------------------------------
1) git install
yum install git
git --version
2) maven install
# yum install maven
#readlink -f /usr/bin/mvn /usr/share/maven/bin/mvn
wget http://apache.tt.co.kr/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -xvzf apache-maven-3.6.3-bin.tar.gz -C /opt
ln -s /opt/apache-maven-3.6.3 /opt/maven
# vim /etc/profile.d/maven.sh
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
chmod +x /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh
mvn --version (mvn -v)
#yum -y install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct vim
6. gradle install
-------------------------------------------------------------------------
wget https://services.gradle.org/distributions/gradle-6.5-bin.zip
unzip -d /opt gradle-6.5-bin.zip
ln -s /opt/gradle-6.5 /opt/gradle
# Set gradle PATH environment
echo "PATH=$PATH:/opt/gradle/bin:$HOME/bin" >> ~/.bashrc
echo "export PATH" >> ~/.bashrc
source ~/.bashrc
gradle -v
https://pkg.jenkins.io/redhat-stable/