It is very troublesome to set up the development and test environment. The company’s development and test server is poisoned to do data recovery. By the way, we can arrange the way of setting up.

I am a programmer, Linux system knowledge is relatively weak, so the system security aspect is not covered in this paper, please make security policy accordingly.

The e Intranet server was exposed to the public network using FRP, resulting in mining. The FRP is still not safe, now it can only be opened when it needs to be penetrated, other times

Shut down.

Mysql data backup and restoration reference: juejin.cn/post/684490…

SpringBoot integrates scaffolding projects from JWT and Mybatis – Plus

Update log

  • 2019-11-18 Add the SSH installation mode
  • Modify the hostname mode
  • 2019-10-25 Add an installation method for Elastic Search
  • Add docker install RabbitMq
  • Add docker installation mode
  • 2019-10-14 Added How to Resolve the conflict of Binding port 80 after Nginx Installation
  • 2019-10-13 Added the ZooKeeper installation mode

The basic configuration

Basic Installation Commands

Some commands may not be installed by default. If the commands cannot be used, perform the following steps to install the commands.

Install the ifconfig

The IP addr command is used to query network information in centos 7

If you still want ifconfig

Install.net – tools

yum install net-tools

Install vim

yum install vim

The network configuration

In VM mode, change the network mode of the VM box to bridge.

Change the hostname

  1. To view the hostname
[root@zhirui-base ~]# hostnamectl Static hostname: zhirui-base Icon name: computer-vm Chassis: vm Machine ID: c9cea1249eaf47379236a0ed4e371584 Boot ID: 94a2959e5c684c94ad6e4e4b096af282 Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: CPE :/ O: CentOS: CentOS :7 Kernel: Linux 3.10.0-957.el7.x86_64 Architecture: x86-64Copy the code

To view only static, transient, or flexible host names, use the “–static”, “– TRANSIENT”, or “–pretty” options respectively

  1. Change hostname and exit the connection
[root@zhirui-base ~]# hostnamectl --static set-hostname zhirui-test [root@zhirui-base ~]# exit logout Connection closing... Socket close. Connection closed by foreign host. Disconnected from remote host(192.168.1.234) at 12:33:40. Type 'help' to learn how to use Xshell prompt. [C:\~]$Copy the code

If you only want to change a specific host name (static, transient or flexible), you can use the “–static”, “–transient” or “–pretty” options.

  1. Reconnect to view hostname
Connecting to 192.168.1.234:22... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Last login: Sun Oct 27 12:29:20 2019 from 192.168.1.119 [root@zhirui-test ~]# hostnamectl --static zhirui-test [root@zhirui-test ~]#  hostnamectl Static hostname: zhirui-test Icon name: computer-vm Chassis: vm Machine ID: c9cea1249eaf47379236a0ed4e371584 Boot ID: 94a2959e5c684c94ad6e4e4b096af282 Virtualization: kvm Operating System: CentOS Linux 7 (Core) CPE OS Name: CPE :/ O: CentOS: CentOS :7 Kernel: Linux 3.10.0-957.el7.x86_64 Architecture: x86-64 [root@zhirui-test ~]#Copy the code
  1. Modify the hosts
[root@zhirui-test ~]# vim /etc/hosts
127.0.0.1      zhirui-test  localhost
#127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain
::1        localhost localhost.localdomain localhost6 localhost6.localdomai
Copy the code

When changing static/transient host names, any special characters or whitespace characters are removed, and any uppercase letters in supplied parameters are automatically converted to lowercase. Once the static hostname is changed, /etc/hostname is automatically updated. However, /etc/hosts will not be updated to save the changes, so you must manually update /etc/hosts every time you change the host name before restarting CentOS 7. Otherwise, the system will be slow to restart.

Changing an IP Address

By default, the server uses DHCP to obtain the address. The address can change at any time, so you need to change it to a fixed address for easy management.

Command as follows:

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
Copy the code

Run the following command to restart the nic: service network restart

You just need to make sure that the configuration in the annotation exists, and everything else doesn’t have to be the same.

TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="static" The default mode is DHCP. IPADDR="192.168.1.254" ### IP address of the NETWORK adapter BROADCAST-"192.168.1.255" ### subnet BROADCAST address GATEWAY="192.168.1.1" ### GATEWAY address DNS1="192.168.1.1" ###DNS address DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="enp0s3" UUID=" 226a0688-3a2F-4485-9694-d8FEa85694AD "DEVICE=" enp0S3" ONBOOT="yes" # UUID=" 226a0688-3a2F-4485-9694-d8FEa85694AD "DEVICE=" ENp0S3" ONBOOT="yes" # UUID=" 226a0688-3a2F-4485-9694-d8FEa85694ad "DEVICE=" enP0S3" ONBOOT="yes" # The default setting is yes.Copy the code

