在CentOS7 RHEL 7 设置GRUB2菜单的超时时间

在CentOS7 RHEL 7 设置GRUB2菜单的超时时间
Update GRUB2 menu timeout on RHEL 7 Linux

系统启动期间GRUB2超时菜单选项的默认设置为5秒。 打开/etc/default/grub grub默认配置文件。
The default settings for the GRUB2 timeout menu selection during the system boot is 5 seconds. To change this value open /etc/default/grub grub default config file. The content of the file looks similar the the one shown below:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root crashkernel=auto \
rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

自己动手给国内外各种云重装纯净版的CentOS7.x(2)

自己动手给国内外各种云重装纯净版的CentOS7.x(2)

一些基于openstack(阿里云云服务器ECS、百度云服务器BCC、京东云服务器,腾讯云服务器CVM,青云QingCloud)的架构使用上面的无法进行安装,那么就需要调整下配置参数才能进行自行重装

是对自己动手给国内外各种云重装纯净版的CentOS7.x的补充
需要自己动手给国内外各种云重装纯净版的CentOS7.x或者其他Linux系统

1、
wget -O /boot/vmlinuz.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/initrd.img

镜像也可以使用各大云服务提供商私有的(通过repo和私有DNS)
-------------------------------------------------------------------------------------------------
2、
cd /etc/grub.d

vi 40_custom

将下面的信息添加进去
menuentry 'www.zhangfangzhou.cn' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
linux16 /boot/vmlinuz.centos.pxe inst.headless ip=dhcp nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /boot/initrd.img.centos.pxe
}

insmod ext2
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe
initrd16 /initrd.img.centos.pxe
这四项信息需要查看/boot/grub2/grub.cfg具体来设置

如果磁盘用的是GPT格式的,需要添加inst.gpt选项。 If you are using GPT disk add inst.gpt option.
linux16 /vmlinuz.centos.pxe inst.gpt inst.headless ip=122.114.224.36::122.114.224.1:255.255.255.0::eth0:none nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /initrd.img.centos.pxe

3、重新生成/boot/grub2/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg

4、设置默认启动项
grub2-set-default www.zhangfangzhou.cn

5、grub2-editenv list #查看确认

6、reboot
打开vnc连接选择启动项www.zhangfangzhou.cn就可以重装了


自己动手给国内外各种云重装纯净版的CentOS7.x

自己动手给国内外各种云重装纯净版的CentOS7.x
需要自己动手给国内外各种云重装纯净版的CentOS7.x或者其他Linux系统
前文 自己动手给国内外各种云重装纯净版的CentOS6.x

CentOS7使用的是grub2,/boot/grub2/grub.cfg (由grub2-mkconfig -o /boot/grub2/grub.cfg生成)
-----------------------------------------------------------------------------------------------
1、国内
wget -O /boot/vmlinuz.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/initrd.img

国外
wget -O /boot/vmlinuz.centos.pxe http://ftp.cuhk.edu.hk/pub/Linux/centos/7/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe http://ftp.cuhk.edu.hk/pub/Linux/centos/7/os/x86_64/images/pxeboot/initrd.img
-------------------------------------------------------------------------------------------------
2、cd /etc/grub.d
ls
00_header 01_users 20_linux_xen 30_os-prober 41_custom
00_tuned 10_linux 20_ppc_terminfo 40_custom README

vi 40_custom

将下面的信息添加进去
menuentry 'www.zhangfangzhou.cn' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe headless ip=122.114.224.36 noipv6 netmask=255.255.255.0 gateway=122.114.224.1 dns=114.114.114.114 ksdevice=eth0 method=http://mirrors.aliyun.com/centos/7/os/x86_64/ devfs=nomount lang=en_US keymap=us
initrd16 /initrd.img.centos.pxe
}

上面的IP、掩码、网关、修改为你机器的就可以

set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe
initrd16 /initrd.img.centos.pxe
这三项信息需要查看/boot/grub2/grub.cfg具体来设置

----------------
正规写法

menuentry 'www.zhangfangzhou.cn' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe inst.headless ip=122.114.224.36::122.114.224.1:255.255.255.0::eth0:none nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /initrd.img.centos.pxe
}

insmod xfs
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe
initrd16 /initrd.img.centos.pxe
这四项信息需要查看/boot/grub2/grub.cfg具体来设置

如果磁盘用的是GPT格式的,需要添加inst.gpt选项。 If you are using GPT disk add inst.gpt option.
linux16 /vmlinuz.centos.pxe inst.gpt inst.headless ip=122.114.224.36::122.114.224.1:255.255.255.0::eth0:none nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /initrd.img.centos.pxe

