Difference between revisions of "Basic"

From AlphaBook
Jump to: navigation, search
(Time)
Line 24: Line 24:
 
== Time ==
 
== Time ==
 
* timedatectl
 
* timedatectl
* timedatectl list-timezones | grep Shanghai
+
* timedatectl list-timezones | grep Asia
 
* timedatectl set-timezones Asia/Shanghai
 
* timedatectl set-timezones Asia/Shanghai
 
* cat /etc/chrony.conf
 
* cat /etc/chrony.conf

Revision as of 13:51, 4 December 2018

Partition

  • /boot
  • /
  • swap

Hostname

  • hostnamectl
  • hostnamectl set-hostname Linux001

Network

  • vi /etc/sysconfig/network-scripts/ifcfg-ens32
  • BOOTPROTO=static
  • ONBOOT=yes
  • IPADDR=192.168.200.10
  • NETMASK=255.255.255.0
  • GATEWAY=192.168.200.1
  • systemctl restart network
  • vi /etc/resolv.conf
  • search corp.alphabook.cn
  • nameserver 114.114.114.114
  • CentOS 7 NetworkManager Keeps Overwriting /etc/resolv.conf
    • Check DNS related configuration in /etc/sysconfig/network-scripts/ifcfg-ens32

Time

  • timedatectl
  • timedatectl list-timezones | grep Asia
  • timedatectl set-timezones Asia/Shanghai
  • cat /etc/chrony.conf
  • Or ntp
  • systemctl stop chronyd.service
  • systemctl disable chronyd.service
  • yum install ntp
  • systemctl start ntpd.service
  • systemctl enable ntpd.service

Service

  • systemctl status ssh
  • systemctl start ssh
  • systemctl stop ssh
  • systemctl restart ssh
  • systemctl reload ssh
  • systemctl enable ssh
  • systemctl disable ssh
  • systemctl is-enabled ssh
  • systemctl is-active ssh
  • systemctl show ssh

Firewall

  • systemctl status firewalld
  • firewall-cmd --get-default-zone
  • firewall-cmd --set-default-zone=internal
  • firewall-cmd --list-service
    • ssh dhcpv6-client http https ftp samba samba-client smtp tftp tftp-client dns
  • firewall-cmd --permanent --add-service=http
  • firewall-cmd --reload
  • firewall-cmd --list-all

SELinux

  • sestatus
  • getenforce
  • setenforce
  • vi /etc/selinux/config

Mount

  • mount /dev/cdrom /media
  • mount -o loop xxx.iso /media

Permission

  • r=read=4 w=write=2 x=execute=1
  • u=user g=group o=other
  • chmod 755 file01
  • chmod go+x file01
  • chown User01.Group01 file01
  • chgrp Group01 file01

Advanced

Basic Ubuntu