Run the ifconfig or IP addr command to view the configured IP address:

[root@zhirui-base ~]# ifconfig enp0s3: Flags = 4163 < UP, BROADCAST, RUNNING, MULTICAST > mtu 1500 inet 192.168.1.254 netmask 255.255.255.0 BROADCAST 192.168.1.255 inet6 fe80::28c9:6c73:d85e:2845 prefixlen 64 scopeid 0x20<link> ether 08:00:27:6b:14:19 txqueuelen 1000 (Ethernet) RX Packets 73394352 bytes 11462789475 (10.6 GiB) RX errors 0 Dropped 0 Overruns 0 frame 0 TX packets 80460498 bytes 119337796839 (111.1 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: Flags =73<UP,LOOPBACK,RUNNING> MTU 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixLen 128 scopeid 0x10<host> loop Txqueuelen 1000 (Local Loopback) RX packets 10370731 bytes 3481539349 (3.2 GiB) RX errors 0 Dropped 0 Overruns 0 frame 0 TX packets 10370731 bytes 3481539349 (3.2 GiB) TX errors 0 Dropped 0 Overruns 0 carrier 0 collisions 0 [root@zhirui-base ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host LO valid_lft forever preferred_lft forever Inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27.6b :14:19 BRD FF :ff:ff:ff: FF inet 192.168.1.254/24 BRD 192.168.1.255 Scope global noprefixroute enp0S3 valid_lft forever preferred_lft forever inet6 fe80::28c9:6c73:d85e:2845/64 scope link noprefixroute valid_lft forever preferred_lft forever [root@zhirui-base ~]#Copy the code

If the IP address is 192.168.1.254, the configuration is successful.

Installing the SSH Service

We usually use Xshell to log in to the server, which is to open the SSH protocol, so we need to open the SSH service on the server.

1) Check whether the SSH service is installed
[root @ zhirui - base ~] # RPM - qa | grep openssh openssh - 7.4 - p1-21. El7. X86_64 openssh - clients - 7.4 - p1-21. El7. X86_64 Openssh server - 7.4 - p1-21. El7. X86_64 / root @ zhirui - base ~ #Copy the code

The preceding command is successfully installed. Run the service SSHD start command to enable the installation.

2) If the installation fails, install it
$ yum install openssh-server
Copy the code
3) the SSH
$ /bin/systemctl start sshd.service
Copy the code

Open after use ps – e | grep SSHD check the SSH service is open

$ ps -e | grep sshd1554? 00:00:00 sshd 4162 ? 00:00:00 sshdCopy the code

22 check with netstat – an | grep 22 port is open

$ netstat -an | grep 22TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTENCopy the code

Run the systemctl enable sshd.service command to add the SSH service to the automatic startup list

$ systemctl enable sshd.service
Copy the code

Modify the DNS

1) vi /etc/resolv.conf
[root@localhost ~]# vi /etc/resolv.conf
# Generated by NetworkManagerNameserver 192.168.1.1 # Nameserver 114.114.114.114 # other DNS naemServer 1.1.1.1 search localdomainCopy the code
3) Ensure that DNS resolution is available

[root@localhost Desktop]# grep hosts /etc/nsswitch.conf

Configuring the Update Source

Set the update source to Aliyuan

Create a new sourceset. sh file and execute it with the following code:

chmod 775 sourceSet.sh

