管理系统服务: CentOS 7: service unit 注意:能兼容早期的服务脚本 命令:systemctl COMMAND name.service 启动:service name start ==> systemctl start name.service 停止:service name stop ==> systemctl stop name.service 重启:service name restart ==> systemctl restart name.service 状态:service name status ==> systemctl status name.service
条件式重启:已启动才重启,否则不做操作
service name condrestart ==> systemctl try-restart name.service
重载或重启服务:先加载,再启动
systemctl reload-or-restart name.service
重载或条件式重启服务:
systemctl reload-or-try-restart name.service
禁止自动和手动启动:
systemctl mask name.service
取消禁止:
systemctl unmask name.service
服务查看
查看某服务当前激活与否的状态:
systemctl is-active name.service
查看所有已经激活的服务:
systemctl list-units --type|-t service
查看所有服务:
systemctl list-units --type service --all|-a
chkconfig命令的对应关系:
设定某服务开机自启:
chkconfig name on ==> systemctl enable name.service
设定某服务开机禁止启动:
chkconfig name off ==> systemctl disable name.service
查看所有服务的开机自启状态: chkconfig –list ==> systemctl list-unit-files –type service
用来列出该服务在哪些运行级别下启用和禁用 chkconfig sshd –list ==> ls /etc/systemd/system/*.wants/sshd.service
安装开发包组 下载源码文件 .config:准备文本配置文件 make menuconfig:配置内核选项 make [-j #] make modules_install:安装模块 make install :安装内核相关文件 安装bzImage为/boot/vmlinuz-VERSION-RELEASE 生成initramfs文件 编辑grub的配置文件
编译安装内核示例
tar xf linux-3.10.67.tar.xz -C /usr/src cd /usr/src ln -sv linux-3.10.67 linux cd /usr/src/linux cp /boot/config-$(uname -r) ./.config make help make menuconfig make -j 2 make modules_install make install reboot
编译内核
(1) 配置内核选项 支持”更新”模式进行配置:make help (a) make config:基于命令行以遍历的方式配置内核中可配置的每个选项 (b) make menuconfig:基于curses的文本窗口界面 (c) make gconfig:基于GTK (GNOME)环境窗口界面 (d) make xconfig:基于QT(KDE)环境的窗口界面 支持”全新配置”模式进行配置 (a) make defconfig:基于内核为目标平台提供的”默认”配置进行配置 (b) make allyesconfig: 所有选项均回答为”yes” (c) make allnoconfig: 所有选项均回答为”no”
(2) 编译 全编译:make [-j #] 编译内核的一部分功能: (a) 只编译某子目录中的相关代码 cd /usr/src/linux make dir/ (b) 只编译一个特定的模块 cd /usr/src/linux make dir/file.ko 例如:只为e1000编译驱动: make drivers/net/ethernet/intel/e1000/e1000.ko
如何交叉编译内核: 编译的目标平台与当前平台不相同 make ARCH=arch_name 要获取特定目标平台的使用帮助 make ARCH=arch_name help make ARCH=arm help
内核编译
在已经执行过编译操作的内核源码树做重新编译 需要事先清理操作: make clean:清理大多数编译生成的文件,但会保留config文件等 make mrproper: 清理所有编译生成的文件、config及某些备份文件 make distclean:mrproper、patches以及编辑器备份文件
Handshake协议:包括协商安全参数和密码套件、服务器身份认证(客户端身份认证可选)、密钥交换 ChangeCipherSpec 协议:一条消息表明握手协议已经完成 Alert 协议:对握手协议中一些异常的错误提醒,分为fatal和warning两个级别,fatal类型错误会直接中断SSL链接,而Warning级别的错误SSL链接仍可继续,只是会给出错误警告 Record 协议:包括对消息的分段、压缩、消息认证和完整性保护、加密等 HTTPS 协议:就是“HTTP 协议”和“SSL/TLS 协议”的组合.HTTP over SSL”或“HTTP over TLS”,对http协议的文本数据进行加密处理后,成为二进制形式传输
time (awk 'BEGIN{ total=0;for(i=0;i<=10000;i++){total+=i;};print total;}') time(total=0;for i in {1..10000};do total=$(($total+i));done;echo $total) time(for ((i=0;i<=10000;i++));do let total+=i;done;echo $total) time(seq –s ”+” 10000|bc)