浏览器直接搜索阿里云, 进入你的ESC控制台, 找到你的实例连接即可
输入密码登录后就看到一下这个样子了, 界面颜色不重要
其实上面这两种就可以使用一个软件来进行远程登录(Putty)
这样就登陆成功了
阿里云服务器 访问公网IP地址需要在实例安全组白名单中增加Workbench的服务器白名单 的解决办法
发表于2020 年 6 月 30 日
登录阿里云网站,鼠标悬浮在右上角头像那一栏,点击安全管控,在左侧IP白名单进行添加源代码:
对象类型 云服务器ECS 源IP:0.0.0.0
勾上选择所有,或者单独选择服务器,确定即可。
下载地址: https://www.oracle.com/java/technologies/downloads/#java8-windows
下载 JDK 源码包,您可前往 Java SE 下载 页面选择需要的版本
可以下载xftp和putty进行远程登陆和传输文件操作
用xftp登录你的远程服务器, 就可以无脑传输文件
这一过程挺顺利的, 一般不会出现什么问题
mkdir /usr/java
tar xzf jdk-8u321-linux-x64.tar.gz -C /usr/java
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_321
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
java -version
java version "1.8.0_321"
Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)
mkdir /usr/tomcat
cd /usr/tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.55/bin/apache-tomcat-8.5.55.tar.gz
可以直接从tomcat官网下载下载所需要的版本的压缩包(以.gz结尾)到自己电脑的文件夹下, 使用软件xftp在usr目录下新建文件夹tomcat, 将该压缩包上传到服务器中该文件夹中, 直接拖拽即可
tar xzf apache-tomcat-8.5.76.tar.gz
mv apache-tomcat-8.5.76 /usr/local/tomcat/
vim /usr/local/tomcat/conf/server.xml
找到 ,按 i 切换至编辑模式,将 appBase="webapps" 替换为以下内容:
appBase="/usr/local/tomcat/webapps"
按 Esc,输入 :wq,保存文件并返回。
vi /usr/local/tomcat/bin/setenv.sh
JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms256m -Xmx496m -Dfile.encoding=UTF-8'
/usr/local/tomcat/bin/startup.sh
echo Hello World! > /usr/local/tomcat/webapps/ROOT/index.jsp
http://云服务器实例的公网 IP:8080
显示结果如下,则说明环境配置成功。
hello world
yum remove mariadb-libs.x86_64
这里显示没有默认包,有的会有,反正保险起见,执行一遍
cd /usr/local
mkdir mysql
cd mysql
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum localinstall mysql80-community-release-el7-3.noarch.rpm
Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
cd /etc/yum.repos.d/
for i in `ls`;do sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' $i;done
for i in `ls`;do sed -i 's/$releasever/$releasever-stream/g' $i;done
yum clean all
yum makecache
yum localinstall mysql80-community-release-el7-3.noarch.rpm
这样就安装上了
yum module disable mysql
Package Architecture Version Repository Size
Disabling modules:
mysql
Transaction Summary
Is this ok [y/N]: y
Complete!
yum install mysql-community-server
这由于源key错误导致的dnf或者yum(软件包管理器)安装软件失败。
yum install mysql-community-server --nogpgcheck
service mysqld start
service mysqld status
cat /var/log/mysqld.log | grep password
mysql -u root -p
# 刚刚获得的初始密码
exit;
mysql_secure_installation
#i 重置root账号密码
Enter password for user root: #输入上一步获取的root用户初始密码
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? (Press y|Y for Yes, any other key for No) : Y #是否更改root用户密码,输入Y
New password: #输入新密码,长度为8至30个字符,必须同时包含大小写英文字母、数字和特殊符号。特殊符号可以是()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/
Re-enter new password: #再次输入新密码
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
# 后面一直输y即可,指导all done 自动退出
#ii 输入Y删除匿名用户账号
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y #是否删除匿名用户,输入Y
Success.
# iii 输入Y禁止root账号远程登录
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y #禁止root远程登录,输入Y
Success.
# iv 输入Y删除test库以及对test库的访问权限
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y #是否删除test库和对它的访问权限,输入Y
- Dropping test database...
Success.
# v 输入Y重新加载授权表
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y #是否重新加载授权表,输入Y
Success.
All done!
mysql -uroot -p
设置的新密码
service firewalld start
firewall-cmd --zone=public --permanent --add-port=8080/tcp
firewall-cmd --reload
firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: cockpit dhcpv6-client ssh
ports: 8080/tcp
protocols:
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
cd /usr/local/tomcat/bin
./shutdown.sh
注意: 还有就是tomcat服务关闭一次后再执行关闭命令会报错, 看着厌烦的话, 就多开几次服务
天翼云盘: https://cloud.189.cn/t/QrAbiyrYNNja
百度云盘: 链接:https://pan.baidu.com/s/1s2Dr6qYcK3KEzVx-fn97bA?pwd=gfso
提取码:gfso
参考文档
腾讯云 手动搭建 Java Web 环境
https://cloud.tencent.com/document/product/213/38234
腾讯云 服务器上安装Mysql8.0
https://cloud.tencent.com/developer/article/1719216
阿里云 Centos8 yum 镜像 404
https://blog.csdn.net/fan63182830/article/details/122808633
Error: GPG check FAILED
https://blog.csdn.net/qq_20265015/article/details/122612166