#! /bin/bash
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#Function:    update source
#Usage: bash update_source.sh
#Author: Customer service department
#Company: Alibaba Cloud Computing
#Version: 5.0
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #check_os_release() { while true do os_release=$(grep "Red Hat Enterprise Linux Server release" /etc/issue 2>/dev/null) os_release_2=$(grep "Red Hat Enterprise Linux Server release" /etc/redhat-release 2>/dev/null) if [ "$os_release" ] && [  "$os_release_2" ] then if echo "$os_release"|grep "release 5" >/dev/null 2>&1 then os_release=redhat5 echo "$os_release" elif echo "$os_release"|grep "release 6" >/dev/null 2>&1 then os_release=redhat6 echo "$os_release" else os_release="" echo "$os_release" fi break fi os_release=$(grep "Aliyun Linux release" /etc/issue 2>/dev/null) os_release_2=$(grep "Aliyun Linux release" /etc/aliyun-release 2>/dev/null) if [ "$os_release" ] && [ "$os_release_2" ] then if echo "$os_release"|grep "release 5" >/dev/null 2>&1 then os_release=aliyun5 echo "$os_release" elif echo "$os_release"|grep "release 6" >/dev/null 2>&1 then os_release=aliyun6 echo "$os_release" elif echo "$os_release"|grep "release 7" >/dev/null 2>&1 then os_release=aliyun7 echo "$os_release" else os_release="" echo "$os_release" fi break fi  os_release_2=$(grep "CentOS" /etc/*release 2>/dev/null) if [ "$os_release_2" ] then if echo "$os_release_2"|grep "release 5" >/dev/null 2>&1 then os_release=centos5 echo "$os_release" elif echo "$os_release_2"|grep "release 6" >/dev/null 2>&1 then os_release=centos6 echo "$os_release" elif echo "$os_release_2"|grep "release 7" >/dev/null 2>&1 then os_release=centos7 echo "$os_release" else os_release="" echo "$os_release" fi break fi os_release=$(grep -i "ubuntu" /etc/issue 2>/dev/null) os_release_2=$(grep -i "ubuntu" /etc/lsb-release 2>/dev/null) if [ "$os_release" ] && [  "$os_release_2" ] then if echo "$os_release"|grep "Ubuntu 10" >/dev/null 2>&1 then os_release=ubuntu10 echo "$os_release elif" echo "$os_release" | grep "Ubuntu 12.04" > / dev/null 2 > &1 then os_release = ubuntu1204 echo "$os_release" Elif echo "$os_release" | grep "Ubuntu 12.10" > / dev/null 2 > &1 then os_release = ubuntu1210 echo "$os_release" elif echo "$os_release" | grep "Ubuntu 14.04" > / dev/null 2 > &1 then os_release = ubuntu1204 echo "$os_release" else os_release = "" echo "$os_release" fi break fi os_release=$(grep -i "debian" /etc/issue 2>/dev/null) os_release_2=$(grep -i "debian" /proc/version 2>/dev/null) if [ "$os_release" ] && [ "$os_release_2" ] then if echo "$os_release"|grep "Linux 6" >/dev/null 2>&1 then os_release=debian6 echo "$os_release" elif echo "$os_release"|grep "Linux 7" >/dev/null 2>&1 then os_release=debian7 echo "$os_release" else os_release="" echo "$os_release" fi break fi os_release=$(grep -i "opensuse" /etc/issue 2>/dev/null) os_release_2=$(grep -i "opensuse" /etc/*release 2>/dev/null) if [ "$os_release" ] && [ "] then if echo "" $os_release_2 $os_release" | grep "packages 13.1" > / dev/null 2 > &1 then os_release = opensuse1301 echo "$os_release" else os_release="" echo "$os_release" fi break fi break done } modify_aliyun5_yum() { wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo sed -i 's/\$releasever/5/' /etc/yum.repos.d/CentOS-Base.repo wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo yum clean metadata yum makecache cd ~ } modify_rhel5_yum() { wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo yum clean metadata yum makecache cd ~ } modify_rhel6_yum() { wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum clean metadata yum makecache cd ~ } modify_rhel7_yum() { wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean metadata yum makecache cd ~ } update_ubuntu10_apt_source() { echo -e "\033[40;32mBackup the original configuration file,new name and path is /etc/apt/sources.list.back.\n\033[40; 37m" cp -fp /etc/apt/sources.list /etc/apt/sources.list.back cat > /etc/apt/sources.list <<EOF#ubuntu
deb http://cn.archive.ubuntu.com/ubuntu/ maverick main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ maverick main restricted universe multiverse
#163
deb http://mirrors.163.com/ubuntu/ maverick main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ maverick main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ maverick-updates universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ maverick-updates universe main multiverse restricted
#lupaworlddeb http://mirror.lupaworld.com/ubuntu/ maverick main universe restricted multiverse deb-src http://mirror.lupaworld.com/ubuntu/ maverick main universe restricted multiverse deb http://mirror.lupaworld.com/ubuntu/  maverick-security universe main multiverse restricted deb-src http://mirror.lupaworld.com/ubuntu/ maverick-security universe main multiverse restricted deb http://mirror.lupaworld.com/ubuntu/ maverick-updates universe main multiverse restricted deb http://mirror.lupaworld.com/ubuntu/ maverick-proposed universe main multiverse restricted deb-src http://mirror.lupaworld.com/ubuntu/ maverick-proposed universe main multiverse restricted deb http://mirror.lupaworld.com/ubuntu/ maverick-backports universe main multiverse restricted deb-src http://mirror.lupaworld.com/ubuntu/ maverick-backports universe main multiverse restricted deb-src http://mirror.lupaworld.com/ubuntu/ maverick-updates universe main multiverse restricted EOF apt-get update } update_ubuntu1204_apt_source() { echo -e "\033[40; 32mBackup the original configuration file,new name and path is /etc/apt/sources.list.back.\n\033[40; 37m" cp -fp /etc/apt/sources.list /etc/apt/sources.list.back cat > /etc/apt/sources.list <<EOF#12.04deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse EOF apt-get update } update_ubuntu1210_apt_source() { echo -e "\033[40; 32mBackup the original configuration file,new name and path is /etc/apt/sources.list.back.\n\033[40; 37m" cp -fp /etc/apt/sources.list /etc/apt/sources.list.back cat > /etc/apt/sources.list <<EOF#12.10deb http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse EOF apt-get update } update_ubuntu1404_apt_source() { echo -e "\033[40; 32mBackup the original configuration file,new name and path is /etc/apt/sources.list.back.\n\033[40; 37m" cp -fp /etc/apt/sources.list /etc/apt/sources.list.back cat > /etc/apt/sources.list <<EOF#14.04deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted  universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse EOF apt-get update } update_debian6_apt_source() { echo -e "\033[40; 32mBackup the original configuration file,new name and path is /etc/apt/sources.list.back.\n\033[40; 37m" cp -fp /etc/apt/sources.list /etc/apt/sources.list.back cat > /etc/apt/sources.list <<EOF#debian6deb http://mirrors.aliyun.com/debian/ squeeze main non-free contrib deb http://mirrors.aliyun.com/debian/ squeeze-proposed-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ squeeze main non-free contrib deb-src http://mirrors.aliyun.com/debian/ squeeze-proposed-updates main non-free contrib EOF apt-get update } update_debian7_apt_source() { echo -e "\033[40; 32mBackup the original configuration file,new name and path is /etc/apt/sources.list.back.\n\033[40; 37m" cp -fp /etc/apt/sources.list /etc/apt/sources.list.back cat > /etc/apt/sources.list <<EOF#debian7deb http://mirrors.aliyun.com/debian/ wheezy main non-free contrib deb http://mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ wheezy main non-free contrib deb-src http://mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib EOF apt-get update } update_opensuse_source() { mv /etc/zypp/repos.d/* /tmp/ zypper addrepo -f http://mirrors.aliyun.com/opensuse/distribution/13.1/repo/oss/ packages - 13.1 - the Oss zypper addrepo - f http://mirrors.aliyun.com/opensuse/distribution/13.1/repo/non-oss/ packages - 13.1 - Non - Oss zypper addrepo - f http://mirrors.aliyun.com/opensuse/update/13.1/ packages - 13.1 - Update - Oss zypper addrepo - f http://mirrors.aliyun.com/opensuse/update/13.1-non-oss/ packages - 13.1 - Update - Non - Oss zypper addrepo - f http://mirrors.aliyun.com/opensuse/distribution/13.1/repo/oss/ packages - 13.1 - the Oss - aliyun zypper addrepo - f http://mirrors.aliyun.com/opensuse/distribution/13.1/repo/non-oss/ packages - 13.1 - Non - Oss - aliyun zypper addrepo - f http://mirrors.aliyun.com/opensuse/update/13.1/ packages - 13.1 - Update - the Oss - aliyun zypper addrepo - f http://mirrors.aliyun.com/opensuse/update/13.1-non-oss/ packages - 13.1 - Update - Non - Oss - aliyun}
####################Start###################
#check lock file ,one time only let the script run one time LOCKfile=/tmp/.$(basename $0) if [ -f "$LOCKfile" ] then echo -e "\033[1;40; 31mThe script is already exist,please next time to run this script.\n\033[0m" exit else echo -e "\033[40; 32mStep 1.No lock file,begin to create lock file and continue.\n\033[40;37m" touch $LOCKfile fi
#check userif [ $(id -u) != "0" ] then echo -e "\033[1;40;31mError: You must be root to run this script, please use root to install this script.\n\033[0m" rm -rf $LOCKfile exit 1 fi echo -e "\033[40; 32mStep 2.Begin to check the OS issue.\n\033[40; 37m" os_release=$(check_os_release) if [ "X$os_release" == "X" ] then echo -e "\033[1;40; 31mThe OS does not identify,So this script is not executede.\n\033[0m" rm -rf $LOCKfile exit 0 else echo -e "\033[40; 32mThis OS is $os_release.\n\033[40;37m" fi echo -e "\033[40; 32mStep 3.Begin to modify the source configration file and update.\n\033[40; 37m" case "$os_release" in aliyun5) modify_aliyun5_yum ;; redhat5|centos5) modify_rhel5_yum ;;  redhat6|centos6|aliyun6) modify_rhel6_yum ;; centos7|aliyun7) modify_rhel7_yum ;;  ubuntu10) update_ubuntu10_apt_source ;; ubuntu1204) update_ubuntu1204_apt_source ;;  ubuntu1210) update_ubuntu1210_apt_source ;; ubuntu1404) update_ubuntu1404_apt_source ;;  debian6) update_debian6_apt_source ;; debian7) update_debian7_apt_source ;; opensuse1301) update_opensuse_source ;;  esac echo -e "\033[40;32mSuccess,exit now!\n\033[40;37m" rm -rf $LOCKfileCopy the code

