欢迎来到云服务器

系统配置

CentOS 7安装后的根基设置讲授

安装完CentOS 7 minimal后,无力吐槽,变革之大,发明以前常用的一些呼吁都没有。

一、常用呼吁安装

查察anaconda-ks.cfg,本来是没装base group的包

 [[email protected] ~]# cat anaconda-ks.cfg
#version=RHEL7
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8 --addsupport=zh_CN.UTF-8
# Network information
network  --bootproto=dhcp --device=eno16777736 --onboot=off --ipv6=auto
network  --hostname=localhost.localdomain
# Root password
rootpw --iscrypted $6$Zz5VMf1HPPRm0YRL$QSoaU9pAUApXMj9BXuK5qlUFGAfCv9Y/ylVGUcDYv.lrxfNodTiI/7DO1UR7carvL1EdgwQpuiwDt524f6.GR.
# System timezone
timezone Asia/Chongqing --isUtc --nontp
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
@core      # 这里只有core
%end

[[email protected] ~]# yum groupinstall base  # 安装完后ifconfig、service、chkconfig等呼吁就都有了

二、运行级别切换

[[email protected] ~]# cat /etc/inittab  #  系统运行级此外配置方法也变革了
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
这里写的很大白了,做个软链修改默认运行级别

[[email protected] system]# ll /lib/systemd/system/runlevel*.target  # 系统0-6 7个运行级别,2 3 4 运行指向同一个文件
lrwxrwxrwx 1 root root 15 Oct 11 03:51 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx 1 root root 13 Oct 11 03:51 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx 1 root root 17 Oct 11 03:51 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx 1 root root 17 Oct 11 03:51 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx 1 root root 17 Oct 11 03:51 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx 1 root root 16 Oct 11 03:51 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx 1 root root 13 Oct 11 03:51 /lib/systemd/system/runlevel6.target -> reboot.target

三、systemctl打点系统处事

systemctl可以看作是service和chkconfig的组合

job
chkconfig、service systemctl
处事开机自启动 chkconfig --level 3 httpd on systemctl enable httpd
处事不开机自启动 chkconfig --level 3 httpd off systemctl disable httpd

 

处事状态

 

service httpd status

systemctl status httpd(处事具体信息)

systemctl is-active httpd(只显示是否active)

 

所有处事的启动状态 chkconfig --list  systemctl list-units --type=service
启动处事 service httpd start systemctl start httpd
遏制处事 service httpd stop systemctl stop httpd
重启处事 service httpd restart systemctl restart httpd
腾讯云代理

Copyright © 2003-2021 MFISP.COM. 国外vps服务器租用 梦飞云服务器租用 版权所有 粤ICP备11019662号