九周第三次课(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
解压
650) this.width=650;" src="https://s1.51cto.com/wyfs02/M01/A6/4A/wKioL1nMU9SwrP8zAAA_zh1dNjM715.png" title="1.png" alt="wKioL1nMU9SwrP8zAAA_zh1dNjM715.png" />
初始化
650) this.width=650;" src="https://s5.51cto.com/wyfs02/M02/07/98/wKiom1nMVBzibwyRAAAx12kaRv4537.png" title="2.png" alt="wKiom1nMVBzibwyRAAAx12kaRv4537.png" />
成功
650) this.width=650;" src="https://s5.51cto.com/wyfs02/M00/07/98/wKiom1nMVCPwwwxOAAAKFy2qaG0613.png" title="3.png" alt="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 成功
650) this.width=650;" src="https://s3.51cto.com/wyfs02/M02/A6/4A/wKioL1nMU-_gf_g2AAUWJg0tlCE896.png" title="4.png" alt="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
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/282A3EDA7A12429DB07C575A484F2BDB/6631" style="height:auto;margin-top:8px;border:0px;" />
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/1BF74FFEB82C4F218F0F60C5AAF2211A/6639" style="height:auto;margin-top:8px;border:0px;" />
make && make install
又提示错误
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/1FFCB2A741E64B91A61AA9348938D7A4/6632" style="height:auto;margin-top:8px;border:0px;" />
解决办法:
在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
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/453CB506F9144AC08A8FE767C6A27352/6628" style="height:auto;margin-top:8px;border:0px;" />
问题又来了,加上--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
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/2E40DF7C78724486949CC049871780E9/6633" style="height:auto;margin-top:8px;border:0px;" />
再次执行./configure就不会报错,make,make install也不会报错;
安装完之后查看
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/3DC88F304DF0435092F57CD99EF21F17/6629" style="height:auto;margin-top:8px;border:0px;" />
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/0FAC1847CE0B41E4B567237CF7ADFB3A/6627" style="height:auto;margin-top:8px;border:0px;" />
apache安装后里面的文件
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/FD14E05F021E413198388EEE8BECC3EC/6638" style="height:auto;margin-top:8px;border:0px;" />
第四步 启动apache /usr/local/apache2.4/bin/apachectl start
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/2427D95123E84825A2F7860C6D19C2C3/6635" style="height:auto;margin-top:8px;border:0px;" />
关闭apache /usr/local/apache2.4/bin/apachectl stop
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/30CB1EEAEECB4908952B284D559FEF9E/6637" style="height:auto;margin-top:8px;border:0px;" />
650) this.width=650;" ?src="http://note.youdao.com/yws/public/resource/510510d68f12f193685fa7898b3f50be/xmlnote/E4F02328014C431DB7EA3518F8E782F8/6630" style="height:auto;margin-top:8px;border:0px;" />
APACHE安装
原文地址:http://zfno111.blog.51cto.com/10527763/1969321