The development environment

JDK

Download the JDK

The latest JDk1.8.0_211 I have uploaded to the web disk:

Link: pan.baidu.com/s/1B9DRL5iZ… Extract code: 5E92 Copy this section of content to open baidu netdisk mobile App, more convenient operation oh)

Upload and decompress the package to /usr/local/bas/jdk1.8.0_211

Setting environment variables:

Vi /etc/profile Add the following information at the end:

#java environmentExport JAVA_HOME = / usr/local/base/jdk1.8.0 _211 export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar export PATH=$PATH:${JAVA_HOME}/binCopy the code
Reload environment variables:
[root@izwz9hy3mj62nle7573jv5z jdk1.8.0_181]# source /etc/profile [root@izwz9hy3mj62nle7573jv5z jdk8.0_181]# Java -version Java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-B13) Java HotSpot(TM) 64-bit Server VM (Build 25.181-B13, mixed mode)Copy the code

Uninstall the JDK:

If you need to uninstall, just delete the environment variables and the decompressed directory of the JDK.

Installation services

Elastic Search (ES)

Centos install

  1. JDK environment configuration (see above)
  2. The installation
The curl - L - O tar XVF - https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz Elasticsearch - 6.2.4. Tar. GzCopy the code

${elasticSearch} = ${elasticSearch} = ${elasticSearch}

  1. Start the

    Under the root for${elasticsearch}/binDirectory Permission Settings
