分类 服务器 下的文章

一、检查是否已安装

# svnserve --version

如果出现下列提示,则代表没有安装

-bash: svnserve: command not found

如果出现下列提示,则代表已经安装了,直接跳到四步

svnserve, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28

Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

二、安装

# yum install -y subversion

三、再次检查是否已安装

# svnserve --version

四、创建并进入到储存版本库的目录

# mkdir /data/svn-repository
# cd /data/svn-repository

五、创建一个版本库(项目)
test为版本库的名称

# svnadmin create test

六、显示版本库目录的文件列表

# ls test
名称类型说明
conf目录配置文件目录
conf/authz文件负责账号权限的管理,控制账号是否读写权限
conf/passwd文件负责账号和密码的用户名单管理
conf/svnserve.conf文件版本库配置文件
db目录版本数据存储目录
hooks目录版本库钩子脚本文件目录
locks目录db锁文件和db_logs锁文件的目录,用来追踪存取文件库的客户端
format文件存储一个整数的文件,此整数代表库层次结构版本
README.txt文件说明文件

七、设置全局配置
默认情况下,都是使用版本库目录下conf目录的配置,一两个项目还没问他,但是项目一多,管理就很麻烦了。
先把配置目录复制出来,作为全局配置

# cp -R test/conf conf

八、新增该版本库的用户
打开passwd文件

# vi conf/passwd

在文件末新增一行,输入用户名jwj和密码123456

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
jwj = qq2254

九、设置版本库用户的权限
打开authz文件

# vi conf/authz

jwj用户赋予test版本库根目录的读写权限

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[test:/]
jwj = rw

当然,还有更多权限的写法,下面列出部分,想详细了解的话,请查阅其他资料

十、设置svn服务开机自启

#vi /etc/init.d/svn

然后输入以下内容

#!/bin/sh
# chkconfig: 2345 85 85
# processname: svn

svn_bin=/bin
svn_port=3690
svn_home=/mnt/svn-repository
svn_config=/mnt/svn-repository/conf/svnserve.conf

if [ ! -f "$svn_bin/svnserve" ]
then
    echo "svnserver startup: cannot start"
exit
fi

case "$1" in
    start)
        echo "Starting svnserve..."
        $svn_bin/svnserve -d -r $svn_home --config-file $svn_config --listen-port $svn_port
        echo "Successfully!"
    ;;
    stop)
        echo "Stoping svnserve..."
        killall svnserve
        echo "Successfully!"
    ;;
    restart)
        $0 stop
        $0 start
    ;;
    *)
        echo "Usage: svn { start | stop | restart } "
        exit 1
    ;;
esac

给文件添加可执行权限

# chmod +x /etc/init.d/svn

开启开机自启动

# chkconfig svn on

十一、启动svn

# service svn start

最近,发现网站的数据库连接不上,而且持续有一段时间了。主要还是平时太少管理网站,所以隔了几天才发现。
重启后,数据库恢复正常,但一分钟不到,内存不足,又挂了。
经过排查,原来是没使用swap虚拟内存。开启后,妥妥的稳定运行。

关闭配置文件/etc/fstab中所有的交换空间

sudo swapoff -a

一、创建交换分区的文件:增加2G大小的交换分区

sudo dd if=/dev/zero of=/var/swapfile bs=1M count=2048
  • if 代表输入文件。如果不指定if,默认就会从stdin中读取输入。
  • of 代表输出文件。如果不指定of,默认就会将stdout作为默认输出。
  • bs 代表字节为单位的块大小。
  • count 代表被复制的块数。
  • /dev/zero 是一个字符设备,会不断返回0值字节(\0)。

块大小可以使用的计量单位表

单位大小代码
字节1Bc
字节2Bw
512Bb
千字节1024Bk
兆字节1024KBM
吉字节1024MBG

二、设置交换分区文件

sudo mkswap /var/swapfile

三、启用交换分区

sudo swapon /var/swapfile

四、写入/etc/fstab,以便在引导时启用

echo '/var/swapfile swap swap defaults 0 0'>>sudo /etc/fstab

五、查看swap的情况

free -m

最近做一个项目,需要用到Gmail邮箱发送邮件,但发现发送不出去。
排查问题时,需要用到dig命令,但使用时,却提醒我dig命令不存在~
那就安装吧,习惯性的运行yum install dig,却提示我没这个包?
微信截图_20181017092818.png

经过查找资料,原来dig命令属于bind-utils工具包,安装这个包之后就可以使用dig命令了。

yum install bind-utils

作为一个习惯追新的人,最近把nginx升级到了1.15.2,修改站点配置并重新加载配置文件时,发现报警告。
虽然不影响正常,也不是处女座,但还是看不顺眼,经过一番百度 Google,终于找到原因和解决方法!

报错内容

nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /usr/local/nginx/conf/vhost/test.ll00.cn:24

原因

新版本不推荐使用ssl指令,所以会发出一段警告。使用listen 443 ssl;代替

解决方法

在配置文件里,找到ssl on;,将其注释掉

# ssl on;

然后修改监听端口处的配置后面加上ssl

listen 443 ssl;

相关Nginx更新日志:

Changes with nginx 1.15.0                                        05 Jun 2018

    *) Change: the "ssl" directive is deprecated; the "ssl" parameter of the
       "listen" directive should be used instead.

    *) Change: now nginx detects missing SSL certificates during
       configuration testing when using the "ssl" parameter of the "listen"
       directive.

    *) Feature: now the stream module can handle multiple incoming UDP
       datagrams from a client within a single session.

    *) Bugfix: it was possible to specify an incorrect response code in the
       "proxy_cache_valid" directive.

    *) Bugfix: nginx could not be built by gcc 8.1.

    *) Bugfix: logging to syslog stopped on local IP address changes.

    *) Bugfix: nginx could not be built by clang with CUDA SDK installed;
       the bug had appeared in 1.13.8.

    *) Bugfix: "getsockopt(TCP_FASTOPEN) ... failed" messages might appear
       in logs during binary upgrade when using unix domain listen sockets
       on FreeBSD.

    *) Bugfix: nginx could not be built on Fedora 28 Linux.

    *) Bugfix: request processing rate might exceed configured rate when
       using the "limit_req" directive.

    *) Bugfix: in handling of client addresses when using unix domain listen
       sockets to work with datagrams on Linux.

    *) Bugfix: in memory allocation error handling.