❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

To install Firewall Command In Centos_linux

30 October 2023 at 13:59

STEP 1:

Update your package repository

sudo yum update

STEP 2:

install firewalld

sudo yum install firewalld

STEP 3:

Start the firewalld service and enable it to start at boot:

sudo systemctl start firewalld
sudo systemctl enable firewalld

STEP 4:

You can check the status of the firewalld service:

sudo systemctl status firewalld
  • That's it! You now have firewalld installed and running on your CentOS system. You can configure your firewall rules using the firewall-cmd command. Here are a few examples of how to use firewall-cmd to configure your firewall:

STEP 5:

Allow incoming traffic on a specific port (e.g., port 80 for HTTP):

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

STEP 6:

Reload the firewall to apply the changes:

bash:

sudo firewall-cmd --reload

STEP 7:

List all open ports in the default zone (usually "public"):

sudo firewall-cmd --list-ports
sudo firewall-cmd --list-all

STEP 8:

List all the services currently allowed through the firewall:

sudo firewall-cmd --list-services

creating centos httpd webserver container from docker file

2 May 2023 at 07:40

$ mkdir httpd && cd httpd

$ vim Dockerfile
FROM centos:7
MAINTAINER tkdhanasekar <tkdhanasekar@gmail.com>
RUN yum update -y
RUN yum install httpd -y
COPY index.html /var/www/html/
ENTRYPOINT ["/usr/sbin/httpd","-D","FOREGROUND"]

:wq!

$ vim index.html
<h1> This is CentOS httpd Docker Container </h1>
:wq!

$ docker build -t myhttpd .
$ docker run -d --name httpd_demo -p 8081:80 myhttpd
http://server_ip:8081

❌
❌