chmod 775 *
Copy the code

Add user “elastic”

adduser elastic
Copy the code

The unzip directory is licensed to user “Elastic”

Chown -r elastic elasticsearch - 6.2.4Copy the code

Su to the elastic user

su elastic
Copy the code

${elasticSearch}/bin/ elasticSearch starts successfully. The node name is wib4w5f.



ps -ef | grep elastic

[root@localhost ~]# ps -ef | grep elastic root 24494 24002 0 17:54 pts/0 00:00:00 su elastic elastic 24495 24494 0 17:54  pts/0 00:00:00 bash root 24670 24521 0 18:03 pts/0 00:00:00 su elastic elastic 24671 24670 0 18:03 pts/0 00:00:00 bash elastic 24700 24671 2 18:04 pts/0 00:00:10 /apps/jdk8/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.KrRABQX8 -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m - Des. Path. Home = / usr/local/elasticsearch - 6.2.4 - Des. Path. The conf = / usr/local/elasticsearch - 6.2.4 / config - cp / usr/local/elasticsearch - 6.2.4 / lib / * org. Elasticsearch. The bootstrap. Elasticsearch root 24876 24858 PTS / 0 canopy 1 00:00:00 grep --color=auto elasticCopy the code
  1. You can also start by specifying the node name
./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name
Copy the code

Startup success:

  1. Cluster mode (Not tested) After the installation, enable the boot mode of each node. For example, two nodes:
  • Startup mode of node 1:
./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name01
Copy the code
  • Startup mode of node 2:
./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name02
Copy the code

docker

Docker-io is the previous earlier version, version number is 1., the latest version is 1.13, and docker-CE is the new version, divided into community version docker-CE and enterprise version docker-EE, version number is 17., the latest version is 17.12. The enterprise version costs a fee.

Prerequisites for installation

  1. A static IP address is configured and the DNS is configured. If no, refer to
  2. To uninstall the previous version, use the following methods:
$ sudo yum remove docker \
               docker-client \
               docker-client-latest \
               docker-common \
               docker-latest \
               docker-latest-logrotate \
               docker-logrotate \
               docker-selinux \
               docker-engine-selinux \
               docker-engine
Copy the code

/var/lib/docker /var/lib/docker

Install the necessary system tools:

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Copy the code

Adding software source information:

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Copy the code

Run the following command to updateyumIndex of the package

sudo yum makecache fast
Copy the code

Install the docker

yum -y install docker-ce
Copy the code

View the installed version

docker version 
Copy the code

Start the docker

systemctl start docker
Copy the code

The rabbitmq (docker way)

Docker Hub image repository address:hub.docker.com/

Search for desired images

Pull the mirror

Docker pull the rabbitmq: 3.8 - rc - managementCopy the code

Use Docker Images to view

Start the rabbitmq

Docker run -d --name rabbitmq3.8.2 -p 5672:5672 -p 15672:15672 -v /data:/var/lib/rabbitmq --hostname myRabbit -e RABBITMQ_DEFAULT_VHOST=my_vhost -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin --privileged=true Docker. IO/rabbitmq: 3.8 - rc - managementCopy the code

-D background running container; –name Specifies the container name. -p Specifies the port on which the service runs (5672: application access port; 15672: Console Web port number); -v Mapping directory or file. (one important thing about RabbitMQ is that it stores data according to what is called a “node name”, which is the hostname by default); -e Specifies the environment variable. RABBITMQ_DEFAULT_VHOST: specifies the default VM name. RABBITMQ_DEFAULT_USER: default user name. RABBITMQ_DEFAULT_PASS: password for the default user name); — Privileged =true Does -v directory mapping, which may result in no privileged.

