Use WinScp+XShell to configure the server Ubantu16.04 to install the latest full version of JDK1.8+Tomcat8.5+Jenkins tutorial (suitable for Xiaobai to learn)

1. Windows install WinScp

Official website address: WinScp official website
Insert picture description here

2. Windows install Xhell

Xhell installation: the latest version of Xhell
Insert picture description here

3. Use XShell to connect to the server, as shown in the figure after connecting

Insert picture description here

First check whether the JDK environment exists. If it does not exist, install the JDK first. Generally, version 1.8 is installed by default.

Check the jdk environment

java -version

If JDK1.8 is installed, the following picture will appear.
Insert picture description here
If not, follow the steps below

  1. Go to Huawei Mirror Cloud or Tsinghua Cloud to download the jdk1.8 version to the local
    Huawei Mirror Cloud official website: Huawei Cloud Mirror official website
    Insert picture description here
    Insert picture description here
    Insert picture description here

Insert picture description here

  1. Use WinScp to transfer the just downloaded .tar.gz file to the server, just
    drag the local file to the server

  2. Move the compressed package to the /usr/local file and unzip the jdk package and configure the environment variable
    /home/tinluz/jdk-8u201-1.8.0_201.tar.gz. Change the path to the path you uploaded to the server

mv /home/tinluz/jdk-8u201-1.8.0_201.tar.gz /usr/local

After decompression, configure the JAVA_HOME environment variable as shown in the figure
Insert picture description here

cd /
vim /etc/environment

Press i to enter the editing mode, copy the following code into
JAVA_HOME and write your own jdk decompressed file name

#set java env
export JAVA_HOME=/usr/local/jdk1.8.0_201
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

Refresh the environment to make the configuration take effect

source /etc/environment

Verify the jdk installation again

java -version

2. Install Tomcat8.5

Install JDK1.8+Tomcat8.5 tutorial tomcat JAVA_HOME, you can configure it yourself
, there are tutorials online

3. Install Jenkins

1 Go to Huawei Cloud Mirror to download Jenkins and
click to download the latest version 2.235 version Jenkins
2. Use WinScp to upload to the server and move to /usr/local

cd /
mv /home/tinluz/jenkins_2.235_all.deb /usr/local/

3. Obtain the key of the official website

wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | sudo apt-key add -

4. Create a source list for Jekins

sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Here, the blogger reports an error after performing step 5 that the daemon dependency package is missing. The solution is to replace the source.list source and solve it.
Back up the sources.list file by yourself and modify the source.list source to be the domestic Alibaba Cloud mirror source.

vim /etc/apt/sources.list

After deleting the original content, add the following code to the sources.list file

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

Execute sudo apt-get update and sudo apt-get install upgrade to make the source change effective

sudo apt-get update
sudo apt-get install upgrade

5. Update the source and install Jekins

To prevent jenkins from reporting errors and lack of daemon dependency packages, let us personally download the dependency packages first

sudo apt-get install daemon

Unzip the jenkins uploaded with WinScp

sudo dpkg -i jenkins_2.235_all.deb

4. Start Jenkins

start up

service jenkins start

If the startup fails, check the reason for the startup failure and the jenkins status

systemctl status jenkins.service

**If the error Failed to start LSB: Start Jenkins at boot time is reported, it means that the default port 8080 of Jenkins is occupied, and you can change the port.**
Enter the following command, find the port 8080, modify it to the port you want, and restart it. can

cd /
vim /etc/default/jenkins

Restart jenkins

service jenkins restart

If the error xxx command not found is reported, the JAVA_HOME configuration error of Jenkins is the
solution: as follows:
1. Change JAVA_HOME to your own, and then copy the following code to the /etc/init.d/jenkins file.

JAVA_HOME=/usr/local/jdk1.8.0_201
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
exprot PATH JAVA_HOME CLASSPATH

2. Edit the jenkins file

cd /
vim /etc/init.d/jenkins

3. Restart jenkins

service jenkins restart

The effect of Jenkins after landing

Insert picture description here

to sum up

In the Linux environment, the pure command line installation development environment often encounters various error messages. For installation errors, you should first check the error log and analyze the cause of the error, instead of directly copying the error message to Baidu. In order to facilitate environmental installation, blog The main individual uses WinScp+XShell to assist in configuring the environment. The general routine is to download the required resources from various domestic mirror clouds, such as Tsinghua Cloud and Huawei Cloud. After downloading these resources, use WinScp or XFtp and other tools. Upload to the server, and then use XShell to connect to the server to perform specific decompression, configure environment variables and other operations. The last point is to have a stable mind. It may take a long time for an environment to be calm, and the programmer has to solve various difficult problems. , You need to improve your troubleshooting skills and English skills

Guess you like

Origin blog.csdn.net/weixin_43967679/article/details/108316711