How to Set Up a Secure Linux Server with JDK, Tomcat, and Docker
This step‑by‑step guide shows how to enable security groups, install the BT control panel, configure firewall rules, deploy JDK and Tomcat, and install Docker on a Linux server, including all required commands and troubleshooting tips.
1. Enable Security Group
1.1 Open security group
In the cloud console, enable the security group and allow inbound traffic.
1.2 Obtain public IP and reset root password
Find the server’s public IP address, reset the root password, and reboot if required.
2. Install Baota (BT) Panel
2.1 Download and run installer
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.shAnswer “y” to all prompts.
2.2 Open required ports
Configure the security group to expose ports needed by subsequent services (e.g., 80, 8080, 22, 2375, etc.).
3. Install JDK, Tomcat and configure firewall
3.1 Remove existing OpenJDK packages (if any)
rpm -qa | grep java
yum -y remove java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64
yum -y remove java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_643.2 Install Oracle JDK 11
rpm -ivh jdk-11.0.8_linux-x64_bin.rpm
java -version3.3 Install Tomcat 9
tar -zxvf apache-tomcat-9.0.37.tar.gz
cd apache-tomcat-9.0.37
./bin/startup.sh3.4 Firewall configuration
# Check firewalld status
systemctl status firewalld
# Start / restart / stop firewalld
service firewalld start
service firewalld restart
service firewalld stop
# List current rules
firewall-cmd --list-all
firewall-cmd --list-ports
# Open a port permanently (example: 80/tcp)
firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl restart firewalld.serviceParameters: --zone defines the rule scope, --add-port=PORT/PROTOCOL adds the port, --permanent makes the rule survive reboots.
4. Install Docker CE via YUM
4.1 Prepare environment
yum -y install gcc gcc-c++4.2 Remove older Docker packages
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine4.3 Install required utilities
sudo yum install -y yum-utils4.4 Add Alibaba Cloud mirror for Docker CE
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo4.5 Update YUM cache and install Docker CE
yum makecache fast
yum -y install docker-ce docker-ce-cli containerd.io4.6 Start Docker and verify
systemctl start docker
ps -ef | grep dockerReference Docker CE installation guide for CentOS: https://docs.docker.com/engine/install/centos/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Architects Alliance
Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
