Difference between revisions of "CentOS7"
From Leaky
(Added link to upstart info as this is also centos7) |
(Added info about firewalld) |
||
| Line 21: | Line 21: | ||
Check the host name again (Close the session and open new session using putty or console) | 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 # HTTP | ||
| + | [root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=https # HTTPS | ||
| + | |||
| + | Add a custom port for SSH | ||
| + | |||
| + | [root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=22222/tcp # SSH | ||
| + | |||
| + | Reload the firewall rules | ||
| + | |||
| + | [root@localhost ~]# firewall-cmd --reload | ||
Revision as of 14:15, 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 # HTTP [root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=https # HTTPS
Add a custom port for SSH
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=22222/tcp # SSH
Reload the firewall rules
[root@localhost ~]# firewall-cmd --reload