Cloud Computing 12 min read

Step-by-Step Guide to Setting Up a Cloud Server with JDK, Redis, and MySQL on Alibaba Cloud ECS

This article provides a detailed, beginner‑friendly tutorial on purchasing an Alibaba Cloud ECS instance, configuring the operating system, and installing JDK 8, Redis, and MySQL 8.0—including necessary firewall and security‑group settings—to launch a functional web‑site environment.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Step-by-Step Guide to Setting Up a Cloud Server with JDK, Redis, and MySQL on Alibaba Cloud ECS

In this tutorial the author walks readers through the entire process of building a simple "play‑around" website on an Alibaba Cloud Elastic Compute Service (ECS) instance, covering server purchase, environment preparation, and the installation of JDK 8, Redis, and MySQL 8.0.

1. Purchase Alibaba Cloud ECS

The author chose a 2核2G,3M固定带宽 instance for 99 CNY per year (3‑year commitment) and selected the CentOS 7.9 64位 image. After the purchase the console shows both a private IP and a public IP; the public IP can be used to access the site from the internet.

To log in remotely, click the 远程连接 button in the ECS console, set an initial password, and connect via the provided remote‑desktop interface.

2. Install JDK 8

The tutorial uses JDK 8 (java‑1.8.0‑openjdk‑devel) because it is stable and well‑supported on CentOS. The following commands are used:

yum list |grep java-1.8.0
yum install java-1.8.0-openjdk-devel.x86_64 -y
java -version

After installation the environment variables are configured automatically.

3. Install Redis

Redis is installed with a few yum commands and started as a system service:

sudo yum install epel-release -y
sudo yum update -y
sudo yum install redis -y
sudo systemctl start redis
sudo systemctl enable redis

To verify the service, run redis-cli ping . The author also shows how to modify /etc/redis.conf to allow remote connections by commenting out the bind 127.0.0.1 line, disabling protected mode, and setting a password, then restarting Redis.

Port 6379 must be opened in the server firewall ( sudo firewall-cmd --zone=public --add-port=6379/tcp --permanent ) and also in the Alibaba Cloud security‑group rules.

4. Install MySQL 8.0

MySQL installation is more involved. The author creates a directory /usr/local/mysql , downloads the RPM bundle, extracts it, and installs the required packages in a strict order:

rpm -ivh mysql-community-common-8.0.35-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm
... (remaining rpm commands) ...

After installation, the /etc/my.cnf file is edited to set the port, character set, bind address (0.0.0.0 for remote access), and other common parameters. Ownership of the data directory is set with chown -R mysql:mysql /var/lib/mysql/ , and the service is started and enabled:

systemctl start mysqld.service
systemctl enable mysqld

The temporary root password is retrieved from the log ( grep "A temporary password" /var/log/mysqld.log ), then the password is changed and remote login is allowed by updating mysql.user and flushing privileges. Port 3306 is opened in both the firewall and the Alibaba Cloud security group.

5. Summary

The author emphasizes that setting up the environment is often the most intimidating part for beginners, but following the step‑by‑step commands reduces the chance of errors. Once JDK, Redis, and MySQL are running and reachable, the foundation for the "play‑around" website is complete.

cloud computingRedisMySQLJDKECSAlibaba CloudServer Setup
Rare Earth Juejin Tech Community
Written by

Rare Earth Juejin Tech Community

Juejin, a tech community that helps developers grow.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.