CentOS 6 CentOS 7
vnc inst.vnc
vncpassword= inst.vncpassword=
Note: MUST at least 8 char
headless inst.headless
ip= ip=ip::gateway:netmask:hostname:interface:none
Example:
ip=10.0.0.10::10.0.0.1:255.255.255.0:host.example.com:eth0:none or ip=dhcp
gateway= See IP above
netmask= See IP above
dns= nameserver=
method= inst.repo=
lang= inst.lang=
keymap= inst.keymap=

你可以阅读整个选项变化
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options
----------------

ls -l /etc/grub2.cfg
lrwxrwxrwx 1 root root 22 Oct 28 17:25 /etc/grub2.cfg -> ../boot/grub2/grub.cfg

3、重新生成/boot/grub2/grub.cfg
执行grub2-mkconfig -o /boot/grub2/grub.cfg

4、设置默认启动项
grub2-set-default www.zhangfangzhou.cn

5、grub2-editenv list #查看确认

6、reboot
打开vnc连接选择启动项www.zhangfangzhou.cn就可以重装了

7、信息补充
rhgb quiet
rhgb表示redhat graphics boot,就是会看到图片来代替启动过程中显示的文本信息,这些信息在启动后用dmesg也可以看到
quiet表示在启动过程中只有重要信息显示,类似硬件自检的消息不回显示

rhgb = redhat graphical boot - This is a GUI mode booting screen with
most of the information hidden while the user sees a rotating activity
icon spining and brief information as to what the computer is doing.
quiet = hides the majority of boot messages before rhgb starts. These
are supposed to make the common user more comfortable. They get alarmed
about seeing the kernel and initializing messages, so they hide them for
their comfort.

8、
也可以添加一些自定义的启动选项
menuentry "System shutdown" {
echo "System shutting down..."
halt
}

menuentry "System restart" {
echo "System rebooting..."
reboot
}

Linux服务器下rootkit后门检测工具chkrootkit安装使用

Linux服务器下rootkit后门检测工具chkrootkit安装使用
操作系统:CentOS6 7

一、安装编译工具包
yum install gcc gcc-c++ make glibc-static -y

二、安装chkrootkit
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz #下载软件包
tar -zxvf chkrootkit.tar.gz #解压
cd chkrootkit-0.52
make sense #安装
cd ..
mv chkrootkit-0.52 /usr/local/chkrootkit #拷贝到安装目录

三、使用chkrootkit

cd /usr/local/chkrootkit
./chkrootkit | grep INFECTED
出现INFECTED就说明系统可能有问题了

CentOS 7.x 可能会出现下面的提示,原因是系统默认缺少netstat命令chkrootkit: can't find `netstat'.
yum whatprovides *netstat #查看命令所在的安装包
yum install net-tools #安装netstat命令即可

自己动手给国内外各种云重装纯净版的CentOS6.x

自己动手给国内外各种云重装纯净版的CentOS6.x
随着互联网的发展,云计算规模越来越大,越来越大的公司开始做相关的产品,为了方便客户的使用很多云公司会优化使用的系统,(阿里云云服务器ECS、百度云服务器BCC、京东云服务器,腾讯云服务器CVM,青云QingCloud,景安云服务器和景安vps,快云服务器和快云vps)添加一些不必要的组件
为此需要自己动手给国内外各种云重装纯净版的CentOS6.9或者其他Linux系统

1、国内
wget -O /boot/vmlinuz.centos.pxe http://mirrors.aliyun.com/centos/6/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe http://mirrors.aliyun.com/centos/6/os/x86_64/images/pxeboot/initrd.img

国外
wget -O /boot/vmlinuz.centos.pxe http://repos-lax.psychz.net/centos/6/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe http://repos-lax.psychz.net/centos/6/os/x86_64/images/pxeboot/initrd.img

2、yum install grub -y
vi /boot/grub/menu.lst

修改default=0
把下面这段插入在hiddenmenu后面

title CentOS 6.9 www.zhangfangzhou.cn
root (hd0,0)
kernel /boot/vmlinuz.centos.pxe headless ip=23.225.182.142 noipv6 netmask=255.255.255.0 gateway=23.225.182.1 dns=8.8.8.8 ksdevice=eth0 method=http://repos-lax.psychz.net/centos/6/os/x86_64/ lang=en_US keymap=us
initrd /boot/initrd.img.centos.pxe

上面的IP、掩码、网关、修改为你机器的就可以

root (hd0,0)
kernel /boot/vmlinuz.centos.pxe
initrd /boot/initrd.img.centos.pxe
这三项信息需要查看/etc/grub.conf具体来设置

