Environmental installation

JAVA Environment Detection

rpm -qa |grep java
rpm -qa |grep jdk
rpm -qa |grep gcj
Copy the code

Java jdk1.8 installation

# No installation if no information is entered.
# if the installation can use RPM - qa | grep Java | xargs RPM -e -- nodeps batch uninstall all files with Java This keyword is a Java command
First retrieve the list containing Java
yum list java*
Retrieve the list of 1.8Yum list Java 1.8 *Install all files for 1.8.0Yum install Java - 1.8.0 comes with - its * - yRun the following command to check whether the installation is successful
java -version
Copy the code

Configure the Yum Ali cloud image

# backup
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
Change the default source
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
         -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' \
         -i.bak \
         /etc/yum.repos.d/CentOS-Base.repo
# rebuild cache
yum makecache
Copy the code

Install the latest version of Node

# unload clear cache
yum remove nodejs
yum clean all
rm -fv /etc/yum.repos.d/nodesource*
# installation
curl --silent --location https://rpm.nodesource.com/setup_11.x | bash -
yum -y install nodejs
# upgrade NPM
curl -L https://www.npmjs.com/install.sh | sh

# Node versioning
#npm i -g n
#export NODE_MIRROR=https://npm.taobao.org/dist/

# Set up common tools for node image installation
npm i -g nrm
nrm use taobao
npm i -g yarn pm2
Copy the code

Program start-stop

Background Start Java

setsid java -jar [xxx.jar]
Copy the code

Cleaning up Java programs

ID=`ps -ef | grep [xxx.jar] | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
echo $ID
kill9 -$ID
Copy the code

Querying port Usage

Lsof -i: [port] netstat NLPT | grep [port]Copy the code