Development environment setup
Zoc8 and Transmit tools
Download and Install
- Zoc8 download links: pan.baidu.com/s/1Pb5shlSj… Password: JMKB
- The Transmit download links: pan.baidu.com/s/1vqdyRijJ… Password: cr05
use
Network Mode Setting
- Set the network connection mode to NAT mode, as shown below:
Modifying a Configuration File
- Open the /etc/sysconfig/network-scripts/ifcfg-eno16777736 file as user root and add the following information:
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.72.128
GATEWAY=192.168.72.2
NETMASK=255.255.255.0
DNS1=114.114.114.114
Copy the code
Configuration file Taking Effect
Run the service network restart command to make the configuration file take effectCopy the code
JDK download and installation
Download and Install
- Download link: pan.baidu.com/s/1lnI998Eu… Password: rc5e
- Installation method: Use the Transmit tool to transfer the downloaded JDK installation package to the CentOS system and run the tar command to decompress the package.
Configuring environment Variables
- Open the /etc/profile file as user root and add the following information to the end of the file:
export JAVA_HOME=/usr/javajdk
export PATH=$JAVA_HOME/bin:$PATH
Copy the code
- Save and exit the file to take effect and verify that the configuration is successful
source /etc/profile
javac -version
Copy the code
Download and install Tomcat
Download and Install
- Download link: pan.baidu.com/s/1O1ZpwM55… Password: MNST
- Installation method: Use the Transmit tool to transfer the downloaded Tomcat installation package to the CentOS system and run the tar command to decompress the package.
Startup and shutdown modes
startup.sh
shutdown.sh
Copy the code
Opening firewall Ports
/sbin/iptables -I INPUT -p TCP --dport 8080 -j ACCEPTCopy the code
Configuring environment Variables
- Open the /etc/profile profile as user root and add content to the end of the file.
export CATALINA_HOME=/usr/tomcat
export PATH=$CATALINA_HOME/bin:$PATH
Copy the code
Save and exit the file to take effect and verify that the configuration is successful
source /etc/profile
startup.sh
Copy the code
Publishing a Web project
- Put the Web project into a WAR package, use the Xftp tool to put the WAR package in the Tomcat/WebApp directory and start it
Download and install Mysql
Download the Mysql repo source
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Copy the code
Install the RPM package
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
Copy the code
Mysql installation
yum install mysql-server
Copy the code
Start the service
service mysqld start
Copy the code
Viewing Service Status
systemctl status mysqld
Copy the code
Log in as the root user
mysql -u root
Copy the code
Changing a Temporary Password
alter user 'root'@'localhost' identified by 'Ran@123456';
Copy the code
Graphical interface to access the database
Use the Navicat Premium tool
- Start Navicat Premium to connect to the Mysql database in the VIRTUAL machine, as shown below:
Solution (Error number 1130)
- Log in to the database as root and select the mysql library
mysql -u root -p
use mysql;
Copy the code
- Mysql > select host from user where host = %
select host from user where user='root';
update user set host='%' where user='root';
flush privileges;
Copy the code
- View the changes and retest them
select user,host from user;
Copy the code
Shell programming
The basic concept
- A Shell is a command-line interpreter that receives application or user commands and then accesses the operating system kernel.
- Shell is a very powerful programming language, easy to write, easy to debug, strong flexibility;
Write your first program
- Use the vi tool to create the xxx.sh file.
- With #! Start with /bin/bash and save after writing code.
How a Shell program is executed
- Method 1:./ file name, which requires execution permission.
- Method 2: /bin/bash File name. This method does not require execution permission.
Definition of variables
Syntax format
- Define variables: Variables = values
- Undo variable: unset variable
Define the rules
- The variable name can contain letters, digits, and underscores (_), but cannot start with a number. You are advised to capitalize environment variable names.
- You can’t use keywords in bash.
- There can be no Spaces, there can be underscores.
- In Bash, variables are strings by default and cannot be evaluated directly.
- The value of a variable must be enclosed in double or single quotation marks if there are Spaces.
Common operator
Arithmetic operator
Relational operator
Flow control statement
If judgment
If then program FICopy the code
A case statement
Case $variable name in "value 1") if the value of the variable is equal to the value 1, execute procedure 1; "Value 2") if the value of the variable is equal to value 2, program 2 is executed; ... Omit the other branches... *) Execute this program if none of the values of the variables are above; esacCopy the code
The for loop
For ((initial value; Cyclic control conditions; Variable change)) do program doneCopy the code
The while loop
While [conditional] do the procedure doneCopy the code
function
[ function ] funname[()] { Action; [return int;] } funnameCopy the code