Welcome Huihui’s Code World ! !? ?
Let’s take a look at the related operations on Linux written by Huihui
Table of Contents
Welcome Huihui’s Code World! !
1.Linux environment configuration
1.JDK
①Upload the installation package to the server
②Unzip the corresponding installation package
③Configure environment variables
2. Tomcat
①Start tomcat
②Firewall settings
3.MySQL
①Delete the default database
②Extract the MySQL installation package to the specified directory
③Install MySQL
④Start the MySQL service
⑤Log in to MySQL to change password
⑥Modify password verification policy
⑦Change password
⑧Refresh service
⑨Modify remote permissions
⑩ Test whether the connection can be successful
2. Deploy project back-end interface
1. Place the war package into the specified location
2. Check the database name corresponding to the project
3. Create database and import sql script
4. Access the project in the browser
3. Deployment of single project
1. Place the war package into the specified location
2. Check the database name and import sql script
3..Access the project in the browser?
Modify access port number
1.Linux environment configuration
1.JDK
①Upload the installation package to the server
The tool used here is MobaXterm, so you can use drag and drop to upload files. If you use other software, you can go online to find relevant operations by yourself
Check whether the file is uploaded successfully. You can query it in the directory where the file was uploaded
②Extract the corresponding installation package
Unzip the .tar file
tar -xvf file.tarUnzip the .tar.gz or .tgz file
tar -zxvf file.tar.gzUnzip the .bz2 file
tar -xjvf file.bz2Unzip the .xz file
tar -xJvf file.xz③Configure environment variables
#Configure environment variable path vim /etc/profile#java environment export JAVA_HOME=/wh/tools/jdk1.8.0_151 (the jdk decompression path is placed here) export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH#Set environment variables to take effect source /etc/profile2.Tomcat
Like JDK, you need to upload the installation package and decompress it.
①Start tomcat
./start.sh//You need to enter the bin directory where tomcat is located and then enter this command②Firewall Settings
We can check the status of the firewall at this time
#Firewall status systemctl status firewalldNow let’s turn off the firewall
#Close firewall systemctl stop firewalld.serviceThe firewall is turned off, so we can access it from the outside
However, this approach is unsafe and is not recommended. Now let’s turn on the firewall.
#Start firewall systemctl start firewalldOur current approach is to open ports. In layman’s terms, it opens a door for others to access. The above approach of opening the firewall is like leaving the entire home open, so it is said to be unsafe.
#Open port firewall-cmd --zone=public --add-port=port number/tcp --permanentBut opening the port is not enough. We need to refresh the firewall rules.
#Update firewall rules firewall-cmd --reloadNow we can also look at the firewall list [you can see the two ports we just successfully opened]
#Firewall list firewall-cmd --zone=public --list-portsFor safety and convenience, we can also set the firewall to start automatically
#Firewall self-starting systemctl disable firewalld.serviceThen tomcat is configured
3.MySQL
①Delete the default database
Otherwise, there will be conflicts when installing MySql (check first, then delete and then check)
#View database rpm -qa|grep mariadb#Delete the default database rpm -e --nodeps database nameLike JDK, you need to upload the installation package and decompress it.
②Extract the MySQL installation package to the specified directory
#Create a folder mkdir mysql-5.7 #Extract the MySQL installation package to the specified directory tar -xvf mysql-5.7.35-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7③Install MySQL
#Enter the specified folder cd mysql-5.7 #Start installation, -ivh where i means installation, v means display the installation process, h means display progress rpm -ivh mysql-community-common-5.7.35-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.35-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.35-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.35-1.el7.x86_64.rpm④Start the MySQL service
#Start the MySQL service systemctl start mysqld⑤Log in to MySQL and change the password
#View temporary password grep "password" /var/log/mysqld.log #Loginmysql mysql -uroot -p [You will be prompted to enter your password later? Enter the temporary password]⑥Modify the password verification policy
#Set the password verification policy (0 or LOW), or the password is too LOW and will not let you pass. set global validate_password_policy=0; #Set the password verification length, otherwise the password will not be allowed to pass if it is too short (multiple tests found that the minimum password length is 4 digits) set global validate_password_length=4;⑦Change Password
#Update password set password = password("123456");⑧Refresh Service
FLUSH PRIVILEGES;⑨Modify remote permissions
Before performing this operation, you need to enter ‘use mysql’
#Allow remote login to mysql as root GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;Remember Need to refresh the service again
⑩ Test whether the connection can be successful
2. Deployment project backend interface
1. Place the war package into the specified location
tomcat》webapps
2. View the database name corresponding to the project
/root/wh/tools/apache-tomcat-8.5.20/webapps/ssm/WEB-INF/classes/
3. Build database and import sql script
4. Access the project in the browser
3. Deployment of single project
1. Place the war package into the specified location
2. View the database name and import the sql script
3..Access the project in the browser
Modify access port number
Enter tomcat》conf》setting.xml
Open port
firewall-cmd --zone=public --add-port=8082/tcp --permanentRemember to take snapshots
Okay, that’s it for today’s sharing, I hope it can help you!