ls -l /etc/grub.conf
lrwxrwxrwx. 1 root root 22 Oct 18 08:53 /etc/grub.conf -> ../boot/grub/grub.conf

3、reboot
打开vnc连接就可以重装了

如果IP信息是通过DHCP的方式获取的,那么需要修改成下面的
title CentOS 6.9 www.zhangfangzhou.cn
root (hd0,0)
kernel /boot/vmlinuz.centos.pxe headless ip=dhcp dns=8.8.8.8 ksdevice=eth0 method=http://mirrors.aliyun.com/centos/6/os/x86_64/ lang=en_US keymap=us
initrd /boot/initrd.img.centos.pxe



CentOS源码编译安装Apache 2.4.26 和 Apache Subversion 1.9.6 并配置基于Apache的SVN多项目库

CentOS源码编译安装Apache 2.4.26 和 Apache Subversion 1.9.6 并配置基于Apache的SVN多项目库

#!/bin/bash
a=$(cat /proc/cpuinfo | grep 'model name'| wc -l)
apstable=2.4.26
yum -y install gcc make epel-release pcre-devel zlib-devel lynx openssl openssl-devel
cd ~
wget http://archive.apache.org/dist//httpd/httpd-$apstable.tar.gz
tar -zxvf httpd-$apstable.tar.gz;
cd ~
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
tar zxf apr-1.5.2.tar.gz && cp -fr ./apr-1.5.2 ./httpd-$apstable/srclib/apr
tar zxf apr-util-1.5.4.tar.gz && cp -fr ./apr-util-1.5.4 ./httpd-$apstable/srclib/apr-util
cd ~
cd httpd-$apstable;
./configure \
--prefix=/usr/local/apache \
--with-mpm=prefork \
--with-included-apr \
--with-ssl \
--with-pcre \
--enable-mime-magic \
--enable-proxy \
--enable-ssl=shared \
--enable-so \
--enable-dav \
--enable-deflate=shared \
--enable-ssl=shared \
--enable-expires=shared \
--enable-headers=shared \
--enable-rewrite=shared \
--enable-static-support \
--disable-userdir \
--enable-modules=all \
--enable-mods-shared=all
make -j$a
make install
......
......

yum -y install gcc gcc-c++ unzip
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
tar -zxvf apr-1.5.2.tar.gz;cd apr-1.5.2
cd apr-1.5.2
./configure --prefix=/usr/local/apr && make && make install

wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
tar -zxvf apr-util-1.5.4.tar.gz;cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install

wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz;cd zlib-1.2.11
./configure --prefix=/usr/local/zlib && make && make install

wget http://apache.cs.utah.edu/subversion/subversion-1.9.6.tar.gz
tar -zxvf subversion-1.9.6.tar.gz;cd subversion-1.9.6
./get-deps.sh

单独使用
./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-zlib=/usr/local/zlib && make && make install

配合apache使用
./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-zlib=/usr/local/zlib -enable-mod-activation --with-apache-libexecdir=/usr/local/apache/modules --with-apxs=/usr/local/apache/bin/apxs --without-berkeley-db && make && make install

多项目配置
mkdir -p /var/www/svn #创建SVN目录
/usr/local/svn/bin/svnadmin create /var/www/svn/repos #创建repos版本库
/usr/local/svn/bin/svnadmin create /var/www/svn/android #创建android版本库
/usr/local/svn/bin/svnadmin create /var/www/svn/web #创建web版本库

/usr/local/apache/bin/htpasswd -c -b /var/www/svn/passwd admin 123456 #第一次创建文件和创建用户
/usr/local/apache/bin/htpasswd -b /var/www/svn/passwd admin2 123456 #添加用户
www.zhangfangzhou.cn

vi /var/www/svn/authz
[groups]
all = admin,rouser
[/]
admin2 = rw
@all = r

vi /usr/local/apache/conf/httpd.conf 默认 Subrsion 安装成功后会自动加上
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

DAV svn
SVNListParentPath on
SVNParentPath /var/www/svn
AuthzSVNAccessFile /var/www/svn/authz
AuthType Basic
AuthName "www.zhangfangzhou.cn SVN"
AuthUserFile /var/www/svn/passwd
Require valid-user

赋予权限
chown -R apache.apache /var/www/svn
chown -R apache.apache /usr/local/apache
重启服务
service httpd restart

/usr/local/apache/conf/httpd.conf: Cannot load modules/mod_dav_svn.so into server:
出现这个原因是因为没有加载#LoadModule dav_module modules/mod_dav.so

CentOS6.x YUM安装配置使用基于Apache的SVN多项目库

CentOS6.x YUM安装配置使用基于Apache的SVN多项目库