Use the docker ps command to view the running container

[root@test1 data]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 872e75cf838b Docker. IO/rabbitmq: 3.8 - rc - management "docker - the entrypoint..." 4 minutes ago Up 4 minutes 4369/ TCP, 5671/ TCP, 0.0.0.0:5672->5672/ TCP, 15671/ TCP, 25672/ TCP, 0.0.0.0:15672 - > 15672 / TCP rabbitmq3.8.2Copy the code

Open the Web management terminal:http://youip:15672

Permissions need to be configured. The login account password is specified as admin/admin when the Docker container is started. Click the Virtual Hosts on the right to add a Virtual Hosts with /.

zookeeper

JDK must be installed before zooKeeper is installed because JDK support is required to start ZooKeeper

download

https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz
Copy the code

Unpack the

Tar xf - apache - they are - 2.6.2 - bin. Tar. GzCopy the code

configuration

The zooKeeper configuration file is zoo. CFG, which must be created first

[root@localhost ~]# cd apache-zookeeper-3.5.5-bin/conf/
[root@localhost conf]# ll
total 12
-rw-r--r--. 1 2002 2002  535 Feb 15  2019 configuration.xsl
-rw-r--r--. 1 2002 2002 2712 Apr  2  2019 log4j.properties
-rw-r--r--. 1 2002 2002  922 Feb 15  2019 zoo_sample.cfg
[root@localhost conf]# cp zoo_sample.cfg zoo.cfg
Copy the code

Then perform the following configuration:

DataDir =/var/lib/zookeeper dataDir=/var/lib/zookeeper dataDir=/var/lib/zookeeper DataLogDir =/var/lib/log ## dataDir clientPort=2181 ## dataLogDir=/var/lib/log ## InitLimit =5 ## The time for the Leader server to wait for the followers to start and complete data synchronization. The default value is 10. SyncLimit =2 ## The maximum latency for heartbeat detection between the Leader server and followers. The default value is 5, which is 5 times the tickTimeCopy the code

Start the

Enter the bin command and start

[root@localhost conf]# cd .. /bin [root@localhost bin]# ./zkServer.sh start ZooKeeper JMX enabled by default Using config: / root/apache - they are - 2.6.2 - bin/bin /.. /conf/zoo.cfg Starting zookeeper ... STARTED [root@localhost bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: / root/apache - they are - 2.6.2 - bin/bin /.. /conf/zoo.cfg Client port found: 2181. Client address: localhost. Mode: standaloneCopy the code

Cluster installation reference: www.cnblogs.com/cyfonly/p/5…

nginx

Add the source

# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
Copy the code

The installation

yum install -y nginx
Copy the code

Check the installation directory

# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz /usr/share/man/man3/nginx.3pm.gz
Copy the code
  • Nginx configuration path: /etc/nginx/
  • Run the program /usr/sbin/nginx
  • PID directory: /var/run/nginx.pid
  • Error log: /var/log/nginx/error.log
  • Access log: / var/log/nginx/access. Log
  • The default site directory is /usr/share/nginx/html

The main things needed are the configuration path and the execution path.

Rev. Stop command

#Start the
[root@nginx]#/usr/sbin/nginx -c /etc/nginx/nginx.conf
#Test configuration
[root@nginx]#/usr/sbin/nginx -c /etc/nginx/nginx.conf -t
#restart
[root@nginx]# /usr/sbin/nginx -s reload
[root@nginx]# /usr/sbin/nginx -c /etc/nginx/nginx.conf -s reload

Copy the code

test

If yes, the command output is successful

[root@zhirui-base nginx]# curl localhost:80 <! PUBLIC DOCTYPE HTML "- / / / / W3C DTD XHTML 1.1 / / EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" > < HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Test Page for the Nginx HTTP Server on Fedora</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> ...Copy the code

Of course, you can also open the url test in the browser.

Remember firewall release port! , CentOS7 Firewall operation reference: juejin.cn/post/684490…

Nginx configuration file configuration reference:

Juejin. Cn/post / 684490…

Juejin. Cn/post / 684490…

Problems encountered

A conflict occurs when port 80 is configured for the first time

After the installation, modify the configuration file to add port 80 listening

[root@zhirui-base nginx]# vim /etc/nginx/nginx.conf server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /wms/website; index index.html index.htm; }}Copy the code

Run the /usr/sbin/nginx -c /etc/nginx/nginx.conf -t command to check whether the following error occurs:

[root@zhirui-base ~]# /usr/sbin/nginx -c /etc/nginx/nginx.conf -s reload
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
Copy the code

Solution: Run the grep -r localhost /etc/nginx/ command to check the conflict. Port 80 is also bound to a default.conf file.

