install Apache HTTP Server on CentOS 9 Stream
all used commands:
sudo yum update
sudo yum install httpd httpd-tools
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd
httpd -v
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
to check port 80 and 443
sudo nmap -sT youriphere
_______________Tomcat Setup______________
if you need to install Apache Tomcat (the main difference between Apache http and Apache Tomcat is that Tomcat serves dynamic content using Java-based logic, while the Apache web server serves mainly static content such as normal html web page):
sudo yum update
sudo groupadd --system tomcat
sudo useradd -d /usr/share/tomcat -r -s /bin/false -g tomcat tomcat
Note: to check tomcat version and set it in the url: [ Ссылка ]
sudo yum -y install wget
export VER="9.0.48"
wget [ Ссылка ]
sudo tar xvf apache-tomcat-${VER}.tar.gz -C /usr/share/
sudo ln -s /usr/share/apache-tomcat-$VER/ /usr/share/tomcat
sudo chown -R tomcat:tomcat /usr/share/tomcat
sudo chown -R tomcat:tomcat /usr/share/apache-tomcat-$VER/
to configure tomcat systemd:
sudo vim /etc/systemd/system/tomcat.service
sudo systemctl daemon-reload
sudo systemctl start tomcat
sudo systemctl enable tomcat
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
sudo systemctl restart httpd && sudo systemctl enable httpd
![](https://s2.save4k.ru/pic/eQmFb9IxqgU/mqdefault.jpg)