Java study notes-Day80 Maven project deployment to Linux


One, linux yum command


Yum (Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora, RedHat and SUSE.

Based on RPM package management, it can automatically download and install RPM packages from a designated server, automatically handle dependencies, and install all dependent software packages at once, without the need for tedious downloading and installation again and again.

Yum provides commands to find, install, delete a certain package, a group or even all packages, and the commands are concise and easy to remember.

yum syntax:

yum [options] [command] [package ...]

  • options: Optional, options include -h (help), -y (when prompted to select all yes when the installation process prompts), -q (do not display the installation process), and so on.
  • command: The operation to be performed.
  • package: The object of operation.

Two, install JDK


(1) Connect to the Linux centos7 server through Xshell6 software.
(2) by rpm -qa|grep jdkwhether the installation View JDK. If the installation can use the rpm -qa|grep java | xargs rpm -e --nodepsbatch uninstall all the files with Java.
(3) by yum search jdkfind the version you want to install, this installation is the java-1.8.0-openjdk-devel.x86_64 version, through yum -y install java-1.8.0-openjdk-devel.x86_64the installation. The following interface will appear when the installation is successful.

Insert picture description here

Three, install Tomcat


(1) Transfer the apache-tomcat-9.0.44.tar.gz compressed package to the /usr/local file on the Linux server through the Xftp6 software.

Insert picture description here
(2) by cd /usr/localentering the local folder, use tar zxvf apache-tomcat-9.0.44.tar.gzdecompression.

Insert picture description here
(3) by cd apache-tomcat-9.0.44/binentering the Tomcat's bin folder, use ./startup.shstart Tomcat, use ./shutdown.shclosed Tomcat. If the following interface appears, it means that Tomcat has started successfully.

Insert picture description here
(4) use systemctl status firewalld.serviceto see if a firewall is started, if the firewall does not start, use systemctl start firewalld.serviceStart the firewall. First use of firewall-cmd --permanent --add-port=8080/tcpopen firewall port 8080, then use systemctl restart firewalld.serviceto restart the firewall.
Insert picture description here
(5) access ip地址:8080will Tomcat home page appears.
Insert picture description here

Fourth, install Mysql


(1) rpm -qa|grep mysqlis installed to check Mysql.
(2) Use rpm to install the official Mysql warehouse:rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

Insert picture description here
(3) Check the Mysql warehouse information: yum info mysql-community-server
(4) Install Mysql through yum:, the yum -y install mysql-community-serverinstallation is successful and the following interface appears.

Insert picture description here
(5) Check and start Mysql: by systemctl status mysqldMysql start to see whether, if not started by systemctl start mysqldstart Mysql.
(6) by grep "password" /var/log/mysqld.logdefault generated password to view Mysql.
Insert picture description here
(7) by mysqladmin -u root -p passwordmodifying a password, enter a password Mysql generated by default, and then enter the new password twice.
(8) through the firewall-cmd --permanent --add-port=3306/tcpopen firewall port 3306, and then by systemctl restart firewalld.servicerestarting the firewall.

Insert picture description here
(9) Use mysql -u root -pand enter the new password to enter Mysql.

Insert picture description here

(10) When using Navicat to connect to Mysql of the Linux server, a 1130 error will occur.

Insert picture description here
This is because the Mysql account does not allow remote login by default, and can only log in at localhost (local). Solution: Use use mysql;switch to mysql database, then use update user set Host='%' where User='root';to modify the user table localhost to the Host %, updates will only allow local access is not limited to IP. Finally, use the flush privileges;refresh.

Insert picture description here
Insert picture description here
(11) If you use Navicat to connect to the Linux server, a 1251 error will occur.

Insert picture description here
This is because the authentication plug-in version required by Mysql is inconsistent with the client. Workaround: Use the ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Root@123';root of the plugin will change mysql_native_password. This line of code has two meanings. The first is to change the root password to'root' and discard the original old password. The second is to use mysql_native_password to encode the new password. Finally, use the flush privileges;refresh.

Insert picture description here
(12) After the above modification, successfully use Navicat to connect to the Mysql database of the Linux server.
Insert picture description here

Five, deployment project


To deploy the project, you only need to use Eclipse to export the war package of the project and put it in the webapps folder of Tomcat. Note: The project must have no problems before it can run in Tomcat.

(1) In the Eclipse project list, right-click the corresponding project and click Export -> Export... -> Web -> WAR file. Destination represents the location to be exported, click Browse to select the import location. Tick ​​Optimize for a specific server runtime. Click Finsh to finish.
Insert picture description here
(2) Transfer the war to Tomcat's webapps folder via Xftp6, and the war package will automatically generate a folder.
Insert picture description here
(3) View Tomcat logs in real time (log files in Tomcat's logs file):tail -f ../logs/catalina.out

Guess you like

Origin blog.csdn.net/qq_42141141/article/details/115049132