[root@zhirui-base ~]# grep -r localhost /etc/nginx/
/etc/nginx/conf.d/default.conf:    server_name  localhost;
Binary file /etc/nginx/.nginx.conf.swp matches
/etc/nginx/nginx.conf:        server_name  localhost;
Copy the code

Successfully detected and started nginx after renaming default.conf.

mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
Copy the code

mysql

Installation:

Mariadb and mysql are common. Mariadb is an open source branch of mysql, which is more promising than mysql.

# yum install mariadb-server mariadb 
Copy the code

Configuration configuration file:

#vim /etc/my.cnf[mysqld] character-set-server = utf8 [mysqld] character-set-server = utf8 Group_concat_max_len = 204800 # Change the maximum length of the returned stringCopy the code

Start and stop operation:

Mariadb systemctl start mariadb systemctl stop mariadb # Mariadb systemctl restart mariadb Enable mariadb # Enable mariadbCopy the code

Configure accounts and rights

You don’t need a password the first time you log in

# mysql -uroot -p
use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
update user set password=password("123456") where user='root';
flush privileges;
exit
Copy the code

Add port to firewall and restart firewall:

firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
Copy the code

To uninstall, use the following methods:

Reference: www.cnblogs.com/javahr/p/92…

  1. Run the following command to check whether mysql is installed before
`rpm -qa|grep -i mysql`
Copy the code

You can see the following figure:

Display before installing:

MySQL – the client – 5.5.25 a – 1. Rhel5

The MySQL server – 5.5.25 a – 1. Rhel5

  1. Stop the mysql service and delete the mysql

Run the RPM -e -nodeps command to delete the package name

&emsp; &emsp; RPM -ev --nodeps mysql-client-5.5.25a-1.rhel5&emsp; RPM -ev --nodeps mysql-client-5.5.25a-1.rhel5&emsp; &emsp; RPM - ev -- nodeps MySQL server - 5.5.25 a - 1. The rhel5Copy the code
  1. Mysql > delete files and libraries **
`find / -name mysql`
Copy the code

The search results are as follows:

`find / -name mysql` `/var/lib/mysql``/var/lib/mysql/mysql``/usr/lib64/mysql  `
Copy the code

Delete the corresponding mysql directory

`rm -rf /var/lib/mysql``rm -rf /var/lib/mysql``rm -rf /usr/lib64/mysql`
Copy the code

The specific steps are as follows: Find the directory and delete it

/etc/my.cnf will not be deleted after uninstallation

`rm -rf /etc/my.cnf`
Copy the code
  1. Check again to see if mysql is installed on the machine
`rpm -qa|grep -i mysql`
Copy the code

If the yum command is installed, run the following command:

yum remove mariadb*

yum remove mysql*

redis

Install a warehouse

The repository needs to be installed in order to be able to install the yum command

yum install epel-release
Copy the code

Install the Redis database

`yum ``install` `redis`
Copy the code

Once installed, start the Redis service using the following command

Service redis stop service redis stop service redis stop service redis stop `-ef | ``grep` `redis`Copy the code

Set Redis to start automatically upon startup

`chkconfig redis on`
Copy the code

Enter the Redis service

Redis -cli # list all keys *Copy the code

Modify the configuration

Opening a Configuration file
`vi` `/etc/redis``.conf`
Copy the code
Modifying the Default Port

Change port 6379 to a corresponding port

Changing the Default Password

Look for requirePass Foobared and change foobared to your password

Allow remote access
# Find bind 127.0.0.1 to comment it out
# find protected-mode yes
protected-mode no
Copy the code

nexus

The installation

Website address: www.sonatype.com/download-os…

# cd /opt
#Wget HTTP: / / https://download.sonatype.com/nexus/3/nexus-3.2.0-01-unix.tar.gz
#Tar ZXVF nexus - 3.2.0-01 - Unix. Tar. Gz
Copy the code

After decompression, there is also a Sonatyoe-work directory in the current directory in addition to nexus-3.2.0-01. Users can change the directory to another path or use soft link as required for storing warehouse data. Here is how to change it to another path by changing the configuration file. Nexus-3.2.0-01 /bin/nexus.vmoptions:

#Vim/opt/nexus - 3.2.0-01 / bin/nexus. Vmoptions
Copy the code

They correspond to the following attributes, which can be modified if necessary:

-XX:LogFile=.. /sonatype-work/nexus3/log/jvm.log -Dkaraf.data=.. /sonatype-work/nexus3 -Djava.io.tmpdir=.. /sonatype-work/nexus3/tmpCopy the code

The sonatype-work/nexus3/etc directory has a configuration file nexus.properties, which can be configured with the corresponding IP address and port

Open a file with Vim:

vim nexus.properties
Copy the code

The default configurations are as follows. If IP addresses conflict, you can change the port number as required:

# Jetty section
# application-port=8081
#Application - host = 0.0.0.0
# nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
# nexus-context-path=/.Copy the code

