Difference between revisions of "CentOS7"

From Leaky
Jump to: navigation, search
(Added info about firewalld)
m (Enable firewall)
Line 31: Line 31:
 
Enable HTTP and HTTPS
 
Enable HTTP and HTTPS
  
  [root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=http   # HTTP
+
  [root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=http
  [root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=https   # HTTPS
+
  [root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=https
  
 
Add a custom port for SSH
 
Add a custom port for SSH
  
  [root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=22222/tcp # SSH
+
  [root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=22222/tcp
  
 
Reload the firewall rules
 
Reload the firewall rules
  
 
  [root@localhost ~]# firewall-cmd --reload
 
  [root@localhost ~]# firewall-cmd --reload

Revision as of 14:16, 27 June 2015

See also Upstart

Change server hostname

[root@localhost ~]# hostnamectl status
  Static hostname: localhost.localdomain
        Icon name: computer-vm
          Chassis: vm
       Machine ID: 399b74f54385ee0d782648666a204c25
          Boot ID: 411893b81fee4fb0b865e1b18fd8dd6d
   Virtualization: kvm
 Operating System: CentOS Linux 7 (Core)
      CPE OS Name: cpe:/o:centos:centos:7
           Kernel: Linux 3.10.0-123.el7.x86_64
     Architecture: x86_64

Set the hostname.

[root@localhost ~]# hostnamectl set-hostname centos7.internal

Check the host name again (Close the session and open new session using putty or console)

Enable firewall

Start the firewall running and set it to auto-start on bootup

[root@localhost ~]# systemctl start firewalld
[root@localhost ~]# systemctl enable firewalld

Enable HTTP and HTTPS

[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=http
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=https

Add a custom port for SSH

[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=22222/tcp

Reload the firewall rules

[root@localhost ~]# firewall-cmd --reload