RHEL6: 升级Kernel

a. 最好不要自行编译内核。直接下载官方的rpm包进行升级即可;
b. 下面是从2.6.32-431升级到2.6.32-504的步骤;

1. 备份重要数据;
2. 下载kernel-2.6.32-504.el6.x86_64.rpm 和 kernel-firmware-2.6.32-504.el6.noarch.rpm ;
3. 升级kernel-firmware;

[root@r6s0 tmp]# rpm -Uvh kernel-firmware-2.6.32-504.el6.noarch.rpm 

4. 安装kernel;

[root@r6s0 tmp]# rpm -ivh kernel-2.6.32-504.el6.x86_64.rpm

5. 检查grub.conf,启动时应以新内核启动;

kernel /vmlinuz-2.6.32-504.el6.x86_64

RHEL6: PAM

PAM可用于各种认证、授权。
下面做两个简单的实验,看看pam_cracklib和pam_tally2的简单用法。

参考文档

1. Linux-PAM page http://www.linux-pam.org/
2. Linux可插拔认证模块的基本概念与架构 http://www.infoq.com/cn/articles/wjl-linux-pluggable-authentication-module
3. Linux可插拔认证模块(PAM)的配置文件、工作原理与流程 http://www.infoq.com/cn/articles/linux-pam-one
继续阅读“RHEL6: PAM”

Stockbroker Grapevine - GCC - O(n3)解法

原题

Description

Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumours in the fastest possible way.

Unfortunately for you, stockbrokers only trust information coming from their "Trusted sources" This means you have to take into account the structure of their contacts when starting a rumour. It takes a certain amount of time for a specific stockbroker to pass the rumour on to each of his colleagues. Your task will be to write a program that tells you which stockbroker to choose as your starting point for the rumour, as well as the time it will take for the rumour to spread throughout the stockbroker community. This duration is measured as the time needed for the last person to receive the information.

Input

Your program will input data for different sets of stockbrokers. Each set starts with a line with the number of stockbrokers. Following this is a line for each stockbroker which contains the number of people who they have contact with, who these people are, and the time taken for them to pass the message to each person. The format of each stockbroker line is as follows: The line starts with the number of contacts (n), followed by n pairs of integers, one pair for each contact. Each pair lists first a number referring to the contact (e.g. a '1' means person number one in the set), followed by the time in minutes taken to pass a message to that person. There are no special punctuation symbols or spacing rules.

Each person is numbered 1 through to the number of stockbrokers. The time taken to pass the message on will be between 1 and 10 minutes (inclusive), and the number of contacts will range between 0 and one less than the number of stockbrokers. The number of stockbrokers will range from 1 to 100. The input is terminated by a set of stockbrokers containing 0 (zero) people.
继续阅读“Stockbroker Grapevine - GCC - O(n3)解法”

RHEL6: NIS的简单配置

参考文档

1. 鸟哥Linux私房菜-NIS http://linux.vbird.org/linux_server/0430nis.php
2. The Linux NIS(YP)/NYS/NIS+ HOWTO http://www.tldp.org/HOWTO/NIS-HOWTO/ypserv.html

实验环境

1. Server1, Server2 系统都是RHEL6.5;
2. Server1 IP为 192.168.122.108;
3. Server2 IP为 192.168.122.50;

实验内容

1. 以Server1 作为 NIS Server, Server2 作为Client.
2. 在Server2上尝试用NIS Server提供的用户信息登录;
3. 配置NFS家目录;


配置NIS Server

1. 安装所需软件包

[root@server1 ~]# yum install yp-tools ypbind ypserv rpcbind

2. 配置Server所属的域和主机名,Server 和 Client要在同一个域里呀。
修改/etc/sysconfig/network

HOSTNAME=server1.nis.example.com
NISDOMAIN=nis.example.com
YPSERV_ARGS="-p 1011"

修改/etc/hosts

192.168.122.108 server1.nis.example.com

继续阅读“RHEL6: NIS的简单配置”

RHEL6: NFS Server 安装与简单配置

参考文档

1. 鸟哥的Linux私房菜-NFS http://linux.vbird.org/linux_server/0330nfs.php
2. Linux NFS-HOWTO http://www.tldp.org/HOWTO/NFS-HOWTO/index.html
3. RFC 1094 https://tools.ietf.org/html/rfc1094
4. Redhat NFS https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-nfs.html

实验环境

1. Server1, Server2 系统均为RHEL6.5;
2. Server1 IP 192.168.122.108;
3. Server2 IP 192.168.122.50;

实验内容

1. 以Server1 作为NFS Server,共享/nfs_pub;用户的udi和gid都使用555.
2. Server2 设置成 NFS Client, 用autofs挂载192.168.122.108:/nfs_pub 到 /nfs/nfs_pub
继续阅读“RHEL6: NFS Server 安装与简单配置”

RHEL7: 救援模式修改root密码

RHEL7的救援模式,相当于RHEL6的单用户模式。
要在不知道root密码的前提下修改root密码,进入救援模式最靠谱。

参考文档

How To Reset Your Forgotten Root Password On CentOS 7 Servers

步骤

1. 进入Grub后修改启动选项。(按e可以编辑)

2. 在linux那一栏,加上

init=/sysroot/bin/sh

3. 删除

rhgb quiet

继续阅读“RHEL7: 救援模式修改root密码”