APACHE安装,


九周第三次课(9月27日)

11.6 MariaDB安装

11.7/11.8/11.9 Apache安装

扩展

4

下载MariaDB

wget  http://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.2.8/bintar-linux-x86_64/mariadb-10.2.8-linux-x86_64.tar.gz

 解压

wKioL1nMU9SwrP8zAAA_zh1dNjM715.png

初始化

wKiom1nMVBzibwyRAAAx12kaRv4537.png

成功

wKiom1nMVCPwwwxOAAAKFy2qaG0613.png

拷贝配置文件

cp support-files/my-small.cnf /usr/local/mariadb/

这里需要根据自己的机器配置选择small或者large配置文件

修改配置文件

$bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" &

这里加上--defaults-file="$conf" 指定启动脚本配置文件的路径。

另外

basedir=/usr/local/mariadb

datadir=/data/mariadb

conf=$basedir/my.conf

这里填写指定的路径

启动mariadb 成功

wKioL1nMU-_gf_g2AAUWJg0tlCE896.png

由于没有指定配置文件,并且存在mysql 所以会取读取my.cnf里面的datadir

修改配置文件

vim /usr/local/mariadb/my-small.cnf 

datedir /data/mariadb


安装Apache

apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows)

下载需要的安装包

http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz

http://mirrors.hust.edu.cn/apache/apr/apr-1.6.2.tar.gz

wget  http://mirrors.cnni.cn/apache/httpd/httpd-2.4.25.tar.gz

安装apr-apr-util

cd /usr/local/src/apr-util-1.5.4

 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

 make && make install

 安装 apr-util-1.6.0

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

make && make install

安装的时候提示错误.需要安装expat-devel

yum install expat-devel  安装这个模块后就可以安装apr-util


make && make install

又提示错误

解决办法:

在configure后加上 “--with-included-apr”。再重新编译, make, make install. 即可。

./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most --with-include-apr

问题又来了,加上--with-included-apr之后,编译,报错如下:

configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

错误为:apr,apr-util缺失,需要下载并解压到./srclib/目录下

解决办法:

# cd /usr/local/src/

# cp -r apr-1.5.2 /usr/local/src/httpd-2.4.7/srclib/apr

# cp -r apr-util-1.5.4 /usr/local/src/httpd-2.4.7/srclib/apr-util

再次执行./configure就不会报错,make,make install也不会报错;

安装完之后查看

apache安装后里面的文件

第四步 启动apache          /usr/local/apache2.4/bin/apachectl  start

关闭apache              /usr/local/apache2.4/bin/apachectl  stop


本文转自 zfno11 51CTO博客,原文链接:http://blog.51cto.com/zfno111/1969321


相关内容