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的版本号

CentOS 6、CentOS 7 ,使用crontab和logrotate实现Nginx日志轮询(转存)

CentOS 6、CentOS 7 ,使用crontab和logrotate实现Nginx日志轮询(转存)

1、安装crontab
2、安装logrotate日志文件管理工具
3、分析cron.daily
4、Nginx日志轮询(转存)配置,Apache的类似
5、为什么日志轮询(转存)生成日志的时间是凌晨三四点
6、立即执行logratate
7、logratate常用配置参数

1、安装crontab
if ! which crond >/dev/null 2>&1;then yum install cronie -y; fi
systemctl enable crond

2、 安装logrotate日志文件管理工具
yum -y install logrotate
查看logrotate的软件包的信息
rpm -ql logrotate
/etc/cron.daily/logrotate
/etc/logrotate.conf
/etc/logrotate.d
.....
.....

3、分析cron.daily
cd /etc/cron.daily
[root@www.zhangfangzhou.cn cron.daily]# ls
logrotate makewhatis.cron
[root@www.zhangfangzhou.cn cron.daily]# tail logrotate
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0

4、Nginx日志轮询(转存)配置,Apache日志轮询(转存)类似。
/home/wwwlogs/ 网站日志目录

cat > /etc/logrotate.d/nginx << EOF
/home/wwwlogs/*log {
daily
rotate 5
missingok
dateext
compress
notifempty
sharedscripts
postrotate
    [ -e /usr/local/nginx/logs/nginx.pid ] && kill -USR1 \`cat /usr/local/nginx/logs/nginx.pid\`
endscript
}
EOF

5、为什么日志轮询(转存)生成日志的时间是凌晨三四点?
Logrotate是基于CRON运行的,所以这个时间是由CRON控制的,具体可以查询CRON的配置文件「/etc/crontab」
anacron 正在运行过去 crontab 未进行的各项工作排程

cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45 #最大延迟时间
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22 #只在03到22点之间执行

#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly

每天都执行/etc/cront.daily/目录下的脚本文件,
真实的延迟RANDOM_DELAY+delay。这里的延迟是5分钟,加上上面的RANDOM_DELAY,所以实际的延迟时间是5-50之间,开始时间为03-22点,
如果机器没关,那么一般就是在03:05-03:50之间执行。nice命令将该进程设置为nice=10,默认为0,即低优先级进程。
如果RANDOM_DELAY=0,那么表示准确延迟5min,即03:05执行cron.daily

6、立即执行logratate
ldconfig #执行
或者
/etc/cron.daily
logrotate
或者
执行下面
/usr/sbin/logrotate -f /etc/logrotate.d/nginx

由于logratate已经加到cron.daily(/etc/cron.daily/logrotate),不再需要加到计划任务中

7、logratate常用配置参数
/home/wwwlogs/*log:需要轮询日志路径
daily:每天轮询
rotate 5:保留最多5次滚动的日志
missingok:如果日志丢失,不报错继续滚动下一个日志
dateext:使用日期作为命名格式
compress:通过gzip压缩转储以后的日志
notifempty:当日志为空时不进行滚动
/usr/local/nginx/logs/nginx.pid: nginx pid位置,请查看nginx.conf
postrotate/endscript:在截断转储以后需要执行的命令

CentOS 7 可能出现如下问题
error: skipping "/home/wwwlogs/access_nginx.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
解决方案
vi /etc/logrotate.d/nginx
su $http_user $http_group
su www www

CentOS7通过反向SSH隧道(Reverse SSH Tunneling) 实现内网穿透

CentOS7通过反向SSH隧道(Reverse SSH Tunneling) 实现内网穿透

1、By default, SSH daemon is only listening on 127.0.0.1, so we won’t be able to access to our forwarded ports from outside. To get it listen on the interface connected to Internet we must enable GatewayPorts option in SSH server's configuration.
默认情况下,SSH守护程序只侦听127.0.0.1,所以我们将无法从外部访问我们转发的端口。 要让它在连接到Internet的接口上侦听,我们必须在SSH服务器的配置中启用GatewayPorts选项。

vim /etc/ssh/sshd_config
然后GatewayPorts yes在文件的底部添加。

2、为防止SSH登录自动超时,修改下面参数每60秒会发一个KeepAlive请求
vim /etc/ssh/sshd_config
ServerAliveInterval 60

3、ssh -fNR 公网服务器需要监听的端口:localhost:内网需要监听的端口 用户@公网服务器
-N:不执行何指令
-f:后台执行
-R:建立reverse tunnel

在内网服务器上执行,那么就可以通过公网服务器的1688端口来连接处于多层内网的服务器了
ssh -fNR 1688:localhost:22 root@122.114.224.224 -p 12345

公网服务器执行netstat -tulpn
tcp 0 0 0.0.0.0:1688 0.0.0.0:* LISTEN 2442/sshd

4、也可以用 autossh 来创建一个连接到公网服务器的永久 SSH 隧道。

5、Windows 通过隧道实现内网穿透
plink -R [Port to forward to on your VPS]:localhost:[Port to forward on your local machine] [VPS IP]
http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

6、这里是用CentOS7,当然也可以使用Ubuntu、Debian、Fedora等等

CentOS实现Nginx1.10.3平滑升级Nginx1.11.10(热部署或热加载)

CentOS实现Nginx1.10.3平滑升级Nginx1.11.10(热部署或热加载)
如果要对当前的Nginx服务器进行版本升级,应用新模块,如果用户访问量比较大的时候,如果需要在不影响客户的情况下进行升级的话,这时候就得考虑平滑升级了。
平缓停止Nginx服务
平缓重启Nginx服务

创建用户目录和赋予权限
id -u www >/dev/null 2>&1
[ $? -ne 0 ] && useradd -M -s /sbin/nologin www;
mkdir -p /usr/local/nginx && chown www.www -R /usr/local/nginx;

yum -y install gcc make screen python wget git pcre-devel zlib-devel openssl-devel

CentOS源码编译安装Nginx1.10.3
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvf nginx-1.10.3.tar.gz;cd nginx-1.10.3
./configure --prefix=/usr/local/nginx --user=www --group=www \
--with-http_stub_status_module \
--with-http_secure_link_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-ipv6 \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_sub_module \
--with-stream \
--with-stream_ssl_module
make
make install

CentOS源码编译Nginx1.11.10
wget http://nginx.org/download/nginx-1.11.10.tar.gz
tar -zxvf nginx-1.11.10.tar.gz;cd nginx-1.11.10
./configure --prefix=/usr/local/nginx --user=www --group=www \
--with-http_stub_status_module \
--with-http_secure_link_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-ipv6 \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_sub_module \
--with-stream \
--with-stream_ssl_module
make

1、重命名低版本的nginx
# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

2、然后拷贝一份新编译的二进制文件:
[root@www.zhangfangzhou.cn nginx-1.11.10]# cp objs/nginx /usr/local/nginx/sbin/

3、在源码目录执行make upgrade开始升级,因为nginx.pid的位置,造成自动升级会报错误
[root@www.zhangfangzhou.cn nginx-1.11.10] # make upgrade

[root@www.zhangfangzhou.cn nginx-1.11.10]# cat Makefile

default: build

clean:
rm -rf Makefile objs

build:
$(MAKE) -f objs/Makefile

install:
$(MAKE) -f objs/Makefile install

modules:
$(MAKE) -f objs/Makefile modules

upgrade:
/usr/local/nginx/sbin/nginx -t

kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
sleep 1
test -f /usr/local/nginx/logs/nginx.pid.oldbin

kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`

#下面是手动升级
[root@www.zhangfangzhou.cn nginx-1.11.10]# kill -USR2 `cat /var/run/nginx.pid;`
[root@www.zhangfangzhou.cn nginx-1.11.10]# sleep 1
[root@www.zhangfangzhou.cn nginx-1.11.10]# test -f /usr/local/nginx/logs/nginx.pid.oldbin
[root@www.zhangfangzhou.cn nginx-1.11.10]# kill -QUIT `cat /var/run/nginx.pid.oldbin`

平缓升级Nginx服务:使用新版本的Nginx文件启动服务,之后平缓停止原有的Nginx进程
# kill -USR2 `cat /nginx/logs/nginx.pid`

平缓停止Nginx服务:平缓停止是指允许Nginx服务将当前正在处理的网络请求处理完成,但不再接受新的请求,之后关闭连接,停止工作
# kill -QUIT `cat /nginx/logs/nginx.pid`

平缓重启Nginx服务:Nginx服务进程接受到信号后,首先读取新的Nginx配置文件,如果配置语法正确,则启动新的Nginx服务,然后平缓关闭旧的服务进程,如果新的Nginx配置文件有问题,将显示错误,仍然使用旧的Nginx进程提供服务
# kill -HUP `cat /nginx/logs/nginx.pid`

Linux CentOS 7 多网卡配置bond模式 bond1 bond5 bond6

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Network_Bonding_Using_the_Command_Line_Interface.html

Linux CentOS 7 多网卡配置bond模式 bond1 bond5 bond6

网卡绑定mode共有七种(0~6) bond0、bond1、bond2、bond3、bond4、bond5、bond6
常用的有四种
mode=0:(balance-rr) Round-robin policy(平衡抡循环策略)平衡负载模式,有自动备援,但需要”Switch”支援及设定。
mode=1,(active-backup) Active-backup policy(主-备份策略)只有一个设备处于活动状态,当一个宕掉另一个马上由备份转换为主设备。mac地址是外部可见得,从外面看来,bond的MAC地址是唯一的。
mode=5,(balance-tlb) Adaptive transmit load balancing(适配器传输负载均衡)不需要任何特别的switch(交换机)支持的通道bonding。
mode=6,(balance-alb) Adaptive load balancing(适配器适应性负载均衡)该模式包含了balance-tlb模式,同时加上针对IPV4流量的接收负载均衡(receive load balance, rlb),而且不需要任何switch(交换机)的支持。接收负载均衡是通过ARP协商实现的

mode=1,(active-backup) Active-backup policy(主-备份策略)

在Centos 7中,我们可以使用modinfo bonding 命令查看bonding模块的信息,默认情况下bonding模块没有被加载

以root用户登录,输入如下的命令进行开启加载bonding模块
modprobe --first-time bonding //--first-time Fail if module already inserted or removed

cat /etc/sysconfig/network-scripts/ifcfg-bond1
DEVICE=bond1
BONDING_OPTS="resend_igmp=1 updelay=0 use_carrier=1 miimon=100 downdelay=0 xmit_hash_policy=0 primary_reselect=0 fail_over_mac=0 arp_validate=0 mode=active-backup primary=eno16777736 arp_interval=0 ad_select=0"
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=none
IPADDR=192.168.199.235
PREFIX=24
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME="Bond connection 1"
UUID=e110d205-848e-4527-8cb1-2b3ac76cfb9b
ONBOOT=yes

cat /etc/sysconfig/network-scripts/ifcfg-eno33554960
HWADDR=00:0C:29:1B:57:14
TYPE=Ethernet
BOOTPROTO=none 修改
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno33554960
UUID=ef35e777-0bc3-4afa-ad54-490e1543242a
ONBOOT=yes 修改

[root@www.zhangfangzhou.cn ~]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eno16777736 (primary_reselect always)
Currently Active Slave: eno16777736
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eno16777736
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:1b:57:0a
Slave queue ID: 0

Slave Interface: eno33554960
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:1b:57:14
Slave queue ID: 0

Slave Interface: eno50332184
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:1b:57:1e
Slave queue ID: 0

Slave Interface: eno67109408
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:1b:57:28
Slave queue ID: 0
------------------------------------------------------------------------------------------------------------------------
CentOS7手动配置bond6(balance-alb) Adaptive load balancing(适配器适应性负载均衡)

1、在Centos 7中,我们可以使用modinfo bonding 命令查看bonding模块的信息,默认情况下bonding模块没有被加载

以root用户登录,输入如下的命令进行开启加载bonding模块
modprobe --first-time bonding //--first-time Fail if module already inserted or removed

2、创建bond0配置文件,创建/etc/sysconfig/network-scripts/ifcfg-bond0文件,加入如下内容
cat /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME="bond0"
IPADDR=192.168.199.223
PREFIX=24
ONBOOT=yes
BONDING_OPTS="resend_igmp=1 updelay=0 use_carrier=1 miimon=100 downdelay=0 xmit_hash_policy=0 primary_reselect=0 fail_over_mac=0 arp_validate=0 mode=balance-alb arp_interval=0 ad_select=0"
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

其中BONDING_OPTS指定bonding的模式,其中10.101.230.30/27将作为bond0的ip地址

3、配置e网卡配置文件,文件位于/etc/sysconfig/network-scripts/目录

vi ifcfg-eno16777736

TYPE=Ethernet
BOOTPROTO=none 修改
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno1
UUID=26ea0bd1-0837-4b1a-9039-f147abd19632
DEVICE=eno16777736
ONBOOT=yes 修改
#以下两项为新增配置选项
MASTER=bond0
SLAVE=yes

systemctl restart network.service //重启网络服务

[root@www.zhangfangzhou.cn~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: eno33554960
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eno16777736
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:0c:29:1b:57:0a
Slave queue ID: 0

Slave Interface: eno33554960
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:1b:57:14
Slave queue ID: 0

Slave Interface: eno50332184
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:1b:57:1e
Slave queue ID: 0

Slave Interface: eno67109408
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:1b:57:28
Slave queue ID: 0

------------------------------------------------------------
nutui配置bond6 (balance-alb) Adaptive load balancing(适配器适应性负载均衡)
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Configure_Bonding_Using_the_Text_User_Interface_nmtui.html

[root@www.zhangfangzhou.cn network-scripts]# cat ifcfg-Bond_connection_1
DEVICE=bond0
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME="Bond connection 1"
UUID=5aa07976-3cc3-4db2-b9a8-af598906d263
ONBOOT=yes
BONDING_OPTS="resend_igmp=1 updelay=0 use_carrier=1 miimon=100 downdelay=0 xmit_hash_policy=0 primary_reselect=0 fail_over_mac=0 arp_validate=0 mode=balance-alb arp_interval=0 ad_select=0"
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

[root@www.zhangfangzhou.cn network-scripts]# cat ifcfg-eno16777736
HWADDR=00:0C:29:00:50:D4
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=600f243a-ef20-4b91-8e5c-02a21b49cfb3
ONBOOT=no

[root@www.zhangfangzhou.cn network-scripts]# cat ifcfg-Ethernet_connection_1
TYPE=Ethernet
NAME="Ethernet connection 1"
UUID=a7f3051a-0aac-45fd-a019-75b9db495736
DEVICE=eno16777736
ONBOOT=yes
MASTER=5aa07976-3cc3-4db2-b9a8-af598906d263
SLAVE=yes

------------------------------------------------------------------------------------------------------------------------
配置mode=5,(balance-tlb) Adaptive transmit load balancing(适配器传输负载均衡)
cat /etc/sysconfig/network-scripts/ifcfg-bond5

bond5
DEVICE=bond5
TYPE=Bond
NAME=bond5
BONDING_MASTER=yes
BOOTPROTO=none
ONBOOT=yes
IPADDR=10.216.13.3
NETMASK=255.255.255.0
BONDING_OPTS="resend_igmp=1 updelay=0 use_carrier=1 miimon=100 downdelay=0 xmit_hash_policy=0 primary_reselect=0 fail_over_mac=0 arp_validate=0 mode=balance-tlb arp_interval=0 ad_select=0"

Linux CentOS6 挂载使用 Windows Server 2012 R2 的 WebDAV

Linux CentOS6 挂载使用 Windows Server 2012 R2 的 WebDAV
CentOS6 挂载使用 Windows Server 2012 R2 的 WebDAV
Windows Server 2012 R2 安装 WebDAV
http://www.ibm.com/support/knowledgecenter/SSEP7J_10.2.1/com.ibm.swg.ba.cognos.c8pp_inst.10.2.1.doc/t_enablewebdavoniis.html
https://www.iis.net/configreference/system.webserver/webdav
https://www.iis.net/learn/install/installing-publishing-technologies/installing-and-configuring-webdav-on-iis


yum -y install gcc gcc-c++ wget openssl-devel
wget -c http://www.webdav.org/neon/neon-0.30.2.tar.gz #neon is an HTTP and WebDAV client library, with a C interface. Features:
tar zxf neon-0.30.2.tar.gz
cd neon-0.30.2
./configure --with-ssl
make && make install
wget -c http://download.savannah.gnu.org/releases/davfs2/davfs2-1.5.0.tar.gz
#http://download-mirror.savannah.gnu.org/releases/davfs2/davfs2-1.5.4.tar.gz 更高的版本需要gcc4.9
tar zxf davfs2-1.5.0.tar.gz
cd davfs2-1.5.0
./configure
make && make install
useradd davfs2

yum -y install davfs2
mkdir /root/www.zhangfangzhou.cn
mount.davfs 122.114.250.255 /root/www.zhangfangzhou.cn

可以调整一下参数做系统自动挂载,免去每次手动操作。
第一步:使用sed命令修改系统设置
sed -i 's/# use_locks 1/use_locks 0/g' /etc/davfs2/davfs2.conf

第二步:将WebDAV发布地址以及账号密码写入配置文件
echo "122.114.250.255 账户 密码" > /etc/davfs2/secrets

第三步:加入系统自动启动
echo "mount.davfs 122.114.250.255 /root/www.zhangfangzhou.cn" >> /etc/rc.local
最后reboot系统测试一下吧。