码迷,mamicode.com
首页 > 数据库 > 详细

安装mariadb和apache

时间:2018-05-25 11:05:13      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:apache安装

安装mariadb(二进制免编译包)
  • cd /usr/local/src
  • wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
  • tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
  • mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
  • cd /usr/local/mariadb
  • ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb
  • cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
  • vi /usr/local/mariadb/my.cnf //定义basedir和datadir,如果这里不定义的话,由于以前安装过mysql,mysql服务启动就会调用/etc/my.cnf里的datadir,下面的服务数据库就会出错
    vi /usr/local/mariadb/my.cnf
    # The MySQL server
    [mysqld]
    basedir         = /usr/local/mariadb
    datadir         = /data/mariadb
    port            = 3306
    [root@akuilinux01 mariadb]# ps aux |grep mysql
    root      1838  0.2  0.0 115388  1748 ?        S    21:41   0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mariadb --pid-file=/data/mariadb/akuilinux01.pid
    mysql     1960  2.7  3.0 1649312 57884 ?       Sl   21:41   0:00 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mariadb --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb/akuilinux01.err --pid-file=/data/mariadb/akuilinux01.pid --socket=/tmp/mysql.sock --port=3306
    root      1999  0.0  0.0 112676   984 pts/0    S+   21:41   0:00 grep --color=auto mysql
  • cp support-files/mysql.server /etc/init.d/mariadb
  • vim /etc/init.d/mariadb //定义basedir、datadir、conf以及启动参数
    如果不是同时安装mysql和mariadb,就不用定义conf

    basedir=/usr/local/mariadb
    datadir=/data/mariadb
    conf=$basedir/my.cnf
    # may be overwritten at next upgrade.
      $bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" &
  • /etc/init.d/mariadb start

安装Apache

  • Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache
  • Apache官网www.apache.org
  • wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33 .tar.gz
  • wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
  • wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
  • apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows)
  • tar zxvf httpd-2.4.26.tar.gz
  • tar zxvf apr-util-1.5.4.tar.gz
  • tar zxvf apr-1.5.2.tar.gz
  • cd /usr/local/src/apr-1.5.2
  • ./configure --prefix=/usr/local/apr
  • make && make install
  • cd /usr/local/src/apr-util-1.5.4
  • ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  • make && make install
  • cd /usr/local/src/httpd-2.4.27
  • //enable-so支持动态扩展模块,最后一个是支持大多数动态模块 这里的反斜杠是脱义字符,加上它我们可以把一行命令写成多行

    ./configure \--prefix=/usr/local/apache2.4 \--with-apr=/usr/local/apr \--with-apr-util=/usr/local/apr-util \--enable-so \--enable-mods-shared=most
    \\ 指定支持大多数模块
    configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
    [root@aminglinux-01 httpd-2.4.27]# yum install -y pcre-devel
  • make && make install
  • ls /usr/local/apache2.4/modules //动态模块目录
  • /usr/local/apache2.4/bin/httpd -M //查看加载的模块 或者/usr/local/apache2.4/bin/apachectl -M
  • /usr/local/apache2.4/bin/apachectl start //启动命令
  • 启动错误
    [root@akuilinux01 ~]# /usr/local/apache2.4/bin/apachectl start
    httpd: Could not open configuration file /usr/local/apache2/conf/httpd.conf: No such file or directory
    [root@akuilinux01 ~]# mkdir -pv /usr/local/apache2/conf/
    mkdir: 已创建目录 "/usr/local/apache2"
    mkdir: 已创建目录 "/usr/local/apache2/conf/"
    [root@akuilinux01 ~]# ln -s /usr/local/apache2.4/conf/httpd.conf /usr/local/apache2/conf/httpd.conf
    [root@akuilinux01 ~]# /usr/local/apache2.4/bin/apachectl start
    AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using fe80::68fd:e6fa:c781:f5a6. Set the ‘ServerName‘ directive globally to suppress this message
    [root@akuilinux01 ~]# ps aux |grep httpd
    root      1475  0.0  0.1  95496  2512 ?        Ss   23:16   0:00 /usr/local/apache2.4/bin/httpd -k start
    daemon    1476  2.9  0.3 382324  6464 ?        Sl   23:16   0:00 /usr/local/apache2.4/bin/httpd -k start
    daemon    1477  3.4  0.3 382324  6464 ?        Sl   23:16   0:00 /usr/local/apache2.4/bin/httpd -k start
    daemon    1478  3.4  0.3 382324  6464 ?        Sl   23:16   0:00 /usr/local/apache2.4/bin/httpd -k start
    root      1561  0.0  0.0 112676   980 pts/0    S+   23:16   0:00 grep --color=auto httpd

    扩展

  • apache dso
  • apache apxs
  • apache工作模式

安装mariadb和apache

标签:apache安装

原文地址:http://blog.51cto.com/akui2521/2120085

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!