1、安装apache和svn
yum install httpd subversion mod_dav_svn -y
2、服务初始化配置
sed -i 's/^#ServerName www.example.com:80/ServerName localhost:80/' /etc/httpd/conf/httpd.conf
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
service httpd start;chkconfig httpd on
chkconfig iptables off;service iptables stop

3、创建目录和项目目录
mkdir -p /var/www/svn #创建SVN目录
svnadmin create /var/www/svn/repos #创建repos版本库

单项目配置
cd /var/www/svn/repos/conf
htpasswd -c -b /var/www/svn/repos/conf/passwd admin 123456 第一次创建文件和创建用户
htpasswd -b /var/www/svn/repos/conf/passwd admin2 123456 添加用户

cat /var/www/svn/repos/conf/authz

[groups] #定义用户组,方便统一管理
all = admin,rouser #定义一个组叫做“all”,包含“admin”和“rouser”
[/] #定义svn版本库根目录权限(子目录继承根目录权限)
@all = r #用户组“all”中的所有用户有读权限
admin = rw #admin用户有读权限和写权限
rouser = r       #rouser有读权限

[groups]
all = admin,rouser
[repos:/]
admin2 = rw
@all = r

vi /var/www/svn/repos/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
pasword-db = passwd
authz-db - authz

配置apache
cat /etc/httpd/conf.d/subversion.conf

DAV svn
SVNPath /var/www/svn/repos
AuthzSVNAccessFile /var/www/svn/repos/conf/authz
AuthType Basic
AuthName "www.zhangfangzhou.cn SVN"
AuthUserFile /var/www/svn/repos/conf/passwd
Require valid-user

赋予权限
chown -R apache.apache /var/www/svn
重启服务
service httpd restart

多项目配置
mkdir -p /var/www/svn #创建SVN目录
svnadmin create /var/www/svn/repos #创建repos版本库
svnadmin create /var/www/svn/android #创建android版本库
svnadmin create /var/www/svn/web #创建web版本库

htpasswd -c -b /var/www/svn/passwd admin 123456 #第一次创建文件和创建用户
htpasswd -b /var/www/svn/passwd admin2 123456 #添加用户

vi /var/www/svn/authz
[groups]
all = admin,rouser
[/]
admin2 = rw
@all = r

vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#上面这两条一般默认存在

DAV svn
SVNListParentPath on
SVNParentPath /var/www/svn
AuthzSVNAccessFile /var/www/svn/authz
AuthType Basic
AuthName "www.zhangfangzhou.cn SVN"
AuthUserFile /var/www/svn/passwd
Require valid-user

赋予权限
chown -R apache.apache /var/www/svn
重启服务
service httpd restart

#如果开启安全上下文,那么需要同步安全上下文
chcon -R -t httpd_sys_content_t /var/www/html/svn

配置中有 SVNPath 与 SVNParentPath 两个选项.
SVNPath用于只有一个项目的情况,此时如果在主目录下面再建新项目,则不能访问.提示没有权限.
如果有多个项目的话,此时应该使用SVNParentPath来设置父目录来设置项目的父目录,这样子目录里面可以有多个项目了。然后auth文件里面可以定义子目录的权限。
apache的/etc/httpd/conf.d/subversion.conf 配置文件里面设置一个location就可以了

Linux环境下更新DELL PowerEdge R710 BIOS版本

Linux环境下更新DELL PowerEdge R710 BIOS版本
更新BIOS帮助保持DELL PowerEdge R710系统软件最新并与其它系统模块(固件,BIOS,驱动程序和软件)兼容的功能增强或更改。

升级BIOS需谨慎,R710使用CentOS7.3升级BIOS,有一次导致了内核崩溃。

http://www.dell.com/support/home/cn/zh/cnbsd1/product-support/servicetag/7MT4S2X/
http://www.dell.com/support/home/cn/zh/cnbsd1/product-support/servicetag/7mt4s2x/drivers

Windows 版本 https://downloads.dell.com/FOLDER01631935M/1/R710_BIOS_4HKX2_WN64_6.4.0.EXE
Linux 版本 https://downloads.dell.com/FOLDER01631932M/1/R710_BIOS_4HKX2_LN_6.4.0.BIN

Windows 版本下载完毕直接点击exe进行升级
Linux 版本下载完毕后
chmod +x R710_BIOS_4HKX2_LN_6.4.0.BIN
./R710_BIOS_4HKX2_LN_6.4.0.BIN
输入y
确认重启输入y

登录进入dell的IDRAC(Integrated Dell Remote Access Controller 6),查看BIOS版本
或者进入linux系统输入dmidecode | more,查看bios的版本号