1. 安装OpenJDK Maven Tomcat MySQL
sudo apt install default-jdk maven tomcat9 tomcat9-docs tomcat9-admin mysql-server mysql-client libmysqlclient-dev
2. 可选:切换默认java版本
sudo update-alternatives --config java
3. 配置tomcat监听端口,编辑文件/etc/tomcat9/server.xml
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
4. 配置tomcat-admin账户,编辑文件/etc/tomcat9/tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="<user>" password="<password>" roles="admin-gui,manager-gui"/>
5. 防火墙放过80 、443端口
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow mysql
sudo ufw allow 8080/tcp
sudo ufw allow 8443/tcp
6. 设置MySQL root默认密码,在root账户下执行
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '<password>';
use mysql
update user set host = '%' where user = 'root';
flush privileges;
7. maven设置阿里云镜像,在/etc/maven/settings.xml的<mirrors>中,添加
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>