System作業

1、求每班總成績和平均成績

[root@Centos7 bin]# awk '!/^name/{a[$2]++;b[$2]+=$3}END{for(i in a){print i,b[i],b[i]/a[i]}}' f1
4 100 50
5 40 40
6 50 50
1 430 71.6667
2 210 70
3 450 56.25
[root@Centos7 bin]# cat f1
name class score
A     1     100
B     2     90
C     3     80
D     1     70
C     3     80
D     1     70
C     3     80
D     1     70
E     2     60
F     3     50
G     1     40
H     4     30
I     5     40
I     3     40
I     3     40
I     3     40
J     6     50
I     3     40
K     2     60
L     4     70
M     1     80

2、為編譯安裝的httpd服務,實現service unit文件

1)安裝編譯環境:

      ① yum install -y pcre

      ② yum install -y pcre-devel

      ③ yum groupinstall -y "Development tools"

2)下載源碼包:

      ① apr-1.5.0.tar.bz2

      ② apr-util-1.5.2.tar.bz2

      ③ httpd-2.4.9.tar.bz2

3)安裝依賴的源碼包,先安裝apr,在安裝apr-util,因為apr-util是apr的工具,apr-util會依賴apr的存在,(如apr未安裝,則會提示用此參數指定apr的安裝地址 – – with-apr=/usr/local/apr)

     ①安裝apr

        ./configure –prefix=/usr/local/apr

        make && make install

                 ②.安裝apr-util

                         ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr

                       make && make install

                 ③.安裝httpd

                   ./configure –prefix=/usr/local/httpd –sysconfdir=/etc/httpd –enable-so –enable–ssl –enable-cgi –enable-rewrite –with-zlib –with-pcre –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –enable-modeles=most –enable-mpms-shared=all –with-mpm=event

                      make && make install

 

    (4)完成http安裝后的操作

           ①添加二進制程序文件地址到/etc/profile.d/httpd.sh文件中          

 [root@Centos7 local]# vim /etc/profile.d/httpd.sh
 export PATH=$PATH:/usr/local/httpd/bin    //添加此行

           ②添加man文檔路徑到man配置文件中  

 [root@Centos7 local]# vim /etc/man_db.conf 
 MANDATORY_MANPATH      /usr/local/httpd/man    //添加此行

            ③添加httpd頭文件的軟鏈接到/usr/include目錄下

   [root@Centos7 local]# ln -sv  /usr/local/httpd/include/ /usr/include/httpd

5)編輯httpd.service unit文件

 [root@Centos7 ~]# vim /etc/systemd/system/httpd.service
    [Unit]
    Description=The Apache HTTP Server
    After=network.target remote-fs.target nss-lookup.target
    Documentation=man:httpd(8)
    Documentation=man:apachectl(8)
     
    [Service]
    Type=notify
    EnvironmentFile=/etc/sysconfig/httpd
    ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
    ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
    ExecStop=/bin/kill -WINCH ${MAINPID}
    KillSignal=SIGCONT
    PrivateTmp=true
     
    [Install]
    WantedBy=multi-user.target

 

 

3、破解centos7 口令

(1)在啟動時選擇內核按e鍵進入編輯模式

 System作業

(2)在以linux16開頭的行的行尾添加內核參數:rd.break

 System作業

(3)按ctrl + x 鍵啟動進入系統

(4)將根文件系統重新掛載為可讀可寫:mount -o remount,rw /sysroot

 System作業

 

(5)切換到根文件系統:chroot  /sysroot

 System作業

(6)更改密碼: passwd

 System作業

 

(7)創建重新打標簽的文件,讓系統重新打標簽:touch /.autorelabel

 System作業

(8)退出重啟系統更改完成:exit

 

4、修改默認的啟動內核

    (1)修改grub配置文件:將GRUB_DEFAULT項更改為需要啟動的內核次序(我這里指定為0,表示/boot/grub2/grub.cfg文件中第一個內核)

[root@Centos7 bin]# vim /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

2)可查看/boot/grub2/grub.cfg文件中的內核次序:

menuentry 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-657cf10a-8a36-43e2-aec5-aa4fc1596776'
 //menuentry 開頭的為內核啟動次序

    (3)重新生成配置grub配置文件

