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
1. Create resources
Click Create Resource and wait for the Alibaba Cloud instance allocated to us by the system:
2. Connect to ECS
This time, use putty to connect to the Alibaba Cloud instance:
3. Install JDK1.8
- Run the following command to view the JDK version in the yum source.
yum list java*
- Run the following command to install JDK1.8 using yum.
yum -y install java-1.8.0-openjdk*
- Execute the following command to check whether the installation is successful.
java -version
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
2. 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
4. Execute the following command to log in to the database.
mysql -uroot -p
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';
6. Run the following command to grant remote management rights to the root user.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';
7. Enter exit to exit the database.
5. Install Tomcat
- 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
2. Execute the following command to decompress the downloaded Tomcat package.
tar -zxvf apache-tomcat-8.5.57.tar.gz
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
6. Start Tomcat.
/usr/local/Tomcat8.5/bin/./startup.sh
6. Access Tomcat
- 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.
- So far, the Java Web development environment has been built!