作者: admin

  • 如何关闭WPS热点弹出框

    WPS在使用过程中,也弹出了类似新闻弹出框的WPS热点,真正关闭的选项却在WPS热点界面中,我们在点击右上角的小齿轮图标,然后并可以看到关闭选项,我们根据需要进行选择便可以。

  • Firebird安装问题

    rpm -ivh FirebirdSS-2.1.6.18547-0.amd64.rpm
    error: Failed dependencies:
    libncurses.so.5 is needed by FirebirdSS-2.1.6.18547-0.amd64
    libstdc++.so.5 is needed by FirebirdSS-2.1.6.18547-0.amd64

    yum install ncurses-libs.i686 ncurses-devel.i686
    解决 libncurses.so.5 is needed by FirebirdSS-2.1.6.18547-0.amd64

    yum install compat-libstdc++-33.x86_64 compat-libstdc++-33.i686 compat-libstdc++-296.i686  libstdc++-devel.i686 libstdc++-devel.x86_64
    解决 libstdc++.so.5 is needed by FirebirdSS-2.1.6.18547-0.amd64

    思路:
    首先找台没问题的服务器
    find / -name libncurses.so.5
    find / -name libstdc++.so.5

    /lib/libncurses.so.5
    /lib64/libncurses.so.5

    /usr/lib/libstdc++.so.5
    /usr/lib64/libstdc++.so.5

    rpm -qf /lib/libncurses.so.5
    ncurses-libs-5.7-3.20090208.el6.i686
    rpm -qf /lib64/libncurses.so.5
    ncurses-libs-5.7-3.20090208.el6.x86_64

    然后 yum 相对应的rpm包,即可解决类似问题。

    yum install postgresql-python postgresql-libs compat-postgresql-libs postgresql-server postgresql postgresql-devel

    yum install ncurses-libs.i686 ncurses-devel.i686 compat-libstdc++-33.x86_64 compat-libstdc++-33.i686 compat-libstdc++-296.i686 libstdc++.i686 libstdc++-devel.i686

    安装firebird 解决 libgds.so 不能加载的问题
    yum install ncurses-libs.i686 ncurses-devel.i686

    yum install compat-libstdc++-33.x86_64 compat-libstdc++-33.i686 compat-libstdc++-296.i686 libstdc++-devel.i686 libstdc++-devel.x86_64
    yum install firebird

    Centos7

    rpm -ivh FirebirdCS-2.5.5.26952-0.amd64.rpm
    Preparing… ################################# [100%]
    file / from install of FirebirdCS-2.5.5.26952-0.amd64 conflicts with file from package filesystem-3.2-25.el7.x86_64
    file /usr/lib64 from install of FirebirdCS-2.5.5.26952-0.amd64 conflicts with file from package filesystem-3.2-25.el7.x86_64

    解决办法

    Firebird-3.0.4.33054-0.amd64.tar.gz

    源码方式安装

    ./install.sh

    yum 提示缺少组件,按照提示完成安装

    changeServerMode.sh 选择服务器模式

    Which option would you like to choose: (super|classic) [super] 默认super

    Firebird启动,完成安装

  • httpd dead but pid file exists

    httpd dead but pid file existsApache起不来,报No space left on device: Couldn’t create accept lock
    service httpd restart
    提示正常
    service httpd status
    提示:httpd dead but pid file exists
    检查80端口是否被占用
    netstat -tulpn | grep :80
    没有记录
    继续
    rm /var/lock/subsys/httpd
    rm /var/run/httpd/httpd.pid
    service httpd restart
    还是提示:httpd dead but pid file exists
    检查 /var/log/httpd/error_log
    发现 [emerg] (28)No space left on device: Couldn’t create accept lock (/etc/httpd/logs/accept.lock.13255) (5)
    以为是空间不足,造成无法创建锁文件,但是df -h察看,发觉不是这个问题。
    google 一下
    ipcs -s
    —— Semaphore Arrays ——–
    key        semid      owner      perms      nsems
    0x000000a7 0          root      600        1
    0x00000000 32769      apache    600        1
    0x00000000 65538      apache    600        1
    0x00000000 884739     apache    600        1
    0x00000000 917508     apache    600        1

    一大堆的ipc使用,需要干掉。
    清除命令
    for semid in `ipcs -s | grep apache | cut -f2 -d” “`;
    do ipcrm -s $semid; done
    service httpd restart
    service httpd status
    提示正常

    查看the number of semaphores that are available on the system

    admin@intlqa142012x:[/home/admin]ipcs -l

    —— Shared Memory Limits ——–
    max number of segments = 4096
    max seg size (kbytes) = 32768
    max total shared memory (kbytes) = 8388608
    min seg size (bytes) = 1

    —— Semaphore Limits ——–
    max number of arrays = 128
    max semaphores per array = 250
    max semaphores system wide = 32000
    max ops per semop call = 32
    semaphore max value = 32767

    —— Messages: Limits ——–
    max queues system wide = 16
    max size of message (bytes) = 8192
    default max size of queue (bytes) = 16384

    如果有权限的话,可以修改这些限制:
    To change these parameters, modify the file /etc/sysctl.conf and add the following lines:

    kernel.msgmni = 1024
    kernel.sem = 250 256000 32 1024

    Then load these settings with the command:sysctl -p
    -p Load in sysctl settings from the file specified or /etc/sysctl.conf if none given.

    admin@intlqa142012x:[/home/admin]sysctl -p
    error: permission denied on key ‘net.ipv4.ip_forward’
    error: permission denied on key ‘net.ipv4.conf.default.rp_filter’
    error: permission denied on key ‘net.ipv4.conf.default.accept_source_route’
    error: permission denied on key ‘kernel.sysrq’
    error: permission denied on key ‘kernel.core_uses_pid’

    Your Apache process should now be able to create the needed semaphores and run properly.

    说明:kernel.msgmni
    该文件指定消息队列标识的最大数目,即系统范围内最大多少个消息队列。缺省设置:16。

    admin@intlqa142012x:[/home/admin]cat /proc/sys/kernel/msgmni
    16

    在root下可用sysctl kernel.msgmni检查该参数:

    admin@intlqa142012x:[/home/admin]sysctl kernel.msgmni
    kernel.msgmni = 16

    也可以在命令行下,使用sysctl -w kernel.msgmni=XXX重新设定。

    admin@intlqa142012x:[/home/admin]sysctl -w kernel.msgmni=32
    error: permission denied on key ‘kernel.msgmni’

     

     

    ipcs 命令

    ipcs – 分析消息队列、共享内存和信号量
    ipcs – report status of interprocess communication facilities

    ipcs displays certain information about active interprocess communication facilities. With no options, ipcs displays information in short format for the message queues, shared memory segments, and semaphores that are currently active in the system.

    引用

    它的语法:

    ipcs [-mqs] [-abcopt] [-C core] [-N namelist]
    -m 输出有关共享内存(shared memory)的信息
    -q 输出有关信息队列(message queue)的信息
    -s 输出信号量(semaphore)的信息
    # ipcs -m
    IPC status from as of 2007年04月10日 星期二 18时32分18秒 CST
    T ID KEY MODE OWNER GROUP
    Shared Memory:
    m 0 0x50000d43 –rw-r–r– root root
    m 501 0x1e90c97c –rw-r—– oracle dba

    ipcrm – 删除ipc(清除共享内存信息)

    引用
    它的语法:
    ipcrm -m|-q|-s shm_id
    -m 输出有关共享内存(shared memory)的信息
    -q 输出有关信息队列(message queue)的信息
    -s 输出信号量(semaphore)的信息
    shm_id 共享内存id
    #ipcrm -m 501


    ipcs用于显示消息队列、共享内存、信号灯信息的
    q 显示消息队列
    s 显示信号灯
    m 显示共享内存
    a 详细信息

    其打印出当前你的系统中处于活动状态的共享内存的信息。

    对每一个资源,这个命令会显示:

    TYPE        包括信息队列(q),共享内存段(m),或者信号灯(s)。

    ID         资源条目的唯一的表示号

    KEY        应用程序存取资源使用的参数。

    MODE        存取模式和许可权限的标记

    OWNER and GROUP   登录名和用户属主的组号,OnLine使用的所有的共享内存资源的属主的属主          为root和informix组。

    OnLine共享内存使用的基本键值为0x52564801。SERVERNUM的值乘上0X10000并且加上这个值就为共享内存的键值。这就 是,如果你的SERVERNUM的值为2,你的共享内存段的键值为0x52564801+(2*0x10000)=0x52584801。如果 SERVERNUM的值为6,产生的键值就为0x525c4801。
    清除命令:
    ipcs -s | grep nobody | perl -e ‘while (<STDIN>) { @a=split(/”s+/); print `ipcrm sem $a[1]`}’
    然后启动Apache即可更深入的了解:

     

    Fixing Apache “No space left on device: Couldn’t create accept lock” errors

    Error Message: When starting Apache, I get this error message in the main Apache error_log:

    [emerg] (28)No space left on device: Couldn’t create accept lock
    [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [notice] Digest: generating secret for digest authentication …
    [notice] Digest: done
    [warn] pid file /etc/httpd/run/httpd.pid overwritten — Unclean shutdown of previous Apache run?
    [emerg] (28)No space left on device: Couldn’t create accept lock

    First off, check to make sure that you really aren’t out of disk space, or have hit a quota limit. Another way that Apache can create the “accept lock” is with a semaphore. A semaphore is an inter-process communication tool that is used by Apache to communicate with it’s child processes. This error message may mean that Apache couldn’t create a new semaphore.

    Check to see how many semaphores are currently in use. If Apache is running correctly, you should see something like this:

    # ipcs -s
    —— Semaphore Arrays ——–
    key semid owner perms nsems
    0x00000000 68681743 apache 600 1
    0x00000000 68714515 apache 600 1
    0x00000000 68747291 apache 600 1

    If Apache is stopped, and you still see these semaphores, then you can safely kill them by running this command for each semaphore id (in the second column)

    $ ipcrm -s <semid>

    To destroy all semaphores, you can run this from the command line (with “apache” being the apache-user):

    for semid in `ipcs -s | grep nobody | cut -f2 -d” “`;

    do ipcrm -s $semid; done

    If you are out of semaphores

    If you can’t create any more semaphores:

    Sometimes your system may need to increase the number of semaphores that are available on the system. This requires a change to a kernel parameter. If you are running on a virtual server and cannot modify kernel parameters, you may need to ask your hosting provider to change this parameter on their host server To view the current parameters:

    # ipcs -l
    —— Shared Memory Limits ——–
    max number of segments = 4096
    max seg size (kbytes) = 32768
    max total shared memory (kbytes) = 8388608
    min seg size (bytes) = 1

    —— Semaphore Limits ——–
    max number of arrays = 1024
    max semaphores per array = 250
    max semaphores system wide = 256000
    max ops per semop call = 32
    semaphore max value = 32767

    —— Messages: Limits ——–
    max queues system wide = 1024
    max size of message (bytes) = 8192
    default max size of queue (bytes) = 16384

    To change these parameters, modify the file /etc/sysctl.conf and add the following lines:

    kernel.msgmni = 1024
    kernel.sem = 250 256000 32 1024

    Then load these settings with the command:

    sysctl -p

    Your Apache process should now be able to create the needed semaphores and run properly

    这里介绍下kernel.msgmni

    /proc/sys/kernel/msgmni

    该文件指定消息队列标识的最大数目,即系统范围内最大多少个消息队列。
    缺省设置:16

    在 root 下用 sysctl kernel.msgmni 检查该参数, 也可以在命令行下

    sysctl -w kernel.msgmni=XXX 重新设定。

    man ipcs:

    ipcs(1)                                                              ipcs(1)

    NAME
    ipcs – report status of interprocess communication facilities

    SYNOPSIS
    ipcs [-mqs] [-abcopt] [-C core] [-N namelist]

    DESCRIPTION
    ipcs displays certain information about active interprocess
    communication facilities.   With no options, ipcs displays information
    in short format for the message queues, shared memory segments, and
    semaphores that are currently active in the system.

         Options
    The following options restrict the display to the corresponding
    facilities.

                (none)          This is equivalent to -mqs.

                -m              Display information about active shared memory
    segments.
    -q              Display information about active message queues.

                -s              Display information about active semaphores.

           The following options add columns of data to the display.   See “Column
    Description” below.

                (none)          Display default columns: for all facilities: T,
    ID, KEY, MODE, OWNER, GROUP.

                -a              Display all columns, as appropriate.   This is
    equivalent to -bcopt.

                -b              Display largest-allowable-size information: for
    message queues: QBYTES; for shared memory
    segments: SEGSZ; for semaphores: NSEMS.

                -c              Display creator’s login name and group name: for
    all facilities: CREATOR, CGROUP.

                -o              Display information on outstanding usage: for
    message queues: CBYTES, QNUM; for shared memory
    segments: NATTCH.

                -p              Display process number information: for message
    queues: LSPID, LRPID; for shared memory segments:
    CPID, LPID.

                -t              Display time information: for all facilities:
    CTIME; for message queues: STIME, RTIME; for

    Hewlett-Packard Company             – 1 –    HP-UX Release 11i: November 2000

    ipcs(1)                                                              ipcs(1)

                               shared memory segments: ATIME, DTIME; for
    semaphores: OTIME.

           The following options redefine the sources of information.

                -C core         Use core in place of /dev/kmem.   core can be a
    core file or a directory created by savecrash or
    savecore.

                -N namelist     Use file namelist or the namelist within core in
    place of /stand/vmunix.   It opens a crash dump for
    reading. Please refer to cr_open(3) for more
    details.

         Column Descriptions
    The column headings and the meaning of the columns in an ipcs listing
    are given below.   The columns are printed from left to right in the
    order shown below.

                T          Facility type:

                               m     Shared memory segment
    q     Message queue
    s     Semaphore

                ID         The identifier for the facility entry.

                KEY        The key used as an argument to msgget(), semget(), or
    shmget() to create the facility entry.   (Note: The key
    of a shared memory segment is changed to IPC_PRIVATE
    when the segment has been removed until all processes
    attached to the segment detach it.)
    MODE       The facility access modes and flags: The mode consists
    of 11 characters that are interpreted as follows:

                          The first two characters can be:

                               R     A process is waiting on a msgrcv().
    S     A process is waiting on a msgsnd().
    D     The associated shared memory segment has been
    removed.   It will disappear when the last
    process attached to the segment detaches it.
    C     The associated shared memory segment is to be
    cleared when the first attach is executed.
    –     The corresponding special flag is not set.

                          The next 9 characters are interpreted as three sets of
    three characters each.   The first set refers to the
    owner’s permissions, the next to permissions of others
    in the group of the facility entry, and the last to all

    Hewlett-Packard Company             – 2 –    HP-UX Release 11i: November 2000
    ipcs(1)                                                              ipcs(1)

                          others.

                          Within each set, the first character indicates
    permission to read, the second character indicates
    permission to write or alter the facility entry, and
    the last character is currently unused.

                               r     Read permission is granted.
    w     Write permission is granted.
    a     Alter permission is granted.
    –     The indicated permission is not granted.

                OWNER      The login name of the owner of the facility entry.

                GROUP      The group name of the group of the owner of the
    facility entry.

                CREATOR    The login name of the creator of the facility entry.

                CGROUP     The group name of the group of the creator of the
    facility entry.

                CBYTES     The number of bytes in messages currently outstanding
    on the associated message queue.

                QNUM       The number of messages currently outstanding on the
    associated message queue.

                QBYTES     The maximum number of bytes allowed in messages
    outstanding on the associated message queue.

                LSPID      The process ID of the last process to send a message to
    the associated message queue.

                LRPID      The process ID of the last process to receive a message
    from the associated message queue.

                STIME      The time the last msgsnd() message was sent to the
    associated message queue.

                RTIME      The time the last msgrcv() message was received from
    the associated message queue.

                CTIME      The time when the associated facility entry was created
    or changed.

                NATTCH     The number of processes attached to the associated
    shared memory segment.

                SEGSZ      The size of the associated shared memory segment.

    Hewlett-Packard Company             – 3 –    HP-UX Release 11i: November 2000

    ipcs(1)                                                              ipcs(1)

                CPID       The process ID of the creating process of the shared
    memory segment.

                LPID       The process ID of the last process to attach or detach
    the shared memory segment.

                ATIME      The time the last shmat() attach was completed to the
    associated shared memory segment.

                DTIME      The time the last shmdt() detach was completed on the
    associated shared memory segment.

                NSEMS      The number of semaphores in the set associated with the
    semaphore entry.

                OTIME      The time the last semop() semaphore operation was
    completed on the set associated with the semaphore
    entry.

    WARNINGS
    ipcs produces only an approximate indication of actual system status
    because system processes are continually changing while ipcs is
    acquiring the requested information.

           Do not rely on the exact field widths and spacing of the output, as
    these will vary depending on the system, the release of HP-UX, and the
    data to be displayed.

    FILES
    /dev/kmem            Kernel virtual memory
    /etc/group           Group names
    /etc/passwd          User names
    /stand/vmunix        System namelist
    SEE ALSO
    msgop(2), semop(2), shmop(2).

    STANDARDS CONFORMANCE
    ipcs: SVID2, SVID3

    Hewlett-Packard Company             – 4 –    HP-UX Release 11i: November 2000

  • vsftpd简单设置

    cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak

    cat /etc/vsftpd/vsftpd.conf
    anonymous_enable=NO
    anon_upload_enable=NO
    no_anon_password=YES
    anon_world_readable_only=NO
    anon_mkdir_write_enable=NO
    anon_other_write_enable=NO
    local_enable=YES
    write_enable=YES
    local_umask=022
    file_open_mode=0755
    chroot_local_user=yes
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    xferlog_std_format=YES
    ftpd_banner=Welcome to blah FTP service.
    pam_service_name=vsftpd
    userlist_enable=YES
    listen=YES
    tcp_wrappers=YES
    max_per_ip=10

    用户设置
    useradd ftpxxx -G ftp -d /var/xxxx -M
    useradd ftpxxx -G ftp,apache -d /var/www/html/XXXX/ -M
    passwd ftpxxx xxxxxx
    chown ftpxxx.ftp /var/xxxx
    chmod 755 /var/xxxx

  • CentOS Linux安装Atomic源

    CentOS Linux安装Atomic源
    Atomic源支持Fedora,RHEL和CentOS
    wget -q -O – http://www.atomicorp.com/installers/atomic | sh

    Atomic Free Unsupported Archive installer, version 2.0.12

    BY INSTALLING THIS SOFTWARE AND BY USING ANY AND ALL SOFTWARE
    PROVIDED BY ATOMICORP LIMITED YOU ACKNOWLEDGE AND AGREE:

    THIS SOFTWARE AND ALL SOFTWARE PROVIDED IN THIS REPOSITORY IS
    PROVIDED BY ATOMICORP LIMITED AS IS, IS UNSUPPORTED AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ATOMICORP LIMITED, THE
    COPYRIGHT OWNER OR ANY CONTRIBUTOR TO ANY AND ALL SOFTWARE PROVIDED
    BY OR PUBLISHED IN THIS REPOSITORY BE LIABLE FOR ANY DIRECT,
    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    OF THE POSSIBILITY OF SUCH DAMAGE.

    ====================================================================
    THIS SOFTWARE IS UNSUPPORTED.  IF YOU REQUIRE SUPPORTED SOFWARE
    PLEASE SEE THE URL BELOW TO PURCHASE A NUCLEUS LICENSE AND DO NOT
    PROCEED WITH INSTALLING THIS PACKAGE.
    ====================================================================

    For supported software packages please purchase a Nucleus license:
    https://www.atomicorp.com/products/nucleus.html
    All atomic repository rpms are UNSUPPORTED.
    Do you agree to these terms? (yes/no) [Default: yes]

    Configuring the [atomic] yum archive for this system

    Installing the Atomic GPG key:
    OK
    Downloading atomic-release-1.0-19.el6.art.noarch.rpm:
    OK

    The Atomic Rocket Turtle archive has now been installed and configured for your system
    The following channels are available:
    atomic          – [ACTIVATED] – contains the stable tree of ART packages
    atomic-testing  – [DISABLED]  – contains the testing tree of ART packages
    atomic-bleeding – [DISABLED]  – contains the development tree of ART packages

  • Linux svn 配置(转)

    http://www.iitshare.com/linux-svn-installation-and-configuration.html

    svn服务器有2种运行方式

    1.独立服务器 (例如:svn://xxx.com/xxx);
    2.借助apache。(例如:http://svn.xxx.com/xxx);
    为了不依赖apache,选择第一种方式-独立的svn服务器。
    svn存储版本数据也有2种方式:
    1.bdb;
    2.fsfs。
    因为BDB方式在服务器中断时,有可能锁住数据(搞ldap时就深受其害,没法根治),所以还是FSFS方式更安全一点,我也选择这种方式。
    我的系统环境:Centos-6.2 + Php-5.4.3 + Nginx-1.3.0 + Mysql-5.5.25 + subversion-1.6.6

    下载相关软件

    wget http://subversion.tigris.org/downloads/subversion-1.6.6.tar.gz
    wget http://subversion.tigris.org/downloads/subversion-deps-1.6.6.tar.gz

    编辑

    1、查看是否安装了svn工具
    命令:rpm -qa | grep subversion
    如果服务器已经安装了则不需要进行安装,如果没有安装可以进行全新的安装
    2、首先检测系统有没有安装SSL:
    find / -name opensslv.h
    如果找不到,就执行如下命令进行安装:
    yum install openssl
    yum install openssl-devel
    安装之后用find / -name opensslv.h命令找到opensslv.h所在的目录,即下列–with-openssl=后面的路径,
    3、解压svn安装文件
    subversion-1.6.6.tar.gz
    subversion-deps-1.6.6.tar.gz
    命令如下:

    12 tar zxvf subversion-1.6.6.tar.gztar zxvf subversion-deps-1.6.6.tar.gz

    tar 为解压命令,zxvf为tar命令的参数,用于解压tar.gz格式压缩的文件。
    解压后生成 subversion-1.6.6 子目录,两个压缩包解压后都会自动放到此目录下,不用手动更改。
    进入解压子目录 cd subversion-1.6.6 进行编译。
    4、编译:

    12 ./configure –prefix=/usr/local/svn –with-openssl=/usr/include/openssl–without-berkeley-db

    后面以svnserve方式运行,所以不加apache编译参数。以fsfs格式存储版本库,不编译berkeley-db
    如果编译时报如下错误:
    no acceptable C compiler found in $PATH
    说明没有gcc库,使用如下命令安装gcc后再编译:
    yum -y install gcc
    如果最后出现下面WARNING,我们直接忽略即可,因为不使用BDB存储。

    123

    4

    5

    6

    7

    8

    configure: WARNING: we have configured without BDB filesystem supportYou don’t seem to have Berkeley DB version 4.0.14 or newerinstalled and linked to APR-UTIL. We have created Makefiles which

    will build without the Berkeley DB back-end; your repositories will

    use FSFS as the default back-end. You can find the latest version of

    Berkeley DB here:

     

    http://www.sleepycat.com/download/index.shtml

    安装

    make
    make install
    如果 make install 出现下面错误:
    /home/upload/subversion-1.6.6/subversion/svnversion/.libs/lt-svnversion: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
    make: *** [revision-install] Error 127
    解决办法:
    1、编辑/etc/ld.so.conf文件
    vi /etc/ld.so.conf
    添加下面一行代码
    /usr/local/lib
    2、保存后运行ldconfig:
    /sbin/ldconfig
    注:ld.so.conf和ldconfig用于维护系统动态链接库。
    3、然后再安装
    make && make install
    测试是否安装成功

    1 /usr/local/svn/bin/svnserve –version

    如果显示如下,svn安装成功:

    123

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    svnserve, version 1.6.6 (r40053)compiled Dec 25 2012, 13:14:38 

    Copyright (C) 2000-2009 CollabNet.

    Subversion is open source software, see http://subversion.tigris.org/

    This product includes software developed by CollabNet

    (http://www.Collab.Net/).

     

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

     

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

     

    Cyrus SASL authentication is available.

    4、为了方便下操作,把svn相关的命令添加到环境变量中:
    echo “export PATH=$PATH:/usr/local/svn/bin/” >> /etc/profile
    source /etc/profile

    配置svn

    1、建立SVN的根目录
    mkdir -p /opt/svn/
    2、建立一个产品仓库
    mkdir -p /opt/svn/tshop/
    svnadmin create /opt/svn/tshop/
    如果你们的研发中心有多个产品组,每个产品组可以建立一个SVN仓库
    3、修改版本配置库文件
    vi /opt/svn/tshop/conf/svnserve.conf
    修改后的文件内容如下:

    123

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    ### This file controls the configuration of the svnserve daemon, if you### use it to allow access to this repository.  (If you only allow### access through http: and/or file: URLs, then this file is

    ### irrelevant.)

     

    ### Visit http://subversion.tigris.org/ for more information.

     

    [general]

    ### These options control access to the repository for unauthenticated

    ### and authenticated users.  Valid values are “write”, “read”,

    ### and “none”.  The sample settings below are the defaults.

    anon-access = none # 注意这里必须设置,否则所有用户不用密码就可以访问

    auth-access = write

    ### The password-db option controls the location of the password

    ### database file.  Unless you specify a path starting with a /,

    ### the file’s location is relative to the directory containing

    ### this configuration file.

    ### If SASL is enabled (see below), this file will NOT be used.

    ### Uncomment the line below to use the default password file.

    password-db = passwd

    ### The authz-db option controls the location of the authorization

    ### rules for path-based access control.  Unless you specify a path

    ### starting with a /, the file’s location is relative to the the

    ### directory containing this file.  If you don’t specify an

    ### authz-db, no path-based access control is done.

    ### Uncomment the line below to use the default authorization file.

    authz-db = authz

    ### This option specifies the authentication realm of the repository.

    ### If two repositories have the same authentication realm, they should

    ### have the same password database, and vice versa.  The default realm

    ### is repository’s uuid.

    realm = tshop

     

    [sasl]

    ### This option specifies whether you want to use the Cyrus SASL

    ### library for authentication. Default is false.

    ### This section will be ignored if svnserve is not built with Cyrus

    ### SASL support; to check, run ‘svnserve –version’ and look for a line

    ### reading ‘Cyrus SASL authentication is available.’

    # use-sasl = true

    ### These options specify the desired strength of the security layer

    ### that you want SASL to provide. 0 means no encryption, 1 means

    ### integrity-checking only, values larger than 1 are correlated

    ### to the effective key length for encryption (e.g. 128 means 128-bit

    ### encryption). The values below are the defaults.

    # min-encryption = 0

    # max-encryption = 256

    对用户配置文件的修改是立即生效的,不必重启svn。
    4、开始设置passwd用户账号信息

    123

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    vi /data/svn/repos/conf/passwd修改完之后的内容如下:### 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.

    ### 在下面添加用户和密码,每行一组username = password

    [users]

    # harry = harryssecret

    # sally = sallyssecret

    ###===========下面是我添加的用户信息========#######

    iitshare = password1

    itblood = password2

    5、开始设置authz. 用户访问权限
    vi /data/svn/repos/conf/authz
    修改完之后的内容如下:

    123

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    48

    49

    50

    ### 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

     

    ###——————–下面我新加的————————###

    ###屏蔽掉上面的[groups] 因为在下面添加了

     

    [groups]

    devteam = iitshare, itblood #devteam 项目组包括两个用户iitshare,itblood

     

    [/]

    iitshare = rw

    itblood =

    [tshop:/tb2c]

    @devteam = rw

    itblood =

     

    [tshop:/tb2b2c]

    @devteam = rw

    itblood = r

    其中,1个用户组可以包含1个或多个用户,用户间以逗号分隔。
    说明:

    123

    4

    5

    6

    7

    8

    9

    10

    11

    12

    devteam = iitshare, itblood #devteam 项目组包括两个用户iitshare,itblood[/]iitshare = rw #iitshare 对根目录有读写权限

    itblood = #itblood 对根目录没有任何权限

    ####如果需要配置tb2c、tb2b2c项目的权限,前提条件是tshop仓库下面需要有这两个项目

    ####如果没有的话,tshop都将不能访问

    [tshop:/tb2c] #对tshop仓库的tb2c项目进行权限控制

    @devteam = rw #控制 devteam 组对tb2c项目有读写权限

    itblood = #限制 itblood 所有权限,其它用户有读写权限

    [tshop:/tb2b2c] #对 tshop: 仓库的 tb2b2c 项目进行权限控制

    @devteam = rw #限制 devteam 组对tb2b2c项目有读写权限

    itblood = r #限制 itblood 只有读权限,其它用户有读写权限

    6、注意:
    * 权限配置文件中出现的用户名必须已在用户配置文件中定义。
    * 对权限配置文件的修改立即生效,不必重启svn。
    用户组格式:

    123

    4

    5

    6

    7

    [groups]= ,其中,1个用户组可以包含1个或多个用户,用户间以逗号分隔。

    版本库目录格式:

    [<版本库>:/项目/目录]

    @<用户组名> = <权限>

    <用户名> = <权限>

    其中,方框号内部分可以有多种写法:
    [/],表示根目录及以下,根目录是svnserve启动时指定的,我们指定为/home/svndata,[/]就是表示对全部版本库设置权限。
    [tshop:/] 表示对版本库tshop设置权限;
    [tshop:/abc] 表示对版本库tshop中的abc项目设置权限;
    [tshop:/abc/aaa] 表示对版本库tshop中的abc项目的aaa目录设置权限;
    权限主体可以是用户组、用户或*,用户组在前面加@,*表示全部用户。
    权限可以是w、r、wr和空,空表示没有任何权限。
    7、建立启动svn的用户
    useradd svn
    根据提示,为用户svn设置密码
    允许用户svn访问版本库:
    chown -R svn:svn /opt/svn
    8、启动svn:
    方式一:svnserve -d -r /opt/svn/ #默认的启动端口号为3690
    方式二:su – svn -c “svnserve -d –listen-port 9999 -r /opt/svn/”
    其中:
    su – svn表示以用户svn的身份启动svn;
    -d表示以daemon方式(后台运行)运行;
    –listen-port 9999表示使用9999端口,可以换成你需要的端口。但注意,使用1024以下的端口需要root权限;
    -r /opt/svn 指定根目录是/opt/svn。
    9、检查是否启动
    netstat -tunlp | grep svn
    如果显示以下信息说明启动成功
    tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 10973/svnserve
    10、将svn加入到开机启动
    编辑rc.local文件:vi /etc/rc.d/rc.local
    加入如下启动命令:
    /usr/local/svn/bin/svnserve -d –listen-port 9999 -r /opt/svn
    11、如果想停止svn,则使用如下命令:
    killall svnserve
    12、如果想将svn作为服务:
    在/etc/rc.d/init.d/目录下新建名为svn的文件
    并设置权限为755:chmod 755 /etc/rc.d/init.d/svn
    编辑svn文件:vi /etc/rc.d/init.d/svn, 在里面添加如下代码:

    123

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    #!/bin/bash# build this file in /etc/rc.d/init.d/svn# chmod 755 /etc/rc.d/init.d/svn

    # centos下可以用如下命令管理svn: service svn start(restart/stop)

    SVN_HOME=/opt/svn

    if [ ! -f “/usr/local/svn/bin/svnserve” ]

    then

    echo “svnserver startup: cannot start”

    exit

    fi

    case “$1” in

    start)

    echo “Starting svnserve…”

    /usr/local/svn/bin/svnserve -d –listen-port 9999 -r $SVN_HOME

    echo “Finished!”

    ;;

    stop)

    echo “Stoping svnserve…”

    killall svnserve

    echo “Finished!”

    ;;

    restart)

    $0 stop

    $0 start

    ;;

    *)

    echo “Usage: svn { start | stop | restart } ”

    exit 1

    esac

    之后便可以以service svn start(restart/stop)方式启动SVN。
    通过web方式访问svn有很多方法,请参阅配置websvn或配置bsSvnBrowser的方法

    客户端访问

    1、下载安装文件
    window 64位的话下载:TortoiseSVN-1.7.6.22632-x64-svn-1.7.4.msi
    window 32位的话下载:TortoiseSVN-1.6.5.16974-win32-svn-1.6.5.msi
    具体的下载文件可以在网上下载下,一找一大堆
    2、通过客户端进行访问
    地址如下:
    svn://{your-server-ip}:9999/tshop/ 或者 svn://{your-server-ip}:3690/tshop/
    注意:
    不要在浏览器中通过http的方式进行访问,如下地址:
    http://{your-server-ip}:9999/tshop/ 或者 http://{your-server-ip}:3690/tshop/
    那样肯定是不行的,因为你没有配置http的服务,上面是安装独立的SVN服务器

     

    问题:svnserve.conf:12: Option expected

    为什么会出现这个错误呢,就是因为subversion读取配置文件svnserve.conf时,无法识别有前置空格的配置文件,anon-access是顶行的,没问题,而auth-access就存在前置空格,会导致这个错误。
    要避免出现这个错误,应该在去掉这些行前的#时,也要顺手去掉前面的空格

    问题:ERR subversion/svnserve/serve.c 167 170001 Authorization failed

    问题解决:
    http://hi.baidu.com/tianfu_xue/blog/item/9dbfd6fa4d416d839f51462b.html

    出现该问题基本都是三个配置文件的问题,下面把这个文件列出来。

    svnserve.conf:
    [general]
    anon-access = read
    auth-access = write
    password-db = passwd
    authz-db = authz

    passwd:
    [users]
    harry = harryssecret

    authz:
    [groups]
    [/]
    harry = rw

    出现authorization failed异常,一般都是authz文件里,用户组或者用户权限没有配置好,只要设置[/]就可以,代表根目录下所有的资源,如果要限定资源,可以加上子目录即可。

  • RHEL/CentOS 6.x 系统服务详解

    PS:RHEL/CentOS 6.x的系统服务比5.x系列的要多了很多新面孔,估计很多童鞋不甚理解,网上这方面资料也很少。理解这个对运维人员是必要的,因为开启不必要的服务越多,系统就相对越不安全。不需开启的服务尽量关闭。本人结合自己的应用经验做一些讲解说明,有不同理解的童鞋欢迎交流。

    1、下面列表是在RHEL/CentOS 6.x最小化桌面环境安装下显示出来的系统服务,其中红色字体标注的是用官方的minimal ISO最小化安装系统后的服务列表。

    服务名称 功能  默认   建议  备注说明
    NetworkManager 用于自动连接网络,常用在Laptop上 开启 关闭 对服务器无用
    abrt-ccpp 开启 自定 对服务器无用
    abrt-oops 开启 自定 对服务器无用
    abrtd 开启 自定 对服务器无用
    acpid 电源的开关等检测管理,常用在Laptop上 开启 自定 对服务器无用
    atd 在指定时间执行命令 开启 关闭 如果用crond,则可关闭它
    auditd 审核守护进程 开启 开启 如果用selinux,需要开启它
    autofs 文件系统自动加载和卸载 开启 自定 只在需要时开启它,可以关闭
    avahi-daemon 本地网络服务查找 开启 关闭 对服务器无用
    bluetooth 蓝牙无线通讯 开启 关闭 对服务器无用
    certmonger 关闭 关闭
    cpuspeed 调节cpu速度用来省电,常用在Laptop上 开启 关闭 对服务器无用
    crond 计划任务管理 开启 开启 常用,开启
    cups 通用unix打印服务 开启 关闭 对服务器无用
    dnsmasq dns cache 关闭 关闭 DNS缓存服务,无用
    firstboot 系统安装后初始设定 关闭 关闭
    haldaemon 硬件信息收集服务 开启 开启
    ip6tables ipv6防火墙 开启 关闭 用到ipv6网络的就用,一般关闭
    iptables ipv4防火墙 开启 开启 ipv4防火墙服务
    irqbalance cpu负载均衡 开启 自定 多核cup需要
    kdump 硬件变动检测 关闭 关闭 服务器无用
    lvm2-monitor lvm监视 开启 自定 如果使用LVM逻辑卷管理就开启
    matahari-broker 关闭 关闭 此服务不清楚,我关闭
    matahari-host 关闭 关闭 此服务不清楚,我关闭
    matahari-network 关闭 关闭 此服务不清楚,我关闭
    matahari-service 关闭 关闭 此服务不清楚,我关闭
    matahari-sysconfig 关闭 关闭 此服务不清楚,我关闭
    mdmonitor 软raid监视 开启 自定
    messagebus 负责在各个系统进程之间传递消息 开启 开启 如停用,haldaemon启动会失败
    netconsole 关闭 关闭
    netfs 系统启动时自动挂载网络文件系统 开启 关闭 如果使用nfs服务,就开启
    network 系统启动时激活所有网络接口 开启 开启 网络基础服务,必需!
    nfs 网络文件系统 关闭 关闭 nfs文件服务,用到就开启
    nfslock nfs相关 开启 关闭 nfs相关服务,用到就开启
    ntpd 自动对时工具 关闭 自定 网络对时服务,用到就开启
    ntpdate 自动对时工具 关闭 关闭
    oddjobd 与D-BUS相关 关闭 关闭
    portreserve RPC 服务相关 开启 自定 可以关闭
    postfix 替代sendmail的邮件服务器 开启 自定 如果无邮件服务,可关闭
    psacct 负荷检测 关闭 关闭 可以关闭
    qpidd 消息通信 开启 开启
    quota_nld 关闭 关闭 可以关闭
    rdisc 自动检测路由器 关闭 关闭
    restorecond selinux相关 关闭 关闭 如果开启了selinux,就需开启
    rpcbind 开启 开启 关键的基础服务,nfs服务和桌面环境都依赖此服务!相当于CentOS 5.x里面的portmap服务。
    rpcgssd NFS相关 开启 关闭 NFS相关服务,可选
    rpcidmapd RPC name to UID/GID mapper 开启 关闭 NFS相关服务,可选
    rpcsvcgssd NFS相关 关闭 关闭 NFS相关服务,可选
    rsyslog 提供系统的登录档案记录 开启 开启 系统日志关键服务,必需!
    saslauthd sasl认证服务相关 关闭 关闭
    smartd 硬盘自动检测守护进程 关闭 关闭
    spice-vdagentd 开启 开启
    sshd ssh服务端,可提供安全的shell登录 开启 开启 SSH远程登录服务,必需!
    sssd 关闭 关闭
    sysstat 开启 开启 一组系统监控工具的服务,常用
    udev-post 设备管理系统 开启 开启
    wdaemon 关闭 关闭
    wpa_supplicant 无线认证相关 关闭 关闭
    ypbind network information service客户端 关闭

    2、系统服务管理工具:

    chkconfig(所有linux发行版都有),用法很简单,如下:

    usage: chkconfig –list [name]
    chkconfig –add
    chkconfig –del
    chkconfig [–level ] <on|off|reset|resetpriorities>
    ntsysv(Redhat系发行版特有),直接运行选择服务是否自启动。

    3、查看系统服务的相关说明:
    在RHEL/CentOS下这些系统服务都是Shell脚本,我们可以使用rpm的命令参数来查看相应服务的说明。如想查看mysqld服务的说明:

    # rpm -qi $(rpm -qf /etc/init.d/mysqld)
    如图所示:
    mysqld

    [root@CentOS6-x64 ~]# rpm -qi $(rpm -qf /etc/init.d/mysqld )
    Name : mysql-server Relocations: (not relocatable)
    Version : 5.5.25 Vendor: Remi Collet
    Release : 1.el6.remi Build Date: 2012年06月01日 星期五 23时56分58

    Install Date: 2012年06月11日 星期一 04时43分06秒 Build Host: dixsept.famillecollet.
    com
    Group : Applications/Databases Source RPM: mysql-5.5.25-1.el6.remi.src.rpm
    Size : 46861045 License: GPLv2 with exceptions
    Signature : DSA/SHA1, 2012年06月01日 星期五 23时58分04秒, Key ID 004e6f4700f97f56
    Packager : http://blog.famillecollet.com/
    URL : http://www.mysql.com
    Summary : The MySQL server and related files
    Description :
    MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
    client/server implementation consisting of a server daemon (mysqld)
    and many different client programs and libraries. This package contains
    the MySQL server and some accompanying files and directories.

  • Ubuntu Update 404 Not Found

    提示
    W: 无法下载 http://mirrors.aliyun.com/ubuntu/dists/raring-backports/restricted/b inary-i386/Packages 404 Not Found [IP: 112.124.140.210 80]

    Ubuntu 11.04 (Natty) 已经停止支持,但可以使用old-releases源了,先备份源列表文件:
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

    sudo gedit /etc/apt/sources.list
    把里面的内容替换为以下内容:
    deb http://old-releases.ubuntu.com/ubuntu/ natty main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ natty-security main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ natty-updates main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ natty-proposed main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ natty-backports main restricted universe multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ natty main restricted universe multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ natty-security main restricted universe multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ natty-updates main restricted universe multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ natty-proposed main restricted universe multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ natty-backports main restricted universe multiverse

    重载源列表,使配置生效:
    sudo apt-get update

  • Apache2.4虚拟主机设置

    //配置虚拟机主机

    cd/etc/httpd/
    mkdir vhost-conf.d
    添加 配置进 httpd.conf
    echo “Include vhost-conf.d/*.conf” >> conf/httpd.conf

    vi/etc/httpd/vhost-conf.d/vhost-name.conf

    //添加如下内容


    ServerName www.xxx.com
    DocumentRoot /var/www/html/www/


    Requireall granted


    ServerName aaa.xxx.com
    DocumentRoot /var/www/html/aaa/


    Require ip 192.168.188.0/24 //可以设置访问限制

    ##############################################3
    另外一个例子

    #端口自定
    ServerAdmin xxx@mail.com
    DocumentRoot “绝对路径”
    ServerName localadm
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common


    ServerAdmin 邮箱
    DocumentRoot “绝对路径”
    ServerName localadm
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common

  • CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)

    准备篇:
    CentOS 7.0系统安装配置图解教程
    http://www.osyunwei.com/archives/7829.html
    一、配置防火墙,开启80端口、3306端口
    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
    1、关闭firewall:
    systemctl stop firewalld.service #停止firewall
    systemctl disable firewalld.service #禁止firewall开机启动
    2、安装iptables防火墙
    yum install iptables-services #安装
    vi /etc/sysconfig/iptables #编辑防火墙配置文件
    # Firewall configuration written by system-config-firewall
    # Manual customization of this file is not recommended.
    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
    -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
    -A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
    -A INPUT -j REJECT –reject-with icmp-host-prohibited
    -A FORWARD -j REJECT –reject-with icmp-host-prohibited
    COMMIT
    :wq! #保存退出
    systemctl restart iptables.service #最后重启防火墙使配置生效
    systemctl enable iptables.service #设置防火墙开机启动
    二、关闭SELINUX
    vi /etc/selinux/config
    #SELINUX=enforcing #注释掉
    #SELINUXTYPE=targeted #注释掉
    SELINUX=disabled #增加
    :wq! #保存退出
    setenforce 0 #使配置立即生效
    安装篇:
    一、安装Apache

    系统运维  www.osyunwei.com  温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链
    yum install httpd #根据提示,输入Y安装即可成功安装
    systemctl start httpd.service #启动apache
    systemctl stop httpd.service #停止apache
    systemctl restart httpd.service #重启apache
    systemctl enable httpd.service #设置apache开机启动
    在客户端浏览器中打开服务器IP地址,会出现下面的界面,说明apache安装成功

    系统运维  www.osyunwei.com  温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链
    二、安装MariaDB
    CentOS 7.0中,已经使用MariaDB替代了MySQL数据库
    1、安装MariaDB

    yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成
    systemctl start mariadb.service #启动MariaDB
    systemctl stop mariadb.service #停止MariaDB
    systemctl restart mariadb.service #重启MariaDB
    systemctl enable mariadb.service #设置开机启动
    cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
    2、为root账户设置密码

    mysql_secure_installation
    回车,根据提示输入Y
    输入2次密码,回车
    根据提示一路输入Y
    最后出现:Thanks for using MySQL!
    MySql密码设置完成,重新启动 MySQL:
    systemctl restart mariadb.service #重启MariaDB
    三、安装PHP
    1、安装PHP

    yum install php #根据提示输入Y直到安装完成
    2、安装PHP组件,使PHP支持 MariaDB
    yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
    #这里选择以上安装包进行安装,根据提示输入Y回车
    systemctl restart mariadb.service #重启MariaDB
    systemctl restart httpd.service #重启apache
    配置篇
    一、Apache配置
    vi /etc/httpd/conf/httpd.conf #编辑文件
    ServerSignature On  #添加,在错误页中显示Apache的版本,Off为不显示
    Options Indexes FollowSymLinks  #修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)
    #AddHandler cgi-script .cgi #修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
    AllowOverride None  #修改为:AllowOverride All (允许.htaccess)
    AddDefaultCharset UTF-8 #修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)
    #Options Indexes FollowSymLinks   #修改为 Options FollowSymLinks(不在浏览器上显示树状目录结构)
    DirectoryIndex index.html   #修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php(设置默认首页文件,增加index.php)
    MaxKeepAliveRequests 500  #添加MaxKeepAliveRequests 500 (增加同时连接数)
    :wq! #保存退出
    systemctl restart httpd.service #重启apache
    rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页
    二、php配置
    vi /etc/php.ini #编辑
    date.timezone = PRC #把前面的分号去掉,改为date.timezone = PRC
    disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
    #列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
    expose_php = Off #禁止显示php版本的信息
    short_open_tag = ON #支持php短标签
    open_basedir = .:/tmp/  #设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题(例如:织梦内容管理系统),可以注销此行,或者直接写上程序的目录/data/www.osyunwei.com/:/tmp/
    :wq! #保存退出
    systemctl restart mariadb.service #重启MariaDB
    systemctl restart httpd.service #重启apache
    测试篇
    cd /var/www/html
    vi index.php #输入下面内容

    :wq! #保存退出
    在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息!

    注意:apache默认的程序目录是/var/www/html
    权限设置:chown apache.apache -R /var/www/html
    至此,CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)教程完成!