[root@Centos7 bin]# grub2-mkconfig -o /etc/grub2.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-589c15d91a5b4e7dba045eb00363a558
Found initrd image: /boot/initramfs-0-rescue-589c15d91a5b4e7dba045eb00363a558.img
done
 
注:/etc/grub2.cfg文件為/boot/grub2/grub.cfg文件的軟鏈接,使用其中一個都可以

5、啟動時臨時禁用SELinux

1)在內核菜單中編輯內核參數,在linux16開頭的行的行尾添加內核參數:selinux=0,按ctrl + x 鍵進入系統,

[root@Centos7 ~]# getenforce   //添加內核參數完畢后進入系統查看selinux值
Disabled

[root@Centos7 ~]# cat /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing    //文件并沒有發生改變,下次重啟即為開啟selinux

6、啟動時進入emergency模式

1)在啟動時添加內核參數,只對當前本次啟動生效,下次重啟不生效,按ctrl + x鍵進入系統

System作業

 

7、刪除編譯安裝的新內核

1)刪除/boot/目錄下包括3.18字樣的內核文件

     [root@Centos7 /]# rm -f /boot/*3.18*

2)刪除/boot/grub2/grub.cfg文件中的啟動內核項

3)刪除/lib/modules目錄下的內核模塊文件:

     [root@Centos7 ~]# rm -rf /lib/modules/3.18.41-SuperDream.ux

4)刪除原來解壓內核文件到的目錄下的文件:

     [root@Centos7 ~]# rm -rf /usr/src/3.18.41

5)重啟

 

 

 

原創文章,作者:Lii,如若轉載,請注明出處:http://www.www58058.com/47934

(0)
LiiLii
上一篇 2016-09-20 09:25
下一篇 2016-09-20 13:56

相關推薦

  • 性能調優概述

    大綱: 一、概述 二、什么是性能調優?(what) 三、為什么需要性能調優?(why) 四、什么時候需要性能調優?(when) 五、什么地方需要性能調優?(where) 六、什么人來進行性能調優?(who) 七、怎么樣進行性能調優?(How) 八、總結 注,硬件配置:CUP Xeon E5620 x 2 8核心, 內存 16G , 硬盤 RAID 10,操作…

    Linux干貨 2015-02-10
  • 千里眼–用NFS和Samba實現共享網頁文件

     目的:使用網絡文件系實現LAMP的分步式資源共享 配置過程– 搭建nfs服務器:(centos 6.8) 安裝yum install mysql-server nfs-utils httpd #這里安裝httpd是為了方便后面共享文件的屬主屬組定義 啟動nfs服務 #service nfs start  mkdir /dat…

    2017-04-30
  • lvs-dr

            通過為請求報文重新封裝一個MAC首部進行轉發,源MAC是DIP所在的接口的MAC,目標MAC是某挑選出的RS的RIP所在接口的MAC地址;源IP/PORT,以及目標IP/PORT均保持不變;     VIP通常配置在lo:0…

    2017-06-29
  • 馬哥教育網絡班22期+第7周課程練習

    week7: 1、創建一個10G分區,并格式為ext4文件系統;    (1) 要求其block大小為2048, 預留空間百分比為2, 卷標為MYDATA, 默認掛載屬性包含acl;    (2) 掛載至/data/mydata目錄,要求掛載時禁止程…

    Linux干貨 2016-09-26
  • DNS高級應用

        DNS高級應用     1、主從復制      應用場景: (1)、當主DNS服務器壓力過大,無法正常處理過多的DNS解析請求時,從DNS服務器可以起到負載均衡的作用。 (2)、當主DNS服務器出現故障時,從DNS服務器可以為其提供冗余備份功能。     實驗環…

    Linux干貨 2015-06-18
  • 使用iptables緩解DDOS及CC攻擊

    緩解DDOS攻擊 防止SYN攻擊,輕量級預防 iptables -N syn-flood iptables -A INPUT -p tcp –syn -j syn-flood iptables -I syn-flood -p tcp -m limit –limit 3/s –limit-burst 6 -j RETURN iptables -A syn-fl…

    Linux干貨 2015-02-09

評論列表(1條)

  • 馬哥教育
    馬哥教育 2016-09-26 12:30

    文章實踐性很強,很具有操作性,贊一個。

欧美性久久久久