Jenkins-1 on Ubuntu 18.04
- Install Java: sudo apt install default-jre (This is not good, as this will install J)
- Go to Jenkins.io to download Generic Java Package (jenkins.war) file.
- java -jar jenkins.war
However, Jenkins will not start up correctly because of an incorrect Java version. If you look in/var/log/jenkins/jenkins.log
, the following error message will be there:Jenkins requires Java 8, but you are running 10.0.1+10-Ubuntu-3ubuntu1 from /usr/lib/jvm/java-11-openjdk-amd64 java.lang.UnsupportedClassVersionError: 54.0 at Main.main(Main.java:128)
As the error message says, Java 8 is needed instead of the Java version that is present on the system. To fix this, install Java 8:
sudo apt-get install openjdk-8-jdk
For Jenkins to be able to use the installed Java 8, make Java 8 the default version of Java:
sudo update-alternatives --config java
In the dialog that appears, select the version that has
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
as its path, and the restart Jenkins (sudo service jenkins restart
).After this, Jenkins should start up normally. You can check that it is the case by visiting
https://zangchuantao.com:8080
, and by looking at the Jenkins logs at/var/log/jenkins/jenkins.log
and making sure that there are no fatal errors reported there. Have fun with automation! - Jenkins offline issue. This is due to SSL certificate.
Fix: open the file~/.jenkins/hudson.model.UpdateCenter.xml
, replacehttps
withhttp
. Restart Jenkins by 192.168.1.98:8080/restart. - Create admin account, psw. Install Jenkins plugin, rebuilder and safe restart.
- Update Jenkins Global Security, Matrix based security, add user 'admin' and authorize all permissions to it.
- Create another user "tester01", and assign it all permissions except the administration in Global Security Settings.
Git Operations
- Git already installed.
-
git config --global user.name "chuantao"
-
git config --global user.email "your email, no need for real"
- Generate certificate by running command:
ssh-keygen -t rsa -C "your email".
The public/private key will be in ~/.ssh/ and later the public key's content will be added to github keys.
- Login to github.com with your own account. Settings ->SSH and GPG keys -> New SSH Key, past public contents here and save. Test this by run
ssh git@github.com
Maven
- Got to maven.apache.org to download maven. Choose bin.zip file to download binary zip archive.
- unzip the download file to /home/chuantao/apache-maven-3.5.4 and add this path to system environment:
sudo nano /etc/environment, add two lines below:
export MAVEN_HOME=/home/chuantao/apache-maven-3.5.4 - run mvn -version to check whether mvn has been correctly set. Set JAVA_HOME to correct value if it reports JAVA_HOME setting error. After setting, source /etc/environment to update it. Note, this file contains path and will override path by removing maven path. So after this, user need to run /etc/profile again to add maven path back ". /etc/profile".
sudo nano /etc/environment
Tomcat
- Go to tomcat.apache.org to download Binary distribution Core zip file.Unzip it.
- Cd to the folder, sudo chmod a+x -R *
- update server.xml to change port from 8080 to 8090,
- sh bin/startup.sh
- open browser, 192.168.1.98:8090