1.购买阿里云服务器
访问阿里云官网,选择合适的云服务器购买
购买成功后创建ECS云服务器
下载Alibaba Cloud Client
创建AccessKey并保存
打开Alibaba Cloud Client,添加账号
2.安装docker
选择操作—>启动远程连接(SSH)
snap install docker
docker -v
docker-compose -v
3.安装Java
apt install openjdk-21-jdk
java -version
4.安装mysql
apt-get update
apt-get install mysql-server
mysql -uroot -p
#密码:设置的密码
#连接成功进行下一步
vim /etc/mysql/mysql.conf.d/mysqld.cnf
#注释bind-address = 127.0.0.1
#添加bind-address = 0.0.0.0
service mysql restart
#修改远程访问权限
mysql -uroot -p
show databases;
use mysql;
update user set host='%' where user='root' and host='localhost';
flush privileges;
配置安全组
使用Navicat连接mysql服务
所遇问题
1.远程连接SSH使用密码连接提示"连接服务器失败,原因:Too many authentication failures"
解决方法:重置ECS服务器密码
2.连接MySQL服务提示ERROR 1698 (28000): Access denied for user 'root'@'localhost'(MySQL版本8.0.37)
解决方法:
use mysql;
update user set host='%' where user='root' and host='localhost';
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
FLUSH PRIVILEGES;
5.部署sonic
wget https://github.com/SonicCloudOrg/sonic-server/releases/download/v2.6.4/sonic-server-v2.6.4.zip
unzip sonic-server-v2.6.4.zip -d sonic-server
sonic部署文档
https://sonic-cloud.cn/deploy/back-end-deploy.html
注意事项:
.env配置文件里面的host填写公网ip
所遇问题:
docker pull拉取sonic镜像超时
解决方法:参考文档https://www.alibabacloud.com/help/zh/ecs/use-cases/install-and-use-docker-on-a-linux-ecs-instance#33f11a5f1800n