ECS Builds a Java Web Development Environment


We can use the one-hour instance experience given to us by Alibaba Cloud ecs:
https://developer.aliyun.com/adc/scenario/bbad6f5e0cba4c0ba5c904f6cf06a8d0
insert image description here

1. Create resources

Click Create Resource and wait for the Alibaba Cloud instance allocated to us by the system:
insert image description here

2. Connect to ECS

This time, use putty to connect to the Alibaba Cloud instance:
insert image description here

3. Install JDK1.8

  1. Run the following command to view the JDK version in the yum source.
    yum list java*
    insert image description here
  2. Run the following command to install JDK1.8 using yum.
    yum -y install java-1.8.0-openjdk*
    insert image description here
  3. Execute the following command to check whether the installation is successful.
    java -version
    insert image description here

Fourth, install the MySQL5.7 database

1. Execute the following command to download and install the official MySQL Yum Repository.

wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server

insert image description here2. Execute the following command to start the MySQL database.

systemctl start mysqld.service

3. Execute the following command to view the initial MySQL password.

grep "password" /var/log/mysqld.log

insert image description here
4. Execute the following command to log in to the database.

mysql -uroot -p

insert image description here
5. Run the following command to change the default MySQL password.

 set global validate_password_policy=0;  #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';

insert image description here
6. Run the following command to grant remote management rights to the root user.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';

insert image description here
7. Enter exit to exit the database.
insert image description here

5. Install Tomcat

  1. Run the following command to download the Tomcat compressed package.
wget https://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.57/bin/apache-tomcat-8.5.57.tar.gz

insert image description here
2. Execute the following command to decompress the downloaded Tomcat package.

tar -zxvf apache-tomcat-8.5.57.tar.gz 

insert image description here
3. Execute the following command to modify the name of Tomcat.

mv apache-tomcat-8.5.57 /usr/local/Tomcat8.5

4. Execute the following command to authorize Tomcat.

chmod +x /usr/local/Tomcat8.5/bin/*.sh

5. Execute the following command to modify the default port number of Tomcat to 80.
Note: The default port number of Tomcat is 8080.

sed -i 's/Connector port="8080"/Connector port="80"/' /usr/local/Tomcat8.5/conf/server.xml

insert image description here
6. Start Tomcat.

/usr/local/Tomcat8.5/bin/./startup.sh

insert image description here

6. Access Tomcat

  1. Open the browser and enter the ECS public network address in the address bar, for example: 139.196.225.35
    If the following interface is displayed, it means that Tomcat is installed and configured successfully.
    insert image description here
  2. So far, the Java Web development environment has been built!

Guess you like

Origin blog.csdn.net/qq_45397526/article/details/107902790