Home>Article>Operation and Maintenance> What is the difference between the commands of centos7 and 6?
Difference: 1. Centos7 uses systemd instead of init; 2. Modify the host name. Centos6 needs to modify "/etc/sysconfig/network", while 7 needs to modify "/etc/hostname"; 3. Centos7 uses the chrony command To synchronize time, use ntp.
#The operating environment of this tutorial: centos7 system, thinkpad t480 computer.
I have recently been using CentOS 7 and found that many commands are different from CentOS 6, so they are listed here for reference.
1. Commonly used systemctl commands
CentOS 7 began to use systemd to replace the init system parent process, so it is necessary to be proficient in systemctl.
CentOS 7 | CentOS 6 | Function |
systemctl start sshd.service | service sshd start | Start ssh service |
systemctl stop sshd.service | service sshd stop | Stop ssh service |
systemctl restart sshd.service | service sshd restart | restart ssh service |
systemctl status sshd.service | service sshd status | View ssh service status |
systemctl reload sshd.service | service sshd reload | Reload the ssh service |
chkconfig --level 3 sshd on | Start the ssh service automatically after booting | |
chkconfig --level 3 sshd off | Disable starting the ssh service at boot | |
chkconfig --list | List all service status | |
chkconfig --list,ntsysv | List allowed service units | |
chkconfig --list sshd | Check whether the ssh service is running | |
Shield (cannot Enable) ssh service | ||
liberation shield ssh service | ||
Show configuration information of SSH service | ||
Get the currently used runlevel | ||
vi /etc/inittab | Modify the default runlevel | |
init 3 | Enable runlevel 3 |
2. Configuration file
1. Startup configuration centos6: Modify /etc/inittab centos7: systemctl set-default runlevel3.target 2. Modify the host name centos6: Modify /etc/sysconfig/network centos7: Modify /etc/hostname 3. Open the startup file /etc/rc. d/rc.local centos6: No modification required centos7: chmod x /etc/rc.d/rc.local 4. Default firewall centos6: iptables centos7: firewall 5. Start the service in file mode centos6:/etc/rc.d/rc3.d/ Modify the ones starting with K The file is S centos7: Make a soft connection to a service under /usr/lib/systemd/system/ to the /etc/systemd/system directory 6, routing forwarding centos6: Edit /etc/sysctl.conf and add net.ipv4.ip_forward = 1 or echo “1” > /proc/sys/net/ipv4/ip_forward centos7: Edit /etc/sysctl .conf Add net.ipv4.ip_forward = 1 or echo “1” > /proc/sys/net/ipv4/ip_forward Edit /usr/lib/sysctl.d/50-default.conf Add net .ipv4.ip_forward = 1 7. Language setting centos6: vim /etc/sysconfig/i18n modification LANG="zh_CN.UTF-8" centos7: localectl set-locale.UTF-8 8, time synchronization CentOS6$ ntp $ ntpq -pCentOS7
$ chrony $ chronyc sources9, modification time CentOS6
$ vim /etc/sysconfig/clock ZONE="Asia/Tokyo" UTC=fales $ sudo ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtimeCentOS7
$ timedatectl set-timezone Asia/Tokyo $ timedatectl statusRecommended: "
centos usage tutorial"
The above is the detailed content of What is the difference between the commands of centos7 and 6?. For more information, please follow other related articles on the PHP Chinese website!