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.178linux.com/47934

(0)
LiiLii
上一篇 2016-09-20
下一篇 2016-09-20

相关推荐

  • 用户管理生产环境实践案例

    关于用户管理的命令回顾:visudo 用户管理生产环境实践案例 1. 关于用户管理命令的回顾 2. 正文 关于用户管理的命令回顾: <1> useradd命令 <2> 其他命令 (1)信息收集 (2)模拟用户测试 <1> 问题现状 <2> 需求分析 <3> 实现方针 <4>. 实施过程 …

    Linux干货 2016-10-18
  • N28-第二周

    文件管理命令: cp命令:copy    源文件;目标文件; 单源复制:cp [OPTION]… [-T] SOURCE DEST多源复制:cp [OPTION]… SOURCE… DIRECTORYcp [OPTION]… -t DIRECTORY SOURCE… 单源复制:cp [OPTION]…

    Linux干货 2017-12-17
  • shell脚本编写-5

      1、 数组 变量:存储单个元素的内存空间 数组:存储多个元素的连续的内存空间,相当于多个变量的集合 数组名和索引 索引:编号从0 开始,属于数值索引 注意:索引可支持使用自定义的格式,而不仅是数值格式,即为关联索引,bash4.0版本之后开始支持。而且bash 的数组支持稀疏格式(索引不连续) 1)、定义数组 声明数组: declare -a …

    Linux干货 2016-09-01
  • sed的基本用法详解

    在Linux的世界中,有着一个文本三剑客的称呼,它们分别代表grep(文本过滤),sed(流编辑器),awk(gawk)(报告生成器)。 它们是强大的文本处理工具,了解并掌握它们,可以让你对文本的处理更加从容和轻松。 今天我们主要是围绕sed来进行分析。 一、初识sed sed:Stream Editor 从名字上也可以直观的了解到它是一个流编辑工具。何为流…

    Linux干货 2015-06-08
  • OpenSSL

    三个组件: openssl: 多用途的命令行工具; libcrypto: 加密解密库; libssl:ssl协议的实现; PKI:Public Key Infrastructure CA RA CRL 证书存取库  建立私有CA: OpenCA openssl  证书申请及签署步骤: 1、生成申请请求; 2、RA核验; 3、CA签署; 4…

    Linux干货 2015-03-21
  • 系统管理之Selinux详解

    SELinux: SELinux概念SELinux配置启用SELinux管理文件安全标签管理端口标签管理SELinux布尔值开关管理日志查看SELinux帮助 SELinux概述 SELinux: Secure Enhanced Linux, 是美国国家安全局「NSA=The National Se…

    Linux干货 2016-09-21

评论列表(1条)

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

    文章实践性很强,很具有操作性,赞一个。