You can also run nexus with a new account in nexus-3.2.0-01/bin/nexus.rc.

Rc: edit the nexus.

run_as_user="nexus"
Copy the code

You need to add a user named Nexus to your Linux system to boot the Nexus.

configuration

To access nexus: http://serverip:8081, login is required before configuration

The default user name and password are admin and admin123 respectively.

configurationmaven-central

Modify the remote warehouse address of central warehouse (it is suggested to change it to spring or Ali Cloud’s warehouse)

The warehouse address is as follows:

1. http://repo1.maven.org/maven2 (official, Speed) 2. http://maven.aliyun.com/nexus/content/repositories/central/ (ali cloud, speed) 3. http://repository.jboss.com/maven2/ 4.<https://repository.sonatype.org/content/groups/public/> 5.http://mvnrepository.com/Copy the code

Modify the rebuild index

Configuring a Third-party Warehouse

This repository is used to upload private jars.

Click Create Repository and enter the name 3rd-repo and the other defaults.

configurationmaven-public

Maven-public is the central group of Nexus. The url of nexus we used is filled in with the address of this group. So here we need to add the repository we just created to the group.

Select and add to the right:

Maven is deployed to nexus

I’ve compiled several ways to deploy to Maven here: juejin.cn/post/684490…

git

Before installing Jinkens, you need to install Git directly with the yum command

# yum install git
Copy the code

After installation, you need to find the location of git program in the following way, which Jenkins needs to use later.

# find / -name git
/usr/bin/git
Copy the code

Git is located in /usr/bin/git.

Check the Git version

# git --versionThe git version 1.8.3.1Copy the code

maven

The installation

Maven needs to be installed before jinkens can be installed

Download page: maven.apache.org/download.cg…

Download and Install:

Wget tar ZXF - http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz Gz mv apache-maven-3.6.2 CD apache-maven-3.6.2/conf vim settings.xmlCopy the code

Settings. The XML configuration

In the conf directory, there is settings. XML, which needs to be configured before using it.

If Jenkins cannot be built after being configured, please refer to: Maven Configuration: Jenkins Production Environment

You need to configure the following items:

  1. Configure the storage path for the downloaded JAR
<localRepository>/path/to/local/repo</localRepository>
Copy the code

  1. Configure the warehouse address

    When Jenkins was building, I configured the following two warehouses at the same time. The private server private JAR needed by the program kept running to Ali Cloud to download, and then prompted that it could not be downloaded. If this happens, try keeping only the private server’s warehouse address.

<! Private server address -->
<mirror>
	<id>com.zhirui.group</id>
	<mirrorOf>central</mirrorOf>
	<name>com.zhirui.group</name>
	<url>http://192.168.1.254:8081/repository/maven-public/</url>
</mirror>
<! -- Aliyun warehouse address -->
<mirror>
	<id>alimaven</id>
	<name>aliyun maven</name>
	<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
	<mirrorOf>central</mirrorOf>
</mirror>
Copy the code

jenkins

Jenkins installation is quite complicated. I have written another article to explain how to install and configure The Jenkins Automatic Deployment of Spring Cloud service.

jira

Jira installation is quite complicated, and I have written another article to explain how to install and configure jIRA. Click to see Jenkins Automatic Deployment of Spring Cloud Service in action.

gitblit

Comparison of several major code management tools, here only gitblit:

Official website address:

www.gitblit.com/

Installation:

Wget HTTP: / / http://dl.bintray.com/gitblit/releases/gitblit-1.8.0.tar.gzCopy the code

Modify port:

server.httpPort = 7000 
server.httpsPort = 7443
Copy the code

Began to visit

Url: http://192.168.1.234:7000/

Default password: admin/admin

frp

FRP is used for Intranet penetration to access Intranet services from the public network.

download

Wget HTTP: / / https://github.com/fatedier/frp/releases/download/v0.29.0/frp_0.29.0_linux_amd64.tar.gzCopy the code

Download more versions: github.com/fatedier/fr…

The server side

configuration
#To configure the connection with the FRP client
[common]
bind_port = 7000
token = javasea@frp

dashboard_port = 7557
#The dashboard user name and password are optional; if not, the default is admin.
dashboard_user = admin
dashboard_pwd = javasea@frpdash
Copy the code
Start the
# frps -c frps.ini
Copy the code

The client

configuration
[common] server_addr = 120.xx.xx.166 server_port = 7000 token = zhirui@frp [common] server_port = 7000 token = zhirui@frp [mysql] type = TCP local_port = 3306 remote_port = 7575 # gitblit = TCP local_port = 7000 remote_port = 7576Copy the code
Start the
# frpc -c frpc.ini
Copy the code
Management Page:

Url: http://192.168.1.254:7557, 7557 is the dash server-side configuration above port.