Commonly used tools

A, SecureCRT

  • Set the key pair login using ali cloud public IP
  • SSH ports need to be set up in ali security rule group

Second, the winSCP

Root cannot log in:

(1)vim /etc/ssh/sshd_config (2)PasswordAuthentication yes PermitRootLogin yes (3)systemctl restart SSHD restarts the system

Centos common commands and install some libraries

  • yum -y install lrzsz
  • yum install libaio-devel.x86_64
  • yum install glibc.i686
  • Rm -rf Forcibly deleted
  • Rm -f Deletes a file
  • Gz Decompress tar. Gz
  • Xz -d converts xz to tar
  • Tar -xvf xx.tar Decompress tar
  • Rz uploads files
  • Sz Downloads files
  • Mv Change the file name
  • Touch file name create file
  • Mkdir Folder name To create a folder

Server Configuration Process

Install the JDK

Yum -y remove java-1.7.0 -openJDK * yum -y remove java-1.8.0 -openJDK * yum -y remove java-1.8.0 -openJDK *

  • Download the tar.gz file from oracle official website, upload it to the server, and decompress it
  • vim /etc/profile
  • I insert
  • export JAVA_HOME=/opt/jdk/jdk8
  • export CLASSPATH=.:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  • PATH=JAVA_HOME/bin
  • Enter wq after esc to save the configuration
  • Source /etc/profile: The configuration file takes effect
  • Java version – look at it

Second, install Tomcat

  • Download the tar.gz file from Tomcat, upload it to the server, and decompress it
  • vim /etc/profile
  • I insert
  • export TOMCAT_HOME=/opt/tomcat/tomcat9
  • PATH=JAVA_HOME/bin:$TOMCAT_HOME/bin
  • Enter wq after esc to save the configuration
  • Source /etc/profile: The configuration file takes effect
Tomcat configuration
  • Added port 8080/8080 to Ali server rule configuration

  • Yum install rnG-tools

  • Systemctl start RNGD – Starts the entropy service

  • Systemctl daemon-reload, systemctl restart RNGD -reload the service

  • Set Tomcat to start automatically after startup:

  • In the tomca/bin directory, add the setenv.sh configuration, which is invoked when catalina.sh is started, and set Java memory parameters.

    CATALINA_PID=”$CATALINA_BASE/tomcat.pid”

    JAVA_OPTS=”-server -XX:PermSize=256M -XX:MaxPermSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m”

  • Add tomcat.service to the /usr/lib/systemd/system directory (based on the actual path) :

    [Unit]

    Description=Tomcat

    After=syslog.target network.target remote-fs.target nss-lookup.target

    [Service]

    Type=forking

    Environment=”JAVA_HOME=/usr/local/java”

    PIDFile=/usr/local/tomcat/tomcat.pid

    ExecStart=/usr/local/tomcat/bin/startup.sh

    ExecReload=/bin/kill -s HUP MAINPID

    PrivateTmp=true

    [Install]

    WantedBy=multi-user.target

  • Use the tomcat.service command:

    Start systemctl enable tomcat.service Start tomcat systemctl start tomcat.service Stop tomcat systemctl stop tomcat.service Restart tomcat systemctl restart tomcat.service

  • http://ip:8080/ Check whether the verification is successful

Mysql installation and configuration

  • Download the YUM source RPM package from the MySQL official website

  • Yum localinstall xxx. RPM: Use the installation source

  • Yum install mysql-community-server

  • mysqld –initialize –user=mysql –console

    • Initialized mysql
    • / var/lib/mysql.sock will generate mysql.sock on my.cnf
    • A temporary password is generated and used as a temporary login
  • Configure my. CNF file [client] socket = / var/lib/mysql/mysql. The sock default – character – set = utf8

    [mysql]

    default-character-set=utf8

    socket=/var/lib/mysql/mysql.sock

    [mysqld]

    datadir=/var/lib/mysql

    socket=/var/lib/mysql/mysql.sock

  • Alter user ‘root’@’localhost’IDENTIFIED BY ‘newpassword’; alter user ‘root’@’localhost’IDENTIFIED BY ‘newpassword’; flush privileges;

Navicat connects to Aricloud mysql
  • 1130-host is not allowed MySQL > usemysQL; mysql>update user set host = ‘%’ where user =’root’; mysql>select host, user from user;

  • 解决Client does not support authentication protocol requested by server; Consider upgrading MySQL client: ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘MySQL ‘; ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘your password ‘; SELECT plugin FROM mysql.user WHERE User = ‘root’;

  • Mysql commands: Start mysql systemctl start mysqld stop systemctl stop mysqld Start systemctl enable mysqld systemctl daemon-reload

Nginx installation and configuration

  • yum install gcc-c++
  • yum install -y pcre pcre-devel
  • yum install -y zlib zlib-devel
  • yum install -y openssl openssl-devel
  • Go to nginx to download the installation package
  • The tar – ZXVF nginx – 1.10.1. Tar. Gz
  • CD nginx – 1.10.1
  • ./configure
  • make
  • make install
  • Whereis nginx: Finds the installation path
  • Nginx Settings:
    • Vi/lib/systemd/system/nginx. Service (file path without having to set below)

      [Unit] Description=nginx

      After=network.target

      [Service]

      Type=forking

      ExecStart=/usr/local/nginx/sbin/nginx

      ExecReload=/usr/local/nginx/sbin/nginx -s reload

      ExecStop=/usr/local/nginx/sbin/nginx -s quit

      PrivateTmp=true

      [Install]

      WantedBy=multi-user.target

    • Relevant command

      Start the nginx service systemctl start nginx.service Sets the automatic startup upon system startup systemctl enable nginx.service Stops the automatic startup upon system startup systemctl disable nginx.service Service Restarts the service systemctl restart nginx.service Displays all started services systemctl list-units –type=service

V. Vue project is placed on the server

  • Package the VUE dist with the NPM Run build and copy it to a server specific folder

  • Vim/usr/local/nginx/conf/nginx. Conf configuration path:

    server { listen 8089; Server_name localhost; root /opt/project/vue-appmanager/dist/; // put the project directory index index. HTML; location / { try_files $uri $uri/ /index.html; }}Copy the code

6. SpringBoot project is placed on the server

  • Maven->Lifecycle-> Clean ->Install and a.jar file will appear in the target folder

  • Vim/usr/local/nginx/conf/nginx. Conf configuration path:

    server { listen 80; server_name localhost; The location/appmanagerapi {/ / with springboot context - path consistent proxy_pass http://127.0.0.1:8088/appmanagerapi; project Settings } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }}Copy the code
  • Set the SpringBoot JAR to boot automatically

  • /lib/systemd/system create xxxx.service

    [Unit]

    Description=abcd service

    After=syslog.target

    [Service] Type = simple ExecStart = / opt/jdk1.8.0 _211 / bin/Java jar/opt/project/springboot/XXXX. The jar

    [Install]

    WantedBy=multi-user.target

  • Related commands:

    Refreshing the service configuration file systemctl daemon-reload Service To start the service systemctl enable xx.service To start the service systemctl start xx.service To stop the service systemctl Stop xx.service Check the service status systemctl status xx.service

Ali Configuration Configure the corresponding port

  • http:80
  • https:443
  • vue:8089

Restart springBoot and nginx services