Centos 7 - 入門級操作

來源:互聯網
上載者:User

標籤:centos7

安裝完centos 7 minimal後,無力吐槽,變化之大,發現以前常用的一些命令都沒有。


一、常用命令安裝

查看anaconda-ks.cfg,原來是沒裝base group的包

[[email protected] ~]# cat anaconda-ks.cfg #version=RHEL7# System authorization informationauth --enableshadow --passalgo=sha512# Use CDROM installation mediacdrom# Run the Setup Agent on first bootfirstboot --enableignoredisk --only-use=sda# Keyboard layoutskeyboard --vckeymap=us --xlayouts=‘us‘# System languagelang en_US.UTF-8 --addsupport=zh_CN.UTF-8# Network informationnetwork  --bootproto=dhcp --device=eno16777736 --onboot=off --ipv6=autonetwork  --hostname=localhost.localdomain# Root passwordrootpw --iscrypted $6$Zz5VMf1HPPRm0YRL$QSoaU9pAUApXMj9BXuK5qlUFGAfCv9Y/ylVGUcDYv.lrxfNodTiI/7DO1UR7carvL1EdgwQpuiwDt524f6.GR.# System timezonetimezone Asia/Chongqing --isUtc --nontp# System bootloader configurationbootloader --location=mbr --boot-drive=sdaautopart --type=lvm# Partition clearing informationclearpart --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.targetlrwxrwxrwx 1 root root 13 Oct 11 03:51 /lib/systemd/system/runlevel1.target -> rescue.targetlrwxrwxrwx 1 root root 17 Oct 11 03:51 /lib/systemd/system/runlevel2.target -> multi-user.targetlrwxrwxrwx 1 root root 17 Oct 11 03:51 /lib/systemd/system/runlevel3.target -> multi-user.targetlrwxrwxrwx 1 root root 17 Oct 11 03:51 /lib/systemd/system/runlevel4.target -> multi-user.targetlrwxrwxrwx 1 root root 16 Oct 11 03:51 /lib/systemd/system/runlevel5.target -> graphical.targetlrwxrwxrwx 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


centos 7之前的版本都採用Sysvinit的系統啟動進程管理體系,因為是串列的進程啟動流程,可能因為某個進程的阻塞而影響啟動過程。centos 7使用systemd。目標是儘可能啟動更少進程;儘可能將更多進程並行啟動(這是效能優於SysVinit的理念基礎)。

更詳解的systemd介紹 https://www.huzs.net/?p=2180







本文出自 “the-way-to-cloud” 部落格,請務必保留此出處http://iceyao.blog.51cto.com/9426658/1562564

Centos 7 - 入門級操作

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.